Skip to content
Draft
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
71 changes: 71 additions & 0 deletions frontend/content/blog/skipped-jobs-unreviewed-changes.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
---
title: Skipping unchanged CI jobs let unreviewed visual changes pass our gate
description: We gate deploys on a visual review, and our CI skips test jobs whose inputs haven't changed. In one day we found three ways those two features undid each other, two of them turning a check green over a change nobody had approved. What went wrong, and the rule that fixed it.
date: 2026-12-08T12:00:00+13:00
author: Nathan Broadbent
draft: true
---

DocSpring, the company that makes VisualCI, runs VisualCI on its own Rails monorepo. Its CI on CircleCI takes long enough that it skips work: when a test suite's inputs hash to the same value as a run that already passed, the suite's jobs don't run. The job that finalizes the suite's VisualCI build still runs, and it finalizes an empty build on purpose (`visualci build finalize --allow-empty`), so the commit still gets a check.

Until 5 December, VisualCI only reported on that repository. Then a pull request merged and deployed with three screenshot changes nobody had reviewed, and we made the review a gate: a branch doesn't deploy to staging, and so not to production, while any of its commit's VisualCI checks is failing or waiting for review.

Before the day was out we had found three holes in it, all where skipped jobs met the review.

## A skipped build carried the baseline, and the baseline is only what was approved

When a build is sent nothing, VisualCI carries the snapshots forward from the baseline. That's correct for a pull request whose last build was approved. The baseline is the approved state, so carrying it forward says "nothing changed since the approved version", which is true.

It's wrong for a branch whose last build was still waiting for review. Picture the sequence:

1. A commit changes a page. Its build shows one screenshot changed, waiting for review, and its check is pending. The gate holds the branch.
2. The next commit only touches the README. The suite's inputs are unchanged, so CI skips it, and the build is finalized empty.
3. The empty build carries the baseline forward. The baseline doesn't have the change, because nobody approved it. Compared with itself, every snapshot is unchanged, so the build approves itself and its check goes green.

The gate reads the newest commit's checks, so the branch passed. The changed screenshot was still in the code, still unreviewed, and the build for the newest commit said there was nothing to look at. A rejected change went the same way: the next skipped build carried the baseline and passed.

DocSpring's own CI agent found this one, reviewing the new gate before it went live.

## The merge commit forgot the pull request

The second hole came with merging. That first pull request, the one that shipped three unreviewed changes, is a clean example:

- Its newest build was waiting for review when the pull request merged. Deleting the branch closed that build, unreviewed.
- Main's CI at the merge commit skipped the suite, because its inputs matched the run on the pull request's branch. The build at the merge commit was empty, so it carried main's baseline forward: unchanged, auto-approved.
- Every branch built after that showed the three screenshots as changed, because those branches render the merged code and main's baseline never took it. Each pull request looked as if it had changed pages it never touched.

So the merged change was never reviewed anywhere, and the noise landed on everyone else's pull requests.

## A rerun started from nothing

The third hole failed red rather than green, but it came from the same place.

A workflow uploaded a suite's PDF snapshots to build 144. Another job failed, so the finalizing job never ran, and build 144 stayed open. Someone clicked "Rerun from failed". CircleCI starts a new workflow with a new workflow ID and carries the passed jobs over without running them. The rerun's finalizing job finalized a new build, 153, for the new workflow. Nothing had been sent to it, so it failed with "No snapshots were sent". The snapshots were sitting in build 144, which nobody would finalize.

Anything keyed on the workflow starts from nothing on a rerun. That includes the nonce VisualCI uses to group a workflow's uploads into one build.

## The rule: a skipped build stands in for a build, not for the baseline

All three holes have the same cause. A build that's empty on purpose doesn't mean "nothing changed since the baseline". It means "this suite's inputs haven't changed since some earlier build". The earlier build is the one to follow, with whatever review state it's in. Carrying the approved baseline forward instead is an approval nobody made.

So that's what VisualCI does now, in three changes:

- **A skipped build follows the branch's previous build of its suite** ([#280](https://github.com/DocSpring/visualci/pull/280)) and shows that build's result. If that build is waiting for review, the skipped one waits, and turns green when the earlier one is approved. Rejected stays rejected, and failed fails. A build that ran some jobs and skipped others does the same for each snapshot it wasn't sent: if the branch's previous build changed, added or removed that snapshot without an approval, it's carried from there and reviewed in this build, not taken from the baseline. Main counts as a branch too, since staging deploys from main.
- **A build at a merge commit carries the pull request's unreviewed changes** ([#279](https://github.com/DocSpring/visualci/pull/279)). VisualCI records each merge from GitHub's webhook. When main's build at that commit skipped a suite, it takes the pull request's own version of each snapshot it wasn't sent and compares it with main's baseline, so an unreviewed change shows as changed on main and waits for review there.
- **An empty rerun finalizes the run it replaces** ([#273](https://github.com/DocSpring/visualci/pull/273)). If an earlier build of the same suite, commit and branch was sent snapshots but never finalized, and nothing has arrived for it for 5 minutes, the empty build finalizes it and follows it. The 5 minutes mean a workflow that's still uploading is never cut short.

Each change came with a test that reproduces the real builds. For the merge-commit case, a test runs a pull request with one changed and one added snapshot, unreviewed, then closes the branch, and checks that main's skipped build at the merge commit shows both and waits for review. Without the fix, that test fails.

The first version of the per-snapshot rule had a bug of its own. It counted a snapshot as unreviewed unless it had been approved by hand. An auto-approved build (the default branch's first build, say) has no hand approvals, so a partly skipped build behind one would have carried every snapshot as unreviewed, warned about all of them, and, where the baseline had moved since, held them for review. We found it while combining the merge-commit change with it, and [#293](https://github.com/DocSpring/visualci/pull/293) fixed it 40 minutes after it went live, before it touched any build: an auto-approved build carries nothing unreviewed.

## If you build a gate on top of skipped jobs

These holes aren't specific to VisualCI. They turn up wherever a CI system skips work and a gate reads the result:

- **"Skipped" has to mean "same as the last run", never "passed".** Whatever the last run's state was (pending, rejected, failed) is the state the skipped run is in.
- **Follow the branch, not the commit.** The run a skipped job stands in for is on an earlier commit, and after a merge it's on another branch altogether.
- **Merges move work between branches.** A merge commit whose jobs were skipped inherits nothing from the pull request unless something carries it across.
- **Reruns get new IDs.** If you key state on a workflow or pipeline ID, a rerun starts with none of it.
- **Test the gate with the change still unreviewed.** All three holes passed every test that started from an approved state. They showed up only when a change was pending, rejected or half-uploaded when the next build came along.

How to set up skipped jobs with VisualCI is in the [CircleCI](/docs/ci/circleci/), [GitHub Actions](/docs/ci/github-actions/) and [other CI](/docs/ci/other/) guides.
Loading