Repository navigation
test(cli): pin storage health rejection and un-red doctor_all_checks_passed - #1217
Merged
Merged
Conversation
…_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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Why
doctor_all_checks_passedmocked a reachable agent withget_state+list_sessionsbut noget_storage_health. On a host whose sandbox probe passes, theSessionscheck therefore took thestorage_health()error arm, printed "Database health was not verified: Agent returned an incomplete storage health report", and the test failed atassert!(stdout.contains("All checks passed.")). CI stayed green only because its sandbox probe fails and the test takes theelsebranch.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_passednow mocksget_storage_healthwith the complete report shape (includingpendingQueuedInputs, same asdoctor_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 aroundRunClient::storage_health:storage_health_accepts_a_complete_report— positive control.storage_health_rejects_a_report_without_pending_queued_inputs— a report missingpendingQueuedInputsreturnsErrcontainingincomplete storage health report.storage_health_rejects_a_schema_version_mismatch—schemaVersionoff by one returns the sameErr.No product logic, required-field list, or existing assertion changed.
Other doctor tests
I checked every test that spawns a reachable
MockAgent: onlydoctor_full_house_all_okanddoctor_all_checks_passeddo. The former already mocksget_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."pendingQueuedInputs"from the required list instorage_health()makesstorage_health_rejects_a_report_without_pending_queued_inputsfail (a report without pendingQueuedInputs must be rejected); reverting restores green.cargo fmt -p future-cli --checkandcargo clippy -p future-cli --all-targets -- -D warningsclean.