Skip to content

feat: platform-default GitHub Copilot connection + first-run AI lockout - #1063

Merged
sabbour merged 1 commit into
devfrom
feat/fre-lockout-screen
Aug 31, 2026
Merged

feat: platform-default GitHub Copilot connection + first-run AI lockout#1063
sabbour merged 1 commit into
devfrom
feat/fre-lockout-screen

Conversation

@sabbour

@sabbour sabbour commented Aug 31, 2026

Copy link
Copy Markdown
Owner

What

Ships the deferred Part A of plan item 10 (github-onboarding-ux-plan.md): a way for a Platform Admin to connect one deployment-wide GitHub Copilot account, plus a first-run lockout screen so the app doesn't run in a half-configured state.

Changes

  • New \PlatformDefaultCopilotBindingService\ — deliberately parallel to (does not modify) the existing project-scoped \ProjectCopilotBindingService. Lets a PlatformAdmin connect one deployment-wide GitHub Copilot account via the existing Copilot App's OAuth flow, with its own isolated callback/state.
  • New singleton \PlatformDefaultCopilotBindingRecord\ + EF migrations (SQLite + Postgres).
  • New PlatformAdmin-gated endpoints: begin / callback / status / disconnect.
  • /api/auth/session\ now reports \�i_configured\ (true if BYOK is configured OR a usable platform-default Copilot connection exists).
  • \App.tsx: signed-in users are blocked behind a setup screen until AI is configured platform-wide — a PlatformAdmin is routed to Platform Settings to fix it, everyone else sees a plain 'contact your administrator' message.
  • Related, tightly-coupled fix found while building this: a signed-in user with zero platform roles now sees a clear 'access denied' message instead of a broken, permission-less shell (this case wasn't handled before).
  • \PlatformSettingsPage.tsx: adds connect/status/disconnect UI for the platform-default Copilot account next to the existing BYOK form.

Verification

  • \dotnet build\ on the full solution: clean, 0 warnings/errors.
  • Targeted backend tests (Auth/PlatformDefaultCopilot/DataMigrator filter): 291 passed, 0 failed (15 pre-existing Postgres-container skips).

  • pm run build\ (web): clean.
  • Targeted frontend tests (App, PlatformSettingsPage, AppShell, SettingsPage, GitHubIdentityBadge): 42 passed, 0 failed.
  • One rubber-duck pass + one code-review pass (mine, done locally before pushing) — no scope creep suggestions taken.

Note on a known, bounded trade-off

The OAuth completion for the platform-default connection does not re-check the caller still holds the PlatformAdmin role at completion time (the project-scoped equivalent does re-check ownership at completion, because project ownership is a persisted, revocable DB row). Platform roles here come from Entra App Role claims, and there is no persisted platform-role-assignment store anywhere in this codebase to re-check against without adding a live Entra Graph call — so this mirrors the codebase's existing trust model for that kind of check. This leaves a narrow (bounded to the ~10-minute OAuth transaction lifetime) race if a PlatformAdmin is demoted mid-flow. Flagging for visibility, not blocking.

Adds the deferred Part A of plan item 10:
- New PlatformDefaultCopilotBindingService (parallel to, does not modify,
  the existing project-scoped ProjectCopilotBindingService): lets a
  PlatformAdmin explicitly connect one deployment-wide GitHub Copilot
  account via a real OAuth flow to the existing Copilot App, isolated
  callback route/cookie/state from the per-project flow.
- New singleton PlatformDefaultCopilotBindingRecord + dual (SQLite +
  Postgres) EF migrations.
- New PlatformAdmin-gated endpoints: begin/callback/status/disconnect.
- /api/auth/session now reports ai_configured (BYOK config OR a usable
  platform-default Copilot binding).
- App.tsx: signed-in users are blocked behind a full-page setup screen
  until AI is configured platform-wide. A PlatformAdmin sees the
  Platform Settings page (to fix it); everyone else sees a plain
  'contact your administrator' message. Also adds a related fix: a
  signed-in user with zero platform roles now sees a clear 'access
  denied' message instead of a broken, permission-less app shell.
- PlatformSettingsPage.tsx: adds a connect/status/disconnect UI for the
  platform-default Copilot account, alongside the existing BYOK form.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot-Session: 20ea1af6-c1fb-441c-8c7d-086f7900fc16
@sabbour
sabbour enabled auto-merge (squash) August 31, 2026 19:31
@sabbour
sabbour merged commit c936f8b into dev Aug 31, 2026
17 checks passed
@sabbour
sabbour deleted the feat/fre-lockout-screen branch August 31, 2026 19:38
sabbour added a commit that referenced this pull request Aug 31, 2026
PR #1063 added new platform-default Copilot docs using the generic phrase
'GitHub OAuth app', which trips the fleet-oauth-surfaces legacy-terminology
guard test. Reworded to 'Copilot App' (matches the rest of the doc's
terminology) with no meaning change.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot-Session: 20ea1af6-c1fb-441c-8c7d-086f7900fc16
sabbour added a commit that referenced this pull request Aug 31, 2026
…cs (#1065)

PR #1063 added new platform-default Copilot docs using the generic phrase
'GitHub OAuth app', which trips the fleet-oauth-surfaces legacy-terminology
guard test (Node toolchain tests were skipped on that PR due to path-based
CI gating, so this wasn't caught until the release promotion PR ran the
full suite). Reworded to 'Copilot App' with no meaning change.

Co-authored-by: sabbour <sabbour@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot-Session: 20ea1af6-c1fb-441c-8c7d-086f7900fc16
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