Conversation
…ionLiterals / EmbeddedFlagReferences / EmbeddedTodoMarkers (#247) Fixes four stale literals shipped in 0.7.0 docs and extends `rivet docs check` with three new invariants that scan the embedded `rivet docs <topic>` bodies (the strings printed by the binary, not files on disk) so this class of drift surfaces at CI time instead of via user reports. Part A — fixes: * `quickstart` topic step 1: replace `rivet 0.5.0` literal expectation with version-agnostic prose (`rivet ` + any version). * `mcp` topic: change the `serverInfo` example version from a hard- coded `0.5.0` to `<rmcp-version>` and add a note explaining that field reflects the underlying rmcp crate, not rivet's release line. * `schemas/eu-ai-act.yaml` (drives `rivet docs schema/eu-ai-act`): flip the single-schema usage line from `rivet init --schema eu-ai-act` to `rivet init --preset eu-ai-act`. Multi-schema bridge examples (e.g. `--schema eu-ai-act,stpa`) are valid and stay. * `schemas/dev.yaml` (drives `rivet docs schema/dev`): drop the `docs/agent-pipelines.md (TODO)` cross-reference to a non-existent topic. * Bonus: `rivet docs impact` example used a stale tag literal (`v0.5.0`); replaced with `vX.Y.Z` placeholder. * Bonus: `rivet export --gherkin` was a stale flag; rewritten to `rivet export --format gherkin` in dev.yaml + main.rs comment. Part B — new invariants in `rivet-core/src/doc_check.rs`: * `EmbeddedVersionLiterals` — every `vX.Y.Z` / `X.Y.Z` token in a topic body must equal the workspace version OR be in `rivet.yaml docs-check.allowed-version-literals`. Allowlist entries without a `v` prefix also match the `v`-prefixed form so users only have to allowlist one shape. * `EmbeddedFlagReferences` — every `rivet <subcmd> --<flag>` token in a topic body must reference a flag declared on that subcommand in the live clap tree. Walks parent-up so root-level globals (`--project`, `--verbose`) and intermediate flags resolve. When the *subcommand* itself is unknown we defer to `SubcommandReferences`, not double-report. * `EmbeddedTodoMarkers` — `TODO` / `FIXME` / `XXX` in topic bodies are author markers that must not ship in a release binary. Inline meta- references (`` `TODO` ``) are skipped so docs-about-the-invariant stay legal. Wiring (rivet-cli/src/main.rs + rivet-cli/src/docs.rs): * `docs::topic_bodies()` exposes (slug, body) pairs for the engine. * `build_subcommand_flag_map()` walks `Cli::command()` and collects long flags per slash-separated path, seeded with root-level globals and the clap built-ins (`--help`, `--version`). * `cmd_docs_check` populates `embedded_topics`, `subcommand_flags`, and `allowed_version_literals` on the `DocCheckContext`. Config (rivet-core/src/model.rs): * Adds `allowed_version_literals: Vec<String>` to `DocsCheckConfig` (the `docs-check:` block in `rivet.yaml`). * Repo's own `rivet.yaml` is updated with the literals shipped in rivet's schemas/topics (schema header versions, ASPICE process IDs, supply-chain example artifacts, rmcp pin). New topic + tests: * Adds a `docs-check` reference topic listing both the markdown and embedded-doc invariants and showing the allowlist syntax. * 10 new unit tests in `doc_check::tests` cover each new invariant plus the no-topics-disabled smoke (existing engine consumers that don't populate the field still pass). `rivet docs check` is clean against the rivet repo after Part A; CI's existing `cargo run -- docs check` step picks the new invariants up automatically via `default_invariants()` — no workflow change needed. Closes #247 Implements: REQ-004, REQ-007 Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
📐 Rivet artifact deltaNo artifact changes in this PR. Code-only changes (renderer, CLI wiring, tests) don't touch the artifact graph. |
There was a problem hiding this comment.
⚠️ Performance Alert ⚠️
Possible performance regression was detected for benchmark 'Rivet Criterion Benchmarks'.
Benchmark result of this commit is worse than the previous benchmark result exceeding threshold 1.20.
| Benchmark suite | Current: aab831d | Previous: b7a17be | Ratio |
|---|---|---|---|
store_insert/10000 |
13830587 ns/iter (± 2010754) |
10641021 ns/iter (± 264093) |
1.30 |
link_graph_build/10000 |
28082563 ns/iter (± 1315562) |
22660622 ns/iter (± 884929) |
1.24 |
validate/10000 |
18217281 ns/iter (± 2968178) |
12248917 ns/iter (± 180828) |
1.49 |
This comment was automatically generated by workflow using github-action-benchmark.
Codecov Report❌ Patch coverage is
📢 Thoughts on this report? Let us know! |
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.
Closes #247.
Summary
Fixes four stale literals shipped in 0.7.0 docs and extends
rivet docs checkwith three new invariants that scan the embeddedrivet docs <topic>bodies — the strings printed by the binary, not files on disk — so this class of drift surfaces at CI time instead of via user reports.Per-fix walkthrough
Part A — stale literal fixes
rivet docs quickstartstep 1 — replaced therivet 0.5.0expectation with version-agnostic prose (rivet+ any version).rivet-cli/src/quickstart.md.rivet docs mcpserverInfoexample — changed the hard-coded\"version\":\"0.5.0\"to\"<rmcp-version>\"and added a note explaining the field reflects the underlying rmcp crate, not rivet's release line.rivet-cli/src/docs.rs.schemas/eu-ai-act.yaml(drivesrivet docs schema/eu-ai-act) — flipped the single-schema usage line fromrivet init --schema eu-ai-acttorivet init --preset eu-ai-act. Multi-schema bridge examples (--schema eu-ai-act,stpa) are valid uses of the existing flag and stay.schemas/dev.yaml(drivesrivet docs schema/dev) — dropped thedocs/agent-pipelines.md (TODO)cross-reference to a non-existent topic.rivet docs impactexample used a stale tag literalv0.5.0; replaced with the placeholdervX.Y.Z.rivet export --gherkinflag inschemas/dev.yaml(flag is--format gherkin, not--gherkin); also fixed the matching comment inrivet-cli/src/main.rs.Part B — three new invariants in
rivet-core/src/doc_check.rsEmbeddedVersionLiterals— everyvX.Y.Z/X.Y.Ztoken in a topic body must equal the workspace version OR be inrivet.yamldocs-check.allowed-version-literals. Allowlist entries without avprefix also match thev-prefixed form (single source of truth).EmbeddedFlagReferences— everyrivet <subcmd> --<flag>token in a topic body must reference a flag declared on that subcommand in the live clap tree. Walks parent-up so root-level globals (--project,--verbose) and intermediate flags resolve. When the subcommand itself is unknown we defer toSubcommandReferences, not double-report.EmbeddedTodoMarkers—TODO/FIXME/XXXin topic bodies are author markers that must not ship in a release binary. Inline meta-references like`TODO`are skipped so docs-about-the-invariant stay legal.Wiring
docs::topic_bodies()exposes(slug, body)pairs for the engine.build_subcommand_flag_map()walksCli::command()and collects long flags per slash-separated path, seeded with root-level globals and the clap built-ins (--help,--version).cmd_docs_checkpopulatesembedded_topics,subcommand_flags, andallowed_version_literalson theDocCheckContext.DocsCheckConfig::allowed_version_literals(thedocs-check:block inrivet.yaml).New topic
Added a
docs-checkreference topic that lists both the markdown invariants and the new embedded-doc invariants, plus the allowlist syntax.Tests
doc_check::testsexercise each new invariant plus the no-topics-disabled smoke (existing engine consumers that do not populate the field still pass).cargo test --workspace).CI
The CI step
cargo run --release -p rivet-cli -- docs checkpicks the new invariants up automatically viadefault_invariants()— no workflow change needed.Test plan
cargo buildcleancargo clippy --workspace --all-targets -- -D warningscleancargo fmt --all -- --checkcleancargo test --workspaceclean (912 unit tests + integration tests)cargo test -p rivet-core --lib doc_check— 36 passing (10 new)rivet docs check— clean against rivet repo (47 files scanned, 0 violations)rivet validate— no new errors (6 errors, 140 warnings — pre-existing baseline)