Repository navigation
fix(bin): accept Enterprise Managed User GitHub owners in PR URLs - #6910
matthewmoorcroft wants to merge 5 commits into
Conversation
GitHub EMU logins append one "_<short code>" to an ordinary login, such as matthew-moorcroft_data, and the PR URL parser, the static merge poll, and the contributions projection refused them, so the guarded check, merge, poll, and contributions paths could not handle those PRs. Accept exactly one underscore followed by an alphanumeric short code within the 39-character limit, and keep every other invalid owner shape rejected. Co-authored-by: Isaac <no-reply@databricks.com>
|
Speaking as Kun's firstmate (OSS triage, not the captain). Thanks @matthewmoorcroft. Head Contract-class: restore. Main's PR URL parser accepts only letters/digits/hyphens in a GitHub owner, so valid Enterprise Managed User logins such as VISION.md: One captain / Authority (validation tightened around the new form, not loosened into arbitrary underscores) / Scripts / Restart n/a / Delegation / Vendor / Scope: all align. Security review: widens a validation gate carefully with explicit invalid cases ( |
Resolve the PR-URL parser conflicts so Enterprise Managed User owners keep working on top of main's GitHub Enterprise host allowlist: the owner is validated by fm_pr_github_owner_valid, the host by fm_github_host_allowed. The contribution projection's supported_url also accepts the owner suffix. Co-authored-by: Isaac <no-reply@databricks.com>
[Medium impact] The PR appears safe to merge. Reviews (1) · Last reviewed commit: "no-mistakes(document): Point PR URL pars..." · Reviewed by Greptile |
|
Speaking as Kun's firstmate: thanks @matthewmoorcroft for bringing this up to date. The merge with main and the What I checked on Contract-class (my own read, unchanged): restore. The guarded PR check, merge and poll tools already promise GitHub PR URLs, and valid EMU owners were refused. VISION.md: aligns on every rule. Waiting on you for one thing: the no-mistakes attestation in the PR body still binds After that, we run the full suite. The red |
Intent
"A Rebase and update the PR"
Context needed to read it: this was the answer, given in Chartroom on 9 Nov 2026, to a decision about firstmate upstream PR #6910, "fix(bin): accept Enterprise Managed User GitHub owners in PR URLs". The PR makes firstmate's PR tools accept GitHub owners containing an underscore (such as matthew-moorcroft_data); today's main still refuses a URL like https://github.com/matthew-moorcroft_data/personal_management/pull/51. It was opened on 9 Oct from the fork matthewmoorcroft/firstmate, branch fm/fm-pr-url-underscore-owner, head 807866a. It changes bin/fm-pr-lib.sh, bin/fm-pr-poll.sh, bin/fm-contributions.jq and two test files. Checks were 19 of 19 green and the maintainers' triage called it a restore of broken behaviour and an auto-merge candidate once green and clean, but main has since changed bin/fm-pr-lib.sh several times (GitHub Enterprise hosts, PR poll fixes), so GitHub now reports merge conflicts. The option chosen reads: a fresh worker puts the fix on top of current main, resolves the conflicts in the PR-URL code and its tests, and runs it through the full validation pipeline, which updates PR 6910; no new PR, no comments. This answer is the one-task consent to publish this update upstream.
What Changed
bin/fm-pr-lib.shgets a newfm_pr_github_owner_validcheck, andfm_pr_url_parsenow uses it in place of the old regex. It accepts a normal GitHub login (1–39 characters, letters, digits and single inner hyphens). It also accepts that login followed by exactly one_and a 3–8 character alphanumeric enterprise short code, which is the Enterprise Managed User form, e.g.matthew-moorcroft_data. The whole owner must still fit in 39 characters. It still rejects a leading or trailing_, a doubled_, more than one_, and a short code that contains hyphens or has the wrong length.bin/fm-pr-poll.shrepeats the same owner check inline for the github provider. This lets the static poll sidecar accept EMU owners and still reject malformed ones. The owner patterns inbin/fm-contributions.jq(supported_url,canonical_url) and thePR_URL_REinbin/fm-pr-health.shnow allow_in the owner. As a result, EMU-owned PRs are counted as contributions, and a task branch's PR is found by pr-health.pr=metadata and poll sidecar, poll reports merged, and merge targets--repo matthew-moorcroft_data/personal_management. The URL-parser security test gains valid and invalid underscore cases. There are also new tests for contribution counting and pr-health branch discovery. The pr-healthghstub now builds PR URLs from the copy'soriginremote and matches anyrepos/*/pulls/*API path.This pull request and its description were written by Isaac.
Risk Assessment
✅ Low: The change is a narrow, well-bounded widening of the GitHub owner rule. The strict validator (fm_pr_github_owner_valid) matches the old rule exactly for owners without an underscore and adds only the recorded 3-8 character EMU short-code suffix. Its static poll mirror is equivalent. Every strict consumer funnels through fm_pr_url_parse. The looser jq and pr-health regexes stay behind that strict gate, or are charset-only as they were before. Behavioral tests cover parser, check/merge/poll, contributions and branch-discovery paths, and each test fails without the fix.
Testing
I ran the real firstmate CLIs in disposable marked lab homes from fm-lab-home.sh. A local gh forge emulator stood in for github.com, because the active gh account cannot read the private EMU repo and switching accounts would change credential state. On the target, fm-pr-check.sh recorded pr= and pr_head for the EMU URL and armed a byte-identical static poll, and that poll printed "merged" for a merged PR. The base commit refused the same URL with "invalid PR check request". In a 20-owner matrix through fm-pr-check.sh and a 14-owner matrix through the armed poll mirror, all valid short codes were accepted (3 to 8 characters, including matthew-moorcroft_data) and every malformed underscore owner was refused before any forge call. fm-contributions.sh enroll wrote the EMU record on the target, where base refused it. The repo's three new EMU regression tests also passed when run in isolation, including the pr-health branch discovery test that runs the real fm-pr-health.sh. The full suite was not run, the change has no UI surface, and transient test copies and scratch dirs were removed.
gh auth switchwould change th…Evidence: fm-pr-check.sh on the EMU PR #51 URL: target arms the poll, base refuses
Evidence: Adversarial owner matrix (fm-pr-check.sh + armed static poll) and fm-contributions enroll target vs base
Evidence: Targeted security test run (parser matrix + EMU end-to-end record/merge/poll)
Evidence: Targeted pr-health test run (EMU-origin branch PR discovery)
Evidence: Targeted contributions test run (EMU URL canonical in bearings)
Evidence: Target vs base on the EMU URL
Pipeline
Updates from git push no-mistakes
✅ **Intent** - passed
✅ No issues found.
bin/fm-pr-lib.sh- merge conflict rebasing onto origin/maintests/fm-contributions.test.sh- merge conflict rebasing onto origin/main✅ **Review** - passed
✅ No issues found.
✅ **Test** - passed
✅ No issues found.
gh auth switchwould change th…bin/fm-lab-home.sh create <lab>+FM_HOME=<lab> bin/fm-pr-check.sh task-emu https://github.com/matthew-moorcroft_data/personal_management/pull/51(target 19acb96c), with gh on PATH replaced by a local forge emulatorSamefm-pr-check.shinvocation from agit archive bc9370e8 binexport (base/main), to reproduce the original refusalbash <lab>/state/task-emu.check.sh(the armed byte-copy of bin/fm-pr-poll.sh) with forge state OPEN and MERGEDAdversarial owner matrix through the realbin/fm-pr-check.sh(5 accept and 15 reject owners, covering a_b, ab_1, 2- and 9-character suffixes, double/leading/trailing underscores, hyphen-adjacent underscores, the--run and the 39-character limit)Static poll mirror matrix: a rewritten<task>.pr-pollsidecar run through the armed check.sh with forge state=MERGED (4 accept, 10 reject owners)FM_HOME=<lab> bin/fm-contributions.sh enroll emu-task <EMU PR URL>on target vs base bc9370e8tests/fm-pr-check-security.test.shfiltered totest_parser_matrix+test_enterprise_managed_owner_end_to_endtests/fm-pr-health.test.shfiltered totest_enterprise_managed_owner_branch_pr_is_discovered+test_open_pr_replacing_a_closed_one_on_the_same_branch_is_discoveredtests/fm-contributions.test.shfiltered totest_enterprise_managed_owner_is_canonical+test_actor_coverage✅ **Document** - passed
✅ No issues found.
✅ **Push** - passed
✅ No issues found.