Skip to content

Carried approvals: a rebased branch isn't asked to review identical content twice; approved_elsewhere finds the branch's own (DocSpring PR #1487) - #289

Merged
ndbroadbent merged 4 commits into
mainfrom
added-approved-elsewhere
Dec 5, 2026
Merged

ndbroadbent merged 4 commits into
mainfrom
added-approved-elsewhere

Conversation

@ndbroadbent

@ndbroadbent ndbroadbent commented Dec 5, 2026 •

Copy link
Copy Markdown
Member

DocSpring PR #1487: after a rebase, pdf build 202 showed 13 added snapshots waiting for review. Their files were byte-identical to 13 added snapshots already approved on the same branch's build 177, and approved_elsewhere was null on all 13.

Part 1: why added snapshots found nothing

  • approved_elsewhere joined only baselines with bl.branch <> b.branch, so it never looked at the build's own branch. Build 177 is on the same branch as 202.
  • The rebase moved 202's anchor to main's build 185. baselines::resolve counts the branch's approval rows only when they're newer than the anchor (by id, or by a commit in the build's history). Build 177's rows are older and its commit was rewritten, so they stopped being baselines.
  • Changed snapshots looked fine only because of compare's exact-image pass: a changed page whose image is the branch's newest approved one passes. An added snapshot has no base, so it never reaches that check.

The fix: approved_elsewhere now matches any other build of the suite, the same branch included (bl.build_id <> b.id). It also skips an approval that a later build of its branch rejected for the same content.

Part 2: carried approvals (domain::carried_approvals::apply)

One helper, called in the conclusion's transaction just before conclude, plus one arm in conclude. It runs on CI builds only, and matches the same project, suite, branch and environment, against earlier builds only:

  • Added: carries when the head fingerprint (a PDF's fingerprint, an image's pixel fingerprint) equals an approved added or changed snapshot's.
  • Changed: carries only when the earlier snapshot was a change too and both the head and base fingerprints are equal.
  • The record: record(..., approval = "carried") writes a baseline row with the original approved_by and review_id, following how merged rows copy those. The snapshot's review becomes approved.
  • The build: when every change in it carried (a pending visualci.yml item still blocks), conclude sets review_state = approved, and the check succeeds.
  • What doesn't carry:
    • withdrawn approvals: rejecting later in the same build deletes the rows, and the query requires s2.review = 'approved' plus a review or carried row;
    • approvals that a later build of the branch rejected for the same content;
    • rejections. Decision: an earlier rejection isn't carried. The snapshot waits for review as usual, with no hint. Carrying a rejection would fail a build that might be a deliberate re-try, and a rejection means "fix this", not "this exact content stays bad".
  • Other branches: unchanged. approved_elsewhere stays a hint.

Unchanged existing behaviour, noted in design.md: compare's exact-image pass still passes a changed page whose image is the branch's newest approved one, whatever its base. So the "same head, different base" rule only applies where the branch has since approved another version.

No migration: baselines.approval is free text.

Tests (app/tests/baselines.rs)

Each was checked to fail with its part of the fix reverted:

  • a_rebased_branch_carries_its_approval_of_an_identical_added_snapshot: carried, attributed to the reviewer and review, build approved.
  • approved_elsewhere_finds_an_added_snapshots_approval_earlier_on_its_branch (Part 1).
  • a_rebased_branch_carries_its_approval_of_an_identical_change.
  • a_change_over_a_different_base_waits_with_the_earlier_approval_as_a_hint.
  • another_branchs_approval_of_the_same_content_is_only_a_hint.
  • an_approval_a_later_rejection_superseded_doesnt_carry: also checks that the rejection isn't carried and that no hint is shown.
  • a_withdrawn_approval_doesnt_carry.

Full suite: 426 passed in --test app, plus the other binaries and unit tests. cargo clippy --all-targets -- -D warnings is clean.

Docs: agents.md (the review loop) and the regenerated visualci-review skill, plugin 0.1.74, design.md, the MCP get_build description and its golden files, and the changelog.

Interplay with #279 and #280: the change is self-contained, one call in processing's conclusion transaction and one match arm in conclude.

Review of #289 (d6f1fbf)

Only an approval that still stands carries:

  • Still the branch's newest approved version. A later baseline row on the branch for that name, platform and environment with other content (or a removal) stops it. A→B, B→A, A→B waits for review, on main and on a PR branch. The changed-carry test now uses a re-encoded file with the same pixels. With the same file, compare's exact-image pass already passes it.
  • Open comment threads. An open thread on the branch (comments::open_on) keeps a snapshot pending.
  • Withdrawals through a carried copy. A carried row counts only while its original review's review row exists.
  • Later rejections. Any rejection of the content on the branch after the approval stops it, including one from a build newer than the carrying build.
  • Failures. A build with a failed snapshot carries nothing.
  • The check summary adds "N changes approved earlier on this branch by X (build #N)."

New tests: both regressions, the open thread, a withdrawal through a carried copy, a late-concluding build, a failure, a pending visualci.yml item, a partial carry, and another environment. Each fails with its fix reverted. --test app passes all 435, and clippy -D warnings and fmt are clean.

Second review (7dc08a5)

  • Rejections count by time. A rejection now stops a carry when the rejecting review was made after the approval row (reviews.created_at > baselines.created_at), whichever build it's in. Rejecting an older pending build after a newer one was approved now blocks the carry. approved_elsewhere uses the same rule. New test: a_rejection_on_an_older_build_made_after_the_approval_stops_it.
  • Faster original-review lookup. It now also filters on project, suite, name, platform, environment and branch, so it can use baselines_by_name instead of scanning a large review's rows.
  • Results: --test app passes all 436, and clippy -D warnings and fmt are clean.

@visualci-com

visualci-com Bot commented Dec 5, 2026 •

Copy link
Copy Markdown

VisualCI

docspring/visualci · build #1424 · 6 changed, 572 unchanged · approved by visualci coordinator agent (MCP) for Nathan Broadbent

#289: get_build's MCP description says approved_elsewhere now covers earlier approvals on the same branch and that CI builds carry them; the changelog pages gain #289's entry.

This PR vs base: 25 changed, 5 added since #1225, across 5 builds

Snapshot What changed Close-up: before → after
screenshots/changelog/1440-dark (changed)
before · after

Content below here moved
screenshots/changelog/1440-light (changed)
before · after

Content below here moved
screenshots/changelog/390-dark (changed)
before · after

Content below here moved
screenshots/changelog/390-light (changed)
before · after

Content below here moved
and 2 more in the build

docspring/visualci · journeys · build #1420 · 3 removed, 53 unchanged · approved by visualci coordinator agent (MCP) for Nathan Broadbent

Not #289's change: the three removed snapshots are main's old numbered journey names (organization-settings/02-admin, 03-admin-invited, 04-admin-dark), renamed on main to stable names, which this build has unchanged. The base is an older main journeys build while main's newest journeys run is still going.

This PR vs base: 53 added, 50 removed since #1220, across 6 builds

Removed: journeys/organization-settings/02-admin, journeys/organization-settings/03-admin-invited, journeys/organization-settings/04-admin-dark

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

ndbroadbent added a commit that referenced this pull request Dec 5, 2026
… carries

- Still the branch's newest approved version: a later baseline row on the branch with
  other content stops it, so A to B, B to A, A to B again waits for review (main too).
- An open comment thread on the branch keeps a snapshot from carrying, as it blocks review.
- A carried row stands only while its original review's row does (withdrawn through
  the copy).
- Any later rejection on the branch stops it, even from a build newer than the carrying one.
- A build with a failed snapshot carries nothing.
- The check says "N changes approved earlier on this branch by X (build #N)."
- Tests: both regressions, open thread, withdrawal through a carried copy, a late build,
  a failure, a pending visualci.yml item, a partial carry, another environment; the
  changed carry now uses a re-encoded file with the same pixels.
ndbroadbent added a commit that referenced this pull request Dec 5, 2026
…it was made; the original-review lookup uses baselines_by_name

- The rejection-after-approval check compares the rejecting review's created_at with the
  approval row's, not build ids: rejecting an older pending build after a newer one was
  approved stops the carry (and the approved_elsewhere hint).
- The original-review lookup filters by project, suite, name, platform, environment and
  branch as well as review_id.
- Test: a_rejection_on_an_older_build_made_after_the_approval_stops_it.
@ndbroadbent
ndbroadbent force-pushed the added-approved-elsewhere branch 2 times, most recently from 0b4eb45 to 330e477 Compare December 5, 2026 12:07
…proval of identical content; approved_elsewhere finds the branch's own (DocSpring PR #1487)

Added snapshots never found an earlier approval on their own branch: approved_elsewhere
excluded the build's own branch (bl.branch <> b.branch), and after a rebase the anchor is
main's newer build, so the branch's older approval rows no longer count as baselines.
Changed pages passed only through compare's exact-image check, which needs a base.

- approved_elsewhere: any other build of the suite, this branch included; an approval a
  later build of its branch rejected for the same content is no longer shown.
- domain::carried_approvals: in the conclusion's transaction, a CI build carries an earlier
  approval on the same branch, suite and environment for added snapshots with the same
  fingerprint, and changed ones with the same head and base fingerprints. Rows have
  approval 'carried' with the original approver and review id. Rejections, withdrawn
  approvals and approvals superseded by a later rejection don't carry.
- conclude: a build whose every change carried concludes approved.
- Docs (agents.md, design.md), changelog, skill regenerated, plugin 0.1.73.
…provals both decide the review; the changelog line is an entry file; no plugin version
…ied approvals; the test helpers keep main's jest and missing-file builds beside start/finish
@ndbroadbent
ndbroadbent force-pushed the added-approved-elsewhere branch from 330e477 to c6f1058 Compare December 5, 2026 15:08
@ndbroadbent
ndbroadbent merged commit bf4edce into main Dec 5, 2026
17 checks passed
@ndbroadbent
ndbroadbent deleted the added-approved-elsewhere branch December 5, 2026 15:18
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