Skip to content

feat: doctor warns on stale installs and editable source drift#115

Merged
Ram9199 merged 2 commits into
mainfrom
feat/doctor-staleness
Jun 13, 2026
Merged

feat: doctor warns on stale installs and editable source drift#115
Ram9199 merged 2 commits into
mainfrom
feat/doctor-staleness

Conversation

@Ram9199

@Ram9199 Ram9199 commented Jun 13, 2026

Copy link
Copy Markdown
Member

Closes #110. Third in the founder-dogfood self-identity chain; builds on SelfIdentity (#108) and inventory classification (#101).

Principle: a permission tool must clearly identify which copy of itself is guarding the user. doctor previously ran six green checks while a stale v0.5.5 snapshot was guarding the user — it never noticed the running code was behind, or that an editable install had drifted from its source.

What

Two WARN-only checks added to run_doctor():

  • install up to date — running version vs inventory's newest_version. WARNs when an older copy is resolving ahead of a newer install, and names where the newer one lives:
    WARN: install up to date - running 0.5.5 but 0.5.6 is installed at /Users/dev/Developer/Agent_Sudo;
          your shell is resolving an older copy — run `agent-sudo inventory` and reinstall or re-point to the newest
    
  • runtime matches install source — for editable installs, verifies the running package path still lives under its registered source; WARNs on drift (source moved, or a stale copy shadowing it).

Scope discipline

  • WARN-only: neither name is in doctor's required set, so the exit code is never affected and nothing is auto-fixed (explicit doctor detects stale installs and runtime mismatches #110 constraint).
  • Reuses SelfIdentity and inventory's newest_version / _version_key rather than re-deriving versions.
  • identity and inventory_report are injectable into run_doctor(...) for deterministic tests.

Tests / validation

  • New InstallHealthCheckTests in tests/test_doctor.py: stale pinned install (WARN + exit 0), editable source mismatch (WARN + exit 0), clean current install (both OK), plus unknown-version no-warn and a default-presence check.
  • Full suite: 489 passed. ruff clean.
  • Docs: command_reference.md doctor entry notes the new WARN-only checks.

Add two WARN-only checks to run_doctor(), built on the SelfIdentity primitive
(#108) and inventory's version classification (#101):

- 'install up to date': running version < newest install found on the machine
  (names where the newer copy lives) — the dogfood case where a shell silently
  resolved a stale copy.
- 'runtime matches install source': an editable install whose running package
  path no longer lives under its registered source (moved/shadowed).

Neither name is in the required set, so the exit code is never affected — this
does not auto-fix. identity and inventory_report are injectable for tests.

Closes #110
@Ram9199 Ram9199 merged commit 396448b into main Jun 13, 2026
@Ram9199 Ram9199 deleted the feat/doctor-staleness branch June 13, 2026 05:41
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.

doctor detects stale installs and runtime mismatches

1 participant