Skip to content

Fix: parse_source_ref rejecting refs containing a slash - #501

Merged
0xLeif merged 1 commit into
mainfrom
fix/parse-source-ref-slash-refs
Jul 27, 2026
Merged

Fix: parse_source_ref rejecting refs containing a slash#501
0xLeif merged 1 commit into
mainfrom
fix/parse-source-ref-slash-refs

Conversation

@0xLeif

@0xLeif 0xLeif commented Jul 27, 2026

Copy link
Copy Markdown
Contributor

Summary

  • parse_source_ref's credential-URL guard rejected any trailing @ref containing /, breaking installs from branches using the common type/description naming convention (e.g. chore/0.2.0-launch-prep) β€” the whole string got globbed into the clone URL instead of being split into repo + ref
  • Rewritten to detect credential URLs by position (the @ sits inside the URL's authority, before any path separator following the scheme) instead of by whether the ref contains a slash
  • Adds SpecSync change CHG-0005 with a delta updating REQ-trust-006's acceptance criteria; bumps specs/trust/trust.spec.md to v6

Test plan

  • cargo test (966 passed), cargo fmt --check, cargo clippy -- -D warnings
  • New tests: slash-containing ref for bare shorthand, full URL, and a credentialed URL + trailing ref
  • Existing credential-URL-with-no-ref regression test still passes unchanged
  • specsync change check --strict --require-coverage 100 passes

πŸ€– Generated with Claude Code

https://claude.ai/code/session_016F4jsbbHAZtUrKf6MmYDM2

The credential-URL guard in parse_source_ref refused to split any
trailing @ref that contained a `/`, to avoid misparsing
`https://user:pass@host/path` as a ref split. That guard overshot: it
also rejected legitimate branch names using the common type/description
convention (chore/..., feature/..., docs/...), leaving the whole string
- ref included - globbed into the clone URL and producing a malformed
install source.

Rewritten to detect credential URLs by position (the @ falls inside the
URL's authority, before any path separator following the scheme)
instead of by whether the ref contains a slash, so slash-containing
refs split correctly everywhere, including full clone URLs with
embedded credentials plus a trailing ref.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_016F4jsbbHAZtUrKf6MmYDM2
@0xLeif
0xLeif requested a review from a team as a code owner July 27, 2026 20:05
@0xLeif
0xLeif requested review from 0xGaspar, Kyntrin and tofu-ux July 27, 2026 20:05

@chatgpt-codex-connector chatgpt-codex-connector 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.

πŸ’‘ Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 1f10740793

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with πŸ‘.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread src/trust.rs
Comment on lines +90 to +92
if let Some(scheme_end) = before.find("://") {
let authority_start = scheme_end + 3;
if !before[authority_start..].contains('/') {

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Preserve @ characters in generic file URLs

When a supported generic URL contains @ in its path followed by another path segment, such as file:///tmp/repo@group/plugin.git, this condition treats group/plugin.git as a ref and causes plugin installation to clone file:///tmp/repo instead of the requested repository. The previous slash guard kept this input intact, and the plugin contract explicitly says generic file:// URLs are cloned as-is (specs/plugin/plugin.spec.md lines 178–182), so ref detection must distinguish URL path characters from the explicit ref syntax.

AGENTS.md reference: AGENTS.md:L356-L356

Useful? React with πŸ‘Β / πŸ‘Ž.

Comment thread src/trust.rs
Comment on lines +379 to +380
#[test]
fn parse_source_ref_branch_with_slash() {

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P1 Badge Synchronize the canonical trust test plan

These three new regression tests are documented only in the accepted change artifact, while the canonical specs/trust/testing.md unit-test inventory still ends with the old credential test and omits all slash-ref coverage. Because canonical module companions remain the maintained test strategy after a change artifact is accepted, add the new cases there as well so the module spec stays synchronized with the implementation.

AGENTS.md reference: AGENTS.md:L377-L377

Useful? React with πŸ‘Β / πŸ‘Ž.

Comment thread specs/trust/trust.spec.md
---
module: trust
version: 5
version: 7

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Record this spec change as a single version bump

The parent spec is version 5, but this change advances the frontmatter directly to 7 and adds both version 6 and version 7 changelog entries for the same CHG-0005 behavior. This makes the source-of-truth history report two revisions where only one occurred and contradicts the commit's stated v6 bump; retain one next-version entry and keep the frontmatter aligned with it.

AGENTS.md reference: AGENTS.md:L356-L356

Useful? React with πŸ‘Β / πŸ‘Ž.

@github-actions github-actions Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

βœ… Corvin says...

      _
    <(^\  .oO(Caw! ^v^)
     |/(\
      \(\\
      " "\\

"That's a nice looking export you've got there."

CI Summary

Check Status
Dependency Audit βœ… Passed
Integration (3 OS) βœ… Passed
Lint (fmt + clippy) βœ… Passed
Spec Validation βœ… Passed
Tests (3 OS) βœ… Passed

Powered by corvid-pet

@0xLeif
0xLeif merged commit 1bd04d0 into main Jul 27, 2026
15 checks passed
@0xLeif
0xLeif deleted the fix/parse-source-ref-slash-refs branch July 27, 2026 20:31
@0xLeif 0xLeif mentioned this pull request Jul 27, 2026
3 tasks
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