Skip to content

Acquisition verify gate (plan 22)#5

Merged
vidaks merged 3 commits into
mainfrom
feat/verify-gate
Jun 5, 2026
Merged

Acquisition verify gate (plan 22)#5
vidaks merged 3 commits into
mainfrom
feat/verify-gate

Conversation

@vidaks

@vidaks vidaks commented Jun 5, 2026

Copy link
Copy Markdown
Owner

Adds the acquisition-side verify gate: given a requested work + a downloaded file,
decide match / mismatch / unverifiable at work granularity.

  • colophon/verify.py + CLI colophon verify <file> --hcid|--title — deterministic
    ISBN path (file OPF ISBN → Hardcover work, compared via canonical_id) + an
    LLM-adjudicated path for ISBN-less files (resolver/Haiku, held below 0.8).
  • grimmory.delete_books(ids) (DELETE /api/v1/books?ids=…) + book_ids_by_filename,
    for the enforce gate's wrong-work removal.
  • epub.inspect now returns opf_author.
  • 41 tests (stdlib unittest, network-free).

Consumed by the plexarr verify-acquisition worker (shadow → enforce).

vidaks added 3 commits June 5, 2026 16:30
…rk?)

verify(requested, file) decides match / mismatch / unverifiable at work
granularity, for the identifier-verified acquisition gate (plan 22):

- deterministic path: the file's embedded OPF ISBN -> Hardcover work,
  compared to the requested work via the shared canonical_id.
- no resolvable ISBN: the file is identified through the resolver's
  adjudicator (its own title/author + colophon text), and that work is
  compared to the requested one; below 0.8 confidence it is held as
  unverifiable rather than matched or rejected on a guess.

Reuses epub + hardcover + matcher + resolver; read-only, no grimmory DB.
CLI: colophon verify <file> --hcid <id> | --title (exit 0/3/4).
epub.inspect now also returns opf_author. 14 tests (deterministic + LLM).
The plan-22 gate's enforce mode removes a confirmed wrong-work grab. Adds:
- Grimmory.delete_books(ids) — DELETE /api/v1/books {"ids":[…]} (drops the
  catalog record + covers; grimmory leaves the file, the caller removes it).
- book_ids_by_filename(name) — resolve a just-landed grab to its record(s) by
  exact book_file.file_name (SQL-escaped), so the gate can target it. Returns a
  list; the caller refuses to delete on a >1 (filename-collision) result.
delete_books sent DELETE /books with a {"ids":[…]} body, which grimmory rejects
("Required request parameter 'ids' for method parameter type Set is not present")
and surfaces as a generic 500 — so every enforce deletion would have silently
failed. `ids` is a @RequestParam Set<Long>; the real call is
DELETE /api/v1/books?ids=<csv>. Verified end-to-end against a disposable throwaway
record (HTTP 200 {"deleted":[…]}, record + file gone). grimmory removes the files
too, so the worker's unlink is now a fallback for failedFileDeletions.
@vidaks vidaks merged commit bf8d15b into main Jun 5, 2026
4 checks passed
@vidaks vidaks deleted the feat/verify-gate branch June 5, 2026 15:42
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