Skip to content

fix(hub): allow visible members to start prototypes - #321

Open
weastler wants to merge 3 commits into
build/hub/newfrom
fix-visible-repository-kickoff
Open

weastler wants to merge 3 commits into
build/hub/newfrom
fix-visible-repository-kickoff

Conversation

@weastler

@weastler weastler commented Nov 20, 2026 •

Copy link
Copy Markdown
Contributor

Why

Signed-in Hub members who can see a repository were told "You do not have permission to create prototypes in this repository." on the Create page, and the brief, template picker, and submit button were disabled. Hub was asking GitHub for write access before letting someone start a prototype. Starting a prototype does not write to the repository: it builds a prompt and hands it to the GitHub Copilot app, or lets the user copy it. GitHub read-only users, Entra-backed members, and Hub administrators with legitimate repository visibility should be able to start one. This follows up the policy discussion on #305.

What changes

Creating a prototype and using Open Copilot App or Copy prompt now require only that the signed-in member can see the repository. This applies to the Default template and to selected templates. Hub still hides repositories a member cannot see, and Hub administrator authority does not grant visibility or GitHub write access.

Pushing a prototype branch and other repository changes, such as registering or managing prototypes and sharing, still require Write, Maintain, or Admin. A read-only member can start a session in the Copilot app, but GitHub may refuse their push until they have write access. Maintain is already treated as write access.

If a member loses access between loading the page and submitting, Hub shows "You do not have permission to create a prototype in this repository." and keeps the brief. If Hub cannot check access, it shows "Hub could not check repository access. Try again." In the mock flows, readers now see Create and Branch from here. The Create page still disables submission if the API reports canCreate: false, so that response field stays meaningful. The server no longer returns false for a visible repository.

flowchart LR
  subgraph Before
    A1[Visible repository] --> B1{GitHub write?}
    B1 -- no --> C1[Create disabled]
    B1 -- yes --> D1[Copilot app or Copy prompt]
  end
  subgraph After
    A2[Visible repository] --> D2[Copilot app or Copy prompt]
    D2 --> E2{Push branch}
    E2 -- Write, Maintain, Admin --> F2[Accepted]
    E2 -- Read, Triage --> G2[Refused by GitHub]
  end
Loading

The ReadOnly Create story showed the old disabled page, which can no longer happen, so it has been removed. The AccessChanged and AccessUnavailable stories now show the two submit-time errors.

Known gaps: this has not been reproduced against a deployed Hub, and the Linux-only tests that read /proc were not run on macOS.

Storybook screenshots

Each screenshot uses the light theme at a 1280×900 viewport. The brief was typed into the page and then submitted.

Hub/Pages/Repositories/Create / Submitted: a member who can see the repository submits a brief and gets the Copilot app handoff.

Create page after submitting a brief, showing the Continue in Copilot app dialog

Hub/Pages/Repositories/Create / Access Changed: access was lost before submitting. The denial is shown and the brief is kept.

Create page showing the permission denial with the brief kept

Hub/Pages/Repositories/Create / Access Unavailable: Hub could not check access. The error is shown and the brief is kept.

Create page showing that Hub could not check repository access

weastler and others added 3 commits November 19, 2026 19:05
Keep repository writes separately authorized while allowing signed-in repository viewers to compose and copy kickoff prompts.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Treat a hidden repository during the Copilot handoff check as a denial,
show Create to mock readers, and align the mock flow documentation.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Align mock Create and Branch from here with the visibility-based kickoff
policy and update navigation tests that still expected readers to lack Create.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
@weastler
weastler requested review from a team and nshki as code owners November 20, 2026 04:31
Copilot AI adaptive review requested due to automatic review settings November 20, 2026 04:31

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🔵 Needs a closer look

Kickoff authorization interacts with GitHub, Entra, administrator sessions, visibility rules, and separate mutation gates, requiring review beyond the limited straightforward-change scope.

No open issues 🎉

What changed in this PR

This PR separates starting a prototype session from repository write access. Following the workflow introduced in #305, signed-in members who can see a repository can prepare prompts and continue in Copilot, while repository mutations remain separately permission-gated.

Changes:

  • Replace write-based handoff checks with repository visibility checks.
  • Enable reader Create and branching flows, with distinct errors for lost access and unavailable access checks.
  • Update regression coverage, Storybook states, and frontend documentation.
File Description
hub/​server/​routes/​api/​repositories/​templates/​index.ts Use visibility for template creation and handoff eligibility.
hub/​server/​routes/​api/​repositories/​templates/​index.test.ts Cover visible members, denied access, provider failures, and revoked sessions.
hub/​server/​routes/​api/​repositories/​templates/​index.db.test.ts Check reader handoffs remain separate from listing management.
hub/​server/​routes/​api/​repositories/​prototypes/​show/​get/​index.ts Allow visible hosted members to start from prototypes.
hub/​server/​routes/​api/​repositories/​prototypes/​show/​get/​index.test.ts Cover reader branching eligibility and visibility failures.
hub/​server/​routes/​api/​product/​template-repository-access/​index.ts Remove the write-based Copilot handoff helper.
hub/​server/​routes/​api/​product/​can-start-prototype-session/​index.ts Add a shared visibility-based session eligibility helper.
hub/​docs/​frontend.md Document reader handoffs and separate mutation permissions.
hub/​client/​pages/​new-prototype-page/​stories.tsx Replace the disabled reader story with submit-time error states.
hub/​client/​hooks/​use-copilot-handoff/​index.ts Make access-check error wording provider-neutral.
hub/​client/​application/​hub/​view-models/​repository-workspace/​index.ts Expose Create navigation in mock reader flows.
hub/​client/​application/​hub/​view-models/​prototype-show-data/​index.ts Enable mock branching independently of write capabilities.
hub/​client/​application/​hub/​routes/​sidebar-consistency.test.tsx Expect Create navigation for readers.
hub/​client/​application/​hub/​routes/​sharing-navigation.test.tsx Preserve Create navigation when sharing access is denied.
hub/​client/​application/​hub/​routes/​session-flow.test.tsx Expect readers to see Branch from here.
hub/​client/​application/​hub/​routes/​real-prototype-index.test.tsx Cover Default and selected-template handoffs without write capabilities.
hub/​client/​application/​hub/​routes/​expanded-flows.test.tsx Check reader handoffs while retaining listing-write denial.
hub/​client/​application/​hub/​requests/​authorize-copilot-handoff/​index.ts Treat hidden-repository responses as handoff denial.
hub/​client/​application/​hub/​requests/​authorize-copilot-handoff/​index.test.ts Distinguish access denial from unavailable checks.
hub/​client/​application/​hub/​mocks/​create-product-store/​index.ts Allow creation from mock template catalogs and details.

Review effort: Balanced (adaptive)

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.

2 participants