Skip to content

feat(aggregator): day-type sample-sufficiency re-measure for C4.3 (#13259) - #13290

Merged
dezren39 merged 1 commit into
mainfrom
lane-wf-13259
Nov 23, 2026
Merged

dezren39 merged 1 commit into
mainfrom
lane-wf-13259

Conversation

@dezren39

@dezren39 dezren39 commented Nov 23, 2026 •

Copy link
Copy Markdown
Member

What this lands

Acceptance criterion 1 of #13259 (C4.3): the sample-sufficiency re-measure the C4 design §5 requires before any day-type adjustment may ship ("Admission is measured, not scheduled (C4.3 re-measures first)").

  • src/quota-daytype-sufficiency.ts — counts independent samples per pool/window/day-type cell over the snapshot store. A sample is one America/Chicago calendar date with ≥1 reading in the cell (readings inside one occurrence are one burn episode, not independent evidence). Cells are measured on the design's grain ladder: weekday ("other Fridays"), dayclass ("other weekends"), daypart ("same time-of-day on other days"), and weekday-daypart (the finest §5 cell). Inputs are the same rename-joined percent series the S2 accuracy harness scores (indexPercentRecords + FORECAST_WINDOW_METRICS), so the measurement and the harness agree. Gate: ≥8 samples (design §5); below it the cell's state is the design's honesty state, adjustment_unavailable.
  • scripts/quota-daytype-sufficiency.ts (+ measure:daytype-sufficiency package script) — the re-measure as a command over the live store, with the strict Design: unknown means stop — one strict argument contract for the repo's operator scripts #3352 argument contract and the backtest script's reproducibility discipline (--as-of defaults to the store, never the wall clock).
  • Tests (10, all passing) name their oracles: the §5 gate (exactly 8 admitted / 7 not; readings ≠ samples), the Stage-3 §2 arithmetic reproduced (33 days ⇒ 4–5 samples per weekday, no weekday cell admitted — the deferral verdict), the §4 America/Chicago calendar (05:00Z in November is the previous Chicago evening), and the §2 rename/window joins.

Live re-measure (2026-11-23, recorded on #13259)

Store: 20,979 records (20,011 percent readings), 2026-10-20 → 2026-11-23; 63 pool/windows; 2,583 cells.

grain admitted max samples
weekday 0 / 441 4
dayclass 12 / 126 14
daypart 39 / 252 15
weekday-daypart 0 / 1764 4

51 cells admitted, all at the coarse grains (daypart 39; dayclass-weekday 12 — no weekend cell admitted anywhere). Weekday and weekday×daypart cells sit at most 4 samples — half the gate — because per pool/window the gatherer-era series covers 19 or fewer distinct Chicago dates even in the densest pool. The adjustment slice (criterion 2) is thereby scoped to the admitted cells, and its earn-in (criterion 3) remains ahead; #13259 stays open on those.

Verification

{
  "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-23T12:56:31Z",
    "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)"
  }
}

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

…3259)

The C4 design §5 admits a day-type adjustment for a cell only when
the cell holds >=8 independent samples; below the gate the state is
adjustment_unavailable. Stage-3 deferred the models at ~4-5 samples
per weekday (33 days of store history); C4.3 re-measures first.

- src/quota-daytype-sufficiency.ts: counts independent samples
  (distinct America/Chicago dates with >=1 reading) per
  pool/window over the design grain ladder — weekday, dayclass,
  daypart, weekday-daypart — over the same rename-joined percent
  series the S2 harness scores, and renders the report.
- scripts/quota-daytype-sufficiency.ts (+ package.json script
  measure:daytype-sufficiency): the re-measure as a command over
  the live snapshot store, strict #3352 argument contract.
- Tests name their oracles: the §5 gate, the Stage-3 §2 arithmetic
  reproduced (33 days => 4-5 per weekday, no weekday cell
  admitted), the §4 Chicago calendar, the §2 rename join.

Live re-measure (2026-11-23, 20,979 records, 63 pool/windows,
2,583 cells): 51 cells admitted — all at the coarse grains
(daypart 39, dayclass-weekday 12); weekday and weekday-daypart
grains admit none (max 4 samples). The measurement is recorded on
#13259; the issue stays open on its adjustment + earn-in criteria.
@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 56 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: 532c19cc-e280-453d-96e5-b736ef5085c5
Commits

Reviewing files that changed from the base of the PR and between 5835457 and cd6dd77.

Files selected for processing: 4

  • pm-stack/aggregator/package.json
  • pm-stack/aggregator/scripts/quota-daytype-sufficiency.ts
  • pm-stack/aggregator/src/quota-daytype-sufficiency.test.ts
  • pm-stack/aggregator/src/quota-daytype-sufficiency.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-23T12:59:13.290045Z cd6dd77 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: cd6dd77cf4

ℹ️ 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".

Comment on lines +173 to +174
for (const pool of [...index.keys()].sort()) {
const series = index.get(pool) as SnapshotRecord[];

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 Aggregate sub-id history into the forecast pool before counting

When a pool's history spans its bare service ID and sub-IDs, this loop measures each indexed key separately instead of measuring the series used by the forecast and S2 harness. For example, meta:high-usage indexes as meta.highusage, but quota-forecast-accuracy.ts::pointsForWindow(index, "meta", window) includes both meta and meta.* records; its existing rename-join test explicitly verifies this behavior. Four distinct Fridays under each spelling therefore give the forecast pool eight samples, while this measurement reports two unavailable four-sample cells. Assemble each canonical forecast pool's history using the same sub-ID acceptance as pointsForWindow before applying the sufficiency gate, so the admission decision covers the series the adjustment will actually use.

Useful? React with 👍 / 👎.

@dezren39

Copy link
Copy Markdown
Member Author

🤖 Dispatch record — Lane WF

The remote dispatch of the test command (fleet-personal, run 45178649021) completed as a failure at the "Execute target command" step — the fleet-build container environment (the flag-held #13159 family: the container has no bun on PATH, the same failure Lane UT's dispatch recorded today). An environment failure is not a test result.

The verifying route is the laptop run, executed against this exact head: new suite 10/10, neighbouring quota suites 41/41 in total, strict scoped tsc clean. Merging on that evidence.

@dezren39
dezren39 merged commit e8237c0 into main Nov 23, 2026
2 checks passed
@dezren39
dezren39 deleted the lane-wf-13259 branch November 23, 2026 13:01
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.

1 participant