Skip to content

Add byte-preserving File.Copy - #1372

Merged
taras merged 8 commits into
mainfrom
codex/file-copy-1368
Nov 17, 2026
Merged

taras merged 8 commits into
mainfrom
codex/file-copy-1368

Conversation

@taras

@taras taras commented Nov 17, 2026 •

Copy link
Copy Markdown
Owner

Why

The test-evidence workflow preserves a generated log with a UTF-8 File read and
write. An 8,639,583-byte log exceeded its 8 MiB text limit. Authors need a byte
copy for that work and for binary files.

What changes

Core provides the self-closing <File.Copy from="…" to="…" />.
It copies the exact bytes into a vacant path in an existing directory and
preserves the source. The operation is available in ordinary runs, Workflow
Workspace, and retained REPL entries. Source read and destination write
permissions and containment apply to each operand.

How it works

File.Copy calls contextual API.Files.copyFile. The host resolves the source
and destination parent and copies natively, preserving an occupied final entry.
Workflow Workspace commits the bytes and outcome together. Covered REPL copies
record both operands under the existing file recorder, with mutation ownership
on the destination. An acknowledged copy restores its outcome on replay
without touching either file.

Review guide

Start with FileCopy.test.md and the File.Copy section of the language spec.
Then trace the contextual Files operation through the native host, Workspace
transaction, and REPL recorder. Check occupied destinations, input-specific
permission denials, and replay before live observations.

How to verify it

  • The recurring Markdown suite creates 8 MiB of zeros followed by one
    0xFF byte, invokes File.Copy, and compares both files with the full binary
    fixture. It also checks that modifying the destination leaves the source
    intact. The suite passed on Deno, Node, and Bun.
  • The focused host, Workflow Workspace, and REPL tests exercise permissions,
    occupied destinations, replay, rollback, and operand identity. Node and Deno
    typechecks, the compiled macOS filesystem contract probe, and the named
    xmd syntax File.Copy check passed.
  • The generated-XMD preflight witness checks that an unoffered copy prevents
    an earlier admitted mutation and retains the existing class-only diagnostic.

Scope

Ticket artifact retention is a separate follow-up.

Closes #1368.

@taras
taras marked this pull request as ready for review November 17, 2026 02:52
@taras
taras merged commit bd823c9 into main Nov 17, 2026
64 checks passed
@taras
taras deleted the codex/file-copy-1368 branch November 17, 2026 04:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add <File.Copy> for byte-preserving file copies

1 participant