decocms / decocms/blocks

deco-migrate: gerar public/_headers com immutable caching pra /assets/* (cache score)

Open Beginner friendly
#489 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
TypeScript
Stars
5
Forks
2
Avg merge
20h 12m
Merged PRs (30d)
36

Description

Gap: portal-davinci run (2026-08-20)

Problema

Assets hasheados (/assets/main-*.js) são servidos pelo CF Workers Assets antes do worker, então a lógica FINGERPRINTED_ASSET_RE do createDecoWorkerEntry (immutable, max-age=31536000) nunca aplica neles. Resultado: shipam com o default do Vite/CF public, max-age=0, must-revalidate → parity cache module penaliza (12 requests cacheable não cacheados, 590KB, cache score 52).

Fix

deco-migrate deve gerar public/_headers no scaffold:

/assets/*
  Cache-Control: public, max-age=31536000, immutable

CF Workers Assets honra _headers. Filenames são content-addressed → 1 ano immutable é seguro.

Alternativa

Configurar assets.run_worker_first no wrangler.jsonc pra o worker interceptar, mas o _headers é mais simples e não adiciona latência de worker aos assets.

Aplicado no site

portaldavinci-tanstack commit 0b78c40. Template storefront-tanstack também não tem _headers → mesmo gap.


Transferida de decocms/parity#253 (bug de template do deco-migrate / @decocms/blocks-cli, fora do escopo do repo parity).

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start at the deco-migrate scaffold generation entry point and inspect how generated public assets are defined. Add the public/_headers output shown in the issue, then generate a scaffold and verify that /assets/* has the immutable Cache-Control value without changing the worker path.

Written by the indexing model from the issue text.

Assessment

Tech stack
typescript
Domain
cli, tooling
Issue type
Bug
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Quiet
Clarity
Clearly specified
Newbie friendliness
68/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.