Skip to content

Reindex Card into ES on printing/tag consensus transitions - #10

Merged
WilfordGrimley merged 2 commits into
masterfrom
worktree-recover-es-reindex-on-vote-transition
Jul 14, 2026
Merged

Reindex Card into ES on printing/tag consensus transitions#10
WilfordGrimley merged 2 commits into
masterfrom
worktree-recover-es-reindex-on-vote-transition

Conversation

@WilfordGrimley

@WilfordGrimley WilfordGrimley commented Jul 14, 2026

Copy link
Copy Markdown

Summary

Stage 3.5 on top of #9: reindex a card into ES immediately on a printing/tag
vote transition, instead of waiting for the next update_database scan.
Design and implementation detail: docs/features/printing-tags.md's new
"Stage 3.5" section.

  • documents.py: reindex_card_safely(card) — failure-isolated ES push,
    shared by both consensus modules.
  • printing_consensus.py: reindexes only when the effective indexed
    printing changes (enter/leave RESOLVED, or a changed resolved printing).
  • tag_consensus.py: its existing (already transition-gated) ES push now
    goes through the same failure-isolated helper.
  • Artist resolution: no ES-indexed field (inferred_canonical_artist/
    artist_vote_status only) — confirmed against documents.py, no hook.

Recovery note

The original session doing this work was killed mid-edit (terminal closed
before it could commit) — reconstructed from its transcript. documents.py
and printing_consensus.py are verbatim recoveries. tag_consensus.py's
docstring edit is verbatim; the call-site swap (CardSearch().update(...)
reindex_card_safely(card)) was never reached by the killed session — I
completed it, matching the pattern already established in
printing_consensus.py and required by the original spec's "if yes, same
hook there" for any ES-indexed field. Diffed all three files against the
transcript's edit history to confirm no partial application beyond that one
documented completion.

Verification

  • New tests (test_printing_consensus.py::TestResolveAndPersistPrintingReindex):
    unresolved→RESOLVED fires one reindex call; re-resolve to the same outcome
    fires zero; RESOLVED→contested fires one call and the indexed fields
    (get_expansion_code/get_collector_number) clear; an ES exception inside
    reindex_card_safely logs but doesn't block the DB write.
  • Full backend suite, real Postgres+ES via testcontainers (not the prod
    stack): 452 tests, 448 passed / 4 failed — the same 4 pre-existing
    secret/fixture-dependent failures Vote-system Stage 3: printing-preferred search consumption #9 documents (2 Moxfield, 2
    FileNotFoundError), no new failures.
  • Pre-commit (ruff, isort, black, mypy, prettier) clean on every commit.

🤖 Generated with Claude Code

https://claude.ai/code/session_016i9S7LQsCL3FGaih3ZTRBJ

@WilfordGrimley
WilfordGrimley marked this pull request as ready for review July 14, 2026 06:01
@WilfordGrimley
WilfordGrimley merged commit ae2ebb3 into master Jul 14, 2026
1 of 2 checks passed
@WilfordGrimley
WilfordGrimley deleted the worktree-recover-es-reindex-on-vote-transition branch July 14, 2026 06:03
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