From 3159d34fb1e6172d8aec093e5dd117b7d90d8177 Mon Sep 17 00:00:00 2001 From: d-oit Date: Thu, 19 Nov 2026 09:57:07 +0100 Subject: [PATCH 1/7] chore(toolchain): pnpm 12.17.0 pin, workspace settings migration, runtime matrix (#1165,#1166) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - settings move: pnpm 12 dropped the package.json 'pnpm' field; overrides, peerDependencyRules, auditConfig, and the build-script denials (allowBuilds, via pnpm approve-builds) now live in pnpm-workspace.yaml; engine-strict moved there too and .npmrc is removed; the validate-package-manager gate checks the new location - pnpm-lock.yaml regenerated with pnpm 12: zero dependency churn (1179 packages before/after; added=removed=changed=empty); the manager itself becomes a lockfile-vendored package (packageManagerDependencies) - engines.node widens to >=22.12.0 <27.0.0 (Node 22 primary; 24/26 weekly scheduled matrix in runtime-matrix.yml per #1165) - agents-docs/RUNTIME_TOOLCHAIN.md documents the matrix, build-script policy, and the upgrade procedure; README/DEPLOYMENT version references updated; decision + rollback in plans/219 - plans/218: #1167 CSP reassessment — directive inventory with evidence, nonce evaluation against the offline precache contract, revisit triggers Generated by Mistral Vibe. Co-Authored-By: Mistral Vibe --- .github/workflows/runtime-matrix.yml | 65 +++++++ .npmrc | 1 - README.md | 2 +- agents-docs/DEPLOYMENT.md | 4 +- agents-docs/RUNTIME_TOOLCHAIN.md | 52 ++++++ package.json | 39 +---- plans/218-csp-reassessment-1167-2026-11-19.md | 57 +++++++ ...-runtime-toolchain-1165-1166-2026-11-19.md | 61 +++++++ pnpm-lock.yaml | 158 ++++++++++++++++++ pnpm-workspace.yaml | 35 ++++ scripts/validate-package-manager.sh | 24 ++- 11 files changed, 449 insertions(+), 49 deletions(-) create mode 100644 .github/workflows/runtime-matrix.yml delete mode 100644 .npmrc create mode 100644 agents-docs/RUNTIME_TOOLCHAIN.md create mode 100644 plans/218-csp-reassessment-1167-2026-11-19.md create mode 100644 plans/219-runtime-toolchain-1165-1166-2026-11-19.md diff --git a/.github/workflows/runtime-matrix.yml b/.github/workflows/runtime-matrix.yml new file mode 100644 index 000000000..c2bf0c123 --- /dev/null +++ b/.github/workflows/runtime-matrix.yml @@ -0,0 +1,65 @@ +name: Runtime Matrix + +# #1165: compatibility validation across the supported Node.js LTS lines. +# Primary CI runtime is Node 22 (ci-and-labels.yml); this workflow adds the +# wider matrix on a schedule so per-PR CI time stays bounded while every +# supported runtime gets install/lint/typecheck/unit/build evidence weekly +# (and on demand, and on every change to its own definition). +name: Runtime Matrix + +on: + schedule: + # Weekly, Monday 04:07 UTC — off the hour to reduce runner contention. + - cron: '7 4 * * 1' + workflow_dispatch: + pull_request: + paths: + - '.github/workflows/runtime-matrix.yml' + - 'pnpm-lock.yaml' + - 'package.json' + - 'pnpm-workspace.yaml' + +permissions: + contents: read + +concurrency: + group: runtime-matrix-${{ github.ref }} + cancel-in-progress: true + +jobs: + matrix: + name: Node ${{ matrix.node }} + runs-on: ubuntu-latest + timeout-minutes: 30 + strategy: + fail-fast: false + matrix: + node: ['22', '24', '26'] + steps: + - name: Checkout repository + uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 + - name: Setup pnpm + uses: pnpm/action-setup@73e46992e05b19abd31f2f3c20e0e7370d762115 # v6.1.1 + - name: Setup Node.js ${{ matrix.node }} + uses: actions/setup-node@949feb2413d6458794dcd2491c4babbbce0c15c1 # v7.1.0 + with: + node-version: ${{ matrix.node }} + cache: 'pnpm' + - name: Frozen install + run: pnpm install --frozen-lockfile + - name: Lint + run: pnpm run lint + - name: Typecheck + run: pnpm run typecheck + - name: Unit tests + run: pnpm run test + - name: Production build + run: pnpm run build + - name: Runtime summary + if: always() + run: | + { + echo "## Runtime matrix — Node ${{ matrix.node }}" + echo '- install/lint/typecheck/test/build completed on this runtime' + echo '- engines.node: `$(node -p "require(\"./package.json\").engines.node")`' + } >> "$GITHUB_STEP_SUMMARY" diff --git a/.npmrc b/.npmrc deleted file mode 100644 index b6f27f135..000000000 --- a/.npmrc +++ /dev/null @@ -1 +0,0 @@ -engine-strict=true diff --git a/README.md b/README.md index 2a0250bba..f47894523 100644 --- a/README.md +++ b/README.md @@ -67,7 +67,7 @@ Your notes stay in this browser (IndexedDB + a small localStorage envelope). No ### Prerequisites - **Node.js**: $\ge 22$ (pinned by `.nvmrc` and permitted by `package.json` `engines`) -- **pnpm**: `10.30.3` (pinned by `package.json` `packageManager`) +- **pnpm**: `12.17.0` (pinned by `package.json` `packageManager`) ### Installation & Development diff --git a/agents-docs/DEPLOYMENT.md b/agents-docs/DEPLOYMENT.md index c3f0b97f2..306612552 100644 --- a/agents-docs/DEPLOYMENT.md +++ b/agents-docs/DEPLOYMENT.md @@ -23,10 +23,10 @@ , an override makes Vercel use the *oldest* version of the named package manager in the build image — for pnpm that is **v6**, which cannot read this repo's `lockfileVersion: '9.0'` or its -`pnpm.overrides`. With no override, Vercel infers pnpm from `pnpm-lock.yaml` +`pnpm-workspace.yaml` `overrides`. With no override, Vercel infers pnpm from `pnpm-lock.yaml` and picks the right major. -The `packageManager: "pnpm@10.30.3"` field only takes effect when Corepack is +The `packageManager: "pnpm@12.17.0"` field only takes effect when Corepack is enabled on the Vercel project (`ENABLE_EXPERIMENTAL_COREPACK=1`). Do not assume it is active. diff --git a/agents-docs/RUNTIME_TOOLCHAIN.md b/agents-docs/RUNTIME_TOOLCHAIN.md new file mode 100644 index 000000000..7bd2d2c37 --- /dev/null +++ b/agents-docs/RUNTIME_TOOLCHAIN.md @@ -0,0 +1,52 @@ +# Runtime & Toolchain + +Authoritative decisions: `plans/219-runtime-toolchain-1165-1166-2026-11-19.md` +(#1165 Node matrix, #1166 pnpm 12). This page is the operator-facing summary. + +## Node.js + +| Runtime | Status | Where validated | +|---------|--------|-----------------| +| Node 22 LTS | **Primary runtime** — `engines.node` floor is `>=22.12.0` | Per-PR CI (`ci-and-labels.yml`), `setup-node` pinned to `'22'` | +| Node 24 LTS | Supported — inside `engines.node` `>=22.12.0 <27.0.0` | Scheduled weekly matrix (`.github/workflows/runtime-matrix.yml`) | +| Node 26 LTS | Supported — same range, same schedule | Same matrix | +| Node 27+ | **Not supported** (untested future line) — engine-strict refuses it | — | + +- The matrix runs frozen install, lint, typecheck, unit tests, and the + production build on every listed runtime (weekly + on demand + on any + change to the workflow, lockfile, or root manifests). +- A red matrix run is a supported-runtime blocker: record the concrete + failure (and the upstream issue) in plan 219, narrow `engines.node`, and + note the exclusion — no runtime is advertised merely because install + worked. + +## pnpm + +- Pinned **`pnpm@12.17.0`** by `packageManager` (lockfile vendors the pinned + manager: integrity-checked `@pnpm/exe.*` artifacts in the lockfile's + manager document, so CI and local installs are reproducible even before + `pnpm/action-setup` runs). +- All pnpm settings live in `pnpm-workspace.yaml` (`engineStrict`, + `peerDependencyRules`, `overrides`, `allowBuilds`, `auditConfig`). There is + **no `.npmrc`** and no `pnpm` field in `package.json` — pnpm 12 ignores the + latter and the validator (`scripts/validate-package-manager.sh`) fails the + gate if settings drift back. +- Build scripts of pinned deps are **denied by default** (`allowBuilds: + pkg: false` — core-js, esbuild, onnxruntime-node, protobufjs, + unrs-resolver). To approve a new dep's postinstall, run + `pnpm approve-builds ` and review the resulting `allowBuilds` diff — + never run `--all`. +- Rollback pnpm: `git revert` the plan-219 commit, then + `pnpm install --frozen-lockfile` (details in plan 219). + +## Upgrading the toolchain (next time) + +1. `npm view pnpm versions` + release notes; test with + `npm_config_manage_package_manager_versions=false npx -y pnpm@ + install --frozen-lockfile` first — expect a settings migration, never + regenerate blindly. +2. `pnpm approve-builds` for new build-script deps (deny form to preserve the + default). +3. Full gate under the candidate (`pnpm --version` must print the candidate), + lockfile churn diff (target: zero dep-graph changes), docs + plan record, + then pin. diff --git a/package.json b/package.json index 23dd23dd8..8198663e7 100644 --- a/package.json +++ b/package.json @@ -3,9 +3,9 @@ "version": "0.2.0", "private": true, "type": "module", - "packageManager": "pnpm@10.30.3", + "packageManager": "pnpm@12.17.0", "engines": { - "node": ">=22.0.0 <25.0.0" + "node": ">=22.12.0 <27.0.0" }, "scripts": { "prepare": "./scripts/install-hooks.sh", @@ -124,40 +124,5 @@ "typescript-eslint": "^8.67.0", "vite": "^8.2.4", "vitest": "4.1.11" - }, - "pnpm": { - "peerDependencyRules": { - "allowedVersions": { - "eslint": "10" - } - }, - "overrides": { - "postcss": "^8.5.23", - "source-map-js": "^1.2.2", - "brace-expansion@<1.1.18": "1.1.21", - "brace-expansion@>=5": "^5.0.12", - "picomatch": "^4.0.4", - "browserslist": "^4.28.7", - "js-yaml": "^4.3.2", - "adm-zip": "npm:adm-zip@0.6.1", - "dompurify": "^3.4.18", - "undici": "^7.29.1", - "nanoid@3": "3.3.18", - "postcss-selector-parser": "^7.1.6", - "smol-toml": "^1.9.1", - "katex": "^0.19.0" - }, - "ignoredBuiltDependencies": [ - "core-js", - "esbuild", - "onnxruntime-node", - "protobufjs", - "unrs-resolver" - ], - "auditConfig": { - "ignoreCves": [ - "CVE-2026-93687" - ] - } } } diff --git a/plans/218-csp-reassessment-1167-2026-11-19.md b/plans/218-csp-reassessment-1167-2026-11-19.md new file mode 100644 index 000000000..c547924ef --- /dev/null +++ b/plans/218-csp-reassessment-1167-2026-11-19.md @@ -0,0 +1,57 @@ +# Plan 218 — CSP reassessment for #1167 (2026-11-19) + +Periodic reassessment of the Content-Security-Policy required by #1167. +**Outcome: the least-privilege posture is confirmed; every exception is +measured and carries a revisit trigger; no policy change ships in plan 217.** + +Baseline: `packages` of evidence from #1051 / plan 191 — implementation in +`src/lib/security/csp.ts` (+ `next.config.ts`) with the unit invariant pins +in `src/lib/security/csp.test.ts` and production-Chromium violation capture +in `e2e/csp-violations.spec.ts`. + +## Directive inventory (each source → why it exists → evidence) + +| Directive | Included sources | Required by | Evidence / revisit trigger | +|-----------|------------------|-------------|----------------------------| +| `default-src` | `'self'` | Everything else falls back to self; frame/object/base are separately tightened | Static site; no third-party frame/object/base use. Revisit on any new embedding feature. | +| `script-src` | `'self' 'unsafe-inline' 'unsafe-eval' 'wasm-unsafe-eval' blob:` | - `self`: app bundles. - `unsafe-eval`: `onnxruntime-web` compiles with `eval` — production Chromium drive recorded a real `script-src → eval` violation without it (plan 191). Removing it ships a permanent lexical fallback behind a working-looking toggle. - `wasm-unsafe-eval`: WebAssembly compile of the ONNX runtime (additive, never a substitute). - `blob:`: onnxruntime imports its WASM loader as a blob module — measured `script-src-elem → blob` + "no available backend found" without it. - `unsafe-inline`: Next.js does not emit nonce-bearing inline scripts in a static export; removing it breaks hydration (**#1051** tracks the nonce pipeline). | Re-run the production drive whenever: Next.js major upgrades; transformers.js/onnxruntime-web upgrades (watch for a no-eval build); any CSP violation appears in the e2e log. | +| `style-src` | `'self' 'unsafe-inline'` | Next.js inlines critical CSS `