Stop the fork API addressing a repo name that doesn't exist - #9
Merged
Conversation
clone_target.py carried its own copy of extract_slug that stripped the
.git suffix with url.rstrip(".git"). rstrip takes a character set, not a
suffix, so it kept eating trailing characters from {'.','g','i','t'} once
.git was gone: rh-forge-ui became rh-forge-u.
Every fork API call then addressed a repository that isn't there. GitHub
answers 404 rather than 403 for a repo a token cannot see, so the symptom
was indistinguishable from a credentials problem and RHAI-760 was
diagnosed as a bad PAT for some time before the name was suspected.
Latent since the copy was made. It only bites names ending in a character
from that set, and no previous target had one -- odh-dashboard, kale,
mlflow and codeflare-sdk all end outside it.
Delete the copy rather than patch it, and point both call sites at
github_utils.extract_slug, which already used .removesuffix(".git"). Two
copies of one function are precisely what let the correct version sit
next to the broken one without either fixing the other.
Also file the follow-on: a clone fault marks the epic terminally Failed,
so this 404 needed a hand-edit of the data repo to retry, where ADR-0025
would have left it Ready.
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5 <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.
What
clone_target.pycarried its own copy ofextract_slugthat stripped.gitwithurl.rstrip(".git").rstriptakes a character set, not a suffix, so it kept eating trailing characters from{'.','g','i','t'}once.gitwas gone:Every fork API call then addressed a repository that isn't there:
GitHub answers 404 rather than 403 for a repo a token cannot see, so this was indistinguishable from a credentials fault — the PAT was audited first (classic vs fine-grained, SSO, org opt-in) and was fine all along.
Latent since the copy was made. It only bites repo names ending in a character from that set;
odh-dashboard,kale,mlflowandcodeflare-sdkall end outside it.rh-forge-uiis the first target that doesn't.How
Deleted
clone_target._extract_slugand pointed both call sites (_url_matches,_setup_fork_remote) atgithub_utils.extract_slug, which already used.removesuffix(".git"). Deleting rather than patching is the point — two copies of one function are what let the correct version sit next to the broken one without either fixing the other.Verification
Reproduction now passes end to end against the live private repo:
TestExtractSlug::test_repo_name_ending_in_git_suffix_chars— the character-set caseTestSetupForkRemote::test_repo_name_ending_in_i_is_not_truncated— asserts the exact args reachingensure_fork, pinning the call site that brokemake test-unit: 762 passedcheck_ledger.py --all: 157 files consistentLedger companion
docs/bugs/fixed/bug-slug-extractor-truncated-repo-names.mddocs/bugs/open/bug-clone-fault-marks-epic-failed.md— the follow-on: a clone fault marks the epic terminallyFailed, so this 404 needed a hand-edit of the data repo to retry, where ADR-0025 would have left itReady. Filed, not fixed here.🤖 Generated with Claude Code