Conversation
Rivet's schema declares link-fields for STPA types (e.g. `uca.controller → issued-by`, `uca.hazards → leads-to-hazard`), but authors used the shorthand form (`controller: CTRL-X` at top level). Rivet's stpa-yaml source format does not expand the shorthand into the `links:` graph, so every artifact reported as "requires 1 target, found 0" despite 0 broken cross-refs. This PR inserts a canonical `links:` block after each artifact's `type:` line, derived from the shorthand fields. Shorthand is preserved (authors keep writing it; stpa-yaml keeps accepting it) — the migration only ADDS explicit entries for rivet's link-counter. Also fixes 6 artifacts in rendering-analysis.yaml that used `type: safety-requirement` — a type not declared in any loaded schema — by changing them to `type: requirement` (the closest declared type; the artifacts are requirements derived from STPA hazard analysis). Migration driver: scripts/stpa_migrate_links.py (text-based line transformer, preserves all comments and formatting). Before: `rivet validate` → FAIL (625 errors, 174 warnings, 0 broken cross-refs) After: `rivet validate` → PASS (91 warnings) Upstream: pulseengine/rivet#154 tracks the stpa-yaml parser side. Once rivet expands shorthand natively, this migration becomes redundant but not harmful (the explicit entries are still correct). Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 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.
Summary
rivet validateon main: FAIL (625 errors, 174 warnings, 0 broken cross-refs).This PR: PASS (91 warnings) — all 625 cardinality ERRORs resolved.
Root cause
Rivet's schema declares link-fields for STPA types (e.g.
uca.controller → issued-by,uca.hazards → leads-to-hazard). Authors used the shorthand form at the top level of each artifact:Rivet's
stpa-yamlsource format does not expand shorthand into thelinks:graph, so every artifact's link-counter reported "requires N targets, found 0" despite the cross-refs resolving fine (hence the0 broken cross-refsparadox).Upstream fix tracked at pulseengine/rivet#154.
What this PR does
links:block to 501 artifacts across 4 of 8 STPA YAML files, derived from their existing shorthand fields.type: safety-requirementartifacts inrendering-analysis.yamltotype: requirement— that type isn't declared in any loaded schema.Insertions per file:
safety/stpa/analysis.yamlsafety/stpa/solver-analysis.yamlsafety/stpa/security.yamlsafety/stpa/rendering-analysis.yamlMigration driver
scripts/stpa_migrate_links.py— text-based line transformer. Preserves all comments and formatting; only inserts new lines after eachtype:line.Mapping table hardcoded from AS-5506D §4-§11 + rivet's stpa schema:
Test plan
rivet validategoes FAIL → PASS.safety-requirement → requirementtype corrections).links:blocks and skips).Not in this PR
method,traces-to,mitigatesnot declared in schema) are unaffected by this migration. Fix requires either upstream rivet schema updates or further artifact rewriting — tracked at rivet#154.🤖 Generated with Claude Code