Repository navigation
Conversation
Contributor
There was a problem hiding this comment.
🟢 Approval recommended
The changes align with the stated bugfixes/features and add extensive regression coverage, with only minor test-fixture completeness nits noted.
Pull request overview
Release v1.0.27 focuses on correctness fixes in schema diff/migration generation (routine ordering, moved extensions, view dependency tracking, identity-column alters, and connection credential handling), plus a significant testing and documentation reorganization enabled by introducing a library target.
Changes:
- Fixes multiple migration correctness bugs (issues #240–#243) and corrects PostgreSQL connection handling for URL-reserved passwords (issue #244) by switching to
PgConnectOptions. - Adds a
--guard-sql-routine-bodies/GUARD_SQL_ROUTINE_BODIESopt-in flag and documents routine ordering behavior. - Reorganizes tests (splits large core tests, adds integration tests, adds live-server smoke tests) and expands rustdoc coverage with CI doc builds.
File summaries
| File | Description |
|---|---|
| README.md | Documents new routine-ordering flag and behavior. |
| data/test/schema_a.sql | Adds fixtures for issues #241–#243. |
| data/test/schema_b.sql | Adds fixtures for issues #240–#243 and schema-moved extension TO-side. |
| data/test/README.md | Documents new/updated regression fixtures and CI assertions. |
| data/pgc.conf | Adds documented GUARD_SQL_ROUTINE_BODIES sample config key. |
| .github/workflows/rust.yml | Adds rustdoc check and new regression assertions for issues #242/#244. |
| app/Cargo.toml | Bumps version and adds a library target for integration tests/doctests. |
| app/Cargo.lock | Updates lockfile for v1.0.27. |
| app/src/lib.rs | Introduces public library entrypoint exporting modules. |
| app/src/main.rs | Switches binary to use the library and wires the new guard flag into Comparer. |
| app/src/config/core.rs | Adds guard_sql_routine_bodies parsing/plumbing + config parser docs/doctest. |
| app/src/config/dump_config.rs | Replaces URL construction with PgConnectOptions to preserve credentials literally. |
| app/src/config/grants_mode.rs | Adds module/docs/doctests; keeps parsing behavior. |
| app/src/config/mod.rs | Adds module-level documentation. |
| app/src/config/tests/core.rs | Adds unit tests for GUARD_SQL_ROUTINE_BODIES parsing. |
| app/src/config/tests/dump_config.rs | Updates tests to assert PgConnectOptions behavior and issue #244 regressions. |
| app/src/config/tests/grants_mode.rs | Adds focused tests for GrantsMode parsing. |
| app/src/utils/mod.rs | Adds module-level documentation. |
| app/src/utils/string_extensions.rs | Adds docs/doctests and moves tests into tests/ subdir. |
| app/src/utils/sql_normalize.rs | Moves tests into tests/ subdir. |
| app/src/utils/tests/string_extensions.rs | Adds tests for unquote_ident and string helpers. |
| app/src/dump/mod.rs | Adds module-level docs describing object module conventions. |
| app/src/dump/acl.rs | Adds docs/doctests; moves tests into tests/ subdir. |
| app/src/dump/cast.rs | Adds module docs; moves tests into tests/ subdir. |
| app/src/dump/collation.rs | Adds module docs; moves tests into tests/ subdir. |
| app/src/dump/column_dependent.rs | Adds module docs; moves tests into tests/ subdir. |
| app/src/dump/default_privilege.rs | Adds module docs; moves tests into tests/ subdir. |
| app/src/dump/event_trigger.rs | Adds module docs; moves tests into tests/ subdir. |
| app/src/dump/extension.rs | Adds module docs clarifying name-identity and relocatability caveat. |
| app/src/dump/fdw.rs | Adds module docs; moves tests into tests/ subdir. |
| app/src/dump/foreign_table.rs | Adds module docs; moves tests into tests/ subdir. |
| app/src/dump/operator.rs | Adds module docs; moves tests into tests/ subdir. |
| app/src/dump/pg_enum.rs | Adds module docs; moves tests into tests/ subdir. |
| app/src/dump/pg_type.rs | Adds module docs; moves tests into tests/ subdir. |
| app/src/dump/publication.rs | Adds module docs; moves tests into tests/ subdir. |
| app/src/dump/routine.rs | Adds module docs; moves tests into tests/ subdir. |
| app/src/dump/rule.rs | Adds module docs; moves tests into tests/ subdir. |
| app/src/dump/schema.rs | Adds module docs; moves tests into tests/ subdir. |
| app/src/dump/sequence.rs | Adds module docs; moves tests into tests/ subdir. |
| app/src/dump/statistic.rs | Adds module docs; moves tests into tests/ subdir. |
| app/src/dump/table.rs | Adds module docs; improves type-change detection reuse via TableColumn::type_differs. |
| app/src/dump/table_constraint.rs | Adds module docs; moves tests into tests/ subdir. |
| app/src/dump/table_index.rs | Adds module docs; moves tests into tests/ subdir. |
| app/src/dump/table_policy.rs | Adds module docs; moves tests into tests/ subdir. |
| app/src/dump/table_trigger.rs | Adds module docs; moves tests into tests/ subdir. |
| app/src/dump/text_search.rs | Adds module docs; moves tests into tests/ subdir. |
| app/src/dump/view.rs | Adds column_relation field (serde-defaulted) and documentation for column-level dependencies. |
| app/src/dump/tests/*.rs | Adds/moves many unit tests into per-module tests/ subdirectories. |
| app/src/comparer/mod.rs | Adds module-level documentation. |
| app/src/comparer/production.rs | Clarifies doc references; moves tests into tests/ subdir. |
| app/src/comparer/scanner.rs | Adds blank_comments_and_literals to prevent false routine deps (issue #240). |
| app/src/comparer/tests/core.rs | Splits large comparer test suite into submodules under tests/core/. |
| app/src/comparer/tests/core/helpers.rs | Adds shared fixture builders for comparer unit tests. |
| app/src/comparer/tests/core/production.rs | Adds production-output rewrite behavior tests. |
| app/src/comparer/tests/core/schemas_extensions.rs | Adds tests for schema/extension compare including issue #241 relocation behavior. |
| app/src/comparer/tests/scanner.rs | Adds unit tests for blank_comments_and_literals. |
| app/tests/clear_script.rs | Adds integration tests for clear-script ordering/idempotency behavior. |
| app/tests/compare_pipeline.rs | Adds end-to-end integration tests for the public compare pipeline. |
| app/tests/config_file.rs | Adds integration tests for pgc.conf parsing against shipped samples and fixtures. |
| app/tests/dump_file_format.rs | Adds integration tests for dump zip layout and backward-compatible deserialization. |
| app/tests/live_database.rs | Adds ignored-by-default live PostgreSQL smoke tests, including issue #244 authentication. |
Review details
Suppressed comments (1)
app/tests/config_file.rs:117
- After adding
GUARD_SQL_ROUTINE_BODIESto the config fixture, this test should also assert that it was parsed intoConfig(otherwise the fixture line could be ignored without failing this test).
- Files reviewed: 76/108 changed files
- Comments generated: 1
- Review effort level: Lite
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
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.
Fixes four migrations that did not do what they said - the routine ordering bug behind issue #240, with one opt-in flag for it, the schema-moved extension of issue #241, the materialized view rebuilt on an unrelated column change of issue #242, and the identity column dropped in the wrong order of issue #243 - and one class of password that could not be used to connect at all (issue #244). Beyond those this release reorganises the test suite, adds a library target and integration tests, and documents the crate. The dump gains one optional field, which older dumps may omit, and the generated SQL is unchanged for any schema none of the four migration bugs touched.
Bug fixes:
- Resolved issue #244 (a password containing characters that are reserved in a URL could not be used, and one kind of password was silently changed). Connection details were interpolated into a postgres://user:password@host:port/database string and handed back to sqlx to parse, so every reserved character in a credential was read as URL syntax rather than as data. A password containing #, / or ? ended the authority section early and the parser eventually read the port out of something that was not a number, reporting invalid port number - naming the one part of the connection that was never wrong, before any socket was opened. Worse and quieter, a password containing a valid percent-escape was decoded: pass%41word was sent as passAword, so the wrong password was accepted and the real one could not be used at all. The connection now goes through PgConnectOptions with the fields set individually, which sqlx passes to the wire protocol unaltered, and a port that is not a number is reported as a port instead of as a failed connection. The masked connection string in log output is unchanged.
Features:
- New --guard-sql-routine-bodies flag (config key GUARD_SQL_ROUTINE_BODIES), default false. When set, the migration opens with set check_function_bodies = false, so PostgreSQL does not resolve the names inside a routine body at CREATE time and a routine is created even if its callee is not there yet. A defensive net for the whole class of ordering problem above, since a text scan can only ever approximate what a body calls. The cost, and the reason it is opt-in, is that a genuine mistake in a routine body is no longer caught while the migration runs. The statement is SET rather than SET LOCAL so it also covers a production script's post-commit section; a migration with nothing to do withdraws it, so an empty diff is unchanged.
Internals:
- Added a library target (
app/src/lib.rs) exporting the four existing modules.main.rsis now a thin binary over it and holds only CLI parsing and command dispatch. A binary-only crate cannot have integration tests or run doctests, so this is what the two sections below are built on. The binary's behaviour, its flags and its output are unaffected.Tests:
- Unit tests moved out of the source directories:
src/<module>/<name>_tests.rsis nowsrc/<module>/tests/<name>.rs. They remain#[cfg(test)] #[path = ...] mod tests;children of the module they cover, so they still reach its private items; only the file layout changed.src/dump/no longer interleaves 27 test files with the 28 sources beside them.Documentation:
- Module-level documentation on all 36 modules.
dump/mod.rsdescribes the hash / get_script / get_drop_script / get_alter_script shape that nearly every object module repeats, and what adding a new object kind requires, so the individual module headers only carry what is specific to that kind.Tooling:
- CI gained a docs step running
cargo doc --no-deps --lib --document-private-itemsunderRUSTDOCFLAGS="-D warnings", so an unresolved link fails the build instead of degrading silently. Private items are included because pgc ships as a binary: most of what a contributor reads is private, and a broken link there is just as wrong.