Skip to content

feat(template): disable adapter-node precompress to shrink tarball#125

Merged
fedorovvvv merged 1 commit into
developfrom
feat/drop-precompressed-client-assets
May 9, 2026
Merged

feat(template): disable adapter-node precompress to shrink tarball#125
fedorovvvv merged 1 commit into
developfrom
feat/drop-precompressed-client-assets

Conversation

@fedorovvvv
Copy link
Copy Markdown
Collaborator

Summary

  • Flip adapter()adapter({ precompress: false }) in template/svelte.config.js.
  • Drops 84 precompressed siblings (*.br + *.gz) from both shipped images.
  • Each dist*/ artifact: 2.0M → 1.5M (–25%, ~520K saving per image, ~1.04 MB total).
  • Closes Drop precompressed *.br/*.gz client assets from tarball #120.

Why

Per issue #120, the precompressed siblings cost ~520K per image but buy negligible runtime CPU savings for the canonical local-first deployment (npx @forgeplan/web start on 127.0.0.1, single user, no CDN). After PR #117 minified the server bundle, precompressed client assets were the largest fixed cost left in the experimental tarball.

Decision (PRD-031 + EVID-036): chose Option A from #120 (disable at adapter level) over B (build.mjs strip — strictly more code for same runtime behaviour) and C (keep .br, drop .gz — half the win for ~zero additional safety).

Trade-off (R-1, documented in PRD-031)

Sirv serves assets uncompressed when no precompressed sibling exists. Verified via direct Accept-Encoding: br, gzip probe against a live npx ... start server in a scratch dir:

HTTP/1.1 200 OK
Content-Length: 3047

(Same response with and without Accept-Encoding. No Content-Encoding header in either case.) For loopback 127.0.0.1 deployments the cost is negligible. Mitigation paths if a real complaint surfaces: revert this flag, or wire on-the-fly compression in template/src/hooks.server.ts.

Test plan

  • npm run build — both images emit (dist/ ready (1.40M), dist-nightly/ ready (1.40M)).
  • find dist dist-nightly -name '*.br' -o -name '*.gz' | wc -l → 0 (was 84).
  • du -sh dist dist-nightly → 1.5M each (was 2.0M each, well under PRD-014 SC-1 3M cap).
  • npm run smokeALL IMAGES PASS.
  • Manual scratch-dir probe: init --image nightlystartGET / returns HTTP 200; GET /_app/immutable/entry/app.*.js returns HTTP 200 with correct Content-Length.
  • CI matrix (ubuntu/macos/windows) — pending.

Refs: PRD-031, EVID-036, PRD-014, PRD-030, #117.

Pass precompress: false to adapter() so the build no longer emits
.br/.gz siblings under client/. Each shipped image (dist/, dist-nightly/)
drops from 2.0M → 1.5M — a ~520K saving per image, ~1.04 MB total.

Trade-off (accepted): sirv serves assets uncompressed when no
precompressed sibling exists (verified via Accept-Encoding probe);
no Content-Encoding header is set. For the canonical npx start on
127.0.0.1 deployment this is negligible.

Closes #120.
Refs: PRD-031, EVID-036.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@fedorovvvv fedorovvvv merged commit 54a918a into develop May 9, 2026
3 checks passed
@fedorovvvv fedorovvvv deleted the feat/drop-precompressed-client-assets branch May 9, 2026 11:51
fedorovvvv added a commit that referenced this pull request May 9, 2026
Sweep stale numbers to match post-PRD-030 / post-PR-125 reality:

- "~1.8 MB single-file bundle" → "~1.4 MB" (matches `[build] dist/
  ready (1.40M)` after #125 drops precompressed siblings).
- Dogfood card row reframed:
  · drop "~200 LOC" (entry shim is now 5 lines after ADR-003 split,
    real work spans ~1.3K across `bin/{cli,commands,lib}/*`)
  · drop "0 runtime deps" (ADR-003 amended to a named-allowlist —
    `citty` is the one allowed runtime dep, with 0 transitives)
  · drop "~6 MB tarball with bundled node_modules" (PRD-030 graduated
    the legacy SvelteKit-with-`node_modules/` shape; current local
    pack is ~870 kB / ~3 MB unpacked)
  · lead with what users actually care about (per-image size + tarball
    weight) instead of LOC bragging
- "(~11 artifacts)" in `npm run dev` comment → "100+" (avoids drift;
  current `forgeplan health` reports 99 artifacts on develop).

Mirrors apply to both README.md and README.ru.md.

Refs: PRD-030, PR #125, ADR-003.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
fedorovvvv added a commit that referenced this pull request May 9, 2026
## Summary

Sweep stale numeric claims in both READMEs to match the current
post-PRD-030 / post-PR #125 reality.

## What changed (verbatim numbers)

| Claim | Before | After | Source of truth |
|---|---|---|---|
| Per-image bundle size | ~1.8 MB | **~1.4 MB** | \`scripts/build.mjs\`
post-build report (\`[build] dist/ ready (1.40M)\`) after PR #125 |
| Dogfood — bin LOC | ~200 LOC | _removed_ — ADR-003 split bin/ across
\`cli.mjs\` + \`commands/\` + \`lib/\`; entry shim is 5 lines, real
total ~1.3K across 11 files | \`wc -l bin/**/*.mjs\` |
| Dogfood — runtime deps in \`bin/\` | 0 | **1** (\`citty\`, 0
transitive) | ADR-003 (amended named-allowlist),
\`package.json#dependencies\` |
| Dogfood — tarball | ~6 MB with bundled \`node_modules\` | **~870 kB
packed / ~3 MB unpacked** | \`npm pack --dry-run\` (post-PRD-030
single-file bundle, no \`node_modules/\` in tarball) |
| Dogfood — CI matrix | \`3 OS in CI\` | **\`3 OS × Node 22\` green
smoke matrix** | \`.github/workflows/*\` |
| \`npm run dev\` artifact count comment | (~11 artifacts) | **(100+
artifacts)** | \`forgeplan health\` — 99 on develop, anti-drift framing
|

## Why

The previous numbers were accurate at the time they were written but
drifted as PRD-030 graduated the bundle approach, ADR-003 amended the
zero-dep rule to allow \`citty\`, and PR #125 dropped the precompressed
siblings. Anyone reading the README today would have a wrong mental
model of size, deps, and dogfood scale.

## Test plan

- [x] \`grep -nE "1\\.8 MB |6 МБ|~200|~11" README.md README.ru.md\`
returns no hits.
- [x] Both READMEs render in GitHub markdown preview (table cells, no
broken refs).
- [x] No content-equivalent claims out of sync between EN and RU.
- [x] Numbers match current local measurements (\`du -sh dist*\`, \`npm
pack --dry-run\`, \`forgeplan health\`).

Refs: PRD-030, PR #125, ADR-003.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant