Skip to content

Doctor v2: surface inventory, injectable probes, JSON contract, verdict-matrix fixtures - #529

Merged
aarontrowbridge merged 4 commits into
mainfrom
525-doctor-v2
Aug 23, 2026
Merged

Doctor v2: surface inventory, injectable probes, JSON contract, verdict-matrix fixtures#529
aarontrowbridge merged 4 commits into
mainfrom
525-doctor-v2

Conversation

@aarontrowbridge

@aarontrowbridge aarontrowbridge commented Aug 23, 2026

Copy link
Copy Markdown
Member

Closes #525.

The fleet-dev-tools keystone (spec-20260823-094507, D1): six surface records with four-verdict staleness logic — every judgment by version string or content digest, never mtime. Injectable roots + running-binary stub make the 25-test verdict matrix fully hermetic (fake binaries, pinned dates, real git fixtures with local remotes). The committed JSON Schema (minItems 6) + canonical round-trip is the machine contract the panel (#527) and watchdog consume. Doctor v1's studio-binding checks untouched; the report gains a surfaces section.

Typecheck clean; the amico-run suite is 1146 passed with 2 failures proven pre-existing at base e308a45 (both read real machine state — verified in a detached base worktree; details in the notes). Zero new dependencies.

Part of #524.

Summary by CodeRabbit

  • New Features

    • Enhanced amico doctor with a machine-readable --json report.
    • Added inventory and status reporting for six installation surfaces.
    • Added root-selection options and running-binary inspection.
    • Human-readable output now includes a surfaces status table.
  • Bug Fixes

    • Added validation for report structure and command-line arguments, with clear errors for invalid input.
  • Documentation

    • Added documentation for diagnostic status scenarios and test fixtures.

@coderabbitai

coderabbitai Bot commented Aug 23, 2026

Copy link
Copy Markdown

Review Change Stack

Caution

Review failed

The pull request is closed.

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: 92643e1d-54c3-44a1-9376-2c20b08c5403

📥 Commits

Reviewing files that changed from the base of the PR and between 5a7c8db and 77aefc0.

📒 Files selected for processing (10)
  • packages/amico-run/schemas/doctor-report.schema.json
  • packages/amico-run/src/amico.ts
  • packages/amico-run/src/doctor.ts
  • packages/amico-run/src/doctor_schema.ts
  • packages/amico-run/src/surfaces.ts
  • packages/amico-run/test/amico.test.ts
  • packages/amico-run/test/doctor.test.ts
  • packages/amico-run/test/fixtures/surfaces/README.md
  • packages/amico-run/test/helpers.ts
  • packages/amico-run/test/surfaces.test.ts

📝 Walkthrough

Walkthrough

Doctor v2 adds six-surface inventory reporting to amico doctor. It supports injectable roots, --running-binary, canonical --json output, schema validation, deterministic verdicts, human-readable rendering, and hermetic fixture tests.

Changes

Doctor v2 surface inventory

Layer / File(s) Summary
Report contract and CLI arguments
packages/amico-run/schemas/doctor-report.schema.json, packages/amico-run/src/doctor_schema.ts, packages/amico-run/src/doctor.ts, packages/amico-run/src/amico.ts
The doctor command accepts JSON and root-selection options. The report schema and zero-dependency validator enforce the six-record contract.
Surface probes and verdict classification
packages/amico-run/src/surfaces.ts
The inventory probes server binaries, extensions, vendored binaries, staged skills, and global and staging agent cards. It classifies records as current, stale, integrity-failure, or unknown.
Doctor report output and routing
packages/amico-run/src/doctor.ts, packages/amico-run/src/amico.ts, packages/amico-run/src/surfaces.ts
The report combines studio diagnosis with surface records. It renders the surfaces table and returns canonical JSON without changing diagnosis-based exit status.
Hermetic verdict and integration validation
packages/amico-run/test/helpers.ts, packages/amico-run/test/surfaces.test.ts, packages/amico-run/test/doctor.test.ts, packages/amico-run/test/amico.test.ts, packages/amico-run/test/fixtures/surfaces/README.md
Pinned fixture worlds and tests cover verdict matrices, argument parsing, schema constraints, canonical serialization, and router output.

Estimated code review effort: 4 (Complex) | ~60 minutes

Sequence Diagram(s)

sequenceDiagram
  participant CLI
  participant DoctorReport
  participant SurfaceInventory
  participant Sources
  participant FleetSurfaces
  CLI->>DoctorReport: pass doctor arguments
  DoctorReport->>SurfaceInventory: request six-surface report
  SurfaceInventory->>Sources: refresh remote-tracking state
  SurfaceInventory->>FleetSurfaces: inspect files, binaries, processes, and receipts
  FleetSurfaces-->>SurfaceInventory: return verdicts and evidence
  SurfaceInventory-->>DoctorReport: return surface records
  DoctorReport-->>CLI: return rendered output or canonical JSON
Loading
✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch 525-doctor-v2

Comment @coderabbitai help to get the list of available commands.

…ll tracer (#525)

surfaces.ts: server-binary, extension, vendored-binary, staged-skills,
agent-cards-global, agent-cards-staging probes over an injectable
SurfaceContext. Verdicts by version string or content digest only — never
mtime; version-sorted 'newest' selection; probes degrade individually.
Hermetic current-world fixture: fake binaries print pinned far-future build
dates, git fixtures carry pinned commit dates, remotes are local bare repos.
…ells (#525)

server-binary's three stale mechanisms as separate fixtures (version-stale,
running≠frozen, server-down); per-surface stale cells; tampered-sidecar
integrity-failure; unknown ×6 (dead-remote stubs, missing-local-source);
degradation proof — every source dead still yields six records.
…ing (#525)

- schemas/doctor-report.schema.json: the committed machine contract
  (surfaces minItems 6; required surface/version/verdict/evidence), itself
  in canonical form; doctor_schema.ts validates against it (zero new deps,
  the vault-card minimal-engine pattern).
- doctor.ts: doctorReport(argv) parses --json + the seven injectable
  flags; composes v1's binding diagnosis with the surface inventory; v1's
  rendered/exit contract preserved verbatim (report GAINS a surfaces
  section; --json emits canonical JSON, surfaces only).
- amico.ts: the doctor case passes argv and prints json when present.
- Fixture world extracted to test/helpers.ts (shared by the unit + CLI
  suites); platform dir derived from the live platform (runner-portable);
  hermetic discoverRunning default (a forgotten stub reads server-down,
  never the real machine's process).
- CLI end-to-end: amico doctor --json through the built bundle emits the
  canonical contract; human output keeps the v1 table + surfaces section.
- test/fixtures/surfaces/README.md: the authorship-split record
  (implementer cells here; reviewer adversarial variants listed).
@aarontrowbridge
aarontrowbridge marked this pull request as ready for review August 23, 2026 17:30
@aarontrowbridge
aarontrowbridge merged commit a8d33df into main Aug 23, 2026
8 checks passed
@aarontrowbridge
aarontrowbridge deleted the 525-doctor-v2 branch August 23, 2026 17:30
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 v2: surface inventory, injectable probes, JSON contract, verdict-matrix fixtures

1 participant