Repository navigation
test: retire ai-vault cases whose inputs the scanner never reads - #23992
Conversation
Semantic sweep of src/main/ai-vault. 48 cases removed across 11 files; no production code touched, no files deleted. The largest single removal is a 36-case block (6 agents x 6 env values) in `session-scanner-agent-root-overrides.test.ts` whose assertion was a self-comparison: `root === join(root)`. The sibling `falls back to the default root for %j` pins `roots[0]` to the exact absolute default, and the extra roots the block also scanned (`agent_logs`, `.clawdbot/agents`) are homedir-derived and unaffected by the env var it varied. The #13082 rationale comment is kept on the surviving case. Inputs the production path never reads: - `session-scanner-codex-tool-records.ts:89` reads only `change.unified_diff ?? change.content` and never `change.type`, so the `{ type: 'delete' }` row was the identical path as `add`; the `add`/`update` rows remain as the two real disjuncts. - `codexSpawnDepth` accepts any positive integer, so depth 2 was the same branch as depth 1. - `agentPath` is an independent `??` fallback with no cross-field logic, so "keeps the rest of the spawn when the naming path is null" passes either way. - `getAiVaultWslHomeDirs` reads only `platform` and a `hasCachedWslDistros()` gate, so a case varying which distros are "currently running" took the default branch; the filtering lives entirely inside a mocked async call. Cases that cannot fail for the reason they name: an all-unknown-agent response whose throw requires `malformedSessionCount > 0` when it is 0; a symlink rejection byte-identical to the directory case above it (`isFile: () => false`); a runtime restamp whose fixture already carries the `executionHostId` and `id` it asserts. Also removed: duplicates of a stronger sibling in `session-list-results`, `session-parse-cache-persistence` (same `schemaVersion !==` gate), `session-scanner-claude-title` (owned by the subagent-prune test, which also asserts `subagentTranscriptCount`), and a session-scanner listing case whose count is N-independent because `fixedChildFileSegments` does one readDir plus a direct stat per child — so a per-session-readDir regression fails at N=1. Three keeps worth recording. Spy-counting tests were kept where real code runs: `session-scan-cutoff` and `session-scanner-dedup-batches` count `Array.prototype.sort` / `RegExp.prototype.test`, but drive the real scanner over 128 fixtures and assert the limit-ordered result too, so a re-sort-per-candidate regression fails them for the right reason — unlike a bench whose assertion was arithmetic over its own constants. `session-scanner-claude-unicode-scope` keeps its locally re-spelled dir-name encoder deliberately: importing the production one would hide Orca drifting from Claude's actual naming. And `session-parse-cache-persistence.test.ts:175` stays although `keys.length > 0` cannot fail — it is the only reference to the `satisfies Record<keyof AiVaultSession, true>` table, so deleting the case would make that type-level ratchet dead.
|
There was a problem hiding this comment.
✅ No new issues found.
Reviewed changes
Read the full diff (11 test files, +2/−190) and checked every deletion against the production path or its surviving sibling; ran the 11 files (161 passed) and oxlint on all of them (0 findings).
cached-session-list.test.ts— dropped the "only running distros" case; the filtering lives inside the mockedlistRunningWslHomeDirsAsync, and the surviving "still discovers running distros…" case asserts the same passthrough.remote-session-scanner.test.ts— dropped the 40-session Antigravity scaling case; the surviving "parses only canonical Antigravity transcripts" case asserts the identical single-readDir filter.runtime-session-scanner.test.ts— dropped the host-stamp case; itsbeforeEachfixture already carried the asserted id andexecutionHostId, and the surviving "stamps sessions … for a different execution host" case exercises the real restamp.session-delete.test.ts— dropped the symlink case, byte-identical (isFile: () => false) to the surviving directory case.session-list-result-validation.test.ts— dropped the all-unknown-agent case; the throw requiresmalformedSessionCount > 0, which is 0 there, and the mixed-unknown case pins the no-throw path.session-list-results.test.ts— dropped the per-host scope case; the merge is a flat issue concat covered by two surviving cases.session-parse-cache-persistence.test.ts— dropped the schema-1 case;SCHEMA_VERSIONis 3, and the surviving mismatched-schema (999) case pins the same rejection.session-scanner-agent-root-overrides.test.ts— replaced the tautologicalroot === join(root)block (36 cases) with the survivingroots[0] === defaultRoot()assertion; the extra roots it also scanned are homedir/default derived and unaffected by the varied env var.session-scanner-claude-title.test.ts— dropped the Task-subagent exclusion case;session-scanner-claude-subagent-prune.test.tspins the same behavior plussubagentTranscriptCount.session-scanner-codex-non-user-origin.test.ts— dropped the depth-2, null-agent_path, and user-thread cases; each is either the same branch as a surviving case or covered by a surviving loop.session-scanner-codex-tool-records.test.ts— dropped the{ type: 'delete' }row;session-scanner-codex-tool-records.ts:89reads onlyunified_diff ?? content, identical to the survivingaddrow.
DeepSeek Flash (free via Pullfrog for OSS) | 𝕏
|
Navigate logical layers of code changes, visualize relationships, and explore their blast radius. 📝 WalkthroughWalkthroughThe changes update AI Vault tests only. They remove several standalone tests and assertions, move runtime host assertions into a test that also checks issue stamping, and update the relative-root test to check the configured default. Priority: ⬇️ Low Merge Risk: 🔵 Low · up to A future regression could silently omit deleted-file records. Restoring the small test case would close this bounded coverage gap before merging. Architecture SummaryArchitecture risk: 🔵 Low · up to The change affects 1 system. Changed systems: Architecture concerns Review detailsSystems and components
Before / after behavior
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches📝 Generate docstrings
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
🧹 Nitpick comments (1)
src/main/ai-vault/session-scanner-codex-tool-records.test.ts (1)
68-76: 🎯 Functional Correctness | 🔵 Trivial | ⚡ Quick winKeep the
deletecase in the paginated file-change test.
publishCodexCompletedToolaccepts each file-change entry without filtering itstypeand publishesunified_difforcontent. Therefore, thedeleterecord withcontent: '+ addedneedle'is valid for this parser boundary. Removing it leaves no assertion that paginated delete records are published. A regression that drops delete records can pass the remainingaddandupdatecases.Suggested fix
it.each([ { type: 'add', content: '+ addedneedle' }, + { type: 'delete', content: '+ addedneedle' }, { type: 'update', unified_diff: '+ addedneedle', move_path: null } ])('publishes paginated $type file changes', (change) => {
ℹ️ Review info
⚙️ Run configuration
Configuration used: Repository UI
Review profile: CHILL
Plan: Advanced
Run ID: c6f994c2-48a7-4dd3-b435-810a34cd10df
📒 Files selected for processing (11)
src/main/ai-vault/cached-session-list.test.tssrc/main/ai-vault/remote-session-scanner.test.tssrc/main/ai-vault/runtime-session-scanner.test.tssrc/main/ai-vault/session-delete.test.tssrc/main/ai-vault/session-list-result-validation.test.tssrc/main/ai-vault/session-list-results.test.tssrc/main/ai-vault/session-parse-cache-persistence.test.tssrc/main/ai-vault/session-scanner-agent-root-overrides.test.tssrc/main/ai-vault/session-scanner-claude-title.test.tssrc/main/ai-vault/session-scanner-codex-non-user-origin.test.tssrc/main/ai-vault/session-scanner-codex-tool-records.test.ts
💤 Files with no reviewable changes (10)
- src/main/ai-vault/cached-session-list.test.ts
- src/main/ai-vault/remote-session-scanner.test.ts
- src/main/ai-vault/session-list-results.test.ts
- src/main/ai-vault/session-delete.test.ts
- src/main/ai-vault/session-list-result-validation.test.ts
- src/main/ai-vault/session-scanner-codex-tool-records.test.ts
- src/main/ai-vault/session-scanner-codex-non-user-origin.test.ts
- src/main/ai-vault/session-scanner-claude-title.test.ts
- src/main/ai-vault/session-parse-cache-persistence.test.ts
- src/main/ai-vault/runtime-session-scanner.test.ts
Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 7 remain after this review.

ELI5
The biggest single removal here is a 36-case block that checked
root === join(root)— a path compared against itself. It ran six agents × six environment values, and every one of those 36 cases asserted that a value equals itself.The rest follow one question: does the scanner actually read the field this case varies? Often not. One case varied
change.typeon a code path that reads onlychange.unified_diff ?? change.content. Another varied a spawn depth on a check that accepts any positive integer.What Changed
−190 lines across 11 files. 48 cases removed. No production code touched, no files deleted.
A self-comparison, 36 times over
session-scanner-agent-root-overrides.test.ts'snever yields a relative root for %jblock assertedroot === join(root). The siblingfalls back to the default root for %jpinsroots[0]to the exact absolute default, which is the real contract; the extra roots the block also scanned (agent_logs,.clawdbot/agents) are homedir-derived and unaffected by the env var it varied. The #13082 rationale comment is preserved on the surviving case.Inputs the production path never reads
{ type: 'delete' }FileChange rowsession-scanner-codex-tool-records.ts:89reads onlychange.unified_diff ?? change.content, neverchange.type— identical path toadd. Theadd/updaterows stay as the two real disjunctscodexSpawnDepthaccepts any positive integer, so depth 2 is the same branch as depth 1agentPathis an independent??fallback with no cross-field logic — passes either way if the fallback is removedgetAiVaultWslHomeDirsreads onlyplatformand ahasCachedWslDistros()gate; the "only running" filtering lives entirely inside a mocked async callCases that cannot fail for the reason they name
malformedSessionCount > 0— which is0in that fixture;isFile: () => false);executionHostIdandidit asserts, sorestampAiVaultListResultreturns the object unchanged;fixedChildFileSegmentsdoes one readDir plus a direct stat per child — a per-session-readDir regression fails at N=1 anyway, and its companiontoHaveLength(40)is inert against a scan limit of 1000.Why — three keeps that draw lines this audit needed
Spy-counting tests are not automatically the bench pattern. An earlier PR in this series deleted a 137-line bench whose assertion reduced to
120 < 134.33over two constants declared in the test file.session-scan-cutoffandsession-scanner-dedup-batcheslook identical in shape — they countArray.prototype.sortandRegExp.prototype.testcalls — but they drive the real scanner over 128 fixtures and assert the limit-ordered result too, so a re-sort-per-candidate regression fails them for the right reason. Same shape, opposite verdict; the difference is whether production code sits between the spy and the assertion.A locally re-spelled encoder was kept on purpose.
session-scanner-claude-unicode-scope.test.tsduplicates Claude's directory-name encoding rather than importing it — normally copied-logic junk. Its comment gives the reason: importing the production encoder would hide Orca drifting from Claude's actual naming. It is a differential against a third party, so the two sides genuinely can diverge.A vacuous assertion was kept because it anchors a type-level ratchet.
session-parse-cache-persistence.test.ts:175assertskeys.length > 0, which cannot fail. But it is the only reference to thesatisfies Record<keyof AiVaultSession, true>table, and nothing else enforces that table. Deleting the case would make the ratchet dead code.Also kept: the per-agent
session-delete-targetrows, each the registration ratchet that an agent is in the deletable table with the right root and extension — the same shape as the #7253 ratchet an earlier PR preserved; andnever plans file-history, a deliberate-absence guard over a user-data rewind buffer.Linked Issue
N/A — test-suite hygiene, no pre-existing issue.
Visual Proof
N/A — no production code changes in this PR.
Testing
Verified locally on macOS after committing and rebasing onto current main:
node config/scripts/check-reliability-gates.mjs— passes, 140 gates.pnpm run check:code-quality:changed— passes, 0 findings.pnpm tcnot required — zero production files changed.Not run locally: e2e and the Windows/Linux/SSH jobs — left to CI.
Removal-only; no new tests.
Review
Every deletion cites the production line or sibling that owns it, so the reasoning is checkable directly. The three keeps are the judgement calls — particularly the vacuous
keys.length > 0case, which stays only because it is load-bearing for asatisfiestable.Agent skill upstream boundary
docs/reference/agent-skill-sharing-upstream-boundary.mdand copies or mechanically translates no upstream skill-installer source, tests, fixtures, registry entries, path tables, comments, or documentation.Notes
pathReads <= 2000admission bound, the title-index LRU cap, and the depth-contradiction bound were all explicitly kept, as was the OpenCode-SQLite-never-a-delete-target invariant.remote-session-scanner-sources.test.tswas kept whole despite looking like a copied inventory — it is the only assertion of Devin's platform split (AppData/Roamingon win32 vs.local/shareelsewhere).Checklist
N/Awith reasonpnpm lint,pnpm typecheck,pnpm test, andpnpm buildpass (or CI will cover; local preferred)