Skip to content

test(cli): pin storage health rejection and un-red doctor_all_checks_passed - #1217

Merged
huichen merged 2 commits into
mainfrom
fix/doctor-storage-health
Oct 19, 2026
Merged

huichen merged 2 commits into
mainfrom
fix/doctor-storage-health

Conversation

@huichen

@huichen huichen commented Oct 19, 2026

Copy link
Copy Markdown
Collaborator

Why

doctor_all_checks_passed mocked a reachable agent with get_state + list_sessions but no get_storage_health. On a host whose sandbox probe passes, the Sessions check therefore took the storage_health() error arm, printed "Database health was not verified: Agent returned an incomplete storage health report", and the test failed at assert!(stdout.contains("All checks passed.")). CI stayed green only because its sandbox probe fails and the test takes the else branch.

The deeper gap: the "an incomplete health report must be an error" contract added in #1186 had no test watching it — the red on macOS was the only thing exercising it. This was a test that never followed the #1186 contract, not a product bug.

Changes (tests only)

  • cli/src/commands/doctor.rs: doctor_all_checks_passed now mocks get_storage_health with the complete report shape (including pendingQueuedInputs, same as doctor_full_house_all_ok), so the all-clear branch is actually reachable on a sandbox-capable host.
  • cli/src/rpc.rs: added three unit tests around RunClient::storage_health:
    • storage_health_accepts_a_complete_report — positive control.
    • storage_health_rejects_a_report_without_pending_queued_inputs — a report missing pendingQueuedInputs returns Err containing incomplete storage health report.
    • storage_health_rejects_a_schema_version_mismatch — schemaVersion off by one returns the same Err.

No product logic, required-field list, or existing assertion changed.

Other doctor tests

I checked every test that spawns a reachable MockAgent: only doctor_full_house_all_ok and doctor_all_checks_passed do. The former already mocks get_storage_health; every other doctor test points at an unreachable local address, so an agent warning keeps them away from the all-clear. No further fixtures needed.

Verification (macOS, pinned 1.97 toolchain)

  • cargo test -p future-cli --lib → 1242 passed, 0 failed.
  • Falsification: removing "pendingQueuedInputs" from the required list in storage_health() makes storage_health_rejects_a_report_without_pending_queued_inputs fail (a report without pendingQueuedInputs must be rejected); reverting restores green.
  • cargo fmt -p future-cli --check and cargo clippy -p future-cli --all-targets -- -D warnings clean.

…_health rejection

doctor_all_checks_passed mocked a reachable agent without
get_storage_health, so on hosts whose sandbox probe passes the Sessions
check warned and the test never reached 'All checks passed.'; it stayed
green in CI only because CI's probe fails. Add the complete report and
unit tests for the incomplete-report and schema-mismatch rejection paths
so the contract added in #1186 is actually guarded.
@huichen
huichen enabled auto-merge (squash) October 19, 2026 06:45
@huichen
huichen merged commit 63e04c3 into main Oct 19, 2026
16 checks passed
@huichen
huichen deleted the fix/doctor-storage-health branch October 19, 2026 06: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.

1 participant