Skip to content

Comments

refactor: simplify normalizer and remove formatter#111

Merged
tianzhou merged 1 commit intomainfrom
simplify
Oct 23, 2025
Merged

refactor: simplify normalizer and remove formatter#111
tianzhou merged 1 commit intomainfrom
simplify

Conversation

@tianzhou
Copy link
Contributor

No description provided.

Copilot AI review requested due to automatic review settings October 22, 2025 08:40
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR refactors the normalization logic to simplify view definition processing by consolidating the approach around a custom formatter. Since both desired and current states now come from database inspection (embedded-postgres), the PR removes legacy parser-specific code and focuses on minimal, formatter-based transformations.

Key changes:

  • Replaces AST-based normalization with a streamlined custom formatter approach
  • Removes unused functions for table qualifier removal and expression fingerprinting
  • Consolidates "= ANY (ARRAY[...])" to "IN (...)" conversion into the custom formatter

Reviewed Changes

Copilot reviewed 35 out of 36 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
testdata/diff/online/alter_constraint/* Updated test expectations to include explicit type casts (::pg_catalog.numeric) in constraint definitions
testdata/diff/online/add_constraint/* Updated test expectations to include explicit type casts in constraint definitions
testdata/diff/migrate/v*/plan.json Updated source fingerprint hashes to reflect changes in normalization output
testdata/diff/create_view/alter_view/* Updated view definition formatting including explicit type casts, parenthesized ORDER BY expressions, and adjusted whitespace
testdata/diff/create_view/add_view_coalesce/* Removed entire test case files (old.sql, new.sql, diff.sql, plan.* files)
testdata/diff/create_view/add_view_array_operators/* Removed entire test case files
testdata/diff/create_view/add_view/* Replaced employee_department_view test with array_operators_view and text_search_view tests
ir/normalize.go Major refactoring: removed legacy normalization functions, simplified view definition processing, consolidated formatter usage
ir/formatter.go Added newline formatting to CASE expressions for improved readability

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

@tianzhou tianzhou force-pushed the simplify branch 3 times, most recently from cea8369 to 611bf42 Compare October 23, 2025 05:12
@tianzhou tianzhou requested a review from Copilot October 23, 2025 05:20
@tianzhou tianzhou changed the title refactor: simplify normalization refactor: simplify formatter Oct 23, 2025
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

Copilot reviewed 6 out of 6 changed files in this pull request and generated 1 comment.


Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

@tianzhou tianzhou changed the title refactor: simplify formatter refactor: simplify normalizer and remove formatter Oct 23, 2025
@tianzhou tianzhou merged commit a7e7b50 into main Oct 23, 2025
2 checks passed
@tianzhou tianzhou deleted the simplify branch October 23, 2025 06:33
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.

1 participant