fix(bin): read cross-repo PR checks from the head repository - #5919
mehulbhagwani wants to merge 3 commits into
Conversation
|
Speaking as Kun's firstmate: whole thread read (body + attestation; open sibling #5796 same fix on older branch Verdict: Tip vs main: Main VISION.md per-rule:
Workflow approvals: CI |
8675ee2 to
f0c2f10
Compare
|
|
Rebased onto current main; validated head is f0c2f10. |
5485f6d to
b1ce267
Compare
fm-contributions.sh queried check-runs and commit statuses against the PR's base repository, even when the head commit only exists on a fork. GitHub's commits API silently returns zero results for a SHA it cannot resolve in that repository, so a cross-repo PR was observed as having no checks at all. Read .head.repo.full_name from the PR core response and query check-runs and statuses there instead, falling back to the base repository when the head repo is absent (a deleted fork).
The fixture accepts statuses for any repo path, so only a negative check proves the base repository statuses endpoint stayed quiet.
b1ce267 to
7af73f2
Compare
|
Closing this as not needed. The premise no longer holds: on fork PRs the check-runs live on the base repository, not the head (fork) repository. Checked live against current fork PR heads:
Commit statuses were 0 on both repositories for both heads. Reading checks only from the head repository, as this PR does, would make the contributions poll see no CI at all on fork PRs, which is a regression. The original reproduction (base 0, fork 20 on #4932) does not reproduce now. |
Intent
i need to close all issues of kun (asked to get every one fixed, not closed unfixed) - sticking to his vision.md to all the tickets
Context: upstream PR #5919 ("read cross-repo PR checks from the head repository", for issue #5796 sibling; closes the contribution-check hole) is the captain's open contribution to kunchenguid/firstmate. The maintainer merges only when the PR body carries a no-mistakes attestation whose head_sha MATCHES the PR head, CI is green, the branch is current with main, and the change aligns with every rule in the repo's VISION.md (his firstmate posts a per-rule VISION.md verdict on each PR). Current state: The maintainer's firstmate triaged it waiting-ci with all VISION.md rules aligned, but after the later rebase to f0c2f10 its 'PR must be raised via no-mistakes' check fails; PR is 13 commits behind main.
What Changed
bin/fm-contributions.sh: resolve PR checks from the head repository rather than the base repository, so cross-repo (fork) PRs have their status checks read correctly.tests/fm-contributions.test.sh: add coverage asserting cross-repo PRs are rejected when checks are read from the base repo, and verifying the fix reads from the head repository instead.🤖 Generated with Claude Code
Risk Assessment
✅ Low: Small, well-scoped fix (fallback-safe repo substitution) with a matching regression test that verifies both the new head-repo call path and the absence of the old base-repo call path.
Testing
Drove tests/fm-contributions.test.sh to completion. It stands up bin/fm-contributions.sh against a scripted fixture 'gh' CLI and exercises the full observe()/poll() pipeline as an end-to-end shell interface. The new test_cross_repo_checks_use_head_repo scenario confirms that for a cross-repo PR (head.repo.full_name = fork/r, base repo = o/r), check-runs and statuses are fetched from repos/fork/r/commits/<sha>/... and NOT from repos/o/r/commits/<sha>/..., matching the fix in bin/fm-contributions.sh. All 45 pre-existing tests (budget handling, dedupe, wake semantics, failure episodes, settle behavior, etc.) also passed, showing no regression from the head-repo change. Exit code 0, no failures.Evidence: fm-contributions.test.sh full run output
Pipeline
Updates from git push no-mistakes
✅ **intent** - passed
✅ No issues found.
✅ **Rebase** - passed
✅ No issues found.
✅ **Review** - passed
✅ No issues found.
✅ **Test** - passed
✅ No issues found.
bash tests/fm-contributions.test.sh — full suite, 46/46 tests passed, exit code 0✅ **Document** - passed
✅ No issues found.
✅ **Lint** - passed
✅ No issues found.
✅ **Push** - passed
✅ No issues found.