Repository navigation
fix(github): accept Enterprise Managed User logins in owner slug validation - #20450
Conversation
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Repository UI Review profile: CHILL Plan: Advanced Run ID: 📒 Files selected for processing (6)
Included review availability: Your plan provides up to 10 included reviews per hour; 7 remain after this review. 📝 WalkthroughWalkthroughOwner slug validation now accepts underscores after the first character, including Enterprise Managed User logins such as Priority: ➖ Normal Severity of issue fixed: Medium Merge Risk: ⚪ Minimal · up to EMU usernames are supported across project and Git username parsing without an identified regression or unresolved merge-blocking risk. 🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
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.
Important
The owner alphabet is widened in the main and renderer parsers, but the mobile app carries its own copy of the same parser and still rejects EMU logins — so the bug this PR fixes persists on mobile.
Reviewed changes
- Owner alphabet widened —
OWNER_SLUG_REnow permits_after the first character insrc/main/github/project-view/internals.ts,src/main/github/github-api-repository-validation.ts, and theparseProjectPasteshorthand. - Renderer parity —
project-picker-input.tsextracts a sharedOWNER_REand applies it to both the URL path and theowner/numbershorthand. - Tests — the two assertions that encoded "underscore is invalid" now assert the EMU shape is accepted and a leading
_is rejected; a newgithub-api-repository-validation.test.tscovers the owner/repo slug gate.
⚠️ Mobile parser still rejects Enterprise Managed User owners
mobile/src/tasks/github-project-reference.ts:32 and :44 keep the old /^[A-Za-z0-9][A-Za-z0-9-]*$/ alphabet. That function is re-exported as parseProjectInput (mobile/src/tasks/mobile-tasks-dependencies.ts:88) and drives the mobile project picker (mobile/src/tasks/use-mobile-tasks-project-loading-actions.tsx:256), so octocat_acme/1 or a .../users/octocat_acme/projects/1 URL still fails to parse there. The PR's stated goal — accepting the alphabet everywhere it is checked — is not met while this copy remains.
Technical details
# Mobile owner alphabet not updated
## Affected sites
- `mobile/src/tasks/github-project-reference.ts:32` — `OWNER_RE` still `/^[A-Za-z0-9][A-Za-z0-9-]*$/`
- `mobile/src/tasks/github-project-reference.ts:44` — shorthand regex still excludes `_`
- `mobile/src/tasks/github-project-reference.test.ts` — no EMU case
## Required outcome
- `parseGitHubProjectInput` accepts the same owner alphabet as main and renderer, with a test asserting `octocat_acme/1` and a `users/octocat_acme` URL parse while `_acme/1` and `orgs/_acme` still reject.
## Suggested approach
- Prefer one shared constant under `src/shared/github/` (mobile already imports from `../../../src/shared/github/...`) so the alphabet cannot drift again — this PR had to touch three independent copies and one was missed.
## Open questions for the human
- Is the mobile project picker in scope for this fix, or intentionally deferred?DeepSeek Flash (free via Pullfrog for OSS) | 𝕏
Review on stablyai#20450 found a fourth copy of the owner regex in mobile/src/tasks/github-project-reference.ts, still rejecting Enterprise Managed User logins. Move the alphabet into src/shared/github/owner-slug.ts (slug regex, owner/number shorthand regex, isGitHubOwnerSlug) and import it from main, renderer and mobile so the four sites cannot drift again. Mobile gains the EMU test cases.
|
Thanks, the mobile finding was right — 95a160c takes the suggested route: the alphabet now lives once in To the open question: yes, the mobile picker is in scope — the point of the fix is that the same paste works everywhere. |
There was a problem hiding this comment.
ℹ️ No critical issues — one minor cleanup suggestion inline.
Reviewed changes
- Shared owner alphabet extracted —
src/shared/github/owner-slug.tsis now the single source forGITHUB_OWNER_SLUG_RE, theowner/numbershorthand regex, andisGitHubOwnerSlug. - Drifting copies replaced — main (
internals.ts,github-api-repository-validation.ts,project-view-reference.ts) and renderer (project-picker-input.ts) import the shared constants instead of local regexes. - Mobile adopted —
mobile/src/tasks/github-project-reference.tsnow uses the shared alphabet, closing the gap the previous review flagged, with EMU cases added to its parser test. - New and updated tests —
owner-slug.test.tsandgithub-api-repository-validation.test.tsadded; main, renderer and mobile parser tests now assert theoctocat_acmeshape is accepted and a leading_is still rejected.
DeepSeek Flash (free via Pullfrog for OSS) | 𝕏
Review on stablyai#20450: isGitHubOwnerSlug had no production caller while isValidOwnerSlug re-implemented the same check. One validator now.
There was a problem hiding this comment.
✅ No new issues found.
Reviewed changes
- Single validator —
isValidOwnerSluginsrc/main/github/project-view/internals.ts:72now delegates to the sharedisGitHubOwnerSlug, and the duplicate localOWNER_SLUG_REalias was removed. Behavior is unchanged: the shared regex requires a leading alphanumeric, so the droppedvalue.length > 0guard was already redundant. This retires the one outstanding cleanup suggestion from the prior review.
DeepSeek Flash (free via Pullfrog for OSS) | 𝕏
|
@gon2gon2 I verified the reported EMU rejection against GitHub's documented username format and tested your fix. I've pushed an update to this PR, preserving your commits and merging in the newer base used for validation. The latest commit is The shared owner validator accepts non-leading underscores across main, renderer, repository overrides, and mobile. I added regression coverage for complete project resolution with EMU and ordinary users, ordinary organizations, shorthand's organization-to-user fallback, github.com host selection, and rejection before a request reaches an unconfigured host. Encoded separators and other path-shaped owner values remain rejected. Validation:
Could you pull this PR branch and test your actual |
There was a problem hiding this comment.
✅ No new issues found.
Reviewed changes
Delta since the prior pullfrog review (f3f944505a): a main merge plus one test-only commit.
- EMU project resolution covered end to end —
project-view-host-auth.test.tsdrivesoctocat_acmethrough pastedgithub.comURLs (org and user shapes), theowner/numbershorthand fallback after an organization miss, the ambient-vs-pasted host boundary, and malformed / unconfigured-host rejection. - github.com normalization parameterized —
github-api-repository.test.tsruns the no-auth-probe normalization case for bothacmeandoctocat_acme. - Shared-alphabet path-injection guards —
owner-slug.test.tsaddsa_b/c,a_b\c,a_b%2Fc,a_b?c,a_b#cto the reject set, pinning that widening_did not open a path segment. mainmerged in — the merge only reconciled unrelatedmainchanges (theGhGraphqlErrorShape→GhGraphqlErrorrename); theisValidOwnerSlugdelegation is intact and no literal copy of the old alphabet remains.
Ablating the alphabet back to [A-Za-z0-9][A-Za-z0-9-]* makes all 11 EMU assertions fail — including the github-api-repository normalization case this commit touched — so the new coverage is real regression protection, not theatre. Focused run: 83 root + 5 mobile tests pass. The single prior Pullfrog thread is resolved, so nothing is outstanding.
DeepSeek Flash (free via Pullfrog for OSS) | 𝕏
|
tl;dr -- if you can test it out then we can merge it if all is well |
|
Tested 212801c with my EMU account. Adding the project by URL and by One related bug I hit while testing, outside this PR: |
|
you can push it here! Thanks!
…On Wed, Sep 16, 2026 at 1:45 AM Gon Song ***@***.***> wrote:
*gon2gon2* left a comment (stablyai/orca#20450)
<#20450 (comment)>
Tested 212801c
<212801c>
with my EMU account. Adding the project by URL and by <login>/<number>
shorthand both work, and the view and its items load. I don't have an
ordinary project handy to check.
One related bug I hit while testing, outside this PR:
src/main/git/git-username.ts only accepts [A-Za-z0-9-] for the gh login,
so an EMU login like octocat_acme is first rejected and then parsed from gh
auth status as octocat, which becomes the branch prefix. Allowing _ after
the first character in both checks fixes it and the existing tests pass. I
can push that here or as a separate PR, whichever you prefer.
—
Reply to this email directly, view it on GitHub
<#20450?email_source=notifications&email_token=AA7SPTCX4RBYLNX4YVZ47BL5PJHMBA5CNFSNUABFM5UWIORPF5TWS5BNNB2WEL2JONZXKZKDN5WW2ZLOOQXTKNRZGQ3DMMZRHA32M4TFMFZW63VHMNXW23LFNZ2KKZLWMVXHJLDGN5XXIZLSL5RWY2LDNM#issuecomment-5694663187>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AA7SPTFNMEYR4T6ZAATO2ML5PJHMBAVCNFSNUABGKJSXA33TNF2G64TZHMYTCOBTHA4DQMZUGI5US43TOVSTWNJUGM4DCMBQHAYDBILWAI>
.
You are receiving this because you commented.Message ID:
***@***.***>
|
|
Thanks @nwparker ! |
There was a problem hiding this comment.
ℹ️ No critical issues — one coverage suggestion inline and a description nit.
Reviewed changes
Delta since the prior pullfrog review (212801cac5): one commit, b19d615c, which widens the branch-prefix username checks in src/main/git/git-username.ts so the follow-up the description called out is now done.
isPlausibleHostedLoginaccepts_after the first character — the 39-char cap, alphanumeric first/last character, and the--reject are all preserved, so_acme,octocat_,-octocatandocto--catstill fail.parseGhAuthStatusLoginstops truncating EMU logins — the login capture widened from[A-Za-z0-9-]+to[A-Za-z0-9][A-Za-z0-9_-]*, so an EMU login printed bygh auth statusno longer parses as the prefix before the_when thegh api userprobe fails.- New
git-username.test.ts— pins the ordinary-login, EMU-login and reject cases against the exported validator; focused run of the two touched suites passes (37 tests).
The widened alphabet is safe: _ is not a path separator, and the leading-character rule plus repo reserved-name set are unchanged, so the nameWithOwner → REST-path guard still holds.
ℹ️ Nitpicks
- The PR description still lists
src/main/git/git-username.tsunder "Not changed … Worth a follow-up if EMU users see odd branch prefixes", but this commit changes exactly that. Worth updating the description so it matches the diff.
DeepSeek Flash (free via Pullfrog for OSS) | 𝕏
There was a problem hiding this comment.
✅ No new issues found.
Reviewed changes
Delta since the prior pullfrog review (b19d615c): one test-only commit, 9146ac7, which closes the coverage gap that review flagged.
gh auth statusfallback EMU coverage —repo-username.test.tsnow drivesoctocat_acmethroughresolveLocalGitUsernamewhengh api userfails and the auth-status output prints the EMU login, asserting the whole login rather than the truncated prefix.gh api userEMU coverage — a second case assertsoctocat_acmeresolves without falling through to the auth-status probe (ghExecFileAsynccalled once).
Ablating parseGhAuthStatusLogin's capture back to [A-Za-z0-9-]+ makes the fallback case fail (octocat vs octocat_acme), so the new coverage is real regression protection, not theatre. The prior review's inline thread is resolved, and the description nit was also addressed (git-username.ts is now listed under "What Changed").
DeepSeek Flash (free via Pullfrog for OSS) | 𝕏
|
Re-reviewed the full PR and the new username fixes through Pushed Verification:
The local Electron checks use fixture GitHub responses; your live EMU project-and-items confirmation in #20450 (comment) is separate real-account evidence. No live Windows/SSH/mobile-device run was performed. Verdict: ready to merge once required checks on the latest head pass. No further functional changes indicated. @gon2gon2, if convenient, please do one final fresh-app check that a new branch now uses your complete |
There was a problem hiding this comment.
✅ No new issues found.
Reviewed changes
Delta since the prior pullfrog review (9146ac72): one test-only commit, 3e117b6b, plus a clarified comment.
- Username suites parameterized —
repo-username.test.tsfolds the single-purpose cases intoit.eachblocks for both thegh api userandgh auth statuspaths, drivinggh-demo/octocat_acmeanddemo-user/octocat_acmethrough each. No prior coverage was dropped. - Multi-account active selection covered — new cases assert the active account wins regardless of block order and whether the logins are EMU or ordinary, pinning
parseGhAuthStatusLogin's block-wise parse. - Boundary and inject cases added —
git-username.test.tsnow pins the 39-char acceptance and 40-char rejection, trailing-, and the path/whitespace shapes (/,\, newline,.lock, space) againstisPlausibleHostedLogin. - Stale comment corrected —
isPlausibleHostedLogindrops the "same alphabet assrc/shared/github/owner-slug.ts" claim, which never held (the 39-char cap, trailing-separator rule and--reject all differ from the shared constant).
The tests are not theatre: reverting isPlausibleHostedLogin or the parseGhAuthStatusLogin capture to reject/halt at _ fails the new EMU and multi-account cases. All prior pullfrog threads are resolved and the description matches the diff.
DeepSeek Flash (free via Pullfrog for OSS) | 𝕏
Unify owner validation across project pickers and repository overrides. Preserve EMU usernames in API and auth-status branch-prefix resolution, with regression coverage. Co-authored-by: gon2gon2 <[email protected]>
3e117b6 to
699337d
Compare
|
I corrected a branch-history mistake from my earlier merge that made this PR show 3,068 changed files. Sorry for the noise. The branch is now rebuilt as commit Validation on the rebuilt branch: 386 desktop tests and 5 mobile tests passed, all project typechecks passed, and the changed-code quality gate passed. CI is running again. @gon2gon2 please use the new branch tip for any further testing. Since history was rewritten, preserve any local work before updating your checkout. Please confirm the EMU project flow and full username branch prefix still work in your environment. |
Unify owner validation across project pickers and repository overrides. Preserve EMU usernames in API and auth-status branch-prefix resolution, with regression coverage. Co-authored-by: Neil <[email protected]>

ELI5
If your company uses GitHub Enterprise Managed Users, your login looks like
octocat_acme— GitHub adds_<shortcode>for you. Orca's GitHub Projects view rejected every such login as "not a valid GitHub slug" before asking GitHub anything, so EMU users could not open their own projects. This PR lets_through in non-leading positions, everywhere the owner alphabet is checked.What Changed
src/shared/github/owner-slug.ts(new) — one owner alphabet for the whole app:GITHUB_OWNER_SLUG_RE, theowner/numbershorthand regex, andisGitHubOwnerSlug._is allowed after the first character.src/main/github/project-view/internals.ts,src/main/github/project-view/project-view-reference.ts,src/main/github/github-api-repository-validation.ts— use the shared alphabet instead of local copies.src/renderer/src/components/github-project/project-picker-input.ts— URL path and shorthand both use the shared alphabet (the test file already required renderer parity).mobile/src/tasks/github-project-reference.ts— the fourth copy, found in review; now imports the shared alphabet too.isValidGitHubApiRepository(which had none); EMU cases added to the mobile parser test.src/main/git/git-username.ts(b19d615, found while testing) — the branch-prefix username fromghwent through the same old alphabet:isPlausibleHostedLoginrejectedoctocat_acme, and thegh auth statusfallback then truncated it tooctocat, so worktree branches got the wrong prefix. Both checks now allow_after the first character;git-username.test.tscovers the accepted and rejected shapes, and the auth-status fallback test covers an EMU login end to end.Why
GitHub's rule for ordinary accounts is alphanumerics and single hyphens, which is what the old regex encoded. Enterprise Managed Users are a second, documented login format:
@IDP-USERNAME_SHORT-CODE(https://docs.github.com/en/enterprise-cloud@latest/admin/managing-iam/iam-configuration-reference/username-considerations-for-external-authentication). Every EMU login has exactly one_, never leading.The regexes exist so untrusted
nameWithOwnerdata cannot become an arbitrary REST path._is not a path separator and the leading-character rule is unchanged, so that guarantee holds.Linked Issue
Fixes #20449
Visual Proof
N/A — no UI change; the same paste either resolves or shows the same validation error, only the accepted alphabet differs.
Testing
Root:
vitest runon the four touched test files (shared owner-slug, project-view, github-api-repository-validation, renderer project-picker-input) — 43 passed; fullpnpm test— 8,565 files pass, 9 environment-bound failures unrelated to this change (see checklist). Mobile: fullvitest run— 566 files, 4,663 tests pass.oxlinton the changed files — clean.pnpm typecheck(all projects),pnpm lint(full, incl. ratchets),pnpm run check:code-quality:changed— pass. Mobile:tsc --noEmit,oxlint— pass.Platforms: macOS (arm64). The change is pure string validation with no platform or SSH surface.
I manually tested these changes locally
Automated tests added/updated, or explained why not below
AI Disclosure
Drafted with Claude (Anthropic, Claude Code) from a human-written bug report; the human reviewed the diff and ran the checks.
Author
X: @gonforall
Review
Agent review summary: cross-platform — pure regex, no OS APIs; SSH/remote — no execution-host surface; agents/integrations — GitHub-only code paths, GitLab/Bitbucket validators untouched; performance — anchored regex, same cost; security — leading-character rule and repo reserved names unchanged,
_cannot introduce a path segment; UI — none.Agent skill upstream boundary
docs/reference/agent-skill-sharing-upstream-boundary.mdand copies or mechanically translates no upstream skill-installer source, tests, fixtures, registry entries, path tables, comments, or documentation.Notes
No platform-, remote-, agent-, integration-, or provider-specific behavior beyond GitHub.com / GHES logins.
Checklist
N/Awith reasonpnpm lint,pnpm typecheck,pnpm test, andpnpm buildpass (or CI will cover; local preferred) —pnpm lint,pnpm typecheck(all projects),pnpm run check:code-quality:changed, rootpnpm test(8,565 files pass; the 9 failing files are the cross-version-wire harness needing thev1.4.190tag and the real-Claude-binary integration tests, none undersrc/main/githuborsrc/shared/github) and mobilepnpm test/tsc/oxlint(566 files pass) run locally on macOS arm64;pnpm buildleft to CI'spackagejob