mirror of
https://github.com/Pasta-Devs/Marinara-Engine.git
synced 2026-12-03 19:00:50 +07:00
[GH-ISSUE #5082] Capability package client bundles re-download in full on every app load (no ETag/304 anywhere) #2811
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#2811
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 (Aug 15, 2026).
Original GitHub issue: https://github.com/Pasta-Devs/Marinara-Engine/issues/5082
Originally assigned to: @kolacheee on GitHub.
What happens
Every installed Agent package's client bundle is fully re-downloaded on every app load. The server sends
Cache-Control: no-cache, must-revalidateon/api/capability-packages/:id/clientbut never sends an ETag or Last-Modified — andno-cachemeans "revalidate before using", so with nothing to revalidate against, the browser has to re-fetch the whole body every time. The same applies to/api/capability-packages/:id/assets/*.For anyone with World Maps installed that's the full hierarchical-maps client bundle on every single app open, on every platform — phones included. It also makes bundle size a per-boot tax for any future package that ships more client code or art.
Try it yourself
/api/capability-packages/hierarchical-maps/client.200with the full body again — never a304, and the request carries noIf-None-Matchbecause the first response had noETag.(
grep -ri "etag" packages/server/srccomes back empty — the server has no cache validators anywhere.)Why it happens
packages/server/src/routes/capability-packages.routes.ts— the/clienthandler (~line 74) sendsCache-Control: no-cache, must-revalidatewith no validator header;/assets/*(~line 83) sendsprivate, no-cache, must-revalidatethe same way.Suggested fix
Every served package file already has a trusted content hash:
manifest.files[]records a sha256 per file, and the serve path re-verifies it on every read. That hash is a perfect strong ETag:/client: sendETag: "<manifest sha256>"and answerIf-None-Matchwith304. Keepno-cachesemantics — a package author can republish the same version with different bytes during development, so the bundle should always revalidate (just cheaply). The client already appends?v=<version>to the import URL, so the cache key is correct today./assets/*: same ETag; additionally, when the request's?v=equals the installed version, the response can bepublic, max-age=31536000, immutable— the path + version + hash pin the exact bytes.No client changes needed: the dynamic
import()rides the normal browser HTTP cache, and a 304 revalidation is transparent to it.Found while building a pixel-RPG game-surface Experience (whose art/bundle costs make the per-boot re-download acute); verified against
staging@068d01fad.@kolacheee commented on GitHub (Aug 15, 2026):
Taking this one (agent working from kolacheee's fork) — draft PR up at #5087. Implementation note for anyone reviewing: the ETag is the manifest-recorded per-file sha256 (the same value the serve path re-verifies bytes against on every read), the client bundle deliberately stays
no-cache(neverimmutable) so a republished same-version bundle is picked up immediately, and assets areimmutableonly when the request pins the installed version with?v=.