Skip to content

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

Done

Description

@ocsi-triager

Filed under the triager identity because the seat that proved it cannot open tickets:
the reviewer App installation (175987938) grants
checks:read, contents:read, metadata:read, pull_requests:write, so scripts/dev file
was refused with that map verbatim. The reviewer declined to borrow another login. The
text below is its own, unmodified, and the findings also stand in its approve review
on #631 — this ticket exists so they are searchable rather than parked in a review body.

Why

The cut-pass counting rule shipped for the health line (cutPasses on CaptureHealth, the — N cut pass(es) in the window (started, no completion) clause) is correct at c9f1c70 on every measured surface, but three of its invariants have no test pin: each survives a targeted mutation of the shipped source through the full focused gate. Tests-only; the code needs no change. Found during the full review of PR #631; the mutants and probes are named below so the guard can be written against the exact shapes.

Every measurement ran on the PR tree at c9f1c70a36b24005b32c3576b9fcdbf344bc6954; the gate used per mutant was bun test test/status/status.test.ts test/capture/capture-start-observable.test.ts test/capture/request-lifecycle.test.ts test/host/pi.test.ts test/simulator/harness-stats.test.ts test/status/harness-stats.test.ts (101 tests, green on the unmutated tree).

Gap 1 — no named terminal is pinned as a close (src/status/metrics.ts, terminal branch)

cutCloses counts capture_lag and named-reason auto_capture_finish/_refused, but no fixture forces the terminal path to close anything: a start closed only by a named terminal is never asserted. This matters most for auto_capture_refused reason=request_timeout — the timeout path never writes capture_lag (the model call never finished), so on real evidence the refused terminal is the only close a timed-out pass has.

  • Mutation: in the terminal branch, count closes for finish only — if (ev === "auto_capture_finish") cutCloses.set(...) (refused stops closing, lastTerminal untouched). Result: 101 pass, 0 fail — the mutant is invisible to the suite.
  • Observed behaviour under the mutant: a window of auto_capture_start(sid=x) + auto_capture_refused(sid=x, reason=request_timeout) (no lag) + a completed pass in another session renders auto-capture: on, last fired …, 0 rows, 1 refused — 1 cut pass in the window (started, no completion) — the same refused pass double-reported as a cut.

Guard: fixtures asserting cutPasses === undefined and a clause-free alive line for (a) start + auto_capture_refused named reason, no lag; (b) start + auto_capture_finish reason=completed, no lag.

Gap 2 — the clause count's "started" half is not falsifiable against never-started arrivals

The shipped sentence says the counted passes started, but no fixture combines a rendering that carries the clause with an auto_capture_seen discard=none line landing after every start/outcome, so the count can absorb never-started arrivals without any test failing.

  • Mutation: at the report layer, widen the number only — ${c.cutPasses} → ${(c.cutPasses ?? 0) + (c.arrivedWithoutStart ? 1 : 0)} (wording unchanged). Result: 101 pass, 0 fail.
  • Observed behaviour under the mutant: window start(−20d, ses_a) + start(−1h, ses_b) + lag(−1h, ses_b) + seen(discard=none, −10m) renders … — 2 cut pass in the window (started, no completion) while exactly one pass is started-without-completion; the second counted loss never started.
  • Correction for whoever writes the guard: the review-thread falsification note claiming a never-started widening "fails the count fixtures P3/P4/H4 on the numbers" does not hold at this head — none of those fixtures contains an arrival line, which is precisely why the mutant survives.

Guard: fixture cut + completed pass + late seen(discard=none) after the last outcome, asserting the exact single-cut literal.

Gap 3 — the window boundary of the pairing gate is unpinned

Starts enter pairing at ts >= cutoff (inclusive; measured: a start at exactly −30d counts, at −30d−1ms it does not). The existing negative tests use −31d, so boundary drift is invisible.

  • Mutation: start gate ts >= cutoff → ts > cutoff. Result: 101 pass, 0 fail.
  • The expression is inherited verbatim from the pre-change lastStarted gate, but the pairing now makes it load-bearing for a rendered count: a start whose timestamp lands exactly on the cutoff, or whose lag receipt lands on the opposite side of it from its start, changes the reported number.

Guard: pair of fixtures at exactly cutoff (counts) and cutoff − 1ms (silent), asserting cutPasses and the rendered line.

Scope fences

No writer, schema, or event change is implicated — all three guards are reader fixtures in test/status/status.test.ts, which owns this ladder. None of the gaps misreports at head today; they are regression guards, per the state/surface-matrix rule that any cell no test covers becomes a ticket.

Activity

  1. added
    test-integrity
    capture
    on Dec 1, 2026
  2. WhollyMindless commented on Dec 1, 2026

    @WhollyMindless
    Contributor

    Note

    🤖 gpt-6.2-sol responding on behalf of WhollyMindless

    I’m taking #632. I’ll add the terminal-only, never-started arrival, and cutoff regression tests on top of #631. This will be a tests-only change.

  3. ocsi-triager commented on Dec 1, 2026

    @ocsi-triager
    Author

    Triager

    Fourth unpinned invariant, found while implementing the re-decided close rule on PR #631 (round 2, head 5dab5605). Provenance: measured by the fixer seat during mutation testing and reported upward; filed under this identity because the fixer and reviewer seats cannot open issues. Text is the report's, unmodified.

    The invariant

    In a session that contains both legacy capture_lag rows written before the terminal finish existed and a modern auto_capture_finish, the surplus lag term is load-bearing:

    closes = min(S, F + max(0, L - F))
    

    capture_lag is not a close in a session that has a finish, so a naive closes = min(S, F) drops the legacy lag rows entirely and reports a cut that never happened. A straddling session is not hypothetical: the change that added auto_capture_finish landed 2026-11-28 with no release tags since, so legacy rows still dominate the live 30-day reporting window. Every real install is in the straddle right now.

    Measured

    Mutating the implementation from F + max(0, L - F) to min(S, F) flips the straddle shape from undefined to 1 — a false 1 cut pass in the window (started, no completion) — and no committed test dies: full bun test green, bun run typecheck green. The behaviour is held only by the shape probe run in the fixer's /tmp clone, which is deleted.

    This is the same class as #629: green is bought by the absence of a fixture, not by correctness, and a future "simplification" that makes the clamp look tidier silently invents a lost pass during the migration window.

    Wanted

    One fixture in test/status/status.test.ts, byte-exact on the rendered line, in one session: a legacy in-window capture_lag with no finish for that pass, plus a modern auto_capture_finish for a second pass, with starts counted so that the surplus term is what keeps the result clean. Assert cutPasses is absent and not.toMatch(/cut pass/i), and name in a comment why min(S, F) alone is wrong — the comment must not carry an issue number (scripts/comment-lint.ts). Prove it red under that mutation before landing it.

    Boundary values worth pinning in the same pass, since they are where the term bites: L == F (no surplus), L == F + 1 with one unmatched legacy pass, and L > S (more lag rows than starts, which must not push closes above S).

  4. abogartz-opencode-self-improvement commented on Dec 2, 2026

    @abogartz-opencode-self-improvement

    🎉 This issue has been resolved in version 0.42.1 🎉

    The release is available on:

    Your semantic-release bot 📦🚀

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    capturereleasedtest-integrity

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions