Plan: fold in Fable's re-review (B7, B8 and the Base nits)
Human
Prompt
Fold B7 (no IDs of a send in flight in the discard beacon; clear chips on pageshow persisted) and B8 (check whether a Finder-copied file reaches Chrome with its name in text/plain; words win only when text/html has real words or text/plain is more than the files' names) into the plan before building, and take the cheap Base nits.
From this commit's own message. The prompt ledger has no entries for it — which is what a squashed, rebased or amended commit looks like, and what every commit looks like in a repo without a ledger.
Summary
P11: the beacon skips a send in flight, pageshow persisted clears chips, words vs chips on leaving; P12: the narrowed paste rule and what B8 turned out to be in Chrome; P1: SetReadDeadline's error, deleting an upload whose client has gone; P3: the name parsed from Equipo's header, then rebuilt; P10: only an attachment 422 is stale. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2 files changed,
+85
−19
docs/superpowers/plans/2026-11-26-ask-attachments-slice1.md+83 −17docs/superpowers/specs/2026-11-26-ask-attachments-design.md+2 −2
CI passed — run details
CI log
=== build === CGO_ENABLED=0 go build ./... === vet === go vet ./... === fmt-check === === staticcheck === go run honnef.co/go/tools/cmd/staticcheck@v0.7.0 ./... === govulncheck === go run golang.org/x/vuln/cmd/govulncheck@v1.8.0 ./... No vulnerabilities found. === gitleaks === [90m2:20PM[0m [32mINF[0m [1mUnknown SCM platform. Use --platform to include links in findings.[0m [36mhost=[0mamadan.net [90m2:20PM[0m [32mINF[0m [1m1 commits scanned.[0m [90m2:20PM[0m [32mINF[0m [1mscanned ~2539633 bytes (2.54 MB) in 281ms[0m [90m2:20PM[0m [32mINF[0m [1mno leaks found[0m === budget === go run amadan.net/rastrillo/rastrillo/cmd/rastrillo budget size budget size: 22 directories within budget === script-test === scripts/prepare-apps_test.sh ok releases lookup failure stops before ship ok app owned elsewhere stops the script ok apps listing failure stops before create ok ambiguous release dir is refused ok explicit version resolves the ambiguity ok releases match is exact, not substring ok shipped version is only promoted, existing app not created ok fresh account creates, ships, promotes to edge, enables ok failing promote stops the script ok ship is retried while uploads are rate limited all passed hack/fonts_test.sh fonts_test: ok === test === go run amadan.net/rastrillo/rastrillo/cmd/rastrillo budget test -count=1 ./... receipt: test step 8.362s against a 60s target (the gate's other steps are not in this figure) receipt: 16 packages ran, 0 cached, 6 without tests, 0 failed receipt: slow package 7.068s amadan.net/oficina/base/internal/webtest receipt: slow package 973ms amadan.net/oficina/base/internal/issuer receipt: slow package 647ms amadan.net/oficina/base/internal/operations receipt: slow package 393ms amadan.net/oficina/base/internal/consumer receipt: slow package 260ms amadan.net/oficina/base/internal/e2e receipt: slow test 1.52s amadan.net/oficina/base/internal/webtest TestHomeDoesNotWaitOnAStalledSnapshot receipt: slow test 1.1s amadan.net/oficina/base/internal/webtest TestAskZoneIsToldOnce receipt: slow test 580ms amadan.net/oficina/base/internal/issuer TestAuthorizeSignsForInstalledApp receipt: slow test 520ms amadan.net/oficina/base/internal/operations TestOperationsRefusals receipt: slow test 350ms amadan.net/oficina/base/internal/issuer TestAuthorizeRefusals === native === strings: copy review's strings.json is not here (git-ignored); its comparison skipped strings: 119 in the catalog, 116 used worktree-lib_test: ok
diff --git a/docs/superpowers/plans/2026-11-26-ask-attachments-slice1.md b/docs/superpowers/plans/2026-11-26-ask-attachments-slice1.md| index 642e011..990b1fd 100644 |
| --- a/docs/superpowers/plans/2026-11-26-ask-attachments-slice1.md |
| +++ b/docs/superpowers/plans/2026-11-26-ask-attachments-slice1.md |
| @@ -14,11 +14,13 @@ half is `oficina/equipo` |
| plan of the same name as this one. |
| **Review:** this revision answers Fable's plan review of 2026-11-26: B1 to |
| -B6, and the cheap nits. |
| +B6, and the cheap nits. Fable's re-review approved it with two edits, B7 |
| +(P11) and B8 (P12), folded in here with the Base nits it took (P1, P3, |
| +P10, P11). |
| -**Branch:** `design/ask-attachments` holds the spec and this plan. Build on |
| -`feat/ask-attachments`, from `origin/main` (`0a6e8bc` when this was |
| -written). |
| +**Branch:** `design/ask-attachments` holds the spec and this plan, and the |
| +build goes on the same branch (the controller's call, 2026-11-26), from |
| +`origin/main` `0a6e8bc`. |
| **Order between the repos:** |
| @@ -53,6 +55,16 @@ written). |
| of 60 s, into memory, to at most 10 MiB plus 1 byte. A stalled body |
| fails at the deadline and gives its slot back. Peak memory is about |
| 4 × 10 MiB. |
| + - **No deadline, no read** (Fable nit). If `SetReadDeadline` fails (a |
| + middleware that wraps the writer without `Unwrap`), the upload is |
| + logged and refused `503` before the body is read, never read without |
| + a deadline. The webtest goes through the whole router, so it would |
| + catch such a middleware. |
| + - **A client gone mid-flight** (Fable nit). The relay to Equipo runs on |
| + a context that outlives the request (`context.WithoutCancel`, 60 s), |
| + so an upload Equipo takes is never half-known. If the page has gone |
| + (Remove aborted the XHR) by the time Equipo answers, Base deletes the |
| + upload at once. |
| - **Waiting.** A request that waits more than 10 s for a slot is `503` |
| with `Retry-After: 2`. |
| - **The page.** `ask-attach.js` uploads two files at a time, and retries |
| @@ -74,9 +86,11 @@ written). |
| - **Download.** The other five types (PDF, text, Markdown, CSV, JSON). |
| Text types get `; charset=utf-8`. |
| - **Anything else** is `application/octet-stream`, as a download. |
| - - **The name.** `Content-Disposition` is built by Base from the name |
| - Equipo gives, with `mime.FormatMediaType`. Equipo's own header is never |
| - used. |
| + - **The name.** Base parses the file name out of Equipo's |
| + `Content-Disposition` (`mime.ParseMediaType`, `filename`), the only |
| + place a read gives it. Base then builds its own header from that name |
| + with `mime.FormatMediaType` and its own disposition. Equipo's header |
| + is never passed on. |
| - **Always.** |
| - `X-Content-Type-Options: nosniff`. |
| - `Content-Security-Policy: default-src 'none'; img-src 'self'; style-src 'unsafe-inline'; sandbox`. |
| @@ -130,6 +144,12 @@ written). |
| - **Stale upload.** Equipo's `422` on a send with files (an upload |
| expired, or already sent) answers `422 {"state":"ready","files":"stale"}`. |
| The page marks every chip "attach it again", and Remove clears them. |
| + - **Only an attachment's `422` is stale** (Fable nit). Base checks the |
| + text as Equipo does before relaying (valid UTF-8, no NUL, at most |
| + 16 KiB after trimming) and the key's reserved prefixes (`reply:`, |
| + `card:`, `handoff:`). Bad text is Base's own `422 {"state":"ready"}`, |
| + with no `files`. So an Equipo `422` on a send with files can only be |
| + the files. |
| - **Words alone.** A send with no files keeps today's mapping. |
| - **P11. Remove frees the upload (D6, Fable B6).** |
| - Remove calls `DELETE /ask/attachments/{id}` once the upload has an ID. |
| @@ -138,13 +158,43 @@ written). |
| - On `pagehide`, `navigator.sendBeacon` posts the unsent IDs to |
| `POST /ask/attachments/discard`. Base deletes each as best it can, and |
| always answers `204`. |
| + - **Not a send in flight** (Fable B7). The beacon leaves out every ID |
| + that is part of a send still on its way: the send links them, and a |
| + delete racing it would lose the message. If that send fails after |
| + all, the 24-hour drop takes them. |
| + - **Back and forward** (Fable B7). A page kept in the back/forward cache |
| + comes back with chips whose uploads the beacon deleted. On `pageshow` |
| + with `persisted`, the page clears its chips. |
| - Chips don't survive a reload. |
| -- **P12. Paste (D8, Fable B5).** On `paste`: |
| - - **With words.** If `clipboardData` holds `text/plain` or `text/html` |
| - with any non-space text, the existing text path runs (`pasteMarkdown` |
| - or plain), and nothing is attached. |
| - - **Files only.** Only when `clipboardData.files` is non-empty and there |
| - is no text are the files attached, and the default is prevented. |
| + - **The words in the field** (Fable nit). Leaving the page drops the |
| + chips and the words alike: a new page draws an empty composer, as |
| + today (the field is `autocomplete="off"`, so the browser doesn't |
| + restore it). The docked panel and the Ask page behave the same. The one |
| + exception is the back/forward cache, which brings the whole page back: |
| + the words are still there, and only the chips go, since their uploads |
| + are gone. |
| +- **P12. Paste (D8, Fable B5 and B8).** On `paste`, with files on the |
| + clipboard: |
| + - **Words win** only when there are real words: `text/html` whose text |
| + (parsed inertly, as `pasteMarkdown` does) has non-space characters, |
| + or `text/plain` that is more than the files' own names (each line |
| + trimmed, every line that is one of the files' names dropped, and |
| + something left). Then the existing text path runs (`pasteMarkdown` or |
| + plain), and nothing is attached. Word, Excel, Pages and Numbers land |
| + here. |
| + - **Otherwise the files are attached,** and the default is prevented, so |
| + no name is typed into the field. |
| + - **What B8 turned out to be** (checked 2026-11-26 in Chrome for Testing |
| + 159 on macOS, with a real paste from the system pasteboard holding a |
| + file as Finder's Copy writes it: its file URL and its name as plain |
| + text). Chrome gives the page `types: ["Files"]` and no `text/plain`, |
| + so "text wins" would not have stopped the file. But Chrome's own |
| + default then types the file's name into the field, which this rule |
| + prevents. A clipboard with text, HTML and an image (as Office writes) |
| + gives all three, and the words win. Safari, and Finder's own Copy |
| + (its automation was refused here), are still to check by hand in |
| + Task 12; the narrowed rule covers a browser that does put the name in |
| + `text/plain`. |
| - **P13. The flag is `can_attach`** (Fable nit), in Equipo's snapshot and |
| in `/ask/state`. Each message's list is `attachments`. |
| @@ -228,7 +278,11 @@ written). |
| - A `401` from Equipo drops the link. |
| - **A stalled body** (Fable B3): send headers and half a body, then |
| stop. Within the read deadline (set short in the test), the request |
| - fails and its slot is free. Then four more uploads all succeed. |
| + fails and its slot is free. Then four more uploads all succeed. The |
| + test goes through the whole router, so a middleware that hides the |
| + deadline fails it. |
| + - **A client gone mid-flight** (nit): with the upload held in the fake, |
| + the client gives up; once the fake answers, Base deletes the upload. |
| - **Busy.** With 4 uploads held in the fake, a fifth waits, then gets |
| `503` and `Retry-After`. |
| - **The slot comes first.** A test hook records the slot count when the |
| @@ -287,8 +341,9 @@ written). |
| `TestAskSendRelaysWithBearer` extended): |
| - **What sends.** `text` and two `attachments` relay in order. |
| `attachments` with empty `text` sends. |
| - - **Base's own `422`s:** six files, a malformed ID, and an empty message |
| - with no files. |
| + - **Base's own `422`s:** six files, a malformed ID, an empty message |
| + with no files, and text with a NUL or bad UTF-8 beside files (no |
| + `files` in the answer, and no call to Equipo). |
| - **`FilesReady(false)`.** A send with files is |
| `409 {"state":"ready","files":"unavailable"}`. Nothing in the link |
| changes, and the page's state stays `ready`. A words-only send right |
| @@ -344,13 +399,18 @@ written). |
| chip then shows its thumbnail from `/ask/attachments/…/preview`. |
| - **A PDF.** Its chip shows "Ask can't read PDFs yet" (D4), and it still |
| sends. |
| - - **Paste** (P12, Fable B5): |
| + - **Paste** (P12, Fable B5 and B8): |
| - a `DataTransfer` holding only a PNG `File` attaches it, and the field |
| is unchanged; |
| - one holding a PNG **and** `text/html` with a table pastes the table |
| as Markdown and attaches nothing; |
| - one holding a PNG and `text/plain` pastes the text and attaches |
| nothing; |
| + - one holding a `.md` `File` and its own name as `text/plain` (a file |
| + copied in the Finder, as a browser may hand it over) attaches the |
| + file and types nothing; |
| + - one holding a PNG and `text/html` with only `<img>` (Copy Image in |
| + a browser) attaches it; |
| - the existing paste tests pass unchanged. |
| - **Drop.** `dragenter`, `dragover` and `drop` with a `File` attach it. |
| The outline shows during the drag and goes after. |
| @@ -381,6 +441,10 @@ written). |
| - with `ExpireUploads()`, the chips say "attach it again". |
| - **Beacon.** On `pagehide` with two unsent chips, the fake sees both |
| deleted. |
| + - **A send in flight** (B7): with the send held in the fake, `pagehide` |
| + deletes nothing, and the message lands with its files. |
| + - **Back/forward** (B7): a `pageshow` with `persisted` clears the |
| + chips, and the words stay. |
| - **The thread.** The sent message shows thumbnails and pills from the |
| `message` event, drawn like the server's. |
| - **The viewer.** |
| @@ -481,6 +545,8 @@ written). |
| report false green"). |
| - [ ] **Check it live, as Paul:** |
| - attach a screenshot and a `.md`, and ask about both; |
| + - copy a file in the Finder and paste it, in Chrome and in Safari (B8); |
| + - Copy Image in a browser and paste it (B8); |
| - two messages later, ask about the `.md` again; |
| - paste an image, and paste a table from Numbers; |
| - remove a chip; |
diff --git a/docs/superpowers/specs/2026-11-26-ask-attachments-design.md b/docs/superpowers/specs/2026-11-26-ask-attachments-design.md| index 1aedef6..e0a148f 100644 |
| --- a/docs/superpowers/specs/2026-11-26-ask-attachments-design.md |
| +++ b/docs/superpowers/specs/2026-11-26-ask-attachments-design.md |
| @@ -48,7 +48,7 @@ Design decisions that follow from these: |
| | D5 | **Refused files never take Ask down** (Fable B1, B2). When a send with files is refused because the runner can't take them, Ask stays ready: the paperclip goes, and the chips say why. A stale upload, refused at send, is marked "attach it again" on its chip. Words always still send. | Showing the whole chat's "needs an update" state for a file. | |
| | D6 | **Remove frees the upload** (Fable E1, B6). Equipo gains a delete for unsent uploads, and Base calls it on Remove. Chips don't survive a reload: when the page goes away, Base asks Equipo, as best it can, to delete what was never sent. The 24-hour drop catches the rest. | Evicting the oldest unsent upload. That silently drops a file the person may still mean to send from another tab. | |
| | D7 | **Base decides what is shown inline, not Equipo** (Fable B4). Only PNG, JPEG, WebP and GIF are served inline. Everything else is a download, and any type outside the nine is `application/octet-stream`. | Passing Equipo's headers through on Base's origin, where the session lives. | |
| -| D8 | **A paste with words pastes the words** (Fable B5). Files are attached only when the clipboard holds files and no text. Word, Excel, Pages and Numbers put a picture of the selection beside its text, and a table pasted from Excel stays a table. | Attaching every image on the clipboard. | |
| +| D8 | **A paste with words pastes the words** (Fable B5, B8). Files are attached only when the clipboard holds no words beyond the files' own names (plan P12). Word, Excel, Pages and Numbers put a picture of the selection beside its text, and a table pasted from Excel stays a table. | Attaching every image on the clipboard. | |
| ## 1. What exists today |
| @@ -151,7 +151,7 @@ Design decisions that follow from these: |
| - Files dropped on the composer are attached. An outline shows while |
| something is dragged over it. |
| - A pasted image (a screenshot) or a copied file is attached, but only |
| - when the clipboard holds no text (D8). |
| + when the clipboard holds no words beyond the files' own names (D8). |
| - A paste with words pastes the words, and a rich-text paste stays |
| Markdown, as now (`ask.js:1676`). |
| - **Chips.** Each file gets a chip above the text field: a file mark, its |