[GH-ISSUE #2499] [Issue]: Message creation should refresh parent chat updatedAt #1240

Closed
opened 2026-10-21 05:29:44 +07:00 by bsakaguchi · 0 comments
Owner

Originally created by @Xelvanis on GitHub (Jun 6, 2026).
Original GitHub issue: https://github.com/Pasta-Devs/Marinara-Engine/issues/2499

Summary

On the refactor branch, creating messages through the message_swipes::create_message path persists the message row and message-swipes sidecar rows, but does not refresh the owning chat's updatedAt. Legacy createMessage refreshed the parent chat after inserting the message and initial swipe, so active chats and newly copied branches stayed correct in recency-ordered chat lists.

Expected behavior

Creating a visible chat message should update the parent chats.updatedAt consistently with legacy behavior. Branch/import flows that preserve old message timestamps should explicitly choose the parent chat timestamp policy, such as preserving an import timestamp or resetting a newly created branch to now.

Actual behavior

Refactor generic message creation dispatches to message_swipes::create_message, which writes messages plus message-swipes and returns a projected timeline message. No parent chats patch is visible in that path.

branch_chat copies messages by looping through message_swipes::create_message. If no later tracker/game-state patch runs, the new branch can retain timestamps copied from the source chat because FileStorage::create only inserts createdAt/updatedAt when they are missing.

Steps to reproduce

  1. On the refactor branch, create a chat message through the normal storage message-create path, or create a chat branch that copies messages.
  2. Inspect the owning row in the chats collection.
  3. Compare the chat updatedAt value with the created message time / branch creation time and the recency order used by chat lists.

Impact area

  • Catalog resources
  • Chat mode
  • Roleplay mode
  • Game mode
  • Shared mode UI
  • Runtime systems: generation, world-state, visuals, tracker, or haptics
  • Professor Mari or shell tools
  • React-free engine behavior, contracts, agents, or capability ports
  • Shared API wrapper or remote runtime routing
  • Tauri/Rust storage, assets, LLM, integrations, security, imports, or HTTP runtime
  • Docs, contributor workflow, or templates

Environment

  • Branch or commit: perf/issue-2493-app-speed at 7e70c4da with local storage/message-swipe changes under review
  • Run mode: Tauri desktop / storage command path
  • OS + version: not captured
  • Node + pnpm versions: not relevant
  • Rust version, if relevant: not captured
  • Remote Runtime URL configured? not relevant
  • Provider, model, or integration, if relevant: not relevant

Logs, screenshots, or video

No runtime logs or screenshots. Static parity evidence:

  • Legacy packages/server/src/services/storage/chats.storage.ts updates chats.updatedAt in createMessage after inserting messages and message_swipes.
  • Legacy packages/server/src/routes/chats.routes.ts branch creation explicitly resets the new branch timestamp after copying preserved message timestamps.
  • Refactor src-tauri/src/commands/storage/message_swipes.rs create_message persists message and sidecar swipe rows without touching parent chat metadata.
  • Refactor src-tauri/src/commands/storage/chats.rs branch_chat loops through message_swipes::create_message and returns the new chat without a guaranteed final timestamp touch.
  • Refactor src-tauri/crates/storage/src/lib.rs FileStorage::create preserves supplied createdAt / updatedAt values with or_insert, so copied chat timestamps can remain old unless the caller patches them.

Regression notes

Legacy behavior refreshed parent chat recency on message create. Exact refactor last-known-good commit is unknown.

Additional context

This surfaced while checking the new message+swipe append optimization against legacy chat storage behavior. The append optimization itself appears compatible for single-message persistence; the missing parent-chat recency update is adjacent behavior.

Template check

Please uncheck the box below before submitting so we know you read the template. It is intentionally pre-checked:

  • I DID NOT read this template and provide the requested details.
Originally created by @Xelvanis on GitHub (Jun 6, 2026). Original GitHub issue: https://github.com/Pasta-Devs/Marinara-Engine/issues/2499 ## Summary On the refactor branch, creating messages through the `message_swipes::create_message` path persists the message row and `message-swipes` sidecar rows, but does not refresh the owning chat's `updatedAt`. Legacy `createMessage` refreshed the parent chat after inserting the message and initial swipe, so active chats and newly copied branches stayed correct in recency-ordered chat lists. ## Expected behavior Creating a visible chat message should update the parent `chats.updatedAt` consistently with legacy behavior. Branch/import flows that preserve old message timestamps should explicitly choose the parent chat timestamp policy, such as preserving an import timestamp or resetting a newly created branch to now. ## Actual behavior Refactor generic message creation dispatches to `message_swipes::create_message`, which writes `messages` plus `message-swipes` and returns a projected timeline message. No parent `chats` patch is visible in that path. `branch_chat` copies messages by looping through `message_swipes::create_message`. If no later tracker/game-state patch runs, the new branch can retain timestamps copied from the source chat because `FileStorage::create` only inserts `createdAt`/`updatedAt` when they are missing. ## Steps to reproduce 1. On the refactor branch, create a chat message through the normal storage message-create path, or create a chat branch that copies messages. 2. Inspect the owning row in the `chats` collection. 3. Compare the chat `updatedAt` value with the created message time / branch creation time and the recency order used by chat lists. ## Impact area - [x] Catalog resources - [x] Chat mode - [ ] Roleplay mode - [ ] Game mode - [ ] Shared mode UI - [ ] Runtime systems: generation, world-state, visuals, tracker, or haptics - [ ] Professor Mari or shell tools - [ ] React-free engine behavior, contracts, agents, or capability ports - [ ] Shared API wrapper or remote runtime routing - [x] Tauri/Rust storage, assets, LLM, integrations, security, imports, or HTTP runtime - [ ] Docs, contributor workflow, or templates ## Environment - Branch or commit: `perf/issue-2493-app-speed` at `7e70c4da` with local storage/message-swipe changes under review - Run mode: Tauri desktop / storage command path - OS + version: not captured - Node + pnpm versions: not relevant - Rust version, if relevant: not captured - Remote Runtime URL configured? not relevant - Provider, model, or integration, if relevant: not relevant ## Logs, screenshots, or video No runtime logs or screenshots. Static parity evidence: - Legacy `packages/server/src/services/storage/chats.storage.ts` updates `chats.updatedAt` in `createMessage` after inserting `messages` and `message_swipes`. - Legacy `packages/server/src/routes/chats.routes.ts` branch creation explicitly resets the new branch timestamp after copying preserved message timestamps. - Refactor `src-tauri/src/commands/storage/message_swipes.rs` `create_message` persists message and sidecar swipe rows without touching parent chat metadata. - Refactor `src-tauri/src/commands/storage/chats.rs` `branch_chat` loops through `message_swipes::create_message` and returns the new chat without a guaranteed final timestamp touch. - Refactor `src-tauri/crates/storage/src/lib.rs` `FileStorage::create` preserves supplied `createdAt` / `updatedAt` values with `or_insert`, so copied chat timestamps can remain old unless the caller patches them. ## Regression notes Legacy behavior refreshed parent chat recency on message create. Exact refactor last-known-good commit is unknown. ## Additional context This surfaced while checking the new message+swipe append optimization against legacy chat storage behavior. The append optimization itself appears compatible for single-message persistence; the missing parent-chat recency update is adjacent behavior. ## Template check Please uncheck the box below before submitting so we know you read the template. It is intentionally pre-checked: - [ ] I DID NOT read this template and provide the requested details.
bsakaguchi 2026-10-21 05:29:44 +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#1240
No description provided.