Skip to content

fix: isolate files in nested local operations#17399

Draft
rasitakyol wants to merge 1 commit into
payloadcms:mainfrom
rasitakyol:agent/fix-local-api-file-isolation
Draft

fix: isolate files in nested local operations#17399
rasitakyol wants to merge 1 commit into
payloadcms:mainfrom
rasitakyol:agent/fix-local-api-file-isolation

Conversation

@rasitakyol

@rasitakyol rasitakyol commented Jul 18, 2026

Copy link
Copy Markdown
Contributor

What?

  • Isolate req.file for child Local API create and update operations that reuse a caller request.
  • Add create and update regression coverage for upload collections where a file is optional.

Why?

Nested Local API operations currently write their file state onto the shared request. A file-less child operation can therefore clear the outer request's file before later hooks use it.

How?

  • Use the existing isolateObjectProperty utility so child file writes remain local while transaction, user, and context state stays shared.
  • Verify that the caller retains the exact file reference and the child document remains file-less across adapters.
  • Validated with Node 24.15.0 and pnpm 11.9.0: test/uploads/int.spec.ts passed 111/111 on SQLite and MongoDB, pnpm build:payload --force, Prettier, source ESLint, and git diff --check passed.

Fixes #15975

@rasitakyol
rasitakyol force-pushed the agent/fix-local-api-file-isolation branch from bf1ad49 to 2619a46 Compare July 18, 2026 13:40
@rasitakyol

Copy link
Copy Markdown
Contributor Author

CI note: the current failing job is E2E - lexical__collections__LexicalViewsProviderDefault [next]. Its two failures time out waiting for [data-lexical-editor="true"] in test/lexical/collections/LexicalViewsProviderDefault/e2e.spec.ts.

This PR only changes the local create/update upload handling and test/uploads/int.spec.ts; it does not change Lexical code. The full uploads integration suite passes locally with both SQLite (111/111) and MongoDB (111/111). All Green is failing only as the aggregate of that Lexical job.

Could a maintainer rerun the failed Actions job? I do not have permission to rerun workflows in the upstream repository.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

File reference is not preserved on req when using local API in hook

1 participant