Skip to content

fix(docs-check): tighten --coverage rule 3 + add --warn-only mode (#248)#250

Merged
avrabe merged 1 commit intomainfrom
fix/issue-248-coverage-gate
May 1, 2026
Merged

fix(docs-check): tighten --coverage rule 3 + add --warn-only mode (#248)#250
avrabe merged 1 commit intomainfrom
fix/issue-248-coverage-gate

Conversation

@avrabe
Copy link
Copy Markdown
Contributor

@avrabe avrabe commented Apr 30, 2026

Closes #248.

Summary

Two fixes to rivet docs check --coverage (the gate from #241):

  • B5 — Rule 3 too generous. The COVERAGE_TOPIC_MAP umbrella rule
    used to be "if the parent has a topic, the child is covered." That
    marked lsp, batch, etc. as covered via cli even though the
    cli topic body doesn't actually mention them. The rule now also
    requires the parent topic body to contain the child subcommand name
    as a whole word, case-insensitive (\b<name>\b). A catch-all
    umbrella that doesn't reference the family is no coverage at all.

  • B6 — --coverage had no GitHub-annotation surface. The
    previous default warn-on-failure pattern ran the gate but exited 0
    silently, with no way to surface gaps inline on PRs. Replaced with
    three explicit modes:

    Mode Exit Annotations Use for
    --coverage 0 none local exploration
    --coverage --warn-only 0 ::warning file=…::… per gap CI rollout
    --coverage --strict 1 if any gap none enforcing CI

    --warn-only and --strict are clap-enforced mutually exclusive.
    The CI workflow now uses --warn-only explicitly so the contract is
    legible at the call site.

Before / after coverage on main

  • Before: Coverage: 48/81 (59%), 33 uncovered.
  • After: Coverage: 46/81 (56%), 35 uncovered — lsp and batch
    surface as gaps now that the umbrella rule no longer hides them
    (rule 3 tightening increases the uncovered count, as expected).

Test plan

  • cargo check — clean
  • cargo clippy --workspace --all-targets -- -D warnings — clean
  • cargo fmt --all — clean
  • cargo test -p rivet-cli — all tests pass (12 new unit + 8
    integration tests, including 6 new rule-3 unit tests and 3 new
    integration tests for --warn-only and clap mutual-exclusion)
  • rivet docs check --coverage — prints, exits 0, no annotations
  • rivet docs check --coverage --warn-only — prints + 35
    ::warning:: annotations, exits 0
  • rivet docs check --coverage --strict — prints, exits 1
  • rivet docs check --coverage --warn-only --strict — clap rejects
    with conflict error, exits 2
  • rivet docs check (no flags) — unchanged, doc-check PASS

Related

🤖 Generated with Claude Code

Two fixes to `rivet docs check --coverage` (the gate from #241):

* B5 — rule 4 (umbrella mapping via `COVERAGE_TOPIC_MAP`) now requires
  the parent topic body to mention the child subcommand by name as a
  whole word, case-insensitive. A catch-all `cli` mapping that doesn't
  reference the family is no coverage at all. With the current TOPICS
  registry this surfaces `lsp` and `batch` as additional gaps
  (was 48/81 covered; now 46/81).

* B6 — replace the implicit two-state warn/strict pattern with three
  explicit modes:
    --coverage              print, exit 0, no annotations (local use)
    --coverage --warn-only  print + emit ::warning::file=…::… GitHub
                            Actions annotations per gap, exit 0
                            (CI rollout — surface gaps inline on PRs
                            without failing the build)
    --coverage --strict     print, exit 1 on any uncovered (enforcing CI)

  `--warn-only` and `--strict` are mutually exclusive (clap-enforced).
  CI workflow now uses `--warn-only` explicitly so the contract is
  legible at the call site rather than relying on the previous default
  warn-on-failure semantics.

The `rivet docs docs-coverage` topic and the docs::TOPICS body are
updated to describe the three modes and the rule-4 body-mention check.

Tests:
  * 6 new unit tests for the body-mention rule (positive/negative,
    case-insensitive, whole-word, plus a direct test of the
    `topic_body_mentions` helper).
  * Integration: `coverage_warn_only_emits_github_annotations` asserts
    at least one `::warning file=…::` line is printed and exit is 0.
  * Integration: `coverage_strict_currently_fails_on_main` pins exit 1
    behaviour while the inventory has gaps.
  * Integration: `coverage_warn_only_and_strict_are_mutually_exclusive`
    pins clap conflict-rejection.
  * Integration: existing `coverage_default_exits_zero_no_annotations`
    asserts no `::warning::` lines in the default mode.

Closes #248.

Implements: REQ-007
Copy link
Copy Markdown

@github-actions github-actions Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ 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: ec1e8a4 Previous: b7a17be Ratio
store_insert/10000 15885926 ns/iter (± 1427903) 10641021 ns/iter (± 264093) 1.49
link_graph_build/10000 35895303 ns/iter (± 4115915) 22660622 ns/iter (± 884929) 1.58
validate/10000 16841744 ns/iter (± 4432787) 12248917 ns/iter (± 180828) 1.37

This comment was automatically generated by workflow using github-action-benchmark.

@github-actions
Copy link
Copy Markdown

📐 Rivet artifact delta

No artifact changes in this PR. Code-only changes (renderer, CLI wiring, tests) don't touch the artifact graph.

@codecov
Copy link
Copy Markdown

codecov Bot commented Apr 30, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

@avrabe avrabe merged commit a50fbb7 into main May 1, 2026
25 of 40 checks passed
@avrabe avrabe deleted the fix/issue-248-coverage-gate branch May 1, 2026 12:44
avrabe added a commit that referenced this pull request May 2, 2026
* chore(release): v0.8.0 — dogfood follow-ups

Workspace, vscode-rivet, and npm root package versions bumped to 0.8.0.
Platform packages stay on the release-npm.yml override path.

What's in 0.8.0:

- fix(docs): stale literals + extend rivet docs check (#252, closes
  #247). Six embedded-doc literals fixed, plus three new invariants
  (EmbeddedVersionLiterals, EmbeddedFlagReferences,
  EmbeddedTodoMarkers) to prevent the class of drift from re-shipping.
- feat(docs-check): tighten --coverage rule 4 + --warn-only (#250,
  closes #248). Rule 4 now requires child name to appear in parent
  body (catches false-positives on lsp + batch). New three-mode
  semantics: default silent / --warn-only with annotations / --strict
  fail.
- feat(cli): cited-source --strict, --strict-cited-source-stale,
  schema migrate --list (#251, closes #249). Read-only audit gate
  for cited-source drift; promotable stale severity; recipe discovery.

Trace: skip

* ci: ignore RUSTSEC-2026-0114 (wasmtime 42.x table-allocation panic)

New wasmtime advisory published 2026-04-30, blocking 0.8.0 CI.
Rivet's wasmtime usage is behind an optional wasm feature gate and
doesn't allocate large wasmtime tables, so the panic case isn't
reachable. Follow-up issue will track upgrading to wasmtime >=43.0.2.

Trace: skip
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.

docs-check: --coverage gate has false-positives + soft-warn pattern broken

1 participant