fix(ci): use fresh relative ts in conductor-snapshot tests (fixes #2550, unblocks core gate) #2551

Merged
core-be merged 1 commits from fix/ops-scripts-snapshot-frozen-ts-2550 into main 2026-06-10 18:44:39 +00:00
Member

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 passed 12:10:00Z the frozen snapshot was dropped as stale → the code fell through to a real API self-fetch → with empty GITEA_OWNER/GITEA_REPO it 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's continue-on-error: true masks the workflow green, but the per-step pytest failure still posts the commit-status context as failure, which is what the gate keys off.)

Fix

Default _make_snapshot / the inline snapshot dicts to a now()-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 in test_load_conductor_snapshot_ignores_stale_snapshot. Tests that intentionally want a STALE snapshot still pass ts= explicitly.

No production-script change. The staleness logic in gitea-merge-queue.py / status-reaper.py is correct and untouched — the bug was purely a frozen-literal fixture vs. a relative-age check.

Verification

On a clean origin/main checkout:

  • Before: 4 failed, 379 passed, 2 skipped
  • After: 383 passed, 2 skipped, 75 subtests passed (0 failures)
$ python -m pytest .gitea/scripts/tests -q
383 passed, 2 skipped, 75 subtests passed in 4.52s

Fixes #2550.

🤖 Generated with Claude Code

## 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 passed `12:10:00Z` the frozen snapshot was dropped as stale → the code fell through to a real API self-fetch → with empty `GITEA_OWNER`/`GITEA_REPO` it 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's `continue-on-error: true` masks the *workflow* green, but the per-step pytest failure still posts the **commit-status context** as `failure`, which is what the gate keys off.) ## Fix Default `_make_snapshot` / the inline snapshot dicts to a `now()`-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 in `test_load_conductor_snapshot_ignores_stale_snapshot`. Tests that intentionally want a STALE snapshot still pass `ts=` explicitly. No production-script change. The staleness logic in `gitea-merge-queue.py` / `status-reaper.py` is correct and untouched — the bug was purely a frozen-literal fixture vs. a relative-age check. ## Verification On a clean `origin/main` checkout: - Before: `4 failed, 379 passed, 2 skipped` - After: `383 passed, 2 skipped, 75 subtests passed` (0 failures) ``` $ python -m pytest .gitea/scripts/tests -q 383 passed, 2 skipped, 75 subtests passed in 4.52s ``` Fixes #2550. 🤖 Generated with [Claude Code](https://claude.com/claude-code)
core-be added 1 commit 2026-06-10 18:42:37 +00:00
fix(ci): use fresh relative ts in conductor-snapshot tests (#2550)
ci-arm64-advisory / fast-checks (pull_request) Waiting to run
CI / Python Lint & Test (pull_request) Successful in 4s
Block internal-flavored paths / Block forbidden paths (pull_request) Successful in 8s
Handlers Postgres Integration / detect-changes (pull_request) Successful in 4s
Lint forbidden tenant-env keys / Scan workspace_secrets writers for forbidden env keys (pull_request) Successful in 5s
E2E Staging Canvas (Playwright) / detect-changes (pull_request) Successful in 6s
Lint forbidden tenant-env keys / Scan for repo-host token write into tenant workspace surface (pull_request) Successful in 6s
E2E API Smoke Test / detect-changes (pull_request) Successful in 10s
Handlers Postgres Integration / Handlers Postgres Integration (pull_request) Successful in 2s
E2E Staging Canvas (Playwright) / Canvas tabs E2E (pull_request) Successful in 3s
sop-checklist / review-refire (pull_request_target) Has been skipped
Secret scan / Scan diff for credential-shaped strings (pull_request) Successful in 6s
E2E API Smoke Test / E2E API Smoke Test (pull_request) Successful in 3s
sop-checklist / all-items-acked (pull_request) acked: 0/7 — missing: comprehensive-testing, local-postgres-e2e, staging-smoke, +4 — body-unfilled: comprehensive-testing, local-postgres-e2
sop-checklist / na-declarations (pull_request) N/A: (none)
CI / Detect changes (pull_request) Successful in 18s
sop-checklist / all-items-acked (pull_request_target) Successful in 7s
gate-check-v3 / gate-check (pull_request_target) Successful in 10s
CI / Platform (Go) (pull_request) Successful in 2s
CI / Canvas (Next.js) (pull_request) Successful in 2s
CI / Shellcheck (E2E scripts) (pull_request) Successful in 2s
lint-required-no-paths / lint-required-no-paths (pull_request) Successful in 18s
CI / Canvas Deploy Status (pull_request) Successful in 1s
Lint shellcheck (arm64 pilot) / shellcheck-arm64 (pilot) (pull_request) Successful in 14s
E2E Chat / detect-changes (pull_request) Successful in 25s
CI / all-required (pull_request) Successful in 2s
E2E Chat / E2E Chat (pull_request) Successful in 2s
security-review / approved (pull_request_target) Approved via pull_request_review trigger
security-review / approved (pull_request_review) Successful in 14s
qa-review / approved (pull_request_target) Approved via pull_request_review trigger
qa-review / approved (pull_request_review) Successful in 13s
Ops Scripts Tests / Ops scripts (unittest) (pull_request) Successful in 1m2s
audit-force-merge / audit (pull_request_target) Successful in 6s
Local Provision Lifecycle E2E / Local Provision Lifecycle E2E (stub) (pull_request) Failing after 6m33s
Local Provision Lifecycle E2E / Local Provision Lifecycle E2E (real image + MiniMax LLM, advisory) (pull_request) Failing after 8m9s
2f2b98445e
The 4 conductor-snapshot tests hardcoded ts="2026-06-10T12:00:00Z".
load_conductor_snapshot() only honors a snapshot within a 10-minute
freshness window, so once wall-clock passed 12:10Z the frozen snapshot
was dropped as stale -> self-fetch with empty OWNER/NAME -> /repos///
crash. This turned the required context "Ops Scripts Tests / Ops scripts
(unittest)" permanently RED on every core PR (continue-on-error masks the
workflow green but the commit-status context still posts failure).

Fix: default _make_snapshot / the inline snapshot dicts to a now()-based
ts (_fresh_ts), matching the already-correct relative-ts approach in
test_load_conductor_snapshot_ignores_stale_snapshot. Tests wanting a STALE
snapshot still pass ts= explicitly. Test-only; no production script change.

Fixes #2550.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
core-be requested review from molecule-code-reviewer 2026-06-10 18:43:03 +00:00
core-qa approved these changes 2026-06-10 18:43:28 +00:00
core-qa left a comment
Member

core-qa: APPROVE.

Verified the fix on a clean origin/main checkout: the suite goes from 4 failed, 379 passed to 383 passed, 2 skipped, 75 subtests passed with 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_matches x2) 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 passes ts= explicitly, so freshness coverage is preserved. No production-script change. No continue-on-error renewed. Quality gate: PASS.

core-qa: APPROVE. Verified the fix on a clean origin/main checkout: the suite goes from `4 failed, 379 passed` to `383 passed, 2 skipped, 75 subtests passed` with 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_matches` x2) 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 passes `ts=` explicitly, so freshness coverage is preserved. No production-script change. No `continue-on-error` renewed. Quality gate: PASS.
core-security approved these changes 2026-06-10 18:43:33 +00:00
core-security left a comment
Member

core-security: APPROVE.

Test-only diff (+24/-4, two .gitea/scripts/tests/*.py files). No production code, no secrets, no network/credential surface, no new dependencies. The only behavioral change is fixture timestamps moving from a frozen literal to datetime.now(timezone.utc) — no injection or untrusted-input path. The staleness check in gitea-merge-queue.py / status-reaper.py is untouched, so the snapshot-freshness security property (don't act on a stale conductor view) is preserved. No security concerns. Approve.

core-security: APPROVE. Test-only diff (`+24/-4`, two `.gitea/scripts/tests/*.py` files). No production code, no secrets, no network/credential surface, no new dependencies. The only behavioral change is fixture timestamps moving from a frozen literal to `datetime.now(timezone.utc)` — no injection or untrusted-input path. The staleness check in `gitea-merge-queue.py` / `status-reaper.py` is untouched, so the snapshot-freshness security property (don't act on a stale conductor view) is preserved. No security concerns. Approve.
core-be merged commit 7082e28814 into main 2026-06-10 18:44:39 +00:00
Sign in to join this conversation.
3 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: molecule-ai/molecule-core#2551