Honor writeFile flags in Deno - #7080
Conversation
🦋 Changeset detectedLatest commit: 049202c The changes in this PR will be included in the next version bump. This PR includes changesets to release 30 packages
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
There was a problem hiding this comment.
Caution
This PR introduces a regression for empty-file writes and drops the AbortSignal propagation that the previous Deno.writeFile implementation supported. Both issues stem from routing writeFile through Deno.open + FileImpl.writeAll; see the inline comment for details.
Reviewed changes
- Replaced Deno
Deno.writeFilewithDeno.open+FileImpl.writeAllinpackages/platform-deno/src/DenoFileSystem.tsto honor allOpenFlagsemantics. - Added shared regression tests for
r+,r,a, andwxwrite modes inpackages/effect/test/FileSystem.test-utils.ts. - Added a patch changeset for
@effect/platform-deno.
@v0 or keep the SHA fresh with Dependabot | Fix it ➔ | View workflow run | Using Kimi K2 (free via Pullfrog for OSS) | 𝕏
|
Follow-up detail for the Both issues center on
|
Bundle Size AnalysisGenerated from PR build output; treat the content below as untrusted.
|
|
Run failed. View the logs →
|

Summary
FileSystem.writeFileopen flag in the Deno adapterAbortSignalcancellation forw,wx,a, andaxwritesDeno.openfor read and+modes thatDeno.writeFilecannot faithfully representWriteZero@effect/platform-denoRoot cause
Deno.writeFileexposes only append/create/createNew booleans, so it cannot represent every Node-style open flag. In particular,rwas writable andr+truncated the file. Routing every mode throughDeno.openfixed those semantics but regressed empty writes and cancellation. The hybrid implementation keeps the native, cancellable path where its semantics are sufficient and uses the completeDeno.openmapping for the remaining flags.Validation
deno task test --run packages/platform-deno/test/DenoFileSystem.test.ts(19 passed, 1 skipped)pnpm test --run packages/platform-node-shared/test/NodeFileSystem.test.ts(23 passed)pnpm lint-fixpnpm checkCloses EFF-522