[PR #8486] [MERGED] Fix large chat-list payloads and compression #8630

Closed
opened 2026-11-07 16:46:05 +07:00 by bsakaguchi · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/Pasta-Devs/Marinara-Engine/pull/8486
Author: @SpicyMarinara
Created: 10/30/2026
Status: ✅ Merged
Merged: 10/30/2026
Merged by: @SpicyMarinara

Base: staging ← Head: fix/8452-chat-list-payloads


📝 Commits (4)

  • c54b5f9 Reproduce large chat-list vector leakage and compression cutoff
  • 03d4508 Keep chat-list internals private and compress large lists asynchronously
  • 24b51ca Allow legacy partial metadata in the chat-list response type
  • 000ed5f Format the chat-list public response type

📊 Changes

3 files changed (+160 additions, -7 deletions)

View changed files

📝 packages/server/src/middleware/compress-json.ts (+32 -5)
📝 packages/server/src/routes/chats.routes.ts (+28 -2)
➕ scripts/regressions/chat-list-payload.regression.ts (+100 -0)

📄 Description

Why this change

Large chat collections transfer internal vectors and skip compression above 4 MiB, slowing the sidebar over mobile and LAN connections.

What changed

Closes #8452.

Large chat collections no longer send internal embedding vectors or write counters in GET /api/chats. The list returns the public Chat fields, including complete metadata, rather than spreading database rows. Stored vectors, internal storage callers, and native export paths remain intact.

Chat-list responses above 4 MiB now use Brotli or gzip on the compression threadpool before the route sends its response. The shared synchronous on-send hook retains its existing safety boundary for other routes, including async handlers that call reply.send() without returning it. Internal app.inject() reads remain plain JSON.

Assigned to @SpicyMarinara; this branch owns #8452.

Validation

  • Real route regression: failed before the fix on vector leakage and the missing compression header; passes after the fix.
  • Raw HTTP Brotli, gzip, identity, Vary/content-length, complete above-4-MiB metadata round-trip, retained stored vectors/counter, and uncompressed internal injection passed.
  • Existing compression regression passed, including the async send-without-return safety control, streams, SSE, small responses, and the unchanged global large-body boundary.
  • Local CodeRabbit reviewed all three changed files with no findings, then the corrected metadata type with no findings. The final commit only adjusts two leading spaces on that reviewed line; full TypeScript AST comparison confirms identical substantive content. An additional formatting-only review hit the shared capacity limit and did not run; it is not counted as a passed review. Final-head Dottore review is Viable, With Notes (no actionable defects).
  • Final pnpm check passed (one existing HomeProfessorMariChat hook warning). The first attempts caught a metadata type mismatch and formatting; both were corrected, and the original failure logs were retained.

Manual verification

  • Manually verify a large saved chat collection loads and retains its names, metadata, sorting, and folders.
  • Manually verify native chat export remains complete.

🔄 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/8486 **Author:** [@SpicyMarinara](https://github.com/SpicyMarinara) **Created:** 10/30/2026 **Status:** ✅ Merged **Merged:** 10/30/2026 **Merged by:** [@SpicyMarinara](https://github.com/SpicyMarinara) **Base:** `staging` ← **Head:** `fix/8452-chat-list-payloads` --- ### 📝 Commits (4) - [`c54b5f9`](https://github.com/Pasta-Devs/Marinara-Engine/commit/c54b5f9aa71b325f7d1549e6df7c930eb0513d9d) Reproduce large chat-list vector leakage and compression cutoff - [`03d4508`](https://github.com/Pasta-Devs/Marinara-Engine/commit/03d4508d310f656364c114de2381df78af7ac0fc) Keep chat-list internals private and compress large lists asynchronously - [`24b51ca`](https://github.com/Pasta-Devs/Marinara-Engine/commit/24b51ca972bac246c9b1f98c07cf3d7c3a05ba9c) Allow legacy partial metadata in the chat-list response type - [`000ed5f`](https://github.com/Pasta-Devs/Marinara-Engine/commit/000ed5facaf26f5aee77008587ed4c3fd121fa02) Format the chat-list public response type ### 📊 Changes **3 files changed** (+160 additions, -7 deletions) <details> <summary>View changed files</summary> 📝 `packages/server/src/middleware/compress-json.ts` (+32 -5) 📝 `packages/server/src/routes/chats.routes.ts` (+28 -2) ➕ `scripts/regressions/chat-list-payload.regression.ts` (+100 -0) </details> ### 📄 Description ## Why this change Large chat collections transfer internal vectors and skip compression above 4 MiB, slowing the sidebar over mobile and LAN connections. ## What changed Closes #8452. Large chat collections no longer send internal embedding vectors or write counters in `GET /api/chats`. The list returns the public Chat fields, including complete metadata, rather than spreading database rows. Stored vectors, internal storage callers, and native export paths remain intact. Chat-list responses above 4 MiB now use Brotli or gzip on the compression threadpool before the route sends its response. The shared synchronous on-send hook retains its existing safety boundary for other routes, including async handlers that call `reply.send()` without returning it. Internal `app.inject()` reads remain plain JSON. Assigned to @SpicyMarinara; this branch owns #8452. ## Validation - Real route regression: failed before the fix on vector leakage and the missing compression header; passes after the fix. - Raw HTTP Brotli, gzip, identity, Vary/content-length, complete above-4-MiB metadata round-trip, retained stored vectors/counter, and uncompressed internal injection passed. - Existing compression regression passed, including the async send-without-return safety control, streams, SSE, small responses, and the unchanged global large-body boundary. - Local CodeRabbit reviewed all three changed files with no findings, then the corrected metadata type with no findings. The final commit only adjusts two leading spaces on that reviewed line; full TypeScript AST comparison confirms identical substantive content. An additional formatting-only review hit the shared capacity limit and did not run; it is not counted as a passed review. Final-head Dottore review is Viable, With Notes (no actionable defects). - Final `pnpm check` passed (one existing HomeProfessorMariChat hook warning). The first attempts caught a metadata type mismatch and formatting; both were corrected, and the original failure logs were retained. ## Manual verification - [ ] Manually verify a large saved chat collection loads and retains its names, metadata, sorting, and folders. - [ ] Manually verify native chat export remains complete. --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
bsakaguchi 2026-11-07 16:46:05 +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#8630
No description provided.