fix: 3 critical publisher/deploy safety issues

1. Skip page deletion and nav sync in --render-only mode
   The CI publisher always uses --render-only but the pruning phase was
   deleting pages not regenerated in a given pass (e.g. low-hit pages),
   breaking nav references and corrupting the MkDocs build.

2. Protect dimension pages from deletion in full mode
   Even in a full (non-render-only) run, pages defined in self.dimensions
   are never deleted. Truly orphaned pages (not in dimensions AND not
   generated) are the only ones pruned.

3. _sync_enterprise_navigation returns True/False
   Deletion is gated on nav sync success. If nav sync fails, deletion
   is skipped to prevent inconsistency (deleted files + stale nav).
   Also fixes the fragile re.sub(r'nav:.*') regex by using string
   indexing instead, preventing accidental truncation of extra_css etc.

4. Deploy workflow V2 sanity check
   If V2 build produces fewer than 50 HTML pages or no index.html,
   deploy falls back to V1-only instead of overwriting V1 with a
   broken V2 build.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
Nubenetes Bot
2026-06-19 13:29:10 +02:00
parent a355889969
commit 1dd0dab308
2 changed files with 48 additions and 13 deletions

View File

@@ -49,6 +49,19 @@ jobs:
- name: Assemble Final Site
run: |
mkdir -p site/
# Safety check: V2 must have a valid index.html and at least 50 pages
V2_PAGE_COUNT=$(find site_v2/ -name "*.html" | wc -l)
if [ "$V2_PAGE_COUNT" -lt 50 ] || [ ! -f site_v2/index.html ]; then
echo "❌ V2 build looks broken (only $V2_PAGE_COUNT HTML pages). Deploying V1 only to protect the site."
cp -r site_v1/* site/
mkdir -p site/v1/
cp -r site_v1/* site/v1/
rm -rf site_v1/ site_v2/
exit 0
fi
echo "✅ V2 build OK ($V2_PAGE_COUNT pages). Assembling dual-version site."
# Copy V1 to root as fallback for any pages not present in V2
cp -r site_v1/* site/
# Overwrite root with V2 Elite Portal (matching pages will be V2 versions)