Skip to content

fix(tests): defuse the hardcoded-timestamp time bomb in the #2467 fleet-list test - #2488

Closed
dolho wants to merge 1 commit into
devfrom
fix/2467-turn-integrity-time-bomb
Closed

dolho wants to merge 1 commit into
devfrom
fix/2467-turn-integrity-time-bomb

Conversation

@dolho

@dolho dolho commented Sep 2, 2026 •

Copy link
Copy Markdown
Contributor

Summary

tests/unit/test_2467_turn_integrity.py::TestListReadersCarryTheColumn::test_fleet_list_returns_turn_integrity inserts a row with a hardcoded started_at = 2026-09-01T10:00Z, while get_fleet_executions filters on its default hours=24 window. The test was green until the calendar caught up and began failing on every branch at 2026-09-02T10:00 UTC (dev CI at 09:15Z today passed; any run after 10:00Z reds). Verified failing on clean origin/dev locally.

The sibling test_agent_summary_list_returns_turn_integrity kept passing because get_agent_executions_summary applies no window — which is why only one arm of the pair fired.

Fix

Timestamps derive from now(timezone.utc) - timedelta(minutes=…) in utc_now_iso()'s exact format, so the row always sits inside a rolling 24h window. Full file: 33 passed.

Closes #2486 (filed in parallel with the same diagnosis — hardcoded started_at vs the hours=24 default window).

This unblocks backend-unit-test for every open PR (CI runs on the PR merge ref, so landing this on dev heals them without rebases).

🤖 Generated with Claude Code

https://claude.ai/code/session_01NLfHNPtB5UCMk4LonZiJux

…et-list test

get_fleet_executions defaults to hours=24, and the fixture inserted a row
with a fixed started_at of 2026-09-01T10:00Z — green until the calendar
caught up, then red on every branch from 2026-09-02T10:00Z onward (the
agent-summary arm has no window and kept passing, which is why only one
of the pair fired). Timestamps now derive from NOW minus minutes, in
utc_now_iso()'s exact format.

Co-Authored-By: Claude Fable 5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01NLfHNPtB5UCMk4LonZiJux

@obasilakis obasilakis left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

/validate-pr: REQUEST CHANGES — superseded, suggest closing

The identical fix is already on dev as 803bb152 (PR #2497, merged 2026-09-02T14:02Z, 1h39m after this PR opened). origin/dev:tests/unit/test_2467_turn_integrity.py:515 derives started = datetime.now(timezone.utc) - timedelta(minutes=5) in the same utc_now_iso() format; this PR's _recent_iso() at tests/unit/test_2467_turn_integrity.py:456-461 is semantically identical (10/9 minutes ago). Two people fixed one bug in parallel and #2497 won the race — git merge-tree confirms a hard conflict with dev on that file, so merging this buys nothing and costs a conflict resolution.

The loose thread that does need action: #2497 landed with Refs #2467, not a closing keyword for #2486 — and this PR is the only one linking #2486 (gh pr list --search "2486 in:body"). So #2486 is fixed on dev but still OPEN and status-in-progress. Closing this PR unmerged strands it; it needs a manual close plus label bump.

Notes

  • The fix itself is sound — no reason to prefer either version on merit. datetime.now(timezone.utc) is explicit UTC with no DST or local-TZ dependency; the format is byte-identical to utc_now_iso()'s '%Y-%m-%dT%H:%M:%S.%fZ', so the lexicographic ISO-Z compare (Invariant #16) holds; 10 minutes ago is always inside iso_cutoff(24); and completed_at (9 min) stays after started_at (10 min). It is not weakened: it still asserts len(rows) == 1 plus the exact turn_integrity payload, and it keeps the default hours=24 window exercised rather than bypassing it.
  • Both this PR and #2497 chose #2486's second option, while the issue body explicitly says "Prefer the first" (hours=0). That's the PR authors overruling the ticket, not a reviewer call — and it's defensible, since option 1 would stop exercising the windowed path entirely. Worth marking on #2486 as consciously overridden rather than silently dropped.
  • Sibling scan found no systemic pattern. ~24 test files inspected across every iso_cutoff()-backed reader (fleet executions/stats/timeline, agent and schedule analytics, reports, reminders, subscription usage, VoIP caps, canary). Zero other tests combine a hardcoded absolute timestamp with a rolling-window reader — everything else seeds via datetime.now() - timedelta(...), monkeypatches iso_cutoff to the same literal, or hardcodes only in non-windowed columns. So the per-instance fix was correctly sized; an AST or lint guard for a single occurrence would be over-engineering.
  • For anyone reading the checks: pytest (base, seed *) pass does not contradict the time-bomb claim — .github/workflows/backend-unit-test.yml:117 runs the base side with || true by design, and the gating check is regression diff, which passed.

Findings produced by /validate-pr (Claude Code).

@github-actions

github-actions Bot commented Sep 3, 2026

Copy link
Copy Markdown

⚠️ Nightly unit-suite check skipped — merge conflict against dev.

Resolve by running git merge dev locally and pushing the result. The next nightly run will re-test once the conflict is gone.

@github-actions

github-actions Bot commented Sep 3, 2026

Copy link
Copy Markdown

⚠️ Live-instance suite skipped — merge conflict against dev.

Resolve by merging dev locally and pushing the result; the next nightly re-tests.

@vybe

vybe commented Sep 4, 2026

Copy link
Copy Markdown
Contributor

Closing as superseded, per the /validate-pr review on this PR.

The identical fix landed on dev first as 803bb152 (#2497, merged 2026-09-02T14:02Z). origin/dev:tests/unit/test_2467_turn_integrity.py now derives started = datetime.now(timezone.utc) - timedelta(minutes=5) in the utc_now_iso() format — semantically identical to this PR's _recent_iso(). Verified on origin/dev just now.

No reflection on the fix, which is sound; two people diagnosed one bug in parallel and #2497 won the race. Merging this would buy nothing and cost a conflict resolution on that file.

The loose thread the review flagged is now closed too: #2497 landed with Refs #2467 rather than a closing keyword for #2486, and this PR was the only one linking it — so #2486 was fixed on dev but still OPEN at status-in-progress. I've closed it and corrected its labels, so nothing is stranded by closing this.

@vybe vybe closed this Sep 4, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants