Skip to content

docs(filestorage): add the FileStorage owner contract - #2155

Closed
eric8810 wants to merge 16 commits into
mainfrom
dim/2016-filestorage
Closed

eric8810 wants to merge 16 commits into
mainfrom
dim/2016-filestorage

Conversation

@eric8810

Copy link
Copy Markdown
Collaborator

Owner: FileStorage
Batch: 1
Scan issue: #2016
Old PR: #2080
Contract: docs/architecture/rust-agent/plugins/FileStorage.md
Base: origin/main 82a91e66a
Head: dc7468763

What

Adds the FileStorage owner contract: the twelve fsHost operations (read/stat, write/import/update, update_claimed, claim/release, create_directory/list/remove, add_root/root_path), the three credential markers, the per-file locks, the copy rules and the error kinds. The current fileStorage surface is replaced by fsHost; the FileStorage type key stays for Rust.

Shared rows:

  • docs/design/resource-faces.md §1/§4/§6 and the file-tool result fields.
  • docs/design/service-faces.md: the fileStorage row.
  • docs/design/contracts/resource-owner-operations.md: the FileStorage caller rows.
  • docs/design/plugins/README.md / zh: owner index row.
  • Session files, session deletion, Hooks, mcp-oauth, TypeScript bindings and the App Server README: pointers and changed caller clauses.

Dependencies

PluginFiles (#2016, batch 2) owns the PluginFiles rows and the pinned-reader sentences. ManagedAccount/DimOAuth, MCP, Hooks, Settings, SessionStore, SessionFiles, UiResources and the migration are callers; their contracts carry the operations they call.

Supersedes

  • docs/design/resource-faces.md §1, §4, §6.
  • docs/design/service-faces.md: the fileStorage row.
  • docs/design/contracts/resource-owner-operations.md: the FileStorage caller rows and the fsHost mapping.
  • docs/design/appserver/session-files.md and zh: §1/§2/§5.1/§5.4/§6/§7/§9.1/§10/§12/§13/§15/§16.8/§17 D1, Appendix A.
  • docs/design/appserver/session-deletion-and-fork.md and zh: §3.5, the error table, §12 and §14.
  • docs/design/appserver/mcp-oauth.md, docs/design/plugins/Hooks.md, docs/design/client-ui-extensions.md, docs/design/plugins/ManagedAccount.md, crates/dim-oauth/docs/runtime-contract.md.
  • docs/design/plugins/README.md / zh and docs/INDEX.md.

Design decisions

  • Three credential records (auth.json, mcp-oauth.json, chatgpt-account.json) use published markers; every other file uses its lock key.
  • A claim holder takes no other operation that waits for the marker (write, import, remove, update); reads are taken while it holds the claim.
  • A second claim from the same row waits like any caller; only one refresh per row runs at a time. A claim cancelled or refused before its write releases without writing.
  • keep_replaced_as is an exclusive create-only copy of the replaced content; a copy failure removes the partial copy and syncs the parent.
  • remove and import of a credential record remove its marker; a directory removal removes every marker under it.
  • closed means the call ended before the replacement; after it the call succeeds or answers unsynced.
  • open_read_only is the one handed-out store: one snapshot, closed by the export.

Review record

  • Pre-review rounds 1-11: no open P1/P2; all P3s fixed.
  • yyhhyyyyyy-style mock review: 2 rounds plus delta, 无 P1/P2.
  • zerob13-style mock review: 2 rounds plus 2 deltas, 无 P1/P2.

Ready check

  • Every operation, error and caller next step defined.
  • §7.1/§7.2 and ADR 002 rows answered.
  • Dependencies match the batch table.
  • Pre-review and both mock reviews 无 P1/P2.
  • node scripts/adr-check.mjs --base origin/main, cargo run --locked -p xtask-check, git diff --check pass.
  • No maintainer question.

Refs #2016

Restore the update_claimed split, extend the credential marker to the MCP record, carry the session-file and pointer fixes, and make Supersedes match the changed paragraphs.
Add the create-only keep_replaced_as copy, the ChatGPT account marker, and the MCP and pointer corrections.
Fix the Hooks binding, the claim-held update flow, the copy failure and lock wording, the ChatGPT login and sign-out claim, the deleted path/resolve list, and the remaining pointer corrections.
Complete the update examples, copy cleanup, claim settlement and the session-file and pointer corrections.
Point the zh overview row at the owner contract, complete the error and cancellation wording, and recompute the ledger.
Fix the zh overview link, the UiResources pointer, root ids and the remaining pointer, wording and lease corrections.
Allow reads under a claim, add the observation caller row, state the removed fileStorage name, and finish the pointer and ledger corrections.
Allow reads under a claim in every restatement, add the read-under-claim test, and complete the closed-error and pointer corrections.
Qualify the exclusion lock, fix the Hooks project path, remove the UiExtensions read-stream plan, and complete the claim, error and ledger corrections.
Scope closed per operation, release the marker after credential remove/import, and complete the pointer and ledger corrections.
Complete marker removal for plain writes, the claim/import/closed wording, the keep_replaced_as form and the remaining Supersedes and name-rule corrections.
Settle a cancelled claim, make the UiResources version guarantee one publisher rule, and complete the claim, marker and wire-field corrections.
Settle a claim cancelled before its write, clarify marker attribution and deletion failure, and record the UiResources and MCP issue links.
Make the second claim wait, map session-file EOF paging, add caller examples, and link the marker protocol from its consumers.
Show claim release on the failure path and name the two lost-claim recoveries.
@eric8810

Copy link
Copy Markdown
Collaborator Author

Closing as part of abandoning the owner-split experiment.

@eric8810 eric8810 closed this Nov 25, 2026
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