Skip to content

feat(cli): add verisimiser validate subcommand#85

Merged
hyperpolymath merged 1 commit into
mainfrom
feat/validate-subcommand
May 14, 2026
Merged

feat(cli): add verisimiser validate subcommand#85
hyperpolymath merged 1 commit into
mainfrom
feat/validate-subcommand

Conversation

@hyperpolymath
Copy link
Copy Markdown
Owner

Summary

Per V-L3-G1: init/start/status had no upstream sanity check on the manifest. Add a verisimiser 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:

  1. manifest-loads — file exists, parses, deserialises
  2. schema-source-exists — if [database].schema-source is set, the file exists
  3. sidecar-path-writable — parent dir of [sidecar].path is writable / createable

Out 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) -> ValidationReport

Closes

Test plan

  • cargo clippy --all-targets -- -D warnings clean
  • cargo test --lib --bins 46/46 (3 new: good_manifest_passes, missing_schema_source_fails, malformed_manifest_fails_load_check)
  • Each failure mode tested independently
  • Exit code reflects pass/fail

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>
@hyperpolymath hyperpolymath merged commit 0cefa56 into main May 14, 2026
16 of 18 checks passed
@hyperpolymath hyperpolymath deleted the feat/validate-subcommand branch May 14, 2026 15:00
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.

V-L3-G1: add verisimiser validate subcommand

1 participant