Skip to content

app/: empty CI builds from reruns of failed jobs show the earlier build's result (sc-9044) - #161

Merged
ndbroadbent merged 1 commit into
mainfrom
app-empty-rerun-builds
Dec 4, 2026
Merged

ndbroadbent merged 1 commit into
mainfrom
app-empty-rerun-builds

Conversation

@ndbroadbent

@ndbroadbent ndbroadbent commented Dec 4, 2026 •

Copy link
Copy Markdown
Member

Fixes sc-9044.

The bug

A CI that keys each suite's build on the workflow (--nonce "$CIRCLE_WORKFLOW_ID-pdf", or $GITHUB_RUN_ID-$GITHUB_RUN_ATTEMPT) gets a new build for every suite when a workflow is rerun from failed. Only the failed jobs run in the new workflow, so a suite whose jobs passed the first time gets a build that is sent nothing. It failed with "No snapshots were sent", and its check ("VisualCI: pdf") turned red on a PR whose CI passed (DocSpring PR #1466, build #12).

The fix

A CI build that was sent no snapshots, on a commit an earlier build of its suite already compared, follows that build (new column builds.covered_by_build_id, module app/src/domain/reruns.rs):

  • Processing's first step (reruns::follow, called at the top of processing::process) finds the earlier build. That's the newest earlier CI build with the same project, name, environment, commit and branch, finalized (processing or completed), not itself an empty failure (error = EMPTY_BUILD), and not following another build. So reruns always point at the original build, never at each other.
  • The empty build concludes with the earlier build's conclusion, review state and superseded_by_build_id. A failed earlier build makes it fail, with "Build #N failed: …". It gets the warning "No snapshots were sent in this run; build #N already covers this commit (a rerun of failed jobs?), so this build shows its result." It writes no snapshot rows, so nothing counts as removed.
  • A new BuildChanged listener (update_the_builds_that_follow_it) copies the earlier build's result onto its followers whenever it changes: when it's reviewed, superseded, closed or reopened. Each changed follower gets its own BuildChanged, so its check, live streams and CLI --wait update too. Followers never have followers of their own, so this can't loop.
  • Check (forge/checks.rs): check_for on a follower builds the earlier build's check (state, title, summary, link) under the follower's name and commit. The title ends "(build #N)", and the summary starts by explaining the rerun. GitHub treats the newest check run of a name on a commit as the check, so the suite's check shows the original result, not "No snapshots were sent". check_state itself is unchanged.
  • A follower can't be reviewed itself (reviews::review refuses and says to review build #N). The PR comment's "newest build per suite" skips followers. reopen_branch reopens the earlier build rather than a follower, and the listener then reopens the follower.

Decisions

  • Commit plus branch, not the commit alone. The same commit on another branch compares with other baselines and has other review rules: the default branch's first build is approved on its own, and a PR branch's approvals only reach main on merge. Its result isn't this build's. A rerun always keeps the branch, so nothing is lost. Environment and suite name must match too, and both builds must be CI builds.
  • Earlier build still processing: the empty build waits in processing (with covered_by_build_id set and the warning) and concludes when the earlier one does, through the listener. Its check mirrors the earlier one's "Processing" meanwhile. If the earlier build never finishes, the sweep's existing 6-hour give-up fails both. A build that is still receiving (never finalized) doesn't count. It would most likely be abandoned, and the empty build then fails as it does today.
  • Local-mode builds: unchanged. A local run's empty build is its own business: it's finished as a subset by the expiry, and its changes are per environment.
  • --allow-empty: doesn't matter for a build that something covers. An earlier build's real result for the same commit is a better answer than an empty comparison or a carry-forward from an ancestor, and a customer who always passes --allow-empty gets the same behaviour on reruns. With no earlier build, --allow-empty behaves as before, and so does an empty build without it: it still fails with "No snapshots were sent".
  • An empty build never covers a later one, so two empty reruns can't pass each other off as compared.

Docs

The CircleCI page gets a new "Rerunning failed jobs" section, and the GitHub Actions page a "Re-running failed jobs" section. The Other CI providers page (Parallel jobs) and the CLI reference's build finalize text explain the exception to "No snapshots were sent". skills/ is regenerated, and the plugin is bumped to 0.1.54.

Tests

New app/tests/reruns.rs, through the CI API against Postgres and the blob store:

Gates (on the build pool, own Postgres 17 container): cargo fmt --all --check, cargo clippy --locked --workspace --all-targets -- -D warnings and cargo test --locked --no-fail-fast -p visualci-app all pass, the 4 new tests included. In frontend/: node scripts/skills.mjs --check, pnpm build and pnpm test (52 tests) pass.

Not merged: Nathan merges under the main-merge lock, after the VisualCI build review.


Open in [code]smith · Need help on this PR? Tag @codesmith-bot with what you need.

@visualci-com

visualci-com Bot commented Dec 4, 2026 •

Copy link
Copy Markdown

VisualCI

docspring/visualci · build #419 · 392 unchanged · no changes

This PR vs base: 16 changed, 31 added since #274, across 4 builds

docspring/visualci · journeys · build #415 · 30 unchanged · no changes

This PR vs base: 16 changed, 2 added since #273, across 4 builds

Updated as builds change. Agents can review with VisualCI's MCP tools.

…s that build, so reruns of failed jobs pass (sc-9044)
@ndbroadbent
ndbroadbent force-pushed the app-empty-rerun-builds branch from f0d7b6b to abbc73c Compare December 4, 2026 05:50
@ndbroadbent
ndbroadbent merged commit 2f4944a into main Dec 4, 2026
16 checks passed
@ndbroadbent
ndbroadbent deleted the app-empty-rerun-builds branch December 4, 2026 05:57
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