Repository navigation
Description
Context
Part of #3234. Ruled by the maintainer on #3231 (D1 A, 2026-11-03). The ruling put this route in #3230's scope, but #3230 closed as completed with the epic's first batch before the ruling could be folded in. This issue carries it instead.
POST /api/chat-deletions (createChatDeletionRoutes, packages/ui-server/src/routes/chat-deletions.ts:39-61) is the only way a client can learn the outcome of a deletion operation. Repeating it with the same operationId retries cleanup, and if the first request never arrived it admits the deletion. A client that lost the reply to its first POST therefore cannot ask what happened without possibly deleting the chat. That is why #3231's "Check now" for an unanswered request (state O2 in #3231 design brief rev 5) cannot be a read on the current contract.
The host already keeps a principal-bound record per operation. chatRetirement, packages/ui-server/src/ws/chat-lifecycle.ts:199, looks one up by (operationId, principalId). The catalog exposes it at packages/ui-server/src/ws/session-catalog.ts:322, and createChatDeletion().delete, packages/ui-server/src/ws/chat-deletion.ts:78, already uses it to build the receipt with chatDeletionReceipt, packages/ui-server/src/ws/chat-deletion.ts:41-44. The receipt shape is ChatDeletionReceipt, packages/ui-sdk/src/protocol.ts:2366-2373, documented under "Explicit chat deletion (additive, #3230)" in docs/http-api.md.
Scope
Add GET /api/chat-deletions/:operationId. It is authenticated and principal-bound, it only reads, and it adds no authority. For the calling principal it answers one of these:
- the current
ChatDeletionReceiptfor that operation (same shape and content-free store outcomes as the POST success); not_admitted: no retirement is recorded under that operation for this principal.
An operation recorded for another principal, or not recorded at all, answers the same not_admitted. The answer reveals nothing about other principals' operations or chats.
Out of scope
The #3231 UI. Changing POST semantics, refusal reasons or receipt shape. Any write, retry, cleanup or admission triggered by the read. Listing operations. Recording refused attempts. Owner recording for typed-only chats (#3337).
Acceptance criteria
GET /api/chat-deletions/:operationIdreturns200with the currentChatDeletionReceiptwhen the calling principal has a retirement recorded under thatoperationId.statusandstoresreflect the latest recorded cleanup, so a read after a restart or a Retry shows progress.- Otherwise it returns a content-free
not_admittedanswer with one documented status code and body. The response is byte-identical for an unknown operation, another principal's operation and a refused attempt, and never echoes a title, session id, history owner id or backend. - The route performs no write. A test proves that calling it for an unknown
operationIdand then POSTing thatoperationIdbehaves exactly like a first POST, and that calling it never starts or resumes cleanup (store outcomes and therunningmap are unchanged). - The same authentication rules as the POST apply: unauthenticated
401; agent, ambient-without-owner-mapping and revoked callers refused without existence leakage. A principal revoked between lookup and response gets401, not the receipt. Responses carryCache-Control: no-store, and:operationIdis bounded like the POST's ids. not_admittedmeans nothing was retired under that operation at the moment of the read.docs/http-api.mdstates this, and states that a request still in transit can be admitted afterwards, in which casechat_retiredfollows as usual. The read waits for committed catalog writes, aschatRetirementalready does.- The route is mounted in
createApp. It appears indocs/http-api.md(route table and the explicit-deletion section),docs/http-api-coverage.mdand the integration-contract index, and the HTTP supported-mount and mount-lifetime fixtures are updated.
Verification
Extend packages/ui-server/tests/chat-deletion.test.ts with real file-backed SQLite. Cover receipt after a successful POST, receipt progress after a partial cleanup and retry, not_admitted for unknown, foreign and refused operations (asserting byte-identical bodies), no admission or cleanup side effect from a read, auth refusals, and the read after a host restart. Run bun run test packages/ui-server/tests/chat-deletion.test.ts packages/ui-server/tests/http-supported-mounts.test.ts, typecheck and bun run check:pr --base origin/main. Keep failing-first and restored mutation receipts for: returning another principal's receipt, a distinguishable foreign versus unknown body, and the read triggering cleanup.
Contract impact
Additive HTTP route and response shape. Label contract, use a CONTRACT-prefixed implementation commit, update the authoritative HTTP docs and the integration-contract index in the same commit, update the API report if a public type is added (for example a not_admitted answer type in @schlessera/brain-ui-sdk/protocol), and add a minor changeset. No existing shape changes.
Filed 2026-11-03 from the maintainer ruling on #3231 D1 (A), which named #3230; #3230 had closed as completed before the ruling was folded.
Activity
schlessera commentedon Nov 3, 2026
Claiming (token
claim-3455-df71). Branchfeat/3455-chat-deletion-read, based onepic/3234-chat-deletion(@ d38eb1e) under the per-epic integration process. Path collisions detected (detection only): #3456 (same epic;docs/http-api.md,chat-lifecycle.ts,session-catalog.ts), #3342, #3386, #3404, #3407, #3443, #3448 (docs/http-api.md/protocol.ts). I'll avoid editing #3456's files beyond the docs table rows.schlessera commentedon Nov 3, 2026
PR #3473 (against
epic/3234-chat-deletion, headcd913e8dc) implements the read-onlyGET /api/chat-deletions/:operationId. It is ready for review, with milestone 0.45.0. It closes when the epic batch lands on main. Claim retained while the PR is live (claim-3455-df71).CONTRACT: feat(ui-server): read one chat deletion's outcome without r…