Skip to content

fix(telemetry): an empty worktree id in the journal reads as not stated - #828

Merged
blafourcade merged 1 commit into
nextfrom
fix/empty-worktree-id-not-stated
Sep 10, 2026
Merged

blafourcade merged 1 commit into
nextfrom
fix/empty-worktree-id-not-stated

Conversation

@blafourcade

Copy link
Copy Markdown
Contributor

🎯 What & why

parseWorktree in the run-journal reader promised, in its comment, that a torn or empty worktree_id reads as "not stated", because asString rejects "". The adapter's asString returns any string, so a session_start carrying "worktree_id": "" was read as a worktree named nothing. The worktree fields had no test at all.

🛠️ How it works

  • An empty worktree_id or worktree_repo_id is now dropped like an absent one: asString(...) || undefined.
  • The comment is reworded to say what the code does, with no added comment line.

🧪 How to verify

cd cli && pnpm vitest run --project integration tests/contexts/telemetry/infrastructure/run-journal-reader-adapter.integration.test.ts
Run Result
Before the change "reads an empty worktree id and repo id as not stated…" is red
After 38 of 38 pass
Both fields dropped unconditionally "keeps a stated worktree id and repo id as written" is red

Telemetry suite: 56 files, 852 tests passed. Typecheck, lint, test:arch, knip and type honesty are clean.

⚠️ Heads-up

Not reached in practice today, because the journal hook never writes an empty worktree id. The fix makes the reader keep the promise its comment already made, which was the recommended option in #826.

🔗 Linked issue

Fixes #826

✅ I certify

  • I have read the contributing guide and followed the PR template.
  • The test was red before the fix and every gate listed above passed locally.

🤖 Generated with Claude Code

https://claude.ai/code/session_011x4ms5qcGuZgYhCxfdHMUb

parseWorktree's comment promised that a torn or empty worktree_id reads as
"not stated", on the ground that asString rejects "". It does not: a
session_start carrying "worktree_id": "" was read as a worktree named
nothing. An empty value is now dropped like an absent one, for the repo id
too, and the comment says what the code does.

Two tests, the first ones the worktree fields ever had: an empty id and
repo id read as absent (red before the change), and stated ones are kept
as written (red with both dropped unconditionally).

Fixes #826

Co-Authored-By: Claude Opus 5 <[email protected]>
Claude-Session: https://claude.ai/code/session_011x4ms5qcGuZgYhCxfdHMUb
AIDD-Session-Id: 4acc9a1c-19bc-4468-b8b6-e86644bcba60
@blafourcade
blafourcade requested a review from a team as a code owner September 10, 2026 10:14
@blafourcade
blafourcade merged commit 69298b2 into next Sep 10, 2026
24 checks passed
@blafourcade
blafourcade deleted the fix/empty-worktree-id-not-stated branch September 11, 2026 07:42
@aidd-bot aidd-bot Bot mentioned this pull request Sep 24, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant