Add Stage D fallback channel calculator (pre-fire prep) - #341
Merged
Conversation
…n guard Pre-fire prep (owner-bundled ahead of the full-catalog Stage D fire, code only): ports local_fallback.py's border/artist/symbol evidence-combination model to Stage D (calculate_fallback_verdict/run_fallback_calculator, own anonymous_id) for cards the join-key calculator found no confident hit for, and adds the missing deductive-backfill exclusion (constant #3 from the pipeline-fidelity gate) to the shared eligible-cards queryset so a repeated Stage D fire never re-votes a card the backfill already covered. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Owner ruled: the 2026-07-14 backfill is pure name/metadata deduction with sound votes (15-card sample all correct); excluding those cards would strand ~27,819 sound-but-UNRESOLVED cards for no protective benefit, since the human-backed consensus gate already makes re-evaluation safe. Removes the .exclude(printing_tags__source=VoteSource.DEDUCTION) clause and its tests; the pre-existing stable-anonymous_id idempotence exclusion is untouched. Fallback channel calculator unchanged. Docs reframed to record this as an intentional non-restoration, not a gap. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
4 tasks
WilfordGrimley
added a commit
that referenced
this pull request
Jul 23, 2026
…ss-method replay baseline
4 tasks
WilfordGrimley
added a commit
that referenced
this pull request
Jul 23, 2026
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.
Description
Pre-fire prep for the full-catalog Stage D fire (code only — this PR does not run the fire, the targeted re-extraction of #340's 373-card cohort, or any other prod extraction/write; both remain separate owner-gated prod steps, see
docs/pipeline-fidelity-gate.md).Fallback channel calculator (
calculate_fallback_verdict/run_fallback_calculator, ownanonymous_id="stage-d-fallback-v1"): Stage D's own port oflocal_fallback.py's pilot "Pass 2" border/artist/symbol evidence-combination model, run only over cards the join-key calculator already found no confident hit for. Unlike the pilot's own live-image version, this operates entirely off already-persistedImageEvidencefields:evidence.layout_class→local_fallback.filter_by_border_color(PROTECTED CORE, called not modified)evidence.artist_ocr_name→local_fallback.match_artist(PROTECTED CORE, called not modified)evidence.symbol_phash→ new_filter_by_symbol_phash, which callslocal_fallback.render_set_symbol(PROTECTED CORE) and reimplements only the Hamming-distance arithmetic — the same pattern_symbol_phash_tiebreakalready established for the join-key calculator, duplicated rather than shared since the two return different shapes (see that function's own docstring).A vote is cast only when the intersection across every sub-check that produced a reading narrows to exactly one candidate —
local_fallback.py's own documented rule, reproduced exactly, with no added agreement/corroboration layer (that layer doesn't exist inlocal_fallback.py, so this is a faithful port, not an augmented one).source=VoteSource.OCR(notDEDUCTION) —VoteSource's own docstring explicitly names "the border/artist/symbol evidence-combination fallback" as part of OCR's umbrella, not deductive_backfill's zero-image-inspection deduction.Wired into the management command between the join-key and slow-path calculators (own
verify_zero_resolutionsgate check, same as join-key's), and_slow_path_eligible_cards_querysetnow also excludes any card this calculator successfully voted on, so a card it resolves isn't also routed to human review in the same invocation.Revision (2026-07-22): an earlier revision of this PR also added a
.exclude(printing_tags__source=VoteSource.DEDUCTION)clause to the shared eligibility queryset ("constant #3" from the pipeline-fidelity gate's knowledge-inventory sweep — the pilot never re-voted a card the 2026-07-14 deductive backfill had already voted for). Owner ruled this OUT after a read-only investigation: that backfill is pure name/metadata deduction (never phash/OCR), its votes are sound (15-card sample all correct), and excluding those cards would strand ~27,819 sound-but-UNRESOLVED cards outside Stage D for no protective benefit — re-evaluating them is safe under the human-backed consensus gate (agreement dedups, disagreement surfaces to human review). The pilot's own exclusion was a performance optimization, not a soundness mechanism. That clause and its tests have been removed; the pre-existing per-calculator stable-anonymous_ididempotence exclusion (independent mechanism) is untouched. This PR is now fallback-calculator-only.Constants #1 (
RESOLUTION_FLOOR_DPI) and #2 (EXCLUDED_RESOLVED_TAGS) remain out of scope — their forward-impact sizing is still open per the gate page.Protected core imported/called, never touched:
local_fallback.filter_by_border_color,match_artist,render_set_symbol,SYMBOL_DISTANCE_THRESHOLD,SYMBOL_MARGIN,FALLBACK_CONFIDENCE_MULTI_EVIDENCE,FALLBACK_CONFIDENCE_SINGLE_EVIDENCE.local_fallback.pyitself has zero diff in this PR.Docs updated in the same PR:
docs/features/catalog-completion-plan.md(Stage D "Pre-fire prep" entry, revised to record the constant-#3 non-restoration),docs/pipeline-fidelity-gate.md§3 (item 3 reframed as "intentionally not restored" with the owner-ruling rationale),docs/reports/2026-07-22-knowledge-inventory.md(constant-#3 row updated to match). No wiki update needed (backend-only, no user/admin-facing surface change) and noextractable-primitives.mdrow (hard dependency onresolve_and_persist_printing/CardPrintingTag, not a clean primitive).Checklist
pre-commitand installed the hooks withpre-commit installbefore creating any commits./home/ubuntu/.venvs/mpcautofill-pilot) against the live Postgres/ES containers' exposed ports (pytest-django's own ephemeral test DB, no prod read/write): 1642 passed, 4 skipped (the same CI-documented named skips), 0 failed.mypy --config-file mypy.iniclean on both changed source files.pre-commit run(ruff/isort/black/mypy/prettier) clean on every changed file.makemigrationsnot applicable — zero model changes (confirmedmodels.pyhas no diff in this PR).docs_lint.pyclean.TestRunJoinKeyCalculator/TestRunSlowPathCalculator/TestRunFallbackCalculator's owntest_idempotent_against_its_own_anonymous_idall still pass — idempotence comes entirely from the stable per-calculatoranonymous_idexclusion, independent of constant Simplify flag icons: static SVG assets instead of hand-rolled geometry #3.