Repository navigation
fix(share): ask before sharing from Studio and bind each action to the confirmed review - #8268
Conversation
A composition's script runs on Studio's origin by default, and a received folder's .hyperframes/review.json can point Studio at an existing review. Every share action except sign-in now asks the person first, naming the review (its link), who can open it, the workspace and whether project files are uploaded. The request carries the manage link of the review that was shown, and the server refuses it with share_target_changed when the project's review no longer matches, so nothing is shared or changed.
… confirmed Studio now gets the id and title of the review an action reaches, including a folder whose record names a review it never opened (a received folder can ship one). The confirmation names that review, its workspace and who can open it, and says plainly when a folder arrives already linked. Actions carry the confirmed id; a missing one is refused as confirmation_required and a different one as share_target_changed, and after that refusal Studio drops the earlier choice. The docs describe the confirmation and that project files are included only when chosen.
…he new state fields
|
Preview deployment for your docs. Learn more about Mintlify Previews.
💡 Tip: Enable Automations to automatically generate PRs for you. |
Edit accuracy: accurate 271 (base branch 271), smooth 62 of thoseThe gate passes. Quarantined, measured but not gated (0) Unstable (4)
|
eddy-heygen
left a comment
There was a problem hiding this comment.
(Eddy's agent) Reviewed by Eddy's Claude agent at commit cd9325f (non-test diff read by me).
Verdict: approve. This is the confirmation half; as the description says, it protects the person's own clicks, and a script running in the page is stopped only by the sealed-preview half.
Summary
A project folder can arrive with its own review record pointing at an existing shared review, so pressing Share could add to, re-open or change a review the person never created. Every share action in Studio now asks first and names the review, the link, the workspace and who can open it, with an explicit warning when the folder is already linked. Each action carries the review id the person confirmed, and the local server refuses a missing or different one before anything changes.
What I checked
- Server: every action except sign-in must carry
confirmedReview; a missing one is a 400, and one that differs from the review the project points at now is a 409, both before the action runs. The value must be null or a short id; any other shape is refused with the rest of the input. - The status now reports the review id and title, taken from the active share or, failing that, the folder's review record, so a folder-supplied link is visible before anything is shared.
- Client: the confirmation text is built from that status; the review title has control and separator characters collapsed and is cut to 80 characters, so a crafted title cannot push the rest of the message out of view.
- The "turn link off" prompt moved into the same confirmation path, so it is still asked.
Non-blockers
- The confirmation is a page dialog and the confirmed id is supplied by the page, so code running in the page can still supply both. That is the stated remainder until the preview is sealed.
- The title lookup for a folder-recorded review that fails is shown as "title not available"; the warning text still appears.
A question I cannot answer from this repository
- Whether register idempotency on the review service is scoped to the calling account lives in that service, not here; it needs its owner.
CI: 51 pass, 40 skipped, none failing or pending.
What
Before CLI Studio shares anything, it now asks the person to confirm, naming the review the action reaches, its workspace and who can open it. Each action carries the id of the review the person confirmed, and the local share routes refuse any action whose review is missing or no longer matches.
shareConfirm.ts). Sign in does not.reviewIdandreviewTitle. That includes a folder whose.hyperframes/review.jsonnames a review it never finished opening, which is the state a received folder can arrive in. In that case the dialog says the folder is already linked to an existing review and tells the person to cancel if they didn't share it. The title is shown on one quoted line, so a title can't add fake lines to the dialog.POST /api/share/actionsneedsconfirmedReview: the review id, ornullfor "no existing review". A missing value is refused withconfirmation_required. A value that doesn't match the project's review now is refused withshare_target_changed, and nothing is changed. After that refusal Studio reloads and drops the earlier audience choice.export-and-share.mdxdescribes the confirmation and received folders, and now says project files are included only when the person chooses them (the old line said "when available").Before
main, CLI Studio signed in, a folder whose.hyperframes/review.jsonnames a review (a fake id, so nothing could change): choosing Create share link sends the share request straight away. No question is asked and the review is never named.After
This branch, same folder, same click: the confirmation says the folder is already linked to an existing review, names it and who can open it. Cancel sends nothing.
Why
The local share routes acted on whichever review
.hyperframes/review.jsonnamed, with the audience from the request, and never showed the person the target. A folder someone sent could carry a record pointing at an existing review, so a first "Create share link" could add a video to that review and change who can open it.Related work
#7846 (Studio's preview sealed by default) is the other half of this work and lands separately.
Not in this PR:
hyperframes sharein a terminal follows the project's review record without a prompt, as it does today.Test plan
shareRoutes.test.ts, "share actions need the review the person confirmed": each action without a confirmation, a first share whose folder record names a review, a different review, and a non-id value are refused with nothing changed.service.test.ts: "names the review a folder's record points at even before it was ever opened".QuickShare.test.tsx: cancel sends nothing; the access dialog names the review, link, workspace and Now/After; an already-linked folder is called out; a first share confirmsnull; aftershare_target_changedthe earlier choice is dropped.tsc --noEmitpasses for cli, studio and studio-server; oxlint, oxfmt, fallow and the comment ratchet pass..hyperframes/review.jsonnaming a review, Create share link showed "This folder is already linked to an existing review…"; without it, "Create a share link for this project?" with the workspace and audience. Cancelling sent no request to/api/share/actionsin either case.