Skip to content

types.ts is stale: #703's moderation tables are missing, and regenerating locally deletes application_status #707

Closed

Description

@thinkclay

Two problems that block each other

1. types.ts does not contain #703's tables

core.content_reports and core.user_blocks exist in the database. They are absent from packages/supabase/types.ts, because #703 shipped their migrations without regenerating it.

That makes table-references-exist.test.ts fail on unmodified main:

core.content_reports: 2 reference(s), baseline 0 — at moderation.ts:221, moderation.ts:287
core.user_blocks: 4 reference(s), baseline 0 — at moderation.ts:350, moderation.ts:361, moderation.ts:403, moderation.ts:451

The routes are correct. The catalogue the test reads is stale.

2. pnpm supa:generate against a local database makes it worse

The obvious fix is to regenerate. Don't — not from a local stack without checking the diff first. Doing it here produces a 199-line diff that adds the three expected objects (content_reports, user_blocks, and the users_are_blocked view) and also deletes the application_status enum:

select count(*) from pg_type t join pg_namespace n on n.oid = t.typnamespace
where t.typname = 'application_status';
-- 0

The local database does not have that enum; the checked-in types.ts declares it. So the generator faithfully reports what it sees, and the result silently drops a type. That is local migration drift, and it means supa:generate is only safe from a database known to be current.

Interim state

Both references are listed in BASELINE_BROKEN with a comment explaining they are a types-staleness problem rather than broken references (landed alongside the #656/#657/#659 fixes). The list's invariant still holds: once types.ts is regenerated correctly, those entries go stale and the test will demand their removal.

Acceptance

  • types.ts contains core.content_reports, core.user_blocks and users_are_blocked
  • It still contains application_status with all eight values
  • The two entries are removed from BASELINE_BROKEN and the test passes
  • The local-drift cause is either fixed or recorded — supa:generate from a drifted database should not be able to delete a type silently

Worth considering

supa:generate writes straight over types.ts with no diff review. A guard that refuses a regeneration which removes a table, view or enum would have caught this before it reached anyone.

Activity

  1. added
    bug
    on Sep 2, 2026
  2. added 3 commits that reference this issue on Sep 2, 2026
  3. thinkclay commented on Sep 2, 2026

    @thinkclay
    ContributorAuthor

    Also affected, from the other direction: migration 350 in #708 creates core.user_feedback (moving it out of the unexposed logs schema, #665). That table is likewise absent from types.ts, so table-references-exist.test.ts flags the corrected route as broken.

    It is recorded in BASELINE_BROKEN with the same explanation rather than hand-edited into types.ts, for the reason above — regenerating from the drifted local database deletes application_status.

    So the regeneration this issue asks for should clear three entries, not two:

    Each will go stale the moment types are correct, and the test fails on stale entries — so nothing here can rot quietly.

  4. self-assigned this
    on Sep 9, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

bug

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions