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(ci): check node personhog proto stub freshness (#79270)

Nick Best6339a1d45573
diff --git a/.github/workflows/ci-proto.yml b/.github/workflows/ci-proto.yml
index c6e636dd78e5..68b12fe6896f 100644
--- a/.github/workflows/ci-proto.yml
+++ b/.github/workflows/ci-proto.yml
@@ -41,6 +41,9 @@ jobs:
- 'proto/**'
- 'posthog/personhog_client/proto/generated/**'
- 'bin/generate_personhog_proto.sh'
+ - 'nodejs/src/common/generated/personhog/**'
+ - 'nodejs/buf.gen.yaml'
+ - 'nodejs/package.json'
- '.github/workflows/ci-proto.yml'
lint:
@@ -120,6 +123,8 @@ jobs:
- name: Check for diff
run: |
+ # Intent-to-add so brand-new generated files show up in git diff
+ git add -N posthog/personhog_client/proto/generated/
if ! git diff --exit-code posthog/personhog_client/proto/generated/; then
echo ""
echo "ERROR: Generated Python proto stubs are out of date."
@@ -128,8 +133,46 @@ jobs:
fi
echo "Generated Python proto stubs are up to date."
+ node-codegen:
+ name: Check Node proto stubs are up to date (depot-ubuntu-22.04-4)
+ needs: changes
+ if: needs.changes.outputs.proto == 'true'
+ runs-on: depot-ubuntu-22.04-4
+ timeout-minutes: 10
+
+ steps:
+ - uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
+ with:
+ clean: false
+
+ - name: Install buf
+ uses: bufbuild/buf-action@fd21066df7214747548607aaa45548ba2b9bc1ff # v1.4.0
+ with:
+ setup_only: true
+ version: '1.50.0'
+
+ - name: Install pnpm and dependencies
+ uses: ./.github/actions/pnpm-install
+ with:
+ install-command: pnpm --filter=@posthog/nodejs... install --frozen-lockfile
+
+ - name: Regenerate Node proto stubs
+ run: pnpm --dir nodejs run generate:personhog-proto
+
+ - name: Check for diff
+ run: |
+ # Intent-to-add so brand-new generated files show up in git diff
+ git add -N nodejs/src/common/generated/personhog/
+ if ! git diff --exit-code nodejs/src/common/generated/personhog/; then
+ echo ""
+ echo "ERROR: Generated Node proto stubs are out of date."
+ echo "Run 'pnpm run generate:personhog-proto' in nodejs/ and commit the result."
+ exit 1
+ fi
+ echo "Generated Node proto stubs are up to date."
+
proto_checks:
- needs: [changes, lint, breaking, python-codegen]
+ needs: [changes, lint, breaking, python-codegen, node-codegen]
name: Proto Checks Pass
runs-on: ubuntu-latest
timeout-minutes: 5
@@ -163,4 +206,9 @@ jobs:
exit 1
fi
+ if [[ "${{ needs.node-codegen.result }}" != "success" && "${{ needs.node-codegen.result }}" != "skipped" ]]; then
+ echo "Node proto codegen staleness check failed."
+ exit 1
+ fi
+
echo "All proto checks passed."
diff --git a/nodejs/package.json b/nodejs/package.json
index 3bbbd64fceb8..260e113f1b76 100644
--- a/nodejs/package.json
+++ b/nodejs/package.json
@@ -50,7 +50,7 @@
"build:hogvm-node:dev": "pnpm --filter=@posthog/hogvm-node run build:dev",
"build:replay-anonymizer": "pnpm --filter=@posthog/replay-anonymizer package",
"build:replay-anonymizer:dev": "pnpm --filter=@posthog/replay-anonymizer run build:dev",
- "generate:personhog-proto": "cd ../proto && buf generate --template ../nodejs/buf.gen.yaml --path personhog/service --path personhog/types .",
+ "generate:personhog-proto": "cd ../proto && buf generate --template ../nodejs/buf.gen.yaml --path personhog/service --path personhog/types . && cd ../nodejs && eslint --fix src/common/generated/personhog && prettier --write src/common/generated/personhog",
"update-ai-costs": "ts-node src/ingestion/pipelines/ai/costs/scripts/update-ai-costs.ts",
"gen:ingestion-warning-types": "ts-node src/ingestion/common/scripts/generate-ingestion-warning-types.ts",
"sync-segment-icons": "DATABASE_URL=something ts-node src/cdp/segment/sync-segment-icons.ts",