Repository navigation
fix(flame): rebuild on config edits, prune removed pages, match deploy workflow to package manager - #463
Conversation
…y workflow to package manager Incremental builds: - A docu.json edit that does not touch the theme or meta.basePath (a sidebar title, the navbar text, the repo URL) left every page a cache hit and reused the client bundle, which inlines the config, until --force. `configStamp()` now folds the resolved config into the bundle hash and the page-asset key (BUILD_CACHE_VERSION 9). - Pages whose source was deleted or renamed stayed published with stale navigation. `pruneRemovedPages()` removes their HTML and cache entries before plugins' onEnd, using the cache as the list of files flame wrote, and never touches anything outside the docs output. flame deploy: - Under Bun it wrote a Bun-only GitHub Pages workflow (`bun install`) even for npm, pnpm and yarn projects. Both runtimes now use the shared, package-manager-aware `generateWorkflowYml()` and write identical files. - The pnpm workflow now passes `version` to pnpm/action-setup when package.json does not declare pnpm, which the action requires. It pins the major of the invoking pnpm, or `latest`. CSP and nonce were audited on static output, flame preview, the dev server and a plain static server, in Chromium on both runtimes: no violations.
|
The latest updates on your projects. Learn more about Vercel for GitHub. |
There was a problem hiding this comment.
Important
The new page pruning can delete the 404 page the same build just generated. Separately, it misses orphans whenever the build cache is discarded (--force or a flame upgrade). The config-stamp and deploy-workflow changes look correct.
Reviewed changes
Senior-mode review (flame build pipeline + deploy) of the single commit: cache-key additions, prune wiring in both build entries, the shared workflow generator, tests and docs.
configStamp()in the cache key: the rawdocu.jsonhash is now part ofhashMdxSources()and the__assets__key inbuild.tsandbuild.impl.ts, andBUILD_CACHE_VERSIONgoes to 9. Correct, and limited to the two build entries.pruneRemovedPages(): removes<DOCS_OUT_DIR>/<key>.htmlfor cache keys that no longer have a source, and refuses to touch anything outside the output root. It runs beforerunOnEnd.- Shared
generateWorkflowYml(): the Bun deploy entry now writes the same package-manager-aware workflow as Node/Deno.pnpmSetupVersion()pinspnpm/action-setup, and its README confirms thatlatestand major-only versions are accepted and thatversioncan be left out whenpackageManager/devEngines.packageManagerdeclares pnpm.
Top priorities: (1) run the prune before the landing/404 writes, (2) keep a record of the previous build's pages when the cache is discarded, (3) nothing else blocking.
claude-opus-5-5 | 𝕏
- Prune removed pages right after the docs pages are written, before the docs index and the 404 page. Pruning after them deleted the fresh 404 when docs/404.mdx was removed: under experimental.pages it shares `<basePath>/404.html`, and at a root deployment `404.html`. - Read the page keys of the previous build from the cache file on disk, ignoring its version and stamps (`previousPageKeys()`). `--force` and any stamp mismatch, such as a flame upgrade, discard the in-memory cache, and with it the only record of which pages to prune.
There was a problem hiding this comment.
✅ No new issues found. Both findings from the previous review are fixed, and their threads are resolved.
Reviewed changes
I reviewed in senior mode (flame build pipeline) the follow-up commit 7863f69, which addresses the two pruning findings from the previous review. Verdict: READY.
- Moved the prune ahead of generated pages: in
build.tsandbuild.impl.ts,pruneRemovedPages()now runs right after the page task loop. That is before the docs index write, the404.htmlwrite andrunOnEnd, so deletingdocs/404.mdxno longer removes the 404 page the same build just generated. An index-order assertion incache-key.test.tslocks this ordering for both entries. - Added
previousPageKeys(): it reads the non-__keys of the cache file on disk without checking stamps, and returns[]if the file is missing, corrupt or not an object. Both builds read it afterreadCache(), andpruneRemovedPages()prunes the union of these keys and the in-memory cache, with the out-of-root guard still applied. This means orphans are pruned even when--forceis used or a version/runtime/render stamp mismatch discards the cache.
claude-opus-5-5 | 𝕏

Why
An audit of the client bundle, the build cache, CSP/nonce handling and
flame deployfound four bugs, all reproduced on Bun and Node before fixing. Two make incremental builds publish stale output. Two make the generated GitHub Pages workflow wrong for the project. CSP and nonce handling had no bugs.Changes
Incremental builds
docu.jsonedit that does not touch the theme ormeta.basePath(a sidebar title, the navbar text, the repo URL) left every page a cache hit and reused the client bundle, which inlines the config. The change only showed up afterflame build --force.configStamp()folds the resolved config into the bundle hash and the page-asset key, andBUILD_CACHE_VERSIONis now 9.pruneRemovedPages()removes it and the cache entries right after the docs pages are written, before the docs index, the 404 page and plugins'onEnd, and the build lists what it removed. It uses the cache as the list of files flame wrote, so it only deletes<docsOutDir>/<key>.html, and a key that resolves outside the docs output is dropped without touching the filesystem.previousPageKeys()also reads the page keys from the cache file on disk, ignoring its version and stamps, so pruning still works when--forceor a flame upgrade discards the cache.flame deploybun install,bun run build) even for npm, pnpm and yarn projects, so CI ignored their lockfile. The Node path already detected the package manager.generateWorkflowYml()is now exported fromdeploy.shared.tsand used by both entries. Bun projects with a lockfile now install with--frozen-lockfile, as on the Node path.pnpm/action-setuprequiresversionunlesspackage.jsondeclares pnpm inpackageManagerordevEngines.packageManager, and flame's template declares neither.pnpmSetupVersion()pins the major of the pnpm that ranflame deploy, orlatest, and leaves the input out whenpackage.jsonalready pins pnpm.deployment.mdxdocuments the package-manager detection and the pnpm pin. Patch changeset for@docubook/flame.Before and after
Template project, rebuilt without
--force. Same results on Bun and Node.docu.jsonchangedrouting.htmlanddeployment.htmlstill publishedflame deploy, generated workflow:oven-sh/setup-bun,bun installactions/setup-node,npm ci --include=devoven-sh/setup-bun,bun installpnpm/action-setupwithversion: "10",pnpm install --frozen-lockfilebun installbun install --frozen-lockfileCSP and nonce audit
No changes needed:
javascript:URLs or cross-origin scripts.flame preview(fresh nonce per request), a plain static server (meta CSP only) andflame devon Bun and Node: no CSP violations, uncaught errors or failed requests. This included opening search (search-index fetch), toggling the theme and rendering Mermaid.Verification
vitest: 742 tests pass, including 18 new ones forconfigStamp,pruneRemovedPages(including the out-of-tree key and the prune order),previousPageKeysandgenerateWorkflowYml/pnpmSetupVersion, plus updated parity checks.tsc,oxlint,prettierandtest:release-planare clean, and the pre-push hook passed.docu.jsonthat point at the deleted pages, which now correctly 404.scripts/flame-browser-smoke.mjspasses on flame's own docs.Review follow-up (7863f69)
Pullfrog found two problems in the pruning, both fixed and verified on Bun and Node against 6eb4e01:
docs/404.mdxremoved the fresh 404. This happened underexperimental.pagesand also at a root deployment with the flag off. Pruning now runs before the docs index and the 404 page are written.--forceor a cache-stamp mismatch stayed published, because the discarded cache was the only record of them. The raw cache file is now read for that list.Notes
docu.jsonthat point at a removed page now 404 instead of reaching stale HTML. The build does not warn about such routes yet; that could be a follow-up.