Skip to content

✨ feat(review): carry an approve across the hive's own base-sync merge - #15046

Merged
hivecommons-hive[bot] merged 1 commit into
hivecommons:v6from
Danathar:feat/review-verdict-survives-base-sync
Oct 28, 2026
Merged

hivecommons-hive[bot] merged 1 commit into
hivecommons:v6from
Danathar:feat/review-verdict-survives-base-sync

Conversation

@Danathar

Copy link
Copy Markdown
Contributor

Summary

When the hive merges the base into a PR itself (update-branch from currentBaseGate / updateBranchAndSkip, reasons base-moved or behind), the new head has no review verdict. reviewGateOutcome keys the verdict to the exact head, so the PR drops back to review-gate:no-review-bundle and waits for another review of a diff it already passed.

projectbluefin/fsdk-containers#482 on 2026-10-28:

  • 5/5 approve at 15:42:20Z on 841476c;
  • the hive merged main at 16:01:49Z (90b3f5f, two parents, parent[0] = 841476c, authored by hivecommons-hive[bot], committed by web-flow);
  • 060 → 050 review-gate:no-review-bundle at 16:08:33Z, still waiting about 2h later.

projectbluefin/finpilot#599 had three resets the same way; a separate PR, #15038, stops that one at its source. In every case the files the base changed were disjoint from the PR's own files.

The delta re-review (#14621 / #14622) re-stamps a verdict without a model call only for a delta under 20 lines that touches no flagged file. A larger base merge gets a model "delta review" of base code that was already merged upstream.

Change

  • ReviewDeltaDiff (pkg/github/review_delta.go) now takes baseRef. A delta counts as a hive base-sync only when every commit in it meets all of these:

    • it is a hygiene merge (holdguard.IsHygieneMerge: two parents, chained from the reviewed head);
    • it is authored by the App and committed by web-flow, meaning GitHub's own update-branch merge;
    • the last merge's second parent is the merge base of base...head, which proves it is on the base;
    • any earlier merge's second parent is among the commits of prevHead...parent[1].

    For such a delta it fills BaseSync, PRFiles and BaseFiles.

  • DeltaDiff.BaseSyncOnly() (pkg/review/delta.go) requires the delta's files to equal the base's changed files and to share none with the PR's files. Every file at the new head is then either the reviewed version or the base's version. That also rules out a conflict resolution or an invented tree. App authorship alone is not trusted for this: agents commit under the App-linked identity (crux/agent/manager_env.go:534, 🐛 agent: hive commits carry whichever agent identity was last written to shared git config (mostly "sec-check"), not the lane that did the work #9478).

  • planDelta re-stamps the prior verdict at any size when it is an approve and the delta is BaseSyncOnly. A changes_requested or requires_human is never carried, so an open ask is not settled by a base merge. The re-stamp records delta.base_sync with a note, and the planner's log line gets a base_sync field.

  • Fallback. If the files intersect, or anything above does not hold, today's delta review runs unchanged.

  • Docs: review-swarm.md (the delta section) and hive-merge.md.

  • Changelog: changelog.d/added-review-verdict-survives-base-sync.md.

Owner call needed. This carries an approve past the 20-line limit #14621 set for a re-stamp without a model call. The bodies of #14621 and #14622 define only the trivial re-stamp; neither says every head needs a full re-review. #13643 spares the label-queued lane only because of human per-SHA approvals. The carry is limited to the shape above, where the new head contains nothing beyond the reviewed version and the base's own files. It reuses the existing opt-out: a negative delta_trivial_lines turns it off. A separate config key would also work.

Testing

From src/, TZ=UTC, -count=1:

  • go test ./pkg/review/... ./pkg/github/ ./cmd/hive/ passes.
  • gofmt and go vet are clean.
  • The changelog, docs-links and docs-citations checks pass.

New tests:

  • pkg/review/delta_base_sync_test.go: the planner carries an approve at any size, does not carry when files intersect, and does not carry a non-approve verdict.

  • pkg/github/review_delta_test.go (httptest), 11 negative cases:

    • a non-App author, or a committer other than web-flow;
    • a single-parent commit, or a broken parent chain;
    • a second parent not on the base;
    • a non-merge commit in the delta;
    • and the others the code rejects.

    It also covers a two-merge chain and abbreviated SHAs.

  • A wiring test in cmd/hive.

Mutation checks: 17 mutants, each restored from a backup copy, and every one fails a test. One survived the first round, so a test was strengthened.

API cost per new head:

  • A delta that is not all App / web-flow merges: unchanged, one compare.
  • A base-sync candidate: two more compares, both per_page=1 (the file list is complete on page 1), going up to 300 only with several merges. An intersecting candidate pays them again on each planning cycle, about 3 calls instead of 1.

Not verified, or still open

  • A PR, or a base side, with 300 or more files never gets the carry; it fails closed to a normal delta review.
  • A fork PR whose base...head compare fails falls back to a normal delta review.
  • The re-stamp lands on the next planner cycle, so the stage label can still flicker 060 → 050 briefly.
  • Not run on a live hive.

Contributor checklist

  • Changelog: changelog.d/added-review-verdict-survives-base-sync.md.
  • Targets v6.
  • The title uses the emoji convention.
  • Commits include DCO sign-off.
  • Docs updated (src/docs/review-swarm.md, src/docs/hive-merge.md).
  • No secrets, credentials or local runtime state are committed.

🤖 Generated with Claude Code

https://claude.ai/code/session_01BQYnPGFJx81c8JXR3o1sg1

The review gate keys a verdict to the exact head SHA, so when the hive
itself merged the base into an approved PR (update-branch for
auto_merge.require_current_base / a behind sweep / the hold guard, or
merge-forward) the merge head had no verdict and the PR dropped back to
review-gate:no-review-bundle until a reviewer "delta reviewed" base code
that was already reviewed and merged upstream
(projectbluefin/fsdk-containers#482, projectbluefin/finpilot#599).

ReviewDeltaDiff now recognises such a delta from the compare's commits:
every commit is a two-parent merge chained from the reviewed head
(holdguard.IsHygieneMerge), authored by the App and committed by GitHub
(web-flow). For those heads only it makes two more compares: base...head
(the PR's own files, and proof the merged parent is the base's merge base
with the head) and prevHead...mergedParent (the base's side). The planner
re-stamps a prior approve at any delta size when the delta's files are
exactly the base's and none is a PR file, so every file at the new head is
the reviewed head's or the base's. Anything else, a prior
changes_requested/requires_human, or a negative delta_trivial_lines keeps
today's delta review. CI still re-runs on the merge head.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01BQYnPGFJx81c8JXR3o1sg1
Signed-off-by: Danathar <Danathar@users.noreply.github.com>
@kubestellar-prow kubestellar-prow Bot added dco-signoff: yes Indicates the PR's author has signed the DCO. size/XL Denotes a PR that changes 500-999 lines, ignoring generated files. labels Oct 28, 2026
@kubestellar-prow

Copy link
Copy Markdown
Contributor

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by:
Once this PR has been reviewed and has the lgtm label, please assign danathar for approval. For more information see the Code Review Process.

The full list of commands accepted by this bot can be found here.

Details Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@hivecommons-hive hivecommons-hive Bot added author/clanker A contributor's own hive authored this PR under their login dco All commits are DCO signed-off role/trusted Author is trusted for unattended merge (trusted-author role or registry/claim tier in require_tiers) stage/050-review-pending Review swarm requested; awaiting a verdict for the current head labels Oct 28, 2026
@hivecommons-hive
hivecommons-hive Bot merged commit 86fc627 into hivecommons:v6 Oct 28, 2026
67 of 71 checks passed
@hivecommons-hive

Copy link
Copy Markdown
Contributor
Evidence bundle `#150463c07ef4` sha256:0120cf7fe5f45af3366d7127920d56a875a56e73d739c853e48e9b7e94b90b8e — download from the dashboard or `hivectl review evidence #15046`.

@hivecommons-hive

Copy link
Copy Markdown
Contributor

merged by Hive trusted-author auto-merge: author @Danathar holds role owner and GitHub permission maintain on repo; CI green at 3c07ef4.

@hivecommons-hive hivecommons-hive Bot removed role/trusted Author is trusted for unattended merge (trusted-author role or registry/claim tier in require_tiers) stage/050-review-pending Review swarm requested; awaiting a verdict for the current head labels Oct 28, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

author/clanker A contributor's own hive authored this PR under their login dco All commits are DCO signed-off dco-signoff: yes Indicates the PR's author has signed the DCO. size/XL Denotes a PR that changes 500-999 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant