Skip to content

app/: nothing becomes a baseline unreviewed: no cross-branch fallback; only the default branch's first build is auto-approved - #121

Merged
ndbroadbent merged 1 commit into
mainfrom
app-baselines-no-cross-branch
Dec 3, 2026
Merged

ndbroadbent merged 1 commit into
mainfrom
app-baselines-no-cross-branch

Conversation

@ndbroadbent

@ndbroadbent ndbroadbent commented Dec 3, 2026 •

Copy link
Copy Markdown
Member

What was wrong

In production, an unreviewed pull request branch's snapshots became the baseline for unrelated branches. Two rules did it together:

  1. First build auto-approved on any branch. processing::conclude auto-approved any CI build with no base (("ci", _, false) => "auto_approved") and recorded its snapshots as baselines (approval = 'auto'), whatever its branch. A PR branch's build was the project's first to conclude, so its 333 snapshots became baselines.
  2. Any-branch fallback. baselines::resolve ended with a pass that gave a snapshot with no baseline on the build's history the suite's latest CI approval of it from any branch. Builds on other branches picked up that PR branch's approvals and came back "unchanged".

That fallback was there for squash merges, but baselines::record_merge has covered them since sc-8806: a merged PR's approvals are copied to the base branch at the merge commit, and resolve counts them through that commit's place in the build's history.

What changed

The rule is now nothing becomes a baseline unreviewed.

  • conclude takes the project's default branch. A CI build with no base is auto-approved only on project.default_branch. On any other branch it concludes review_state = "pending", like any change. A build with no changes is still auto-approved on any branch, since it records nothing.
  • The any-branch fallback block in baselines::resolve is deleted. A PR's approvals reach the base branch only through record_merge.
  • Also changed (not in the original brief): the exact-match passes in compare.rs (a changed text or page image that exactly matches an approved one passes as a variant). They took current CI approvals from any branch, and the text pass's comment said that was for squash-merged PR branches. That's the same cross-branch leak by another route: test 3 caught a main build before the merge passing on the PR branch's approval. Production's existing auto rows from the PR branch would also have kept feeding it. Both passes now count only the build's own branch's rows and the default branch's CI rows, which include merged rows. Matching across environments works as before on those branches.
  • Unchanged: local mode. A local build's changes always waited for review, even in a project's first build, and still do. Check and status: nothing in checks.rs, builds::passed, pr_comment.rs or changeset.rs needed changing, because they all key on review_state. A pending first PR build gets the same check as any pending build: in_progress "N changes waiting for review" (failure in strict mode), with the CI step passing in review mode and waiting in wait mode. recount only auto-approves a pending build whose changes all went away (ignored or accepted as variants), which is the "unchanged" case, so it stays.

Docs

  • docs/design.md: a new "Nothing becomes a baseline unreviewed" bullet, the merge bullet says it's the only way a PR's approvals reach the base branch, and the exact-match wording no longer says "approved anywhere in the suite".
  • quick-start.md (Review the changes) and the "first build becomes the baseline" line on the snapshot pages (jest, vitest, syrupy, insta, rspec-snapshot, laravel-rust) now say it's the default branch's first build, and that a PR's first build waits for review. skills/ is regenerated and the plugin version goes to 0.1.47.

Tests

New app/tests/baselines.rs:

  1. a_pull_request_branchs_first_build_waits_for_review_and_records_no_baselines
  2. the_default_branchs_first_build_is_approved_and_becomes_the_baseline (and the next build on main is unchanged)
  3. a_build_never_takes_an_unrelated_branchs_approvals: after a feature build is approved, a build on an unrelated branch, and a main build before any merge, see the snapshots as added.
  4. a_squash_merged_pull_requests_approvals_reach_the_default_branch_at_the_merge: main's baseline, a PR change approved, a main build before the merge still shows it changed, then after record_merge at squash commit s1 a main build with s1 in its ancestry is unchanged.

cargo fmt --check, cargo clippy --locked --all-targets -D warnings and cargo test --locked all pass in app/ (agents-build-2).

Goldens and existing tests changed: none. Every existing test whose first build is auto-approved runs on main, and none relied on the fallback or the cross-branch exact match.

Production follow-up (not in this PR)

The auto baseline rows that PR #102's branch recorded are still in production. This change stops every path that read them for other branches (resolve and the exact-match passes), and record_merge would copy them to main only if that PR merges. Deleting them is a data change for a separate decision.


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

…; only the default branch's first build is auto-approved

A pull request branch's first CI build with no base now waits for review (it was auto-approved on any branch and its
snapshots recorded as baselines). baselines::resolve no longer takes any branch's latest CI approval for a snapshot with
no baseline on its history, and the exact-match passes in compare.rs count only the build's own branch's approvals and
the default branch's CI ones. A pull request's approvals reach its base branch only through record_merge, at the merge
commit.
@ndbroadbent
ndbroadbent force-pushed the app-baselines-no-cross-branch branch from 52f01f5 to 71cf4ef Compare December 3, 2026 06:45
@visualci-com

visualci-com Bot commented Dec 3, 2026 •

Copy link
Copy Markdown

VisualCI

docspring/visualci · build #24 · 1 changed, 332 unchanged · approved by visualci features agent for Nathan Broadbent

This PR vs base: nothing since #12, across 2 builds

Snapshot Before After
site/docs/quick-start (changed) text text, see the build

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

@ndbroadbent
ndbroadbent merged commit ba6ede4 into main Dec 3, 2026
12 checks passed
@ndbroadbent
ndbroadbent deleted the app-baselines-no-cross-branch branch December 3, 2026 06:58
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