Skip to content

fix(cdn): skip content-less builds so the manifest never outruns the bundle#153

Merged
ABB65 merged 1 commit into
mainfrom
fix/cdn-skip-content-less-builds
Jul 16, 2026
Merged

fix(cdn): skip content-less builds so the manifest never outruns the bundle#153
ABB65 merged 1 commit into
mainfrom
fix/cdn-skip-content-less-builds

Conversation

@ABB65

@ABB65 ABB65 commented Jul 16, 2026

Copy link
Copy Markdown
Member

Problem

On staging (Lanista-Software/collabers, CDN enabled), content went missing in the consuming app after any push that changed no content (a pure code push) — permanently, until a manual full rebuild.

Root cause: executeCDNBuild re-uploads _manifest.json with the new commit SHA on every build (unconditional), but only re-emits _bundle/{locale}.json when a content model is affected. A code-only push resolves zero affected models → the bundle block is skipped, but the manifest still advances. Result: _manifest.json.commitSha (new) ≠ _bundle/*.json.commitSha (old). Consumers that key content freshness off the manifest then read stale/empty content until a manual full rebuild re-aligns the two.

Evidence (staging, measured from R2)

  • Every 22-file code-only webhook build (974dcde, ec4b5e1, a217527) stranded content and forced an 88-file manual rebuild.
  • 28-file content builds (2189565, 6ac7a23) advanced manifest and bundle together → never a problem.
  • Live divergence caught after a217527: storage complete (274 objects, 19 models in bundle) but manifest=a217527 / bundle=ec4b5e1.

Fix

Early-return a 0-file no-op from executeCDNBuild when a selective build (!fullRebuild && changedPaths.length) resolves zero affected models. The manifest tracks the content version, so a content-less push must not bump it.

  • Manual rebuilds pass fullRebuild: true → never hit this branch.
  • Config / model-definition changes make getAffectedModels non-empty → never hit this branch.
  • Same push also stops wasting a build cycle on code-only pushes.

Tests

  • New: executeCDNBuild with code-only changedPaths uploads nothing and returns filesUploaded: 0, changedModels: []; the pre-existing manifest/bundle stay at the old commit.
  • New counter-case: a config.json change still full-builds (guard never suppresses a real build).
  • Full suite green: 1062 tests, typecheck + lint clean.

Out of scope (follow-up)

CDN builds are fire-and-forget with no serialization; one manual↔webhook overlap was observed. Worth a separate hardening pass.

…bundle

A webhook build for a push that changes no content models (a pure code
push) still ran the full pipeline: it re-uploaded `_manifest.json` with
the new commit SHA but skipped the locale-bundle block (which only runs
when a model is affected). That left `_manifest.json.commitSha` ahead of
every `_bundle/*.json`, and CDN consumers that key content freshness off
the manifest rendered stale/empty content until a manual full rebuild
re-aligned the two — reproduced on staging (Lanista/collabers), where
every 22-file code-only webhook build stranded content and forced an
88-file manual rebuild, while 28-file content builds were always fine.

The manifest tracks the CONTENT version, so a content-less push must not
bump it. Early-return a 0-file no-op from executeCDNBuild when a
selective build resolves zero affected models. Manual rebuilds
(fullRebuild) and config/model-def changes never reach this branch, so
they are unaffected; the same push also stops wasting a build cycle.
@ABB65
ABB65 merged commit f4419f6 into main Jul 16, 2026
2 checks passed
@ABB65
ABB65 deleted the fix/cdn-skip-content-less-builds branch July 16, 2026 20:25
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