Skip to content

test/repokey-path.test.ts (#92) is CI-flaky via cross-file session scope from update-targeting.test.ts: rows stamped from the other file's fixture (channel: memory.ts:273 getCurrent().sid) #150

Closed

Description

@WhollyMindless

Two tests in test/repokey-path.test.ts (the #92 suite) went red on the ubuntu test job for a tree that is byte-identical, apart from a package.json version string, to trees where the same job passed. The failure signature is cross-file state contamination, and the channel is identifiable in source.

The failure (run 40716641566, head da64f63 of #135 — a maintainer "update branch" merge whose content equals the approved 152d613):

(fail) non-git repo keys are bare tokens (#92) > a session dir containing a space stamps repo= as an unquoted hash, repoPath stays raw
Expected to contain: "repo=39fb4455edb0"
Received: "... content=\"the build runs from a folder with a space\" repo=7f336c009f10 repoPath=/tmp/osi-upd-H5OLSA/repo"
(fail) non-git repo keys are bare tokens (#92) > rows written before the hash (repo= was the path) stay visible through repoPath
Expected to contain: "legacy note about the old pipeline"   Received: ""

repoPath=/tmp/osi-upd-* is test/update-targeting.test.ts's fixture directory (mkdtempSync("osi-upd-"), liveRoot = join(root, "repo") — line 34/41 there). A row written by a repokey-path test got stamped with a DIFFERENT FILE's repo scope; the second test then finds nothing because the reads filter through the same hijacked scope.

Why the tree is innocent: the same job passed on 152d613 (run 40574894053, identical suite content) and on main 8ad23d2 two minutes after #133 merged (run 40716278212, same code). git range-diff between the branch tips proves the merge changed nothing but the merge commit itself.

The channel (all verified in source):

Suggested fix — the #146 prescription, which fixed precisely this class (capture-sid-race leaking session→repo scope into the next file): teardown parity at the file that creates the state.

  • update-targeting.test.ts afterEach: add resetState(); resetSessionScopes(); (and optionally setRepoScope(null)).
  • Belt-and-suspenders for the victim file: repokey-path.test.ts beforeEach: add resetState(); resetSessionScopes(); alongside its setRepoScope(null).

Test-only change; no product code involved. Suite-hygiene issue in the family of #146 (fixed), #144, and #141 — worth sweeping once: a grep of setCurrent(/rememberSessionDir( call sites in test/ against files lacking a matching reset would find any remaining pairs.

Activity

  1. WhollyMindless commented on Oct 28, 2026

    @WhollyMindless
    ContributorAuthor

    Closing as a duplicate of #149, which abogartz diagnosed more precisely and fixed via #151 (shared preload isolation + per-file resets). My 'timing lottery' framing was wrong: the leak is deterministic under file ordering via bindSessionProvisional registering bySession for the tool-dispatching session — reproduced on plain 0.14.12 with a two-file invocation and on macOS/Bun 1.4.3. My local pair-runs on Windows/Bun 1.4.4 were green, which misled the diagnosis into a race narrative. Kept this issue as a cross-reference for the run evidence (run 40716641566).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions