Repository navigation
Description
Context
ShareHarness is the dev-only stand-in for the Android share sheet (ShareHarness, packages/ui-react/src/components/dev/share-harness.tsx:36-99, exported from packages/ui-react/src/index.ts:63). It builds the multipart body and sends it with fetch(path, { method: "POST", body: form }) (share-harness.tsx:74-99). Its own comment states the gap (share-harness.tsx:23-27): a fetch has mode: "cors", not "navigate", so the harness exercises the worker's handler and stash but "never the browser rendering the landing page". The 303 redirect is followed invisibly, the app never boots on /?share=<id>, and claimFromLocation (packages/ui-react/src/hooks/use-share-intake.ts:43-61) never runs from a real launch.
A real share is a top-level POST navigation with multipart/form-data. A <form method="post" enctype="multipart/form-data"> submitted from the page is the same kind of request: the worker sees request.mode === "navigate", answers with the 303, and the browser loads the landing page.
Guide: (no guide).
Scope
- Add a second action, "Submit as navigation", that submits the same fields (title, text, url, files) through a real
<form method="post" enctype="multipart/form-data" action={path}>. Files go in through an<input type="file" name="files" multiple>whosefilesare set from the selectedFiles with aDataTransfer. - Keep the existing fetch button and its result readout.
- Update the component comment. A same-origin form POST still carries the session cookie, so neither button tests an unauthenticated share; say so.
Out of scope
- The share-target handler, stash or redirect.
- Testing the manifest's
share_targetregistration (needs an installed WebAPK). - An unauthenticated or cross-site share simulation.
- Styling beyond matching the existing dev buttons (
raw-button: devpattern).
Acceptance criteria
- Pressing "Submit as navigation" on a controlled page navigates the tab to the landing URL carrying
?share=<id>, and the app's share intake shows the shared text. Proven by a real-browser test in theui-react-layoutproject that uses the worker harness inpackages/ui-react/tests/browser/offline/cold-capture/or theshare-reviewharness. - The test asserts the worker saw
request.mode === "navigate"(for example through the stash record or a test-only header), so it cannot pass through the fetch path. - Files selected in the harness arrive in the stash with their names and sizes.
- With no controlling worker, the existing warning is shown and the navigation goes to the network (no crash).
- The fetch button behaves as before.
Verification
bun run test:layout
bun run typecheck
bun run lintContract impact
- This touches the integration contract, so it needs the
contractlabel, aCONTRACT:commit prefix, and the doc updated in the same commit. - This changes a published package's behaviour, so it needs a changeset.
Not contract: ShareHarness is not listed in docs/integration-contract/package-api.md, and its props do not change.
Activity