Skip to content

fix(ci): typecheck auto-synced Supabase types before pushing to main - #2888

Draft
posthog-eu[bot] wants to merge 1 commit into
mainfrom
posthog-self-driving/fixci-typecheck-auto-synced-supabase-177955
Draft

fix(ci): typecheck auto-synced Supabase types before pushing to main#2888
posthog-eu[bot] wants to merge 1 commit into
mainfrom
posthog-self-driving/fixci-typecheck-auto-synced-supabase-177955

Conversation

@posthog-eu

@posthog-eu posthog-eu Bot commented Aug 6, 2026

Copy link
Copy Markdown

Summary

  • The sync_schema_types job regenerates Supabase types from prod and pushed them straight to main with [skip ci] and no typecheck — so drift that doesn't compile lands unverified and reddens main for the next contributor (who eats a lint/typecheck failure they didn't cause).
  • Prod is often behind local migrations, so a regeneration can drop columns the backend still references. This has rewritten the devices types region on ≥5 occasions since March; one (454a345cc) broke bun typecheck on plain main and needed a reactive cleanup PR (fix(types): restore device country code #2659).
  • No user impact ([skip ci] also means no deploy fires) — the cost is entirely on engineers blocked by a red main.

Fix — gate the job on its own output:

+      - name: Install dependencies
+        run: bun install --frozen-lockfile
       - name: Sync generated schema and types
         ...
           BRANCH=main bun types
           ...drift check...
+          # Verify the regenerated types still compile against the backend
+          bun typecheck
           git add ...
-          git commit -m "chore(auto-sync): update supabase schema and generated types [skip ci]"
+          git commit -m "chore(auto-sync): update supabase schema and generated types"
  • Runs bun typecheck only when drift is detected, before the commit — the default bash -eo pipefail shell fails the job (and skips the push) when the types don't compile.
  • Adds bun install --frozen-lockfile because typecheck needs deps.
  • Drops [skip ci]: the commit is now verified in-job before it lands.

Note

tests.yml uses branches-ignore: [main, development] for push, so it does not run on a direct push to main. The reliable protection is therefore the in-job typecheck gate, not the [skip ci] removal. Dropping the tag newly triggers only codspeed.yml (push-to-main benchmarks) on the auto-sync commit; it does not re-trigger this workflow (all jobs already skip chore(auto-sync): commits) and no deploy fires (build_and_deploy.yml runs on tags only).

This does not fix the underlying drift (prod schema behind local migrations) — it stops that drift from landing unverified.

Test plan

  • CI-only change; verify by triggering a migration change on main and confirming the job fails rather than pushing when regenerated types don't compile.
  • YAML parses and job structure is unchanged apart from the added step and typecheck.

Screenshots

N/A — CI workflow change.

Checklist

  • My code follows the code style of this project and passes
    bun run lint:backend && bun run lint.
  • My change requires a change to the documentation.
  • I have updated the documentation
    accordingly.
  • My change has adequate E2E test coverage.
  • I have tested my code manually, and I have provided steps how to reproduce
    my tests

Created with PostHog Desktop from this inbox report.


View with [code]smith Autofix with [code]smith
Need help on this PR? Tag @codesmith-bot with what you need. Autofix is disabled.

Review in cubic

The sync_schema_types job regenerated the generated Supabase types from the
prod project and pushed them straight to main with [skip ci] and no
verification. Because prod is often behind local migrations, a regeneration
can drop columns the backend still references, breaking `bun typecheck` on
plain main and blocking the next contributor's CI.

Gate the job on its own output: install deps and run `bun typecheck` after
`bun schemas` / `bun types` and before the commit, so drift that doesn't
compile fails the job instead of landing. Drop the [skip ci] tag now that the
commit is verified before it lands.

Generated-By: PostHog Code
Task-Id: 579264d3-898f-4371-af17-ca71aa62de32
@sonarqubecloud

sonarqubecloud Bot commented Aug 6, 2026

Copy link
Copy Markdown

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

0 participants