Skip to content

fix(validate): sync artifact-id shape with the commit-trailer parser (REQ-239, #577)#640

Merged
avrabe merged 1 commit into
mainfrom
fix/577-validate-commit-name-parity
Jul 1, 2026
Merged

fix(validate): sync artifact-id shape with the commit-trailer parser (REQ-239, #577)#640
avrabe merged 1 commit into
mainfrom
fix/577-validate-commit-name-parity

Conversation

@avrabe

@avrabe avrabe commented Jul 1, 2026

Copy link
Copy Markdown
Contributor

What

Closes #577. The YAML validator accepted IDs the commit-trailer parser rejected, so authors hit a surprise rename loop only when rivet commit refused the trailer. Both directions are now synced, sharing one shape rule (crate::commits) — the "both" option.

Changes

  1. Relax is_artifact_id: a prefix segment may contain digits if it has ≥1 uppercase letter, so MAD1-101 is a valid trailer ref (was rejected for the digit in MAD1). Still rejects 123-4 (no letter), mad1-1 (lowercase), non-digit suffixes.
  2. validate parity lint: rivet validate WARNs (commit-ref-shape) when an ID looks like a botched numbered ID — hyphen + digit but unparseable, e.g. dotted suffix H-3.2 — so the mismatch surfaces at validate time. Runs in the shared structural pass so validate/validate --direct stay byte-identical (REQ-241); external prefix: IDs excluded.

Verification

  • 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:*.
  • Unit tests: relaxed rule (MAD1-101 accepted, dotted/lowercase/no-letter rejected) + validate lint (H-3.2 flagged, MAD1-101 not). rivet-core lib 1160 + cli_commands 148 green; clippy --all-targets clean; validate/direct still identical.

Self-hosted CI pool offline (#509); verified locally.

🤖 Generated with Claude Code

…(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>
@avrabe avrabe merged commit 96dcb9a into main Jul 1, 2026
22 of 23 checks passed
@avrabe avrabe deleted the fix/577-validate-commit-name-parity branch July 1, 2026 04:53
@github-actions

github-actions Bot commented Jul 1, 2026

Copy link
Copy Markdown

📐 Rivet artifact delta

Change Count
Added 0
Removed 0
Modified 1
Downstream impacted (depth ≤ 5) 0

Graph

graph 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
Loading
Modified
ID Changes
REQ-239

📎 Full HTML dashboard attached as workflow artifact rivet-delta-pr-640download from the workflow run.

Posted by rivet-delta workflow. The graph shows only changed artifacts; open the HTML dashboard (above) for full context.

@codecov

codecov Bot commented Jul 1, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

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.

sync validate function with commit name pasring to identify naming issues early

1 participant