Skip to content

feat: add stability index for CI/CD gating (QA-04)#5

Open
philmcneely wants to merge 3 commits into
mainfrom
feature/qa-04-stability-index
Open

feat: add stability index for CI/CD gating (QA-04)#5
philmcneely wants to merge 3 commits into
mainfrom
feature/qa-04-stability-index

Conversation

@philmcneely

Copy link
Copy Markdown
Owner

Track pass/fail per test over last N runs. Tests below threshold are quarantined (xfail) so they don't block CI pipelines.

Track pass/fail per test over last N runs. Tests below threshold
are quarantined (xfail) so they don't block CI pipelines.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@philmcneely

Copy link
Copy Markdown
Owner Author

Shouldnt there be an update to the documentation?

@github-actions

Copy link
Copy Markdown

✅ All smoke tests passed! View report

Document the flaky test quarantine feature: how it works,
environment variables, programmatic API, and data storage.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@philmcneely

Copy link
Copy Markdown
Owner Author

Added Section 16: Stability Index (Flaky Test Quarantine) to the README covering:

  • How the tracking/scoring/quarantine pipeline works
  • STABILITY_THRESHOLD env var
  • Programmatic API (get_stability, get_stability_report, get_unstable_tests)
  • Data storage details (data/stability_history.json)
  • Updated the directory structure to include stability_index.py

Commit: c120861

_load_history() crashed with JSONDecodeError when the history file existed
but was empty — happens when pytest-xdist workers create the file
concurrently. Fixed with:
- Graceful handling of empty/malformed JSON (return {} instead of crash)
- Atomic writes via tmp file + rename (prevents partial reads)
- fcntl file locking in record_result() to serialize concurrent workers

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@philmcneely

Copy link
Copy Markdown
Owner Author

Fixed the CI failure — INTERNALERROR in the smoke job caused by JSONDecodeError in stability_index.py.

Root cause: _load_history() crashed when the history file existed but was empty. With pytest-xdist running parallel workers, one worker could create/truncate the file while another tried to read it.

Fix (988f5f4):

  • _load_history() now handles empty files and malformed JSON gracefully (returns {} instead of crashing)
  • _save_history() uses atomic write (tmp file + rename()) to prevent partial reads
  • record_result() uses fcntl.flock() to serialize concurrent xdist workers

Smoke tests should pass now.

@github-actions

Copy link
Copy Markdown

✅ All smoke tests passed! View report

@github-actions

Copy link
Copy Markdown

✅ All chromium login tests passed! View report

@github-actions

Copy link
Copy Markdown

✅ All firefox login tests passed! View report

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.

1 participant