Files
swaitsandClaude Fable 5.2 3208d4f19c Add property tests, an old-database test and a live lookup check
The queue test runs random sequences of enqueue, look up again, cancel,
failure, time and restart. It found a book left pending for ever when
Look up again landed on a book already queued for its weekly re-check;
that lookup now counts as a real one.

Also: the three-frame camera rule against an independent model, a
pre-looked_up_at database opening intact, a script that checks nine
books against the live catalogues, and the sisi contract naming them.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
2026-11-22 19:55:31 -07:00

123 lines
5.2 KiB
JSON

{
"id": "booksorter",
"goal": "Lookups ride out flaky sources, find data from every source before asking the owner, and the camera does not accept misreads",
"checks": [
{
"id": "types",
"claim": "The whole project typechecks, including the new retry state on Book and the Google Books source",
"kind": "general",
"rung": 1,
"cmd": "npm run typecheck",
"expect": {
"exit": 0
},
"timeout_s": 20
},
{
"id": "unit-tests",
"claim": "Every unit test passes: backoff schedule, no give-up on temporary failures, Retry-After, restart resume, settle-with-a-number, Google Books source, widened similar tier, weekly re-check, misread hint, three-frame agreement",
"kind": "general",
"rung": 3,
"cmd": "npm test",
"expect": {
"exit": 0
},
"timeout_s": 25
},
{
"id": "build",
"claim": "The web bundle builds",
"kind": "general",
"rung": 3,
"cmd": "npm run build",
"expect": {
"exit": 0
},
"timeout_s": 10
},
{
"id": "jobs-state-machine",
"claim": "Under random sequences of enqueue, look-up-again, cancel, temporary failure, definitive answer, time passing and restart, the lookup queue never loses a pending book, never runs two lookups for one book at once, never writes to a removed book, and never marks a book Needs attention because of a temporary failure",
"kind": "general",
"rung": 2,
"cmd": "node --test src/server/jobs.property.test.ts",
"expect": {
"exit": 0
},
"timeout_s": 15
},
{
"id": "scanner-agreement",
"claim": "For random frame sequences, a camera read is accepted only after three consecutive agreeing valid ISBNs inside the time window, and a code with a wrong check digit is never accepted",
"kind": "general",
"rung": 2,
"cmd": "node --test src/web/readstate.property.test.ts",
"expect": {
"exit": 0
},
"timeout_s": 10
},
{
"id": "old-database-loads",
"claim": "A database file written before the looked_up_at column existed opens with every book intact, the same call numbers, and hand-entered numbers untouched; opening it twice changes nothing",
"kind": "general",
"rung": 2,
"cmd": "node --test src/server/db.migration.test.ts",
"expect": {
"exit": 0
},
"timeout_s": 10
},
{
"id": "live-lookups",
"claim": "Against the real catalogues, the three books with no official number get a number in the expected class (Durango Hikes GV199.42.C6, San Rafael Swell GV199.42.U8 or F832, Adventures of a Lifetime E160 or GV191), and the six books that resolved before get exactly the same number as before",
"kind": "general",
"rung": 3,
"tier": "deep",
"cmd": "node scripts/live-lookup-check.ts",
"expect": {
"exit": 0
},
"timeout_s": 1500
}
],
"invariants": [
{
"id": "resolved-numbers-unchanged",
"claim": "Books that already resolved keep their numbers: 9781640976108 F721.F57 2023, 9781493029150 GB1198.3.C6 W25 2018, 9780826363770 F774.3.M86 2022, 9781937052898 GV854.5.C6 F68 2024, 9780874808131 GV199.42.C63 M58 2005, 9781426220951 GV199.5.S55 2020",
"baseline": "Numbers from the owner's server log of 2026-11-22, before any change in this session; enforced by the live-lookups check",
"cmd": "node scripts/live-lookup-check.ts --regressions-only",
"expect": {
"exit": 0
},
"tier": "deep",
"timeout_s": 1200,
"rung": 3,
"kind": "general"
},
{
"id": "existing-tests-still-pass",
"claim": "The tests that passed before this session still pass",
"baseline": "305 passing at commit bb46d34; 368 passing at a08fbff; enforced by the unit-tests check",
"cmd": "npm test",
"expect": {
"exit": 0
},
"timeout_s": 25,
"rung": 3,
"kind": "general"
}
],
"assumptions": [
"A network error, timeout, 5xx or 429 is retried for as long as the book is pending; only definitive answers from every source lead to Needs attention.",
"Once a call number is in hand, a remaining step that still fails after six tries is dropped and the book settles with that number, marked approximate if a source could not be asked.",
"A number worked out from similar books, marked with ~, is better than an empty card. It needs at least two agreeing books.",
"Google Books (the key-less Atom feed) is acceptable as a source of title, author, publisher and category. It carries no LC number.",
"9781037052897 and 9781037042898 are camera misreads of 9781937052898; the owner confirmed he has only that book.",
"Camera reads need three agreeing frames (two in a capture burst); about 0.3 s slower on a clean barcode is acceptable.",
"Books with no number or an approximate one are looked up again only at server start, once the last lookup is a week old.",
"The card layout, the waiting text and real-camera behaviour are checked by the owner in a browser, not by an automated check (rung 6).",
"The contract file is committed to the repository with the rest of the project."
],
"questions": []
}