fix(publish): lowercase OCI repository path for uppercase scopes#120
Merged
Conversation
`trix publish` rejected protocols whose `[protocol].scope` carried capitals (e.g. "SundaeSwap-finance"). The scope passes `validate_ident` (which accepts `[a-zA-Z]`) and deliberately mirrors the GitHub org owner, which legitimately has capitals. But `reference_for` then built an OCI reference with the original case, and the OCI image spec requires repository paths to be lowercase, so `oci_client::Reference::try_from` rejected it at push time. Lowercase only the two repository path segments in `reference_for`, the single chokepoint shared by publish and pull. Registry addressing stays OCI-compliant and consistent across both paths, while the original-case scope is preserved everywhere else (GitHub verification, image metadata, the vendor annotation). Tags are left untouched since OCI permits uppercase there. Adds regression tests covering the lowercasing and the `latest` default. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
trix publishrejects protocols whose[protocol].scopecarries capitals, e.g.:The metadata passes config loading and
validate_ident(which accepts[a-zA-Z]), but the publish fails at push time.scopedeliberately mirrors the GitHub org owner —publish.rsverifies it case-sensitively against the[protocol].repositoryURL owner, and GitHub orgs legitimately have capitals. So we can't simply reject capitals.The real issue:
reference_for(src/interfaces/oci.rs) built the OCI reference with the original-case scope/name, and the OCI image spec requires repository paths to be lowercase —oci_client::Reference::try_fromrejected it.Fix
Lowercase only the two repository path segments in
reference_for, the single chokepoint shared by bothtrix publish(push) andtrix use(pull). This keeps registry addressing OCI-compliant and consistent across both paths, while the original-case scope is preserved everywhere else (GitHub verification, image metadata, theorg.opencontainers.image.vendorannotation). Tags are left untouched since OCI permits uppercase there.Adds regression tests covering the lowercasing (
SundaeSwap-finance/Sundae-V3→sundaeswap-finance/sundae-v3) and thelatestdefault.Follow-up to confirm (registry side, out of this repo)
If the registry's push-authorization compares the GitHub OIDC owner case-sensitively against the lowercased repository path segment, a publisher from org
SundaeSwap-financecould still fail authorization. Worth verifying the registry resolves that case-insensitively.🤖 Generated with Claude Code