[PR #3527] [MERGED] Add message game state endpoint #5980

Closed
opened 2026-10-23 04:05:51 +07:00 by bsakaguchi · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/Pasta-Devs/Marinara-Engine/pull/3527
Author: @kaldigo
Created: 7/12/2026
Status: ✅ Merged
Merged: 7/12/2026
Merged by: @SpicyMarinara

Base: staging ← Head: codex/game-state-message-endpoint


📝 Commits (4)

  • 9673608 Add message game state endpoint
  • acf3afa Merge branch 'staging' into codex/game-state-message-endpoint
  • 1a99162 Merge remote-tracking branch 'origin/staging' into codex/game-state-message-endpoint
  • a908dae Keep message game-state responses complete

📊 Changes

1 file changed (+53 additions, -0 deletions)

View changed files

📝 packages/server/src/routes/chats.routes.ts (+53 -0)

📄 Description

Linked issue

Closes #3526

Why this change

  • Extensions and integrations need to retrieve the game state associated with a specific chat message, instead of only being able to fetch the latest game state for the chat.

What changed

  • Added GET /api/chats/:chatId/messages/:messageId/game-state.
  • The endpoint resolves the target message and verifies it belongs to the requested chat.
  • Supports optional swipeIndex; defaults to the message's active swipe index.
  • Returns the exact stored game state snapshot for that message/swipe when one exists.
  • Returns null when no snapshot exists for that message/swipe, rather than falling back to the latest chat state.
  • Rejects invalid swipe indexes with 400.

Validation

  • pnpm check passes locally
  • Container (Docker / Podman) built and ran without issue
  • Ran the app, clicked through the changes manually
  • Checked edge cases (light + dark mode, mobile viewport, empty states, error paths)
  • Above manual verification completed (describe below)
  • Read and followed CONTRIBUTING.md

Manual verification notes

  • Ran pnpm check.
  • Ran pnpm version:check.
  • Ran pnpm test.
  • Verified the endpoint against a disposable local dev server:
    • created a temporary game chat and assistant message
    • confirmed the endpoint returns null before a snapshot exists
    • confirmed invalid swipeIndex returns 400
    • confirmed mismatched chat/message returns 404
    • patched a game-state snapshot onto the exact messageId + swipeIndex
    • confirmed the endpoint returns that exact stored snapshot
    • confirmed another swipe index returns null
    • deleted the temporary chat and confirmed the endpoint returns 404

Docs and release impact

  • No docs changes needed
  • Updated docs (README / CONTRIBUTING / android/README / CHANGELOG) as needed
  • Version/release files updated (only if this PR includes a version bump)

UI evidence (if applicable)

No screenshots attached; this is an API-only change.


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/Pasta-Devs/Marinara-Engine/pull/3527 **Author:** [@kaldigo](https://github.com/kaldigo) **Created:** 7/12/2026 **Status:** ✅ Merged **Merged:** 7/12/2026 **Merged by:** [@SpicyMarinara](https://github.com/SpicyMarinara) **Base:** `staging` ← **Head:** `codex/game-state-message-endpoint` --- ### 📝 Commits (4) - [`9673608`](https://github.com/Pasta-Devs/Marinara-Engine/commit/96736084c579c700a3043ed4f626a93f8cc29cf2) Add message game state endpoint - [`acf3afa`](https://github.com/Pasta-Devs/Marinara-Engine/commit/acf3afad2c77188d9d22ad03a79329cb988bdfa8) Merge branch 'staging' into codex/game-state-message-endpoint - [`1a99162`](https://github.com/Pasta-Devs/Marinara-Engine/commit/1a99162ec08c12a6f2ba48faf37a4fbbb9e751ff) Merge remote-tracking branch 'origin/staging' into codex/game-state-message-endpoint - [`a908dae`](https://github.com/Pasta-Devs/Marinara-Engine/commit/a908dae0475b0f9c5c18d995f9ab4d3211590150) Keep message game-state responses complete ### 📊 Changes **1 file changed** (+53 additions, -0 deletions) <details> <summary>View changed files</summary> 📝 `packages/server/src/routes/chats.routes.ts` (+53 -0) </details> ### 📄 Description ## Linked issue Closes #3526 ## Why this change - Extensions and integrations need to retrieve the game state associated with a specific chat message, instead of only being able to fetch the latest game state for the chat. ## What changed - Added `GET /api/chats/:chatId/messages/:messageId/game-state`. - The endpoint resolves the target message and verifies it belongs to the requested chat. - Supports optional `swipeIndex`; defaults to the message's active swipe index. - Returns the exact stored game state snapshot for that message/swipe when one exists. - Returns `null` when no snapshot exists for that message/swipe, rather than falling back to the latest chat state. - Rejects invalid swipe indexes with `400`. ## Validation - [x] `pnpm check` passes locally - [ ] Container (Docker / Podman) built and ran without issue - [x] Ran the app, clicked through the changes manually - [x] Checked edge cases (light + dark mode, mobile viewport, empty states, error paths) - [x] Above manual verification completed (describe below) - [x] Read and followed `CONTRIBUTING.md` ### Manual verification notes - Ran `pnpm check`. - Ran `pnpm version:check`. - Ran `pnpm test`. - Verified the endpoint against a disposable local dev server: - created a temporary game chat and assistant message - confirmed the endpoint returns `null` before a snapshot exists - confirmed invalid `swipeIndex` returns `400` - confirmed mismatched chat/message returns `404` - patched a game-state snapshot onto the exact `messageId` + `swipeIndex` - confirmed the endpoint returns that exact stored snapshot - confirmed another swipe index returns `null` - deleted the temporary chat and confirmed the endpoint returns `404` ## Docs and release impact - [x] No docs changes needed - [ ] Updated docs (README / CONTRIBUTING / android/README / CHANGELOG) as needed - [ ] Version/release files updated (only if this PR includes a version bump) ## UI evidence (if applicable) No screenshots attached; this is an API-only change. --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
bsakaguchi 2026-10-23 04:05:51 +07:00
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#5980
No description provided.