Skip to content

ui-react: the dev share harness cannot submit a share as a real navigation #2575

Open

Description

@schlessera

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> whose files are set from the selected Files with a DataTransfer.
  • 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_target registration (needs an installed WebAPK).
  • An unauthenticated or cross-site share simulation.
  • Styling beyond matching the existing dev buttons (raw-button: dev pattern).

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 the ui-react-layout project that uses the worker harness in packages/ui-react/tests/browser/offline/cold-capture/ or the share-review harness.
  • 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 lint

Contract impact

  • This touches the integration contract, so it needs the contract label, a CONTRACT: 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

  1. added
    type: test
    area: ui-react
    priority: p3
    agent-ready
    on Oct 22, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    agent-readyarea: ui-reactpriority: p3type: test

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions