fix(xtest): Lets push-to-main SHA resolve bare HEAD right - #533
Conversation
On a push to main the tip SHA is listed by ls-remote as both the symbolic HEAD and refs/heads/main. With equal specificity, min() picked the first (HEAD), yielding tag=HEAD with no head flag — so nothing built and the test looked for dist/HEAD/cli.sh. Rank real refs (pull > merge-queue > branch > tag) above the bare HEAD so refs/heads/main wins, giving tag=main, head=true. Branch is ranked above tag so a commit-under-test that is also a release tag still gets a source build.
|
Warning Review limit reached
More reviews will be available in 53 minutes and 57 seconds. Learn how PR review limits work. Your organization has used up its prepaid credits, and credit purchases are no longer available. Enable the review add-on in the billing tab to keep reviews running — you're only billed for reviews past your plan's rate limits ($0.25/file). ⌛ How to resolve this issue?After more reviews become available, a review can be triggered using the 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 credits. 🚦 How do rate limits work?CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan refill rate. For paid Pro and Pro+ PR reviews, CodeRabbit uses rolling per-developer review limits. Reviews become available again as older review attempts age out of the rolling limit window. Please see our Fair Usage Limits Policy for further information. ℹ️ Review info⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (2)
✨ Finishing Touches🧪 Generate unit tests (beta)
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. Comment |
There was a problem hiding this comment.
Code Review
This pull request refines the reference resolution logic in _ref_specificity to prioritize branches over tags and other symbolic references (like HEAD) when they share the same SHA. This ensures that a branch is preferred so that it is correctly flagged as a head and built from source. Additionally, unit tests have been added to verify that branches are preferred over symbolic HEADs and tags. There are no review comments to address.
Important
The consumer version of Gemini Code Assist on GitHub is being sunset. Starting June 18, 2026, new organization installations will be blocked, and all code review activity will officially cease on July 17, 2026.
For more details on the timeline and next steps, please review the Help Documentation.
|



Problem
Follow-up to #532. xtest still fails during go CLI setup, now on push-to-main events from
opentdf/platform, as in this example failure:The matrix value was
go@HEADand onlymaingot built.Root cause
The platform caller passes the go ref as the main-tip commit SHA (
otdfctl-ref: <sha> main). On a push to main,git ls-remotelists that SHA under two refs:_ref_specificityscored every non-PR/non-merge-queue ref equally (2), somin()kept the first entry — the symbolicHEAD. That fell through_classify_sha_matchto the generic tag path, producingtag = "HEAD"with noheadflag. Sosetup-cli-toolskipped the source build (onlymain, separately resolved as a head, was built) and the test looked for the non-existentdist/HEAD/cli.sh.Fix
Rank real refs above the bare
HEAD: PR > merge-queue > branch > tag > other. Nowrefs/heads/mainwins overHEAD, givingtag = "main",head = true(built from source).Branch is deliberately ranked above tag: the SHA path always resolves a commit-under-test, and only the branch case sets
head=true. So a commit that is simultaneously a branch tip and a release tag (e.g. right after release-please) still gets a source build rather than resolving to a tag that wouldn't be built.Testing
test_head_and_branch_prefers_branchandtest_branch_preferred_over_tag.uv run pytest— 137 pass.uv run ruff check .,uv run ruff format .,uv run pyright— clean.