Skip to content

feat: add last-write-wins workspace policy - #32

Merged
kauandotnet merged 1 commit into
mainfrom
codex/workspace-last-write-wins
Aug 21, 2026
Merged

feat: add last-write-wins workspace policy#32
kauandotnet merged 1 commit into
mainfrom
codex/workspace-last-write-wins

Conversation

@kauandotnet

Copy link
Copy Markdown
Contributor

Summary

  • add an explicit write permission and mode: "overwrite" Workspace operation that delegates to the ordinary Files SDK upload path
  • add last-write-wins copy through bounded download plus upload, and unconditional delete guarded by both write and delete
  • add bounded binary readBytes() and a selectable AI tool mutation policy while keeping conditional mode as the default
  • retain every existing native conditional create, replace, copy, move, and delete path and the fail-closed Files policy guard from fix: fail conditional operations closed with Files policy #30

Safety decisions

  • last-write-wins move is deliberately not exposed: download/upload/delete could delete a newer source generation
  • overwrite options reject ignored ETags and malformed/legacy modes before provider I/O
  • unconditional delete requires a new write grant in addition to the existing delete permission, so current delete-only mounts do not gain weaker authority
  • copy uses the ordinary download and upload pipeline instead of provider-side copy, preserving transforms such as decrypt/re-encrypt and enforcing workspace byte limits
  • the bundled Files SDK encryption() plugin is tested only as pipeline compatibility evidence; application-specific key custody, strict encrypted-only reads, AAD, and copy/move policy remain application-owned
  • no Files SDK version bump, low-level conditional API change, R2 change, package publication, or change to release PR chore: release @nestm/storage (alpha) #31

Verification

  • pnpm test — 255 unit tests; 55 e2e passed and 4 live tests skipped
  • pnpm check
  • pnpm verify:pack — build, strict publint, tarball install, packed consumer test
  • independent API/security diff review

Tracks #29. Native CAS can return to Workspace Files after haydenbleasel/files-sdk#138 / haydenbleasel/files-sdk#139 (or an equivalent upstream release) routes conditional operations through the same plugin, hook, and receipt boundary.

@kauandotnet
kauandotnet marked this pull request as ready for review August 21, 2026 15:18
@kauandotnet
kauandotnet merged commit aec25d6 into main Aug 21, 2026
6 checks passed
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.

1 participant