Skip to content

fix(postgrest): move override fixtures out of generated types, repair codegen - #2605

Merged
mandarini merged 5 commits into
masterfrom
fix/postgrest-types-codegen-drift
Aug 11, 2026
Merged

mandarini merged 5 commits into
masterfrom
fix/postgrest-types-codegen-drift

Conversation

@mandarini

@mandarini mandarini commented Aug 10, 2026 •

Copy link
Copy Markdown
Contributor

Moves the hand-written scalar_computed_* fixtures out of the machine-generated types.generated.ts into types.override.ts and regenerates the file, which also picks up echo_bigint_as_text and extract_jsonb_bigint_as_text (added to the test schema in #2245 but never regenerated). Repairs codegen:postgrest, which had been failing for everyone since pnpm 11 stopped rewriting the cwd to the nearest package directory: the relative --workdir test resolved to test/test, so every run died with chdir test: no such file or directory, locally and in CI alike.

Re-enables the codegen sync check, which was gated on packages/core/postgrest-js/test/db/, a path deleted when the tests moved to the Supabase CLI, so it never ran on any PR. It now watches test/supabase/ plus the root package.json, since the pinned CLI version selects the postgres-meta image that performs the introspection. Also converts the two scalar computed field tests to type-only assertions (they were awaiting a request to a function that does not exist, then never asserting on the response) and drops the function-name as any casts in rpc.test.ts that the regenerated types make unnecessary.

Verified with two consecutive regens producing byte-identical output, so the git diff --exit-code gate is stable rather than flaky, plus tstyche at 29/29 files and the postgrest-js integration suite at 350 passing tests.

@github-actions github-actions Bot added the postgrest-js Related to the postgrest-js library. label Aug 10, 2026
@coderabbitai

coderabbitai Bot commented Aug 10, 2026 •

Copy link
Copy Markdown

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: af5ff6bc-5a56-4bd5-8447-7e47184ba738

📥 Commits

Reviewing files that changed from the base of the PR and between 73f7a13 and 913bb67.

📒 Files selected for processing (1)
  • .github/workflows/ci-core.yml
🚧 Files skipped from review as they are similar to previous changes (1)
  • .github/workflows/ci-core.yml

📝 Walkthrough

Summary by CodeRabbit

  • Bug Fixes

    • Improved PostgREST type generation checks for schema and CLI version changes.
    • Added clearer failures when type generation cannot complete.
    • Fixed type generation across different working-directory configurations.
  • Tests

    • Strengthened type coverage for scalar computed fields, computed-function results, and bigint RPC calls.
    • Improved validation of result nullability and inferred JSON data types.

Walkthrough

The PostgREST test types now define scalar computed-function fixtures for non-nullable numbers and string[] results. Related tests validate query types without live requests and remove unnecessary RPC any casts. The codegen script uses an absolute Supabase CLI working directory. The package command separates generation failures from generated-file drift. CI now detects changes to the test schema and package.json and fails when base-ref operations fail.

Sequence Diagram(s)

sequenceDiagram
  participant CI
  participant PackageScript
  participant Generator
  participant SupabaseCLI
  CI->>PackageScript: Run codegen:check:postgrest
  PackageScript->>Generator: Generate PostgREST types
  Generator->>SupabaseCLI: Use absolute TEST_DIR for CLI workdir
  SupabaseCLI-->>Generator: Generated types or error
  Generator-->>PackageScript: Generation result
  PackageScript->>PackageScript: Check generated-file drift
  PackageScript-->>CI: Report success, drift, or generation failure
Loading

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@pkg-pr-new

pkg-pr-new Bot commented Aug 10, 2026 •

Copy link
Copy Markdown

Open in StackBlitz

@supabase/auth-js

npm i https://pkg.pr.new/@supabase/auth-js@2605

@supabase/functions-js

npm i https://pkg.pr.new/@supabase/functions-js@2605

@supabase/postgrest-js

npm i https://pkg.pr.new/@supabase/postgrest-js@2605

@supabase/realtime-js

npm i https://pkg.pr.new/@supabase/realtime-js@2605

@supabase/storage-js

npm i https://pkg.pr.new/@supabase/storage-js@2605

@supabase/supabase-js

npm i https://pkg.pr.new/@supabase/supabase-js@2605

commit: 913bb67

@mandarini mandarini self-assigned this Aug 10, 2026
@coveralls

coveralls commented Aug 10, 2026 •

Copy link
Copy Markdown

Coverage Status

coverage: 81.564% (+3.9%) from 77.684% — fix/postgrest-types-codegen-drift into master

@mandarini mandarini added the do-not-merge Do not merge this PR. label Aug 10, 2026
@mandarini
mandarini marked this pull request as ready for review August 10, 2026 14:32
@mandarini
mandarini requested review from a team as code owners August 10, 2026 14:32
@mandarini mandarini changed the title fix(postgrest): types codegen drift fix(postgrest): move override fixtures out of generated types, repair codegen Aug 10, 2026
spydon
spydon previously approved these changes Aug 10, 2026

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 2

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In @.github/workflows/ci-core.yml:
- Around line 472-473: Update the changed-files check in the workflow step
around the git diff pipeline to fail closed: remove the suppressed git diff
error, explicitly validate that origin/${BASE_REF} is fetched and that the base
comparison succeeds before matching paths, and make any fetch or diff failure
fail the job instead of setting changed=false and skipping
codegen:check:postgrest.

In `@packages/core/postgrest-js/test/embeded_functions_join.test.ts`:
- Line 1444: Remove the unassigned result declarations in the affected test
cases and replace them with type-only assertions that validate the inferred
query data type without creating runtime variables. Apply this to both
occurrences near the embeded functions join tests while preserving the existing
type expectation.
🪄 Autofix

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: 7f486a9b-0cac-4866-aa83-ec688d3b5711

📥 Commits

Reviewing files that changed from the base of the PR and between 586dee3 and 603a20a.

⛔ Files ignored due to path filters (1)
  • packages/core/postgrest-js/test/types.generated.ts is excluded by !**/*.generated.*
📒 Files selected for processing (6)
  • .github/workflows/ci-core.yml
  • package.json
  • packages/core/postgrest-js/test/embeded_functions_join.test.ts
  • packages/core/postgrest-js/test/rpc.test.ts
  • packages/core/postgrest-js/test/types.override.ts
  • scripts/generate-postgrest-types.js

Comment thread .github/workflows/ci-core.yml Resolved
@mandarini mandarini removed the do-not-merge Do not merge this PR. label Aug 10, 2026

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In @.github/workflows/ci-core.yml:
- Around line 471-475: Update the target-selection logic used by the
CHANGED_FILES diff in the reusable CI workflow so push-triggered runs compare
HEAD against github.event.before rather than github.ref_name/base_ref, which may
resolve to the current commit. Preserve the existing base-ref comparison for
pull requests and ensure the selected target is fetched before evaluating
origin/${BASE_REF}...HEAD.
🪄 Autofix

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: 9ff1f43f-b751-4711-aee7-8edca7fe6245

📥 Commits

Reviewing files that changed from the base of the PR and between 603a20a and 73f7a13.

📒 Files selected for processing (1)
  • .github/workflows/ci-core.yml

Comment thread .github/workflows/ci-core.yml Resolved
@mandarini
mandarini requested a review from spydon August 11, 2026 09:53
mandarini pushed a commit to supabase/ssr that referenced this pull request Aug 24, 2026
This PR updates `@supabase/supabase-js` to v2.112.4.

**Source**: supabase-js-stable-release

---

## Release Notes

## v2.112.4

## 2.112.4 (2026-08-24)

### 🩹 Fixes

- **auth:** convert stolen-lock AbortError when acquireTimeout is 0
([#2616](supabase/supabase-js#2616))
- **auth:** warn on deprecated lock option and prevent unhandled refresh
rejection ([#2627](supabase/supabase-js#2627))
- **postgrest:** move override fixtures out of generated types, repair
codegen ([#2605](supabase/supabase-js#2605))
- **realtime:** respect custom logger for send() REST fallback warning
([#2612](supabase/supabase-js#2612))

### ❤️ Thank You

- Katerina Skroumpelou @mandarini
- mmustafasenoglu @mmustafasenoglu

This PR was created automatically.

Co-authored-by: supabase-workflow-trigger[bot] <266661614+supabase-workflow-trigger[bot]@users.noreply.github.com>
mandarini added a commit to supabase/supabase that referenced this pull request Aug 25, 2026
This PR updates @supabase/*-js libraries to version 2.112.4.

**Source**: manual

**Changes**:
- Updated @supabase/supabase-js to 2.112.4
- Updated @supabase/auth-js to 2.112.4
- Updated @supabase/realtime-js to 2.112.4
- Updated @supabase/postgest-js to 2.112.4
- Refreshed pnpm-lock.yaml

---

## Release Notes

## v2.112.4

## 2.112.4 (2026-08-24)

### 🩹 Fixes

- **auth:** convert stolen-lock AbortError when acquireTimeout is 0
([#2616](supabase/supabase-js#2616))
- **auth:** warn on deprecated lock option and prevent unhandled refresh
rejection ([#2627](supabase/supabase-js#2627))
- **postgrest:** move override fixtures out of generated types, repair
codegen ([#2605](supabase/supabase-js#2605))
- **realtime:** respect custom logger for send() REST fallback warning
([#2612](supabase/supabase-js#2612))

### ❤️ Thank You

- Katerina Skroumpelou @mandarini
- mmustafasenoglu @mmustafasenoglu

This PR was created automatically.

Co-authored-by: mandarini <6603745+mandarini@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

postgrest-js Related to the postgrest-js library.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants