Fix stage_e_shakedown run_id collision on same-day invocations - #470
Merged
Conversation
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.
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
Fixes a drill-found defect in the #465
stage_e_shakedownspec'srun_idconvention (§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 withPilotRunLedger.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 withIntegrityErrorat the very first batch's ledger create.Fixed by including a microsecond-precision invocation timestamp (
%Y%m%dT%H%M%S%f), mirroringdispatch_micro_batch's own defaultrun_idconvention (stage_e_dispatch.py'sf"stage-e-stream-{timezone.now().strftime('%Y%m%dT%H%M%S%f')}Z") — every invocation now gets a distinct prefix while theb<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
pre-commitand installed the hooks withpre-commit installbefore creating any commits.cd MPCAutofill && pytest cardpicker/tests/test_stage_e_shakedown.py cardpicker/tests/test_stage_e_dispatch.py -q— 71 passed (ran against a/tmp/mpcvenvvenv, system Python lacks Django/deps).ruff/black/isort/mypy/prettierall pass via the pre-commit hook on the commit.docs_lint.pyclean.