Skip to content

ci: match paired branch by fork account, fall back to Postgres-Extensions master only#25

Merged
jnasbyupgrade merged 6 commits into
Postgres-Extensions:masterfrom
jnasbyupgrade:fix-ci-fork-owner
Jul 14, 2026
Merged

ci: match paired branch by fork account, fall back to Postgres-Extensions master only#25
jnasbyupgrade merged 6 commits into
Postgres-Extensions:masterfrom
jnasbyupgrade:fix-ci-fork-owner

Conversation

@jnasbyupgrade

Copy link
Copy Markdown
Contributor

Pairs with pgxntool PR: Postgres-Extensions/pgxntool#40

Problem

The resolve step (and run-tests.yml checkouts) hardcoded
github.repository_owner (Postgres-Extensions) when locating the sibling
pgxntool branch. For a fork PR, the paired branch is on the fork, so resolve
never found it and tested against unpaired code. (This is why fix-38's CI failed
against pgxntool=master.)

Fix

  • resolve now looks for the paired pgxntool branch only on the PR head's
    account
    (head.repo.owner.login) — never cross-account.
  • Security: no paired branch → fall back to Postgres-Extensions/master
    only
    , never the fork's master (which may be stale or modified). master is
    the sole ref ever taken cross-account.
  • run-tests.yml gains pgxntool-owner / pgxntool-test-owner inputs
    (default to the repo owner) so each repo is checked out from the right account.
  • Documented the pairing + never-cross-account rules in workflows/CLAUDE.md.

Pairing model (now enforced by account): a pgxntool change needs a paired
pgxntool-test branch (or the commit-with-no-tests override); a pgxntool-test
change may stand alone and falls back to pgxntool master.

Merge order: merge this first (so run-tests.yml@master gains the owner
inputs), then the pgxntool PR.

🤖 Generated with Claude Code

The resolve step and run-tests.yml checkouts hardcoded github.repository_owner
(Postgres-Extensions) when locating the sibling pgxntool branch. For a fork PR
the paired branch lives on the fork, so resolve never found it and tested
against the wrong (unpaired) pgxntool — which is why fix-38's CI failed.

Now:
- resolve looks for the paired pgxntool branch ONLY on the PR head's account
  (github.event.pull_request.head.repo.owner.login) — never cross-account.
- No paired branch -> fall back to Postgres-Extensions/master ONLY, never a
  fork's master (possibly stale/modified). master is the sole cross-account ref.
- run-tests.yml gains pgxntool-owner / pgxntool-test-owner inputs (default to the
  repo owner) so each repo is checked out from the correct account.
- Document the pairing + never-cross-account rules in workflows/CLAUDE.md.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@coderabbitai

coderabbitai Bot commented Jul 13, 2026

Copy link
Copy Markdown

Review Change Stack

Warning

Review limit reached

@jnasbyupgrade, you've reached your PR review limit, so we couldn't start this review.

Next review available in: 19 minutes

Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available.
You're only billed for reviews past your plan's rate limits ($0.25/file).

How can I continue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews.

How do review limits work?

CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability.

For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window.

Please refer docs for additional details.

Review details
⚙️ Run configuration

Configuration used: Organization UI

Review profile: ASSERTIVE

Plan: Pro Plus

Run ID: 31b42dac-2455-447e-8ebb-887e894646e6

📥 Commits

Reviewing files that changed from the base of the PR and between 65b18fe and 296bf5c.

📒 Files selected for processing (3)
  • .github/workflows/ci.yml
  • .github/workflows/run-tests.yml
  • README.md
📝 Walkthrough

Walkthrough

CI now pairs repositories using both branch name and GitHub account. The resolve job emits the selected pgxntool owner and branch, using a same-account branch when available or Postgres-Extensions/master as fallback. The test job passes explicit owners to run-tests.yml, which uses them for both repository checkouts. Documentation describes the pairing, fallback, security, and branch-protection rules.

Estimated code review effort: 3 (Moderate) | ~20 minutes

Sequence Diagram(s)

sequenceDiagram
  participant PullRequest
  participant ResolveJob
  participant TestJob
  participant RunTests
  participant GitHub
  PullRequest->>ResolveJob: Provide branch and head owner
  ResolveJob->>GitHub: Check branch within head owner
  GitHub-->>ResolveJob: Matching branch or master fallback
  ResolveJob->>TestJob: Pass pgxntool ref and owner
  TestJob->>RunTests: Pass pgxntool and pgxntool-test owners
  RunTests->>GitHub: Checkout both repositories
Loading

Possibly related PRs

Poem

A bunny checks each branch with care,
And keeps its owner paired and fair.
No stranger’s branch can hop inside,
Master waits as fallback guide.
Two checkouts follow names made clear—
Safe CI carrots for the year! 🐇

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly describes the branch-account pairing change and the master fallback behavior.
Description check ✅ Passed The description accurately summarizes the CI pairing fix, security rule, checkout inputs, and docs updates.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

jnasbyupgrade and others added 3 commits July 13, 2026 14:38
The CI now pairs branches by name AND account (never cross-account). Update the
"CI and Contributing" section accordingly: paired branches must share a name and
live on the same account (your fork), and add a fork-contributor security note —
no paired branch means the other repo comes from Postgres-Extensions/master
only, never a fork's master.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In @.github/workflows/ci.yml:
- Around line 56-65: Update the branch status messages in the resolve step to
match run-tests.yml’s `pgxntool=… pgxntool-test=…` ordering and values. Report
pgxntool using the resolved owner/ref, while identifying pgxntool-test as `${{
github.repository_owner }}` at `${{ github.sha }}` in both the paired-branch and
fallback cases.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: ASSERTIVE

Plan: Pro Plus

Run ID: 42344fd8-06c3-49d3-b308-00e280129959

📥 Commits

Reviewing files that changed from the base of the PR and between 0d6abd6 and 65b18fe.

📒 Files selected for processing (4)
  • .github/workflows/CLAUDE.md
  • .github/workflows/ci.yml
  • .github/workflows/run-tests.yml
  • README.md

Comment thread .github/workflows/ci.yml Outdated
Address CodeRabbit review on Postgres-Extensions#25: the resolve step's `=== BRANCHES:` line
flipped the field order vs run-tests.yml and reported pgxntool-test as
${HEAD_OWNER}/${BRANCH}, though the test checkout is actually the base repo at
the merge SHA. Both lines now use the same shape — `pgxntool=<owner>/<ref>
pgxntool-test=<owner>/<ref>`, pgxntool first — with accurate values on each
side. (monitor-ci.sh reads the resolve job's line, so accuracy matters.)

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
The "CI and Contributing" section called pgxntool-test-only commits "normal and
common" and framed both-repo changes as conditional. Reframe: a paired change
(matching branch + account in both repos) is the norm; pgxntool changes are
effectively required to be paired; a pgxntool-test-only change is the occasional
exception. Neither repo should be changed in isolation as a matter of routine.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
jnasbyupgrade added a commit to Postgres-Extensions/pgxntool that referenced this pull request Jul 14, 2026
Pairs with pgxntool-test PR:
Postgres-Extensions/pgxntool-test#25

## Problem
CI resolved the paired sibling branch using `github.repository_owner`
(Postgres-Extensions), so a **fork PR** never found its paired branch
(which
lives on the fork) and tested against the wrong, unpaired code. This is
what
made the fix-38 PRs' CI fail: pgxntool-test's resolve looked for the
pgxntool
branch on Postgres-Extensions, didn't find it (it was on the fork), fell
back to
`pgxntool=master`, and master lacked the paired change.

## This PR (pgxntool side)
When pgxntool runs its own tests (`commit-with-no-tests` or
master-to-master),
pass explicit owners to `run-tests.yml`:
- `pgxntool-owner` = this PR's head account (the fork for fork PRs)
- `pgxntool-test-owner` = `Postgres-Extensions` (canonical master only —
never a fork's master)

The matching resolve/owner logic and the
`pgxntool-owner`/`pgxntool-test-owner`
inputs on `run-tests.yml` are in the paired pgxntool-test PR.

**Merge order:** pgxntool-test first (so `run-tests.yml@master` gains
the owner
inputs), then this PR.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

---------

Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@jnasbyupgrade jnasbyupgrade merged commit f0fe443 into Postgres-Extensions:master Jul 14, 2026
7 of 8 checks passed
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