fix(docs): make bridge schemas discoverable (REQ-328, #895) - #905
Conversation
`rivet coverage` reports traceability rules that come from the embedded bridge schemas. jess saw three of them at 0.0% — constraint-has-requirement, controller-constraint-has-requirement, stpa-constraints-provide-evidence — and `rivet docs schema/<bridge>` answered "Unknown topic" for every spelling they tried. Reproduced on current main, with the reporter's own command: schema/stpa-dev.bridge 0 hits schema/safety-case-stpa.bridge 0 hits schema/dev serves the schema normally A rule you can watch fail and cannot look up is a rule you cannot act on: nothing tells you which link type or target types would satisfy it. Same shape as a gate whose output a reader cannot turn into an action. The bridges were embedded all along as BRIDGE_SCHEMAS with filename, extends and content — they were simply never registered as documentation topics. The fix derives the topics FROM that registry rather than listing them by hand, so a bridge added later cannot ship undocumented. Lookup, `docs --list` in both text and JSON, and `docs <slug>` all consult it. Deliberately NOT folded into topic_bodies, which feeds the embedded-doc invariants in `rivet docs check`. Those scan markdown prose; bridge content is schema YAML and would be judged against rules written for something else. The oracle asserts over the registry rather than a fixed list — every entry must be both servable AND present in the listing, since a topic nobody can find is only half fixed. Negative-controlled: disabling the fallback reddens it with all seven bridges named. Reporter's test after the fix: schema/stpa-dev.bridge returns 2 hits for constraint-has-requirement. safety-case-stpa.bridge still returns 0 for that rule, correctly — it is defined in stpa-dev.bridge, and being able to discover which bridge owns a rule is the point. Confirmed with cargo fmt --check, clippy --all-targets -D warnings on 1.97.0, cargo test --workspace (exit 0, 66 ok), the full cli_commands suite (194 passed), rivet validate, rivet docs check, yamllint — all exit 0. Implements: REQ-328 Verifies: REQ-328
📐 Rivet artifact delta
Graphgraph LR
REQ_328["REQ-328"]:::added
classDef added fill:#d4edda,stroke:#28a745,color:#155724
classDef removed fill:#f8d7da,stroke:#dc3545,color:#721c24
classDef modified fill:#fff3cd,stroke:#ffc107,color:#856404
classDef overflow fill:#e2e3e5,stroke:#6c757d,color:#495057,stroke-dasharray: 3 3
Added
Posted by |
|
Closing as duplicate of #903, which came first (2026-09-07) and is the better I picked up #895 without checking the open PR list, which is on me — second time For the record on why yours wins rather than mine: #903 registers the seven Nothing here is worth salvaging on top of #903. The one line I'd offer as a |
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: db8c58f | Previous: a80ca3a | Ratio |
|---|---|---|---|
store_insert/10000 |
16838855 ns/iter (± 1775541) |
12739051 ns/iter (± 575699) |
1.32 |
This comment was automatically generated by workflow using github-action-benchmark.
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
Closes #895.
rivet coveragereports traceability rules that come from the embedded bridgeschemas. You saw three at 0.0% —
constraint-has-requirement,controller-constraint-has-requirement,stpa-constraints-provide-evidence—while
rivet docs schema/<bridge>answeredUnknown topicfor every spelling.Reproduced on current
mainwith your own command:A rule you can watch fail and cannot look up is a rule you cannot act on —
nothing tells you which link type or target types would satisfy it.
The bridges were embedded all along
BRIDGE_SCHEMAScarriesfilename,extendsandcontentfor all seven. Theywere simply never registered as documentation topics.
So the fix derives the topics from that registry rather than listing them by
hand — a bridge added later cannot ship undocumented. Lookup,
docs --list(textand JSON) and
docs <slug>all consult it.Deliberately not folded into
topic_bodies, which feeds the embedded-docinvariants in
rivet docs check: those scan markdown prose, and bridge contentis schema YAML that would be judged against rules written for something else.
The oracle asserts over the registry, not a list
Every entry must be both servable and present in the listing — a topic nobody
can find is only half fixed.
After the fix
schema/stpa-dev.bridgereturns 2 hits forconstraint-has-requirement.safety-case-stpa.bridgestill returns 0 for that rule — correctly, it's definedin
stpa-dev.bridge. Being able to discover which bridge owns a rule is thepoint.
Gates
cargo fmt --check·clippy --all-targets -D warningson 1.97.0 ·cargo test --workspace(exit 0, 66 ok) · fullcli_commands(194 passed) ·rivet validate·rivet docs check·yamllint— all exit 0.