Skip to content

Adds the library world's guards as corpus rows - #228

Merged
johnnyt merged 1 commit into
mainfrom
px-5l8-library-corpus
Sep 22, 2026
Merged

johnnyt merged 1 commit into
mainfrom
px-5l8-library-corpus

Conversation

@johnnyt

@johnnyt johnnyt commented Sep 22, 2026

Copy link
Copy Markdown
Member

What this lands

conformance/cases/library.json, the library example world's renewal and
standing guards as authored corpus rows, plus the regeneration they force.

The rows, enumerated, and what each pins:

  1. library/renew-allowed - the renewal guard in full, satisfied.
  2. library/renew-refused-by-hold - the same guard, a hold waiting.
  3. library/renew-refused-at-max - the same guard, at the renewal limit.
  4. library/renew-refused-blocked-standing - the same guard, standing blocked.
  5. library/standing-good-no-fines - good standing and nothing owed.
  6. library/fine-owed - the same guard with one unpaid fine.
  7. library/due-soon-window - the due-soon reminder three days before the
    end of the loan period.
  8. library/pickup-window - the seven-day pickup window as a duration.
  9. library/overdue-days - an overdue copy not yet at the lost-item point.
  10. library/max-renewals-boundary - the limit is exclusive at the boundary.
  11. library/nested-patron - two chained property reads over a nested context.
  12. library/holds-pending-negation - the holds flag negated.

That enumeration is twelve rows, and twelve library/* ids appear in the
regenerated tier files.

Every context is drawn from the example world: the patron ids, the copy and
branch ids, the renewal limit of 2, and the loan, pickup and lost-item
durations. No case carries a date.

Corpus hash

  • before: sha256:548f54cacdcb700df0c47d67f86a944b5dbe6b0c6f96ef0c4c6fbb95b0494892
  • after: sha256:bb60ec82faba2e82ef1e7abaac8d26257db2a77cd4ce0c083b683c5bc063fd43

mix corpus.generate ran the authored rows through the real compiler and
evaluator, which is what makes their expected values true rather than
asserted, and rewrote the tier 1, tier 3 and tier 4 files and the manifest.
The asserted tier on every row agreed with the computed one.

Two rows depart from their sketch, because the ISA refuses the shape

  • library/due-soon-window was sketched as 21d - 3d. docs/isa.md
    section 5's subtract bullet gives clauses for number-number, Date-Date,
    DateTime-DateTime and Date/DateTime-duration only, so a
    duration-duration subtraction is a TypeMismatchError. The row computes the
    window over a duration context value's days field instead, and its notes
    field says so.
  • library/overdue-days compares the days fields of two duration context
    values rather than the durations themselves. The same section leaves ordering
    between two maps unspecified for siblings, and a duration is a map at the
    value level. Its notes field says so.

Both were found by reading the ISA after the generator refused the sketched
shape, not by weakening a row to pass.

Provenance

One file beyond the authored case and the regenerated corpus changed:
conformance/examples/registry.example.json. Adding two tier-1 rows moves the
manifest's corpus_hash, which that example pins, and the example claims the
evaluator surface complete at tier 1, so it also gains the two new tier-1
evaluator entries. Predicator.Conformance.RatchetRegistryTest's pin test and
its R5 completeness test both name that file in their failure text; the
canonical encoding was round-tripped byte-for-byte before the edit and the
entries were re-sorted by the order rule 2 specifies. A corpus regeneration has
refreshed that same pin before, in bdbfdab.

conformance/README.md gains one sentence under
## How to add a case, without any Elixir, saying the library/* rows are the
family's shared example world and where its definition lives.

No changelog fragment

changelog.d/README.md says not to write a fragment for "test harness, corpus
tooling, or conformance fixtures". This is exactly that.

Gate

Full mix quality, quoted whole:

Running quality checks...

✓ Format: No changes needed (273ms)
✓ Compile: dev + test compiled (warnings as errors) (308ms)

Running analysis stages in parallel...

○ Doctor: skipped (:doctor not installed)
○ Gettext: skipped (:gettext not installed)
○ Sobelow: skipped (:sobelow not installed)
✓ Dependencies: No unused dependencies (347ms)
✓ Credo: No issues (3.1s)
✓ Tests: 2,914 of 2,914 passed, 95.5% coverage (3.8s)
✓ Dialyzer: No warnings (4.3s)

✓ All quality checks passed!

The branch's base is main's tip, and the tree committed is byte-identical to
the tree that run went green on, so the commit cites this run rather than
re-running it.

Refs: px-5l8

conformance/cases/library.json authors the renewal and standing guards
of the family's library example world: the renewal guard in full and one
row per conjunct that refuses it, the standing-and-fines pair, the
due-soon and pickup windows, an overdue comparison, the renewal boundary,
a nested read, and the holds negation.

Two rows depart from their sketch because the ISA refuses the shape the
sketch assumed. docs/isa.md section 5 gives subtract clauses for
number-number, Date-Date, DateTime-DateTime and Date/DateTime-duration
only, so 21d - 3d is a TypeMismatchError and the due-soon window is
computed over a duration context value's days field instead. The same
section leaves ordering between two maps unspecified for siblings, and a
duration is a map at the value level, so the overdue row compares days
fields rather than durations. Both carry a notes field saying so; the
corpus never carries a date.

The corpus diff is a regeneration: mix corpus.generate ran the twelve
authored rows through the real compiler and evaluator, which is what
makes their expected values true rather than asserted, and rewrote tiers
1, 3 and 4 and the manifest hash. The ratchet registry example's
corpus_hash pin is refreshed to the new manifest and gains the two
tier-1 evaluator entries the corpus now carries, the way a corpus
regeneration has refreshed that pin before.

Refs: px-5l8
@codecov

codecov Bot commented Sep 22, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@johnnyt
johnnyt merged commit f2f982d into main Sep 22, 2026
2 checks passed
@johnnyt
johnnyt deleted the px-5l8-library-corpus branch September 22, 2026 14:26
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