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.

feat(stamphog): leave drizzle schema snapshots out of the size gate (#116873)

Marcus Hof237b7bb9cfa6
diff --git a/products/stamphog/packages/pr-approval-agent/README.md b/products/stamphog/packages/pr-approval-agent/README.md
index 86dd8935a5fb..b1a15a5e6a07 100644
--- a/products/stamphog/packages/pr-approval-agent/README.md
+++ b/products/stamphog/packages/pr-approval-agent/README.md
@@ -97,7 +97,9 @@ Size ceiling (hard gate)
snapshots (.snap/.ambr, __snapshots__/), images,
`.lock`-extension files (e.g. `yarn.lock`), tests (test dirs and
.test/.spec/_test files), and generated/ artifacts
- (regenerated-artifact extensions only: .ts/.tsx/.js/.jsx/.json/.md/.snap/.pyi/.txt)
+ (regenerated-artifact extensions only: .ts/.tsx/.js/.jsx/.json/.md/.snap/.pyi/.txt),
+ and Drizzle Kit schema snapshots (`migrations/meta/NNNN_snapshot.json`; the migrator reads only
+ the SQL and `_journal.json`, which still count)
don't count toward the ceiling, because they inflate diffs without adding review
surface. Note: `pnpm-lock.yaml` and `package-lock.json` are not `.lock`-extension
files and do count toward the ceiling. All files still count toward tier
diff --git a/products/stamphog/packages/pr-approval-agent/gates.py b/products/stamphog/packages/pr-approval-agent/gates.py
index cc7b706d8f99..97cf694caa79 100644
--- a/products/stamphog/packages/pr-approval-agent/gates.py
+++ b/products/stamphog/packages/pr-approval-agent/gates.py
@@ -684,7 +684,12 @@ _SIZE_EXEMPT_PATH_RE = re.compile(
r"|^services/mcp/src/api/generated\.ts$"
r"|\.gen\.(ts|tsx|js|jsx)$"
r"|\.generated\.(ts|tsx|js|jsx)$"
- r"|^frontend/src/queries/schema/",
+ r"|^frontend/src/queries/schema/"
+ # Drizzle Kit's schema snapshots: written by `drizzle-kit generate` and read only by its
+ # next run, never by the migrator, so a new table adds thousands of lines and no runtime.
+ # The sibling _journal.json is what the migrator reads, so it stays counted. Scoped to a
+ # migrations/ output dir so an unrelated meta/ folder of runtime JSON keeps counting.
+ r"|(?:^|/)migrations/meta/\d{4}_snapshot\.json$",
re.IGNORECASE,
)
diff --git a/products/stamphog/packages/pr-approval-agent/test_gates.py b/products/stamphog/packages/pr-approval-agent/test_gates.py
index f53b08a101c6..e7e00630efee 100644
--- a/products/stamphog/packages/pr-approval-agent/test_gates.py
+++ b/products/stamphog/packages/pr-approval-agent/test_gates.py
@@ -510,6 +510,18 @@ def test_dwh_source_mixed_still_denies() -> None:
pytest.param("services/mcp/src/api/generated_helpers.ts", False, id="generated-underscore-counted"),
pytest.param("frontend/src/queries/schema/schema-general.ts", True, id="queries-schema"),
pytest.param("frontend/src/types.gen.ts", True, id="dot-gen-suffix"),
+ pytest.param(
+ "products/desktop/packages/workspace-server/src/db/migrations/meta/0009_snapshot.json",
+ True,
+ id="drizzle-snapshot",
+ ),
+ pytest.param(
+ "products/desktop/packages/workspace-server/src/db/migrations/meta/_journal.json",
+ False,
+ id="drizzle-journal-counted",
+ ),
+ pytest.param("frontend/src/meta/0001_snapshot.ts", False, id="snapshot-named-code-counted"),
+ pytest.param("config/meta/0001_snapshot.json", False, id="snapshot-outside-migrations-counted"),
pytest.param("pnpm-lock.yaml", False, id="lockfile-yaml-counted"),
pytest.param("uv.lock", True, id="lockfile-lock-ext"),
pytest.param("posthog/api/insight.py", False, id="python-code"),
diff --git a/products/stamphog/packages/pr-approval-agent/version.py b/products/stamphog/packages/pr-approval-agent/version.py
index 48d3c5a0e433..545f1230cd04 100644
--- a/products/stamphog/packages/pr-approval-agent/version.py
+++ b/products/stamphog/packages/pr-approval-agent/version.py
@@ -9,4 +9,4 @@ changes don't need a bump - they are tracked by the policy sha shown next to
the version in the verdict table.
"""
-STAMPHOG_VERSION = "2.5.0"
+STAMPHOG_VERSION = "2.5.1"