Repository navigation
Conversation
Hub copies eligible Builds into public export storage, writes and revokes their policies, supports optional link passwords, and shows export status on the Share links page. Legacy share links stay on their backend. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
…ests Recovery now revokes export links whose branch was deleted, whose prototype became a replica, or whose repository was removed, and a copy refuses those prototypes. A retry keeps the manifest an earlier attempt wrote when only its start page changed. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
The share-links components bundled into the canvas extension changed. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Contributor
There was a problem hiding this comment.
🟡 Changes recommended
Critical publication races, recovery gaps, and cleanup flaws can leave links accessible under stale access rules and exported files undeleted, while password badges can falsely indicate protection.
8 open issues
Show password protection only after policy confirmation · New Require an authoritative file inventory before marking cleanup complete · New Ensure cleanup reaches all links within the deletion deadline · New Prevent stale policy uploads from overwriting newer revisions · New Prevent recovery batches from starving later revocations · New Recover expired active links with unwritten policy revisions · New Prevent timeout failures from leaving published links active · New Refresh share-link controls while export state is transient · New
2 files not reviewed
.github/extensions/replica-prototype/assets/renderer.css: Generated file.github/extensions/replica-prototype/assets/renderer.js: Generated file
What changed in this PR
Connects Hub’s Share links flow to the isolated reader introduced in #438. When enabled, Hub exports eligible Builds to separate storage and issues reader URLs while preserving legacy links.
Changes:
- Adds export storage, lifecycle records, password policies, revocation, recovery, and cleanup jobs.
- Extends the Share links page with export status, eligibility feedback, and password controls.
- Adds configuration checks, automated coverage, stories, and operating documentation.
| File | Description |
|---|---|
hub/test/public-share-export-storage/index.ts |
Adds an in-memory export storage fixture. |
hub/test/database/public-share-export-migration/index.db.test.ts |
Tests legacy-link migration behavior. |
hub/server/workers/recover-public-share-exports/index.ts |
Connects scheduled recovery to the queue. |
hub/server/workers/index.ts |
Validates worker export configuration. |
hub/server/workers/index.test.ts |
Tests partial-configuration rejection. |
hub/server/workers/export-public-share/index.ts |
Runs individual export jobs. |
hub/server/workers/delete-public-share-exports/index.ts |
Runs scheduled export cleanup. |
hub/server/workers/create-public-share-export-dependencies/index.ts |
Assembles worker export dependencies. |
hub/server/workers/configuration.ts |
Registers export processors and schedules. |
hub/server/workers/configuration.test.ts |
Tests queue placement and schedules. |
hub/server/utils/run-in-batches/index.ts |
Adds bounded parallel processing. |
hub/server/routes/index.ts |
Registers password-change requests. |
hub/server/routes/build-preview/share-authorize/get/index.test.ts |
Updates sharing service mocks. |
hub/server/routes/api/security-audits/present-security-audit/index.ts |
Presents password-change audit actors. |
hub/server/routes/api/public-sharing/respond-public-sharing-error/index.ts |
Maps invalid-password errors. |
hub/server/routes/api/public-sharing/public/get/index.ts |
Requires a legacy preview origin. |
hub/server/routes/api/public-sharing/public-share-exports.db.test.ts |
Tests export routes and permissions. |
hub/server/routes/api/public-sharing/public-preview/get/index.ts |
Guards legacy preview redirects. |
hub/server/routes/api/public-sharing/present-share-link-export/index.ts |
Presents export URLs and status. |
hub/server/routes/api/public-sharing/links/post/index.ts |
Accepts optional creation passwords. |
hub/server/routes/api/public-sharing/links/patch/index.ts |
Adds password replacement and removal. |
hub/server/routes/api/public-sharing/links/get/index.ts |
Returns export status and eligibility. |
hub/server/routes/api/public-sharing/links/delete/index.ts |
Reports pending public revocation. |
hub/server/routes/api/public-sharing/index.test.ts |
Updates sharing route mocks. |
hub/server/routes/api/public-sharing/create-public-sharing-route-dependencies/index.ts |
Composes hosted export services. |
hub/server/repositories/security-audits/record-repository-audit/index.ts |
Adds the password-change audit action. |
hub/server/repositories/public-sharing/update-share-link-password/index.ts |
Saves hashes and advances policy revisions. |
hub/server/repositories/public-sharing/update-share-link-expirations/index.ts |
Tracks shortened export deadlines. |
hub/server/repositories/public-sharing/update-share-link-expirations/index.db.test.ts |
Updates deadline test inputs. |
hub/server/repositories/public-sharing/start-revoking-share-links/index.ts |
Marks exports for policy revocation. |
hub/server/repositories/public-sharing/revoke-retired-export-links/index.ts |
Revokes links whose targets become ineligible. |
hub/server/repositories/public-sharing/mark-public-share-policy-written/index.ts |
Confirms published policy revisions. |
hub/server/repositories/public-sharing/mark-public-share-files-deleted/index.ts |
Records completed cleanup. |
hub/server/repositories/public-sharing/mark-public-share-export-failed/index.ts |
Records permanent export failures. |
hub/server/repositories/public-sharing/list-share-links/index.ts |
Keeps unfinished revocations visible. |
hub/server/repositories/public-sharing/list-share-link-expirations/index.ts |
Includes backend information for expiry updates. |
hub/server/repositories/public-sharing/list-public-share-export-work/index.ts |
Selects unfinished export work. |
hub/server/repositories/public-sharing/list-expired-public-share-exports/index.ts |
Selects cleanup candidates. |
hub/server/repositories/public-sharing/find-shareable-build/index.ts |
Includes identifiers needed for eligibility. |
hub/server/repositories/public-sharing/find-public-share-export/index.ts |
Reads export records and source metadata. |
hub/server/repositories/public-sharing/fail-stale-public-share-exports/index.ts |
Times out pending exports. |
hub/server/repositories/public-sharing/create-share-link/index.ts |
Creates export-backed share records. |
hub/server/integrations/azure-blob/create-public-share-export-storage/types.ts |
Defines the export storage contract. |
hub/server/integrations/azure-blob/create-public-share-export-storage/index.ts |
Implements managed-identity Blob operations. |
hub/server/integrations/azure-blob/create-public-share-export-storage/index.test.ts |
Tests storage behavior with SDK mocks. |
hub/server/index.ts |
Composes and validates API export settings. |
hub/server/index.test.ts |
Tests generated-hostname restrictions. |
hub/server/domains/public-sharing/types.ts |
Extends sharing contracts for exports. |
hub/server/domains/public-sharing/synchronize-public-share-export/index.ts |
Coordinates copying and policy publication. |
hub/server/domains/public-sharing/recover-public-share-exports/index.ts |
Recovers unfinished exports and revocations. |
hub/server/domains/public-sharing/read-public-share-source/index.ts |
Reads and verifies source artifact bytes. |
hub/server/domains/public-sharing/read-public-share-export-settings/index.ts |
Validates opt-in, storage, and site isolation. |
hub/server/domains/public-sharing/read-public-share-export-settings/index.test.ts |
Tests export configuration rules. |
hub/server/domains/public-sharing/publish-public-share-policy/index.ts |
Publishes activation and access policies. |
hub/server/domains/public-sharing/public-share-exports.db.test.ts |
Covers export lifecycle and legacy isolation. |
hub/server/domains/public-sharing/jobs/recover-public-share-exports.ts |
Defines the recovery job. |
hub/server/domains/public-sharing/jobs/export-public-share.ts |
Defines export retries and payloads. |
hub/server/domains/public-sharing/jobs/delete-public-share-exports.ts |
Defines the cleanup job. |
hub/server/domains/public-sharing/is-public-share-eligible/index.ts |
Checks private-preview eligibility. |
hub/server/domains/public-sharing/errors.ts |
Adds password and export failure types. |
hub/server/domains/public-sharing/enqueue-public-share-export/index.ts |
Enqueues recoverable work with stable IDs. |
hub/server/domains/public-sharing/delete-public-share-export-files/index.ts |
Deletes ended exports’ stored objects. |
hub/server/domains/public-sharing/create-public-sharing-service/index.ts |
Adds export creation and access management. |
hub/server/domains/public-sharing/copy-public-share-files/index.ts |
Copies immutable files and manifests. |
hub/server/create-app/index.test.ts |
Updates application sharing mocks. |
hub/schema/share-link.prisma |
Adds export lifecycle and policy fields. |
hub/schema/share-link-export-state.enum.prisma |
Defines export states. |
hub/schema/share-link-backend.enum.prisma |
Distinguishes legacy and export links. |
hub/schema/migrations/20261221120000_public_share_exports/migration.sql |
Adds export columns, constraints, and index. |
hub/docs/share-links.md |
Documents configuration and export lifecycle. |
hub/docs/public-share-reader.md |
Documents Hub’s writer integration. |
hub/docs/background-jobs.md |
Describes export queues and schedules. |
hub/docs/architecture.md |
Includes export storage and workers. |
hub/client/pages/share-links-index-page/types.ts |
Adds password and eligibility page props. |
hub/client/pages/share-links-index-page/stories.tsx |
Adds export and ineligible-Build stories. |
hub/client/pages/share-links-index-page/index.tsx |
Displays eligibility feedback and password controls. |
hub/client/features/share-links-form/types.ts |
Adds optional password field labels. |
hub/client/features/share-links-form/styles.css |
Accommodates the password field. |
hub/client/features/share-links-form/stories.tsx |
Adds a password-enabled form story. |
hub/client/features/share-links-form/index.tsx |
Renders the creation password input. |
hub/client/features/share-link-row/types.ts |
Adds status and protection labels. |
hub/client/features/share-link-row/styles.css |
Styles link status messages. |
hub/client/features/share-link-row/stories.tsx |
Adds Preparing and Updating stories. |
hub/client/features/share-link-row/index.tsx |
Displays export status and protection labels. |
hub/client/features/share-link-item/types.ts |
Defines password-management and availability props. |
hub/client/features/share-link-item/styles.css |
Styles password management. |
hub/client/features/share-link-item/stories.tsx |
Adds export-state and password stories. |
hub/client/features/share-link-item/index.tsx |
Adds password forms and state-aware actions. |
hub/client/application/hub/view-models/product-share-links-data/index.ts |
Maps export responses to page states. |
hub/client/application/hub/routes/product-share-links/index.tsx |
Submits creation and password changes. |
hub/client/application/hub/routes/expanded-flows.test.tsx |
Tests export creation and eligibility feedback. |
hub/client/application/hub/product-contracts/index.ts |
Extends request and response schemas. |
hub/.env.example |
Lists optional export settings. |
Review effort: Max (adaptive)
| ...(hasUrl && (status === "ready" || status === "pending") | ||
| ? { password: { hasPassword, path: passwordPath } } | ||
| : {}), | ||
| protectedLabel: hasPassword ? "Password protected" : undefined, |
| try { | ||
| return (await readPublicShareSource(artifacts, link)).map(({ sha256 }) => sha256) | ||
| } catch (error) { | ||
| if (error instanceof PublicShareExportError && error.permanent) return [] |
Comment on lines
+54
to
+58
| const links = await listExpiredPublicShareExports( | ||
| database, | ||
| new Date(now.getTime() - settleTime), | ||
| batchSize, | ||
| ) |
Comment on lines
+41
to
+45
| const written = await storage.replace( | ||
| key, | ||
| Buffer.from(JSON.stringify(policy)), | ||
| "application/json", | ||
| ) |
Comment on lines
+24
to
+25
| const work = await listPublicShareExportWork(database, now, batchSize) | ||
| if (work.length > 0) await enqueue(work.map(({ id }) => id)) |
Comment on lines
+30
to
+31
| // Expiry is enforced by the policy's deadline; cleanup deletes the files later. | ||
| if (!revoked && (link.exportState === "failed" || link.expiresAt <= new Date())) return |
| filesDeletedAt: null, | ||
| createdAt: { lte: createdBefore }, | ||
| }, | ||
| data: { exportState: "failed" }, |
Comment on lines
+28
to
+31
| const live = hasUrl && (status === "ready" || status === "updating") | ||
| return { | ||
| ...(statusLabel ? { statusLabel } : {}), | ||
| ...(live ? {} : { unavailable: 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.


Agent assessment
Self-reported assessment, not an independent review.
Assessed revision:
3611d50d04d3a319d9ab8dba31397f23c03bf9fa↑ 13 domain and 2 route database tests cover copy order, eligibility, retries, revocation, passwords, overtaken writes, recovery, cleanup and legacy isolation.
↑ Local integrated run: Hub exported a real Vite-built
proto/*Build and the #438 reader served entry, assets, deep links and password links; revoking one link left the other working.↑ An independent review's three findings were fixed and covered by tests.
↓ Real Azure Blob permissions and managed identity are untested until PR 3.
↓ Rendered browser playback through the reader was not checked; only HTTP-level checks ran.
Why
ADR 0003 moves public sharing to an isolated read-only reader, which #438 added. Hub still had no way to give that reader anything to serve. This PR lets Hub copy a shared Build into the public export storage, turn the copy on and off, and show the result on the existing Share links page.
What changes
When
HUB_PUBLIC_SHARE_ENABLED=true, every new hosted share link is an export: Hub copies the Build's stored files into its own folder in the export container and gives outhttps://<public-origin>/s/<shareId>. There is still no API between Hub and the reader. Hub writes with its own managed identity, and the reader only reads.flowchart LR user["Hub user"] -- "create, revoke, change password" --> api["Hub API"] api --> db[("share_links: state, password hash, revision")] api -- "enqueue" --> worker["On-demand worker"] worker -- "reads dist files" --> private[("Build artifact storage")] worker -- "files, then manifest, then policy" --> exports[("Export container")] api -- "revoked or new policy" --> exports sweep["Scheduled recovery and cleanup"] --> exports reader["Public reader (#438)"] -- "reads" --> exports viewer["Link viewer"] --> readermanifest.json, thenpolicy.jsonlast, so a link is never live half-copied. A retry finishes an interrupted copy, and a different object at the same name fails the export. Two links to one Build are two independent copies.azurecontainerapps.ioone, or on the same site as the public origin. The exception isHUB_PUBLIC_SHARE_ALLOW_SHARED_SITE=true, which logs a warning and is meant for non-production installations only.ShareLinkrows stay on the legacy backend. Hub doesn't copy, convert or redirect them, and the reader never serves them. A database check keeps export data off legacy rows.hub/docs/share-links.mdnow documents the export contract, states and jobs. The reader guide no longer says Hub doesn't write exports.Needed from PR 3: set the five
HUB_PUBLIC_SHARE_*settings on Hub's API and both workers, and give their identities create, overwrite, read and delete access on the export container. To keep sharing off, leave everyHUB_PUBLIC_SHARE_*setting unset or setHUB_PUBLIC_SHARE_ENABLED=false. Hub refuses the other settings without an explicitHUB_PUBLIC_SHARE_ENABLED.Known verification gaps:
Storybook screenshots
Captured from the candidate's static Storybook build in headless Chromium. Narrow captures are omitted because the page's 390 px clipping is unchanged from the base.
Hub/Pages/Share Links
Hub/Pages/Share Links / Public Exports, light theme, 1280 px wide
Hub/Pages/Share Links / Public Exports, dark theme, 1280 px wide
Hub/Pages/Share Links / Build Cannot Be Shared, light theme, 1280 px wide
Hub/Pages/Share Links / Build Cannot Be Shared, dark theme, 1280 px wide
Hub/Features/Share Links/Form
Hub/Features/Share Links/Form / With Password, light theme, 1100 px wide
Hub/Features/Share Links/Form / With Password, dark theme, 1100 px wide
Hub/Features/Share Links/Item
Hub/Features/Share Links/Item / Public Copy Preparing, light theme, 900 px wide
Hub/Features/Share Links/Item / Public Copy Preparing, dark theme, 900 px wide
Hub/Features/Share Links/Item / Password Protected (password control opened by the story), light theme, 900 px wide
Hub/Features/Share Links/Item / Password Protected (password control opened by the story), dark theme, 900 px wide
Hub/Features/Share Links/Item / Revoking, light theme, 900 px wide
Hub/Features/Share Links/Item / Revoking, dark theme, 900 px wide
Hub/Features/Share Links/Row
Hub/Features/Share Links/Row / Preparing, light theme, 900 px wide
Hub/Features/Share Links/Row / Preparing, dark theme, 900 px wide
Hub/Features/Share Links/Row / Updating, light theme, 900 px wide
Hub/Features/Share Links/Row / Updating, dark theme, 900 px wide
Hub/Features/Share Links/Row / Expired (changed: muted status text), light theme, 900 px wide
Hub/Features/Share Links/Row / Expired (changed: muted status text), dark theme, 900 px wide
Prototype canvas/Share links page
Prototype canvas/Share links page / Expired Link (changed indirectly through the shared row: muted status text), light theme, 900 px wide
Prototype canvas/Share links page / Expired Link (changed indirectly through the shared row: muted status text), dark theme, 900 px wide