Repository navigation
fix(hub): repair mention search, prompt copying, and Inbox checks - #322
Open
arniebradfo wants to merge 7 commits into
Open
arniebradfo wants to merge 7 commits into
arniebradfo wants to merge 7 commits into
Conversation
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Contributor
There was a problem hiding this comment.
🟡 Changes recommended
Required canvas extension assets were not rebuilt, and unresolved mention filtering and Enter handling can insert the wrong collaborator or submit unfinished replies.
9 open issues
Committed extension assets are out of date · New Exact collaborator matches fail at the search limit · New Enter submits the reply while mention lookup is pending · New Canvas mention loader ignores the query · New Superseded mention searches keep consuming API quota · New Stale unread count can hide newly arrived notices · New Copy-instruction selection is not covered by the fixture · New Move the duplicated warning into shared continuation copy · New Restore coverage for Copilot mode on template details · New
What changed in this PR
Repairs Hub’s mention search, prompt-copying flow, and Inbox permission checks, addressing #318, #317, and #315.
Changes:
- Searches mentions using the typed login and ignores outdated responses.
- Lets repository viewers copy kickoff prompts, including after a denied Copilot handoff.
- Shares overlapping GitHub permission checks, scopes single-notice operations, and updates Inbox count handling.
| File | Description |
|---|---|
hub/server/routes/api/review-comments/create-review-realtime-access/index.ts |
Rechecks the session after authorization. |
hub/server/routes/api/review-comments/collaboration.db.test.ts |
Covers scoped Inbox checks and access revocation. |
hub/server/routes/api/repositories/templates/index.ts |
Offers prompt copying to repository viewers. |
hub/server/routes/api/repositories/templates/index.db.test.ts |
Covers viewer access and handoff fallback. |
hub/server/routes/api/product/create-product-route-dependencies/index.ts |
Uses read checks and rechecks repository visibility. |
hub/server/repositories/review-comments/inbox-queries/index.ts |
Filters repository checks by notice ID. |
hub/server/integrations/github/create-review-directory/types.ts |
Defines the read-permission check. |
hub/server/integrations/github/create-review-directory/index.ts |
Shares in-progress permission checks. |
hub/server/integrations/github/create-review-directory/index.test.ts |
Covers shared checks, revocation, and renamed users. |
hub/server/domains/review-comments/create-review-inbox/index.ts |
Scopes notice operations to their repository. |
hub/docs/websockets.md |
Documents overlapping permission checks. |
hub/docs/review-collaboration.md |
Documents mention search and Inbox responses. |
hub/docs/frontend.md |
Documents viewer copying and handoff fallback. |
hub/client/utils/notification/schemas.ts |
Makes update-response unread counts optional. |
hub/client/utils/notification/read-updates.ts |
Adds timing to read-change events. |
hub/client/pages/replica-browse-page/stories.tsx |
Adds viewer-copy and denied-handoff stories. |
hub/client/pages/replica-browse-page/index.tsx |
Offers template prompt copying after denial. |
hub/client/pages/replica-browse-page/index.test.tsx |
Covers template prompt-copy fallback. |
hub/client/pages/notifications-page/stories.tsx |
Updates the Inbox response fixture. |
hub/client/pages/new-prototype-page/types.ts |
Adds copy-specific prompt instructions. |
hub/client/pages/new-prototype-page/stories.tsx |
Adds viewer-copy and denied-handoff stories. |
hub/client/pages/new-prototype-page/index.tsx |
Preserves briefs and offers copy fallback. |
hub/client/pages/new-prototype-page/index.test.tsx |
Covers copying after handoff denial. |
hub/client/hooks/use-notification-inbox/index.ts |
Coordinates read updates and count refreshes. |
hub/client/hooks/use-notification-inbox/index.test.tsx |
Covers overlapping count and read responses. |
hub/client/hooks/use-mention-source/context.ts |
Adds query and cancellation arguments. |
hub/client/hooks/use-copilot-handoff/index.ts |
Supports an explicit copy fallback. |
hub/client/components/mention-input/stories.tsx |
Adds a matching-collaborator story. |
hub/client/components/mention-input/index.tsx |
Loads suggestions for the current query. |
hub/client/components/mention-input/index.test.tsx |
Covers later collaborators and stale responses. |
hub/client/application/hub/view-models/product-new-data/index.ts |
Separates Copilot and copy instructions. |
hub/client/application/hub/screens/prototype-screen/index.tsx |
Sends mention queries and cancellation signals. |
hub/client/application/hub/screens/prototype-screen/index.test.tsx |
Verifies query forwarding to the API. |
hub/client/application/hub/routes/product-new/index.tsx |
Enables copy fallback for Create. |
hub/client/application/hub/routes/product-browse/index.tsx |
Enables copy fallback for templates. |
hub/client/application/hub/requests/authorize-copilot-handoff/index.ts |
Recognizes explicitly authorized copy fallback. |
hub/client/application/hub/requests/authorize-copilot-handoff/index.test.ts |
Covers fallback authorization boundaries. |
hub/client/application/hub/requests/acknowledge-inbox-activity/index.ts |
Includes read-start timing in notifications. |
Review effort: Max (adaptive)
Comment on lines
+56
to
+59
| void source.load(query, request.signal).then( | ||
| (candidates) => { | ||
| if (!request.signal.aborted) | ||
| setResult({ source, query, retry, candidates, failed: false }) |
Comment on lines
+68
to
+69
| url.searchParams.set("q", query) | ||
| const { candidates } = await requestJson(url, MENTION_CANDIDATES_SCHEMA, { signal }) |
Comment on lines
+39
to
+42
| const current = | ||
| result?.source === source && result.query === query && result.retry === retry ? result : null | ||
| const failed = current?.failed | ||
| const waiting = current === null |
| result?.source === source && result.query === query && result.retry === retry ? result : null | ||
| const failed = current?.failed | ||
| const waiting = current === null | ||
| const suggestions = current?.candidates.slice(0, 8) ?? [] |
Comment on lines
+53
to
+56
| const request = new AbortController() | ||
| const timer = window.setTimeout(() => { | ||
| setLoading(true) | ||
| void source | ||
| .load() | ||
| .then( | ||
| (people) => { | ||
| if (active) setResult({ source, candidates: people, failed: false }) | ||
| }, | ||
| () => { | ||
| if (active) setResult({ source, candidates: [], failed: true }) | ||
| }, | ||
| ) | ||
| .finally(() => { | ||
| if (active) setLoading(false) | ||
| }) | ||
| setResult(null) | ||
| void source.load(query, request.signal).then( |
Comment on lines
+192
to
+195
| const delta = current?.read === saved.read ? 0 : saved.read ? -1 : 1 | ||
| const count = updateCount | ||
| ? (saved.unreadCount ?? Math.max(0, unreadCount + delta)) | ||
| : unreadCount |
| } | ||
|
|
||
| describe("NewPrototypePage()", () => { | ||
| it("offers a deliberate copy when fresh authorization denies Copilot but still allows viewing", async () => { |
| <HubToast title={copy.copiedLabel} /> | ||
| {handoffUnavailable && !submissionDisabled ? ( | ||
| <HubAlert | ||
| title="Copilot isn’t available for this repository. You can still copy the prompt." |
Comment on lines
258
to
+259
| permission.mockResolvedValue("write") | ||
| expect(await (await read()).json()).toMatchObject({ | ||
| expect(await (await read("/create/permission")).json()).toMatchObject({ canCreate: true }) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.



Why
Review mentions could miss collaborators outside the first batch. Viewing a repository was not enough to copy a prototype prompt, even though copying writes nothing. Live review and Inbox also made more GitHub permission requests than they needed.
Addresses #318, #317, and #315.
What changes
Mention suggestions search for the login you type and ignore older responses. Signed-in repository viewers can copy a kickoff prompt from Create or a saved template. If the fresh GitHub write-permission check prevents a Copilot handoff, viewers who still have repository access keep their brief and can copy it.
Hub shares overlapping GitHub permission checks for the same user and repository without caching the result. Opening or updating one Inbox notice checks only its repository. The Inbox list still verifies access and returns the total unread count, even when a badge refresh overlaps a read change.
Storybook screenshots
Components/Mention input — Matching Collaborator (Light, 1440 × 900)
Hub/Pages/Repositories/Create — Copy Prompt As Viewer (Light, 1440 × 900)
Hub/Pages/Replica Browse — Copy Template Prompt As Viewer (Light, 1440 × 900)
Hub/Pages/Repositories/Create — Copy After Handoff Denied (Light, 1440 × 900)
Hub/Pages/Replica Browse — Copy Template After Handoff Denied (Light, 1440 × 900)
Hub/Pages/Notifications — Cached Refresh (Light, 1440 × 900)
Existing mention and local Create states
Components/Mention input — People (Light, 1440 × 900)
Components/Mention input — Plain Text (Light, 1440 × 900)
Hub/Pages/Repositories/Create — Local (Light, 1440 × 900)