Acquisition verify gate (plan 22)#5
Merged
Merged
Conversation
…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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Adds the acquisition-side verify gate: given a requested work + a downloaded file,
decide match / mismatch / unverifiable at work granularity.
colophon verify <file> --hcid|--title— deterministicISBN path (file OPF ISBN → Hardcover work, compared via canonical_id) + an
LLM-adjudicated path for ISBN-less files (resolver/Haiku, held below 0.8).
for the enforce gate's wrong-work removal.
Consumed by the plexarr verify-acquisition worker (shadow → enforce).