Commit e7d348a
fix(validate): sync artifact-id shape with the commit-trailer parser (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>1 parent 8204255 commit e7d348a
3 files changed
Lines changed: 122 additions & 10 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
7579 | 7579 | | |
7580 | 7580 | | |
7581 | 7581 | | |
7582 | | - | |
| 7582 | + | |
7583 | 7583 | | |
7584 | 7584 | | |
7585 | 7585 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
322 | 322 | | |
323 | 323 | | |
324 | 324 | | |
325 | | - | |
| 325 | + | |
| 326 | + | |
| 327 | + | |
| 328 | + | |
| 329 | + | |
| 330 | + | |
326 | 331 | | |
327 | 332 | | |
328 | 333 | | |
329 | | - | |
| 334 | + | |
| 335 | + | |
| 336 | + | |
| 337 | + | |
330 | 338 | | |
331 | | - | |
332 | | - | |
333 | | - | |
334 | | - | |
| 339 | + | |
| 340 | + | |
| 341 | + | |
| 342 | + | |
| 343 | + | |
| 344 | + | |
| 345 | + | |
335 | 346 | | |
336 | 347 | | |
337 | 348 | | |
338 | 349 | | |
339 | | - | |
340 | | - | |
341 | | - | |
| 350 | + | |
| 351 | + | |
| 352 | + | |
| 353 | + | |
| 354 | + | |
| 355 | + | |
| 356 | + | |
342 | 357 | | |
343 | 358 | | |
344 | 359 | | |
| |||
1271 | 1286 | | |
1272 | 1287 | | |
1273 | 1288 | | |
| 1289 | + | |
| 1290 | + | |
| 1291 | + | |
| 1292 | + | |
| 1293 | + | |
| 1294 | + | |
| 1295 | + | |
| 1296 | + | |
| 1297 | + | |
| 1298 | + | |
| 1299 | + | |
| 1300 | + | |
| 1301 | + | |
| 1302 | + | |
| 1303 | + | |
| 1304 | + | |
| 1305 | + | |
| 1306 | + | |
| 1307 | + | |
| 1308 | + | |
| 1309 | + | |
| 1310 | + | |
| 1311 | + | |
| 1312 | + | |
1274 | 1313 | | |
1275 | 1314 | | |
1276 | 1315 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
636 | 636 | | |
637 | 637 | | |
638 | 638 | | |
| 639 | + | |
| 640 | + | |
| 641 | + | |
| 642 | + | |
| 643 | + | |
| 644 | + | |
| 645 | + | |
| 646 | + | |
| 647 | + | |
| 648 | + | |
| 649 | + | |
| 650 | + | |
| 651 | + | |
| 652 | + | |
| 653 | + | |
| 654 | + | |
| 655 | + | |
| 656 | + | |
| 657 | + | |
| 658 | + | |
| 659 | + | |
| 660 | + | |
| 661 | + | |
| 662 | + | |
| 663 | + | |
| 664 | + | |
639 | 665 | | |
640 | 666 | | |
641 | 667 | | |
| |||
2719 | 2745 | | |
2720 | 2746 | | |
2721 | 2747 | | |
| 2748 | + | |
| 2749 | + | |
| 2750 | + | |
| 2751 | + | |
| 2752 | + | |
| 2753 | + | |
| 2754 | + | |
| 2755 | + | |
| 2756 | + | |
| 2757 | + | |
| 2758 | + | |
| 2759 | + | |
| 2760 | + | |
| 2761 | + | |
| 2762 | + | |
| 2763 | + | |
| 2764 | + | |
| 2765 | + | |
| 2766 | + | |
| 2767 | + | |
| 2768 | + | |
| 2769 | + | |
| 2770 | + | |
| 2771 | + | |
| 2772 | + | |
| 2773 | + | |
| 2774 | + | |
| 2775 | + | |
| 2776 | + | |
| 2777 | + | |
| 2778 | + | |
| 2779 | + | |
| 2780 | + | |
| 2781 | + | |
| 2782 | + | |
| 2783 | + | |
| 2784 | + | |
| 2785 | + | |
| 2786 | + | |
| 2787 | + | |
| 2788 | + | |
| 2789 | + | |
| 2790 | + | |
| 2791 | + | |
| 2792 | + | |
| 2793 | + | |
| 2794 | + | |
2722 | 2795 | | |
2723 | 2796 | | |
2724 | 2797 | | |
| |||
0 commit comments