mirror of
https://github.com/Pasta-Devs/Marinara-Engine.git
synced 2026-12-03 19:00:50 +07:00
[PR #2776] [MERGED] fix(storage): make lastContactByCharacter work on the file-storage backend #5724
Labels
No labels
android
bug
bugfix
ci
client
code freeze pause
container
dependencies
docs
documentation
duplicate
enhancement
feature
feature
feature
feature-creep
fixed-in-refactor
fixed-in-staging
good first issue
help wanted
in-pr
in-pr
needs-codeowner-decision
normal-scope
old-codebase
old-codebase
pull-request
qol
question
refactor
regression
revisit later
roadmap
scope-risk
scope-risk
server
server
shared
soup
upstream
windows
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
Pasta-Devs/Marinara-Engine#5724
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
📋 Pull Request Information
Original PR: https://github.com/Pasta-Devs/Marinara-Engine/pull/2776
Author: @kolacheee
Created: 6/22/2026
Status: ✅ Merged
Merged: 6/22/2026
Merged by: @SpicyMarinara
Base:
staging← Head:fix/issue-2775-last-contact-groupby📝 Commits (1)
bc08067fix(storage): aggregate lastContactByCharacter in JS for file-storage backend📊 Changes
1 file changed (+15 additions, -5 deletions)
View changed files
📝
packages/server/src/services/storage/chats.storage.ts(+15 -5)📄 Description
Linked issue
Closes #2775
Why this change
chats.lastContactByCharacter()built its query with.groupBy()plus asqlMAX()aggregate. The default file-storage backend's query-builder shim (file-backed-store.ts) implementsselect/from/where/orderBybut notgroupBy(and does not evaluatesqlMAX()aggregates), so the conversation route 500s withgroupBy is not a functionon that backend. It works on libsql, where real Drizzle supportsgroupBy.What changed
packages/server/src/services/storage/chats.storage.ts: replaced the SQLGROUP BY/MAX()aggregation with an in-JS reduction. The query now selects plaincharacterId+createdAtcolumns (using onlyselect/from/where, which both backends support) and folds the rows into a{ characterId: latestCreatedAt }map.created_atis a TEXT (ISO 8601) column, so lexicographic>is chronological.sqlimport fromdrizzle-orm..groupBy()is used in exactly this one place in the server, so dropping the aggregate here is smaller and safer than teaching the file-store shim SQL aggregation.Validation
pnpm checkpasses locallyCONTRIBUTING.mdManual verification notes
pnpm --filter @marinara-engine/server lint(tsc -b ../shared && tsc --noEmit) passes. Fullpnpm check(TypeScript + ESLint across the workspace) has not yet been run.groupBy is not a function500 was reproduced from server logs before the change; in-app confirmation of the fix is pending a rebuild.)Docs and release impact
Assessment: storage-internal refactor with no API/schema/behavior change and no version bump, so no docs or release-notes updates appear necessary — left unchecked for the contributor to confirm.
UI evidence (if applicable)
N/A — no UI changes (storage-internal fix).
Summary by CodeRabbit
🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.