Skip to content

Deflake CI: record DOI fixtures, retry Jupyter execution e2e tests - #62

Merged
mmcky merged 3 commits into
mainfrom
feature/ci-deflake
Jun 12, 2026
Merged

Deflake CI: record DOI fixtures, retry Jupyter execution e2e tests#62
mmcky merged 3 commits into
mainfrom
feature/ci-deflake

Conversation

@mmcky

@mmcky mmcky commented Jun 12, 2026

Copy link
Copy Markdown

Fixes #29

Context

Four flake incidents today alone, culminating in the live-DOI test failing all three node jobs simultaneously on the sync PR #59 (doi.org throttling the runner IP range). Of the issue's options this implements (4) the real fix for the DOI tests plus (2) targeted per-test retry for the Jupyter tests — deliberately not the workflow-level retry, so genuinely deterministic tests still fail fast.

DOI tests → recorded fixtures

  • doi.spec.ts now uses a mock session whose fetch serves recorded doi.org content-negotiation responses (fixtures/doi.json, captured today with the proper Accept headers — including the month=Sept quirk that previously caused live drift).
  • Coverage preserved: URL normalization (the "strange characters" cases still construct a real URL), content negotiation by Accept header, and the full BibTeX/CSL-JSON parsing pipeline all still run — only the network is fixed.
  • TEST_LIVE_DOI=1 runs the same cases against live doi.org as well (16 tests total; verified passing) — for fixture refresh or upstream-drift checks, e.g. from a scheduled workflow later.
  • Side benefit: 8 tests run in ~30ms instead of ~4s of network round-trips.

Jupyter execution tests → targeted retry

  • The e2e runner (endToEnd.spec.ts) moves from test.each to per-case test(title, { retry }, fn) so cases can declare vitest options; exports.yml gains retry: 2 on exactly the two known-environmental cases (Serial execution, Concurrent execution), each attempt with a fresh timeout. All other e2e cases keep retry: 0.

Testing

  • Full monorepo build + test pass (all 56 e2e cases green through the new runner)
  • DOI suite green in both recorded (8) and live (16) modes

🤖 Generated with Claude Code

The two flake classes from #29:

- DOI resolver tests no longer hit live doi.org: a mock session serves
  recorded content-negotiation responses (fixtures/doi.json), keeping
  the URL handling and BibTeX/CSL-JSON parsing under test while
  removing the dependency on doi.org availability/throttling. The live
  variants remain available behind TEST_LIVE_DOI=1 for fixture
  refresh / drift checks. 8 tests now run in ~30ms instead of ~4s.
- The e2e export runner now supports per-case vitest `retry`; the two
  Jupyter kernel-timing cases (Serial/Concurrent execution) get
  retry: 2 with a fresh timeout per attempt. Deliberately not a
  workflow-level retry, so genuinely deterministic tests still fail
  fast and loudly.

Fixes #29

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Copilot AI review requested due to automatic review settings June 12, 2026 04:05

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Pull request overview

This PR aims to deflake CI by removing reliance on live doi.org network calls in DOI resolver tests (using recorded fixtures) and by enabling targeted per-test retries for known flaky Jupyter execution end-to-end cases.

Changes:

  • Add retry support to the e2e test runner and set retry: 2 for the two known flaky Jupyter execution cases in exports.yml.
  • Replace live-network doi.org test behavior with recorded fixtures, while keeping an opt-in mode for live DOI verification via TEST_LIVE_DOI.
  • Add a changeset documenting the CI deflaking changes.

Reviewed changes

Copilot reviewed 5 out of 5 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
packages/mystmd/tests/exports.yml Adds retry: 2 for the known flaky Serial/Concurrent Jupyter execution cases.
packages/mystmd/tests/endToEnd.spec.ts Switches away from test.each to allow per-case vitest options (notably retries).
packages/myst-cli/src/transforms/fixtures/doi.json Adds recorded doi.org responses used by the mocked DOI test session.
packages/myst-cli/src/transforms/doi.spec.ts Introduces a mocked DOI session backed by fixtures and optional live-doi mode.
.changeset/ci-deflake.md Records the deflaking change as a myst-cli patch changeset.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread packages/myst-cli/src/transforms/doi.spec.ts Outdated
Comment thread packages/myst-cli/src/transforms/doi.spec.ts
mmcky and others added 2 commits June 12, 2026 14:10
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@mmcky
mmcky merged commit e2bac52 into main Jun 12, 2026
6 checks passed
@mmcky
mmcky deleted the feature/ci-deflake branch June 12, 2026 04:26
mmcky added a commit that referenced this pull request Jun 12, 2026
Records squash commit e2bac52 as merged feature 12 (untagged,
post-qe-v8) and adds a standalone upstream candidate — the deflaked
tests are upstream's own and the touched files were byte-identical
to upstream/main before the change.

Co-authored-by: Claude Fable 5 <noreply@anthropic.com>
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.

CI: flaky tests in test workflow (Jupyter timing + live DOI network)

2 participants