[GH-ISSUE #7686] Finish splitting generate.routes.ts: empty-reply branch, game turn resolution, post-save game data, roleplay extra #4244

Closed
opened 2026-10-21 06:13:21 +07:00 by bsakaguchi · 2 comments
Owner

Originally created by @Gunterlie on GitHub (Oct 15, 2026).
Original GitHub issue: https://github.com/Pasta-Devs/Marinara-Engine/issues/7686

Originally assigned to: @Gunterlie on GitHub.

Problem

#7573 splits packages/server/src/routes/generate.routes.ts into bounded modules, one part per PR, with no behaviour change. Eight slices are merged into staging. The route went from 15,619 to 14,820 lines. The largest parts are still inline in the route, so it is still hard to read, review and test.

Merged so far (all with a regression):

PR Part New home
#7671 token output chain (chunks, stream filters, reasoning clock) routes/generate/generation-stream-output.ts
#7672 tool-call rounds routes/generate/tool-rounds.ts
#7673 reply command parsing routes/generate/reply-commands.ts
#7674 reply text cleanup routes/generate/reply-text-cleanup.ts
#7676 generation info on the saved message extra routes/generate/saved-message-extra.ts
#7677 roleplay roll helpers services/generation/roleplay-rolls.ts
#7678 reply save step (swipe, continue, owner turn, split save) routes/generate/save-generated-reply.ts
#7679 hidden command anchor save routes/generate/hidden-command-anchor.ts

Proposal

Continue with the same rules: one part per PR, no behaviour change, and each PR adds or names a regression that pins the moved behaviour.

Remaining parts, in the planned order:

  • Rest of the empty-reply branch: the empty-response message and log, and the anchor follow-up (GM verbs, game state tool calls, spatial step, conversation activity) around saveHiddenCommandAnchor.
  • Game turn resolution, in several slices: GM verb scan and execution, skill-check and dice resolution, the turn notice.
  • Game data saved after the reply: game state persistence and the other post-save game writes.
  • Roleplay extra and interrupt handling (last, because it reads the most route state).

Notes for whoever picks this up

  • Many scripts/regressions/*.regression.ts files pin the source text of generate.routes.ts with regexes. Every move must repoint those pins to the new file. Grep the regressions for the moved code before you push.
  • Base each slice on staging, not on another slice. A stacked PR that GitHub retargets after its base merges does not get the required CodeQL runs and is skipped by GitHub CodeRabbit until you merge staging into it and push.
  • On devbox, multiplayer-peer-server-security fails with a TLS altname error for ::1 on staging too. It is not caused by this work.

Follow-up to #7573.

Originally created by @Gunterlie on GitHub (Oct 15, 2026). Original GitHub issue: https://github.com/Pasta-Devs/Marinara-Engine/issues/7686 Originally assigned to: @Gunterlie on GitHub. ## Problem #7573 splits `packages/server/src/routes/generate.routes.ts` into bounded modules, one part per PR, with no behaviour change. Eight slices are merged into `staging`. The route went from 15,619 to 14,820 lines. The largest parts are still inline in the route, so it is still hard to read, review and test. Merged so far (all with a regression): | PR | Part | New home | | --- | --- | --- | | #7671 | token output chain (chunks, stream filters, reasoning clock) | `routes/generate/generation-stream-output.ts` | | #7672 | tool-call rounds | `routes/generate/tool-rounds.ts` | | #7673 | reply command parsing | `routes/generate/reply-commands.ts` | | #7674 | reply text cleanup | `routes/generate/reply-text-cleanup.ts` | | #7676 | generation info on the saved message extra | `routes/generate/saved-message-extra.ts` | | #7677 | roleplay roll helpers | `services/generation/roleplay-rolls.ts` | | #7678 | reply save step (swipe, continue, owner turn, split save) | `routes/generate/save-generated-reply.ts` | | #7679 | hidden command anchor save | `routes/generate/hidden-command-anchor.ts` | ## Proposal Continue with the same rules: one part per PR, no behaviour change, and each PR adds or names a regression that pins the moved behaviour. Remaining parts, in the planned order: - [ ] **Rest of the empty-reply branch:** the empty-response message and log, and the anchor follow-up (GM verbs, game state tool calls, spatial step, conversation activity) around `saveHiddenCommandAnchor`. - [ ] **Game turn resolution**, in several slices: GM verb scan and execution, skill-check and dice resolution, the turn notice. - [ ] **Game data saved after the reply:** game state persistence and the other post-save game writes. - [ ] **Roleplay extra and interrupt handling** (last, because it reads the most route state). ## Notes for whoever picks this up - Many `scripts/regressions/*.regression.ts` files pin the source text of `generate.routes.ts` with regexes. Every move must repoint those pins to the new file. Grep the regressions for the moved code before you push. - Base each slice on `staging`, not on another slice. A stacked PR that GitHub retargets after its base merges does not get the required CodeQL runs and is skipped by GitHub CodeRabbit until you merge `staging` into it and push. - On devbox, `multiplayer-peer-server-security` fails with a TLS altname error for `::1` on `staging` too. It is not caused by this work. Follow-up to #7573.
Author
Owner

@SpicyMarinara commented on GitHub (Oct 19, 2026):

Closing this for now to clear the board for the next release. The eight slices that already landed stay; reopen it after the release when you continue with the remaining parts.

<!-- gh-comment-id:6264053643 --> @SpicyMarinara commented on GitHub (Oct 19, 2026): Closing this for now to clear the board for the next release. The eight slices that already landed stay; reopen it after the release when you continue with the remaining parts.
Author
Owner

@Gunterlie commented on GitHub (Oct 30, 2026):

Closing for now to clear the board before the next stable release. This is not a rejection; I will reopen it after the release.

<!-- gh-comment-id:6521117745 --> @Gunterlie commented on GitHub (Oct 30, 2026): Closing for now to clear the board before the next stable release. This is not a rejection; I will reopen it after the release.
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
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
Pasta-Devs/Marinara-Engine#4244
No description provided.