Repository navigation
feat(cron): keep a run cut off by a gateway restart as pending replay (RIG-8084) - #45
Conversation
… (RIG-8084) A run the gateway cut off stays pending. Its occurrence counts when the replay finishes, not at the first shutdown. A replay cut off again counts at that shutdown and is not replayed again. A retry rung already counted its occurrence and keeps its ladder across a shutdown. Co-authored-by: Matt Wilkinson <matt@rigel.build>
… interrupted replay (RIG-8084)
Review round 1 at
|
Preserve interrupted occurrences through shutdown and local-time due scans; cover replay accounting and admission.
Only preserve pending replay for explicit manual claims.
Require each registered owner to receive interruption bookkeeping.
Review round 1: fixes at
|
| Finding | Fix | Test |
|---|---|---|
| High: real shutdown never stamps | The shutdown sweep and the ownership-loss path record the interruption as a replay | test_shutdown_sweep_preserves_interrupted_occurrence, test_ownership_loss_records_interruption |
| High: UTC stamp lost west of UTC | Stamp stored in the scheduler's zone | test_non_utc_replay_survives_due_scan |
Caller's ladder_rung ignored |
Honored | test_midrun_schedule_edit_keeps_retry_count |
| Malformed marker fails open | Counts the run, never replays | test_malformed_replay_counts_without_another_replay |
| Manual fire drops marker | Kept | test_manual_run_preserves_pending_replay |
Stale restored_replay |
Cleared on re-anchor and edit | test_schedule_edit_clears_restored_replay |
| Ordinary run counted once | New test | test_normal_completion_counts_once_without_replay |
| One-shot restore untested | New test | test_restore_unstarted_one_shot_releases_claim |
| Second-shutdown assertion was either/or | Asserts the replay key is absent | test_second_shutdown_does_not_stamp_again |
| Test names claimed crash and dispatch coverage | Renamed to their real scope | test_scan_before_claim_keeps_replay, test_multiplex_gate_ticks_only_admitted_profile_with_replay |
Replay lookup written three times; _claim_replay wrapper; backslash continuation |
One lookup helper using scheduled_instant; wrapper removed |
n/a |
Flag docstring, case numbers, RIG references, started_at comment, restored_replay shape, duplicated lock setup, doc sentences |
Fixed | n/a |
| Shutdown mocks | test_shutdown_interrupt.py mocks require and assert shutdown_interrupted=True |
that file |
Each high's test failed before its fix.
pytest tests/cron -q -k 'not TestRunJobScript' gives 1517 passed, 1 skipped (re-run at the final commit). ruff check on the changed files is clean.
|
Review round 2 fix at 9b77dc2: |
What does this PR do?
A gateway restart that cuts off a cron run no longer loses that occurrence. Shutdown stores it as pending work. The normal admitted tick replays it at most once, under ESTOP, drain and the profile gate.
This is T1 of the orion-docs design
nemo-cron-replay-pending.md, with Matt's Q2 ruling. A run is counted at its replay, so a cut-off final repeat still replays. A cut-off replay never replays again. T2 and the Q1 Discord read follow later.Related Issue
RIG-8084 (Linear). Replaces the startup re-fire in #32.
Type of Change
Changes Made
cron/jobs.py,cron/occurrences.py,cron/scheduler.pyand related files: the gateway shutdown sweep stamps areplaymarker, in the scheduler's zone, and it moves throughpending_slot,fire_claimandunreachable_retry. A malformed marker counts the run and never replays.cron-internals.mddocuments the replay.How to Test
pytest tests/cron -q -k 'not TestRunJobScript': 1518 passed, 1 skipped. The sandbox has no/bin/bash.ruff checkon the changed files: clean.ruff formatdrift is already onrigel-release.Submitted with
rjc --on rigel-release, because this fork's PR base isrigel-release, notmain.Checklist
Code
pytest tests/cron -qand all tests passpython scripts/checkpasses: its two failures are already onrigel-releaseDocumentation & Housekeeping
cron-internals.md)cli-config.yaml.exampleif I added/changed config keys: N/ACONTRIBUTING.mdorAGENTS.mdif I changed architecture or workflows: N/AFor New Skills
N/A: no skill changes.
Screenshots / Logs
N/A.
Refs RIG-8084
Co-authored-by: Matt Wilkinson matt@rigel.build