feat(bookspec): rule identifiers from B-1 to B-45 (P13)
Every rule of `docs/spec/rules.md` now has one bookspec identifier, `BS-<area>-<n>`: eleven areas (entry, ledger, statement, period, partner, asset, prepaid, arap, revenue, 1099, format), numbered in B-rule order within its area. The table is `bookspec/spec/rules-index.md`, and each stated rule carries its id under its heading in `docs/spec/rules.md`, so a reader of either can find the other. rules.md's DECISION status becomes bookspec's CHOICE: the specification names the options and an engine declares its pick (`Claims::with_choice`), which is what an example already meant by `status = "CHOICE"`. B-39 to B-45 are allocated in `plan/served.md` 8.0.3 and not yet stated: they carry an id and an area and no status, so a later unit fills them in without moving anyone else's number. The catalogue names the examples that demonstrate each rule (56 files, each under at least one rule) and the rule each refusal reason belongs to. A rule with no example cannot be claimed: a claim needs evidence. `docs/architecture.md`, `docs/testing.md` (tests and the For-P12 mutation targets) and `docs/parity.md` record the new shape; the bookspec README points at the checker, the runner and the adapter.
This commit is contained in:
1 parent
7350adb07a
commit
b0512f214c
2 files changed
+37
-1
No files matched your search
@@ -13,6 +13,14 @@ Every example is checked against wanderbooks on every `cargo test`
|
|||||||
with fails the build, so the examples can't rot. An expected value is worked
|
with fails the build, so the examples can't rot. An expected value is worked
|
||||||
by hand from the cited source, never copied from an engine's output.
|
by hand from the cited source, never copied from an engine's output.
|
||||||
|
|
||||||
|
The schema, the parser (`Example::from_toml`, every structure with
|
||||||
|
`deny_unknown_fields`) and the `Engine` trait an accounting engine
|
||||||
|
implements live in `bookspec/checker`; `bookspec/runner` runs any engine
|
||||||
|
through the examples and reports per rule: pass, fail or not claimed. The
|
||||||
|
wanderbooks adapter is `crates/ledger-core/tests/bookspec.rs`. The rule
|
||||||
|
identifiers are `BS-<area>-<n>`, tabled in `bookspec/spec/rules-index.md`
|
||||||
|
(P13 steps 1 to 3).
|
||||||
|
|
||||||
## The shape of an example
|
## The shape of an example
|
||||||
|
|
||||||
One TOML file per example in `examples/`, named for its `id`.
|
One TOML file per example in `examples/`, named for its `id`.
|
||||||
@@ -99,7 +107,7 @@ declares `largest-remainder`, the rule a members close splits by.
|
|||||||
authorities alone (a standard, a regulation, a statute, a court, the
|
authorities alone (a standard, a regulation, a statute, a court, the
|
||||||
mechanics of double entry); `CONVENTION`, common practice where no
|
mechanics of double entry); `CONVENTION`, common practice where no
|
||||||
authority governs (rules.md's CONVENTION); `CHOICE`, an owner's or the
|
authority governs (rules.md's CONVENTION); `CHOICE`, an owner's or the
|
||||||
house's decision (a plan D-number, or a DECISION rules.md records) that
|
house's decision (a plan D-number, or a CHOICE rules.md records) that
|
||||||
some expected value depends on, even when authorities carry the rest. An
|
some expected value depends on, even when authorities carry the rest. An
|
||||||
example whose figures follow a decision cites it in `sources`.
|
example whose figures follow a decision cites it in `sources`.
|
||||||
|
|
||||||
|
|||||||
@@ -0,0 +1,28 @@
|
|||||||
|
//! The documentation bookspec's identifiers live in: `docs/spec/rules.md`
|
||||||
|
//! carries each stated rule's id and speaks bookspec's `CHOICE`.
|
||||||
|
|
||||||
|
use std::path::Path;
|
||||||
|
|
||||||
|
use bookspec_checker::rules;
|
||||||
|
|
||||||
|
/// `docs/spec/rules.md` carries every stated rule's id under its heading,
|
||||||
|
/// and no longer calls a choice a decision (P13 step 3).
|
||||||
|
#[test]
|
||||||
|
fn rules_md_carries_every_id() {
|
||||||
|
let text = std::fs::read_to_string(
|
||||||
|
Path::new(env!("CARGO_MANIFEST_DIR")).join("../../docs/spec/rules.md"),
|
||||||
|
)
|
||||||
|
.expect("docs/spec/rules.md");
|
||||||
|
for rule in rules().iter().filter(|r| r.status.is_some()) {
|
||||||
|
assert!(
|
||||||
|
text.contains(&format!("**bookspec:** `{}`", rule.id)),
|
||||||
|
"B-{} carries {}",
|
||||||
|
rule.b,
|
||||||
|
rule.id
|
||||||
|
);
|
||||||
|
}
|
||||||
|
assert!(
|
||||||
|
!text.contains("DECISION"),
|
||||||
|
"rules.md speaks bookspec's CHOICE"
|
||||||
|
);
|
||||||
|
}
|
||||||
Reference in new issue
Block a user