Repository navigation
feat: support in-memory file uploads - #1883
Conversation
There was a problem hiding this comment.
All reported issues were addressed across 27 files
Heads up: you’ve reached your flex budget. Increase your flex budget or wait for usage to reset.
View guided diff | Re-trigger cubic
There was a problem hiding this comment.
0 issues found across 7 files (changes from recent commits).
Heads up: you’ve reached your flex budget. Increase your flex budget or wait for usage to reset.
View guided diff | Re-trigger cubic
There was a problem hiding this comment.
0 issues found across 2 files (changes from recent commits).
Heads up: you’ve reached your flex budget. Increase your flex budget or wait for usage to reset.
View guided diff | Re-trigger cubic
okwasniewski
left a comment
There was a problem hiding this comment.
[claude-opus-5-5] automated review on behalf of @okwasniewski
Reviewed 073135c (main b369e38): core/web/e2e diff, the testbed on the built CLI, and Playwright 1.65.1's setInputFiles. A separate action kind is right: an older engine would read action.paths as undefined, and web's dispatcher has no default. Payload bytes never reach traces (grepped .e2e/results for a marker payload and its base64 after a failing test, no hits). Approved fork CI.
Must fix
packages/core/src/locator/screen.ts:539: a payload over 50 MB fails asENGINE_FAILURE(infrastructure, exit code 3) with Playwright'sCannot set buffer larger than 50Mbpassed through. That's an authoring error. Bigger payloads also hit the protocol's 256 MB message limit after base64 (connection.ts:89), which closes the whole engine connection instead of failing one step. SumbyteLengthin core before lookup and reject 50 MB+ withINVALID_ARGUMENT(reuse Playwright's message), plus a unit test.
Should fix
filePayloadsflag (manifest.ts:281-307,web/src/engine.ts:127, the two schemaif/thenblocks): the same fact is declared twice, anddefineEnginesilently drops a declared action unless it's the only one, then it throws. This is the first locator action kind since the contract locked, so its shape becomes the pattern. It's needed only becauseweb()declaresactions: LOCATOR_ACTION_KINDS. Simpler: freezeLOCATOR_ACTION_KINDSat the v1 set, let the validator accept the full known set, and have web declare[...LOCATOR_ACTION_KINDS, 'setInputFilePayloads']with its core peer floor raised. Old web on new core stays safe and the flag, schema pair, filter andincludescheck go away. Hold this one until a maintainer picks the shape.contract.ts:296: base64 leaks into the in-process contract. Snapshot pixels set the precedent (Uint8Arrayin the contract,encodeSnapshot/decodeSnapshotinprotocol.ts). Do the same so in-process engines skip the round trip.apps/testbed/tests/set-input-files.e2e.tsis a port of the upstream Playwright tests, but the PR deletes the "Not ported" note and adds tests under new names. Portshould set from memoryandinput event.composed should be true and cross shadow dom boundaryunder their upstream names (both pass on this branch in a scratch port). Keep the extra cases if you like.
Nits
screen.ts:529: a mixed array starting with a path fails with "paths must be non-empty strings". Use Playwright'sFile paths cannot be mixed with buffers.- Changeset: drop
@e2e-dev/mobile(no mobile change) and keep the first sentence; engine opt-in details belong inengine.mdx. docs/migrate/playwright.mdx:124: "legacy engines returnUNSUPPORTED_CAPABILITY" is internals, "web only" is enough.
Verified: oxlint, core/e2e/web typecheck, check:peer-ranges, check:changeset-bumps. e2e unit (engine-protocol, engine, locator-action-options, schema-fixtures) 186/186, web upload-actions + core-compatibility 19/19, testbed set-input-files.e2e.ts 21/21. Mutants caught: base64 decoded as utf8, opt-in filter removed, filePayloads dropped from describeEngine, mixed array accepted, unknown payload key check removed.
This supersedes #1407.
|
[claude-opus-5-5] automated review on behalf of @okwasniewski One more, from fork CI: |
|
[GPT-6] responding on behalf of @WellDunDun @okwasniewski addressed in a0974fe, after merging main in e53f6ce:
|
There was a problem hiding this comment.
0 issues found across 20 files (changes from recent commits).
Heads up: you’ve reached your flex budget. Increase your flex budget or wait for usage to reset.
View guided diff | Re-trigger cubic
okwasniewski
left a comment
There was a problem hiding this comment.
[claude-opus-5-5] automated review on behalf of @okwasniewski
Re-checked a0974fe (main fabb0c0) against the 073135c review: core/web/e2e diff, the testbed on the built CLI, and Playwright 1.65.1's convertInputFiles.
Every earlier ask is done:
- 50 MiB:
screen.tssumsbyteLengthbefore lookup and throwsINVALID_ARGUMENTwith Playwright's message at>= 50 * 1024 * 1024, same comparison as Playwright'sfilePayloadExceedsSizeLimit. The testbed case shows the connection survives a rejected 50 MiB payload. - Contract:
setInputFilePayloadscarriesUint8Array;encodeLocatorAction/decodeLocatorActioninprotocol.tshandle base64 only on the wire, like snapshot pixels. Bytes are copied at the call, so mutating the caller's Buffer afterwards changes nothing. should set from memoryandinput event.composed should be true and cross shadow dom boundaryare ported under their upstream names.- Mixed arrays fail with
File paths cannot be mixed with buffersin either order. The changeset is one sentence without mobile, the migrate row says "web only", and ja/zh code blocks are synced (check-docs-translationspasses). - The open cubic threads (schema reverse dependency, single-violation negative fixture, INVALID_CONFIG for malformed lists, payload-only doc) are fixed and covered by tests.
Must fix
- None.
Should fix
- The
filePayloadsflag is still there (manifest.ts:280-307,web/src/engine.ts:127, two schemaif/thenblocks), waiting on the maintainer's call between the per-kind flag and freezingLOCATOR_ACTION_KINDSat v1 with a raised web core floor. Whichever shape lands becomes the pattern for every new locator action kind, so it should be settled before merge. No other changes needed.
Nits
locator/engine.ts:205: when payloads aren't supported, the error saysthe "setInputFilePayloads" action is not available, but the user calledsetInputFiles. Something like "in-memory files for setInputFiles are not available on this target" would read better. This goes away if the flag goes.client.ts:268/server.ts:181:name === 'action' && spec.member === 'perform'hardcodes one codec into the generic arg loop. Fine for one case. If a second encoded arg comes along, give the method spec an arg codec likeresult: 'snapshot'instead.
Verified: oxlint, typecheck core/e2e/web/mobile, check:peer-ranges, check:changeset-bumps, docs:check-errors, plugins:check, docs check (including translations). e2e unit (engine-protocol, engine, locator-action-options, schema-fixtures) 194/194, web upload-actions + core-compatibility 19/19, testbed set-input-files.e2e.ts 24/24 on the built CLI. Mutants caught: >= to > on the size limit, size check removed, mixed-array check removed, encode made identity, base64 decoded as utf8, payload bytes not copied, opt-in filter removed, unknown payload key check removed. Fork workflows (spec, docs, translations, benchmarks, mobile) still need approval at this SHA; only check/label/cubic have run, all green.
Waiting on a maintainer decision: per-kind filePayloads flag vs freezing LOCATOR_ACTION_KINDS at v1 with a web core floor bump. Labeling for human review.
Earlier asks done, see latest automated review.
kdy1
left a comment
There was a problem hiding this comment.
[claude-opus-5-5] automated review on behalf of @kdy1
Reviewed a0974fe (main fabb0c0). In-memory uploads work: the testbed set-input-files.e2e.ts passes 24/24 on the head and 18/24 on main, and path uploads did not change. Please fix these before merge.
Should fix
packages/core/src/engine/manifest.ts:302-305: the same mistake gives two different results.defineEngine({ ..., actions: ['tap', 'setInputFilePayloads'] })withoutfilePayloads: truedrops the kind with no error (actionsbecomes['tap']). Withactions: ['setInputFilePayloads']alone, it throwsINVALID_CONFIG. An engine author who forgets the flag finds out only when users getUNSUPPORTED_CAPABILITY. Make the declaration fail loudly. If you freezeLOCATOR_ACTION_KINDSat the v1 set and have web declare[...LOCATOR_ACTION_KINDS, 'setInputFilePayloads'], this goes away together with the flag.packages/core/src/locator/engine.ts:202-207: with the current@e2e-dev/webon this core (the peer range allows it),setInputFiles(payload)fails withthe "setInputFilePayloads" action is not available on this target: its engine declares ..., setInputFiles, .... The user did not call that kind, and the list sayssetInputFilesis supported. InsetInputFiles, check for payload support first and say what to do, for example: "in-memory files for setInputFiles are not available on this target; update its engine or pass a file path".
Nits
docs/reference/engine-protocol.mdx:212: theEngineManifestblock does not havefilePayloads, but the schema requires it whenactionslistssetInputFilePayloads. Add it here and in the ja and zh pages.packages/web/src/actions.ts:343-345:Buffer.from(file.buffer)copies the bytes again. The protocol decode already made a freshUint8Array, so near the 50 MiB limit each call allocates about 50 MB more. UseBuffer.from(b.buffer, b.byteOffset, b.byteLength).packages/mobile/src/surface.ts:1552: the comment says the switch is "kept exhaustive", but it has nosetInputFilePayloadscase. Add it to the unsupported cases.packages/e2e/src/mcp/code-surface.ts:163: the reasonrun_codeleaves outsetInputFilesis "reads files from disk", which is no longer the whole story. Update the text.
Verified: core/e2e/web/mobile typecheck; e2e unit (engine-protocol, engine, locator-action-options, schema-fixtures) 194/194; web upload-actions + core-compatibility 19/19; testbed set-input-files.e2e.ts on the built CLI, head 24/24 and main 18/24. Item 1 was run against the built core, and item 2 with the main @e2e-dev/web dist on the head core.
There was a problem hiding this comment.
All reported issues were addressed across 13 files (changes from recent commits).
Heads up: you’ve reached your flex budget. Increase your flex budget or wait for usage to reset.
View guided diff | Re-trigger cubic
|
[GPT-6] responding on behalf of @WellDunDun @kdy1 items 2-6 are fixed in 313b9f8 and a3b65c4:
Also addressed both new cubic threads in a3b65c4. Item 1 remains on hold as requested in the earlier review: @okwasniewski @kdy1, please decide between the current flag and freezing LOCATOR_ACTION_KINDS at v1 with a web core peer floor bump before I change that contract. Verified locally: pnpm check; 280 core/MCP, 60 web, and 242 mobile tests on 313b9f8; pnpm check, 76 locator tests, and all 24 built-CLI upload tests on a3b65c4. Fresh-context review found no actionable issues. The first CLI attempt hit local disk exhaustion; the complete final rerun passed. Please re-review and approve the new fork workflow runs. The previous head's workflows passed, but each new push requires approval again. |
There was a problem hiding this comment.
0 issues found across 5 files (changes from recent commits).
Heads up: you’ve reached your flex budget. Increase your flex budget or wait for usage to reset.
View guided diff | Re-trigger cubic
kdy1
left a comment
There was a problem hiding this comment.
Note
This text was drafted with AI and posted after human approval.
- Harness: T3 Code
- AI agent: Claude Opus 5.5 (claude-opus-5-5)
Re-reviewed a3b65c4 (main fabb0c0). Items 2 to 6 from my last review are fixed. Thanks.
Decision on the capability shape: freeze LOCATOR_ACTION_KINDS. Please replace the filePayloads flag with this:
packages/core/src/engine/contract.ts: keepLOCATOR_ACTION_KINDSat the v1 set, withoutsetInputFilePayloads. Its meaning becomes "the kinds of SPI v1". An engine that spreads it never claims a kind that was added later.packages/core/src/engine/manifest.ts: validateactionsagainst every known kind (the fullLocatorActionKindset), not againstLOCATOR_ACTION_KINDS. Remove thefilePayloadschecks, the filter, and thesetInputFilePayloads requires filePayloads: truethrow. A declared kind is then kept or rejected. It is never dropped without an error, so item 1 of my last review goes away.packages/web/src/engine.ts: declareactions: [...LOCATOR_ACTION_KINDS, 'setInputFilePayloads']and remove the conditionalfilePayloadsspread. Raise@e2e-dev/web's@e2e-dev/corepeer floor to the release that shipssetInputFilePayloads, because an older core rejects the new kind.- Remove
filePayloadsfromKNOWN_KEYS,Engine,EngineManifest, the protocol client,describeEngine, andcomparable. Remove thefilePayloadsproperty and the twoif/thenblocks fromengine-manifest-v1.schema.json, and update both fixtures. - Docs: remove the
filePayloadsrow indocs/reference/engine.mdxand the field indocs/reference/engine-protocol.mdx(also in ja and zh). Inengine.mdx, say thatLOCATOR_ACTION_KINDSis the v1 set and that an engine lists a newer kind explicitly. Update theactionsvalidation row (line 106), which now says "outsideLOCATOR_ACTION_KINDS".
Keep the checkAction message for setInputFilePayloads in locator/engine.ts. A web build older than this change still reaches it.
There are 2 small inline comments.
Verified: pnpm check passes on the head. The e2e unit tests (engine-protocol, engine, locator-action-options, schema-fixtures, mcp-code-parse) pass 281/281, web actions, core-compatibility, and upload-actions pass 60/60, and mobile engine.test.ts passes 242/242. On the built CLI, the testbed set-input-files.e2e.ts passes 24/24 on the head and 18/24 on main. I also swapped the web dist between main and the head: new web on the old core passes all 18 path uploads, and old web on the new core passes the path uploads and fails payloads with the new UNSUPPORTED_CAPABILITY message. The fork workflows for this head still need approval.
…ploads # Conflicts: # packages/e2e/schema/fixtures/engine-manifest-v1.invalid.json # packages/e2e/schema/fixtures/engine-manifest-v1.valid.json
There was a problem hiding this comment.
0 issues found across 4 files (changes from recent commits).
Heads up: you’ve reached your flex budget. Increase your flex budget or wait for usage to reset.
View guided diff | Re-trigger cubic
okwasniewski
left a comment
There was a problem hiding this comment.
[claude-opus-5-5] automated review on behalf of @okwasniewski
Re-checked at 0023573 (main 3e7d19d, merges clean). The new commit is 0023573, "route upload clearing in the locator".
The 22:17 asks are done:
packages/web/package.json: both peers are now>=0.25.0 <1, and the PR body says 0.25.0. No0.24.1is left in packages or docs.- The payload-only clear is out of
LocatorEngine.perform, which is back to its main shape.setInputFilesinscreen.tsnow makes the choice through a newLocatorEngine.supports(kind). - Nit tests added: a payload-only engine rejects
setInputFiles('a.txt')withUNSUPPORTED_CAPABILITYand does not dispatch. An engine with neither upload action rejectssetInputFiles([])before lookup.
No must-fix. No should-fix.
Nits (optional, still open)
locator-action-options.test.ts:249:not.toContain('AID/')would still pass if the steps recorded the raw bytes as numbers. Use a distinctive text payload, and assert that neither its text nor its base64 appears in the steps.
CI: all green at 0023573, including android deterministic, which was infra-red last round. cubic: 0 findings on the new commit.
Verified
- Built core and e2e at the head. Core typecheck and oxlint on
packages/core/src/locatorare clean. - e2e unit tests
locator-action-options,engine-protocolandengine: 161 passed. - Mutant: disabling the new payload-only clear branch in
screen.tsfails "uploads then clears on a payload-only engine". - Not re-run on the testbed this round. The only web change is the peer range, and last round's built-CLI run passed 25/25.
okwasniewski
left a comment
There was a problem hiding this comment.
[claude-opus-5-5] automated review on behalf of @okwasniewski
Re-checked at 8a21b1e (main c30354f, merges clean). The only new commit since 0023573 is a main merge, "Merge main and preserve upload type assertions".
The merge conflicted only in packages/e2e/tests/types/sdk-types.ts, against #1925 (describe.fail). The resolution is correct. It keeps all of main's describe.fail assertions and all of this PR's upload assertions. It drops this PR's old @ts-expect-error on describe(..., { fail: true }), which #1925 made valid. Apart from line offsets, the PR's diff against main is the same as at 0023573. Every ask from earlier rounds is still done.
No must-fix. No should-fix.
Nits (optional)
locator-action-options.test.ts:249(still open from last round):not.toContain('AID/')would still pass if the steps recorded the raw bytes as numbers. Use a distinctive text payload, and assert that neither its text nor its base64 appears in the steps.packages/desktop/src/surface.ts:1060(new on main via #1953): the "kept exhaustive" unsupported case listssetInputFilesbut notsetInputFilePayloads. The desktop engine does not declare either kind, so the harness never sends them. If one did arrive, though, it would fall through as a silent no-op.blurhas the same gap already on main, so this can be a follow-up.
CI: all green at 8a21b1e, including android and ios deterministic. cubic: no findings.
Verified
- Built core and e2e at the head. e2e unit tests
locator-action-options,engine-protocolandengine: 162 passed. - e2e typecheck, including
tests/types/sdk-types.ts: no errors except the expected ones from@e2e-dev/webnot being built in this worktree.
|
/ready |
|
Fix these and comment |
okwasniewski
left a comment
There was a problem hiding this comment.
[claude-opus-5-5] automated review on behalf of @okwasniewski
Re-checked at 08cd2cf (main 6fdb1c2, merges clean). The only new commit since 8a21b1e is a main merge, "Merge main and preserve upload path validation".
The merge conflicted with #2039 in actions.ts, its unit and integration tests, screen.mdx and both writing-tests.md copies. The resolution is correct:
actions.ts: #2039'sstatPathcheck now runs in thesetInputFilescase ofdispatchLocatorAction, beforeuploadFiles, so a missing or unsearchable path is stillINVALID_ARGUMENTbefore anything is clicked.setInputFilePayloadsskips it and still goes straight touploadFileswith in-memory buffers.- Tests keep both sides: the PR's input/label/chooser payload cases and #2039's missing-path and unsearchable-dir cases.
- Docs merge both: the
INVALID_ARGUMENTrow lists blank or missing paths, unsearchable dirs and payload errors, andUNSUPPORTED_CAPABILITYkeeps the payload-engine case.
No must-fix. No should-fix.
Nits (optional)
packages/web/src/actions.ts:235: theuploadFilesJSDoc still says a missing path "fails before anything is clicked", but that check now lives in its caller. Move the sentence to thesetInputFilescase or drop it.- Still open from earlier rounds:
locator-action-options.test.ts:249(distinctive payload text in the steps assertion) and the desktopsetInputFilePayloadsexhaustive case.
CI: all green at 08cd2cf, including android and ios deterministic. cubic: no new findings.
Verified
- Ran
git show --remerge-diff 08cd2cf55to check every conflict hunk. - Built core. Web
tests/unit/actions.test.ts+tests/integration/upload-actions.test.ts: 65 passed. - Mutant: I removed the
statPathloop from thesetInputFilescase, and all 6 of #2039's missing-path and unsearchable-dir integration tests failed withENGINE_FAILURE. Restored after. - Web
tsc --noEmit: no errors insrc. The only errors come frome2enot being built in the worktree.
michal-e2e
left a comment
There was a problem hiding this comment.
Drafted with AI and posted at my request.
Re-reviewed 08cd2cf55. Two optional notes below.
| "peerDependencies": { | ||
| "@e2e-dev/core": ">=0.24.1 <1", | ||
| "e2e": ">=0.24.1 <1" | ||
| "@e2e-dev/core": ">=0.25.0 <1", |
There was a problem hiding this comment.
@okwasniewski, the web peers read >=0.25.0 <1. That is right only if this merges before the release PR #1974, which is still open and versions core and e2e to 0.25.0 (npm has 0.24.0). If #1974 merges first, 0.25.0 ships without setInputFilePayloads, and a 0.25.0 core rejects the new web engine's actions at config load. The floor would then need to be the next version.
There was a problem hiding this comment.
[GPT-6] responding on behalf of @WellDunDun
Release PR #1974 is still open. The 0.25.0 floor assumes this PR lands first. If #1974 lands first without this action, the floor needs to match the next release that includes it.
There was a problem hiding this comment.
0 issues found across 1 file (changes from recent commits).
Heads up: you’ve reached your flex budget. Increase your flex budget or wait for usage to reset.
View guided diff | Re-trigger cubic
|
/ready |
okwasniewski
left a comment
There was a problem hiding this comment.
[claude-opus-5-5] automated review on behalf of @okwasniewski
Re-checked at f95fb42 (main 5acb822, merges clean, no rebase needed). The only new commit since 08cd2cf is f95fb42, "test(locator): distinguish unsupported upload clearing".
- michal-e2e's ask (
locator-action-options.test.ts): done. ThesetInputFiles([])case now asserts the message as well as the code (the "setInputFiles" action is not available on this target: its engine declares tap). Test-only commit, no regressions. - michal-e2e's floor thread (
packages/web/package.json:65): the>=0.25.0 <1peers are right while release PR #1974 is still open, since this PR would then ship in 0.25.0. If #1974 merges first, the floors need to move to the next release. This thread is still unresolved, and it is the only thing that blocked the 21:44/ready. Resolve it once the merge order is settled. - Earlier nit on
actions.ts(theuploadFilesJSDoc "before anything is clicked"): done, the sentence is gone.
No must-fix. No should-fix.
Nits (optional, from earlier rounds)
packages/desktop/src/surface.ts:1163: the "kept exhaustive" unsupported case listssetInputFilesbut notsetInputFilePayloads.
CI: all green at f95fb42, including android and ios deterministic, web, bun and all Node test matrices. cubic: 0 issues on the new commit.
Verified
- Built core.
packages/e2etests/unit/locator-action-options.test.ts: 77 passed. - Mutant: I replaced
supports('setInputFilePayloads')atscreen.ts:551withtrue. The new assertion failed ("does not suggest file paths when the engine supports no uploads"). Restored after.
What and why
locator.setInputFiles, preserving paths and empty-array clearing.INVALID_ARGUMENT; larger files can use paths.@e2e-dev/core0.25.0 or later below 1.0, with the same minimum for its optionale2epeer. The SPI v1 action list stays frozen so older engines do not advertise payload support. Include types, migration docs, consumer skill, and changeset.Issue
Part of #1855, Locators and actions:
locator.setInputFiles({ name, mimeType, buffer }). Assigned in #1855 (comment).Verified
Ran it locally: yes, macOS arm64, Node 25.8.1.
e2e run tests/set-input-files.e2e.ts --grep in-memory --video. Checks filename, MIME type, binary contents, empty files, chooser buttons, and clearing. Recording retained locally: GitHub CLI attachment upload requires upstream write access, unavailable for this fork contribution.a0974fe4:pnpm check, 194 core/schema tests, 19 web compatibility/upload tests, and all 24 built-CLI upload tests pass. This includes the upstream shadow-DOM event case and oversized-upload recovery.pnpm testand the deterministic web benchmark (93 tests) passed ona0974fe4.313b9f89:pnpm check, 280 core/MCP tests, 60 web unit/integration tests, and 242 mobile tests pass.a3b65c43:pnpm check, 76 locator tests, and all 24 built-CLI upload tests pass. Fresh-context review found no actionable issues.d2f621cawith current main:pnpm check, 280 focused tests, and all 24 upload tests on the built CLI pass.Existing path-upload scenarios preserve behavior in the main-versus-branch comparison. Two pairs were measured; timing remains unresolved, with no performance claim.