Save and delete files in an aindrive drive without overwriting another change #2

Merged
RaymondCho merged 2 commits from save-and-delete into main 2026-10-13 21:54:07 +00:00
Owner

A token that may write now opens a writable folder. A save sends the file whole with the revision it was read at, so aindrive refuses one that would overwrite a newer change; saves stop at 1 MiB. A lost answer or a device timeout reports an unknown outcome. Only files are deleted: aindrive removes folders recursively and hides .git from listings. Follows lead/memona-plugin-aindrive#1

Verified: 39 unit tests, and in Memona an edit autosaved to the drive's disk, while a file changed underneath showed Changed elsewhere and kept the other version. Live calls covered create-only, a stale revision, a 1 MiB save at 12.9M of 20M fuel, and deletes.

Edited and saved Changed on the drive meanwhile
12-edited-dark 13-changed-elsewhere-dark
Reloaded from the drive
14-reloaded-dark

🤖 Generated with Claude Code

A token that may write now opens a writable folder. A save sends the file whole with the revision it was read at, so aindrive refuses one that would overwrite a newer change; saves stop at 1 MiB. A lost answer or a device timeout reports an unknown outcome. Only files are deleted: aindrive removes folders recursively and hides `.git` from listings. Follows https://git.capsulizers.com/lead/memona-plugin-aindrive/pulls/1 Verified: 39 unit tests, and in Memona an edit autosaved to the drive's disk, while a file changed underneath showed Changed elsewhere and kept the other version. Live calls covered create-only, a stale revision, a 1 MiB save at 12.9M of 20M fuel, and deletes. | Edited and saved | Changed on the drive meanwhile | | --- | --- | | ![12-edited-dark](https://git.capsulizers.com/attachments/906fc34c-e048-41d3-b8a1-4c307bb4ca09) | ![13-changed-elsewhere-dark](https://git.capsulizers.com/attachments/e360cb38-e035-4116-b831-1fb79b964cab) | | Reloaded from the drive | | | ![14-reloaded-dark](https://git.capsulizers.com/attachments/11d1b7b8-3e4c-495d-8c6d-904ccd3d3cdc) | | 🤖 Generated with [Claude Code](https://claude.com/claude-code)
RaymondCho requested review from bot 2026-10-12 14:28:20 +00:00
bot approved these changes 2026-10-12 14:32:03 +00:00
bot left a comment
Owner

✅ Approved
Summary: Conditional saves, safe file-only deletion, and unknown-outcome handling are ready.

Strengths

Implementation
  • Conditional saves preserve revisions and reject stale writes.
  • Writes and deletes distinguish uncertain outcomes from definite failures.
  • Folder deletion is prevented before the destructive drive operation.

Checks

Passed
  • cargo fmt --check
  • cargo clippy --locked --all-targets -- -D warnings
  • cargo test --locked --lib — 39 passed
  • cargo build --locked --release --target wasm32-wasip2
  • Repository policy review: compliant.

Recommendations

None
  • No follow-up changes recommended.

Declined to judge

None
  • No behaviors were set aside.

Assessment

Ready to merge
  • The implementation meets the PR requirements and all local project checks pass.

Profile: codex · gpt-5.6-terra

✅ Approved Summary: Conditional saves, safe file-only deletion, and unknown-outcome handling are ready. ## Strengths <details> <summary>Implementation</summary> - Conditional saves preserve revisions and reject stale writes. - Writes and deletes distinguish uncertain outcomes from definite failures. - Folder deletion is prevented before the destructive drive operation. </details> ## Checks <details> <summary>Passed</summary> - `cargo fmt --check` - `cargo clippy --locked --all-targets -- -D warnings` - `cargo test --locked --lib` — 39 passed - `cargo build --locked --release --target wasm32-wasip2` - Repository policy review: compliant. </details> ## Recommendations <details> <summary>None</summary> - No follow-up changes recommended. </details> ## Declined to judge <details> <summary>None</summary> - No behaviors were set aside. </details> ## Assessment <details> <summary>Ready to merge</summary> - The implementation meets the PR requirements and all local project checks pass. </details> > Profile: `codex` · `gpt-5.6-terra`
RaymondCho changed target branch from read-only-folder to main 2026-10-13 21:52:48 +00:00
RaymondCho added 2 commits 2026-10-13 21:52:48 +00:00
A token that may write opens a writable folder. A save sends the file
whole through write_file with the revision it was read at, or "none" for
create-only, so aindrive refuses it as a conflict when the file moved on;
saves are capped at one 1 MiB transfer, which a table-driven encoder fits
into one call's fuel. A save whose answer is lost, or that the drive's
device timed out on, is reported with an unknown outcome. Deleting takes
one file; folders are refused because delete_path is recursive and
listings hide entries such as .git.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Encode base64 through fixed-size chunks, as clippy 1.99 asks
CI / checks (pull_request) Successful in 38s
b614810ff9
The encoder takes twelve-byte groups through as_chunks like the decoder
now does, and reads each group's two words with one fixed eight-byte
copy each, which compiles to a load: spelling the bytes out one by one
pushed a 1 MiB save past the 20M fuel budget, while this keeps it at
12.9M.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
RaymondCho closed this pull request 2026-10-13 21:53:01 +00:00
RaymondCho reopened this pull request 2026-10-13 21:53:02 +00:00
RaymondCho merged commit e5bf47634b into main 2026-10-13 21:54:07 +00:00
Sign in to join this conversation.
No Reviewers
No Label
2 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: commons/memona-plugin-aindrive#2