Unreferenced attachments are listed and collected after a week #16
Loading…
Reference in a new issue
No description provided.
Delete branch "board/977-d199dc"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Ticket: https://agentboard.icefish-betta.ts.net/#977 (follow-up from the PR #12 review).
Built on #12, which has merged. This PR is now rebased on
main, including #17 (padded attachments), and Forgejo retargeted it there.What changes
GET /v1/vaults/{id}/fileslists a vault's uploaded files with their ids and sealed sizes (the bytes the quota counts), whether or not an item lists them. Writers and above can call it; readers get 403, and non-members get 404 as on every other vault route.sync, including a sync that ends in 409 or 413, since both come after a pull.history, and the server's copy of an item with an edit or delete still pending here (Vault::base_files).FILE_GRACE(7 days).#[serde(default)], so old snapshots restore. An old snapshot with a pending change and no base files skips collection.sync.Vault::collect_files,Item::file_ids). The client addsSession::filesandpub(crate) Session::collect_files(vault, now).delete_itemno longer deletes attachments right away. Another device that brings the item back with an unpushed edit (local edits win the merge) now keeps its files.attachdeletes the fresh upload only after a 4xx. After a network error or a proxy's 5xx the push may have landed, so a later sync collects the file instead.Trade-offs
FILE_GRACEis one constant.Tests
file_garbage_collectiontest inclient/src/tests.rs:historyand in current fields survive, and readers don't collect.storage_quota:delete_itemthe file stays.🤖 Generated with Claude Code
GET /v1/vaults/{id}/files lists a vault's files with their sealed sizes. A writer's device notes files no item refers to (current or earlier versions) as it syncs and deletes them once they've stayed unreferenced for a week. delete_item no longer deletes files right away, so another device restoring the item with an unpushed edit keeps its attachments. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>- A pending edit or delete keeps the files of the version it started from in use, so a refused change no longer stops collection in its vault. - Notes start over after more than a grace without a look. - GET /v1/vaults/{id}/files needs a writer. - CLI attach cleans up only after a 4xx. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>74dd6c45412f5a97e7e92f5a97e7e9cdd1448ceddd15600748e1f711e4f5e1f711e4f5a4d38ae535GET /v1/vaults/{id}/files now returns {now, files}, and collection uses the server's now, so a device clock set ahead can't make an upload due early. New tests pin the snapshot persistence of the notes, the old-snapshot guard, the conflict base files and the two-grace reset bound. DESIGN.md states the sampling limits, the sync cadence collection needs and plaintext mcp; the 413 message no longer promises a week. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>