Skip to content

test(workflows): fix flaky last_run_at listing test on Windows - #9788

Merged
lstein merged 1 commit into
mainfrom
fix/flaky-workflow-last-run-at-test
Oct 10, 2026
Merged

lstein merged 1 commit into
mainfrom
fix/flaky-workflow-last-run-at-test

Conversation

@lstein

@lstein lstein commented Oct 10, 2026

Copy link
Copy Markdown
Collaborator

Summary

test_workflow_last_run_at.py::test_update_last_run_at_sets_timestamp fails intermittently, mostly on Windows CI.

  • The fixture stores the 43 bundled workflows, then the test creates one workflow and expects it in the first 10 results of a listing sorted newest first by created_at.
  • created_at has millisecond resolution. On Windows' ~15 ms clock the new workflow usually gets the same timestamp as the bundled ones.
  • Ties sort by workflow_id descending. A random UUID sorts above the bundled default_... ids only about 1 time in 7 or 8, so the new workflow usually falls off the page and the test's next(...) raises StopIteration.

The listing now includes only user workflows, which is what the check is about. Nothing else changes.

Related Issues / Discussions

Seen as the windows-cpu failure on #9694. The test came in with #9702.

QA Instructions

  • Forced tie (a throwaway test setting every row's created_at to the same value), 20 runs each: the old query lost the workflow in 19, the new one in none.
  • uv run --no-sync pytest tests/app/services/workflow_records: 137 passed.
  • ruff check and ruff format --check are clean.

Review

No material findings. This is a one-line test change.

Checklist

  • The PR has a short but descriptive title, suitable for a changelog
  • Meaningful regression coverage added / updated where needed; obsolete tests/code removed
  • Persisted-state and API changes include required migrations / compatibility validation
  • Relevant performance/efficiency opportunities considered; material claims have evidence
  • Material review findings resolved and relevant checks rerun
  • Documentation added / updated (if applicable)
  • Updated What's New copy (if doing a release after this PR)

… the page

The listing check now pages user workflows only. On a coarse clock the new workflow
ties on created_at with the 43 bundled workflows, and the workflow_id tie-break
usually put it past the first 10.
@lstein lstein added the 7.0.0 label Oct 10, 2026
@github-actions github-actions Bot added the python-tests PRs that change python tests label Oct 10, 2026
@lstein
lstein merged commit 3289f16 into main Oct 10, 2026
17 checks passed
@lstein
lstein deleted the fix/flaky-workflow-last-run-at-test branch October 10, 2026 19:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

7.0.0 python-tests PRs that change python tests

Projects

Status: 7.0 Theme: Modular Design

Development

Successfully merging this pull request may close these issues.

2 participants