Skip to content

fix(#71): add session-onboard.sh --doctor diagnostic - #77

Merged
jsirish merged 2 commits into
mainfrom
claude/onboard-doctor
Sep 1, 2026
Merged

fix(#71): add session-onboard.sh --doctor diagnostic#77
jsirish merged 2 commits into
mainfrom
claude/onboard-doctor

Conversation

@jsirish

@jsirish jsirish commented Sep 1, 2026

Copy link
Copy Markdown
Member

Summary

  • Adds session-onboard.sh --doctor: a read-only diagnostic reporting resolved data root, activation state/reason, jq availability, live/archived buffer counts, and the three env vars' values.
  • Checked before the THROUGHLINE_DISABLE kill switch (the disabled state is exactly what someone runs --doctor to discover). Never calls tl_active(), so it never bootstraps a data directory as a side effect.
  • Counts buffers via a plain glob-and-count loop, not find | wc — neither is a guaranteed dependency in the degraded environments this diagnostic exists to investigate (caught live via the jq-missing test fixture's restricted PATH stub).
  • Docs: new Troubleshooting section in docs/REFERENCE.md.

Closes #71

Test plan

  • local-ci --strict — all checks pass (183/183 hook test assertions, shellcheck clean)
  • 8 new test assertions covering: disabled, ignored (.throughlineignore), linked worktree (shared root), missing jq, never-activated project (would-bootstrap + no side effect)
  • Live-verified manually: disabled state, missing-jq PATH stub, and a fresh scratch git repo confirming --doctor creates no .claude/throughline/ directory

🤖 Generated with Claude Code

https://claude.ai/code/session_019VuUKvqH3q511w8xVd4VFY

jsirish and others added 2 commits September 1, 2026 14:10
throughline resolves its data location through three env vars, a
.throughlineignore marker checked at two roots, sticky git-worktree
migration logic, and a soft jq dependency that degrades capture
silently when missing. Diagnosing "why isn't capture firing" meant
reading _lib.sh and reasoning through the precedence by hand.

--doctor prints the resolved root/data root (and whether worktree-
sharing applies), activation state and reason, jq availability,
live/archived buffer counts, and the three env vars' values. It is
read-only - checked before the THROUGHLINE_DISABLE kill switch (that's
exactly the state someone runs --doctor to discover), and never calls
tl_active() so it never bootstraps a data directory as a side effect.

Counts buffers via a plain glob-and-count loop rather than find | wc:
this is a diagnostic meant to work in the degraded environments it
exists to investigate, and neither find nor wc is a POSIX-sh-guaranteed
dependency the way plain globbing and arithmetic are - caught by testing
the --doctor jq-missing fixture, which stubs a minimal PATH.

Closes #71

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_019VuUKvqH3q511w8xVd4VFY
- The new worktree-sharing assertion matched the full absolute WT_MAIN
  path, which is red on windows-latest: $WT_MAIN is in MSYS form while
  the doctor's own "data root:" line resolves via `git worktree list`
  in native C:/... form for the identical directory. Match a path
  suffix instead, the convention every other worktree assertion in
  this file already follows.
- --doctor collapsed tl_active()'s bootstrap-failed outcome into
  would-bootstrap and asserted the next hook run "will" create the
  data dir - exactly wrong in the one scenario ("why isn't capture
  firing") this diagnostic exists to explain. Walk up to the nearest
  existing ancestor and probe writability; report "LIKELY TO FAIL"
  when it isn't writable.
- Add dedicated assertions for the "active" state and for an exact
  seeded buffer count - both branches of the state machine had zero
  regression coverage beyond incidentally passing through them.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_019VuUKvqH3q511w8xVd4VFY
@jsirish
jsirish merged commit bcd3abf into main Sep 1, 2026
4 checks passed
@jsirish
jsirish deleted the claude/onboard-doctor branch September 1, 2026 19:19
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.

session-onboard.sh --doctor: print resolved data root, activation state, and reason

1 participant