Repository navigation
A pull request build compares with its base branch's approved build, never an unapproved one (sc-9247) - #178
Merged
Merged
Conversation
ndbroadbent
force-pushed
the
app-baseline-base
branch
from
December 4, 2026 06:22
ad9d9a7 to
14228b4
Compare
VisualCIdocspring/visualci · build #564 · 414 unchanged · no changes This PR vs base: 24 changed, 22 added since #432, across 4 builds docspring/visualci · journeys · build #559 · 42 unchanged · no changes This PR vs base: 6 changed, 12 added since #430, across 4 builds Updated as builds change. Agents can review with VisualCI's MCP tools. |
ndbroadbent
force-pushed
the
app-baseline-base
branch
2 times, most recently
from
December 4, 2026 07:35
29b7978 to
9064e2c
Compare
…uild, and a base is only ever an approved build (sc-9247) Two baseline bugs from the daisyUI case study: 1. A PR build compared with the default branch, never the PR's base branch. Builds now record `base_branch` (the API's and MCP create_build's `base_branch`; the CLI sends it in a follow-up, once this server is live). The anchor falls back to the base branch's newest approved build before the default branch's, and the base branch counts like the default branch in the anchor walk, local environments' rows, the exact-match passes and the inherited-changes note. 2. The anchor took the nearest ancestor commit's completed build whatever its review, so a rerun of a PR's commit anchored on its own pending build and compared with whatever that build had been compared with. The anchor is now only ever an approved (or auto-approved) build, never a pending, rejected or failed one, and never an empty build that follows another (sc-9044's reruns). Per-snapshot approvals of pending builds still count through the baselines table; `inherited` finds the unreviewed base-branch build on the PR's history itself.
…mmit count, base_branch only on PR builds, the default branch only through history when a base is named, inherited looks on the base branch itself
ndbroadbent
force-pushed
the
app-baseline-base
branch
from
December 4, 2026 08:44
9064e2c to
c6ce072
Compare
This was referenced Dec 4, 2026
ndbroadbent
added a commit
that referenced
this pull request
Dec 4, 2026
…ts, so a migration that adds a column never fails the previous release's SELECT * (cached plan must not change result type: #178's rollout 500)
ndbroadbent
added a commit
that referenced
this pull request
Dec 4, 2026
…ts, so a migration that adds a column never fails the previous release's SELECT * (cached plan must not change result type: #178's rollout 500)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
sc-9247, from the daisyUI case study (visualci-com/daisyui builds #4 and #6).
1. A PR build compared with the default branch, not its base branch
Cause.
baselines::anchor()looked for the nearest ancestor commit's build, then fell back to the defaultbranch's newest approved build. Nothing recorded which branch a pull request merges into, and the CLI never sent it.
A PR into a release branch (or a stacked PR, or a fork PR into a non-default branch) with no shared build in its
history sent to VisualCI (a shallow checkout sends none) was measured against the default branch. Build #4 compared
with daisyUI 5.8.3 on the default branch instead of the PR base's approved build #3, so all 4 snapshots showed as changed.
Fix.
builds.base_branch(migration). The API's and MCPcreate_build'sbase_branchset it; it's ignored when it'sthe build's own branch.
base_branchfromCI: GitHub's
pull_request.base.ref/GITHUB_BASE_REF, GitLabCI_MERGE_REQUEST_TARGET_BRANCH_NAME, JenkinsCHANGE_TARGET, BitbucketBITBUCKET_PR_DESTINATION_BRANCH, BuildkiteBUILDKITE_PULL_REQUEST_BASE_BRANCH,Semaphore and Travis's target branch, or
VISUALCI_BASE_BRANCH, and the GitHub action'sworkflow_runpath willset it too. It can't ship in this PR:
CreateParamshasdeny_unknown_fields, and CI's visual and journeys jobsrun the PR's CLI against production. The first run of this PR, with the CLI included, failed both jobs with
422 unknown field base_branch.base branch's newest approved build, then the default branch's.
(
effective), local environments' CI rows inresolve(), compare.rs's exact-match baseline queries, andinherited.2. A rerun compared with the PR's own unapproved build
Cause.
anchor()took the nearest ancestor commit's completed CI build whatever its review_state, andancestry()lists the build's own commit first. A rerun of the same commit therefore anchored on its own earlierpending build.
effective()reads a pending build's unapproved changes as "the version it was compared with", so thererun inherited the first run's base. In #6 that was a branch that was no longer the default (base_build 4, the
same 5.8.3 comparison), when nothing approved existed to compare with. An unapproved base can hide a PR's own changes
from review.
Fix. The anchor is only ever an approved or auto-approved build (the default branch's first build, or one with no
changes). It is never pending, rejected or failed, and never an empty build that follows another (sc-9044's
covered_by_build_id, merged in #161): a follower mirrors its build's review state,approvedincluded, but holds nosnapshots. Nothing is lost:
baselinesand are still laid on top.effective()'s walk back through the base-build chain is unchanged.inherited("N changes are already on main and unreviewed") used to rely on the anchor being main's pending build.It now finds the nearest base-branch build on the PR's history that is still pending and newer than the anchor
(
baselines::nearest).earlier build keeps its followers pending, so it hides nothing. With this change a follower can no longer be an anchor.
processing::conclude'sfirst_on_defaultis unchanged: only the default branch's first CI build with no base isauto-approved.
Review fixes (second commit)
From the independent review of 14228b4. Each behaviour fix has a test that failed before it:
resolve()used to count approvals only whenbuild_id > anchor.id. An approval now also counts when its commit is nearer than the anchor's commit in thebuild's history (the whole history when the anchor isn't on it). Case: a PR build approved in part before main
built the PR's parent commit, so the next PR build anchored on that later main build. The rank treats such rows
as newer. A newer main approval still beats the PR's older ones by id.
(
a_partial_approval_survives_a_later_anchor_on_an_older_commitapproves a removal, which no exact match canrescue.)
baselines::base_branch()and compare.rs'sSQL, when the build has no
pr_numberor is on the default branch. A push build namingfeature-xcan no longerpass on feature-x's unmerged approvals. (
a_push_build_naming_a_base_branch_takes_nothing_from_it)trusted_branches()is the base branch,plus the default branch only when the anchor fell back to it. It is used in effective()'s walk and local CI rows.
compare.rs's exact match accepts the base branch, plus the default branch only at the build's own commit or its
parent_commits. (a_pull_request_into_a_release_branch_ignores_mains_newer_approvals)baselines::nearest_pending_on(build, branch)finds the basebranch's nearest pending build on the history. It must be nearer than the anchor's commit (or newer at the same
commit). The PR's own earlier builds no longer hide it.
(
inherited_changes_are_found_from_the_pull_requests_second_build_on)(
inherited_falls_back_to_the_default_branch_for_an_unbuilt_base)SET LOCAL lock_timeout = '5s'before itsALTER TABLE.Tests (app/tests/baselines.rs)
Each failed on main before the fix:
a_pull_request_into_a_release_branch_compares_with_the_release_branchs_approved_build: base was main's build;now release-1's, and only the PR's own change shows.
a_rerun_never_compares_with_its_own_unapproved_build: the daisyUI case. The rerun's base was its own pending build;now there's no base and both snapshots are added, still waiting for review.
a_pending_build_on_the_branch_is_never_the_base: base was the branch's pending build; now main's approved build.It also checks that a partial approval still counts.
a_build_that_follows_another_is_never_the_base: base was the empty follower; now the build it follows.a_pull_request_on_an_unreviewed_main_build_marks_the_inherited_changesguards theinheritedrework.The full
cargo test -p visualci-appsuite, fmt --check, and clippy-D warningspass. docs/design.md is updated,and api.md documents
base_branch.