Skip to content

test(core): extend behavior-replay conformance to the booking-method specs - #1687

Closed
robcohen wants to merge 1 commit into
feat/tla-behavior-replayfrom
feat/tla-behavior-replay-booking
Closed

robcohen wants to merge 1 commit into
feat/tla-behavior-replayfrom
feat/tla-behavior-replay-booking

Conversation

@robcohen

@robcohen robcohen commented Jul 2, 2026

Copy link
Copy Markdown
Member

Stacked on #1685 (auto-retargets to main when it merges). Extends the MBT layer to the full booking family: ~3,976 enumerated behaviors across 7 corpora, replayed in <0.1s of plain cargo test.

Corpus Behaviors Replay checks
Conservation 678 units + totals abstraction, enabledness
FIFO / LIFO 422 each per-date totals; matched lot's date == model selection
HIFO 422 per-cost totals; matched lot's cost == model selection
STRICT 136 success/no_match/ambiguous ↔ Ok/NoMatchingLot/AmbiguousMatch
AVERAGE 1,500 units abstraction (model uses integer \div; documented)
NONE 396 balance incl. shorts

Generator generalization

Structured TLA value parsing (records/sequences/sets, escaped strings, TLC's pretty-printed multi-segment values — two real dump dialect quirks found and fixed), a SPECS registry with delta-derived actions, full canonicalization. Conservation's corpus stays byte-identical. The tla.yml lockstep guard now loops over all corpora.

First-run findings (the point of the exercise) — both adjudicated

  1. STRICT: model ambiguous vs impl Ok → mapping fidelity, not a bug. reduce_strict deliberately treats same-cost lots as financially interchangeable (documented FIFO fallback). The replay now gives each model lot a distinct cost number, faithfully reproducing lot-identity ambiguity — after which STRICT replays clean, including all error-outcome conformance.
  2. NONE: reduce_none refuses to short from a positive balance while allowing it from zero — inconsistent with itself, the model, and beancount NONE. Filed as NONE booking: reduce refuses to short from a positive balance but allows it from zero #1686; the replay pins the divergent outcome by issue number and asserts the pin fires, so a future fix flips it loudly instead of leaving a stale pin.

Verification

7/7 replay suites green; generator self-test extended (STRICT + FIFO mini-graphs, label-stripping + reorder invariance); clippy -D warnings + fmt clean.

🤖 Generated with Claude Code

…specs

Generalizes the MBT layer to the full booking family — FIFO/LIFO/HIFO/STRICT/
AVERAGE/NONE — bringing the enumerated conformance corpus to ~3,976 behaviors
(replayed in <0.1s of plain cargo test):

- tla-behaviors.py: structured TLA value parsing (records/sequences/sets,
  escaped strings, TLC's pretty-printed multi-segment values), a SPECS
  registry with per-spec delta-derived actions, canonicalization for the
  richer states. Conservation output stays byte-identical.
- Per-spec replay interpreters: FIFO/LIFO assert the matched lot's DATE and
  per-date totals; HIFO the matched COST; STRICT maps the model's
  success/no_match/ambiguous onto Ok/NoMatchingLot/AmbiguousMatch; AVERAGE
  asserts the units abstraction (the model's average uses integer \div, the
  implementation divides exactly — documented); NONE asserts balance incl.
  shorts.
- tla.yml lockstep guard now loops over ALL committed corpora.

First-run findings, both adjudicated:
- STRICT 'ambiguous' vs impl Ok — a mapping-fidelity issue, not a bug:
  reduce_strict deliberately treats same-cost lots as financially
  interchangeable (documented FIFO fallback), so the replay now gives each
  model lot a distinct cost number to reproduce lot-identity ambiguity.
- NONE: reduce_none refuses to short from a POSITIVE balance while allowing
  it from zero — inconsistent with itself, the model, and beancount NONE.
  Filed as #1686; the replay pins the divergent outcome by issue number and
  asserts the pin FIRES, so a fix flips it loudly.

Co-Authored-By: Claude Opus 4.8 <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant