mirror of
https://github.com/Pasta-Devs/Marinara-Engine.git
synced 2026-12-03 19:00:50 +07:00
[GH-ISSUE #2775] lastContactByCharacter throws "groupBy is not a function" on the file-storage backend #1413
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#1413
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?
Originally created by @kolacheee on GitHub (Jun 22, 2026).
Original GitHub issue: https://github.com/Pasta-Devs/Marinara-Engine/issues/2775
Originally assigned to: @kolacheee on GitHub.
Summary
chats.lastContactByCharacter()(packages/server/src/services/storage/chats.storage.ts) builds a Drizzle query using.groupBy()plus asqlMAX()aggregate. The default file-storage backend's query-builder shim (packages/server/src/db/file-backed-store.ts) implementsselect/from/where/orderBybut notgroupBy, so the call throws at runtime:Impact
conversation.routes.tscalls this when the conversation view loads, so on the default file-storage backend that route 500s repeatedly. It works on the libsql backend (real Drizzle supports.groupBy()), which is why it can pass unnoticed in libsql setups.Root cause
.groupBy()is used in exactly one place in the server (this function), and the file-backed store never implemented it. It's also the only call relying on asqlMAX()aggregate, which the file store doesn't evaluate.Reproduce
TypeErrorabove (HTTP 500).Suggested fix
Aggregate in JS instead of via SQL
GROUP BY/MAX(): select the plaincharacterId+createdAtcolumns (both supported by the file store) and reduce to latest-per-character in code. Backend-agnostic; no schema/API change. PR to follow.Branch:
staging.