feat: schema-driven YAML extraction — the stpa.rs replacement (Phase 3)#120
Merged
feat: schema-driven YAML extraction — the stpa.rs replacement (Phase 3)#120
Conversation
The capstone: extract_schema_driven() uses yaml-section and shorthand-links metadata from the schema to parse both generic-yaml and STPA-yaml formats with ONE function. - Reads yaml-section to map top-level keys to artifact types - Converts shorthand-links fields to Link objects automatically - Falls back to generic artifacts: extraction when no section matches - Handles mixed-section files (losses + hazards in same file) Added yaml-section + shorthand-links to controller-constraint and loss-scenario types in STPA schema (was missing). 4 new tests: losses, hazards with shorthand links, mixed sections, generic fallback. Total: 14 HIR tests. This function can replace the 861-line stpa.rs once wired into the salsa pipeline (Phase 5).
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: 34409b8 | Previous: e4f398e | Ratio |
|---|---|---|---|
validate/10000 |
12550053 ns/iter (± 1657368) |
10328007 ns/iter (± 93067) |
1.22 |
traceability_matrix/1000 |
61361 ns/iter (± 1710) |
47654 ns/iter (± 150) |
1.29 |
query/1000 |
8407 ns/iter (± 43) |
6562 ns/iter (± 47) |
1.28 |
query/10000 |
128048 ns/iter (± 2270) |
90301 ns/iter (± 409) |
1.42 |
document_parse/100 |
176800 ns/iter (± 2008) |
145353 ns/iter (± 13733) |
1.22 |
document_parse/1000 |
1661441 ns/iter (± 30260) |
1357315 ns/iter (± 19462) |
1.22 |
This comment was automatically generated by workflow using github-action-benchmark.
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
The architectural capstone:
extract_schema_driven()uses schema metadata to parse YAML without hardcoded type knowledge.yaml-section: losseson a type → parser findslosses:key, auto-setsartifact_type: lossshorthand-links: {losses: leads-to-loss}→ convertslosses: [L-001]to proper Linksartifacts:extractionThis single function replaces the 861-line
formats/stpa.rswith its 14 serde structs. Deletion comes in Phase 6 after wiring into salsa (Phase 5).4 new schema-driven tests. 14 total HIR tests.
Refs #22, #93.
🤖 Generated with Claude Code