Skip to content

test(#70): deterministic since-gate pin + publish-rename-since-blind (the #110 companion) - #120

Merged
abogartz merged 4 commits into
abogartz:mainfrom
WhollyMindless:test/publish-since-gate-companion
Oct 26, 2026
Merged

abogartz merged 4 commits into
abogartz:mainfrom
WhollyMindless:test/publish-since-gate-companion

Conversation

@WhollyMindless

@WhollyMindless WhollyMindless commented Oct 26, 2026 •

Copy link
Copy Markdown
Contributor

The #110 follow-up you sequenced (ruling thread): pin first, then the mutant. Three changes, one concern (the since-gate's sweep status).

What the since-gate's sweep status actually was

handoverRename's re-check (if ((await fileIdentity(file)) !== since) throw err;) had no mutant in the catalog — but that wasn't the interesting half. Applying it by hand at f4ba5dc reddened the suite, so it is killed — by two tests (logfmt.test.ts's degraded-append pin and #106's batch twin), both via setTimeout(h.release, 1500) racing the retry window's internal 2000ms deadline: a 1.33x margin. On a runner stalled past ~2s, the deadline throws the original error first, both tests read green, and a since-blind retry would have survived silently — the #110 timing-luck class, invisible precisely because a flaky mutant-kill can't pollute a baseline.

The pin (red-first, measured both ways)

A third handover test, same scenario with the margins made structural: destination touched at event-loop speed (~60ms), handle freed at 400ms — 4x inside the deadline. The shipped abort rides the identity check (fires within one backoff step, no timer matters); the blind retry publishes stale bytes by ~450ms. Measured under the exact mutation bytes: old pin red at 1516ms, new pin red at 453ms; shipped 17/0. The release-after-append shape deliberately keeps a 400ms floor between the append and any rename that could carry a stale pre-append identity check (libuv's rename dispatch adds a real JS→syscall gap, so a purely event-chained release would leave a microsecond flake window in the shipped path — this way neither the green nor the red depends on clock luck).

The catalog

  • publish-rename-since-blind — the 44th pattern (--validate 45/45, one site), killed 1/1 at f4ba5dc, killers logfmt.test.ts, supersede-batch.test.ts. The bench doc's lineage section carries the arithmetic and the margin math.
  • Drive-by, caught by --validate while calibrating: lock-default-fail's anchor is currently rotten on main — the lock: the absent-strike deadline rethrow does not mean "absent this whole time" #107 branch's now() seam moved the wait loop's bytes (that was our merge, and validate caught it the day it landed — the tool earned its keep before this PR existed). Re-anchored here, meaning unchanged, kill re-measured: 1/1 via lock-absent-holder.test.ts.

Suite 491/0/5 (main's 490 + the new pin), tsc clean, validate 45/45.

One suggestion this PR's existence proves

Nothing runs --validate in CI — that's why the lock-default-fail rot sat on main unnoticed since 16:35Z. A one-step bun scripts/test-sweep.ts --validate job (it's just byte-counting, seconds) would have caught it at the #114 merge. I left CI untouched to keep this PR single-concern; happy to fold it into #72's gate job or send it standalone.

Amended after filing (2d1f7ea): his #110 acceptance review landed while this PR was open, and its non-blocking note 1 - the kept node_modules link listing as ?? node_modules dirt, so every POSIX reset rebuilt the whole worktree (51.6s where 25s is honest) - lives in this file and this concern, so it's folded in here: the dirt comparison now filters the link's status line (Windows junctions are gitignored directories and never match; the post-fix Windows run of publish-rename-since-blind is bit-identical, killed 1/1, same killers). His note 2 (one extra run before crediting a 1-test kill) is a verdict-policy call he flagged for #72's timeline - deliberately not decided here.
Assisted by Qwen3-flash-next

…e-blind (the abogartz#110 companion)

The abogartz#110 ruling sequenced this: the anchored retry's re-check (handoverRename
aborts while the destination has moved past \since\) had no mutant, and the
two tests that DO kill a blind retry land at ~1500ms racing the window's
internal 2000ms deadline - a 1.33x margin a stalled runner can flip into a
silent survive. That's the timing-luck class abogartz#110 made a status.

- new handover test: destination touched at event-loop speed (~60ms), handle
  freed at 400ms - 4x inside the deadline. Shipped aborts on the identity
  check in ms; a blind retry publishes stale bytes by ~450ms (measured: red at
  453ms). Neither verdict waits on the deadline.
- catalog: publish-rename-since-blind (44th pattern, --validate 45/45),
  killed 1/1 (logfmt.test.ts + supersede-batch.test.ts) at f4ba5dc.
- re-anchor lock-default-fail: the abogartz#107 branch's now() seam rotted it (that
  was OUR merge; --validate caught it on main the day it landed - proof the
  tool earns keep, and that nothing runs it in CI). Killed 1/1 at the new
  anchor (lock-absent-holder.test.ts).
- doc: 43->44 lineage note + margin math; baseline 491/0/5, suite + tsc clean.
…e POSIX rebuild thrash

abogartz#110 approval note 1, reproduced on Linux: with clean -e node_modules the link
survives the clean but stays untracked-not-ignored, so every resetScratch's
status --porcelain listed '?? node_modules' and the dirt-check rebuilt the
whole worktree on EVERY reset (his macOS selftest: 51.6s where 25s is honest;
our own green legs carry the warnings). Filter the link's status line out of
the comparison - the reset's own plumbing, owned by ensureScratchLink below;
the rebuild path stays reserved for real disturbance. Windows junctions match
the gitignored node_modules/ directory rule and never surface: post-fix
Windows re-run of publish-rename-since-blind is bit-identical (killed 1/1,
same killers, no warnings).

@abogartz abogartz left a comment

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

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

Verdict: APPROVED_WITH_NITS

Verified on macOS (f4ba5dc-era claims re-measured where the platform allows; Windows-only legs checked statically + against CI logs). Every body claim that is locally checkable held; nothing was taken from the body.

What I independently confirmed

  • --validate 45/45, exit 0 — on the branch head and again after merging current main (d4e495d, i.e. what update-branch will produce): the #118 merge does not disturb any anchor, including the two this PR touches.
  • Mutant is the adjudicated shape. publish-rename-since-blind drops exactly the destination-identity recheck inside the anchored retry (if ((await fileIdentity(file)) !== since) throw err; → if (false)) — the "shape 2" from the #110 ruling, not a softer stand-in.
  • The since-gate's kill story is structurally sound. handoverRename throws immediately for !IS_WINDOWS || since === undefined (logfmt.ts:164), so on POSIX the check is never reached: I measured --mutant=publish-rename-since-blind here → survives vacuously, delta [], exactly the platform-note class. The deterministic kill therefore lives in the win32 describe + test-windows, which is honest, not hidden.
  • lock-default-fail re-anchor is behaviorally alive, not just byte-unique. Re-ran --mutant=lock-default-fail locally: 2/2 reds in lock-absent-holder.test.ts (both #107 pins). Independent platform confirmation of the re-measured kill.
  • The dirt filter is strict and works. /^\?\? node_modules\/?$/ cannot mask any other dirt (anchored both ends; nested or deeper paths don't match). Two consecutive scratch sweeps here: ~26 s/mutant, zero dirty/relink warnings in either log — the rebuild thrash from my #110 note is genuinely gone.
  • held() premises hold: openSync(file, "r") shares read/write but not delete (append-during-hold is legal, rename blocked), and release is closed-guarded so the setTimeout + finally double-release is safe.
  • CI 4/4 on head, test-windows log: 494 pass / 0 fail / 5 skip, 499 total = main's 498 + the new pin; the body's 491/0/5 is the branch-base local number and reconciles with CI's 499 after #118's tests. macOS local on merged tree: 487/0/12 of 499; tsc clean.

Nits (non-blocking)

  1. The pin trades a silent-green for a loud-red, and I'd pin the trade in writing. If a stalled runner delays the 60 ms append past the 400 ms release, the shipped code renames before the destination moves → "ok" → the test goes red on correct code. The margin is 6.7× (vs the 1.33× that motivated the PR) and the failure mode is self-reporting rather than the silent survive it replaced — acceptable, arguably right — but a one-line comment naming that residual would stop the next reader from re-introducing the old shape "for safety." (Widening to append@20 / release@600 keeps both margins ≥ ~2.3×; optional.)
  2. Platform note doesn't name this mutant. The note exemplifies POSIX divergence with publish-rename-to-truncate, but publish-rename-since-blind is a vacuous POSIX survivor (the retry loop is never entered, so the check is never reached). One clause would prevent a future POSIX sweeper from being filed against it as a catalog gap.
  3. Red-first numbers (old pin red ~1516 ms, new pin red ~453 ms) are Windows observations I can't reproduce here — logic analysis agrees (mutant publishes stale bytes right after the 400 ms release, well inside the 2 s deadline; the deadline can only pre-empt the old pin's 1500 ms release), and CI's Windows leg is green on shipping code. Noted as author-observed, not independently timed.

Landing

Branch is BEHIND (pre-#118). I rehearsed the merge locally: no conflicts (touch sets are disjoint), --validate 45/45 and suite 499/0 post-merge. After update-branch, poll mergeStateStatus to CLEAN and confirm the Windows leg on the new head.

… mark since-blind POSIX-vacuous

Nit 1: the deterministic pin's trade is pinned in writing - a stall that
delays the 60ms append past the 400ms release reddens the test on CORRECT
code (6.7x margin, loud self-reporting red) - so nobody reintroduces the
1.33x silent-green pins above it for safety.

Nit 2: the platform note now names publish-rename-since-blind as the vacuous
POSIX class: handoverRename throws immediately for !IS_WINDOWS, the retry
loop (and the blinded recheck) is never entered - no catalog gap, no future
POSIX sweeper issue to file.
@WhollyMindless

Copy link
Copy Markdown
Contributor Author

Both fixable nits are fixed at 81bf4fe (comment/doc-only; your validate 45/45 on the merged shape is anchor-stable by construction — --validate re-run here says the same, and logfmt.test.ts 17/0):

Nit 1 — pinned in writing at the third test, in the trade's own terms:

The residual race, named so it doesn't get "fixed" back (#120 review nit 1): if a stall delays the 60ms append PAST the 400ms release, the shipped code renames before the destination moves and this goes red on CORRECT code. Deliberate trade: a 6.7x margin with a loud, self-reporting red beats the 1.33x silent-green of the pins above.

Took the widening offer-up as optional and left the shape: 6.7x (append→release) and 5x (release→deadline) already clear the class, and append@20 leans on a timer the size of a libuv tick — the current floor (60ms) is the one the other two pins use.

Nit 2 — the platform note now names the vacuous class explicitly, with your mechanism: handoverRename throws immediately for !IS_WINDOWS, the retry loop (and with it the blinded recheck) is never entered — flagged so no future POSIX sweeper gets filed as a catalog gap.

Nit 3 — agreed, and it's the honest class: those two numbers are author-observed Windows timings, cited as such in the body (your logic analysis reproducing the verdicts is the right confirmation; I won't claim macOS timings I didn't measure).

Head moving to 81bf4fe re-fires CI; the diff vs the head you rehearsed is the two comment blocks, so your rehearsed merge should hold verbatim after update-branch.

@abogartz
abogartz merged commit 87608c3 into abogartz:main Oct 26, 2026
4 checks passed
@abogartz-opencode-self-improvement

Copy link
Copy Markdown

🎉 This PR is included in version 0.14.7 🎉

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

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants