test(web): gate the overlapping-discard test on the post reaching GitHub

The race helper let whichever request claimed first proceed and parked the
second claim until a GitHub call. When the scheduler let the discard claim
first, the post waited for a GitHub call that could never happen, and the
test hung to its 5 s timeout (seen in CI on 96945148d). A discard's claim now
waits for the post to reach GitHub directly, so request order no longer
matters.

Negative control: with the two requests swapped, the old gate fails and the
new one passes. Web vitest 58 files / 549 passed; eslint clean.

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
Claude-Session: https://claude.ai/code/session_014ZwqatxgVFxHvovngywnks
This commit is contained in:
Hunter BandClaude Opus 5.5 committed 2026-09-29 14:07:10 -07:00
1 parent 96945148d5
commit 0eef7dd350
1 file changed
+8
@@ -575,6 +575,14 @@ describe("admin post action is idempotent and bounded", () => {
kv.beforePut = async (key, value) => {
const isClaim = key.startsWith("draft-claim:") || (key.startsWith("draft-resolved:") && value.includes('"claim"'));
if (!isClaim) return;
// A discard only ever overlaps a post already at GitHub. Gate it on
// that directly so the test does not depend on which request the
// scheduler lets claim first (a discard claiming first would park the
// post forever waiting for a GitHub call that never happens).
if (value.startsWith("discard:") || value.includes('"discard')) {
await firstAtGitHubP;
return;
}
claimPuts += 1;
await (claimPuts === 1 ? bothCheckedP : firstAtGitHubP);
};