Commit 3253ba0
authored
refactor: consume regelrecht-law-model in pipeline and harvester (#858)
* refactor(pipeline): source law model from regelrecht-law-model in pipeline and harvester
Advies 11: the two remaining consumers that kept a partial mirror of the
canonical law-YAML model now source it from the leaf crate
regelrecht-law-model, so the executable model has a single definition.
pipeline:
- Replace the untyped serde_yaml_ng::Value treewalk in count_article_stats
(map.get("articles") / contains_key("machine_readable")) with a typed parse
into ArticleBasedLaw. The read/count side is now type-checked against the
single source of truth instead of stringly-typed field access.
- The surgical write path is intentionally left untouched: production
enrichment is performed by an external LLM subprocess that edits the file
directly, so there is no Rust-side model write to unify.
- Behavior change: a structurally-invalid law now surfaces as a parse error in
the count rather than being silently undercounted — desirable, since this
only runs on real harvested/enriched corpus files. Test fixtures updated to
realistic minimal laws; an empty-machine_readable edge case is added.
harvester:
- The writer stays a deliberate write-projection (it carries preamble,
organisation, cvdr_id and per-article references that the executable
ArticleBasedLaw does not, with bespoke quoting/indent post-processing), but
the internal YamlReference struct was a byte-identical duplicate of
types::Reference, so it is dropped and types::Reference is serialized
directly.
- Add regelrecht-law-model as a dev-dependency and two regression tests:
golden byte-identity for a BWB and a CVDR law (the repo previously only
asserted substrings), and a conformance test proving the harvested output
deserializes cleanly into ArticleBasedLaw.
* test(pipeline): pin machine_readable null vs empty count behavior
Document and assert the one parity nuance between the typed count and the old
contains_key walk: an empty `machine_readable: {}` counts as enriched (an LLM may
insert a bare section), while an explicit `machine_readable: null` is treated as
un-enriched. No corpus file uses the bare/null form, so this matches the previous
behavior in practice. Addresses a ralph-review completeness finding.1 parent 1178055 commit 3253ba0
5 files changed
Lines changed: 228 additions & 113 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
38 | 38 | | |
39 | 39 | | |
40 | 40 | | |
| 41 | + | |
41 | 42 | | |
42 | 43 | | |
43 | 44 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
37 | 37 | | |
38 | 38 | | |
39 | 39 | | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
40 | 45 | | |
41 | 46 | | |
42 | 47 | | |
43 | 48 | | |
44 | 49 | | |
45 | 50 | | |
46 | | - | |
47 | | - | |
48 | | - | |
49 | | - | |
50 | | - | |
51 | | - | |
52 | | - | |
53 | | - | |
54 | | - | |
55 | | - | |
56 | | - | |
57 | | - | |
58 | | - | |
59 | | - | |
60 | | - | |
61 | | - | |
62 | | - | |
63 | | - | |
64 | | - | |
65 | | - | |
66 | | - | |
67 | | - | |
68 | | - | |
69 | | - | |
70 | | - | |
71 | | - | |
72 | | - | |
73 | | - | |
74 | | - | |
75 | | - | |
76 | | - | |
77 | | - | |
78 | | - | |
79 | | - | |
80 | | - | |
| 51 | + | |
81 | 52 | | |
82 | 53 | | |
83 | 54 | | |
| |||
147 | 118 | | |
148 | 119 | | |
149 | 120 | | |
150 | | - | |
| 121 | + | |
151 | 122 | | |
152 | 123 | | |
153 | 124 | | |
| |||
553 | 524 | | |
554 | 525 | | |
555 | 526 | | |
556 | | - | |
557 | | - | |
558 | | - | |
559 | | - | |
560 | | - | |
561 | | - | |
562 | | - | |
563 | | - | |
564 | | - | |
565 | | - | |
566 | | - | |
| 527 | + | |
| 528 | + | |
| 529 | + | |
| 530 | + | |
| 531 | + | |
| 532 | + | |
| 533 | + | |
| 534 | + | |
| 535 | + | |
| 536 | + | |
| 537 | + | |
| 538 | + | |
| 539 | + | |
| 540 | + | |
| 541 | + | |
| 542 | + | |
567 | 543 | | |
568 | 544 | | |
569 | | - | |
570 | | - | |
571 | | - | |
572 | | - | |
| 545 | + | |
| 546 | + | |
| 547 | + | |
| 548 | + | |
| 549 | + | |
| 550 | + | |
| 551 | + | |
| 552 | + | |
| 553 | + | |
| 554 | + | |
| 555 | + | |
| 556 | + | |
| 557 | + | |
| 558 | + | |
| 559 | + | |
| 560 | + | |
| 561 | + | |
| 562 | + | |
| 563 | + | |
| 564 | + | |
| 565 | + | |
| 566 | + | |
| 567 | + | |
| 568 | + | |
| 569 | + | |
| 570 | + | |
| 571 | + | |
| 572 | + | |
| 573 | + | |
| 574 | + | |
| 575 | + | |
| 576 | + | |
| 577 | + | |
| 578 | + | |
| 579 | + | |
| 580 | + | |
| 581 | + | |
| 582 | + | |
| 583 | + | |
| 584 | + | |
| 585 | + | |
| 586 | + | |
| 587 | + | |
| 588 | + | |
| 589 | + | |
| 590 | + | |
| 591 | + | |
| 592 | + | |
| 593 | + | |
| 594 | + | |
| 595 | + | |
| 596 | + | |
| 597 | + | |
| 598 | + | |
| 599 | + | |
| 600 | + | |
| 601 | + | |
| 602 | + | |
| 603 | + | |
| 604 | + | |
| 605 | + | |
| 606 | + | |
| 607 | + | |
| 608 | + | |
| 609 | + | |
| 610 | + | |
| 611 | + | |
| 612 | + | |
| 613 | + | |
| 614 | + | |
| 615 | + | |
| 616 | + | |
| 617 | + | |
| 618 | + | |
| 619 | + | |
| 620 | + | |
| 621 | + | |
| 622 | + | |
| 623 | + | |
| 624 | + | |
| 625 | + | |
| 626 | + | |
| 627 | + | |
| 628 | + | |
| 629 | + | |
| 630 | + | |
| 631 | + | |
| 632 | + | |
| 633 | + | |
| 634 | + | |
| 635 | + | |
| 636 | + | |
| 637 | + | |
| 638 | + | |
| 639 | + | |
| 640 | + | |
| 641 | + | |
| 642 | + | |
| 643 | + | |
| 644 | + | |
| 645 | + | |
| 646 | + | |
| 647 | + | |
| 648 | + | |
| 649 | + | |
| 650 | + | |
573 | 651 | | |
574 | 652 | | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
25 | 25 | | |
26 | 26 | | |
27 | 27 | | |
| 28 | + | |
28 | 29 | | |
29 | 30 | | |
30 | 31 | | |
| |||
0 commit comments