fix: close four gaps a multi-persona audit pass found - #360
Merged
Conversation
Six independent auditors read the codebase from different angles. Four findings survived verification. **The store-redirect warning missed its own stated case.** `.xtctx/config.yaml` is committable and can set `storePath`, resolved with no containment, so a cloned repo can point a scraper at another project's store and have those conversations served back as this project's context. The docstring says exactly that. The check then asked whether the path was outside the *home directory* — and every Claude Code project's transcripts live under `~/.claude/projects/`, so redirecting at a sibling project names a path inside home and was reported as nothing at all. The boundary is now the tool's own default store. That does not reintroduce the noise the home rule was avoiding: setup no longer writes `storePath`, so any config carrying one is already an override. **Literal search blamed the query for a broken store.** A store that threw and a pass that hit its limit both set `exhausted: false`, and that was everything the caller got — so it told the user the pass "stopped at its limit or time budget" and advised narrowing the query. Against an unreadable store every narrower query returns the same nothing, and the broken tool is never mentioned. The tools that threw are now named, with their own sentence. **The retrieval-unit repair ran on every project in the database.** It was the one query that selected sessions without asking whose they were. One database can hold another project's sessions — a copied `.xtctx/`, a renamed root — and the repair is capped at a few sessions per scan, so foreign rows do not merely waste the rebuild and the embedding after it, they crowd out the real ones and this project's own gap never closes. **An orphaned docstring** in claude-code.ts documented a method that is not there, sitting against the class's closing brace. Each fix is pinned by a test that fails against the old behaviour: neutralising the project filter, dropping the store name, and reverting to a home-shaped boundary each turn one red. One finding was rejected rather than fixed. The audit's top-ranked item claimed a comment in cursor.ts lies about array recursion; the comment says arrays *are* walked into and their elements ignored, which is what the code does.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Six independent auditors read the codebase from different angles — attacker, impatient newcomer, 3am SRE, performance engineer, privacy reviewer, inheriting maintainer. Four findings survived verification and are fixed here. (The memory finding went to #359, where the feature it affects lives.)
1. The store-redirect warning missed its own stated case
.xtctx/config.yamlis committable and can setstorePath, resolved with no containment — so a cloned repo can point a scraper at another project's store and have those conversations served back as this project's context. The docstring says exactly that.The check then asked whether the path was outside the home directory. Every Claude Code project's transcripts live under
~/.claude/projects/, so redirecting at a sibling project names a path inside home and was reported as nothing at all.The boundary is now the tool's own default store. This doesn't reintroduce the noise the home rule was avoiding: setup no longer writes
storePathat all, so any config carrying one is already an override.2. Literal search blamed the query for a broken store
A store that threw and a pass that hit its limit both set
exhausted: false, and that was all the caller got:Against an unreadable store every narrower query returns the same nothing, and the broken tool is never named. It now gets its own sentence saying which store failed and that this is not a query problem.
3. The retrieval-unit repair ran on every project in the database
selectSessionsMissingUnitswas the one query that selected sessions without asking whose they were. One database can hold another project's sessions — a copied.xtctx/, a renamed root — and the repair is capped at a few sessions per scan, so foreign rows don't merely waste the rebuild and the embedding after it: they crowd out the real ones, and this project's own gap never closes.4. An orphaned docstring
claude-code.tsdocumented a method that isn't there, against the class's closing brace.Verification
Each fix is pinned by a test that fails against the old behaviour:
project_rootfilter694 tests pass,
tsc -p tsconfig.test.jsonclean, lint clean.One finding rejected
The audit's top-ranked item claimed a comment in
cursor.tslies about array recursion. It doesn't — the comment says arrays are walked into and their elements ignored, which is what the code does. Verified verbatim rather than taken on the auditor's word.