Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
69 commits
Select commit Hold shift + click to select a range
0a74c1b
feat(bundler-plugin-core): verify the debug-ID stamp, and delete maps…
krassx Nov 23, 2026
7f13da8
feat(bundler-plugin-core): stamp debug-IDs inside the build for Vite,…
krassx Nov 23, 2026
de212ad
docs: in-build stamping, stamp verification and safe map deletion
krassx Nov 23, 2026
d251091
chore: changeset for in-build stamping
krassx Nov 23, 2026
7acaa8e
feat(bundler-plugin-core): stamp a hashed build and re-seal its integ…
krassx Nov 23, 2026
e8495dd
fix(bundler-plugin-core): review findings on in-build stamping
krassx Nov 23, 2026
1218afe
feat(angular): @bugsee/angular/sourcemaps and the bugsee-angular-uplo…
krassx Nov 23, 2026
d42fe8f
fix(bundler-plugin-core): round-2 review findings on stamp verification
krassx Nov 23, 2026
bb5d505
fix(bundler-plugin-core): treat an import map's integrity table as a …
krassx Nov 23, 2026
e5e93e9
feat(angular): ng add schematic, build wiring and a real-output test
krassx Nov 23, 2026
780fd61
fix(bundler-plugin-core): round-3 review findings
krassx Nov 23, 2026
707bcf7
fix(bundler-plugin-core): upload a pre-stamped build as an explicit f…
krassx Nov 23, 2026
9c30963
fix(bundler-plugin-core): re-seal by what each script's digests were,…
krassx Nov 23, 2026
ed55e8e
docs: Angular ng add, source-map upload and SRI re-seal
krassx Nov 23, 2026
2e4885f
fix(bundler-plugin-core): upload and delete every uploadable map, wha…
krassx Nov 23, 2026
7bf43e9
Merge origin/feat/in-build-stamping into feat/angular-sourcemaps
krassx Nov 23, 2026
ac5a8ea
fix(bundler-plugin-core): roll the build back when the re-seal fails
krassx Nov 23, 2026
f1a0e0a
fix(angular): keep an existing ErrorHandler, no-op without a token be…
krassx Nov 23, 2026
e7a6f10
fix(bundler-plugin-core): delete stylesheet/declaration maps on the p…
krassx Nov 23, 2026
6d06b43
fix(bundler-plugin-core): stamp moved maps, walk any depth, determini…
krassx Nov 23, 2026
3bdb914
fix(bundler-plugin-core): foreign maps survive, unreachable maps are …
krassx Nov 23, 2026
4cb9575
fix(bundler-plugin-core): delete by identity (what this build emitted…
krassx Nov 23, 2026
21daacb
fix(bundler-plugin-core): webpack/Rspack asset names with a ?query no…
krassx Nov 23, 2026
10242b1
fix(bundler-plugin-core): cut asset names at '?' only; '#' is part of…
krassx Nov 23, 2026
4077365
chore(bundler-plugin-core): round-12 leftovers (limits doc, script-li…
krassx Nov 23, 2026
c85d306
Merge origin/feat/in-build-stamping (4077365b) into feat/angular-sour…
krassx Nov 23, 2026
1a770c5
fix(angular): name this build's own files so foreign maps in fenced d…
krassx Nov 23, 2026
e76176e
feat(bundler-plugin-core): re-seal service worker manifests (ngsw.jso…
krassx Nov 23, 2026
96b5162
fix(angular): re-compute service worker manifests instead of refusing…
krassx Nov 23, 2026
d8570ff
fix(bundler-plugin-core): write webpack/Rspack stamped assets as STRI…
krassx Nov 23, 2026
3782b60
fix(bundler-plugin-core): Vite workers keep the debug-id in their map…
krassx Nov 23, 2026
837bd6c
fix(bundler-plugin-core): the worker catch-up never costs the build i…
krassx Nov 23, 2026
9f67602
fix(bundler-plugin-core): catch-up always verifies/restores, reports …
krassx Nov 23, 2026
8c798c5
test(bundler-plugin-core): pin the catch-up's per-pair read guard
krassx Nov 23, 2026
e650531
Merge origin/feat/in-build-stamping (8c798c5b) into feat/angular-sour…
krassx Nov 23, 2026
540e304
fix(angular): --dist on an SSR build re-seals the server modules; rej…
krassx Nov 23, 2026
c74f033
fix(angular,bundler-plugin-core): find the SSR output root from any n…
krassx Nov 23, 2026
ef4e80b
fix(angular,bundler-plugin-core): re-seal one locale only, verify the…
krassx Nov 23, 2026
a9c0d73
fix: CI packaging guard, re-seal only when needed, no false rollback …
krassx Nov 23, 2026
355d236
fix(bundler-plugin-core): address PR #221 review threads and code-sca…
krassx Nov 23, 2026
436ac98
test(bundler-plugin-core): type the catch-up edge-case run mock
krassx Nov 23, 2026
a67491a
style(bundler-plugin-core): format a test
krassx Nov 23, 2026
048700a
fix(bundler-plugin-core): on-disk re-check judges only what the stamp…
krassx Nov 23, 2026
e0d192d
fix(bundler-plugin-core): report an unrestorable rewrite, sibling out…
krassx Nov 23, 2026
c4bf2ff
fix(bundler-plugin-core): a generate()-only output cannot hide anothe…
krassx Nov 23, 2026
97da0be
fix(bundler-plugin-core): coordinate outputs by physical directory; s…
krassx Nov 23, 2026
117053e
fix(bundler-plugin-core): generate()-only outputs are no siblings; ca…
krassx Nov 23, 2026
f361097
Merge origin/feat/in-build-stamping (117053e8) into feat/angular-sour…
krassx Nov 23, 2026
0f9a3ef
feat(nextjs): withBugsee() source-map upload for webpack and Turbopac…
krassx Nov 23, 2026
0d360f9
fix(bundler-plugin-core): review sweep - own-map exception by own nam…
krassx Nov 23, 2026
5fbeb79
Merge origin/feat/in-build-stamping (#224) into the sweep
krassx Nov 23, 2026
137601b
Merge origin/feat/in-build-stamping (0f9a3ef4) into feat/angular-sour…
krassx Nov 23, 2026
4dac82a
fix: remove the duplicate env-file export left by the merge
krassx Nov 23, 2026
3bbcbce
fix(nextjs,bundler-plugin-core): remove forced browser maps when the …
krassx Nov 23, 2026
e04f684
docs(nextjs): registration follows the source-map pipeline; document …
krassx Nov 23, 2026
f5455e3
fix(nextjs): sweep forced browser maps after every run, and when a se…
krassx Nov 23, 2026
953dff4
Merge origin/feat/in-build-stamping (f5455e36) into feat/angular-sour…
krassx Nov 23, 2026
fc385a7
fix(angular,bundler-plugin-core): review threads - restore on inject …
krassx Nov 23, 2026
081e500
fix(bundler-plugin-core): report a failed restore after inject failur…
krassx Nov 23, 2026
dd5b68c
fix(bundler-plugin-core): address PR review (generate-only, standalon…
krassx Nov 24, 2026
4b39207
fix(bundler-plugin-core): webpack stamps in-build in every mode; only…
krassx Nov 24, 2026
db8d182
fix(bundler-plugin-core,nextjs): review round on in-build stamping (s…
krassx Nov 24, 2026
2766d57
Merge origin/feat/in-build-stamping into feat/angular-sourcemaps
krassx Nov 24, 2026
9cea1b1
fix(nextjs): honour deleteMaps:false and sweep forced maps on the no-…
krassx Nov 24, 2026
71a2ea6
docs(source-maps): webpack forced-map sweep honours deleteMaps:false …
krassx Nov 24, 2026
3c4ca0d
Merge origin/feat/in-build-stamping into feat/angular-sourcemaps
krassx Nov 24, 2026
c6ef38d
merge: main (squash-merged #221) into feat/angular-sourcemaps
krassx Nov 24, 2026
4dbfebb
fix(bundler-plugin-core): pass --allow-sri only when a re-seal will h…
krassx Nov 24, 2026
623c73b
fix(angular): refuse an SSR build whose server output is inside the b…
krassx Nov 24, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions .changeset/angular-sourcemaps.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
---
'@bugsee/angular': minor
'@bugsee/bundler-plugin-core': minor
---

`ng add @bugsee/angular` and Angular source maps. The schematic enables hidden script source maps in the production configuration, launches the SDK in `main.ts`, registers `BugseeErrorHandler` through Angular's own `addRootProvider` (standalone and NgModule apps; it prints what to add by hand rather than guess when it cannot find the bootstrap), and adds a `build:bugsee` script: `ng build`, then the new `bugsee-angular-upload` command (also `@bugsee/angular/sourcemaps`), which stamps debug-IDs into the browser output, uploads the maps and registers the build. Works on Angular's esbuild `application` builder and the webpack `browser` builder.

`subresourceIntegrity: true` is supported rather than refused: `@bugsee/bundler-plugin-core` gains `resealSri`, which snapshots every script's digests, stamps with `--allow-sri`, swaps each changed script's old digests for its new ones in the pages, an import map, the copy of the page an SSR build embeds in its server modules and the webpack builder's runtime hash table, then verifies the pages. The SRI scan now also reads `<script type="importmap">` integrity tables, which is how Angular 21+ pins its lazy chunks; before, a stamped lazy chunk was blocked by the browser. A build with service worker manifests (`ngsw.json`, one per locale) is supported: their SHA-1 hashes are recomputed after stamping and checked, and the build is restored if one cannot be reconciled.
3 changes: 2 additions & 1 deletion biome.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,8 @@
"!vendor",
"!.local-registry",
"!packages/protocol/spec",
"!docs/design/async-origin-capture/**"
"!packages/angular/test/fixtures",
"!docs/design/async-origin-capture"
]
},
"formatter": {
Expand Down
3 changes: 3 additions & 0 deletions dev-packages/packaging-guard/src/publish-manifest.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,9 @@ function referencedPaths(value: unknown, out: string[] = []): string[] {
function isPacked(path: string, files: string[] | undefined): boolean {
if (files === undefined) return true; // no allowlist: everything not ignored is packed
const rel = path.replace(/^\.\//, '');
// npm always packs package.json, whatever `files` says (as the doc comment above says). The Angular CLI resolves
// `<pkg>/package.json` through `exports` for `ng add`, so a package may legitimately export it.
if (rel === 'package.json') return true;
return files.some((entry) => {
const clean = entry.replace(/^\.\//, '').replace(/\/$/, '');
return rel === clean || rel.startsWith(`${clean}/`);
Expand Down
6 changes: 6 additions & 0 deletions docs/PROGRESS.md
Original file line number Diff line number Diff line change
Expand Up @@ -1532,5 +1532,11 @@ Verified against current majors, all green with no adapter code changes: `@bugse
### Debug-ID stamping inside the build for Vite, Rollup and Rspack; verified stamps; safe map deletion (2026-11-23)
`@bugsee/bundler-plugin-core` now stamps INSIDE the build wherever the bundler has a pre-write hook, so Subresource Integrity hashes taken later describe the stamped bytes: webpack 5 and **Rspack** at `PROCESS_ASSETS_STAGE_DEV_TOOLING + 1` (shared `tapProcessAssetsStamp`), **Vite and Rollup** in `generateBundle` (`order: 'pre'`; `rollupAssetStore` over chunks + `.map` assets; the stamped id is also put on `chunk.map` because Vite regenerates the map of a lazy-loading chunk after user hooks). esbuild and the standalone CLI stay post-emit with the SRI refusal (its message now names the workaround). Every stamp is verified (`verify-stamp.ts`: parses, sourceMappingURL intact, map debugId matches, original bytes + appended stamp): in-build all-or-nothing, post-emit snapshot + restore of the failing pair (`stamp-files.ts`); an in-build stamp is re-checked on disk (`verifyStampedPairs`) and against the HTML (`findIntegrityMismatches`). `.map` deletion now requires a confirmed upload AND a debugId on the map (`partitionByKeyed`). Real-build proof: `plugin.in-build.real-build.test.ts` (Vite 7 + 8, Rollup, Rspack with its built-in SRI plugin) and a Chromium run in `instrumentation-tests/test/sri-vite-rollup.e2e.ts`. Measured ordering limits and what the guards do not see: `docs/design/source-maps.md` §7.1.

### Angular: `ng add @bugsee/angular` and source-map upload, SRI re-seal (2026-11-23) → `feat/angular-sourcemaps`
`@bugsee/angular` gains a **schematic** (`ng add`; `src/schematics/ng-add`, built as CommonJS `dist/schematics/ng-add/index.cjs` + `collection.json`/`schema.json`, package.json `schematics` field; `@angular-devkit/schematics` + `@schematics/angular` are OPTIONAL PEERS `>=16.1` — `addRootProvider` exists from 16.1 — and never reach the runtime entry) and a **build-time entry** `@bugsee/angular/sourcemaps` + the `bugsee-angular-upload` bin (`uploadAngularSourcemaps`, `resolveAngularOutput`, `runCli`). The schematic: hidden script maps in the production configuration (never overriding a setting that already produces maps), `launch(token)` in `main.ts`, `BugseeErrorHandler` through Angular's own `addRootProvider` (standalone and NgModule; when the bootstrap cannot be found it changes no source and prints the lines to add), a `build:bugsee` script (`ng build --configuration production && bugsee-angular-upload ...`), the token in a git-ignored `.env.bugsee-build-plugin`. Idempotent. The upload step reuses `@bugsee/bundler-plugin-core` (no pipeline reimplemented): the esbuild `application` builder has no plugin hook, so it is a post-build step.

`@bugsee/bundler-plugin-core` additions: **`resealSri`** (snapshot every script's digests, stamp with `--allow-sri`, swap each changed script's old digests for its new ones in the pages, the HTML Angular embeds in its server modules and the webpack builder's runtime hash table, verify) — the refusal stays the default for every other caller; and the SRI scan now reads **`<script type="importmap">` integrity tables**, which is how Angular 21+ pins lazy chunks (found by a real Chromium run: a stamped lazy chunk was blocked while the entry ran). Exports `findSriProtectedScripts`/`findIntegrityMismatches`/`resealIntegrity`/`loadBuildPluginEnv`/`mergeBuildPluginEnv`.

Also found: Angular 22 already writes `//# debugId` (before its SRI hashes); the CLI keeps that id and adds only the `_bugseeDebugIds` registration. Verified with real Angular 22.3 (esbuild, SSR+prerender) and 19.2 (webpack `browser` builder) apps in Chromium; the first version of the re-seal read only the pages, and the real runs found the two places that missed (import-map lazy chunks on 22, the runtime table on 19). Evidence, limits (service worker refused; server bundles not uploaded), and why no wrapper builder: `docs/design/source-maps.md` §7.1 "Angular". User-facing setup: `docs/source-maps-usage.md` §2 and `packages/angular/README.md`. Round-2 review: service worker manifests are recomputed (per locale) instead of refused; configuration errors (no output, no angular.json, several apps, moved output) are warnings with exit 0 unless `--fail-on-error`, and `--output-path` points at a moved output; a failed re-seal restores the build and uploads nothing.
### Next.js build integration: `withBugsee` (`@bugsee/nextjs/config`), webpack AND Turbopack (2026-11-23)
`withBugsee(nextConfig, options)` makes `next build` stamp debug-IDs and upload source maps (gap #1 of the source-map gap analysis). Design + measured limits: `docs/design/source-maps.md` §7.3; user docs: `packages/nextjs/README.md`. **webpack** (`--webpack`, default <= 15): one per-compilation plugin (client, server, edge) stamping inside the compilation (`PROCESS_ASSETS_STAGE_DEV_TOOLING + 1`, SRI-safe) and uploading exactly the files that compilation emitted (`files` mode, nothing walks `.next`). The generic `@bugsee/webpack-plugin` was NOT reused for Next: measured against a real build it cannot stamp the server compilation (assets named `../app/page.js`, output path `.next/server/chunks`) and its directory-wide upload of `.next` collides across the three compilations. **Turbopack** (default 16; `--turbopack` 15.x): `compiler.runAfterProductionCompile` (15.4.0+) runs the real `inject` + upload over `.next/static` and `.next/server`, bundles paired with maps by the `sourceMappingURL` pointer (Turbopack does not name a map after its bundle; Next 15.5 shares one map between two runtime chunks, which are left unstamped with a notice). Measured limits: Turbopack writes the SRI hashes BEFORE the hook, so an `experimental.sri` Turbopack build is left unmodified with a notice (webpack handles SRI); Next 16 errors on a `webpack` function without a `turbopack` config, so none is added on Turbopack builds; `compiler.define` (not `defineServer`) bakes the app identity. Policy: browser maps deleted after a confirmed upload, server/edge maps kept (`deleteServerMaps`). Composes with a user's `webpack`, `compiler.runAfterProductionCompile`, `compiler.define`, `productionBrowserSourceMaps`, function/async configs; inert for dev/start/export. Core change: `@bugsee/bundler-plugin-core` now also exports `stampAssets`, `AssetStore`, `notify`, `resolveIdentity`, `loadBuildPluginEnv`, `mergeBuildPluginEnv`. Found by the independent reviews and fixed: stamped webpack assets are written as STRING sources (a Buffer is opaque to webpack's RealContentHashPlugin, which renames `[contenthash]` chunks after the stamp, so every lazy chunk 404'd; the e2e now opens each build in headless Chromium and asserts the lazy chunk runs), the baked define is the RAW value (Next JSON-encodes `compiler.define` itself; a JSON string arrived double-quoted), own-files-only deletion on Turbopack, contained post-build hook, version floors (hook 15.4.0, define 15.1.0), idempotent application. Real builds (`@bugsee/nextjs-e2e`, `test/source-maps.e2e.ts`, `next` 15.5.28 and 16.4.6 x webpack/Turbopack + SRI cases, real `bugsee-cli`, mock collector, `next start` smoke): see the PR for the run.
88 changes: 80 additions & 8 deletions docs/design/source-maps.md
Original file line number Diff line number Diff line change
Expand Up @@ -460,27 +460,99 @@ step that computes the hashes (esbuild, Angular, Bun, `tsc`). The CLI has its ow
build still breaks.
- **HTML emitted outside the output directory.** `html-webpack-plugin`'s `filename` can point anywhere
(`../templates/index.html` is the usual Django/Rails shape); the scan only walks `outDir`.
- **Importmap integrity** (`<script type="importmap">` whose JSON body carries an `integrity` map) —
an inline script with no `src`.
- **Lazy-chunk hash tables are not read.** The post-stamp integrity check compares what the HTML pins; the table
`webpack-subresource-integrity` / Rspack embed in the runtime chunk is correct because it was hashed after the
stamp (real-build test: every lazy chunk's digest appears in the runtime), but it is not re-verified from disk.
- **In-build stamping covers what is in the bundler's asset table.** A script copied verbatim from a `public/`
directory (never in the bundle) is no longer stamped, since the post-emit inject is skipped for a pre-stamped build.
- **The standalone CLI path.** Users driving `bugsee-cli` directly (Angular 17+, Bun, `tsc`) get no plugin guard,
but the CLI's own (`--allow-sri`).
- **The standalone CLI path.** Users driving `bugsee-cli` directly (Bun, `tsc`) get no plugin guard, but the CLI's
own (`--allow-sri`). Angular has its own entry (below).

It does see, and refuses: `<script integrity src=…>` and `<link rel=modulepreload|preload integrity href=…>`
in any `.html` under the output directory, quoted or bare, in any attribute order, with a whitespace-padded
URL. It deliberately does NOT fire on a CDN script, a non-JS target, a path outside the output directory, an
URL, and the `integrity` table of a `<script type="importmap">` (a URL-keyed pin the browser enforces like a tag's
attribute; an unparsable map is ignored, as a browser does). It deliberately does NOT fire on a CDN script, a non-JS target, a path outside the output directory, an
empty `integrity`, a `data-integrity`/`data-src` attribute, a commented-out tag, a `rel=prefetch` (a failed
prefetch is discarded, not fatal), or a symlinked page.

**Why not rewrite the hashes instead.** `webpack-subresource-integrity` also embeds the lazy chunks' hashes in
the runtime chunk (`__webpack_require__.sriHashes = {480: "sha384-…"}`), so patching the HTML alone would still
break every dynamic import, and Angular's builder has its own shape. Stamping before the hash is the only approach
correct for the HTML *and* the runtime-embedded lazy hashes (OPEN-FINDINGS D3's "real fix"; now built for webpack 5,
Rspack, Vite and Rollup).
break every dynamic import. Stamping before the hash is the only approach correct for the HTML *and* the
runtime-embedded lazy hashes (OPEN-FINDINGS D3's "real fix"; now built for webpack 5, Rspack, Vite and Rollup).
Re-writing IS correct where the page is the only place the hashes live — Angular's esbuild builder, next.

### Angular (`@bugsee/angular`): post-build stamp, then re-seal

Measured on `@angular/build` 22.3 (the esbuild `application` builder), read from its source and run for real.

**No hook to stamp before the hash.** The builder takes no plugin: `buildApplication(options, context, extensions)`
has `codePlugins` (esbuild) and `indexHtmlTransformer`, documented *"usage of the `extensions` parameter is NOT
supported and may cause unexpected build output or build failures"* and `@experimental`, and neither runs between
the final bytes and the hash (`execute-post-bundle.js`: debug-IDs, then `generateIndexHtml`, which computes SRI from
the output files). A wrapper builder over that API was therefore not built: it would sit on an unsupported seam of
an API that churns every release.

**What Angular already does.** Since 21/22 it writes an ECMA-426 `//# debugId=<uuid>` comment into every browser
bundle that has a map (and `debugId` into the map) when `sourceMap.scripts` is on, BEFORE the SRI hashes are taken.
That is only half of what the SDK needs: the `_bugseeDebugIds` registration that maps a running script to its id is
not there, so the SDK would report no id. `bugsee-cli sourcemaps inject` keeps an id another tool wrote and adds only
the registration (log: `registered an existing debug-id another tool wrote`), so Angular's id, the map's id and the
reported id are one value.

**Where Angular keeps the hashes** (`subresourceIntegrity: true`, one real build each, loaded in Chromium):

- (esbuild builder) the entry `<script src integrity>` tags and the stylesheet `<link integrity>` in `index.html` (and in every
prerendered page, and in `index.csr.html`);
- a `<script type="importmap">{"integrity": {"./chunk-X.js": "sha384-…"}}</script>` in the same page, pinning EVERY lazy chunk. A stamped lazy chunk is blocked
(`Failed to find a valid digest in the 'integrity' attribute for resource '…/chunk-X.js' … has been blocked`,
and `Failed to fetch dynamically imported module`) while the entry scripts still run — which is what made this a
finding: the first version of the scan read tags only;
- with SSR/prerender, a second copy of the page as a string in `server/assets-chunks/index*.html.mjs` and in
`server/index.server.html`, which the Node server answers requests from.

Nothing else in the esbuild builder's output (no runtime table). The legacy webpack `browser` builder differs:
its `runtime.*.js` carries the lazy chunks' hashes (`sriHashes`), which NO page pins (measured on
`@angular-devkit/build-angular` 19: a stamped lazy chunk was blocked while the entry scripts ran). So the stale
hashes cannot be found by reading the pages. They are found by what the files WERE: `snapshotScriptDigests` records
the sha256/384/512 of every script under the output before the stamp, and `resealIntegrity` swaps each changed
script's old digests for its new ones in every HTML, `.mjs` and `.js` file (same length, so no byte offset moves and
the maps stay valid), repeating (bounded) because rewriting the runtime's table changes the runtime's own hash.

The order that works is the one the CLI documents for `--allow-sri`: stamp, then recompute the hashes.
`uploadSourcemaps({ resealSri: true })` does: snapshot, `inject --allow-sri`, verify the stamp, re-seal, then verify
with `findIntegrityMismatches` (the pages' pins, the one thing a browser checks first). A page that still does not
verify is reported, or thrown under `failOnError`, never silent. A hash computed at run time, or kept in a file
outside the directories given, is not covered and is not claimed to be.

**Verified for real** (`npm run build:bugsee` from `ng add`, the packed `@bugsee/angular` + `@bugsee/bundler-plugin-core`,
the real `bugsee-cli`, a mock collector, Chromium via Playwright; `outputHashing: all`, `subresourceIntegrity: true`):

| App | Result |
|---|---|
| Angular 22.3, esbuild `application`, lazy route | every pin matches its file; 5 maps uploaded and deleted; the page runs, the lazy chunk loads, 4 debug-IDs registered, no console error |
| same, stamped with `--allow-sri` and NOT re-sealed (control) | blocked outright: nothing runs |
| Angular 22.3, SSR + prerender | 24 pins across `browser/`, `server/index.server.html` and the 3 `assets-chunks` modules all match; the real `server.mjs` serves a page that runs, 5 debug-IDs, no console error |
| Angular 19.2, webpack `browser` builder | the lazy chunk (blocked before the digest snapshot) now loads; 4 debug-IDs, no console error; control blocked |

CI keeps the bytes half of this: `upload.real-build.test.ts` runs the real CLI over two real Angular 22.3 chunks with
the SRI page shapes above (script tag, import map, SSR copy); the browser half is not in CI.

**Service worker manifests.** `ngsw.json` (one per locale for a localized build; measured on `@angular/build` 22.3 with
`@angular/service-worker`) carries `hashTable`: SHA-1 hex of each cached file's bytes, keyed by path from the manifest's
directory. A service worker that finds a mismatch treats the app as corrupt and stops serving it, and the SRI re-seal
(sha256/384/512) never touched it: the first version only refused a top-level manifest and so missed the per-locale
ones. `resealIntegrity` now recomputes every entry after the last pass (a targeted text swap, formatting untouched;
the file is found by dropping leading URL segments, which covers a base href), `findStaleServiceWorkerEntries` verifies,
and an entry that cannot be reconciled rolls the build back like a stale SRI hash. No other manifest field depends on
file contents in the version checked. **What it refuses:** nothing for a service worker now. It also stamps `browser/` only: a server bundle's errors are the Node
SDK's, symbolicated by `@bugsee/node`.

**The legacy webpack `browser` builder** (`@angular-devkit/build-angular:browser`) takes the same route: the post-build
step needs nothing from the builder, and its output is flat (`outputPath` IS the browser directory). Its SRI is the
reason for the digest snapshot above. `@angular-builders/custom-webpack` + `bugseeWebpackPlugin` (the route Sentry
documents) was considered and not built: it would need the plugin's in-build stamp to run before Angular's own SRI
plugin hashes, an ordering nobody verified for Angular's compilation, to cover one legacy builder that the post-build
step already covers with a measured result.

---

Expand Down
Loading
Loading