Skip to content

test(status): pin cut-pass counting boundaries - #633

Open
WhollyMindless wants to merge 3 commits into
abogartz:mainfrom
WhollyMindless:test/632-cut-pass-guards
Open

WhollyMindless wants to merge 3 commits into
abogartz:mainfrom
WhollyMindless:test/632-cut-pass-guards

Conversation

@WhollyMindless

@WhollyMindless WhollyMindless commented Dec 1, 2026 •

Copy link
Copy Markdown
Contributor

Closes #632. The cut-pass counter landed in #631, and this PR adds the remaining five regression tests on top of main.

  • Verify that a timeout refusal and a completed terminal receipt each close a started pass without a lag receipt.
  • Verify that a later arrival without a start leaves the rendered cut count at one.
  • Pin a start exactly at the reporting cutoff and one millisecond before it.

Validation on Windows with Bun 1.4.4: 124 focused tests passed, and typecheck passed. Before the branch update, five targeted mutations each failed their intended fixture.

@WhollyMindless
WhollyMindless changed the base branch from autofix/abogartz_opencode-self-improvement-1796118324962 to main December 1, 2026 23:06

@ocsi-reviewer ocsi-reviewer 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.

APPROVE — head 9170d902dca97a1898533df258b08280e09315f1. One required step before merge: rebase onto current main (c8ff1e2); details in §4. This review approves the content at the head named above; it does not merge and does not change the title, description, or state.

1. Shape pass (disclosed per our outside-contribution process)

No architect artifact runs on a contributor path, so before opening the diff, this PR's body, or any comment I wrote a pre-diff analysis from the #632 ticket body alone (body-only route, not the thread) and the tree at c8ff1e2, and kept it as an artifact. I enumerated the invariants any guard set must hold (non-vacuity against the exact mutants #632 names, exact-boundary placement, whole-line render assertions, no accidental vacuity from rows silently dropping out), and two shapes that could replace fixture-by-fixture pins: a table-driven case bank for the whole cut-pass block, and a seeded differential property test against an independently written reference model of the rule.

Your shape — three guards as two test.each pairs plus one standalone test, whole-line captureLines literals — sits inside the space I wrote down (the table form applied locally to the new guards). Two of my pre-diff predictions were wrong, and they are the evidence the space was independent: I predicted this PR would most likely duplicate the clamp/surplus fixtures the #631 block already carries (it duplicates none), and I predicted that guards written from #632's pre-round-5 cutCloses framing might pin values that only hold under the superseded rule (every value here holds under the landed rule).

2. Every expected value, derived against the landed rule

The rule on main (after #631 round 5) is, per session in the window,

closes = F > 0 ? min(S, F + max(0, L − C) + max(0, R − (F − C)))
               : min(S, L + R)
cutPasses = Σ (S − closes)

with F/C named finishes (all / completed), L lag rows, R named non-grant refusals. Your five cases, derived independently rather than read off a green run:

case per-session receipts derivation expected asserts
1a ses_b: S=1, R=1 (request_timeout) F=0 branch: min(1, 0+1)=1 cutPasses undefined, no clause ✓
1b ses_b: S=1, F=1, C=1, L=0 min(1, 1+max(0,0−1)+max(0,0−0))=1 undefined, no clause ✓
2 ses_a: S=1; ses_b: S=1, L=1; ses_c: arrival only 1−0 + 1−min(1,1) = 1; ses_c never enters cutStarts, so it cannot contribute; arrivedWithoutStart true (seen at −10m > last outcome −1h) 1, clause literal 1 cut pass ✓
3a start at exactly now−30d, ses_b healthy at(30*86_400) stringifies to exactly the cutoff string; ts >= cutoff admits it → S=1, no close 1 + clause ✓
3b same start 1 ms earlier below cutoff → excluded → only healthy ses_b undefined, no clause ✓

The full-suite run at your head is green here as well: the focused file goes 90 → 95, 0 fail; tsc --noEmit clean; CI green on all eleven checks at this head.

Direct answer to "is my boundary already pinned": no. I walked all twenty fixtures of the #631 block on main (test/status/status.test.ts:818-1355) before reading yours. The nearest neighbours are each a different assertion: :898 is a completed pass with a lag row — yours (1b) is the lag-free twin, and §3 shows it is the only test in the repository that notices a missing finish; :1059 is the grant-refusal with the opposite polarity; :861 tests −31 days, not the edge; the window you reuse from P1 (:919) gains the seen line and the whole-line count literal, which nothing there asserts. There is no overlap to fold away.

One honest correction against the ticket, in your favour: #632 wrote its Gap-1 mutant against c9f1c70, before round 5 changed the pairing. On current main that mutant ("refusals stop closing") is no longer invisible — three of #631's own round-5 fixtures die on it — but the bare start + refused pair with no lag, the exact shape real timeouts leave, is asserted nowhere until your 1a. So your work is a genuine addition even where the ticket's framing went stale under it.

3. Non-vacuity: I ran your mutants independently

Each mutation applied in-place to src/status/metrics.ts (or report.ts) in a throwaway clone at your head, proven landed by git diff before running, reverted after. Focused gate: bun test test/status/status.test.ts (95 tests).

mutation your intended fixture full red list
M1 — refusals stop closing (cutRefusals.set → no-op, metrics.ts:374) 1a red 1a + three round-5 fixtures (:1263, :1287, :1334)
M2 — finishes stop counting (cutFinishes.set → no-op, :370) 1b red only 1b
M3 — report widens the count (${c.cutPasses} → + arrivedWithoutStart, report.ts:233) 2 red only 2
M4 — start gate exclusive (ts >= cutoff → >, :342) 3a red only 3a

M2, M3 and M4 are exclusive kills: across the whole focused file, your pin is the single thing standing between the mutant and a green gate. That is the load-bearing property this repo audits for, and all three guards from #632 pass it here. Within M1, 1a is the only fixture pinning the bare refused pair; the other three deaths are the round-5 surplus-refusal fixtures. Nothing here passes under both the correct rule and a broken one — and because each fixture carries at most one receipt class per session, none of the five can accidentally encode the pre-round-5 shared-budget rule: the two rules provably agree on every window you built (the terms that differ only bite with ≥2 receipt rows in one session), which is the right property — your invariants are orthogonal to the round-5 refinement, not copies of it.

4. The rebase is required — and it is not where you break

mergeable_state=behind because main moved one commit past your merged-in base: c8ff1e2 chore(release): 0.41.3, which touches only the version line in package.json. Your merge commit 9170d90 already carries both semantic predecessors — #631 round 5 (fd75fbf) and #626 (affc683) — so nothing about the rule or the capture-outcome labels changes. I simulated the rebase on my side: it replays as one clean linear commit onto c8ff1e2, the focused file passes 95/0, typecheck clean. Please rebase (rather than merge again) and push; the assertions survive it — the rebase is not where they break. A second merge commit would keep the branch behind-shaped for no gain; if the rebase were somehow conflicted, it would have to be over this file's :914 insertion point only, and my simulation says it is not.

5. Nits, none blocking

  • The inclusive edge is pinned for the start gate only; the capture_lag gate (metrics.ts:331) and the finish/refused gate (:351) carry their own ts >= cutoff and keep their −31d-only coverage. That matches #632's stated scope exactly (it cited the start-gate mutant), so I am not asking for more here — noting it as the next open cell for whoever likes these.
  • 3b is a control case (it would also pass under an exclusive gate); that is correct pair design — 3a carries the bite — just flagging that the pair, not 3b alone, is the pin.

Your PR body's claims match the diff at this head: five cases, three guards, and the mutation claims reproduce independently as tabulated above.

— reviewer seat (ocsi-reviewer), verified against the tree at 9170d90 and c8ff1e2, not against the conversation.

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.

cut-pass counting has three unpinned invariants, each invisible to the gate

2 participants