Repository navigation
test(connectors): install the #1081 write-delay wrapper inside try, and assert it ran - #1262
Conversation
…nd assert it ran (#1224)
|
Verdict: PASS at 32617dc Both halves of 1. The wrapper is installed inside the 2. Red without the source change, reproduced on the two shapes:
3.
One shape worth recording rather than flagging: in the stored series the new-side start repeats the old-side start on every hunk (291/291 in 4. Nothing else changed. 5. Body and checkpoint. The six sections are present, CI at read: 14 runs, 13 success; the one non-success is an Ran: The probe copies ( |
Owner: Dev2
Reviewer: Reviewer
test(connectors): install the #1081 write-delay wrapper inside try, and assert it ran
Fixes #1224
Reproduce
At main
98528d9f, the #1081 case incore/test/connectors.test.js("an address saved by an older version is dropped…") installsfsp.rename = …andsyncBuiltinESMExports()beforeconst second = setup({ home, warns }), and itstrystarts after that call. The case also rides silently oncore/src/host/store.js:5continuing to takerenamefromnode:fs/promisesas a named import (used at:488).Two probes at that sha, on the unmodified tree:
setup()— a copy of the file withsetup({ home, warns })replaced by a throw, plus a later test assertingfsp.rename ===the function captured at module load. Result on the old code:not ok … the wrapper leaked into later tests(+ [AsyncFunction (anonymous)]vs-[AsyncFunction: rename]) — thetrynever opened, so thefinallynever restored the wrapper.store.jswriting throughpromisify(renameCb)(renameimported fromnode:fsinstead ofnode:fs/promises). Result on the old test:# tests 1 / # pass 1 / # fail 0— the wrapper was never called, the case passed on timing, and nothing said so.What changed
core/test/connectors.test.js(the connectors.test.js:639 goes red under the full core suite: the legacy address is still in state.json when the test reads it #1081 case only): the wrapper install (fsp.rename = …+syncBuiltinESMExports()) moved inside thetry, withlet secondandt.after(() => second?.ctx.dispose())before it so a throwingsetup()still restores infinally; andrenameCallscounts every wrapped call, asserted at the end of the case asassert.ok(renameCalls >= 1, 'the wrapper never ran — store no longer uses the named rename import'). The comment states what the count pins (the named-import path) and what it does not (that the 400 ms delay took effect —SLOW_WRITE_MS = 0still calls it).patches/ds-bot/0001-core-fixes.patch: the same case in the patch mirror, in thetest/connectors.test.jshunk (@@ -165,10 +165,614 @@), re-counted to match.generateis not available on this machine (no git), so the hunk was edited by hand and proven bycheck.What I ran
At the branch tip (fresh tarball of the branch,
node_moduleslinked):Red without the source change
With the two test-file changes reverted (i.e. main's shape), both probes above are red in the way that matters:
setup()throwing leaves the wrapper onfsp.rename— a later test in the same file sees the anonymous wrapper (ERR_ASSERTION,the wrapper leaked into later tests). With the change: the same probe isok … the rename wrapper is restored after setup() throws, and the throwing case still fails for its own reason (the deliberate throw).node:fsrename path keeps the case green with no counter; with the counter it is red:not ok 1 - an address saved by an older version is dropped from state.json at start…,error: 'the wrapper never ran — store no longer uses the named rename import'.Not run
npm run verifylocally (it runs in CI on this tip; only the one test file changed).core/src/host/store.jsand the two test(connectors): wait for the scrub write before reading state.json #1215 diagnostic lines are unchanged (thenode:fsvariant above existed only as a probe and was restored byte-for-byte).Risk
Test-only, one file plus its patch mirror. The counter pins "the named
renameimport is still the write path", not "the delay ran": a store change to another path now fails loudly instead of silently passing on timing, which is the defect #1215's PASS left behind. The install-in-trymove only widens the window in which the wrapper is restored, and thefinallystill restores on every path.Verification at the tip
Tip SHA: 32617dc
Ran:
node --test --import ./core/test/harness-resolve.mjs --test-concurrency=1 core/test/connectors.test.js→ 29/29 pass (branch tip)node scripts/ds-bot-patches.mjs check→ pin skipped (no git here),10 patches apply cleanly in order,core/ equals ds-bot/ + patches/ds-bot/Not run (and why):
npm run verifyat this tip — CI'stests-okcovers it; the local change is one test fileCheckpoint
{ "pr": 1262, "claim": "Dev2", "issue": 1224, "summary": "The #1081 connectors case now installs its write-delay wrapper inside the try, so a throwing setup() cannot leave the wrapper on fsp.rename for later tests, and it counts wrapped rename calls and asserts the count, so a store move to another rename path fails loudly instead of passing on timing. Both halves were proven red first: a leak probe and an alternate-path probe. Only the test file and its patch mirror change; product code is untouched.", "files": [ "core/test/connectors.test.js", "patches/ds-bot/0001-core-fixes.patch" ], "checks": { "ran": "connectors.test.js 29/29 at the branch tip; ds-bot-patches check 3 lines green; both red probes on main and here", "result": "green", "at": "32617dcac4fc3a134d0176991fe2ee4fe67f5514" }, "next": "review" }