Pin the capture-scope timeout floor, not just its wiring - #182
Merged
Conversation
The test added last round has the stub answer after a real 40 ms, which proves the preflight waits for its own answer. It does not pin how long. CAPTURE_SCOPE_TIMEOUT_MS = 45 typechecks clean and leaves the whole suite green, and 45 ms aborts every real preflight there has ever been: measured over 1,271 production requests, p50 is 472 ms, p95 1,269 ms, p99 1,682 ms and max 8,419 ms. Every abort fails open, so the symptom is silence. A fixture can only pin a boundary it happens to straddle, so the constant is exported and pinned from outside instead, as a floor rather than an equality. Raising the bound stays free; lowering it past the line is the defect. An equality would fail on any deliberate retune and teach the next person to edit the test in the same commit. Bisected, every value typecheck-clean: 0 fails twice, 45 and 4999 fail the floor, 5000 and 10_000 pass. Full suite 954 pass, 0 fail.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
A 40 ms fixture pins the bound at "above 40 ms", and 45 ms is a live defect
The test added in #181 proves the preflight waits for its own answer, by having the stub take a real 40 ms. That pins the wiring. It does not pin the magnitude, and a post-merge validator on the app side found the gap:
CAPTURE_SCOPE_TIMEOUT_MS = 45typechecks clean and leaves the whole cli suite green.45 ms aborts every real preflight there has ever been. Measured server-side over 1,271 production requests to this endpoint:
Every abort fails open by design, so the symptom is silent: captures are sent without asking whether the repository was excluded, and from the outside that is indistinguishable from the server having said "capture".
This is the fixture-grid trap in general form — a fixture can only ever pin a boundary it happens to straddle. So the constant is now exported and pinned from outside, as a floor rather than an equality: raising it is free, lowering it below the line is the defect. Equality would fail on any deliberate retune and teach the next person to edit the test in the same commit, which is how a guard becomes a formality.
Bisected across the floor, every value typecheck-clean
CAPTURE_SCOPE_TIMEOUT_MS0454999500010_000(shipped)Full
cli/src/*.test.ts: 954 pass / 0 fail.tsc -p cli/tsconfig.json: clean.The behavioural test stays as it is. It proves the request actually waits; this one proves it waits long enough to matter. Neither is sufficient alone: the behavioural test misses 45, and the floor alone would pass on a bound that was never wired to the fetch at all.
Reasoning
written by the agent in-session via
backthread/add-reasoning-to-prsDecisions
Trade-offs
Limitations