Skip to content

Fix Backend-tests CI: 10 tests missing the established tesseract mock - #137

Merged
WilfordGrimley merged 3 commits into
masterfrom
worktree-agent-aea2752d83552fd91
Jul 19, 2026
Merged

Fix Backend-tests CI: 10 tests missing the established tesseract mock#137
WilfordGrimley merged 3 commits into
masterfrom
worktree-agent-aea2752d83552fd91

Conversation

@WilfordGrimley

@WilfordGrimley WilfordGrimley commented Jul 19, 2026

Copy link
Copy Markdown

Description

Fixes a real, scoped regression: 10 tests added 2026-07-15 to -17 in MPCAutofill/cardpicker/tests/test_local_identify_printing_tags.py skip this file's established convention (ddb6dce9's docstring invariant: any test whose path reaches local_ocr.run_tesseract must monkeypatch it) — they crashed CI with TesseractNotFoundError since real OCR was never mocked, only masked locally by the dev venv/Docker image having tesseract genuinely installed.

Full investigation, including two other root causes found in the same CI failure (both NOT fixed here, not code bugs — see below) is at docs/reports/2026-07-19-backend-tests-ci-tesseract-fix.md.

Note on overlap with #135 (merged, 6c6ea198): that PR independently fixed the Moxfield and Google-Drive-credential failures via pytest.mark.skipif, and installed real tesseract-ocr in the CI runner itself. This branch was cut before #135 landed; its own Moxfield-adjacent fix (a requires_network pytest marker) was discarded once #135's already-merged, more thorough fix was discovered — no duplicate marker ships here.

Resolved (owner decision, 2026-07-19): SHIP IT. The open question was whether this fix still adds value now that #135 installs real tesseract in CI. Owner's call: the file's monkeypatch convention is about unit-test hermeticity; #135 is about CI environment capability — both true simultaneously, hermetic units don't get retired by a provisioned runner. Merge on green.

Checklist

  • I have installed pre-commit and installed the hooks with pre-commit install before creating any commits.
  • I have updated any related tests for code I modified or added new tests where appropriate. (No production code touched — test-file-only fix, 10 tests brought into line with the file's own established mocking convention.)
  • I have manually tested my changes as follows:
    • python3 -m py_compile on the edited test file: clean.
    • pytest --collect-only inside a throwaway container from the live mpcautofill_django:latest image: 145 tests collected, zero collection errors.
    • Directly reproduced the CI failure (TesseractNotFoundError) and the fix's effect in isolation against the real local_fallback.detect_illus_anchor code path, with and without the monkeypatch — see the linked report for detail. Full pytest run of the 10 tests' own assertions (not just the tesseract crash) was not executed in this environment (needs Docker-socket/testcontainers access this sandbox doesn't have) — recommend confirming via this branch's own next CI run rather than building special local infra for it.
  • I have updated any relevant documentation or created new documentation where appropriate. (docs/troubleshooting.md's TesseractNotFoundError entry updated in place.)

WilfordGrimley and others added 3 commits July 19, 2026 16:37
10 tests in test_local_identify_printing_tags.py (added 2026-07-15 to
-17) call run_pilot with a real fetched image but skip monkeypatching
local_ocr.run_tesseract, so detect_illus_anchor's unconditional OCR
fallback hits the real tesseract binary - absent on CI's bare
ubuntu-latest runner, present in the local Docker image and host venv,
which is why this passed everywhere except CI. Same fix pattern as
ddb6dce.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Wio5Yq81k96aHjSJMFB62d
@WilfordGrimley
WilfordGrimley merged commit b53ef25 into master Jul 19, 2026
9 checks passed
WilfordGrimley added a commit that referenced this pull request Jul 19, 2026
…E_API_KEY rotation didn't clear the CI skip

CORR-0009: a directive claimed PR #136/#137 were merged via UI when
they weren't (conflated with two unrelated credential rotations) --
caught by gh api verification before any branch deletion or downstream
claim, zero actual damage.

docs/lessons.md: rotating GOOGLE_DRIVE_API_KEY alone didn't clear the
4-skipped baseline on a fresh re-run -- likely still blocked on
pyOpenSSL not being installed in the CI runner (per #135's own commit
note), not conclusively fixed by the rotation alone.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Wio5Yq81k96aHjSJMFB62d
WilfordGrimley added a commit that referenced this pull request Jul 19, 2026
…tions ledger, docs manifest (#136)

* Phase 1/2 orchestration groundwork: guard hook, SessionStart context, worker roster

Adds a committed .claude/settings.json wiring two hooks: guard_master.py
(PreToolUse) blocks gh pr merge / git merge into master unconditionally,
and git push to master only from worker worktree checkouts, leaving the
interactive main-checkout push-to-master convention untouched; and
session_context.sh (SessionStart) injects live branch/CI/PR state,
using the correct fork-vs-upstream repo slug and the Checks API (not
the legacy Status API, which silently hides Actions failures).

Adds four scrubbed, public worker agent definitions
(.claude/agents/worker-{backend,frontend,docs,upstream}.md) and a
tiered report schema mirror (docs/reports/schema.json) for the
six-field standing report format.

Carves committed exceptions into .gitignore's blanket /.claude/
ignore so these files are actually trackable. Documents the
branch-protection trade-off (real backstop vs. workflow cost) in
docs/infrastructure.md without applying it.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Wio5Yq81k96aHjSJMFB62d

* Fix guard_master.py stub-logging path leak; add corrections ledger, docs manifest, lessons triage ritual

guard_master.py fixes: exempt git merge --ff-only from the unconditional
git-merge-into-master block (a fast-forward sync isn't an authorization
decision); fix log_stub() resolving repo root from the script's own
on-disk path instead of cwd, which was writing real ledger entries from
test-fixture invocations.

Adds corrections/ (blameless CORR-NNNN ledger, seeded with 7 verified
incidents from this week's real history), docs/MANIFEST.md (routing
table: path/purpose/governs-what/authority), and a lessons-to-gates
triage ritual documented in docs/lessons.md. Broadens CLAUDE.md's
gh-CLI upstream-parent-resolution note to cover list/view, not just
create/merge.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Wio5Yq81k96aHjSJMFB62d

* Add CORR-0008 (ramp-probe serialized latency) + report-as-evidence ledger rule

Establishes that a corrections entry may cite a report instead of a
commit SHA when no discrete commit exists for the fix (owner decision).

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Wio5Yq81k96aHjSJMFB62d

* Add CORR-0009 (planner asserted unconfirmed merges); note GOOGLE_DRIVE_API_KEY rotation didn't clear the CI skip

CORR-0009: a directive claimed PR #136/#137 were merged via UI when
they weren't (conflated with two unrelated credential rotations) --
caught by gh api verification before any branch deletion or downstream
claim, zero actual damage.

docs/lessons.md: rotating GOOGLE_DRIVE_API_KEY alone didn't clear the
4-skipped baseline on a fresh re-run -- likely still blocked on
pyOpenSSL not being installed in the CI runner (per #135's own commit
note), not conclusively fixed by the rotation alone.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Wio5Yq81k96aHjSJMFB62d

---------

Co-authored-by: Claude Sonnet 5 <noreply@anthropic.com>
@WilfordGrimley
WilfordGrimley deleted the worktree-agent-aea2752d83552fd91 branch July 19, 2026 18:32
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