Skip to content

doctor: route the vault hygiene sweeps in as advisory findings - #58

Merged
bukershok merged 2 commits into
mainfrom
doctor-vault-router
Aug 15, 2026
Merged

doctor: route the vault hygiene sweeps in as advisory findings#58
bukershok merged 2 commits into
mainfrom
doctor-vault-router

Conversation

@menitasa

Copy link
Copy Markdown
Contributor

jit doctor now runs the auth-free half of the vault cleanup surface on every full sweep and routes each finding to the command that acts on it, keeping both of doctor's standing guarantees: it never decrypts (so it never prompts) and it reports, never deletes. The scan/migrate-style report/act boundary stays intact — jit vault orphans and jit vault duplicates remain the acting halves.

What changed

  • [orphan] count on by default. The orphan sweep always runs; without --orphans it collapses to one count line routing to jit vault orphans. --orphans now selects the per-path listing instead of switching the sweep on — the run where you'd learn you have eleven orphans was exactly the run that hid them. Applied to text and JSON alike.
  • [mount: stale] split out of [mount]. A registered mount whose manifest is GONE (project deleted without jit unmount) routes to jit vault orphans --prune and no longer sets parseFailed: a missing file names no references, so skipping it cannot make the orphan sweep under-count. Same distinction jit vault orphans drew in v0.93.0 (GAPS.md #67); doctor still suppressed the orphan count in exactly the cleanup that state calls for. A manifest that exists but won't parse keeps today's behavior.
  • [duplicates] hint. Groups that look like the same file stored twice, on the same name-level evidence as jit vault list's nudge — the clustering is extracted into a shared duplicateGroupClusters so the two surfaces can never drift. The action routes to jit vault duplicates; name evidence never nominates a copy to delete, since a surviving copy can lack a key the retired one held.
  • [origin gone]. A secret a profile still references whose recorded Origin file no longer exists on disk. Stat only, and only os.IsNotExist counts as gone — a permission error is not evidence of absence. The unreferenced half of that state needs no kind of its own: it is the orphan definition, and the count already carries it. No action line (kindShadowed's reasoning: a deliberately deleted source file and a half-deleted project look identical from here).

All four are warnings: ok and the default exit are untouched, they gate only under --strict, and the JSON change is additive (no schema bump). Also fixes a pre-existing wording glitch in jit vault orphans ("clears 1 the stale mount registration").

Verified on a real machine

The dev VM genuinely had the stale-mount state plus 9 orphaned secrets. Installed v0.90.0 rendered the stale mount as a raw "no such file or directory" [mount] warning with the action "fix the manifest" (of a deleted project) and showed nothing about the orphans; this branch renders [mount: stale] with the prune route plus the 9-orphan count, in exact agreement with jit vault orphans. No auth prompt at any point.

🤖 Generated with Claude Code

https://claude.ai/code/session_015ugtBevcdhHM42LCTNCEFb

menitasa and others added 2 commits August 15, 2026 11:40
jit doctor now runs the auth-free half of the vault cleanup surface on
every full sweep and routes each finding to the command that acts on it,
keeping its two standing guarantees: it never decrypts (so never
prompts) and it reports, never deletes.

Four pieces:

- The orphan sweep always runs. By default it collapses to one [orphan]
  count line routing to `jit vault orphans`; --orphans now selects the
  per-path listing instead of switching the sweep on. The run where
  you'd learn you have eleven orphans was exactly the run that hid
  them.
- A registered mount whose manifest is GONE (project deleted without
  `jit unmount`) is split out of [mount] into [mount: stale], routes
  to `jit vault orphans --prune`, and no longer sets parseFailed — a
  missing file names no references, so skipping it cannot make the
  orphan sweep under-count. Same distinction vault orphans drew in
  v0.93.0 (GAPS.md #67); doctor still suppressed the count in exactly
  the cleanup that state calls for.
- [duplicates]: groups that look like the same file stored twice, on
  the same name-level evidence as `jit vault list`'s nudge — the
  clustering is extracted into duplicateGroupClusters and shared, so
  the two surfaces cannot drift. The action routes to `jit vault
  duplicates`; name evidence never nominates a copy to delete, since
  a surviving copy can lack a key the retired one held.
- [origin gone]: a secret a profile still references whose recorded
  Origin file no longer exists on disk (stat only; os.IsNotExist only,
  a permission error is not evidence of absence). The unreferenced
  half of that state needs no kind of its own — it is the orphan
  definition, and the count already carries it.

All four are warnings: ok and the default exit are untouched, they gate
only under --strict, and the JSON change is additive (no schema bump).

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_015ugtBevcdhHM42LCTNCEFb
countWord prepends the number to whatever noun it is given, so handing
it "the stale mount registration" rendered "clears 1 the stale mount
registration". The article belongs to the sentence, the count to the
noun: singular keeps "the stale mount registration", plural becomes
"the N stale mount registrations".

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_015ugtBevcdhHM42LCTNCEFb
@bukershok
bukershok merged commit 84d49a9 into main Aug 15, 2026
3 checks passed
@menitasa
menitasa deleted the doctor-vault-router branch August 15, 2026 08:52
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.

2 participants