Skip to content

API Review Gate blocks every open PR whose merge-base predates cmd/api-gate #3192

Closed

Description

The API Review Gate required check (.github/workflows/api-review-gate.yaml) fails on every open PR whose merge-base with main predates the gate's own landing commit (fa871249c, 2026-07-01), and it fails before evaluating any API content. This currently red-blocks the entire pre-gate open-PR backlog.

Mechanism

The "Materialize base checkout at the merge base" step builds the detector from git merge-base(head, origin/main) rather than the main tip — intentional, to avoid base-drift inventing or hiding API findings. The "Build api-gate" step then does:

if [ -d "${RUNNER_TEMP}/base/cmd/api-gate" ]; then
  build_dir="${RUNNER_TEMP}/base"          # trusted base
else
  build_dir="${GITHUB_WORKSPACE}"          # head fallback (bootstrap)
fi
( cd "${build_dir}" && go build -o "${RUNNER_TEMP}/api-gate" ./cmd/api-gate )

For any PR whose merge-base is older than fa871249c, cmd/api-gate exists in neither the merge-base checkout nor the (equally old) PR head, so the build fails:

##[warning]api-gate not present on the base branch yet; building from head (bootstrap)...
stat .../cmd/api-gate: directory not found
##[error]Process completed with exit code 1

The check reports FAILURE before any API detection runs.

Evidence

Impact

Every open PR created before 2026-07-01 is blocked on this required check regardless of what it changes. The only per-PR workaround is a rebase onto current main, which moves the merge-base past fa871249c — a lot of manual toil across the whole backlog.

Suggested fix

When cmd/api-gate is absent from the merge-base checkout, fall back to building the detector from the main tip (or a pinned trusted ref) instead of the PR head. The head fallback only helps during the bootstrap window before the tool exists anywhere, which has already passed, so it can no longer succeed. Building from main tip when the merge-base lacks the tool would unblock the backlog without requiring every open PR to rebase, while keeping the "analyze head as data, not code" property. This is distinct from #3184, which addresses detection false-negatives rather than this build failure.

Activity

  1. added a commit that references this issue on Jul 3, 2026
    58d61d5
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    kind/bugCategorizes issue or PR as related to a bug

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions