Title: id(web/build-manifest): a second run deletes the only stylesheet and drops its manifest entry — dist is left unstyled, exit 0 · Issue #6969 · developing-today/code · GitHub
Open Graph Title: id(web/build-manifest): a second run deletes the only stylesheet and drops its manifest entry — dist is left unstyled, exit 0 · Issue #6969 · developing-today/code
X Title: id(web/build-manifest): a second run deletes the only stylesheet and drops its manifest entry — dist is left unstyled, exit 0 · Issue #6969 · developing-today/code
Description: Problem pkgs/id/web/scripts/build-manifest.ts is not idempotent: a second run deletes the web UI's only stylesheet and writes a manifest that no longer mentions it — exit 0, no warning. The script's first step deletes every hashed styles...
Open Graph Description: Problem pkgs/id/web/scripts/build-manifest.ts is not idempotent: a second run deletes the web UI's only stylesheet and writes a manifest that no longer mentions it — exit 0, no warning. The script'...
X Description: Problem pkgs/id/web/scripts/build-manifest.ts is not idempotent: a second run deletes the web UI's only stylesheet and writes a manifest that no longer mentions it — exit 0, no warning. The scr...
Opengraph URL: https://github.com/developing-today/code/issues/6969
X: @github
Domain: github.com
IPv4 address: 140.82.113.3
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"id(web/build-manifest): a second run deletes the only stylesheet and drops its manifest entry — dist is left unstyled, exit 0","articleBody":"## Problem\n\n`pkgs/id/web/scripts/build-manifest.ts` is not idempotent: a second run deletes the web UI's only stylesheet and writes a manifest that no longer mentions it — exit 0, no warning.\n\nThe script's first step deletes **every** hashed stylesheet in `dist/`:\n\n```ts\n// Remove stale hashed CSS files before processing\nfor (const file of readdirSync(distDir)) {\n if (file.match(/^styles\\.[a-f0-9]+\\.css$/)) {\n unlinkSync(join(distDir, file));\n }\n}\n```\n\nThe only path that puts a stylesheet back is renaming an *unhashed* `styles.css` (the Tailwind output) later in the script. After a first run, `dist/` contains only `styles.\u003chash>.css` — there is no `styles.css` left to rename. So a second run:\n\n1. deletes `styles.\u003chash>.css` (the live stylesheet),\n2. finds no `styles.css` to rename,\n3. writes `manifest.json` with no `styles.css` entry, and logs it as success.\n\nThe Rust server then silently falls back to the unhashed default URL (`pkgs/id/src/web/mod.rs`, `load_asset_urls`: missing `styles.css` key → `/assets/styles.css`), which does not exist in `dist/` — every page is served unstyled, with no error at build time or runtime.\n\n`build:manifest` is a standalone script in `pkgs/id/web/package.json` (`\"build:manifest\": \"bun run scripts/build-manifest.ts\"`), so re-running it on an already-built `dist/` — a rebuild retry, a packaging step, a developer re-running one stage — is a realistic invocation, not a contrived one. The full `bun run build` sequence masks the bug because `build:css` regenerates `styles.css` first.\n\n## Evidence (verified this run, laptop probe)\n\nFixture `dist/` with `styles.css` + `main.abc12xyz.js`, script copied verbatim from `pkgs/id/web/scripts/build-manifest.ts` @ main `d3c26e14b5`, probe at `~/git/fleet/probe-build-manifest` on the laptop:\n\n- Run 1: `manifest.json: { \"main.js\": \"main.abc12xyz.js\", \"styles.css\": \"styles.74d94aed.css\" }`; `dist/` = `main.abc12xyz.js`, `manifest.json`, `styles.74d94aed.css`. Correct.\n- Run 2 (same dist, no regeneration): `manifest.json: { \"main.js\": \"main.abc12xyz.js\" }`; `dist/` = `main.abc12xyz.js`, `manifest.json` — **`styles.74d94aed.css` is gone and the manifest has no `styles.css` entry**. Exit code 0.\n\nThe JS side does not have this defect: the hashed bundle is kept and re-recorded on re-runs (only *stale extra* bundles are removed, newest by mtime wins). The CSS side deletes first and asks questions never.\n\nRelated contract: `pkgs/id/src/web/assets.rs` `is_hashed_filename` (#6779) pins the emitted names (`styles.` + exactly 8 lowercase hex + `.css`); the deletion regex in the script (`[a-f0-9]+`, any length) is also broader than that contract.\n\n## Why it matters\n\nA build step that destroys a built artifact on re-run, silently, turns a benign retry into a broken deployment: the server keeps serving pages whose stylesheet 404s. Nothing fails — not the script, not the server startup, not the manifest parse — so the breakage surfaces only as a visibly unstyled UI, far from the cause.\n\n## Acceptance criteria\n\n- Running `build-manifest.ts` twice in a row on the same `dist/` leaves the stylesheet file in place and `manifest.json` still maps `styles.css` to it (idempotent re-run).\n- A re-run with no unhashed `styles.css` but an existing contract-valid `styles.\u003c8-hex>.css` adopts that file into the manifest instead of deleting it (or fails loudly naming the missing input — silently dropping the entry is the one unacceptable outcome).\n- Stale-stylesheet cleanup still works: when `build:css` produces a new `styles.css` whose hash differs, the old hashed file is removed and the manifest points at the new one.\n- The deletion/adoption patterns match the #6779 emitted-name contract in `assets.rs` (exactly 8 hex chars for styles), or the divergence is explicitly justified in a comment.\n- A regression test or fixture script exercises the double-run case (the probe above is a ready-made repro).\n","author":{"url":"https://github.com/dezren39","@type":"Person","name":"dezren39"},"datePublished":"2026-11-07T22:43:57Z","url":"https://github.com/developing-today/code/issues/6969"}
| react-profiling | 0 |
| react-import-map | react,react-dom,react-dom/client,react-dom/profiling,react-is,react/compiler-runtime,react/jsx-dev-runtime,react/jsx-runtime,scheduler@b8488ee2c322 |
| route-pattern | /_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format) |
| route-controller | voltron_issues_fragments |
| route-action | issue_layout |
| fetch-nonce | v2:0dfb0332-8a1a-e2ea-0a36-a743c045084f |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | C240:B70F1:A4ED8A:DCE617:6B064238 |
| html-safe-nonce | 533ab271239eae84a17cdf810b636e3374c770c0713a309f59ba26bb9ac52766 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJDMjQwOkI3MEYxOkE0RUQ4QTpEQ0U2MTc6NkIwNjQyMzgiLCJ2aXNpdG9yX2lkIjoiMzIxMjMzNDM2MzIxMTg3NDg3MiIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9 |
| visitor-hmac | ce1166e1ab88232f0928f4f4cc6ab4efda4be1b81d1cda3da42dcae417382e73 |
| hovercard-subject-tag | issue:6265029219 |
| github-keyboard-shortcuts | repository,issues,copilot |
| google-site-verification | Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I |
| octolytics-url | https://collector.github.com/github/collect |
| analytics-location | / |
| fb:app_id | 1401488693436528 |
| apple-itunes-app | app-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/developing-today/code/6969/issue_layout |
| twitter:image | https://opengraph.githubassets.com/0a7ff9486abec7ea271877122dc188ee231994ece5fab599ac3de3f8454b1c96/developing-today/code/issues/6969 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/0a7ff9486abec7ea271877122dc188ee231994ece5fab599ac3de3f8454b1c96/developing-today/code/issues/6969 |
| og:image:alt | Problem pkgs/id/web/scripts/build-manifest.ts is not idempotent: a second run deletes the web UI's only stylesheet and writes a manifest that no longer mentions it — exit 0, no warning. The script'... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | dezren39 |
| hostname | github.com |
| expected-hostname | github.com |
| None | 1bff4f6bfaa96dc9c42cacf315424c24ebb548b06142ced5e3aaccb2a42dd652 |
| turbo-cache-control | no-preview |
| go-import | github.com/developing-today/code git https://github.com/developing-today/code.git |
| octolytics-dimension-user_id | 26439447 |
| octolytics-dimension-user_login | developing-today |
| octolytics-dimension-repository_id | 627308783 |
| octolytics-dimension-repository_nwo | developing-today/code |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 627308783 |
| octolytics-dimension-repository_network_root_nwo | developing-today/code |
| turbo-body-classes | logged-out env-production page-responsive |
| disable-turbo | false |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | ac613d3698d3d8565651455086e1f74da07bf277 |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
| react-app-name | issues |
Links:
| Server | github.com |
| Content-Type | text/html; charset=utf-8 |
| Cache-Control | max-age=0, private, must-revalidate |
Viewport: width=device-width