Skip to content

Fix stage_e_shakedown run_id collision on same-day invocations - #470

Merged
WilfordGrimley merged 1 commit into
masterfrom
shakedown-runid-uniqueness
Jul 25, 2026
Merged

Fix stage_e_shakedown run_id collision on same-day invocations#470
WilfordGrimley merged 1 commit into
masterfrom
shakedown-runid-uniqueness

Conversation

@WilfordGrimley

Copy link
Copy Markdown

Description

Fixes a drill-found defect in the #465 stage_e_shakedown spec's run_id convention (§7(b) dispatcher-kill drill) — not an implementation bug in PR #467, a defect in the spec's own run_id shape that PR carried out faithfully.

The prefix stage-e-shakedown-b<batchsize>-<date>-<batch-num> (date-only) collides with PilotRunLedger.run_id's UNIQUE constraint on any second same-day invocation of the driver: kill-and-resume (the command's own documented resume contract via --reextracted-after) and every multi-invocation wave die with IntegrityError at the very first batch's ledger create.

Fixed by including a microsecond-precision invocation timestamp (%Y%m%dT%H%M%S%f), mirroring dispatch_micro_batch's own default run_id convention (stage_e_dispatch.py's f"stage-e-stream-{timezone.now().strftime('%Y%m%dT%H%M%S%f')}Z") — every invocation now gets a distinct prefix while the b<batchsize> segment stays greppable for the #463 wave analysis.

Updated: the run_id-shape test (now a regex match, since the timestamp is no longer a fixed 8-digit date), a new test proving two same-day invocations produce disjoint run_id sets, the command's own module docstring, and the "Ledger convention" example in docs/features/stage-e-operations.md's "Shakedown driver" subsection (no other literal run_id example found elsewhere in that doc).

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.
  • I have manually tested my changes as follows:
    • cd MPCAutofill && pytest cardpicker/tests/test_stage_e_shakedown.py cardpicker/tests/test_stage_e_dispatch.py -q — 71 passed (ran against a /tmp/mpcvenv venv, system Python lacks Django/deps). ruff/black/isort/mypy/prettier all pass via the pre-commit hook on the commit.
    • docs_lint.py clean.
  • I have updated any relevant documentation or created new documentation where appropriate.

Date-only run_id prefix collided with PilotRunLedger.run_id's UNIQUE
constraint on a second same-day invocation, breaking kill-and-resume.
Add microsecond-precision invocation timestamp, mirroring
dispatch_micro_batch's own default run_id convention.
@WilfordGrimley
WilfordGrimley merged commit 3275f3b into master Jul 25, 2026
10 checks passed
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