P14 unit S-D0 (plan/bookspec-audit.md D0) is a mechanical split, no content change. bookspec is becoming the definitive spec, and later units move each rule's accounting text there and reduce wanderbooks' copy to the engine's claim (the pick, where it is enforced, which tests check it) plus product rules. Several workers reduce different areas in parallel; one 3,696-line file blocks them, so the file is split first by bookspec area (the B -> area map is bookspec's spec/rules-index.md). Every `## B-n` section moves verbatim, in B order, into docs/spec/claims/<area>.md: entry 5, ledger 13, statement 5, period 3, partner 4, asset 4, prepaid 1, arap 6, revenue 1, 1099 1, format 2. docs/spec/rules.md keeps its preamble and becomes the index (B, bookspec id, area, link to the claims heading), so the existing "rules.md B-n" references still resolve until S-E rewrites them. The bookspec test now reads every claims file and the index, so every stated rule's id is still verified where it is carried. The split is proved lossless: the preamble plus the 45 claims sections concatenated in B order is byte-identical to the old rules.md. No WB-n product rules exist in rules.md, so no docs/spec/product.md is created (D0's other half) until product rules are written. Co-Authored-By: DeepSeek V4.1 Flash <noreply@opencode.ai>
48 lines
1.6 KiB
Rust
48 lines
1.6 KiB
Rust
use crate::*;
|
|
|
|
/// `docs/spec/claims/*.md` carry every stated rule's id under its heading,
|
|
/// `docs/spec/rules.md` indexes every rule to its claims file, and neither
|
|
/// calls a choice a decision (P14 unit S-D0; P13 step 3).
|
|
#[test]
|
|
pub(crate) fn rules_md_carries_every_id() {
|
|
let spec = Path::new(env!("CARGO_MANIFEST_DIR")).join("../../docs/spec");
|
|
let index = std::fs::read_to_string(spec.join("rules.md")).expect("docs/spec/rules.md");
|
|
|
|
let mut claims = std::fs::read_dir(spec.join("claims"))
|
|
.expect("docs/spec/claims")
|
|
.map(|entry| entry.expect("a claims entry").path())
|
|
.filter(|path| path.extension().is_some_and(|ext| ext == "md"))
|
|
.collect::<Vec<_>>();
|
|
claims.sort();
|
|
assert!(!claims.is_empty(), "docs/spec/claims holds the rule text");
|
|
|
|
let mut all = String::new();
|
|
for path in &claims {
|
|
let text = std::fs::read_to_string(path)
|
|
.unwrap_or_else(|error| panic!("{}: {error}", path.display()));
|
|
all.push_str(&text);
|
|
all.push('\n');
|
|
}
|
|
|
|
for rule in bookspec_checker::rules().iter() {
|
|
assert!(
|
|
index.contains(&format!("| B-{} | `{}` |", rule.b, rule.id)),
|
|
"rules.md indexes B-{} to {}",
|
|
rule.b,
|
|
rule.id
|
|
);
|
|
if rule.status.is_some() {
|
|
assert!(
|
|
all.contains(&format!("**bookspec:** `{}`", rule.id)),
|
|
"B-{} carries {} in its claims file",
|
|
rule.b,
|
|
rule.id
|
|
);
|
|
}
|
|
}
|
|
assert!(
|
|
!index.contains("DECISION") && !all.contains("DECISION"),
|
|
"the rules speak bookspec's CHOICE"
|
|
);
|
|
}
|