Repository navigation
fix(cli): check names an anchor that belongs to another project - #886
Merged
Merged
Conversation
`hook fired` graded FAIL whenever the anchored session left no run file here, including for a session that never ran in this project: the anchor is inherited by any process nested inside a session, whatever directory it runs in, so a `check` run from a shell another project's session spawned was told the chain was broken when it was not. The stored records already decide it. `anchorProjectElsewhere` compares what the sink holds for the anchor against the projects this project's own run files name, and the claim reads `unknown`, naming that project, instead of `fail`. `fail` keeps its meaning: this project's own session ran and the hook wrote nothing. Two values are compared only when the same field named them — `project_id` is a directory name, `project_remote` a URL — so an anchor no stored record places, or places by a field this project never used, decides nothing and falls through to the verdict it already had. Fixes #872 Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> AIDD-Session-Id: 58b68db5-0bfc-485b-aefa-1fcb609ac8f7
A run file in another project is not something this command read; the stored figures naming that project are. The wording says that, and the details suite pins it word for word like every other claim's. Refs #872 Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> AIDD-Session-Id: 58b68db5-0bfc-485b-aefa-1fcb609ac8f7
`run-mutation --changed` scored the new lines 77: the sink was asked for the anchor in every case the tests could see, so the two guards that keep it from being asked — an anchor this project journalled itself, and a project no run file here names — were indistinguishable from nothing. The double now records which vendors it was asked about, and the cases assert it was asked none. The domain cases were comparing a record the field filter already dropped, never `projectOfRecord` itself; they now name a project by both fields so the record reaches it. Score 97.7, the two survivors being a type narrowing the field filter makes unobservable. Refs #872 Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> AIDD-Session-Id: 58b68db5-0bfc-485b-aefa-1fcb609ac8f7
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.
What
aidd telemetry checkgradedhook firedFAIL whenever the anchored session left no run file in this project — including for a session that never ran here. The anchor is inherited: any process nested inside a Claude Code session seesCLAUDE_CODE_SESSION_ID, whatever directory it runs in, so acheckrun from a shell another project's session spawned was told the chain was broken when it was not.The claim now answers the third state it already models: an anchor decidably another project's reads
unknown, naming that project.failkeeps its meaning — this project's own session ran and the hook wrote nothing.How
anchorProjectElsewhere(cli/src/contexts/telemetry/domain/session-project.ts) compares what the sink holds for the anchor against the projects this project's own run files name.project_idis a directory name,project_remotea URL, and both are live on a real machine (31507 records namingproject_remote, 7 namingproject_idin my own sink). Across the two, a match would read as a mismatch.readRecordsForVendorwas already onTelemetrySinkand the sink already injected intoDiagnoseTelemetryUseCase.Limitation, stated rather than hidden
The sink decides it only when it holds figures for that anchor — a session whose project was never read locally is still undecidable, and falls through to today's
fail. Strict improvement: nothing that used to be graded correctly changes, and no newunknownis produced from a guess.Evidence
Tests were written first and watched fail for the reason they name:
The user's own scenario, against the built binary (
cli/dist/cli.js), in a throwaway repository whose remote isacme/widgets, with a stored record placing sessions-foreignunderacme/other:Same tree, an anchor no stored record places, and the project's own session:
Gates:
pnpm lint,pnpm typecheck,check-cli-type-honesty,pnpm test(6261 passed),pnpm knip, all green.node scripts/run-mutation.mjs --changed origin/nextscores the changed lines 97.7 (77 before the guards were given cases that see them); the two survivors are a type narrowing the field filter makes unobservable.tests/architecture/comments.arch.test.ts'ssrcbaseline is raised 4471 → 4481, with its reason recorded in that file as the guard's own convention requires.Fixes #872
🤖 Generated with Claude Code