Make the stored-id prepass report what it did - #841
Merged
Merged
Conversation
Both of the previous PR's fixes hooked the event-emitting search session. Neither one fires for a re-tag, because comics codex already holds an issue id for never reach that session: the stored-id prepass fetches them by explicit id outside it, and on a re-tag that prepass is the whole run. Two consequences, both visible in the admin Tagging tab: - A merged multi-source refresh was credited to the primary source alone. Under merge-all the prepass pins every stored id and comicbox fetches and merges them all, so a comic refreshed from Metron *and* Comic Vine showed Matched in one column and an em-dash in the other — the cell that reads as "this source was never consulted". Each source whose requested id comes back in the merged record is now credited; the primary is proven by the fetch itself, which returns nothing unless its own id landed. A source the scan never pinned (first-wins, or no credentials) still reports nothing, which is what the em-dash is for. - Only the search pass opened a librarian status row, so a scan that resolved every comic from a stored id ran start to finish with an empty status rail, while the Tagging tab's table — published from the same loop — showed each lookup as it happened. The prepass now opens the row, totalled over the whole batch, advances it per comic, and the search pass adopts it instead of starting a second one, so the rail shows one continuous job whose elapsed time counts the prepass. The live marker's "looking up on <source>" subtitle lands there too, which is what it was missing to reach the rail at all. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
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.
Follow-up to #840, which fixed neither symptom in practice. Both of its fixes hooked comicbox's event-emitting search session, and a re-tag never enters that session: comics codex already holds an issue id for are fetched by explicit id in the stored-id prepass, outside it. On a re-tag that prepass is the entire run.
Evidence from the reporting instance: the frozen snapshot had five comics, all
{"comicvine": "matched"}with no Metron cell,merge_all_sources: true— while the log for the same run showedonline metron: added id=134167,id=170212,id=8862… Metron had refreshed every one of those comics.A merged refresh now credits every source that landed
record_prefetch_matchtook a single primary source. Under merge-all the prepass pins every stored id and comicbox fetches and merges them all, so a comic refreshed from both sources showed Matched in one column and an em-dash in the other — the cell that reads "never consulted".resolved_id_sourcesreports which of the requested ids came back in the merged record, and every one of them is credited. The primary needs no such check:fetch_tags_by_explicit_idalready returns nothing unless its own id landed. A source this scan never pinned — first-wins, or no credentials — still reports nothing, which is what the em-dash is for.This matches what the search path already does: under merge-all comicbox emits one
AutoWrittenper contributing source, and the fold accumulates them.The status rail covers the prepass
Only
collect_resultsopened anOnlineLookupStatus, so a scan that resolved everything from stored ids ran start to finish with no active row at all — an empty rail, while the Tagging tab's table, published from the same loop, showed each lookup as it happened. #840'slooking up on <source>subtitle was written toself._pass_runner.lookup_status, which isNonefor the whole prepass.The prepass now opens the row (
begin_status), totalled over the whole batch so the count doesn't jump when the search pass takes over, and advancescompleteper committed comic.collect_resultsadopts an already-open row instead of starting a second one, so the rail shows one continuous job whose elapsed time counts the prepass, and still finishes it in itsfinally.finish_status()inrun_session'sfinallycloses the row if the prepass raises before the search pass can adopt it.Testing
pytest: 1113 passed. New coverage: merged-fetch attribution, first-wins attribution (the source that sat out stays blank), the prepass opening and naming its status row,collect_resultsadopting rather than restarting it, andfinish_statusidempotence.make fix,make lint,make ty: clean.🤖 Generated with Claude Code