Fix pending watcher leases for same-second Forgejo dispatches #37
No reviewers
Labels
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
logiciels/tricoteuses-assemblee!37
Loading…
Reference in a new issue
No description provided.
Delete branch "fix/forgejo-pending-second-precision"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Problem
Forgejo reports creation timestamps at second precision; the watcher records dispatchedAt with milliseconds before the POST. The exact Scrutins dispatch of 2026-10-05 (update run 1852) was created at 03:00:44Z while dispatchedAt was 03:00:44.403Z. Its failure was rejected as an older run, retaining a 24-hour pending lease after an upstream 503. Amendements run 1866 exhibits the same issue.
Fix
Normalize the dispatch lower bound to seconds, both for exact UUID matching and the pagination cutoff. Preserve exact dispatch UUID/workflow matching, genuinely older-run rejection and conservative handling of absent/unavailable status. Do not merely continue past the exact matched run.
Validation
Two new regression tests fail before the fix and pass after: same-second failed/cancelled/active/succeeded states (including Paris offset and preceding-second rejection), and same-second pagination. Replaying the real API responses changes recognizedStatus from undefined to failed for both runs. Full suite: 378 passed, 57 skipped; lint: no errors (existing warnings); type-check: passed.
Deployment
Production watch.yml resolves master at startup. Merge, then dispatch a new watcher to let it clear failed pending leases and trigger the normal fenced ingestion workflow. No manual state deletion or corpus write outside CI.