Skip to content

fix(pg-delta): normalize function body line endings#279

Open
pjpjq wants to merge 1 commit into
supabase:mainfrom
pjpjq:codex/normalize-function-line-endings-english
Open

fix(pg-delta): normalize function body line endings#279
pjpjq wants to merge 1 commit into
supabase:mainfrom
pjpjq:codex/normalize-function-line-endings-english

Conversation

@pjpjq

@pjpjq pjpjq commented Jun 9, 2026

Copy link
Copy Markdown

Summary

  • Normalize CRLF/LF differences in source_code, sql_body, and definition when building the procedure stable snapshot.
  • Reuse the same line-ending normalization for body-only non-alterable comparisons to avoid false CREATE OR REPLACE FUNCTION diffs.
  • Add regression coverage showing line-ending-only differences do not produce a diff while owner-only changes are still detected.

Fixes #242.
Replaces #276.

Tests

  • bun test packages/pg-delta/src/core/objects/procedure/procedure.diff.test.ts
  • cd packages/pg-delta && bun run check-types
  • cd packages/pg-delta && bun run format-and-lint
  • git diff --check origin/main...HEAD

@changeset-bot

changeset-bot Bot commented Jun 9, 2026

Copy link
Copy Markdown

⚠️ No Changeset found

Latest commit: 5f305ce

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

@avallete

avallete commented Jun 9, 2026

Copy link
Copy Markdown
Member

I think the issue with such approach is that the function itself might contain an actual "\r\n" in it, then I wonder how the normalization would go 🤔

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.

pg-delta treats CRLF vs LF inside function bodies as a schema diff

2 participants