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.

fix(canvas): pin framer-motion's transitive motion-dom (#87576)

Adam Bowker6910d89ca89a
diff --git a/products/canvas/backend/tests/test_cloud_builder.py b/products/canvas/backend/tests/test_cloud_builder.py
index cbd7f3fe3a54..969b34707e9d 100644
--- a/products/canvas/backend/tests/test_cloud_builder.py
+++ b/products/canvas/backend/tests/test_cloud_builder.py
@@ -12,7 +12,7 @@ from django.test import SimpleTestCase
from parameterized import parameterized
from products.canvas.backend.build_service import node_executable, run_cloud_builder, validate_builder_output
-from products.canvas.backend.contract import platform_dependencies
+from products.canvas.backend.contract import allowed_import_specifiers, platform_dependencies
from products.canvas.backend.presentation.serializers import CanvasSourceProjectSerializer
from products.canvas.backend.source import synthetic_source_project, validate_source_project
@@ -90,21 +90,18 @@ class TestCanvasCloudBuilder(SimpleTestCase):
self.assertFalse(manifest["capabilities"]["posthog"]["inlineQueries"])
self.assertTrue(any(file["path"].endswith(".js") for file in files))
- def test_bundles_the_extended_platform_libraries(self) -> None:
- source = """
-import { useVirtualizer } from "@tanstack/react-virtual"
-import { useForm } from "react-hook-form"
-import { groupBy } from "lodash-es"
-import ReactMarkdown from "react-markdown"
-import Papa from "papaparse"
-void useVirtualizer
-void useForm
-void groupBy
-void ReactMarkdown
-void Papa
-"""
-
- project = self._project(source)
+ def test_bundles_every_allowlisted_platform_library(self) -> None:
+ # Transitive versions are not pinned, so a caret range can drift onto a
+ # dependency that dropped an export and break every canvas importing the
+ # library, while source validation still passes because the specifier is
+ # allowlisted. Namespace imports keep the whole module graph reachable,
+ # so a missing deep export fails here instead of in a user's publish.
+ imports: list[str] = []
+ for index, specifier in enumerate(sorted(allowed_import_specifiers())):
+ imports.append(f'import * as library{index} from "{specifier}"')
+ imports.append(f"void library{index}")
+
+ project = self._project("\n".join(imports))
project["dependencies"] = platform_dependencies()
result = run_cloud_builder(project)
diff --git a/products/canvas/packages/canvas_builder/package-lock.json b/products/canvas/packages/canvas_builder/package-lock.json
index ab6c55e799c0..4d35fc2e62e1 100644
--- a/products/canvas/packages/canvas_builder/package-lock.json
+++ b/products/canvas/packages/canvas_builder/package-lock.json
@@ -1740,6 +1740,21 @@
}
}
},
+ "node_modules/framer-motion/node_modules/motion-dom": {
+ "version": "12.23.12",
+ "resolved": "https://registry.npmjs.org/motion-dom/-/motion-dom-12.23.12.tgz",
+ "integrity": "sha512-RcR4fvMCTESQBD/uKQe49D5RUeDOokkGRmz4ceaJKDBgHYtZtntC/s2vLvY38gqGaytinij/yi3hMcWVcEF5Kw==",
+ "license": "MIT",
+ "dependencies": {
+ "motion-utils": "^12.23.6"
+ }
+ },
+ "node_modules/framer-motion/node_modules/motion-utils": {
+ "version": "12.23.6",
+ "resolved": "https://registry.npmjs.org/motion-utils/-/motion-utils-12.23.6.tgz",
+ "integrity": "sha512-eAWoPgr4eFEOFfg2WjIsMoqJTW6Z8MTUCgn/GZ3VRpClWBdnbjryiA3ZSNLyxCTmCQx4RmYX6jX1iWHbenUPNQ==",
+ "license": "MIT"
+ },
"node_modules/hast-util-to-jsx-runtime": {
"version": "2.3.6",
"resolved": "https://registry.npmjs.org/hast-util-to-jsx-runtime/-/hast-util-to-jsx-runtime-2.3.6.tgz",
@@ -2517,21 +2532,6 @@
],
"license": "MIT"
},
- "node_modules/motion-dom": {
- "version": "12.43.0",
- "resolved": "https://registry.npmjs.org/motion-dom/-/motion-dom-12.43.0.tgz",
- "integrity": "sha512-azKON4d9S65PEoFUiQTMTgPheEmzf2QngdRc50AKfJp9Q9mmcBVw22c8eMq9k8kxOFHdL7+WZY7N/5F/lwiDag==",
- "license": "MIT",
- "dependencies": {
- "motion-utils": "^12.39.0"
- }
- },
- "node_modules/motion-utils": {
- "version": "12.39.0",
- "resolved": "https://registry.npmjs.org/motion-utils/-/motion-utils-12.39.0.tgz",
- "integrity": "sha512-8nadJAJjTtqRkmRF36FoJTrywK9nnFmnPwnSMyxaOCU7GDjN9RTMJIxx9De8ErM+vpPhMccr/6fo5WciyQLnMQ==",
- "license": "MIT"
- },
"node_modules/ms": {
"version": "2.1.3",
"resolved": "https://registry.npmjs.org/ms/-/ms-2.1.3.tgz",
diff --git a/products/canvas/packages/canvas_builder/package.json b/products/canvas/packages/canvas_builder/package.json
index 3a413198cd0a..4fde4c20b78e 100644
--- a/products/canvas/packages/canvas_builder/package.json
+++ b/products/canvas/packages/canvas_builder/package.json
@@ -22,5 +22,10 @@
"tailwindcss": "4.3.1",
"three": "0.179.1",
"zod": "3.25.76"
- }
+ },
+ "overrides": {
+ "motion-dom": "12.23.12",
+ "motion-utils": "12.23.6"
+ },
+ "$comment": "framer-motion depends on motion-dom and motion-utils by caret range, and motion removes exports within that range: motion-dom 12.43.0 dropped `activeAnimations`, which framer-motion 12.23.12 imports. Pin both to what framer-motion was released against, and move them whenever framer-motion moves."
}