Skip to content

fix(canvas): match Hub share link contract - #510

Closed
alliscode wants to merge 3 commits into
build/hub/newfrom
alliscode-canvas-share-contract-fix
Closed

alliscode wants to merge 3 commits into
build/hub/newfrom
alliscode-canvas-share-contract-fix

Conversation

@alliscode

@alliscode alliscode commented Dec 3, 2026 •

Copy link
Copy Markdown
Contributor

Agent assessment

Self-reported assessment, not an independent review.

Assessed revision: a5c8ea7dabf362c032630e73931b45a89f1dfa18

Dimension Assessment Rationale
Change confidence 8.5/10 ↑ On this head, after merging the updated base: extension tests 502/502, affected Hub unit tests 104/104, typecheck, lint and asset freshness all pass.
↑ Share-link DB tests passed 8/8 before the merge; the merge did not change those files.
↑ New tests reject reader links on other origins and keep control settings off reader links.
↓ Not tested against a deployed Hub or the HTTPS public reader.
↓ CI for this head had not finished when assessed.
Diagnosis confidence 9.5/10 ↑ Hub's routes return UUID string IDs and /shared/ or /s/ URLs; the extension parsed IDs as integers and accepted only /share/ URLs.
Evidence fit 9/10 ↑ The mismatch matches the reported failure to create, open and revoke links against the current Hub.
↓ No production trace was inspected.

Why

The Copilot canvas extension was written for the earlier Rails Hub. The current Hub identifies share links by UUID strings and returns their addresses as /shared/<uuid> on Hub or /s/<uuid> on the public-sharing reader. When public exports are off, a link's URL is null. The extension still expected numeric IDs and /share/<uuid> addresses, so it rejected Hub's responses and could not open or revoke links.

What changes

The extension now accepts share-link IDs as UUID strings, while repository IDs, prototype IDs and Build numbers stay integers. It accepts link addresses only on Hub's own origin (/shared/<uuid>) or on the public reader origin that /api/canvas/prototype now reports as publicShareOrigin (/s/<uuid>), and only when the last path segment matches the link's ID. Revoking a link reports Hub's revoked or revoking result instead of a yes/no flag.

The canvas share page now shows each link's export state:

  • With exports turned off, a link has no address. It is still listed and can be revoked, but it can't be copied or opened.
  • A link whose public copy is being prepared, or failed to prepare, can't be opened until it is ready. If it failed, the page asks you to delete it and create a new one.
  • A link being updated keeps working and says that it still uses its previous settings.
  • A link that is being turned off can't be opened or revoked again.

The public reader drops query parameters when it redirects, so Include current control settings applies only to Hub /shared/ links. Reader links stay unchanged and the page says so.

flowchart LR
  subgraph Before
    A[Hub returns id: UUID, url: /shared/... or /s/... or null] --> B[Extension expects numeric id and /share/ URL] --> C[Request rejected]
  end
  subgraph After
    D[Hub returns id: UUID, url: /shared/... or /s/... or null] --> E[Extension checks UUID and allowed origin and path] --> F[List, open, copy or revoke by export state]
  end
Loading

hub/docs/prototype-canvas.md now describes this contract. The stories use the new link fixtures and add Export states and Control Settings Reader Link stories. No stories were removed.

Storybook screenshots

Every story in Prototype canvas/Share links page is included, because the page component and its shared link fixture both changed. Prototype canvas/Publication example is limited to the two stories that open the share panel. All captures come from this head's Storybook build at 1024 px wide and full content height, with the share panel open in the Publication example stories.

Prototype canvas/Share links page, Light, 1024 px wide (36 stories)

Prototype canvas/Share links page / Empty, Light, 1024 px wide

Prototype canvas/Share links page / Empty, Light, 1024 px wide

Prototype canvas/Share links page / Thirty Day Maximum, Light, 1024 px wide

Prototype canvas/Share links page / Thirty Day Maximum, Light, 1024 px wide

Prototype canvas/Share links page / Internal Only, Light, 1024 px wide

Prototype canvas/Share links page / Internal Only, Light, 1024 px wide

Prototype canvas/Share links page / Internal Url Unavailable, Light, 1024 px wide

Prototype canvas/Share links page / Internal Url Unavailable, Light, 1024 px wide

Prototype canvas/Share links page / Sharing Disabled, Light, 1024 px wide

Prototype canvas/Share links page / Sharing Disabled, Light, 1024 px wide

Prototype canvas/Share links page / Policy Changed, Light, 1024 px wide

Prototype canvas/Share links page / Policy Changed, Light, 1024 px wide

Prototype canvas/Share links page / Access Changed, Light, 1024 px wide

Prototype canvas/Share links page / Access Changed, Light, 1024 px wide

Prototype canvas/Share links page / Single, Light, 1024 px wide

Prototype canvas/Share links page / Single, Light, 1024 px wide

Prototype canvas/Share links page / Export States, Light, 1024 px wide

Prototype canvas/Share links page / Export States, Light, 1024 px wide

Prototype canvas/Share links page / Two Builds, Light, 1024 px wide

Prototype canvas/Share links page / Two Builds, Light, 1024 px wide

Prototype canvas/Share links page / Multiple, Light, 1024 px wide

Prototype canvas/Share links page / Multiple, Light, 1024 px wide

Prototype canvas/Share links page / Many Links, Light, 1024 px wide

Prototype canvas/Share links page / Many Links, Light, 1024 px wide

Prototype canvas/Share links page / Previous Build, Light, 1024 px wide

Prototype canvas/Share links page / Previous Build, Light, 1024 px wide

Prototype canvas/Share links page / Control Settings, Light, 1024 px wide

Prototype canvas/Share links page / Control Settings, Light, 1024 px wide

Prototype canvas/Share links page / Control Settings Warning, Light, 1024 px wide

Prototype canvas/Share links page / Control Settings Warning, Light, 1024 px wide

Prototype canvas/Share links page / Control Settings Matching Build, Light, 1024 px wide

Prototype canvas/Share links page / Control Settings Matching Build, Light, 1024 px wide

Prototype canvas/Share links page / Control Settings Uncommitted Changes, Light, 1024 px wide

Prototype canvas/Share links page / Control Settings Uncommitted Changes, Light, 1024 px wide

Prototype canvas/Share links page / Control Settings Unknown Status, Light, 1024 px wide

Prototype canvas/Share links page / Control Settings Unknown Status, Light, 1024 px wide

Prototype canvas/Share links page / Loading, Light, 1024 px wide

Prototype canvas/Share links page / Loading, Light, 1024 px wide

Prototype canvas/Share links page / Failed, Light, 1024 px wide

Prototype canvas/Share links page / Failed, Light, 1024 px wide

Prototype canvas/Share links page / Unknown Outcome, Light, 1024 px wide

Prototype canvas/Share links page / Unknown Outcome, Light, 1024 px wide

Prototype canvas/Share links page / Fresh Authorization Required, Light, 1024 px wide

Prototype canvas/Share links page / Fresh Authorization Required, Light, 1024 px wide

Prototype canvas/Share links page / Creating, Light, 1024 px wide

Prototype canvas/Share links page / Creating, Light, 1024 px wide

Prototype canvas/Share links page / Created, Light, 1024 px wide

Prototype canvas/Share links page / Created, Light, 1024 px wide

Prototype canvas/Share links page / Disconnected, Light, 1024 px wide

Prototype canvas/Share links page / Disconnected, Light, 1024 px wide

Prototype canvas/Share links page / No Build, Light, 1024 px wide

Prototype canvas/Share links page / No Build, Light, 1024 px wide

Prototype canvas/Share links page / Insufficient Permission, Light, 1024 px wide

Prototype canvas/Share links page / Insufficient Permission, Light, 1024 px wide

Prototype canvas/Share links page / Permission Unknown, Light, 1024 px wide

Prototype canvas/Share links page / Permission Unknown, Light, 1024 px wide

Prototype canvas/Share links page / Expired Link, Light, 1024 px wide

Prototype canvas/Share links page / Expired Link, Light, 1024 px wide

Prototype canvas/Share links page / Never Expires, Light, 1024 px wide

Prototype canvas/Share links page / Never Expires, Light, 1024 px wide

Prototype canvas/Share links page / Created Link Recovery, Light, 1024 px wide

Prototype canvas/Share links page / Created Link Recovery, Light, 1024 px wide

Prototype canvas/Share links page / Refreshing Existing Links, Light, 1024 px wide

Prototype canvas/Share links page / Refreshing Existing Links, Light, 1024 px wide

Prototype canvas/Share links page / Control Settings Saving, Light, 1024 px wide

Prototype canvas/Share links page / Control Settings Saving, Light, 1024 px wide

Prototype canvas/Share links page / Control Settings Failed, Light, 1024 px wide

Prototype canvas/Share links page / Control Settings Failed, Light, 1024 px wide

Prototype canvas/Share links page / Invalid Label, Light, 1024 px wide

Prototype canvas/Share links page / Invalid Label, Light, 1024 px wide

Prototype canvas/Share links page / Control Settings Reader Link, Light, 1024 px wide

Prototype canvas/Share links page / Control Settings Reader Link, Light, 1024 px wide

Prototype canvas/Publication example, Light, 1024 px wide (2 stories)

Prototype canvas/Publication example / Share Management, Light, 1024 px wide

Prototype canvas/Publication example / Share Management, Light, 1024 px wide

Prototype canvas/Publication example / Narrow Share Management, Light, 1024 px wide

Prototype canvas/Publication example / Narrow Share Management, Light, 1024 px wide

Prototype canvas/Share links page, Dark, 1024 px wide (36 stories)

Prototype canvas/Share links page / Empty, Dark, 1024 px wide

Prototype canvas/Share links page / Empty, Dark, 1024 px wide

Prototype canvas/Share links page / Thirty Day Maximum, Dark, 1024 px wide

Prototype canvas/Share links page / Thirty Day Maximum, Dark, 1024 px wide

Prototype canvas/Share links page / Internal Only, Dark, 1024 px wide

Prototype canvas/Share links page / Internal Only, Dark, 1024 px wide

Prototype canvas/Share links page / Internal Url Unavailable, Dark, 1024 px wide

Prototype canvas/Share links page / Internal Url Unavailable, Dark, 1024 px wide

Prototype canvas/Share links page / Sharing Disabled, Dark, 1024 px wide

Prototype canvas/Share links page / Sharing Disabled, Dark, 1024 px wide

Prototype canvas/Share links page / Policy Changed, Dark, 1024 px wide

Prototype canvas/Share links page / Policy Changed, Dark, 1024 px wide

Prototype canvas/Share links page / Access Changed, Dark, 1024 px wide

Prototype canvas/Share links page / Access Changed, Dark, 1024 px wide

Prototype canvas/Share links page / Single, Dark, 1024 px wide

Prototype canvas/Share links page / Single, Dark, 1024 px wide

Prototype canvas/Share links page / Export States, Dark, 1024 px wide

Prototype canvas/Share links page / Export States, Dark, 1024 px wide

Prototype canvas/Share links page / Two Builds, Dark, 1024 px wide

Prototype canvas/Share links page / Two Builds, Dark, 1024 px wide

Prototype canvas/Share links page / Multiple, Dark, 1024 px wide

Prototype canvas/Share links page / Multiple, Dark, 1024 px wide

Prototype canvas/Share links page / Many Links, Dark, 1024 px wide

Prototype canvas/Share links page / Many Links, Dark, 1024 px wide

Prototype canvas/Share links page / Previous Build, Dark, 1024 px wide

Prototype canvas/Share links page / Previous Build, Dark, 1024 px wide

Prototype canvas/Share links page / Control Settings, Dark, 1024 px wide

Prototype canvas/Share links page / Control Settings, Dark, 1024 px wide

Prototype canvas/Share links page / Control Settings Warning, Dark, 1024 px wide

Prototype canvas/Share links page / Control Settings Warning, Dark, 1024 px wide

Prototype canvas/Share links page / Control Settings Matching Build, Dark, 1024 px wide

Prototype canvas/Share links page / Control Settings Matching Build, Dark, 1024 px wide

Prototype canvas/Share links page / Control Settings Uncommitted Changes, Dark, 1024 px wide

Prototype canvas/Share links page / Control Settings Uncommitted Changes, Dark, 1024 px wide

Prototype canvas/Share links page / Control Settings Unknown Status, Dark, 1024 px wide

Prototype canvas/Share links page / Control Settings Unknown Status, Dark, 1024 px wide

Prototype canvas/Share links page / Loading, Dark, 1024 px wide

Prototype canvas/Share links page / Loading, Dark, 1024 px wide

Prototype canvas/Share links page / Failed, Dark, 1024 px wide

Prototype canvas/Share links page / Failed, Dark, 1024 px wide

Prototype canvas/Share links page / Unknown Outcome, Dark, 1024 px wide

Prototype canvas/Share links page / Unknown Outcome, Dark, 1024 px wide

Prototype canvas/Share links page / Fresh Authorization Required, Dark, 1024 px wide

Prototype canvas/Share links page / Fresh Authorization Required, Dark, 1024 px wide

Prototype canvas/Share links page / Creating, Dark, 1024 px wide

Prototype canvas/Share links page / Creating, Dark, 1024 px wide

Prototype canvas/Share links page / Created, Dark, 1024 px wide

Prototype canvas/Share links page / Created, Dark, 1024 px wide

Prototype canvas/Share links page / Disconnected, Dark, 1024 px wide

Prototype canvas/Share links page / Disconnected, Dark, 1024 px wide

Prototype canvas/Share links page / No Build, Dark, 1024 px wide

Prototype canvas/Share links page / No Build, Dark, 1024 px wide

Prototype canvas/Share links page / Insufficient Permission, Dark, 1024 px wide

Prototype canvas/Share links page / Insufficient Permission, Dark, 1024 px wide

Prototype canvas/Share links page / Permission Unknown, Dark, 1024 px wide

Prototype canvas/Share links page / Permission Unknown, Dark, 1024 px wide

Prototype canvas/Share links page / Expired Link, Dark, 1024 px wide

Prototype canvas/Share links page / Expired Link, Dark, 1024 px wide

Prototype canvas/Share links page / Never Expires, Dark, 1024 px wide

Prototype canvas/Share links page / Never Expires, Dark, 1024 px wide

Prototype canvas/Share links page / Created Link Recovery, Dark, 1024 px wide

Prototype canvas/Share links page / Created Link Recovery, Dark, 1024 px wide

Prototype canvas/Share links page / Refreshing Existing Links, Dark, 1024 px wide

Prototype canvas/Share links page / Refreshing Existing Links, Dark, 1024 px wide

Prototype canvas/Share links page / Control Settings Saving, Dark, 1024 px wide

Prototype canvas/Share links page / Control Settings Saving, Dark, 1024 px wide

Prototype canvas/Share links page / Control Settings Failed, Dark, 1024 px wide

Prototype canvas/Share links page / Control Settings Failed, Dark, 1024 px wide

Prototype canvas/Share links page / Invalid Label, Dark, 1024 px wide

Prototype canvas/Share links page / Invalid Label, Dark, 1024 px wide

Prototype canvas/Share links page / Control Settings Reader Link, Dark, 1024 px wide

Prototype canvas/Share links page / Control Settings Reader Link, Dark, 1024 px wide

Prototype canvas/Publication example, Dark, 1024 px wide (2 stories)

Prototype canvas/Publication example / Share Management, Dark, 1024 px wide

Prototype canvas/Publication example / Share Management, Dark, 1024 px wide

Prototype canvas/Publication example / Narrow Share Management, Dark, 1024 px wide

Prototype canvas/Publication example / Narrow Share Management, Dark, 1024 px wide

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

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.

🟡 Changes recommended

Export share links lose selected control settings during redirects, and component tests do not cover the pending, failed, and updating link behaviors.

2 open issues
1 file not reviewed
  • .github/extensions/replica-prototype/assets/renderer.js: Generated file
What changed in this PR

Aligns the Copilot canvas with Hub’s current share-link contract, replacing legacy Rails assumptions.

Changes:

  • Uses UUID share IDs, nullable URLs, and explicit revocation results.
  • Makes copy, open, and revoke actions reflect export availability.
  • Updates regression tests, Storybook fixtures, and documentation.
File Description
hub/​docs/​prototype-canvas.md Documents the current sharing contract.
hub/​client/​hooks/​use-canvas-share-links/​types.ts Reuses extension share types.
hub/​client/​hooks/​use-canvas-share-links/​index.ts Handles UUIDs and revocation results.
hub/​client/​hooks/​use-canvas-share-links/​index.test.tsx Tests updated hook behavior.
hub/​client/​hooks/​use-canvas-share-links/​en.ts Adds export-state messages.
hub/​client/​features/​prototype-canvas-share-links/​stories.tsx Adds export-state fixtures.
hub/​client/​features/​prototype-canvas-share-links/​index.tsx Gates actions by link availability.
hub/​client/​features/​prototype-canvas-share-links/​index.test.tsx Covers readerless and revoking links.
hub/​client/​application/​prototype-canvas/​stories.tsx Updates publication demo responses.
hub/​client/​application/​prototype-canvas/​stories.test.tsx Updates expected share URLs.
.github/​extensions/​replica-prototype/​start-canvas-server/​index.test.mjs Exercises UUID sharing through the server.
.github/​extensions/​replica-prototype/​share-links/​index.test.mjs Tests destinations and export states.
.github/​extensions/​replica-prototype/​share-links/​index.mts Implements the updated sharing contract.
.github/​extensions/​replica-prototype/​share-links/​index.mjs Synchronizes the JavaScript implementation.

Review effort: Balanced (adaptive)

Hub now reports its configured public share origin, and the extension
accepts /s/ links only on that origin. Control settings are added only to
Hub /shared/ links, because the public reader drops query parameters.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>

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.

🟡 Changes recommended

The settings-encoding blocker incorrectly hides unrelated reader links and recovery URLs and must be restricted to Hub Copy/Open actions that add settings.

1 open issue
2 resolved since last review
1 file not reviewed
  • .github/extensions/replica-prototype/assets/renderer.js: Generated file

Review effort: Balanced (adaptive)

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

Interacting changes to Hub share-link contracts, extension URL trust checks, and asynchronous export/revocation behavior exceed the limited-consequence scope for automated approval.

No open issues 🎉

1 resolved since last review
1 file not reviewed
  • .github/extensions/replica-prototype/assets/renderer.js: Generated file

Review effort: Balanced (adaptive)

@alliscode

Copy link
Copy Markdown
Contributor Author

Closing in favor of #500, which covers the same share-link contract fix.

@alliscode alliscode closed this Dec 3, 2026
arniebradfo added a commit that referenced this pull request Dec 4, 2026
Port the selected origin contract from #510 without importing its history. Keep older same-Hub links and the existing sharing lifecycle safeguards.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
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.

3 participants