Repository navigation
Description
Problem
`scripts/validation/tests/reference-detection.test.js` › "End-to-End Integration" › "should handle rename scenario correctly" fails:
```
Expected: "issue-triage-agent"
Received: "issue-agent"
```
Root cause (verified, not assumed)
This is not a platform-specific issue — reproduces identically regardless of OS. Confirmed via direct instrumentation of FixSuggester.suggestFix().
The `describe('End-to-End Integration', ...)` block has a nested `beforeEach` (line 154-156):
```js
beforeEach(() => {
suggester.buildIndex(['issue-agent', 'pr-agent', 'release-agent'], 'agent');
});
```
This runs before every test in that describe block, including "should handle rename scenario correctly" (line 173), which then calls its own `buildIndex(['issue-triage-agent', 'pr-agent', 'release-agent'], 'agent')` on top. `buildIndex`/`addToIndex` only adds to the index (Map.set), never clears — so by the time `suggestFix('agents/issue-agent', ...)` runs, the index actually contains 4 entries: `issue-agent`, `pr-agent`, `release-agent`, `issue-triage-agent` — not the 3 the test intends.
Since the whole point of this test is "issue-agent was renamed to issue-triage-agent, so the old name should no longer be in the index," the leaked `issue-agent` entry (still present from the outer `beforeEach`) fuzzy-matches closer to the input `agents/issue-agent` (similarity 0.61) than `issue-triage-agent` does, so the test's own leaked fixture data defeats its purpose.
Fix
The "rename scenario" test needs a suggester instance whose index does not already contain `issue-agent` before it adds `issue-triage-agent`. Either:
- Give this test its own
FixSuggesterinstance instead of relying on the outerbeforeEach's shared one, or - Have the outer
beforeEachnot apply to this specific test (restructure the describe blocks), or - Reset
suggester.agentIndexexplicitly at the start of this test before callingbuildIndexagain.
Verification
Confirmed via direct instrumentation (temporary console.error in findCandidates) that the index contains all 4 names at the point of failure, not just the 3 from this test's own buildIndex call.
Note on CI visibility
This is not currently caught by CI at all — no active workflow in .github/workflows/ runs the Jest suite (the workflows that did, checks.yml and testing.yml, were archived 2026-09-11 as part of the workflow consolidation; their replacements validation-unified.yml/testing-unified.yml don't exist yet — tracked in #2896 / PR #3359). Not raising that as a separate issue here since it's already an active initiative.
Related
- Not covered by test: ~264 failing tests across 48 files, unmasked by fixing the babel 7/8 jest crash (PR #3306) #3309 or fix: 29 pre-existing test suite failures remaining after #3340/#3341 #3344 (both track broader pre-existing test failures; neither mentions this file)
Metadata
Metadata
Assignees
Type
Fields
Priority
Activity
linear-code commentedon Sep 22, 2026
LS-4223
eleshar commentedon Sep 22, 2026
Follow-up: while preparing the fix, running the full test file (not just this one test filtered out) surfaced 4 more pre-existing failures unrelated to the nested-`beforeEach` leak documented here — filed separately as #3460.
Important nuance for whoever reviews the fix PR: isolating this test's state (giving it its own `FixSuggester` instance) is necessary but not sufficient — even properly isolated, the test still fails, because `suggestFix('agents/issue-agent', ...)` against `['issue-triage-agent', ...]` scores 0.44 similarity (below the 0.6 threshold), for the reason documented as Root Cause 1 in #3460. The state-leak fix and the threshold/normalization fix are two separate, real bugs stacked on the same test.
fix: repair changelog merge marker and shorten entry to 250-char limit (