Skip to content

fix(telemetry): an empty worktree id in the journal reads as not stated, as its comment promises #826

Closed

Description

@blafourcade

Problem

parseWorktree in cli/src/contexts/telemetry/infrastructure/run-journal-reader-adapter.ts has a comment that says: "asString rejects "", so a torn or empty value reads as 'not stated' rather than as a worktree named nothing". The adapter's asString returns any string, "" included. So a session_start carrying "worktree_id": "" is read as a worktree named nothing, which is exactly what the comment says cannot happen. The #799 mutation pass found it.

Scope

Pick one and make the code and the comment agree:

  • Keep the guarantee (recommended): parseWorktree treats an empty worktree_id or worktree_repo_id as absent. Add a test that is red on next.
  • Drop the guarantee: rewrite the comment to say an empty value is kept as given.

Acceptance criteria

  • The comment on parseWorktree states what the code does.
  • If the guarantee is kept, a journal line with "worktree_id": "" reads with no worktree_id, and a test proves it (red before, green after).

Prior art in this repository

  • asString in the per-tool formats (domain/formats/*.ts) also accepts "". The worktree fields are the only place a comment promises otherwise.

Out of scope

  • How the journal hook computes the worktree fields. It never writes "" today, which is why this path is not reached in practice.

Activity

  1. added theissue type on Sep 10, 2026
  2. moved this from Ideation to Todo in AIDD Roadmapon Sep 10, 2026
  3. moved this from Todo to In review in AIDD Roadmapon Sep 10, 2026
  4. added a commit that references this issue on Sep 10, 2026
    69298b2
  5. moved this from In review to Done in AIDD Roadmapon Sep 10, 2026
  6. closed this as completedby moving to Done in AIDD Roadmapon Sep 10, 2026
  7. moved this from Done to In review in AIDD Roadmapon Sep 24, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    Projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions