Repository navigation
fix(approuter): preserve static/qa across content-rebuild swap (recurring QA navigator wipe) - #1759
Merged
Merged
Conversation
The /admin/rebuild handler atomically replaces the whole static dir with the pushed tarball. rebuild-content.yml's 'Assemble static content' step does NOT include static/qa (the QA author-preview navigator, shipped only by the full MTA deploy via root mta.yaml's inline hugo/public-qa build), so every full/catalog-only content rebuild WIPED static/qa off the running pod -> /tutorials-qa/ 404s until the next deploy. This is the recurring 'no QA navigator on PROD' root cause. Carry deploy-only subtrees (REBUILD_PRESERVE_DIRS = ['qa']) forward from the previous static dir across the swap, but only when the incoming tarball did not ship them (so a future tarball that DOES include static/qa still wins). Verification requires a deploy + a content rebuild (cannot be exercised by unit tests / curl). Alternative considered: add a QA fetch+build+assemble to rebuild-content.yml (matches the #350 include-in-tarball precedent) — heavier (adds a full QA build to every prod rebuild); preserve is lighter and QA nav is content-rebuild-independent by design.
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
/tutorials-qa/(the QA author-preview tutorial navigator) keeps disappearing on PROD (404). Confirmed on live PROD (authenticated): the QA backend is healthy (/tutorials-qa/_nav.json→ 200, 2071 tutorials;/qa-search→ 200), but the entire static frontend understatic/qa/(index.html, js, css) 404s.Root cause (the persistent one)
rebuild-content.yml's "Assemble static content" step (L707–728) builds the tarball fromhugo/public/*+ the admin/scanner/explore/analytics/data-inspector dirs (added in #350) but omitsstatic/qa. The approuter's/admin/rebuildhandler then does an atomic whole-dir swap (approuter/server.js:380–383:rename static → old,rename new → static,rm old). Anything not in the tarball — i.e.static/qa— is deleted from the running pod on every full/catalog-only content rebuild.static/qais shipped only by the full MTA deploy (rootmta.yamlbuildshugo/public-qainline), so it never comes back until the next deploy.Fix
Preserve deploy-only static subtrees across the swap.
REBUILD_PRESERVE_DIRS = ['qa']; after the swap, carry each forward from the previous static dir only when the incoming tarball didn't ship it (so a future tarball that includesstatic/qastill wins). QA nav is independent of content rebuilds by design, so preserving (rather than rebuilding it every time) is the correct coupling.Scope / caveats
static/qamust be present for preserve to carry it — i.e. it relies on a deploy having shipped it. That gap (local deploy never buildshugo/public-qa) is closed by the companion PR (deploy-mta.cjs QA build + mtar guard). CI deploys already ship it via rootmta.yaml.rebuild-content.yml(matches the rebuild-content.yml clobbers admin-ui / scanner-ui / analytics-ui static dirs in approuter #350 include-in-tarball precedent). Heavier (a full QA build on every prod rebuild); preserve is lighter. Happy to switch if reviewers prefer consistency with rebuild-content.yml clobbers admin-ui / scanner-ui / analytics-ui static dirs in approuter #350.Follow-ups
static/qa/index.htmlpresent).Part of the "recurring missing QA navigator" cleanup.