diff --git a/docs/architecture.md b/docs/architecture.md index 8d393f51..d81de4ff 100644 --- a/docs/architecture.md +++ b/docs/architecture.md @@ -46,7 +46,7 @@ the core depends on another crate of ours. UI concerns (formatting, locale, widgets) never leak into the core; the core speaks `Decimal` and ISO codes. A crate that was planned and never created is not missing: `ledger-export` became part of `ledger-import`; `ledger-oracle` is the -test `crates/ledger-core/tests/oracle_gnucash.rs` with `oracle/gnucash/` +test `crates/ledger-core/tests/oracle_gnucash.rs` with bookspec's `gnucash/oracle/` (`just oracle`); `ledger-view` and `ledger-extract` were closed by D-53 (`PackageBooks` is the shared view; extraction is in-process in `ledger-import`, P6). diff --git a/docs/oracle.md b/docs/oracle.md index 2ce82529..d43a88ef 100644 --- a/docs/oracle.md +++ b/docs/oracle.md @@ -89,7 +89,7 @@ engine bugs that Layers 1–4 had all missed. **Layer 5 — Cross-implementation diff harness (live: GnuCash).** `just oracle` builds GnuCash 5.10 in a pinned container -(`oracle/gnucash/`) and runs `tests/oracle_gnucash.rs`: 200 random books +(bookspec's `gnucash/oracle/`, built from the pinned rev) and runs `tests/oracle_gnucash.rs`: 200 random books built through wanderbooks (entries, foreign lines, reversals, closes), every account's balance at month ends and random dates, and each month's P&L, compared exactly (15,800 comparisons). Its first run found one real diff --git a/docs/testing.md b/docs/testing.md index bae3609c..2b8dea30 100644 --- a/docs/testing.md +++ b/docs/testing.md @@ -22,7 +22,7 @@ promise. | Concurrency (store) | a viewer reading while the books are written sees only whole books, never a false "differs" (2) | `ledger-store/tests/concurrency.rs` | `just check` | <1s | every change | | Model-based stateful | the Lean state machine, transcribed (3) | `tests/model.rs` | `just check` | ~3s | every change | | Differential: Decimal vs i64 | the kernel at two types (3) | `kernel_bridge/` | `just check` | <1s | every change | -| Differential: GnuCash | another implementation, adjudicated (3) | `tests/oracle_gnucash.rs`, `oracle/gnucash/` | `just oracle` | ~2 min | weekly | +| Differential: GnuCash | another implementation, adjudicated (3) | `tests/oracle_gnucash.rs`, bookspec `gnucash/oracle/` | `just oracle` | ~2 min | weekly | | Formal proofs | Kani (bounded) and Lean (unbounded) | `src/proofs/`, `verify/lean/` | `just prove` (51 harnesses and Lean), `just prove-slow` (the 9 in the justfile's `kani_slow`, each under its own 30-minute cap); 60 harnesses in all with the checker canary (2026-10-28) | prove ~5 min and prove-slow ~8 min at four jobs on a quiet laptop (each ~25 min under heavy load; docs/verification.md, "Running it") | weekly (CI runs both) | | Fuzzing | crash, hang, broken books (4); for `fuzz_store_replay` (validly chained journals with fuzz-chosen events): books that open must verify, and the viewer must accept exactly what the writer does | `fuzz/fuzz_targets/`, corpora in `fuzz/corpus/` | `just fuzz ` | 10 min each | weekly | | Miri | undefined behavior in our use of dependencies (4) | the core's unit, bridge, invariant tests (the exhaustive calendar walk aside) | `just miri` | ~4 min | on demand | diff --git a/justfile b/justfile index e1136470..65758273 100644 --- a/justfile +++ b/justfile @@ -186,15 +186,18 @@ _kani set: oracle: #!/usr/bin/env bash set -euo pipefail - rev=$(sed -nE 's/.*bookspec-checker.*rev = "([0-9a-f]+)".*/\1/p' crates/ledger-core/Cargo.toml | head -1) - [ -n "$rev" ] || { echo "oracle: no bookspec rev pinned in crates/ledger-core/Cargo.toml" >&2; exit 1; } - cargo fetch --locked >/dev/null 2>&1 || cargo fetch >/dev/null - checkout=$(ls -d "${CARGO_HOME:-$HOME/.cargo}"/git/checkouts/bookspec-*/"$rev" 2>/dev/null | head -1 || true) - if [ -z "$checkout" ] || [ ! -f "$checkout/gnucash/oracle/Dockerfile" ]; then - echo "oracle: bookspec checkout for rev $rev not found under ${CARGO_HOME:-$HOME/.cargo}/git/checkouts (ran cargo fetch; is the pin fetched?)" >&2 + # The oracle's container lives in bookspec (one source of truth): find + # the pinned checkout through cargo itself, whatever its directory name. + cargo fetch --locked + manifest=$(cargo metadata --format-version 1 --locked \ + | jq -r '.packages[] | select(.name == "bookspec-checker") | .manifest_path' | head -1) + [ -n "$manifest" ] || { echo "oracle: bookspec-checker is not a dependency of this workspace" >&2; exit 1; } + root=${manifest%/checker/Cargo.toml} + [ -f "$root/gnucash/oracle/Dockerfile" ] || { + echo "oracle: the pinned bookspec ($root) has no gnucash/oracle; move the pin to a bookspec rev that includes it (P14 unit S-K1)" >&2 exit 1 - fi - docker build -q -t bookspec-gnucash-oracle "$checkout/gnucash/oracle" + } + docker build -q -t bookspec-gnucash-oracle "$root/gnucash/oracle" cargo test -p ledger-core --test oracle_gnucash -- --ignored --nocapture # Fuzz one target for some seconds (nightly; corpus in fuzz/corpus/) diff --git a/mise.toml b/mise.toml index dda8c262..55038094 100644 --- a/mise.toml +++ b/mise.toml @@ -9,6 +9,8 @@ rust = [ { version = "nightly-2026-10-01", components = "miri,rust-src" }, ] just = "1" +# `just oracle` reads the pinned bookspec's path from `cargo metadata`. +jq = "1.7.1" # `just deploy` runs the Netlify CLI through npx. node = "26" # `just prove`: Kani model-checks the accounting kernel. Kani fetches its