Skip to content

fix(#71): build cross-fork compare commit URLs from their repository - #138

Open
fullsend-ai-coder[bot] wants to merge 1 commit into
mainfrom
agent/71-cross-fork-commit-urls
Open

fullsend-ai-coder[bot] wants to merge 1 commit into
mainfrom
agent/71-cross-fork-commit-urls

Conversation

@fullsend-ai-coder

Copy link
Copy Markdown
Contributor

Summary

Builds the commit URLs in a cross-fork compare from the repository that holds each commit. A cross-fork compare reads the fork's objects in place and copies nothing into the base repository. Its files URLs already pointed at the fork. But commits, base_commit and merge_base_commit built every URL (url, html_url, comments_url, commit.url, commit.tree.url, parent URLs) from the base repository. Following any of them for a fork-only commit returned 404.

This is option 1 from the issue, the approach the maintainer chose.

Changes

  • src/app/api/commits.py: _build_compare now takes base_fork as well as head_fork.
    • commits (and files, as before) use the head side's repository: the head fork when the head side is one.
    • base_commit uses the base side's repository: the base fork when the base side is one. merge_base_commit is an ancestor of the base commit, so it uses the same repository.
    • A comparison with no fork side is unchanged.
  • tests/test_compare_and_label_edges.py: new test_cross_fork_commit_urls_lead_to_the_repository_that_holds_them. It runs the compare with the fork on the head side, then on the base side. It checks that each commit's URLs name the repository that holds the commit. As the comparing user, it then follows url, commit.url, commit.tree.url and the parent URLs of commits, base_commit and merge_base_commit, and expects 200.
    • comments_url is only checked for the right repository, not followed: the emulator has no commit-comments route for any repository.
  • docs/bugs/fixed/cross-fork-compare-commit-urls-name-the-base-repository.md and PLAN.md: work-ledger record of the bug and fix.

Testing

  • The new test fails without the source change and passes with it. tests/test_compare_and_label_edges.py and tests/test_compare_api.py all pass.
  • Full suite: 1561 passed, 2 failed. Neither failure is related to this change:
    • tests/actions/test_runner_shutdown.py::test_a_shutdown_signal_fails_the_running_step_and_stops_its_processes also fails on unmodified main in the sandbox.
    • tests/test_security_headers.py::test_admin_ui_and_unreserved_admin_path_include_security_headers fails because the frontend dist wasn't built in the sandbox.
  • Pre-commit couldn't fetch its hook repositories in the sandbox (TLS verification failure). I ran ruff check v0.17.3 (the pinned hook version) directly and it passed. Trailing-whitespace and end-of-file checks and a gitleaks secret scan also passed.

Follow-up

Option 2 is left as a possible follow-up: get_commit and the git commit/tree routes would resolve a fork-only commit through the fork network, keeping GitHub's base-repository URL shape.

🤖 Generated with Claude Code


Closes #71

Post-script verification

  • Branch is not main/master (agent/71-cross-fork-commit-urls)
  • Secret scan passed (gitleaks — 0454bace16539f60483343fc2079d8b7d7a6ebc7..HEAD)
  • PR body secret scan passed (gitleaks — no-git)
  • Final PR description secret scan passed (gitleaks — no-git)

A cross-fork compare reads the fork's objects in place, without copying
them into the base repository. Its files' URLs already named the fork,
but the commit objects (commits, base_commit, merge_base_commit) built
every URL from the base repository, so following url, commit.url,
commit.tree.url or a parent URL of a fork-only commit answered 404.

_build_compare now takes the base side's fork as well as the head
side's, and builds commits' URLs from the head side's repository and
base_commit's and merge_base_commit's from the base side's (the merge
base is an ancestor of the base commit). Comparisons with no fork side
are unchanged. This is option 1 from the issue, as the maintainer chose.

The new test compares with the fork on the head side and then on the
base side, and follows each commit's URLs as the comparing user. The
bug is recorded in docs/bugs/fixed and indexed in PLAN.md.

Note: pre-commit could not fetch its hook repositories in the sandbox
(TLS verification failure). ruff-check v0.17.3 was run directly and
passed; whitespace, end-of-file and secret scans also passed. In the
full suite, two unrelated tests fail in the sandbox:
test_runner_shutdown (fails on main too) and test_security_headers
(no built frontend/dist).

Closes #71

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@fullsend-ai-coder fullsend-ai-coder Bot added the ready-for-review Triggers review agent dispatch label Dec 3, 2026
@fullsend-ai-review

fullsend-ai-review Bot commented Dec 3, 2026 •

Copy link
Copy Markdown

🤖 Finished Review · ✅ Success · Started 2:59 PM UTC · Completed 3:06 PM UTC

Commit: f5e0d7a · View workflow run →

Runtime: pi · Model: sonnet → claude-sonnet-5-5 · Effort: high · Cost: $1.02

@fullsend-ai-review fullsend-ai-review Bot added the risk/moderate PR risk: moderate label Dec 3, 2026
@fullsend-ai-review

Copy link
Copy Markdown

Risk Assessment: moderate (2/5)

Details

Targeted bug fix with complete acceptance criteria and test coverage, moderately elevated due to modifying existing compare URL behavior without a feature flag toggle.

@fullsend-ai-review

fullsend-ai-review Bot commented Dec 3, 2026 •

Copy link
Copy Markdown

Looks good to me

@fullsend-ai-review fullsend-ai-review Bot added the ready-for-merge All reviewers approved — ready to merge label Dec 3, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ready-for-merge All reviewers approved — ready to merge ready-for-review Triggers review agent dispatch risk/moderate PR risk: moderate

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Cross-fork compare: commit URLs name the base repository for fork-only commits

1 participant