Skip to content

:hedgehog: PostHog is the leading platform for building self-driving products. Our developer tools – AI observability, analytics, session replay, flags, experiments, error tracking, logs, and more – capture all the context agents need to diagnose problems, uncover opportunities, and ship fixes. Steer it all from Slack, web, desktop, or the MCP.

chore(deps): move pnpm settings to workspace config (#80857)

Matt Pua7318991731f6
diff --git a/package.json b/package.json
index 08d5912b7272..67337dcc0dab 100644
--- a/package.json
+++ b/package.json
@@ -123,105 +123,5 @@
"engines": {
"node": ">=24 <25"
},
- "packageManager": "[email protected]",
- "pnpm": {
- "// Fix React version to a fixed known good version across the monorepo": "",
- "overrides": {
- "axios": "^1.15.0",
- "@modelcontextprotocol/sdk": "^1.29.0",
- "@types/react": "18.3.27",
- "@types/react-dom": "18.3.7",
- "cipher-base": ">=1.0.5",
- "d3-geo": ">=3.1.0",
- "d3-selection": ">=3.0.0",
- "d3-zoom": ">=3.0.0",
- "form-data": ">=4.0.4",
- "node-forge": ">=1.4.0",
- "pbkdf2": ">=3.1.3",
- "react": "18.3.1",
- "react-dom": "18.3.1",
- "sha.js": ">=2.4.12",
- "typescript": "6.0.3",
- "ultimate-express>uWebSockets.js": "-",
- "fast-xml-parser@^4": ">=4.5.4",
- "fast-xml-parser@^5": ">=5.3.5",
- "jest-playwright-preset>playwright-core": "1.60.0",
- "@smithy/node-http-handler": "4.4.9",
- "@smithy/core": "3.24.6",
- "rolldown": "1.1.4",
- "@tiptap/core": "3.20.6",
- "@tiptap/extensions": "3.20.6",
- "@tiptap/html": "3.20.6",
- "@tiptap/markdown": "3.20.6",
- "@tiptap/pm": "3.20.6",
- "@tiptap/react": "3.20.6",
- "@tiptap/starter-kit": "3.20.6",
- "@tiptap/suggestion": "3.20.6",
- "@tiptap/extension-blockquote": "3.20.6",
- "@tiptap/extension-bold": "3.20.6",
- "@tiptap/extension-bubble-menu": "3.20.6",
- "@tiptap/extension-bullet-list": "3.20.6",
- "@tiptap/extension-code": "3.20.6",
- "@tiptap/extension-code-block": "3.20.6",
- "@tiptap/extension-code-block-lowlight": "3.20.6",
- "@tiptap/extension-collaboration": "3.20.6",
- "@tiptap/extension-color": "3.20.6",
- "@tiptap/extension-document": "3.20.6",
- "@tiptap/extension-drag-handle": "3.20.6",
- "@tiptap/extension-drag-handle-react": "3.20.6",
- "@tiptap/extension-dropcursor": "3.20.6",
- "@tiptap/extension-floating-menu": "3.20.6",
- "@tiptap/extension-gapcursor": "3.20.6",
- "@tiptap/extension-hard-break": "3.20.6",
- "@tiptap/extension-heading": "3.20.6",
- "@tiptap/extension-horizontal-rule": "3.20.6",
- "@tiptap/extension-image": "3.20.6",
- "@tiptap/extension-italic": "3.20.6",
- "@tiptap/extension-link": "3.20.6",
- "@tiptap/extension-list": "3.20.6",
- "@tiptap/extension-list-item": "3.20.6",
- "@tiptap/extension-list-keymap": "3.20.6",
- "@tiptap/extension-node-range": "3.20.6",
- "@tiptap/extension-ordered-list": "3.20.6",
- "@tiptap/extension-paragraph": "3.20.6",
- "@tiptap/extension-placeholder": "3.20.6",
- "@tiptap/extension-strike": "3.20.6",
- "@tiptap/extension-table": "3.20.6",
- "@tiptap/extension-table-of-contents": "3.20.6",
- "@tiptap/extension-text": "3.20.6",
- "@tiptap/extension-text-align": "3.20.6",
- "@tiptap/extension-text-style": "3.20.6",
- "@tiptap/extension-underline": "3.20.6"
- },
- "patchedDependencies": {
- },
- "// Known dependencies that we need preinstall scripts for, add new ones with caution": "",
- "onlyBuiltDependencies": [
- "@modelcontextprotocol/ext-apps",
- "@mongodb-js/zstd",
- "@parcel/watcher",
- "chartjs-plugin-stacked100",
- "@swc/core",
- "core-js",
- "core-js-pure",
- "cpu-features",
- "esbuild",
- "lmdb",
- "lz4",
- "msgpackr-extract",
- "msw",
- "node-gyp",
- "node-rdkafka",
- "protobufjs",
- "re2",
- "sharp",
- "ssh2",
- "unrs-resolver",
- "workerd"
- ]
- }
+ "packageManager": "[email protected]"
}
diff --git a/pnpm-workspace.yaml b/pnpm-workspace.yaml
index 6ff39b71cd2d..67adeb4600d4 100644
--- a/pnpm-workspace.yaml
+++ b/pnpm-workspace.yaml
@@ -32,6 +32,104 @@ packages:
blockExoticSubdeps: true
trustPolicy: no-downgrade
+# Fix React versions across the monorepo.
+overrides:
+ axios: ^1.15.0
+ '@modelcontextprotocol/sdk': ^1.29.0
+ '@types/react': 18.3.27
+ '@types/react-dom': 18.3.7
+ cipher-base: '>=1.0.5'
+ d3-geo: '>=3.1.0'
+ d3-selection: '>=3.0.0'
+ d3-zoom: '>=3.0.0'
+ form-data: '>=4.0.4'
+ node-forge: '>=1.4.0'
+ pbkdf2: '>=3.1.3'
+ react: 18.3.1
+ react-dom: 18.3.1
+ sha.js: '>=2.4.12'
+ typescript: 6.0.3
+ ultimate-express>uWebSockets.js: '-'
+ fast-xml-parser@^4: '>=4.5.4'
+ fast-xml-parser@^5: '>=5.3.5'
+ jest-playwright-preset>playwright-core: 1.60.0
+ '@smithy/node-http-handler': 4.4.9
+ '@smithy/core': 3.24.6
+ rolldown: 1.1.4
+ '@tiptap/core': 3.20.6
+ '@tiptap/extensions': 3.20.6
+ '@tiptap/html': 3.20.6
+ '@tiptap/markdown': 3.20.6
+ '@tiptap/pm': 3.20.6
+ '@tiptap/react': 3.20.6
+ '@tiptap/starter-kit': 3.20.6
+ '@tiptap/suggestion': 3.20.6
+ '@tiptap/extension-blockquote': 3.20.6
+ '@tiptap/extension-bold': 3.20.6
+ '@tiptap/extension-bubble-menu': 3.20.6
+ '@tiptap/extension-bullet-list': 3.20.6
+ '@tiptap/extension-code': 3.20.6
+ '@tiptap/extension-code-block': 3.20.6
+ '@tiptap/extension-code-block-lowlight': 3.20.6
+ '@tiptap/extension-collaboration': 3.20.6
+ '@tiptap/extension-color': 3.20.6
+ '@tiptap/extension-document': 3.20.6
+ '@tiptap/extension-drag-handle': 3.20.6
+ '@tiptap/extension-drag-handle-react': 3.20.6
+ '@tiptap/extension-dropcursor': 3.20.6
+ '@tiptap/extension-floating-menu': 3.20.6
+ '@tiptap/extension-gapcursor': 3.20.6
+ '@tiptap/extension-hard-break': 3.20.6
+ '@tiptap/extension-heading': 3.20.6
+ '@tiptap/extension-horizontal-rule': 3.20.6
+ '@tiptap/extension-image': 3.20.6
+ '@tiptap/extension-italic': 3.20.6
+ '@tiptap/extension-link': 3.20.6
+ '@tiptap/extension-list': 3.20.6
+ '@tiptap/extension-list-item': 3.20.6
+ '@tiptap/extension-list-keymap': 3.20.6
+ '@tiptap/extension-node-range': 3.20.6
+ '@tiptap/extension-ordered-list': 3.20.6
+ '@tiptap/extension-paragraph': 3.20.6
+ '@tiptap/extension-placeholder': 3.20.6
+ '@tiptap/extension-strike': 3.20.6
+ '@tiptap/extension-table': 3.20.6
+ '@tiptap/extension-table-of-contents': 3.20.6
+ '@tiptap/extension-text': 3.20.6
+ '@tiptap/extension-text-align': 3.20.6
+ '@tiptap/extension-text-style': 3.20.6
+ '@tiptap/extension-underline': 3.20.6
+
+patchedDependencies:
+
+# Dependencies that require preinstall scripts. Add entries with caution.
+onlyBuiltDependencies:
+ - '@modelcontextprotocol/ext-apps'
+ - '@mongodb-js/zstd'
+ - '@parcel/watcher'
+ - chartjs-plugin-stacked100
+ - '@swc/core'
+ - core-js
+ - core-js-pure
+ - cpu-features
+ - esbuild
+ - lmdb
+ - lz4
+ - msgpackr-extract
+ - msw
+ - node-gyp
+ - node-rdkafka
+ - protobufjs
+ - re2
+ - sharp
+ - ssh2
+ - unrs-resolver
+ - workerd
+
catalog:
# Kea ecosystem - state management
kea: ^4.0.0-pre.6
diff --git a/tools/pr-approval-agent/gates.py b/tools/pr-approval-agent/gates.py
index 1b1c48eab8d9..9b47d6f0d25b 100644
--- a/tools/pr-approval-agent/gates.py
+++ b/tools/pr-approval-agent/gates.py
@@ -60,7 +60,7 @@ class Ecosystem:
DEPENDENCY_ECOSYSTEMS: dict[str, Ecosystem] = {
"node": Ecosystem(
- manifests=frozenset({"package.json"}),
+ manifests=frozenset({"package.json", "pnpm-workspace.yaml"}),
lockfiles=frozenset({"pnpm-lock.yaml", "package-lock.json", "yarn.lock", "npm-shrinkwrap.json"}),
trusted_at_dismiss=True,
),
diff --git a/tools/pr-approval-agent/manifest_risk.py b/tools/pr-approval-agent/manifest_risk.py
index 73e413a60b9e..5c9074d43fd6 100644
--- a/tools/pr-approval-agent/manifest_risk.py
+++ b/tools/pr-approval-agent/manifest_risk.py
@@ -21,6 +21,8 @@ from collections.abc import Callable
from pathlib import Path
from typing import NamedTuple
+import yaml
+
# Any change at all to these is execution-bearing — setup.py and Gemfile are
# code, and setup.cfg's declarative surface (entry_points, cmdclass) doesn't
# justify a parser for how rarely it changes.
@@ -48,6 +50,16 @@ def _package_json_risky_subtree(text: str) -> object:
return {key: data.get(key) for key in ("scripts", "husky", "pnpm")}
+_PNPM_WORKSPACE_INERT_KEYS = frozenset({"packages", "catalog", "catalogs"})
+
+
+def _pnpm_workspace_risky_subtree(text: str) -> object:
+ data = yaml.safe_load(text) if text.strip() else {}
+ if not isinstance(data, dict):
+ raise ValueError("pnpm-workspace.yaml root is not a mapping")
+ return {key: value for key, value in data.items() if key not in _PNPM_WORKSPACE_INERT_KEYS}
+
+
def _composer_json_risky_subtree(text: str) -> object:
return _json_object(text, "composer.json").get("scripts")
@@ -102,6 +114,7 @@ class StructuralCheck(NamedTuple):
_STRUCTURAL_RISK_CHECKS: dict[str, StructuralCheck] = {
"package.json": StructuralCheck(_package_json_risky_subtree, (ValueError,)),
+ "pnpm-workspace.yaml": StructuralCheck(_pnpm_workspace_risky_subtree, (yaml.YAMLError, ValueError)),
"pyproject.toml": StructuralCheck(_toml_risky_subtree, (tomllib.TOMLDecodeError, ValueError)),
"pipfile": StructuralCheck(_toml_risky_subtree, (tomllib.TOMLDecodeError, ValueError)),
"cargo.toml": StructuralCheck(_cargo_risky_subtree, (tomllib.TOMLDecodeError,)),
diff --git a/tools/pr-approval-agent/test_gates.py b/tools/pr-approval-agent/test_gates.py
index a451da5bd60f..da758ffdfa78 100644
--- a/tools/pr-approval-agent/test_gates.py
+++ b/tools/pr-approval-agent/test_gates.py
@@ -431,6 +431,11 @@ def test_substantive_size_counts_only_non_exempt_files() -> None:
[],
id="lockfile-present-hard-denies-instead",
),
+ pytest.param(
+ ["pnpm-workspace.yaml"],
+ ["pnpm-workspace.yaml"],
+ id="pnpm-workspace-manifest-flagged",
+ ),
pytest.param(
["common/esbuilder/tsconfig.json"],
["common/esbuilder/tsconfig.json"],
diff --git a/tools/pr-approval-agent/test_manifest_risk.py b/tools/pr-approval-agent/test_manifest_risk.py
index 566abbd2f228..8fa64319d314 100644
--- a/tools/pr-approval-agent/test_manifest_risk.py
+++ b/tools/pr-approval-agent/test_manifest_risk.py
@@ -43,6 +43,41 @@ def _pkg(scripts: str = "", extra: str = "") -> str:
True,
id="pnpm-config-added",
),
+ pytest.param(
+ "pnpm-workspace.yaml",
+ "onlyBuiltDependencies:\n - esbuild\n",
+ "onlyBuiltDependencies:\n - esbuild\n - evil\n",
+ True,
+ id="pnpm-workspace-built-dependency-added",
+ ),
+ pytest.param(
+ "pnpm-workspace.yaml",
+ "overrides:\n react: 18.3.1\n",
+ "overrides:\n react: 18.3.2\n",
+ True,
+ id="pnpm-workspace-override-edited",
+ ),
+ pytest.param(
+ "pnpm-workspace.yaml",
+ "catalog:\n react: 18.3.1\n",
+ "catalog:\n react: 18.3.2\n",
+ False,
+ id="pnpm-workspace-catalog-edit-clean",
+ ),
+ pytest.param(
+ "pnpm-workspace.yaml",
+ "packages:\n - .\n",
+ "packages:\n - .\nallowBuilds:\n esbuild: true\n",
+ True,
+ id="pnpm-workspace-build-authorization-added",
+ ),
+ pytest.param(
+ "pnpm-workspace.yaml",
+ "packages:\n - .\n",
+ "packages:\n - .\ndangerouslyAllowAllBuilds: true\n",
+ True,
+ id="pnpm-workspace-all-builds-allowed",
+ ),
pytest.param(
"pyproject.toml",
"[project]\nname = 'x'\n",
@@ -137,6 +172,7 @@ def test_manifest_change_is_risky_structural(path: str, base: str, head: str, ri
"path, base, head",
[
pytest.param("frontend/package.json", _pkg(), "{not json", id="package-json"),
+ pytest.param("pnpm-workspace.yaml", "packages:\n - .\n", "packages: [", id="pnpm-workspace-yaml"),
pytest.param("pyproject.toml", "[project]\nname = 'x'\n", "[project\nname = 'x'\n", id="pyproject-toml"),
pytest.param("Pipfile", "[packages]\n", "[packages\n", id="pipfile"),
pytest.param("rust/Cargo.toml", '[package]\nname = "x"\n', '[package\nname = "x"\n', id="cargo-toml"),