Text chat 42: apps/fluxer channel-type runtime (#327) #450

Manually merged
charles merged 11 commits from textchat-42-app-channel-types-runtime into textchat 2026-11-13 12:28:26 +00:00
Owner

What this builds

Text chat 42 (apps/fluxer channel-type runtime, spec §18.3/§18.4):

  • runtime::perform_chat now carries out every Phase 5 ApiRequest of Task 38 through Task 37's calls: FetchChannel (GET, retried), CreateForumPost (JSON), SearchThreads (HTTP 202 → ThreadSearchResponse::NotReady, retried GET), PostData (fluxer-api splits into calls of 100), ArchivedThreads (Public/Private page by archive timestamp, MinePrivate by thread id), EditThread, DeleteChannel, Add/RemoveThreadMember, PatchThreadMemberSettings, Crosspost, CrosspostSource (retried GET), FollowChannel, PurgeNotes, each answered with the matching ApiResult. No request returns CLIENT_NOT_WIRED any more.
  • upload_rt: UploadCommand::StartForumPost runs as a job like a message send: multipart POST /channels/{forum}/threads (payload_json + files[n]) or the presigned flow (presign/PUT/complete in the forum, then the JSON post with upload_filename per attachment), with throttled progress and UploadEvent::ForumPostDone (or Failed), cancellable by nonce. The upload code was generalised over a small Job view (nonce, presign channel, attachment entries, files) so both kinds share the multipart and presigned paths; the message path behaves as before.
  • Op 14 (threads: true) and op 28 frames already go out through the existing Effect::SendGateway; the tests confirm the forum's posts arrive by THREAD_LIST_SYNC.
  • upload_rt::perform_upload (doc-hidden, like perform_chat): runs one UploadCommand inline and returns its reports, for end-to-end tests of jobs the store does not start yet (Task 39 starts forum posts).
  • READMEs: apps/fluxer describes the new requests and forum-post jobs; the fluxer-core README line saying the runtime fails them is updated.

How it was tested

apps/fluxer/tests/channel_types_runtime.rs against the in-process devserver (textchat and textchat_presigned scenarios):
forum_opens_with_posts_after_thread_sync, create_post_with_image_multipart_then_opens_it, create_post_with_image_presigned_then_opens_it (extra), forum_post_without_files_is_json (extra), thread_search_not_ready_then_results, unknown_thread_fetched_and_messages_shown, crosspost_round_trip (with follow and crosspost-source), purge_notes_round_trip, thread_administration_requests_round_trip (extra: fetch, edit, members, settings, all three archived lists, delete).
I ran them before the change and watched them fail (CLIENT_NOT_WIRED, "forum post uploads are not supported yet"), then pass. FLUXER_SCREENSHOT_TESTS=1 cargo xtask ci is green locally. No test needs a display, clipboard, file dialog or the live instance.

Deviations from the plan

  • The store does not yet issue most of these requests or start forum-post jobs (Tasks 39 and 40), so the tests call perform_chat / perform_upload directly, as the Text chat 21 tests do. Where the store already acts (op 14 subscription, opening an unknown thread, gateway echoes such as MESSAGE_UPDATE, MESSAGE_DELETE_BULK, THREAD_CREATE, the CHANNEL_FOLLOW_ADD message) the tests check the store.
  • forum_opens_with_posts_after_thread_sync and unknown_thread_fetched_and_messages_shown depend partly on code that was already wired (Task 38 + SendGateway). The first one also checks PostData, which failed before this change; the second one passed only after FetchChannel was wired.
  • ApiRequest::ArchivedThreads has no limit, so the runtime asks for 50 per page (the server's default, and what the original's thread browser gets). The original's forum fallback asks for 25; if Task 39 needs that, the request should get a limit field. A before of the wrong kind for the list (which the store never sends) starts from the newest page.
  • Test-only change: the forum test selects the guild before the channel, as the sidebar does, because the thread subscription follows SelectGuild.

Stacked on: textchat-37-api-channel-types, textchat-38-core-channel-routing, textchat-41-devserver-channel-types

Follow-up from review: #454 (ArchivedThreads has no limit). Branch updated with current textchat and textchat-38-core-channel-routing (666d3aa); FLUXER_SCREENSHOT_TESTS=1 cargo xtask ci green again.

Closes #327

🤖 Generated with Claude Code

## What this builds Text chat 42 (`apps/fluxer` channel-type runtime, spec §18.3/§18.4): - `runtime::perform_chat` now carries out every Phase 5 `ApiRequest` of Task 38 through Task 37's calls: `FetchChannel` (GET, retried), `CreateForumPost` (JSON), `SearchThreads` (HTTP 202 → `ThreadSearchResponse::NotReady`, retried GET), `PostData` (fluxer-api splits into calls of 100), `ArchivedThreads` (Public/Private page by archive timestamp, MinePrivate by thread id), `EditThread`, `DeleteChannel`, `Add/RemoveThreadMember`, `PatchThreadMemberSettings`, `Crosspost`, `CrosspostSource` (retried GET), `FollowChannel`, `PurgeNotes`, each answered with the matching `ApiResult`. No request returns `CLIENT_NOT_WIRED` any more. - `upload_rt`: `UploadCommand::StartForumPost` runs as a job like a message send: multipart `POST /channels/{forum}/threads` (`payload_json` + `files[n]`) or the presigned flow (presign/PUT/complete in the forum, then the JSON post with `upload_filename` per attachment), with throttled progress and `UploadEvent::ForumPostDone` (or `Failed`), cancellable by nonce. The upload code was generalised over a small `Job` view (nonce, presign channel, attachment entries, files) so both kinds share the multipart and presigned paths; the message path behaves as before. - Op 14 (`threads: true`) and op 28 frames already go out through the existing `Effect::SendGateway`; the tests confirm the forum's posts arrive by `THREAD_LIST_SYNC`. - `upload_rt::perform_upload` (doc-hidden, like `perform_chat`): runs one `UploadCommand` inline and returns its reports, for end-to-end tests of jobs the store does not start yet (Task 39 starts forum posts). - READMEs: `apps/fluxer` describes the new requests and forum-post jobs; the `fluxer-core` README line saying the runtime fails them is updated. ## How it was tested `apps/fluxer/tests/channel_types_runtime.rs` against the in-process devserver (`textchat` and `textchat_presigned` scenarios): `forum_opens_with_posts_after_thread_sync`, `create_post_with_image_multipart_then_opens_it`, `create_post_with_image_presigned_then_opens_it` (extra), `forum_post_without_files_is_json` (extra), `thread_search_not_ready_then_results`, `unknown_thread_fetched_and_messages_shown`, `crosspost_round_trip` (with follow and crosspost-source), `purge_notes_round_trip`, `thread_administration_requests_round_trip` (extra: fetch, edit, members, settings, all three archived lists, delete). I ran them before the change and watched them fail (`CLIENT_NOT_WIRED`, "forum post uploads are not supported yet"), then pass. `FLUXER_SCREENSHOT_TESTS=1 cargo xtask ci` is green locally. No test needs a display, clipboard, file dialog or the live instance. ## Deviations from the plan - The store does not yet issue most of these requests or start forum-post jobs (Tasks 39 and 40), so the tests call `perform_chat` / `perform_upload` directly, as the Text chat 21 tests do. Where the store already acts (op 14 subscription, opening an unknown thread, gateway echoes such as `MESSAGE_UPDATE`, `MESSAGE_DELETE_BULK`, `THREAD_CREATE`, the `CHANNEL_FOLLOW_ADD` message) the tests check the store. - `forum_opens_with_posts_after_thread_sync` and `unknown_thread_fetched_and_messages_shown` depend partly on code that was already wired (Task 38 + `SendGateway`). The first one also checks `PostData`, which failed before this change; the second one passed only after `FetchChannel` was wired. - `ApiRequest::ArchivedThreads` has no `limit`, so the runtime asks for 50 per page (the server's default, and what the original's thread browser gets). The original's forum fallback asks for 25; if Task 39 needs that, the request should get a `limit` field. A `before` of the wrong kind for the list (which the store never sends) starts from the newest page. - Test-only change: the forum test selects the guild before the channel, as the sidebar does, because the thread subscription follows `SelectGuild`. Stacked on: textchat-37-api-channel-types, textchat-38-core-channel-routing, textchat-41-devserver-channel-types Follow-up from review: #454 (ArchivedThreads has no limit). Branch updated with current textchat and textchat-38-core-channel-routing (666d3aa); FLUXER_SCREENSHOT_TESTS=1 cargo xtask ci green again. Closes #327 🤖 Generated with [Claude Code](https://claude.com/claude-code)
The forum #ideas (30 posts), the media channel #gallery (8 posts), the
announcement channel #releases and its thread, the link channel "Docs", the
voice channel "Hangout", the private thread "Moderators only" and the
personal notes, appended to textchat_ready.json; READY's `threads` keeps
only the active threads the user joined, "Old bikeshed" moves to
textchat/channel_types.json. Moderators gain MANAGE_WEBHOOKS (follow).

Shapes follow the server source (fork ba98441b4):
- threads: mapThreadToResponse, api/channel/services/thread/ThreadMappers.ts,
  as in THREAD_CREATE (ThreadDispatch.ts:26-39); private thread metadata
  with `invitable` (S/channel/ThreadSchemas.ts:20-29)
- forum and media parents: ThreadParentSettings.ts:180-222 (flags,
  available_tags, default_* fields); link channel `url`
- forum/media fields and flags: C/ThreadConstants.ts:44-48, 94-148
- personal notes: id equal to the user's (isPersonalNotesChannelId,
  MessageDeleteService.ts:247), type 999
- messages: MessageResponseSchema as in textchat/history.json; the
  published message carries CROSSPOSTED (C/ChannelConstants.ts:117)

Refs #326

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Refs #322

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The textchat scenario serves the channel types of spec §18.6: READY lists
only the joined active threads; op 14 `threads: true` answers with a
THREAD_LIST_SYNC of the guild and `thread_member_lists` with
THREAD_MEMBER_LIST_UPDATE; op 28 answers FORUM_UNREADS. REST: GET
/channels/{id}, forum and media posts (JSON and multipart, tag rules,
starter id = post id, THREAD_CREATE then MESSAGE_CREATE), thread search
(202 on the first call per channel, then filtered, sorted and paged, with
first_messages), post-data, the archived lists, PATCH/DELETE of threads,
thread members and member settings, crosspost and crosspost-source,
followers (CHANNEL_FOLLOW_ADD notice) and the personal notes purge. Thread
and forum routes are a 404 without X-Fluxer-Features: channel_threads;
`thread_search = false` turns the search off.

Refs #326

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Refs #323

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
Refs #327

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
Every Phase 5 ApiRequest goes through the fluxer-api calls of Text chat 37;
UploadCommand::StartForumPost takes the multipart or the presigned path and
reports ForumPostDone.

Refs #327

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
Author
Owner

Independent review: Text chat 42 (app channel-type runtime)

Reviewed df84215..0d1cec6 (runtime.rs, upload_rt.rs, tests/channel_types_runtime.rs, two README lines).

Plan tests (1): all 6 named tests exist (forum_opens_with_posts_after_thread_sync, create_post_with_image_multipart_then_opens_it, thread_search_not_ready_then_results, unknown_thread_fetched_and_messages_shown, crosspost_round_trip, purge_notes_round_trip) and run against the devserver textchat scenario. There are 3 more tests: a presigned post, a JSON post and a thread-admin round trip.
Interfaces (2): every Phase 5 ApiRequest is executed in perform_chat through Task 37's calls and returns the Task 38 ApiResult variants. The exhaustive list arm is gone, so nothing falls through to not_a_chat_request. UploadCommand::StartForumPost runs multipart (create_forum_post_with_files) or presigned in the forum, then the JSON post with upload_filename, and reports progress and UploadEvent::ForumPostDone. Op 14 and op 28 go out unchanged through Effect::SendGateway. The message upload path was refactored into Job without changing its behaviour; the Text chat 21 tests still pass.
Invariants (3): only apps/fluxer changed. No new dependencies or fixtures. Logs contain only the file count and mode, with no paths or URLs. The forum multipart call and the presign/PUT/complete calls are unobserved in fluxer-api, so --record does not see them. The JSON post after a presign is observed, the same as the existing message path, and it holds only upload_filename keys. Archived before of the wrong kind is ignored and does not panic.
Review Focus (4): items 4 and 5 (upload flow shape, no leaks) hold for forum posts, which use the same code path as messages.
CI (5): FLUXER_SCREENSHOT_TESTS=1 cargo xtask ci is green in the review worktree (all steps passed; channel_types_runtime 9/9).

Findings

  1. minor, apps/fluxer/src/runtime.rs ARCHIVED_PAGE = 50: ApiRequest::ArchivedThreads has no limit, so every archived list asks for 50. Spec §18.2.1 (design doc line 990) says the forum fallback is threads/archived/public?...&limit=25. Task 39's fallback will page by 50 rather than the original's 25. This is not a data problem, but Task 39 should either add a limit to the request or accept 50. Suggest a follow-up issue.
  2. minor, apps/fluxer/tests/channel_types_runtime.rs (crosspost_round_trip, the CrosspostSource part): the test passes on any HTTP error except CLIENT_NOT_WIRED. PUBLISHED is the source message in #releases (not an IS_CROSSPOST copy), so the devserver answers UNKNOWN_MESSAGE and the success branch never runs. Pointing it at a crossposted copy or the follow notice in #general would actually test the CrosspostSource result.

Verdict: approve. No blocking findings; local CI is green.

🤖 Generated with Claude Code

## Independent review: Text chat 42 (app channel-type runtime) Reviewed `df84215..0d1cec6` (runtime.rs, upload_rt.rs, tests/channel_types_runtime.rs, two README lines). **Plan tests (1):** all 6 named tests exist (`forum_opens_with_posts_after_thread_sync`, `create_post_with_image_multipart_then_opens_it`, `thread_search_not_ready_then_results`, `unknown_thread_fetched_and_messages_shown`, `crosspost_round_trip`, `purge_notes_round_trip`) and run against the devserver `textchat` scenario. There are 3 more tests: a presigned post, a JSON post and a thread-admin round trip. **Interfaces (2):** every Phase 5 `ApiRequest` is executed in `perform_chat` through Task 37's calls and returns the Task 38 `ApiResult` variants. The exhaustive list arm is gone, so nothing falls through to `not_a_chat_request`. `UploadCommand::StartForumPost` runs multipart (`create_forum_post_with_files`) or presigned in the forum, then the JSON post with `upload_filename`, and reports progress and `UploadEvent::ForumPostDone`. Op 14 and op 28 go out unchanged through `Effect::SendGateway`. The message upload path was refactored into `Job` without changing its behaviour; the Text chat 21 tests still pass. **Invariants (3):** only `apps/fluxer` changed. No new dependencies or fixtures. Logs contain only the file count and mode, with no paths or URLs. The forum multipart call and the presign/PUT/complete calls are unobserved in fluxer-api, so `--record` does not see them. The JSON post after a presign is observed, the same as the existing message path, and it holds only `upload_filename` keys. Archived `before` of the wrong kind is ignored and does not panic. **Review Focus (4):** items 4 and 5 (upload flow shape, no leaks) hold for forum posts, which use the same code path as messages. **CI (5):** `FLUXER_SCREENSHOT_TESTS=1 cargo xtask ci` is green in the review worktree (all steps passed; channel_types_runtime 9/9). ### Findings 1. **minor**, `apps/fluxer/src/runtime.rs` `ARCHIVED_PAGE = 50`: `ApiRequest::ArchivedThreads` has no limit, so every archived list asks for 50. Spec §18.2.1 (design doc line 990) says the forum fallback is `threads/archived/public?...&limit=25`. Task 39's fallback will page by 50 rather than the original's 25. This is not a data problem, but Task 39 should either add a `limit` to the request or accept 50. Suggest a follow-up issue. 2. **minor**, `apps/fluxer/tests/channel_types_runtime.rs` (`crosspost_round_trip`, the CrosspostSource part): the test passes on any HTTP error except `CLIENT_NOT_WIRED`. `PUBLISHED` is the source message in #releases (not an `IS_CROSSPOST` copy), so the devserver answers UNKNOWN_MESSAGE and the success branch never runs. Pointing it at a crossposted copy or the follow notice in #general would actually test the `CrosspostSource` result. **Verdict: approve.** No blocking findings; local CI is green. 🤖 Generated with [Claude Code](https://claude.com/claude-code)
# Conflicts:
#	crates/fluxer-core/src/app.rs
#	crates/fluxer-core/src/chat/state.rs
#	crates/fluxer-core/src/effect.rs
#	crates/fluxer-core/src/event.rs
#	crates/fluxer-core/src/messages.rs
#	crates/fluxer-core/src/persist.rs
charles manually merged commit ba7cf9d2ec into textchat 2026-11-13 12:28:26 +00:00
Author
Owner

Independent review: Text chat 42 (channel-type runtime), head 666d3aa

Scope: task commits 8dfde6d and 0d1cec6 against base df84215, plus the merges into 666d3aa. After the merges, only runtime.rs changed in the task's files (+8/-2).

Checks

  1. Tests: all six tests the plan names are there and check what the plan asks for: forum_opens_with_posts_after_thread_sync, create_post_with_image_multipart_then_opens_it, thread_search_not_ready_then_results, unknown_thread_fetched_and_messages_shown, crosspost_round_trip and purge_notes_round_trip. Three more were added: the presigned forum post, the JSON post with a 400 when the tag is missing, and a round trip of the thread administration calls. The values match the fixtures and the spec: 23 active posts in #ideas, 30 search results, 4 purged notes, the starter's id equal to the post id, and CROSSPOSTED set.
  2. Interfaces: perform_chat now handles every Phase 5 ApiRequest (the not-wired fallback is gone) and builds the matching ApiResult variants from Task 38. UploadCommand::StartForumPost uses the multipart path or the presigned path (presign in the forum, then the JSON post with upload_filename, as ForumCommands.ts:58-102 does). It reports throttled progress, then UploadEvent::ForumPostDone, or Failed on an error. Op 14 goes out through the existing Effect::SendGateway, which the forum test exercises. Nothing another task consumes was renamed.
  3. Invariants: no changes to the dependencies of fluxer-core, fluxer-ui or fluxer-emoji. The new logs carry only file counts and the upload mode. No URLs, paths or file bytes are logged. The task adds no new fixtures. Server errors come back as ApiError/CoreError, never as a panic.
  4. Review Focus 4 and 5 (uploads, no leaks): the forum path uses the same multipart builder and presign/PUT/complete code as messages, which the Job struct now shares. The message path behaves as before.
  5. FLUXER_SCREENSHOT_TESTS=1 cargo xtask ci in the review worktree: green ("all steps passed"; channel_types_runtime 9/9).

Findings

  • [minor] runtime.rs ARCHIVED_PAGE = 50: spec §18.2.1 says the forum fallback (threads/archived/public) asks for limit=25. ApiRequest::ArchivedThreads (Task 38) has no limit field, so this cannot be fixed here without changing an interface. Follow-up #454 tracks it and the PR links it. Acceptable.
  • [minor] channel_types_runtime.rs crosspost_round_trip: the CrosspostSource call targets the source message PUBLISHED. The devserver answers UNKNOWN_MESSAGE for it, because it only answers for copies (IS_CROSSPOST) or CHANNEL_FOLLOW_ADD notices (forums.rs:1092). So the Ok branch never runs, and the assertion only proves the request is wired. Pointing it at the follow notice the test has just created in #general would check the success path. This is not blocking: the endpoint mapping itself is covered by the Task 37 wiremock tests.

Verdict: approve. No blocking findings, and local CI is green.

## Independent review: Text chat 42 (channel-type runtime), head 666d3aa Scope: task commits 8dfde6d and 0d1cec6 against base df84215, plus the merges into 666d3aa. After the merges, only `runtime.rs` changed in the task's files (+8/-2). **Checks** 1. Tests: all six tests the plan names are there and check what the plan asks for: `forum_opens_with_posts_after_thread_sync`, `create_post_with_image_multipart_then_opens_it`, `thread_search_not_ready_then_results`, `unknown_thread_fetched_and_messages_shown`, `crosspost_round_trip` and `purge_notes_round_trip`. Three more were added: the presigned forum post, the JSON post with a 400 when the tag is missing, and a round trip of the thread administration calls. The values match the fixtures and the spec: 23 active posts in #ideas, 30 search results, 4 purged notes, the starter's id equal to the post id, and `CROSSPOSTED` set. 2. Interfaces: `perform_chat` now handles every Phase 5 `ApiRequest` (the not-wired fallback is gone) and builds the matching `ApiResult` variants from Task 38. `UploadCommand::StartForumPost` uses the multipart path or the presigned path (presign in the forum, then the JSON post with `upload_filename`, as `ForumCommands.ts:58-102` does). It reports throttled progress, then `UploadEvent::ForumPostDone`, or `Failed` on an error. Op 14 goes out through the existing `Effect::SendGateway`, which the forum test exercises. Nothing another task consumes was renamed. 3. Invariants: no changes to the dependencies of fluxer-core, fluxer-ui or fluxer-emoji. The new logs carry only file counts and the upload mode. No URLs, paths or file bytes are logged. The task adds no new fixtures. Server errors come back as `ApiError`/`CoreError`, never as a panic. 4. Review Focus 4 and 5 (uploads, no leaks): the forum path uses the same multipart builder and presign/PUT/complete code as messages, which the `Job` struct now shares. The message path behaves as before. 5. `FLUXER_SCREENSHOT_TESTS=1 cargo xtask ci` in the review worktree: **green** ("all steps passed"; channel_types_runtime 9/9). **Findings** - [minor] `runtime.rs` `ARCHIVED_PAGE = 50`: spec §18.2.1 says the forum fallback (`threads/archived/public`) asks for `limit=25`. `ApiRequest::ArchivedThreads` (Task 38) has no limit field, so this cannot be fixed here without changing an interface. Follow-up #454 tracks it and the PR links it. Acceptable. - [minor] `channel_types_runtime.rs` `crosspost_round_trip`: the `CrosspostSource` call targets the source message `PUBLISHED`. The devserver answers UNKNOWN_MESSAGE for it, because it only answers for copies (`IS_CROSSPOST`) or `CHANNEL_FOLLOW_ADD` notices (`forums.rs:1092`). So the `Ok` branch never runs, and the assertion only proves the request is wired. Pointing it at the follow notice the test has just created in #general would check the success path. This is not blocking: the endpoint mapping itself is covered by the Task 37 wiremock tests. **Verdict: approve.** No blocking findings, and local CI is green.
Sign in to join this conversation.
No description provided.