Skip to content

C4 design section 4: compound range form unimplemented and day form unreachable in the shared formatter #13357

Open

Description

@dezren39

Found while landing the C4.2 reset-duration builder (#13258, PR #13352), comparing the C4 design's §4 against the shipped shared formatter.

Design (doc/2026-11-13T15-12-00Z_design_reporting-architecture-event-driven/c4-forecasting-design.md §4):

  • "mixed spans render compound: "2 days 4 hours to up to 3 days 16 hours"" — no landed code produces this form. renderPredictionRange in pm-stack/aggregator/src/quota-downtime.ts (the formatter C4.1 shipped and C4.2 now reuses) implements only the duration form, the decimal day form, and the calendar form.
  • The day form ("2.5 to 3.7 days") is specified for "span ≥ 48h", but in the shipped formatter the cross-day calendar check runs before the span check, and any range ≥48h wide necessarily crosses a Chicago day boundary — so the day-form branch is unreachable as ordered. (It can only fire for a ≥48h-wide range whose bounds share a Chicago calendar day, which cannot exist.)

Question for the design owner (#9572): is §4's text or the shipped formatter the intended behaviour?

  • If the formatter is right, §4's compound example and the day-form condition should be corrected in the design record so future C4 kinds don't re-derive them.
  • If the design is right, the formatter needs a compound form and a check order that lets the day form fire — a methodology-visible change (records' stored rendered strings are what the scorer grades, design §1), so it should ride a methodology-log entry (§6), not a silent edit.

Neither blocks #13258: C4.2 reuses the one shared formatter per §4's "produced by one formatter" rule rather than forking a second interpretation.

{
  "direct_parent": null,
  "links": [],
  "lineage": {
    "design": null,
    "roadmap_item": null,
    "priority": null
  },
  "pm_meta": 1,
  "provenance": {
    "queue_id": null,
    "scheduled_start": null,
    "picked_up_at": null,
    "work_started_at": null,
    "created_at": "2026-11-23T14:11:09Z",
    "session_id": null,
    "lane": null,
    "host": "htch-runtime",
    "worktree": null,
    "model": null,
    "lane_start_issues": [],
    "workspace_ref": null,
    "auth_subject": "archer",
    "stamped_by": "fleet 0.1.0 (native)"
  }
}

Activity

  1. developing-today commented on Nov 23, 2026

    @developing-today
    Contributor
  2. dezren39 commented on Nov 23, 2026

    @dezren39
    MemberAuthor

    Lane ZV picking this up for premise verification and options analysis.

    Note: the issue is framed as a question for the design owner (#9572) — whether §4's text or the shipped formatter is the intended behaviour — and no decision is on record in this thread. Plan: verify the defect first-hand against the shipped formatter, post an options analysis with ramifications and a recommendation, and stand down for the owner's call rather than guess the intended behaviour.

  3. dezren39 commented on Nov 23, 2026

    @dezren39
    MemberAuthor

    Lane ZV — premise verification + options analysis (standing down for the owner's decision)

    Premise verdict: TRUE, verified first-hand at current main

    renderPredictionRange in pm-stack/aggregator/src/quota-downtime.ts (the C4.1 formatter, #13257) orders its checks:

    1. earliest/latest on different Chicago calendar days → calendar form
    2. span ≥ 48h → day form
    3. earliest ≤ issued → calendar form
    4. else → duration form

    A Chicago calendar day is 23–25h long, so any two instants ≥48h apart necessarily carry different day keys — check 1 always fires first and the day-form branch at check 2 is unreachable, exactly as filed. Live demonstration against the shipped code (issued Mon 2026-11-23 06:00 CST):

    • earliest +48h, latest +96h (span 48h) → "between Wednesday morning and Friday morning" (calendar form — not §4's day form, not compound)
    • earliest +72h, latest +144h (span 72h) → "between Thursday morning and Sunday morning" (calendar form)

    No branch in the formatter produces the compound form ("2 days 4 hours to up to 3 days 16 hours"). The existing tests pin only the calendar and duration forms.

    Additional verified findings the decision should reckon with

    • There are two shipped formatters with this name, diverging in opposite directions. quota-arrival.ts (C4.4, C4.4 — New model / plan arrival predictions (watch-based, honesty-first) #13260, model/plan arrival records) exports its own renderPredictionRange (millisecond args): span check only, no calendar form at all — its day form does fire and is test-pinned ("between 2.5 and 5.7 days from now"). §4 says rendered is "produced by one formatter"; the shipped reality is two, and neither implements the compound form.
    • §4 contradicts itself, not just the code. The day-form bullet assigns span ≥ 48h to the day form, but the calendar-form bullet says the calendar form is "preferred for downtime windows and any range whose latest bound falls on a different day than its earliest" — which covers every ≥48h range. Both bullets cannot govern downtime windows at once; one must yield.
    • Even where the day form fires, its shape differs from §4's example. §4: "2.5 to 3.7 days". Arrival formatter: "between 2.5 and 5.7 days from now".
    • Adjacent, out of this issue's scope but worth the owner's eye: §4 specifies the formatter input as (earliest, latest, likely, issued_at); neither shipped formatter takes a likely bound.

    The decision (design owner, #9572)

    Option A — the shipped downtime behaviour is intended; correct §4.
    Rewrite the day-form bullet so it no longer promises a form downtime windows can't produce, drop or re-scope the compound example, and restate the "one formatter" sentence to match the two shipped implementations.
    Ramifications: docs-only; no methodology impact; stored records and scoring continuity untouched. Cost: the compound form dies as a design idea unless another kind adopts it; §4 keeps kind-dependent rendering implicitly rather than saying so.

    Option B — §4 is intended; change the downtime formatter.
    Implement the compound form and reorder the checks so the day form can fire for ≥48h downtime ranges.
    Ramifications: methodology-visible — the stored rendered strings are what the scorer grades (§1), so this must ride a §6 methodology-log entry with a new methodology_version, never a silent edit; every ≥48h downtime prediction changes reader-facing shape (calendar dayparts → decimal/compound days); scoring comparability across the change is the owner's call. Also forces the convergence question for the arrival formatter. Largest blast radius.

    Option C — scope split (recommended).
    Amend §4 to say what the code already does, explicitly: the calendar preference governs downtime windows; the day and compound forms govern kinds whose formatter takes the span path (arrival today). Then implement the compound form in the arrival formatter for mixed spans, where the day form already fires — with a §6 entry if the owner judges the arrival rendering change methodology-visible.
    Why: §4's own calendar bullet already states the downtime preference, so the shipped downtime behaviour reads as the design's intent, not an accident; the compound form is a genuine readability gain for multi-day arrival ranges; and the amendment ends the self-contradiction instead of leaving future C4 kinds to re-derive it. Cost: kind-dependent rendering becomes permanent and must be documented as such.

    Whichever option is picked, §4's text needs editing — as written it is internally inconsistent, independent of the code.

    Disposition

    This is a genuine owner decision (the implementation shape differs materially per option, and Option B/C touch the scoring methodology), so Lane ZV is standing down without implementing and releases the item. #13357 should stay open until the owner records the choice here; the chosen option then becomes a fresh, unambiguous implementation slice. Nothing here blocks #13258 (already landed, PR #13352).

  4. dezren39 commented on Nov 23, 2026

    @dezren39
    MemberAuthor

    Lane xaltha — #13357 landed as PR #13406 (Closes #13357).

    Decision (decide-and-proceed, FDR-0013): the design is right, the formatter was wrong. Verified fresh against origin/main c8f3a5cf8: the day-form branch in the shared formatter (pm-stack/aggregator/src/quota-downtime.ts, renderPredictionRange) was provably unreachable — the cross-day calendar check ran first and every ≥48h-wide range crosses a Chicago day boundary — and no code produced the §4 compound form. The fix implements the design as written: day form (span ≥ 48h, future ranges) checked before calendar form; compound (2 days 4 hours to up to 5 days 4 hours) when either bound is not an exact tenth of a day, plain decimal days otherwise; in-progress ranges stay calendar. Methodology bumped to c4-meth:2 with a §6 log entry, since stored rendered strings are what the scorer grades.

    Evidence: failing-first remote run https://github.com/developing-today/fleet/actions/runs/45203063978 (30 pass / 3 fail — the 3 new tests each got the calendar form), verify run https://github.com/developing-today/fleet/actions/runs/45204666137 (33 pass / 0 fail). bun test src/quota-downtime.test.ts src/quota-reset-duration.test.ts via the fleet-command.yml fallback (fleet queue dispatch blocked by #13185). No local builds/tests.

    Flagged for the design owner: the design's example numbers illustrate the forms' shapes, not the threshold — "2.5 to 3.7 days" is 28.8h wide, under the 48h width rule, so under the shipped code's (and this issue's) width reading of "span" it renders calendar, not day form. If §4 meant an offset-based span, the design text needs that correction; the PR keeps the width reading both formatters already implement.

    Next slice: unify the second formatter — quota-arrival.ts has its own renderPredictionRange (duration/day only, no calendar/compound); filed as #13408.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions