Skip to content

fix: preserve dots in repository URLs - #102

Open
Benkapner wants to merge 3 commits into
mainfrom
fix/preserve-dots-in-repository-urls
Open

Benkapner wants to merge 3 commits into
mainfrom
fix/preserve-dots-in-repository-urls

Conversation

@Benkapner

Copy link
Copy Markdown
Member

Summary

Repository names containing dots are truncated when passed as GitHub URLs through --target-repo. For example, https://github.com/example/my.project.git resolves to example/my instead of example/my.project.

Preserve the full repository name and remove only a trailing .git suffix from URLs. Shorthand values such as example/my.project.git remain unchanged.

Related Issue

None — opened directly as a bug fix.

Changes

  • Update URL extraction in scripts/validate_target_repo.py to preserve dots.
  • Add unit coverage for dotted names, clone URLs, trailing slashes, and invalid names.
  • Add CLI regression coverage for dotted repository arguments.

Testing

  • Focused tests: 65 passed.
  • Full suite: 1,588 passed, 2 skipped; 85.23% coverage.
  • uv run --extra dev pre-commit run --all-files
  • make lint

Verified the new regression tests fail before the fix.

Full suite command:
uv run pytest tests/ -q --cov=scripts --cov-report=term-missing --cov-fail-under=70

make lint passes with an existing warning about the removed content-critical-position rule in .skillsaw.yaml.

Checklist

  • PR title follows Conventional Commits
  • Commits are signed off (DCO)
  • I wrote this contribution myself and can explain all changes in it

Signed-off-by: Ben Kapner <benkapner@gmail.com>
@qodo-code-review

Copy link
Copy Markdown

PR Summary by Qodo

Fix dotted repository names in GitHub URLs

🐞 Bug fix 🧪 Tests 🕐 10-20 Minutes

Grey Divider

AI Description

• Preserve dotted repository names when resolving GitHub URLs passed through --target-repo.
• Remove one trailing .git suffix from URL repository names without changing shorthand values.
• Add unit and CLI regression coverage for dotted names, URL variants, and invalid names.
Diagram

graph TD
  A["Target repo flag"] --> B["Flag parser"] --> C{"GitHub URL?"} -->|URL| D["Extract URL repo"] -->|strip trailing .git| E["Validate org/repo"] --> F["Normalized repo"]
  C -->|shorthand unchanged| E
Loading
High-Level Assessment

The targeted extraction fix is appropriate: it preserves existing shorthand behavior and uses the existing name validation. Replacing extraction with general URL parsing would broaden this narrowly scoped change without being necessary for the reported bug.

Files changed (3) +66 / -2

Bug fix (1) +2 / -2
validate_target_repo.pyPreserve dotted names during GitHub URL extraction +2/-2

Preserve dotted names during GitHub URL extraction

• URL extraction now captures the complete repository path segment rather than stopping at a dot. It removes one trailing '.git' suffix from URL values before the existing owner/repository validation.

scripts/validate_target_repo.py

Tests (2) +64 / -0
test_validate_target_repo_with_args.pyCover dotted repository arguments through the CLI +5/-0

Cover dotted repository arguments through the CLI

• Adds '--target-repo' regression cases for dotted shorthand names, GitHub URLs, and clone URLs.

tests/integration/test_validate_target_repo_with_args.py

test_validate_target_repo.pyCover dotted-name URL normalization and validation +59/-0

Cover dotted-name URL normalization and validation

• Adds cases for dotted names, single-suffix removal, trailing slashes, URL subpaths, credentialed URLs, and invalid names. Confirms shorthand values retain a literal '.git' suffix.

tests/unit/test_validate_target_repo.py

@qodo-code-review

qodo-code-review Bot commented Nov 8, 2026 •

Copy link
Copy Markdown

Code Review by Qodo

🐞 Bugs (1) 📘 Rule violations (0) 🔗 Cross-repo conflicts (0) 📜 Skill insights (0)

Grey Divider


Remediation recommended

1. Some GitHub links stop resolving 🐞 Bug ≡ Correctness
Description
validate_target_repo now captures the query or fragment after repo.git, so
removesuffix('.git') leaves it intact and repository-name validation rejects the value. A link
such as https://github.com/example/repo.git?tab=readme previously resolved to example/repo but
now fails when passed through --target-repo.
Code

scripts/validate_target_repo.py[R59-61]

+        match = re.search(r"github\.com[:/]([^/]+)/([^/]+)", repo_name)
        if match:
-            repo_name = f"{match.group(1)}/{match.group(2)}"
+            repo_name = f"{match.group(1)}/{match.group(2).removesuffix('.git')}"
Relevance

●●● Strong

Concrete deterministic regression: query/fragment after repo.git now breaks URL parsing. Same file's
accepted validation fixes (PR #49) suggest the team takes such correctness issues.

PR-#49

ⓘ Recommendations generated based on similar findings in past PRs

Evidence
The old capture stopped at the dot in repo.git?tab=readme and returned example/repo. The new
capture takes repo.git?tab=readme; the suffix removal does nothing, and the unchanged repository
regex rejects ?. main passes that validation failure through exit_error.

scripts/validate_target_repo.py[58-61]
scripts/validate_target_repo.py[66-76]
scripts/validate_target_repo.py[151-158]

Agent prompt
The issue below was found during a code review. Follow the provided context and guidance below and implement a solution

## Issue description
GitHub URLs ending in `.git` followed by a query or fragment were previously accepted but now fail validation because the extra URL components are included in the repository name.
## Fix Focus Areas
- scripts/validate_target_repo.py[58-61]
- tests/unit/test_validate_target_repo.py[59-117]
## Recommended Fix
Extract the repository path component separately from the URL query and fragment, then remove a trailing `.git` from the repository path segment only. Add cases for `.git` URLs followed by a query and a fragment.

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools

Dismiss ↗ | View ↗


Grey Divider

Context sources
✅ Compliance rules (platform): 12 rules
✅ Cross-repo context — repo relationships
✅ REVIEW.md
Review mode: Auto: ⚖️ Balanced: Regex change in repo-name input validation; localized, but validation edge cases warrant full review.

Grey Divider

Tip of the day
💡 Did you know, you can show, collapse, or hide each part of a finding: code, evidence, and all

More tips ↗ | Customize Qodo ↗ | Qodo docs ↗

Grey Divider

Qodo Logo

Comment on lines +59 to +61
match = re.search(r"github\.com[:/]([^/]+)/([^/]+)", repo_name)
if match:
repo_name = f"{match.group(1)}/{match.group(2)}"
repo_name = f"{match.group(1)}/{match.group(2).removesuffix('.git')}"

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Remediation recommended

1. Some github links stop resolving 🐞 Bug ≡ Correctness

validate_target_repo now captures the query or fragment after repo.git, so
removesuffix('.git') leaves it intact and repository-name validation rejects the value. A link
such as https://github.com/example/repo.git?tab=readme previously resolved to example/repo but
now fails when passed through --target-repo.
Agent Prompt
## Issue description
GitHub URLs ending in `.git` followed by a query or fragment were previously accepted but now fail validation because the extra URL components are included in the repository name.
## Fix Focus Areas
- scripts/validate_target_repo.py[58-61]
- tests/unit/test_validate_target_repo.py[59-117]
## Recommended Fix
Extract the repository path component separately from the URL query and fragment, then remove a trailing `.git` from the repository path segment only. Add cases for `.git` URLs followed by a query and a fragment.

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools

Dismiss ↗ | View ↗

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

@Benkapner I agree with this review, it is valid

@fullsend-ai-review

fullsend-ai-review Bot commented Nov 8, 2026 •

Copy link
Copy Markdown

🤖 Finished Review · ❌ Failure (fullsend config could not be loaded, agent did not run: loading fullsend config: config.yaml: create_issues is no longer supported: move create_issues.allow_targets to tracker.<provider>.allowed_ta…) · Started 3:38 PM UTC · Completed 3:38 PM UTC

Commit: 5077272 · View workflow run →

@fullsend-ai-review

fullsend-ai-review Bot commented Nov 23, 2026 •

Copy link
Copy Markdown

🤖 Finished Review · ✅ Success · Started 2:21 PM UTC · Completed 2:29 PM UTC

Commit: 5335bd5 · View workflow run →

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

@fullsend-ai-review fullsend-ai-review Bot added the risk/low PR risk: low label Nov 23, 2026
@fullsend-ai-review

fullsend-ai-review Bot commented Nov 23, 2026 •

Copy link
Copy Markdown

Risk Assessment: low (1/5)

Details

Small 68-line bug fix with high test coverage and zero recent churn across touched files, presenting minimal risk.

Previous run

Risk Assessment: low (1/5)

Details

Small bug fix with comprehensive test coverage and zero recent churn in touched files, resulting in minimal risk.

@fullsend-ai-review

fullsend-ai-review Bot commented Nov 23, 2026 •

Copy link
Copy Markdown

Review

Findings

High

  • [protected-path] scripts/validate_target_repo.py:59 — This PR modifies a file under a protected path (scripts/). It has no linked issue ("Related Issue: None"), so it lacks a linked authorization for changing governance or infrastructure files. Human approval is always required for protected-path changes.
    Remediation: Link an issue that authorizes the change, and obtain human approval.

Low

  • [edge-case] scripts/validate_target_repo.py:59 — The widened capture ([^/]+) now includes URL query strings and fragments. https://github.com/example/repo.git#readme and https://github.com/example/repo.git?ref=main previously normalized to example/repo. They now fail validation, because removesuffix('.git') no longer matches and _GITHUB_REPO_RE rejects the value. The added tests cover trailing slashes, subpaths and credentials, but not queries or fragments.
    Remediation: Capture ([^/?#]+) and add regression cases for clone URLs with a query and with a fragment.

  • [injection-vuln] scripts/validate_target_repo.py:59 — https://github.com/example/.. now validates as example/.., because _GITHUB_REPO_RE accepts dot-only names. The shorthand example/.. already passed on the base branch. Local paths are already accepted by design, so the URL form adds little reach. Rejecting . and .. components would still be sensible input hygiene, for URL and shorthand input alike. Treat this as advisory and out of scope for this fix.
    Remediation: Optionally reject repository components equal to . or .. after removing the .git suffix, with tests.


Next steps:

  • /fs-fix — agent addresses review findings automatically
  • /fs-fix <your instruction> — agent fixes with your specific guidance
  • Push commits directly — review re-runs automatically on push
  • /fs-fix-stop — disable automatic fix runs for this PR
Previous run

<!-- fullsend:review-findings-v2:eyJ2ZXJzaW9uIjoyLCJhY3Rpb24iOiJyZXF1ZXN0LWNoYW5nZXMiLCJmaW5kaW5ncyI6W119 -->

Review

Findings

High

  • [protected-path] scripts/validate_target_repo.py — This PR modifies a file under the protected path scripts/, and it has no linked issue (the description states "None — opened directly as a bug fix"), so there is no recorded justification or authorization for changing governance/infrastructure files. Human approval is always required for protected-path changes.
    Remediation: Link a tracking issue for the dotted-repository-name bug (e.g. Closes #NN) and explain why the scripts/ change is needed, then have a human maintainer approve.

Labels: PR is a bug fix to repository URL parsing.


Next steps:

  • /fs-fix — agent addresses review findings automatically
  • /fs-fix <your instruction> — agent fixes with your specific guidance
  • Push commits directly — review re-runs automatically on push
  • /fs-fix-stop — disable automatic fix runs for this PR

fullsend-ai-review[bot]

This comment was marked as outdated.

@fullsend-ai-review fullsend-ai-review Bot added the bug Something isn't working label Nov 23, 2026
@fullsend-ai-review

fullsend-ai-review Bot commented Nov 24, 2026 •

Copy link
Copy Markdown

🤖 Finished Review · ✅ Success · Started 9:31 AM UTC · Completed 9:38 AM UTC

Commit: 9ddf497 · View workflow run →

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

@fullsend-ai-review fullsend-ai-review 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.

See the review comment for full details.

# Accept full GitHub URLs, extract org/repo
if repo_name.startswith("http://") or repo_name.startswith("https://"):
match = re.search(r"github\.com[:/]([^/]+)/([^/\.]+)", repo_name)
match = re.search(r"github\.com[:/]([^/]+)/([^/]+)", repo_name)

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

[high] protected-path

Modifies a file under protected path scripts/ with no linked issue ("Related Issue: None"), so the change lacks linked authorization for modifying governance/infrastructure files. Human approval is always required for protected-path changes.

Suggested fix: Link an issue that authorizes the change and obtain human approval.

# Accept full GitHub URLs, extract org/repo
if repo_name.startswith("http://") or repo_name.startswith("https://"):
match = re.search(r"github\.com[:/]([^/]+)/([^/\.]+)", repo_name)
match = re.search(r"github\.com[:/]([^/]+)/([^/]+)", repo_name)

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

[low] edge-case

The widened capture ([^/]+) includes URL queries and fragments: https://github.com/example/repo.git#readme and ...repo.git?ref=main previously normalized to example/repo but now fail validation (removesuffix no longer matches; _GITHUB_REPO_RE rejects). New tests do not cover queries or fragments.

Suggested fix: Capture ([^/?#]+) and add regression cases for clone URLs with a query and a fragment.

# Accept full GitHub URLs, extract org/repo
if repo_name.startswith("http://") or repo_name.startswith("https://"):
match = re.search(r"github\.com[:/]([^/]+)/([^/\.]+)", repo_name)
match = re.search(r"github\.com[:/]([^/]+)/([^/]+)", repo_name)

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

[low] injection-vuln

https://github.com/example/.. now validates as example/.. since _GITHUB_REPO_RE accepts dot-only names; the shorthand example/.. already passed on base and local paths are accepted by design, so the URL form adds little reach. Advisory input-hygiene gap, out of scope for this fix.

Suggested fix: Optionally reject repository components equal to . or .. after removing the .git suffix, for URL and shorthand input, with tests.

@fege fege Nov 24, 2026 •

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

@Benkapner, I agree here.
Please reject repository names that are exactly . or .. after stripping one trailing .git. This still allows valid dotted names like my.project and .github.
On main, a GitHub URL whose repository segment is .. is rejected; this change accepts it and passes owner/.. to find_target_repo().

Please add CLI regression cases for ., .., and ...git (which becomes .. after suffix removal).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working risk/low PR risk: low

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants