From 051948cdb4c27ab28bae41d1cfa6431b6b66db19 Mon Sep 17 00:00:00 2001 From: Jaime Still Date: Mon, 30 Nov 2026 06:19:35 -0500 Subject: [PATCH] Take web-tooling 0.2.0: the browser in its own network namespace web-tooling 0.2.0's launch() runs Chrome in a user and network namespace with only loopback up, so a host link or address change no longer aborts the browser tier's page loads with ERR_NETWORK_CHANGED. The machine now needs unshare, ip, and unprivileged user namespaces. - package.json and the lockfile pin github:standards-lab/web-tooling#v0.2.0. - ci.yml and release.yml run "Allow the browser's network namespace" (sysctl kernel.apparmor_restrict_unprivileged_userns=0) just before the check, the shape of web-tooling's own CI. - docs/testing.md says what the browser tier needs from the machine, pointing to web-tooling's README; docs/release.md names the CI step; CHANGELOG records it. With a refusing unshare first on PATH, every browser test file fails in about 150 ms on launch()'s rejection: each after hook already closes with optional chaining, so the server started before launch() is stopped, and no test changed. No test or doc named ERR_NAME_NOT_RESOLVED. --- .github/workflows/ci.yml | 3 +++ .github/workflows/release.yml | 3 +++ CHANGELOG.md | 5 +++++ docs/release.md | 3 +++ docs/testing.md | 5 ++++- package.json | 2 +- pnpm-lock.yaml | 12 ++++++------ 7 files changed, 25 insertions(+), 8 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 5474646..6fc1d5c 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -20,5 +20,8 @@ jobs: - name: mise run install run: mise run install + - name: Allow the browser's network namespace + run: sudo sysctl -w kernel.apparmor_restrict_unprivileged_userns=0 + - name: mise run check run: mise run check diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index c8fb8ae..d0629e0 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -63,6 +63,9 @@ jobs: - name: mise run install run: mise run install + - name: Allow the browser's network namespace + run: sudo sysctl -w kernel.apparmor_restrict_unprivileged_userns=0 + - name: mise run check run: mise run check diff --git a/CHANGELOG.md b/CHANGELOG.md index 2909916..6b7ea41 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -12,6 +12,11 @@ All notable changes to `@standards-lab/web-components` are documented here. The chrome-headless-shell 158.0.8127.88, `@types/node` 26.6.11, ESLint 10.16.0, eslint-plugin-boundaries 7.4.5, and jdx/mise-action v5.4.0. - `marked` is at 18.3.0. +- The browser tier takes web-tooling 0.2.0, whose `launch()` runs the browser in a network + namespace of its own, so a link or address change on the machine no longer aborts the tests' + page loads with `ERR_NETWORK_CHANGED`. The machine now needs `unshare`, `ip`, and unprivileged + user namespaces, and the CI and release workflows allow them on the Ubuntu runner before the + check. - The repository's tasks take the agent-separation layout: `check` is a file task in `mise-tasks/` that runs the step scripts in `scripts/check/` in order, stopping at the first failure; the `lint`, `types`, `test`, and `preflight` tasks are gone, and under `MISE_ENV=agent`, which the diff --git a/docs/release.md b/docs/release.md index f45fe76..9803f9c 100644 --- a/docs/release.md +++ b/docs/release.md @@ -35,6 +35,9 @@ the tag's tree to the pack, file for file; and creates the GitHub release from t - **CI** runs the check on each pull request to main and each push to it. `mise run install` first installs every pin `mise.toml` names, the chrome-headless-shell the browser tier runs in included, and `node_modules`, the foundation, the icons, and the tooling at their release tags. + Before the check, it allows unprivileged user namespaces, which the Ubuntu runner's AppArmor + refuses until `kernel.apparmor_restrict_unprivileged_userns` is 0, so the browser tier's + browser gets its network namespace. Release does the same before its check. - **Release** checks out every branch and tag, so the pack commit's parent and main are both at hand. The parent must be main's merge commit, so it has two parents of its own. The tagged tree must be the tarball's `package/`, file for file. The release action releases the tag its `ref` diff --git a/docs/testing.md b/docs/testing.md index b748147..447f4c0 100644 --- a/docs/testing.md +++ b/docs/testing.md @@ -11,7 +11,10 @@ the behavior and layout each one holds to. and `release.test.ts` checks a `pnpm pack` of the `dist/` that `mise run build` writes, as it stands and in scratch copies with one fault each. - The browser tier runs on `dist/` in the pinned chrome-headless-shell, on the pages under - `test/fixtures/` and the specimen pages under `examples/`. `test/browser/support/served.ts` is + `test/fixtures/` and the specimen pages under `examples/`. web-tooling's `launch()` runs the + browser in a network namespace of its own, reaching only the loopback servers, so the machine + needs `unshare`, `ip`, and unprivileged user namespaces, as web-tooling's + [README](https://github.com/standards-lab/web-tooling#readme) gives. `test/browser/support/served.ts` is what the browser tier, `mise run examples`, and the screenshots description all serve, so the list is kept once. Of the served packages, lit's own dependencies (lit-html, lit-element, and `@lit/reactive-element`) sit beside it in pnpm's store and the server brings them with it; the diff --git a/package.json b/package.json index b0c09ce..218c5a3 100644 --- a/package.json +++ b/package.json @@ -26,7 +26,7 @@ "@eslint/js": "10.0.1", "@standards-lab/web-foundation": "github:standards-lab/web-foundation#v0.4.0", "@standards-lab/web-icons": "github:standards-lab/web-icons#v0.1.0", - "@standards-lab/web-tooling": "github:standards-lab/web-tooling#v0.1.0", + "@standards-lab/web-tooling": "github:standards-lab/web-tooling#v0.2.0", "@types/node": "26.6.11", "eslint": "10.16.0", "eslint-import-resolver-typescript": "4.4.5", diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 622a43d..49e8b04 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -28,8 +28,8 @@ importers: specifier: github:standards-lab/web-icons#v0.1.0 version: https://codeload.github.com/standards-lab/web-icons/tar.gz/499927708dcf386e0cff3de7ba84a10eaf19fa1a '@standards-lab/web-tooling': - specifier: github:standards-lab/web-tooling#v0.1.0 - version: https://codeload.github.com/standards-lab/web-tooling/tar.gz/24363f36750fe287250ac8b48310b6e02f22f794 + specifier: github:standards-lab/web-tooling#v0.2.0 + version: https://codeload.github.com/standards-lab/web-tooling/tar.gz/8dd6c26270a47779e713a0bba382e561461a9659 '@types/node': specifier: 26.6.11 version: 26.6.11 @@ -174,9 +174,9 @@ packages: vite: optional: true - '@standards-lab/web-tooling@https://codeload.github.com/standards-lab/web-tooling/tar.gz/24363f36750fe287250ac8b48310b6e02f22f794': - resolution: {gitHosted: true, integrity: sha512-D+0nTntEPlGCsjg82qXCVPb0INy38/uyiEbYbewQ+gq7pGSMMd9Mw1BDL2/VbuIQMI17cxXRKnnPZDrvP9eAyg==, tarball: https://codeload.github.com/standards-lab/web-tooling/tar.gz/24363f36750fe287250ac8b48310b6e02f22f794} - version: 0.1.0 + '@standards-lab/web-tooling@https://codeload.github.com/standards-lab/web-tooling/tar.gz/8dd6c26270a47779e713a0bba382e561461a9659': + resolution: {gitHosted: true, integrity: sha512-S1H+y1tcWl/t/dPr1mAJje6a1Lk1WY4EfgQw5Vleq3DxEvoGiS2KWXjeRgmBPgWf3SgoncE3jb33C9X5UaLXfQ==, tarball: https://codeload.github.com/standards-lab/web-tooling/tar.gz/8dd6c26270a47779e713a0bba382e561461a9659} + version: 0.2.0 hasBin: true '@types/esrecurse@4.3.1': @@ -958,7 +958,7 @@ snapshots: '@standards-lab/web-icons@https://codeload.github.com/standards-lab/web-icons/tar.gz/499927708dcf386e0cff3de7ba84a10eaf19fa1a': {} - '@standards-lab/web-tooling@https://codeload.github.com/standards-lab/web-tooling/tar.gz/24363f36750fe287250ac8b48310b6e02f22f794': {} + '@standards-lab/web-tooling@https://codeload.github.com/standards-lab/web-tooling/tar.gz/8dd6c26270a47779e713a0bba382e561461a9659': {} '@types/esrecurse@4.3.1': {}