HostService.Send: the server's side of a file sent to the room #80

Merged
mikluko merged 2 commits from server-send into main 2026-11-16 09:58:28 +00:00
Owner

Replaces #77, which was based on main; this one is stacked on #75 (server-shown-head, now rebased on main), so its schema step 4 comes after #75's step 3.

Server side of HostService.Send (proto: #74).

  • Host.Send checks the session by its token, then the bounds, calls server.Files.SendFile, and records a File event (no bytes). Chat refusals map: ErrFileTooLarge/ErrFileKind to InvalidArgument, ErrNoRoom to FailedPrecondition, ErrChatDown to Unavailable.
  • LimitSend on the network listener: 401 before the body is read without a live session's token, 413 / MaxBytesReader past the largest file.
  • The File kind is known to the transcript (scanEntry), the page (a notice line) and the raw stream (type: "file"), and has its own migration step to schema 4, which changes only the version.
  • serve.Options.Files is unset until the chat side's Attach is adapted to server.Files; Send answers Unavailable meanwhile. The changelog entry for Send is left to the PR that wires it.
Replaces #77, which was based on main; this one is stacked on #75 (`server-shown-head`, now rebased on main), so its schema step 4 comes after #75's step 3. Server side of `HostService.Send` (proto: #74). - `Host.Send` checks the session by its token, then the bounds, calls `server.Files.SendFile`, and records a `File` event (no bytes). Chat refusals map: `ErrFileTooLarge`/`ErrFileKind` to InvalidArgument, `ErrNoRoom` to FailedPrecondition, `ErrChatDown` to Unavailable. - `LimitSend` on the network listener: 401 before the body is read without a live session's token, 413 / `MaxBytesReader` past the largest file. - The `File` kind is known to the transcript (`scanEntry`), the page (a notice line) and the raw stream (`type: "file"`), and has its own migration step to schema 4, which changes only the version. - `serve.Options.Files` is unset until the chat side's `Attach` is adapted to `server.Files`; Send answers Unavailable meanwhile. The changelog entry for Send is left to the PR that wires it.
The handler checks the bounds itself (the host is not trusted with them),
hands the file to server.Files, and maps the chat side's refusals to codes
the agent reads. A sent file is recorded in the session's stream as a File
event, without its bytes.

The network listener refuses a Send without a live session's token before
reading its body: the call's own check comes after the body is read, so
without it any pod of the namespace could make the server read as much as
it was sent. serve.Options.Files is unset until the chat side's Attach is
adapted to server.Files.

Assisted-By: Claude <noreply@anthropic.com>
A File event is in the transcript, the page and the raw stream: schema version 4
All checks were successful
image / image (pull_request) Successful in 6s
test / go (pull_request) Successful in 44s
test / changelog (pull_request) Successful in 5s
a9da7f8dfd
scanEntry did not know the kind, so the transcript of a start holding a
File failed as a whole. The new kind is also a change of what the database
holds, so it has its own step to version 4, which changes only the version:
a server of version 3 refuses the database instead of failing on a
transcript. Based on #75's step to 3.

Assisted-By: Claude <noreply@anthropic.com>
mikluko force-pushed server-send from a9da7f8dfd
All checks were successful
image / image (pull_request) Successful in 6s
test / go (pull_request) Successful in 44s
test / changelog (pull_request) Successful in 5s
to 972a7a8b93
All checks were successful
image / image (pull_request) Successful in 3s
test / changelog (pull_request) Successful in 6s
test / go (pull_request) Successful in 45s
2026-11-16 09:47:29 +00:00
Compare
mikluko changed target branch from server-shown-head to main 2026-11-16 09:52:26 +00:00
mikluko force-pushed server-send from 972a7a8b93
All checks were successful
image / image (pull_request) Successful in 3s
test / changelog (pull_request) Successful in 6s
test / go (pull_request) Successful in 45s
to 8df0c8d5a0
All checks were successful
test / changelog (pull_request) Successful in 6s
image / image (pull_request) Successful in 22s
test / go (pull_request) Successful in 1m18s
2026-11-16 09:56:55 +00:00
Compare
mikluko deleted branch server-send 2026-11-16 09:58:29 +00:00
Commenting is not possible because the repository is archived.
No reviewers
No labels
No milestone
No project
No assignees
1 participant
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
mikluko/roomcity!80
No description provided.