Skip to content

fix(pm-stack): unify quota-arrival rendering on the shared §4 formatter (#13408) - #13529

Closed
dezren39 wants to merge 1 commit into
mainfrom
lane-au6-13408
Closed

dezren39 wants to merge 1 commit into
mainfrom
lane-au6-13408

Conversation

@dezren39

@dezren39 dezren39 commented Nov 23, 2026 •

Copy link
Copy Markdown
Member

Closes #13408.

What changed (pm-stack/aggregator, 3 files):

  • src/quota-arrival.ts: the kind-local renderPredictionRange (ms-number signature, duration + day forms only) and its private helpers are deleted. The arrival builder now calls the one shared §4 formatter from quota-downtime.ts — the same formatter C4.1 downtime and C4.2 reset-duration already use — adapting both call sites from ms numbers to ISO strings. Header §4 note updated to match.
  • Methodology (§6): ARRIVAL_METHODOLOGY_VERSION bumps c4-meth:1 → c4-meth:2, with a new c4-meth:2 entry in c4-methodology-log.jsonl recording the unification and the stored-string change. The entry is scoped to the arrival kind: downtime/reset-duration already rendered via the shared formatter and keep naming c4-meth:1.
  • src/quota-arrival.test.ts: the §4-forms block now pins the shared formatter at the arrival call shape (duration form "between 4 and 6.5 hours from now"; calendar form "between tomorrow morning and Sunday afternoon"), and the detector_history record test pins the shared calendar rendering ("between Wednesday evening and this evening") plus methodology_version: c4-meth:2.

Verification (laptop worktree off main a94634c68fd):

  • bun test src/quota-arrival.test.ts src/quota-downtime.test.ts src/quota-reset-duration.test.ts — 49 pass / 0 fail.
  • bun test src/quota-forecast-alerts.test.ts src/quota-anomaly.test.ts — 27 pass / 0 fail.
  • bun x tsc --noEmit — exit 0 (after bun install in the fresh worktree; the pre-install TS2688 was the missing-types environment, not this change).
  • c4-methodology-log.jsonl parses as JSONL; both entries valid.

Oracle: the C4 design §4 ("rendered is produced by one formatter") + §6 (methodology log), and #13357's FDR-0013 decision landed by PR #13406.

— Lane AU6 (agent-note:v1)


Run Proof on this PR
Open in [code]smith · Need help on this PR? Tag @codesmith-bot with what you need.

…er (#13408)

quota-arrival.ts carried its own renderPredictionRange (ms-number
signature, duration and day forms only) beside the one shared §4
formatter in quota-downtime.ts that C4.1/C4.2 already use. Delete
the kind-local copy and its private helpers; the arrival builder
now calls the shared formatter with ISO strings at both prediction
sites.

Stored rendered strings for arrival ranges change accordingly —
the methodology-visible change the issue requires be logged, not
silent: ARRIVAL_METHODOLOGY_VERSION bumps to c4-meth:2 with a §6
entry in c4-methodology-log.jsonl scoped to the arrival kind (the
downtime and reset-duration kinds already used the shared
formatter and keep naming c4-meth:1).

Arrival tests updated to the shared renderings: the
detector_history record now pins the calendar form ("between
Wednesday evening and this evening") and methodology c4-meth:2;
the §4-forms block pins the shared formatter at the arrival call
shape (duration form + calendar form).
@coderabbitai

coderabbitai Bot commented Nov 23, 2026

Copy link
Copy Markdown

Warning

Review limit reached

You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository.

Next included review available in 45 minutes.

Check out review usage here.

View limit details

Limit details: You’ve used the included review currently available.

Learn how review limits work.

Review configuration:

Run configuration

  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: defaults
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 2cf6d845-f0b5-47df-9c40-d65f381278e0
Commits

Reviewing files that changed from the base of the PR and between c664a2f and 0844195.

Files selected for processing: 3

  • pm-stack/aggregator/c4-methodology-log.jsonl
  • pm-stack/aggregator/src/quota-arrival.test.ts
  • pm-stack/aggregator/src/quota-arrival.ts
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

Share

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Nov 23, 2026 •

Copy link
Copy Markdown
Codex Review Summary: ✅ Completed

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-11-23T17:48:38.041825Z 0844195 PR opened
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 0844195ab2

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

latest: iso(latest),
likely: iso(anchorMs + k * cad.periodMs),
rendered: renderPredictionRange(earliest, latest, issuedMs),
rendered: renderPredictionRange(iso(earliest), iso(latest), input.issuedAt),

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Preserve week information in long-horizon arrival ranges

For multiweek arrival predictions, the shared formatter loses which week each bound belongs to: it selects calendar form whenever the dates differ, but labels those dates using only weekdays. For example, a vendor cadence anchored and issued at 2026-09-01T17:00:00Z, with a 28-day period and 7-day spread, predicts September 22 through October 6 yet now stores between Tuesday afternoon and Tuesday afternoon instead of the previous unambiguous 21–35 days from now. This affects both arrival bases and makes their stored human-readable predictions ambiguous or apparently zero-width. Keep the shared formatter, but add a date-qualified or duration fallback for long-horizon ranges before routing arrivals through it.

Useful? React with 👍 / 👎.

@dezren39

Copy link
Copy Markdown
Member Author

Lane AU6 — closing this PR as superseded, per the collision resolution on #13408.

Lane AU5's claim was first on the record (17:41:33Z, ~20 s before mine — both premise checks ran against the same 1-comment state), and AU5 had in fact already written the same implementation in its worktree when my collision note posted. AU5's version landed as PR #13530 (merge 074d39603ac7); #13408 is closed. I verified the landed state on main first-hand: shared formatter imported in quota-arrival.ts, ARRIVAL_METHODOLOGY_VERSION = "c4-meth:2", exactly one c4-meth:2 entry in c4-methodology-log.jsonl. This PR's diff is the same slice and must not merge (it would duplicate the log entry).

The Codex P2 finding on this PR (long-horizon arrival ranges render ambiguously through the shared formatter's weekday-only calendar form) applies unchanged to the landed implementation — it is a property of the shared formatter, not of either diff. Filed as a follow-up issue (see #13408 outcome note for the number) rather than fixed here, since the remedy changes the one formatter for every C4 kind and belongs to the design owner's call.

@dezren39 dezren39 closed this Nov 23, 2026
@dezren39
dezren39 deleted the lane-au6-13408 branch November 23, 2026 17:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

C4: quota-arrival.ts has its own renderPredictionRange without the §4 compound/calendar forms

1 participant