-
-
Notifications
You must be signed in to change notification settings - Fork 79.1k
Module-level registry has no test-clearable export, risking cross-test pollution under --isolate=false #83887
Copy link
Copy link
Closed
Labels
P3Low-priority cleanup, docs, polish, ergonomics, or speculative work.Low-priority cleanup, docs, polish, ergonomics, or speculative work.clawsweeper:fix-shape-clearClawSweeper found a clear likely implementation shape for this issue.ClawSweeper found a clear likely implementation shape for this issue.clawsweeper:queueable-fixClawSweeper marked this issue as an existing queue_fix_pr work candidate.ClawSweeper marked this issue as an existing queue_fix_pr work candidate.clawsweeper:source-reproClawSweeper found a high-confidence source-level issue reproduction.ClawSweeper found a high-confidence source-level issue reproduction.issue-rating: 🦞 diamond lobsterVery strong issue quality with high-confidence source-level or clear reproduction.Very strong issue quality with high-confidence source-level or clear reproduction.
Metadata
Metadata
Assignees
Labels
P3Low-priority cleanup, docs, polish, ergonomics, or speculative work.Low-priority cleanup, docs, polish, ergonomics, or speculative work.clawsweeper:fix-shape-clearClawSweeper found a clear likely implementation shape for this issue.ClawSweeper found a clear likely implementation shape for this issue.clawsweeper:queueable-fixClawSweeper marked this issue as an existing queue_fix_pr work candidate.ClawSweeper marked this issue as an existing queue_fix_pr work candidate.clawsweeper:source-reproClawSweeper found a high-confidence source-level issue reproduction.ClawSweeper found a high-confidence source-level issue reproduction.issue-rating: 🦞 diamond lobsterVery strong issue quality with high-confidence source-level or clear reproduction.Very strong issue quality with high-confidence source-level or clear reproduction.
Type
Fields
Give feedbackNo fields configured for issues without a type.
Severity: low / Confidence: high / Category: test-gap
Triage: test-gap
Detected against: openclaw v2026.5.18 (latest stable at time of scan, 2026-05-18)
Tooling: clawpatch 0.3.0 + acpx/claude-sonnet-4-5 via Brad Mills protocol
Evidence
extensions/twitch/src/client-manager-registry.ts:29-29(registry)extensions/twitch/src/twitch-client.ts:272-275(_clearForTest)Reasoning
TwitchClientManagerexports_clearForTest()acknowledging that module state needs to be reset between tests. The module-levelregistryMap inclient-manager-registry.tshas no equivalent. Under--isolate=false(documented in CLAUDE.md), a test that callsgetOrCreateClientManagerwill leave an entry that bleeds into subsequent tests, causinggetOrCreateClientManagerto return a stale/mock manager instead of creating a fresh one.Reproduction
In a vitest run with
--isolate=false, test A callsgetOrCreateClientManager('default', loggerA), test B calls the same — it gets loggerA's manager silently.Recommendation
Export a
_clearRegistryForTest()function that callsregistry.clear(), mirroring the pattern already used inTwitchClientManager.Why existing tests miss this
The included tests do not call
getOrCreateClientManagerdirectly; they mock at theresolveTwitchAccountContextlevel, so the leak is latent rather than currently observable.Suggested regression test
Add an
afterEachthat calls_clearRegistryForTest()in any test file that exercisesgetOrCreateClientManager, and assert each test starts with an empty registry.Minimum fix scope
Add one exported
_clearRegistryForTest(): void { registry.clear(); }function to client-manager-registry.ts.Standardized clawpatch finding. Persistent in v2026.5.18 (not resolved by upgrading from v2026.5.12). Finding ID:
fnd_sig-feat-cli-command-0c715f7406-_bd18f93218.