fix(ci): use fresh relative ts in conductor-snapshot tests (fixes #2550, unblocks core gate) #2551
Reference in New Issue
Block a user
Delete Branch "fix/ops-scripts-snapshot-frozen-ts-2550"
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?
What
Test-only fix for the core merge-gate breakage tracked in #2550.
The 4 conductor-snapshot tests hardcoded a frozen literal timestamp
ts="2026-06-10T12:00:00Z".load_conductor_snapshot()only honors a snapshot within a 10-minute freshness window, so once wall-clock passed12:10:00Zthe frozen snapshot was dropped as stale → the code fell through to a real API self-fetch → with emptyGITEA_OWNER/GITEA_REPOit built a malformed/repos///...URL → crash.This turned the required context
Ops Scripts Tests / Ops scripts (unittest)permanently RED on every core PR. (The job'scontinue-on-error: truemasks the workflow green, but the per-step pytest failure still posts the commit-status context asfailure, which is what the gate keys off.)Fix
Default
_make_snapshot/ the inline snapshot dicts to anow()-based timestamp (_fresh_ts()), so the snapshot is always inside the freshness window when the suite runs. This mirrors the already-correct relative-ts approach intest_load_conductor_snapshot_ignores_stale_snapshot. Tests that intentionally want a STALE snapshot still passts=explicitly.No production-script change. The staleness logic in
gitea-merge-queue.py/status-reaper.pyis correct and untouched — the bug was purely a frozen-literal fixture vs. a relative-age check.Verification
On a clean
origin/maincheckout:4 failed, 379 passed, 2 skipped383 passed, 2 skipped, 75 subtests passed(0 failures)Fixes #2550.
🤖 Generated with Claude Code
core-qa: APPROVE.
Verified the fix on a clean origin/main checkout: the suite goes from
4 failed, 379 passedto383 passed, 2 skipped, 75 subtests passedwith zero failures. The 4 named tests (test_list_candidate_issues_uses_snapshot_when_present,test_list_queued_issues_uses_snapshot_label_filter,test_get_combined_status_uses_snapshot_when_sha_matchesx2) now pass.Root cause is correctly named (frozen-literal fixture ts vs. a relative 10-minute freshness check — a time-bomb, not a flake), and the fix mirrors the already-correct relative-ts pattern in
test_load_conductor_snapshot_ignores_stale_snapshot. The intentionally-stale test still passests=explicitly, so freshness coverage is preserved. No production-script change. Nocontinue-on-errorrenewed. Quality gate: PASS.core-security: APPROVE.
Test-only diff (
+24/-4, two.gitea/scripts/tests/*.pyfiles). No production code, no secrets, no network/credential surface, no new dependencies. The only behavioral change is fixture timestamps moving from a frozen literal todatetime.now(timezone.utc)— no injection or untrusted-input path. The staleness check ingitea-merge-queue.py/status-reaper.pyis untouched, so the snapshot-freshness security property (don't act on a stale conductor view) is preserved. No security concerns. Approve.