Skip to content

feat(github): resolve accounts by repository access - #557

Merged
nixuuu merged 9 commits into
feat/github-link-pr-pickerfrom
feat/github-repository-accounts
Nov 12, 2026
Merged

nixuuu merged 9 commits into
feat/github-link-pr-pickerfrom
feat/github-repository-accounts

Conversation

@nixuuu

@nixuuu nixuuu commented Nov 12, 2026 •

Copy link
Copy Markdown
Member

Behavior

GitHub accounts resolve in the gateway from the owner's repository access. A single matching account, including an organization installation, works immediately. Several matches retain the last account used for that repository; otherwise a human account wins over a bot/App, followed by stable login/ID ordering. Optional inline account controls appear only with several accessible accounts.

The resolver serves the Link PR picker, manual URL linking, Create PR, PR reads, branch detection and authenticated release lookups. The repository/installation index is cached for 15 minutes and refreshed by the periodic sweep or an explicit installation re-list. Catalogue changes atomically replace the index, bump access revisions, invalidate private caches and update projections; unchanged re-lists preserve revisions and ETags. Migration 0127 adds the index, account type and catalogue fingerprint. Explicit PAT choices remain supported; connector tokens are never probed automatically. Credentials stay in the gateway.

Create PR starts with owner/repo and head → base, without an empty account separator. Base defaults to the saved thread base when valid, otherwise the repository default, and remains editable. Draft/review controls enable when required fields are present. Distinct messages describe unpublished branches and unpushed commits. No existing push action is exposed by the API, so the copy directs users to git/their agent and refresh. Header controls now truncate long names within the phone dialog. Web/desktop and mobile share the behavior; mobile changes are JavaScript only.

Second layer above #553; ship the complete stack together into dev with gh stack.

Verification

  • Rebased the stack with gh stack rebase onto d3c7e0191, retaining dev migrations 0124–0126 and this migration at 0127. Regenerated the additive contracts. bun install and bun run gen:check passed.
  • Focused loopback GitHub/gateway/database tests: 67 pass, 0 fail, 412 assertions. After the final rebase: 42 pass, 0 fail, 237 assertions across picker, account-resolution and migration suites. Covers one organization account, several accounts with one accessible match, several accessible accounts, deterministic human/bot priority, remembered choice across restart, no access, foreign owner denial, installation changes, unchanged re-lists and periodic refresh. Also covers default/editable base, distinct publication errors, revoke/reconnect fences, branch discovery and migration durability.
  • CI exposed the inherited-access upgrade fixture applying a later migration before 0125. The staged migration fix is now on dev and retained by the rebase; the focused test passes. Scoped oxlint and oxfmt passed for the phone-header fix. No full local check:tmp or real GitHub API calls were run. Remote CI supplies full static/build/test coverage; final status is in the handoff.
  • Real browser fixtures: one account has no account step or switcher; several accessible accounts show an optional compact switcher with remembered selection. Verified missing-account/Connect GitHub, inaccessible-repo/Manage access, rate-limit reset/retry, unavailable service, non-GitHub URL fallback and empty repository. Create PR immediately shows repository, head and default dev, supports editing base, enables Draft with agent and Review after entering a title, and precisely reports unpublished/unpushed branches. No model invocation or real GitHub mutation was made.
  • Reviewed light/dark, desktop 1280×800 and phone 390×844, long titles/logins/head/base branches, truncation and overlay seams. Browser-discovered base overflow was fixed and rechecked: dialog scroll width equals client width on phone. EAS CLI 27.4.1 production fingerprints equal dev: iOS 6ddec9ef559ee0095ac33e94ff9418a942053b17, Android 5f6eae3ab278f1cd543e9ed763f923a319b65ec9. Native inputs are unchanged. Browser and fixture processes were stopped by PID.

Copy audit — docs/copy.md §8

  • “Choose a GitHub account to check the published branch.” → removed. Repository-access resolution replaces that blocking step; an optional account control appears only with several matches.
  • Leading separator and empty base → owner/repo, head → base. Base branch names the editable control; Base unavailable identifies the field when access is missing.
  • Generic access failures → No connected GitHub account can access {repository}., with Manage access or Connect GitHub, and refresh/retry where relevant. Repository names are data; credential/protocol details are absent.
  • Vague publication warning → This branch is not published on GitHub. Push it with git or your agent, then refresh. / This branch has unpushed commits. Push them with git or your agent, then refresh. The empty panel remains No pull requests yet plus its two actions, without a hint paragraph.
  • Sentence case, glossary, verb-led actions and accessible labels were checked. No humor or new glossary terms. Real-browser checks covered short/typical/long text, themes, widths, truncation and enabled/blocked controls.

@nixuuu
nixuuu added this pull request to stack #558 November 12, 2026 08:35
@nixuuu
nixuuu force-pushed the feat/github-repository-accounts branch from ce85023 to 2a9d085 Compare November 12, 2026 08:36
@nixuuu
nixuuu force-pushed the feat/github-repository-accounts branch 2 times, most recently from c0ae5ba to 2aedf51 Compare November 12, 2026 12:25
@nixuuu
nixuuu force-pushed the feat/github-repository-accounts branch from 4cef5d1 to d9fad4f Compare November 12, 2026 12:44
@nixuuu
nixuuu marked this pull request as ready for review November 12, 2026 12:45
@nixuuu
nixuuu merged commit 354146b into dev Nov 12, 2026
11 checks passed
@nixuuu
nixuuu deleted the feat/github-repository-accounts branch November 12, 2026 12:59
nixuuu added a commit that referenced this pull request Nov 12, 2026
## Behavior

“Link pull request” opens a compact repository picker on web/desktop and
a sheet on mobile. Open PRs are ordered by last update, with matching
head branches first and the resolved user's PRs next. Rows include state
icons, number, title, branches, login, updated time and linked status.
Selecting a row links immediately and keeps the picker open for
additional links.

Search matches numbers, titles, branches and authors. Numeric input and
PR URLs retain manual linking, including another repository by URL.
Open/All, incremental scroll paging and immediate skeletons use shared
controls. Sparse searches scan at most three cached upstream pages per
request and offer **Load more** to continue.

The additive owner-scoped RPC resolves the repository from the thread
workspace. It uses the existing GitHub client, account budgets, short
cache, single-flight and REST ETags/304. Signed cursors bind owner,
thread, repository, account/access revisions and filters. Tokens remain
in the gateway. Missing account, repository access, rate limits and
non-GitHub remotes have separate states and actions.

The empty panel contains **No pull requests yet** and its two actions,
without the account/manual-link explanation. Layer #557 provides
automatic repository-access account resolution and fixes Create PR. Ship
both layers together into `dev` with `gh stack`.

## Verification

- Rebased with `gh stack rebase` onto `d3c7e0191`. Migrations 0124–0126
remain from dev; repository access stays 0127. Generated contract
conflicts were regenerated with `bun run gen`.
- `bun install` and `bun run gen:check` passed. Focused gateway/database
suite: 67 tests passed, 412 assertions. After the final rebase, 42
focused tests passed again, 237 assertions, covering picker, account
resolution and migration stages. Coverage includes listing/pinning,
paging, number/title/branch/author search, ETag/304, each error, index
refresh, ownership, creation, revocation and discovery. No real GitHub
API requests, web UI test suites or full local `check:tmp` were run.
- Real browser review used a disposable gateway, worker and loopback
GitHub fixtures. Verified branch/user priority, draft/open/merged/closed
icons, search, Open/All, scroll paging, immediate linking, linked-row
disabling, multi-link and URL entry. Row DOM identities stayed unchanged
on hover.
- Reviewed light/dark at desktop 1280×800 and phone 390×844, including
long titles, branches and logins. Verified empty repo, missing
account/Connect GitHub, no access/Manage access, rate-limit reset,
unavailable service/retry and non-GitHub URL fallback. One account has
no switcher; several show an optional switcher and preserve its
selection after reopening. The empty panel has no hint paragraph.
- EAS CLI 27.4.1 production fingerprints match dev exactly: iOS
`6ddec9ef559ee0095ac33e94ff9418a942053b17`; Android
`5f6eae3ab278f1cd543e9ed763f923a319b65ec9`. Mobile changes are
JavaScript only. The final rebase did not change native inputs. Browser
and fixture processes were stopped by PID. Final remote CI state is
reported in the handoff.

## Copy audit — docs/copy.md §8

- URL-only linking → **Find a pull request**, **Open / All**, **Link by
URL**, **Load more**. Labels use sentence case and concrete actions.
- “Choose a repository account or link a pull request manually to match
this branch.” → removed. The empty panel contains **No pull requests
yet**, **Link pull request** and **Create pull request**.
- **Current branch**, **Yours** and **Linked** identify
priority/availability. State icons have accessible labels; metadata does
not rely on color alone.
- Distinct account/access/request-limit/connection errors offer
**Connect GitHub**, **Manage access**, **Retry** or the reset time. No
token/protocol details, humor or new glossary terms appear.
- Short, typical and long rendered text, truncation, reserved badge
space, themes and widths were reviewed in the real browser. Account
controls appear only for several accessible accounts.
nixuuu added a commit that referenced this pull request Nov 12, 2026
The same thread now exposes its home connector access and scheduled
tasks from either linked computer. A dedicated display DTO omits
credentials, headers, endpoints and account errors. Connector grants,
schedule creation, edits and cancellation run at home with owner and
revision checks. Worker grants affect every thread on that worker;
inherited All workers and account administration show a compact
home-management hint.

Verified panel responses survive a restart and remain visible as stale
when the home or panel read is unavailable. The archived sidebar now
pages local rows together with committed linked metadata: the previous 7
vs 31 counts came from intentionally local-only archive reads.

The three-gateway move regression now reconnects with a saved thread
cursor and requires a removal from the old home. The runtime exemption
for mirror subscriptions and range acknowledgments is already present in
the rebased dev branch; individual thread operations still follow their
redirects, and ACKs retain peer/subscription/cursor validation.

Gateway-to-gateway regression coverage exercises safe metadata, schedule
create/list/edit/cancel, home enforcement after grant changes, owner
isolation, cached stale reads, restart/unlink and archive
totals/pagination. Mobile changes are JavaScript/TypeScript only; native
configuration and dependencies are unchanged.

Validation:
- `bun install`, `bun run gen:check`, package-db typecheck and
changed-file oxfmt/oxlint passed. No full local `check:tmp` was run, as
requested; CI runs the full checks and test shards.
- Focused gateway-to-gateway panel tests, schema and upgrade tests
passed. The three-gateway move regression passed 20 consecutive runs.
After rebasing onto migration 0126, the panel/schema/inherited-access
tests passed; the staged sync upgrade exposed an ordering assumption,
was repaired and passed its focused rerun (17 assertions).
- Real-browser review used two linked gateways in light/dark at desktop
and phone widths. Both views show Connectors and Scheduled tasks. Remote
grant revoke/restore was reflected at home; remote schedule
create/edit/cancel worked. Disconnecting home retained connectors and
schedules with explicit stale/unreachable text and disabled actions.
Both archive counts were 38 (7 + 31), including offline. Short, typical
and long labels remained readable without horizontal overflow; removed a
duplicate offline hint that compressed schedule rows on phones.
- Native fingerprints match the tested dev base (`a79d316c`) for both
platforms: iOS `6ddec9ef559ee0095ac33e94ff9418a942053b17`; Android
`5f6eae3ab278f1cd543e9ed763f923a319b65ec9`. Mobile changes remain JS/TS
only. Subsequent rebases include JS/TS-only mobile changes from dev;
fresh CI runs on the final head.

Copy audit (§8): hidden sections → visible Connectors and Scheduled
tasks; Manage → scoped connector-access dialog with “Changes apply to
every thread on this worker.” This states the grant's actual scope.
Stale metadata → explicit last-known-details status; account-wide
changes → “Manage accounts on <computer>”. New actions use verbs,
sentence case and text status cues; no humorous copy. Existing controls
provide keyboard/focus behavior and name truncation. Browser review
covered short, typical and long names in light/dark at desktop and phone
widths, including offline states and dialog scrolling.

Related: #543, #539

Migration coordination: rebased onto `580a4815`, including #562 = 0124,
#547 = 0125, #560 = 0126 and #557 = 0127. This PR registers
`0128_thread_panel_cache`; the loader and schema expectations list 0124
through 0128 in order. The staged thread-sync upgrade test reads the
migration tail dynamically after the explicit 0126 stage, including 0127
and 0128, checks that durable sync state survives, and verifies that
repeating the full migration is a no-op. It does not assume 0128 is the
latest migration. Focused schema and staged/inherited-access upgrade
tests passed again after this rebase (25 tests, 107 assertions); all 6
remote-panel integration tests also passed (63 assertions). `bun
install` and `gen:check` passed. An initial panel test launch resolved a
workspace package to another checkout; refreshing installation corrected
the local alias before the successful rerun.
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