Skip to content

Graduate crash-drill script, fix test snapshot-sequence pinning - #405

Merged
WilfordGrimley merged 3 commits into
masterfrom
sark-hygiene-crashdrill-conftest
Jul 24, 2026
Merged

Graduate crash-drill script, fix test snapshot-sequence pinning#405
WilfordGrimley merged 3 commits into
masterfrom
sark-hygiene-crashdrill-conftest

Conversation

@WilfordGrimley

Copy link
Copy Markdown

Description

Two owner-ordered hygiene items, bundled as one small PR:

  1. Graduate the crash drill. Copies crash_drill.sh (v5, byte-identical) from the orchestration repo into this repo at scripts/ops/crash_drill.sh — it passed in production 2026-07-23 (kill at 105/1000 committed, DRILL-PASS 2026-07-23T18:31:39Z). Documents it in docs/features/catalog-completion-plan.md's Stage E resume-contract section: the acceptance test now exists as a re-runnable script, and its one edit-point per run is the seeded cohort query. Refs Stage E: streaming assembly + resume contract + kill-test #153 (the drill-slice comment/close on that issue is not part of this PR — orchestrator handles issue state).

  2. Conftest hoist → sequence-pinning fix. The _preserve_shared_factory_sequences capture/restore convention (forgotten twice today, breaking test_views.py snapshots both times) turned out to protect the wrong side: test_views.py is the only module in the suite whose snapshots (__snapshots__/test_views.ambr) embed a factory_boy sequence-derived value (an autogenerated "Artist N" name, reached via brainstorm_canonical_card's default CanonicalCardFactory/CanonicalArtistFactory SubFactory chain). Every other module using the same shared factories had to independently capture/restore its own use of them around itself so test_views.py's hardcoded values stayed put — fragile, and forgotten 3 times now (see docs/troubleshooting.md's retired entry for the history).

    Fix: push the pin to the one module that actually needs it. test_views.py now resets its shared factories to a fixed baseline (Factory.reset_sequence(0, force=True)) before every one of its own tests, via a new _pin_shared_factory_sequences autouse fixture — self-determined regardless of suite composition, collection order, or how many other tests ran first. Removed the now-redundant per-module _preserve_shared_factory_sequences fixture + _SHARED_FACTORIES list (and the now-unused cardpicker.tests.factories imports it required) from the other 31 test files that carried it, including test_views.py's own old request.node.name-gated single-test-insulation variant, which is no longer needed.

    docs/troubleshooting.md and docs/lessons.md rewritten in place to describe the new pattern (old entries kept as history, marked RETIRED). Added a Backend-table row + detail note to docs/upstreaming/extractable-primitives.md and a Tier-1 ladder entry to docs/upstreaming/readiness-audit.md for the pattern itself (zero fork-only imports, applicable to any factory_boy + snapshot-testing pairing) — per the docs' own upstreaming-ledger convention, judged honestly: it's a pattern-level primitive, not a file to lift (its current call site, test_views.py, asserts real fork-only fields elsewhere in the same file).

Checklist

  • I have installed pre-commit and installed the hooks with pre-commit install before creating any commits. (pre-commit run --files <all touched> clean: ruff, isort, black, mypy, prettier all pass)
  • I have updated any related tests for code I modified or added new tests where appropriate. (test-infra-only change; test_views.ambr re-recorded via --snapshot-update, diff confirmed purely additive — the 6 changed keys are exactly the sequence-derived "Artist N""Artist 0" values, nothing else)
  • I have manually tested my changes as follows:
    • Full backend suite (pytest . from MPCAutofill/, real Postgres/Elasticsearch via testcontainers on the host venv): 1829 passed, 4 skipped, 0 failed (verified twice, before and after the pre-commit auto-fix pass)
    • Verified pytest cardpicker/tests/test_views.py --snapshot-update in isolation now produces byte-identical output to the full-suite --snapshot-update run (the old single-file-vs-full-suite divergence this fix retires)
    • diff-verified scripts/ops/crash_drill.sh is byte-identical to the orchestration repo's already-passed v5 copy
  • I have updated any relevant documentation or created new documentation where appropriate. (catalog-completion-plan.md, troubleshooting.md, lessons.md, extractable-primitives.md, readiness-audit.md — all edited in place, no new files)

Closes nothing; refs #153.

Copies the production-verified crash_drill.sh (2026-07-23 DRILL-PASS)
into scripts/ops/ and documents it in the resume-contract section of
catalog-completion-plan.md.

Also fixes the _preserve_shared_factory_sequences convention that broke
test_views.py snapshots twice today: instead of every module using a
shared factory protecting the one module that asserts on exact
sequence-derived values, test_views.py now pins those factories to a
fixed baseline per test, so its snapshots are self-determined regardless
of suite composition or collection order. Removes the now-redundant
per-module fixture + _SHARED_FACTORIES list from the other 31 test
files. Full backend suite: 1829 passed, 4 skipped, 0 failed.

Refs #153.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@WilfordGrimley
WilfordGrimley merged commit 3a50aa6 into master Jul 24, 2026
9 checks passed
WilfordGrimley added a commit that referenced this pull request Jul 24, 2026
…I onto Tokyo-11

PR #431 landed after the original sweep with its own hardcoded #302-derived
literals (CardbackApplyPrompt.tsx, useCardbackReminderGate.tsx,
PDFWaitPanel.tsx, SlotCardbackControl.tsx, plus a new DisplayPage.tsx line) -
migrated onto var(--bs-*)/var(--theme-*) tokens the same way the rest of the
sweep was, including simplifying the primary/info/success at-rest button
text to use the token directly (Tokyo-11's action colours are light enough,
unlike #302's, so the separate hand-picked tint literals aren't needed any
more). CardbackPdfWaitFidelity.spec.ts's own literal assertions updated to
match, comment-linked per row.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
WilfordGrimley added a commit that referenced this pull request Jul 24, 2026
… Semi radius) (#438)

* Re-theme site to Tokyo-11 (Tokyo Night base, orange action, purple accent, Semi radius)

Owner-ruled palette swap (theme-options study, palette 11) on top of #425's
token-layer pass: new colour/radius tokens in _theme-tokens.scss, Bootstrap
variable + runtime var(--bs-*)/var(--theme-*) wiring in styles.scss (incl.
the AAA button-ink flip and a WCAG/APCA audit fold-in: opaque accent focus
ring, .btn-close/.fbtoggle target-size fixes, a lightened muted token),
accent wiring across D14/chips/toggles/selection outlines, a sitewide sweep
of hardcoded old-palette literals onto token references, and matching
DisplayLeftRailFidelity.spec.ts updates.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>

* Merge master (#427/#405/#440), re-theme PR #431's cardback+PDF-wait UI onto Tokyo-11

PR #431 landed after the original sweep with its own hardcoded #302-derived
literals (CardbackApplyPrompt.tsx, useCardbackReminderGate.tsx,
PDFWaitPanel.tsx, SlotCardbackControl.tsx, plus a new DisplayPage.tsx line) -
migrated onto var(--bs-*)/var(--theme-*) tokens the same way the rest of the
sweep was, including simplifying the primary/info/success at-rest button
text to use the token directly (Tokyo-11's action colours are light enough,
unlike #302's, so the separate hand-picked tint literals aren't needed any
more). CardbackPdfWaitFidelity.spec.ts's own literal assertions updated to
match, comment-linked per row.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>

* Fix PagePreview.tsx CustomCardbackDot missed by #431 merge sweep

Post-merge re-scan (coordinator's ask) caught one more #302-derived
literal (#431's own PagePreview.tsx diff) - the flip-button custom-cardback
indicator dot's warning colour wasn't yet routed to var(--bs-warning).

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>

---------

Co-authored-by: Claude Fable 5 <noreply@anthropic.com>
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