feat(check): add rivet check docs oracle with --format json + --strict (#540)#541
Conversation
📐 Rivet artifact deltaNo artifact changes in this PR. Code-only changes (renderer, CLI wiring, tests) don't touch the artifact graph. |
Codecov Report❌ Patch coverage is
📢 Thoughts on this report? Let us know! |
Dogfood on gale's real
|
…ict (#540) Enumerates every candidate path the doc scanner considered, tagging each `loaded` / `skipped (<reason>)` / `excluded (<glob>)`. Mirrors the existing oracle pattern (`rivet check sources` / `bidirectional` / `gaps_json`) — narrow, mechanical, scriptable. Default output is human text; `--format json` emits the canonical `{oracle,entries,total, by_status}` envelope for pipeline consumers. `--strict` exits non-zero when any entry is `skipped` (explicit `excluded` allowlist matches do not trip strict). Reuses the existing `load_documents_with_report` iteration verbatim via a new `scan_documents(dir, exclude) -> Vec<ScannedDoc>` that returns per-path detail instead of emitting stderr warnings — the warning-printing path is left untouched, so `rivet validate`'s output is byte-identical. Tests: `rivet-cli/tests/docs_check.rs` covers the four fixture cases (loaded / no-frontmatter / missing-id frontmatter / excluded-by-glob), the strict exit-code branches in both directions, and the human-text shape. Closes #540. Implements: REQ-007 Refs: REQ-004
1feb996 to
0ec7c0c
Compare
First release since v0.16.1, cut to ship the RUSTSEC-2026-0182 wasmtime fix and the feature batch to downstream consumers (gale waits on a release, not main): Security: wasmtime 43 -> 44.0.3 (#542). Added: `rivet check docs` oracle (#541), minimal --no-default-features build (REQ-202/#456), `init --vendor-schemas` (REQ-220/#431), runner-liveness alert (#509). Fixed: next-id git-history awareness (REQ-218/#479), JSON error envelope on parse failure (REQ-219/#500), variant binding-file loader (#539), `accepted` status enum (#525). Confirmed: `cargo build` green, lock synced to 0.17.0, `rivet validate` PASS, `rivet docs check` PASS (0 violations). Trace: skip Co-authored-by: Claude Opus 4.8 <noreply@anthropic.com>
What
A new dedicated
rivet check docsoracle that enumerates every candidate path the doc scanner considered and tags eachloaded/skipped (<reason>)/excluded (<glob>). Default output is human text;--format jsonemits the canonical{oracle, entries, total, by_status}envelope;--strictexits non-zero when any entry is skipped (excluded allowlist matches do not trip strict — explicit opt-in).How the kill-criterion is met
rivet_core::document::scan_documents(dir, exclude) -> Vec<ScannedDoc>returns per-path detail. The existingload_documents_with_reportis unchanged (other call sites —serve, validate — keep their byte-identical stderr-warning behavior).ScannedDoccarriesstatus: Loaded | Skipped(reason) | Excluded(pattern); the reason forSkippedis verbatim what the scanner would have printed ("no YAML frontmatter"or the serde parse-error message).--format json: canonical envelope, snake-case, deterministic ordering.--strict: exits 1 on anySkipped. Excluded files don't trip it.Tests
rivet-cli/tests/docs_check.rs(new): four fixture cases (loaded / no-frontmatter / missing-id frontmatter / excluded-by-glob), both--strictbranches (skipped → exit 1; same files excluded → exit 0), and the human-text shape.cargo fmt,cargo clippy --all-targets -- -D warnings,cargo test -p rivet-core -p rivet-cli, andrivet validateon the rivet repo itself are all clean.Dogfood against the gale skip cases
The maintainer's verification target is gale's three live skips (
mcuboot-coverage-analysis.md,release-plan.md,wasm-module-distribution.md). Those files don't live in this repo, but the mechanism is verified against synthetic fixtures with the same three failure modes (no-frontmatter, missing-id frontmatter, excluded-by-glob). On gale,rivet check docs --format jsonshould show each of the three with its current reason and--strictshould exit non-zero until they're fixed or excluded — exactly the issue's contract.Draft note (process)
Opened as draft because
https://pulseengine.eu/blog/is returning HTTP 503 right now (same expired-TLS / site-infra symptom that's been on every recent triage thread — #420, #422, #431, #436, #456, #468, #479, #482, #488, #490, #500, #508, #509, #516, #522, #523, #530, #532, #538, #540), so the routine that opened this PR could not consult the authoritative process guidance the maintainer requires before opening a PR. The technical work and the kill-criterion are complete; please move out of draft once the blog is reachable and a quick process check passes (or if the local AGENTS.md guidance is sufficient —cargo fmt/cargo clippy --all-targets -D warnings/cargo test -p rivet-core -p rivet-cli/rivet validateare all clean, and theImplements:/Refs:trailers per CLAUDE.md are on the commit).Closes #540.
Generated by Claude Code