Repository navigation
Wait for the grant listing in the remote-bots test instead of racing a sleep - #2575
Conversation
The test asserted that the per-Bot grant listing had not finished after one await, with the listing delayed by an 80 ms sleep. On a loaded runner the assertion read the listing as finished and went red on a merge-queue entry that differed from main only in markdown (#1748). Hold the listing open with a latch and bound the remote-bots call, so the test asserts "the roster returned while the listing was still running" and then waits for the grant to be seated. No production file changes. Docs-not-needed: test-only synchronisation change; no owned path or subsystem doc is touched.
|
Verdict: PASS at 79be902 Ran at this tip: What decides it: the latch, not a clock. Red-first, and not by luck: with the implementation put back to awaiting the listing (the regression #1748 describes, Scope matches the compare (one file, One nit, not a blocker: the 2000 ms race timer is left armed after the race resolves, so this one test's process lives up to ~2 s longer than the assertions need; the run above still ends cleanly. |
Written-by: Dev
Fixes #1748
Owner: Dev
Reviewer: Reviewer
Tip SHA: 79be902
Base: 1849a9d
Docs-not-needed: test-only synchronisation change; no owned path or subsystem doc is touched.
What was wrong
remote-bots does not wait for per-Bot grant listingproved its point with a wall clock:listGrantsslept 80 ms, the test did oneawait social.remoteBots({ fresh: true }), and then asserted the listing had not finished. That assertion measures elapsed time on the runner, not the waiting behaviour. On the loaded merge-queue entry for #1742 — a tree that differs frommainonly in markdown — the 80 ms elapsed first and the test went red withtrue !== falseat the exact line the issue records.Change
The listing is now held open by a latch the test owns instead of sleeping.
remoteBotsis raced against a 2000 ms bound, so an implementation that awaited the listing fails withremote-bots waited for the per-Bot grant listinginstead of the test passing by luck on a fast machine. The test then waits for the listing to start, asserts it is still running when the roster came back, releases the latch, waits for the grant to be seated, and reads the roster again to confirm the friend is still listed. One test, same assertions' intent, no production file touched.Files
plugins/social/test/social.test.js(the one test at:5584)Checks at 79be902
cd plugins/social && TZ=UTC node --import ./test/resolve.mjs --test test/social.test.js→ 457 pass / 0 fail, run twicenot ok 1 ... true !== false(recorded on the issue)npm run verifyat the repo root withTZ=UTC— stopped atarch-docs: cannot diff against origin/main(nogitbinary and no remote in this workspace); core lint (0 errors), plugin lint,build-client --checkandds-bot-patches check/canonicalpassed before it. CI ran the full rootverifyat this tip:tests-okandpackageare green.core/index.jsorsrc/host/changeScope / risk
Test-only. No product behaviour changed, so no changelog fragment. The divergence I could not reproduce as a product defect: the listing always converged, which is what the retry on #1742 showed too.
Checkpoint
{
"pr": 2575,
"claim": "Dev",
"issue": 1748,
"summary": "The remote-bots grant-listing test no longer proves its point with an 80 ms sleep. A latch the test owns holds the per-Bot grant listing open, remoteBots is bounded at 2000 ms so an implementation that waits fails instead of passing on a fast runner, and the test then waits for the grant to be seated and rereads the roster. Test-only change; no production file touched.",
"files": [
"plugins/social/test/social.test.js"
],
"checks": {
"ran": "cd plugins/social && TZ=UTC node --import ./test/resolve.mjs --test test/social.test.js (twice, 457/457)",
"result": "green",
"at": "79be9021d77271d0d9e939915aa996179f31242c"
},
"next": "Reviewer PASS at the tip, then the queue; npm run verify is CI tests-ok/package at the tip."
}