fix(cdn): skip content-less builds so the manifest never outruns the bundle#153
Merged
Conversation
…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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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:
executeCDNBuildre-uploads_manifest.jsonwith the new commit SHA on every build (unconditional), but only re-emits_bundle/{locale}.jsonwhen 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)
974dcde,ec4b5e1,a217527) stranded content and forced an 88-file manual rebuild.2189565,6ac7a23) advanced manifest and bundle together → never a problem.a217527: storage complete (274 objects, 19 models in bundle) butmanifest=a217527/bundle=ec4b5e1.Fix
Early-return a 0-file no-op from
executeCDNBuildwhen 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.fullRebuild: true→ never hit this branch.getAffectedModelsnon-empty → never hit this branch.Tests
executeCDNBuildwith code-onlychangedPathsuploads nothing and returnsfilesUploaded: 0, changedModels: []; the pre-existing manifest/bundle stay at the old commit.config.jsonchange still full-builds (guard never suppresses a real build).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.