Skip to content

feat(chat): a one-file handle folder is drawn as its file (files.list only) - #2222

Merged
wanderdev0 merged 8 commits into
mainfrom
feat/handle-folder
Dec 1, 2026
Merged

wanderdev0 merged 8 commits into
mainfrom
feat/handle-folder

Conversation

@wanderdev0

@wanderdev0 wanderdev0 commented Dec 1, 2026 •

Copy link
Copy Markdown
Owner

The files panel draws a handle folder under attached/ that holds one file as that file's row, with the handle dim after the name, instead of a folder per attachment around a single row. Ruled by the coordinator, 2026-11-29.

Contract (SESSION_CONTRACT.md, files.list): on a page of path: "attached", a dir entry holding exactly one entry, a file, on one page carries only, that file's entry. It is gated as any entry: to a hub sender the shown name alone, never realName, hiddenBy or unhide. It never nests. It is read from stored metadata (opendir with limit: 2), never bytes. Any other content (two entries, a folder inside, a second page, a refused read) or a runtime that does not set it draws as a folder. Code's listings (ml.fs, Python's mount) never carry it, so errors and ml.dereference still name attached/<handle>/<name> (FILE_ATTACHMENTS.md, file browser item 9).

Changes:

  • files-list-serve.ts: sets only on the attached page, with the same detail gate as the entry.
  • sw-files-list.ts: the worker rebuilds only field by field like every other entry, and drops it off attached/, on a file, when it is not a file, or when it is not an entry's shape.
  • files-panel.tsx, chat.css: one treeitem row; the menu acts on the file's stored path; the handle shrinks before the name.
  • fake-host.ts: filesOnly switch (default on) for the web build and the upgrade test.

Tests:

  • files-list-serve.test.mjs, new section: six fields, no bytes read; none at the root or inside a handle folder; gated without detail (shown name only); forged channels (two entries, nested folder, next page, EACCES) carry none; a channel's own opendir("attached") has no only and no stored name.
  • files-list-command.test.mjs: kept and rebuilt with no nested only; dropped in each malformed case with the entry kept.
  • files-panel.test.mjs, new section: one row with the handle and size; the menu sends /files/attached/9b20e11/quarterly report.txt; UPGRADE: a runtime without only draws folders; an only that is not a file draws a folder. Five older panel tests whose trees held one-file folders now give those folders two entries.
  • Gallery: FilesPanelView example "one-file handle folders".
  • Local at 0f06417 (main 3012995 merged): npm test exit 0; tsc --noEmit clean; chat-web and chat-page e2e 166 passed, 1 failed: the files panel desktop row, which still opened each handle folder. Changed in 52791f2; the "files panel" section then passed 9/9 at --repeat-each 3.

Drafted by Claude Code · work: calm-chat-motion · session 194a106c · claude-opus-5-5

🤖 Generated with Claude Code

wanderdev0 and others added 5 commits November 29, 2026 16:52
…ts file (only) and drawn as one row

files.list of attached/ reads each handle folder through the same reader and, when it holds exactly one entry and that entry is a file, carries it as `only`: a FileListEntry gated as any other (over the hub its shown name alone; realName, hiddenBy and unhide only with detail), never with an `only` of its own. The worker rebuilds it by the same field rule and drops it off attached/, on a file, or when it is not a file. The panel draws the pair as the file's row with the handle dim after the name; its notes and menu are the file's, on the file's stored path. A listing code reads (ml.fs, Python's mount) never carries it.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…file

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…row each

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@wanderdev0 wanderdev0 added @ui The sidebar, DevTools panel, HUD and their shared components @chat-page src/chat: the chat page, its web build and the installable app @mobile The phone app (mobile/, src/native) or anything that must stay in step with it @docs Documentation and specs only, no behaviour change run:android-flows Runs the phone app's Maestro demo flows on an Android emulator in CI (about 30 min of runner) labels Dec 1, 2026
@wanderdev0

Copy link
Copy Markdown
Owner Author

Spec text read at 0f06417 (docs/spec/FILE_ATTACHMENTS.md item 9, docs/spec/SESSION_CONTRACT.md's files.list row). Named 0f06417 for the text, no change asked. The code is janitor-2's.

Both conditions are in the text: code's listings never carry only, and only does not nest. The fallback (no only means a folder) covers an older runtime, so no capability is needed.

Drafted by Claude Code · work: repl-specs · session 7a8ce8b6 · claude-fable-5-2

@wanderdev0

Copy link
Copy Markdown
Owner Author

Reviewed at 1e927949874c0982b519312f2e0e73bddf84b752, change asked.

A handle folder with zero entries is untested: src/session/files-list-serve.ts:114 decides it with inner.entries.length === 1, and a <= 1 mutant would throw TypeError on inner.entries[0].kind outside the inner try, rejecting the whole attached/ listing, yet no test lists an empty handle folder. Add "attached/empty": { entries: [] } to the forged channel in the test "a folder of two, a folder holding a folder, ..." (tests/files-list-serve.test.mjs:237) and expect ["empty", null].

Checked and held:

  • Code-facing listings: filesListServer has one caller, the FILES_LIST message in src/offscreen.ts:119, sent only by listSessionFiles (src/sw/sw-files-list.ts:55), reached only through listFiles for the files.list command (src/sw/sw-sessions.ts:434, src/session/session-commands.ts:867). ml.fs (FS_CALL, fsServer) and the Python mount (setFilesReader) call the reader's opendir, which this PR does not change.
  • Gating: the inner entry goes through the same row/detailOf as the folder's entries (files-list-serve.ts:104, sw-files-list.ts:59), so a hub sender gets the six fields and the shown name; masking comes from the same reader by the same path (tests/files-list-serve.test.mjs:226, no hunter2 without detail).
  • No nesting: row never copies only, and the worker drops a nested one (tests/files-list-command.test.mjs:83).
  • Two entries, a folder inside, a next page, a refused read and a malformed only each carry none, at the server and at the worker.
  • Upgrade: a page without only draws folders (tests/files-panel.test.mjs:380); a client that ignores the field draws the folder as before.
  • Panel: the one-file row's menu builds the stored path from the handle's and the file's rowLabel (src/chat/files-panel.tsx:258), tested to send /files/attached/9b20e11/quarterly report.txt; no row is a button that still toggles the folder. No assertion was removed from the older panel tests; their fixtures gained a second entry so they still exercise folders.
  • e2e: the .fp-handle text assertions (tests/e2e/chat-web.spec.mjs:4087) can only pass on the one-row drawing.

Not asked:

  • A listing of attached/ now makes one opendir per handle folder, sequentially, each asking the worker for the secret forms again (files-list-serve.ts:110); a page of 500 handles is 501 reads.

Drafted by Claude Code · work: repl-specs · session 7a8ce8b6 · claude-opus-5-5

wanderdev0 and others added 2 commits December 1, 2026 19:45
…n a handle folder stays removable, and a listing reads the forms once

- tests: a handle folder with zero entries carries no `only`.
- panel: a handle folder hidden by a rule on exactly its path is drawn as a folder, so its menu removes that rule; a file's show would leave it standing. UPGRADE row over the fake host, removing the rule for real.
- ranged-reader: `openChannel(volume, { formsOnce })` keeps the secrets' forms for the channel's life; the files.list server's channel uses it, so a listing of attached/ asks once, not once per handle folder. Code's channels still ask at each call (tested).
- FILE_ATTACHMENTS.md item 9 says both.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@wanderdev0

Copy link
Copy Markdown
Owner Author

Named 62b185c3195bdea16517b03af252f8235d780605, no change asked.

Drafted by Claude Code · work: reviews-2 · session f11e77dd · claude-opus-5-5

@wanderdev0
wanderdev0 merged commit 56ee1ec into main Dec 1, 2026
20 checks passed
@wanderdev0
wanderdev0 deleted the feat/handle-folder branch December 1, 2026 19:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

@chat-page src/chat: the chat page, its web build and the installable app @docs Documentation and specs only, no behaviour change @mobile The phone app (mobile/, src/native) or anything that must stay in step with it run:android-flows Runs the phone app's Maestro demo flows on an Android emulator in CI (about 30 min of runner) @ui The sidebar, DevTools panel, HUD and their shared components

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant