fix(validate): sync artifact-id shape with the commit-trailer parser (REQ-239, #577)#640
Merged
Merged
Conversation
…(REQ-239, #577) The YAML validator accepted ids the commit-trailer parser rejected, so an author only discovered a naming problem when `rivet commit` refused the trailer — a surprise re-naming loop. Sync both directions, sharing one shape rule (crate::commits) so validate and the parser can never diverge again. 1. Relax `is_artifact_id`: a prefix SEGMENT may now contain digits as long as it has at least one uppercase letter, so `MAD1-101` is a valid trailer ref (was rejected for the digit in `MAD1`). Still rejects no-letter (`123-4`), lowercase (`mad1-1`), and non-digit suffixes. 2. `rivet validate` now WARNs (`commit-ref-shape`) when an id looks like a botched numbered id — a hyphen and a digit but not parseable, e.g. a dotted suffix `H-3.2` — so the mismatch surfaces at validate time, not commit time. Runs in the shared structural pass, so `validate` and `validate --direct` stay byte-identical (REQ-241); externally-prefixed ids are excluded. On rivet's own artifacts the lint flags exactly the 12 dotted STPA hazard ids (`H-1.1`…), not the descriptive `ARCH-*` scheme or external `spar:*` ids. Unit tests cover the relaxed rule and the lint (MAD1-101 accepted, H-3.2 flagged). Implements: REQ-239 Verifies: REQ-239 Fixes: REQ-004 Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
📐 Rivet artifact delta
Graphgraph LR
REQ_239["REQ-239"]:::modified
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
Modified
Posted by |
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.
What
Closes #577. The YAML validator accepted IDs the commit-trailer parser rejected, so authors hit a surprise rename loop only when
rivet commitrefused the trailer. Both directions are now synced, sharing one shape rule (crate::commits) — the "both" option.Changes
is_artifact_id: a prefix segment may contain digits if it has ≥1 uppercase letter, soMAD1-101is a valid trailer ref (was rejected for the digit inMAD1). Still rejects123-4(no letter),mad1-1(lowercase), non-digit suffixes.rivet validateWARNs (commit-ref-shape) when an ID looks like a botched numbered ID — hyphen + digit but unparseable, e.g. dotted suffixH-3.2— so the mismatch surfaces at validate time. Runs in the shared structural pass sovalidate/validate --directstay byte-identical (REQ-241); externalprefix:IDs excluded.Verification
H-1.1…), not the descriptiveARCH-*scheme or externalspar:*.--all-targetsclean; validate/direct still identical.🤖 Generated with Claude Code