feat(cli): add verisimiser validate subcommand#85
Merged
Conversation
Closes #52. `init/start/status` had no upstream "is this manifest sane?" check. Errors only surfaced at the moment some later stage tried to use a mis-shaped field, often with unhelpful messages. Add a `validate` subcommand that runs every check it can up front and reports them all in one go (one failure does not short-circuit the remaining checks). New public API in `manifest`: - `ValidationCheck { name, description, passed, detail }` — one row per check. - `ValidationReport { manifest, passed, checks, failed_count() }` — the aggregate, serialisable for `--json`. - `validate_manifest(path) -> ValidationReport` — runs all checks. Checks performed in this initial cut: 1. `manifest-loads` — file exists, parses, deserialises (catches V-L3-H1 span-aware errors in passing). 2. `schema-source-exists` — if `[database].schema-source` is set, it points to a readable file. 3. `sidecar-path-writable` — parent dir of `[sidecar].path` is writable (or doesn't exist yet, in which case verisimiser will create it). Out of scope here: V-L2-E1 backend/target_db conflict (own issue #35), target-DB reachability (would require a live connection). The CLI subcommand: - Plain text by default: `[ok ] <name> — <description>` per row, a final pass/fail summary, exit 0 on pass / non-zero on fail. - `--json` emits the full `ValidationReport`. New tests in `manifest::validate_manifest_tests`: - `good_manifest_passes` — happy path. - `missing_schema_source_fails` — `schema-source` pointing at a nonexistent path produces exactly one failure on `schema-source-exists`. - `malformed_manifest_fails_load_check` — broken TOML short-circuits on `manifest-loads` and skips the dependent checks. `cargo clippy --all-targets -- -D warnings` clean; 46 unit tests pass. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
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.
Summary
Per V-L3-G1:
init/start/statushad no upstream sanity check on the manifest. Add averisimiser validate [--manifest <path>] [--json]subcommand that runs every check up front, reports them all in one go (one failure does not short-circuit the rest), and exits non-zero on any fail.Checks in this initial cut:
manifest-loads— file exists, parses, deserialisesschema-source-exists— if[database].schema-sourceis set, the file existssidecar-path-writable— parent dir of[sidecar].pathis writable / createableOut of scope: V-L2-E1 backend/target_db conflict (#35), target-DB reachability (live connection).
Public API:
ValidationCheck { name, description, passed, detail }ValidationReport { manifest, passed, checks, failed_count() }validate_manifest(path) -> ValidationReportCloses
Test plan
cargo clippy --all-targets -- -D warningscleancargo test --lib --bins46/46 (3 new: good_manifest_passes, missing_schema_source_fails, malformed_manifest_fails_load_check)