Repository navigation
ci(types): guard types.ts generation, and finish migration 350's move - #771
Merged
Merged
Conversation
Salvages the parts of #719 that are still true. That PR has been open since 2026-09-09, its issue (#707) closed on 09-10, and `main` has moved 28 commits past its base — so most of it is now either redundant or a regression, but the guard at its centre never landed and is still the only thing standing between this repo and a repeat of #707. **Taken** `scripts/generate-supabase-types.mjs` (blink-dev's, unchanged). `supabase gen types` reports what the database in front of it contains, so pointing it at a database behind the migrations silently deletes every object added since, straight over types.ts with no diff to review. The script refuses to run when the migration list and the applied set disagree, generates in memory, and refuses to write when a table, view, enum or function would disappear — `--allow-removals` for the deliberate case, like migration 344 dropping core.application_status. `supa:generate` and the supabase project.json target now point at it. Exercised rather than assumed: with no local stack it exits 1 with "Refusing to generate: could not read the migration list", and types.ts is untouched afterwards. The CI halves come too — api-tests.yml regenerates against a fresh `supabase start` and fails on a diff, and ci.yml adds `expo install --check` for the Expo SDK skew behind #683/#689. `feedback.router.ts` moves off `.schema('logs')`. That one is mine to own: migration 350 moved `user_feedback` to `core` with `ALTER TABLE ... SET SCHEMA` and I never swept for readers. These two lines are the last ones left on main — dormant, since `trpc` is not in deploy-functions.sh's deploy list any more, but wrong. **Not taken** `packages/supabase/types.ts` — redundant. main already carries content_reports, user_blocks, user_feedback, soft_skills_ratings and profile_import_data. `table-references-exist.test.ts` — this is the conflict, and taking it would go backwards. #719 restores four BASELINE_BROKEN entries that main has since resolved properly: soft_skills_ratings and profile_import_data exist as of migration 354 (#658), core.inquiries' routes were deleted (#476), and profile_completion_nudges' route was retired. The baseline is empty on main and fails on stale entries, so merging that file would fail the very test it edits. `package.json` was applied by hand for the same reason — #719's copy predates `lint:migrations` and would have deleted both the script and its call from `lint`. Only the `supa:generate` line is changed here. Co-Authored-By: blink-dev <[email protected]> Co-Authored-By: Claude Opus 5 <[email protected]>
The staleness check failed on its first run, and it was the check that was
wrong, not types.ts. Every difference was in `storage`:
+ versioning_status: string
+ archived_at: string | null
+ is_delete_marker: boolean
+ is_versioned: boolean
Supabase introspects `storage`, `auth` and `realtime` from whichever
postgres-meta image the CLI pulls — v0.98.0 on that runner — so those schemas
move when the platform ships, not when a migration lands. Regenerating would
not have fixed it, and it would have failed again on the next image bump. A
check that fails for something nobody can act on is one people learn to skip.
`scripts/types-owned-schemas.mjs` slices a generated file down to `public`,
`core`, `community`, `onet` and `logs` — the schemas
packages/supabase/migrations is responsible for — and the workflow compares
those slices instead of the whole file.
Probed in both directions rather than assumed:
* adding a column to `core.jobs` in a copy → detected
* adding a column to `storage` in a copy → ignored
It also generates to /tmp now instead of redirecting over types.ts, so a failed
run no longer leaves a modified working tree behind — the previous version
would have, which is an unpleasant surprise for anyone running it locally.
Co-Authored-By: Claude Opus 5 <[email protected]>
Contributor
📊 Performance Benchmark Results |
6 of 16 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Salvages the parts of #719 that are still true. That PR has been open since
2026-09-09, its issue (#707) closed on 09-10, and
mainhas moved 28 commitspast its base — so most of it is now either redundant or a regression, but the
guard at its centre never landed and is still the only thing standing between
this repo and a repeat of #707.
Taken
scripts/generate-supabase-types.mjs(blink-dev's, unchanged).supabase gen typesreports what the database in front of it contains, so pointing it at adatabase behind the migrations silently deletes every object added since,
straight over types.ts with no diff to review. The script refuses to run when
the migration list and the applied set disagree, generates in memory, and
refuses to write when a table, view, enum or function would disappear —
--allow-removalsfor the deliberate case, like migration 344 droppingcore.application_status.
supa:generateand the supabase project.json targetnow point at it.
Exercised rather than assumed: with no local stack it exits 1 with "Refusing to
generate: could not read the migration list", and types.ts is untouched
afterwards.
The CI halves come too — api-tests.yml regenerates against a fresh
supabase startand fails on a diff, and ci.yml addsexpo install --checkfor the Expo SDK skew behind #683/#689.
feedback.router.tsmoves off.schema('logs'). That one is mine to own:migration 350 moved
user_feedbacktocorewithALTER TABLE ... SET SCHEMAand I never swept for readers. These two lines are the last ones left on main —
dormant, since
trpcis not in deploy-functions.sh's deploy list any more, butwrong.
Not taken
packages/supabase/types.ts— redundant. main already carries content_reports,user_blocks, user_feedback, soft_skills_ratings and profile_import_data.
table-references-exist.test.ts— this is the conflict, and taking it would gobackwards. #719 restores four BASELINE_BROKEN entries that main has since
resolved properly: soft_skills_ratings and profile_import_data exist as of
migration 354 (#658), core.inquiries' routes were deleted (#476), and
profile_completion_nudges' route was retired. The baseline is empty on main and
fails on stale entries, so merging that file would fail the very test it edits.
package.jsonwas applied by hand for the same reason — #719's copy predateslint:migrationsand would have deleted both the script and its call fromlint. Only thesupa:generateline is changed here.Co-Authored-By: blink-dev [email protected]
Supersedes #719.
🤖 Generated with Claude Code