Skip to content

238 refactoring - #239

Merged
nettrash merged 9 commits into
v1.0.27from
238-refactoring
Aug 3, 2026
Merged

238 refactoring#239
nettrash merged 9 commits into
v1.0.27from
238-refactoring

Conversation

@nettrash

@nettrash nettrash commented Aug 3, 2026

Copy link
Copy Markdown
Owner

Closes #238

@nettrash nettrash added this to the v1.0.27 milestone Aug 3, 2026
@nettrash nettrash self-assigned this Aug 3, 2026
Copilot AI review requested due to automatic review settings August 3, 2026 19:04

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

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 (closes #238) refactors the pgc crate layout to support a new library target, reorganizes unit tests into per-module tests/ subdirectories, adds an integration test suite under app/tests/, and substantially expands rustdoc documentation/doctests—while aiming to keep emitted SQL/CLI behavior unchanged.

Changes:

  • Added app/src/lib.rs and updated the binary (main.rs) to consume the library API.
  • Reorganized and expanded tests: moved unit tests under src/**/tests/ and added multiple integration test binaries under app/tests/.
  • Added/updated module-level rustdoc and enabled CI doc builds with -D warnings.

Reviewed changes

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

Show a summary per file
File Description
CHANGELOG Documents v1.0.27 refactor scope, including library target, test reorg, docs, and CI doc step.
.github/workflows/rust.yml Adds a CI docs step (cargo doc ... -D warnings) to fail on rustdoc warnings/unresolved links.
app/Cargo.toml Bumps version to 1.0.27 and adds a [lib] target.
app/Cargo.lock Updates lockfile for the 1.0.27 version bump.
app/src/lib.rs New library entry point exporting existing modules with crate-level docs and example.
app/src/main.rs Removes in-crate modules and switches CLI to use the pgc library modules.
app/src/utils/mod.rs Adds module-level docs for utils.
app/src/utils/string_extensions.rs Adds module docs and doctest examples; updates unit-test module path.
app/src/utils/sql_normalize.rs Updates unit-test module path to the new tests/ layout.
app/src/utils/tests/string_extensions.rs New unit tests for string extension helpers.
app/src/utils/tests/sql_normalize.rs New/relocated unit tests for SQL normalization.
app/src/config/mod.rs Adds module-level docs for config types and precedence rules.
app/src/config/core.rs Adds parser documentation/doctests; updates unit-test module path.
app/src/config/dump_config.rs Promotes comments to rustdoc with examples; updates unit-test module path.
app/src/config/grants_mode.rs Adds rustdoc with examples and default semantics; updates unit-test module path.
app/src/config/tests/core.rs New/relocated unit tests for config parsing.
app/src/config/tests/dump_config.rs New/relocated unit tests for dump connection string helpers.
app/src/config/tests/grants_mode.rs New/relocated unit tests for GrantsMode parsing.
app/src/dump/mod.rs Adds module-level docs describing the common object-module shape and extension points.
app/src/dump/core.rs Supports library/integration testing and doc examples; continues zip+JSON dump persistence.
app/src/dump/acl.rs Adds module docs and doctest examples; updates unit-test module path.
app/src/dump/cast.rs Adds module docs; updates unit-test module path.
app/src/dump/collation.rs Adds module docs; updates unit-test module path.
app/src/dump/column_dependent.rs Adds module docs; updates unit-test module path.
app/src/dump/default_privilege.rs Adds module docs; updates unit-test module path.
app/src/dump/event_trigger.rs Adds module docs; updates unit-test module path.
app/src/dump/extension.rs Adds module docs; updates unit-test module path.
app/src/dump/fdw.rs Adds module docs; updates unit-test module path.
app/src/dump/foreign_table.rs Adds module docs; updates unit-test module path.
app/src/dump/operator.rs Adds module docs; updates unit-test module path.
app/src/dump/pg_enum.rs Adds module docs; updates unit-test module path.
app/src/dump/pg_type.rs Adds module docs; updates unit-test module path.
app/src/dump/publication.rs Adds module docs; updates unit-test module path.
app/src/dump/routine.rs Adds module docs; updates unit-test module path.
app/src/dump/rule.rs Adds module docs; updates unit-test module path.
app/src/dump/schema.rs Adds module docs; updates unit-test module path.
app/src/dump/sequence.rs Adds module docs; updates unit-test module path.
app/src/dump/statistic.rs Adds module docs; updates unit-test module path.
app/src/dump/table.rs Adds module docs and extensive rustdoc field comments; updates unit-test module path.
app/src/dump/table_column.rs Adds module docs and field rustdoc; updates unit-test module path.
app/src/dump/table_constraint.rs Adds module docs and field rustdoc; updates unit-test module path.
app/src/dump/table_index.rs Adds module docs and field rustdoc; updates unit-test module path.
app/src/dump/table_policy.rs Adds module docs and field rustdoc; updates unit-test module path.
app/src/dump/table_trigger.rs Adds module docs and field rustdoc; updates unit-test module path.
app/src/dump/text_search.rs Adds module docs; updates unit-test module path.
app/src/dump/view.rs Adds module docs; promotes a comment to rustdoc; updates unit-test module path.
app/src/dump/tests/acl.rs New/relocated unit tests for ACL parsing and script generation.
app/src/dump/tests/cast.rs New/relocated unit tests for casts.
app/src/dump/tests/collation.rs New/relocated unit tests for collations.
app/src/dump/tests/column_dependent.rs New/relocated unit tests for column dependents and serde.
app/src/dump/tests/default_privilege.rs New/relocated unit tests for default privileges.
app/src/dump/tests/event_trigger.rs New/relocated unit tests for event triggers.
app/src/dump/tests/extension.rs New/relocated unit tests for extensions.
app/src/dump/tests/fdw.rs New/relocated unit tests for FDW objects.
app/src/dump/tests/foreign_table.rs New/relocated unit tests for foreign tables.
app/src/dump/tests/operator.rs New/relocated unit tests for operators.
app/src/dump/tests/pg_enum.rs New/relocated unit tests for enum label rows.
app/src/dump/tests/publication.rs New/relocated unit tests for logical replication objects.
app/src/dump/tests/rule.rs New/relocated unit tests for rewrite rules.
app/src/dump/tests/schema.rs New/relocated unit tests for schemas.
app/src/dump/tests/sequence.rs New/relocated unit tests for sequences and ALTER logic.
app/src/dump/tests/statistic.rs New/relocated unit tests for extended statistics.
app/src/dump/tests/table_policy.rs New/relocated unit tests for RLS policies.
app/src/dump/tests/text_search.rs New/relocated unit tests for text search objects.
app/src/comparer/mod.rs Adds module docs for comparer components and the private scanner.
app/src/comparer/core.rs Adds module/docs and doctests; updates unit-test module path.
app/src/comparer/production.rs Updates doc links/wording; updates unit-test module path.
app/src/comparer/scanner.rs Updates unit-test module path.
app/src/comparer/tests/core.rs New split test harness for comparer core tests.
app/src/comparer/tests/scanner.rs New/relocated scanner unit tests (string/comment/dollar-quote aware scanning).
app/src/comparer/tests/core/buffer_ordering.rs New comparer tests pinning post-buffer emission order.
app/src/comparer/tests/core/helpers.rs New shared fixtures for comparer core tests.
app/src/comparer/tests/core/matview_indexes.rs New tests covering materialized-view index behavior (issue #235).
app/src/comparer/tests/core/production.rs New tests for --output-for-production rewriting and post-commit section behavior.
app/src/comparer/tests/core/schemas_extensions.rs New tests for schema/extension comparison behavior.
app/src/comparer/tests/core/types.rs New tests for type/enum ordering and multirange handling.
app/tests/common/mod.rs New integration-test shared fixtures and scratch dir helper.
app/tests/clear_script.rs New integration tests for clear-script ordering and flags.
app/tests/compare_pipeline.rs New end-to-end integration tests for compare pipeline behaviors.
app/tests/config_file.rs New integration tests for pgc.conf parsing against real files and defaults.
app/tests/dump_file_format.rs New integration tests for zip dump format and backward-compatible deserialization.
app/tests/live_database.rs New ignored-by-default integration tests against a real PostgreSQL server.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread app/tests/compare_pipeline.rs
Copilot AI review requested due to automatic review settings August 3, 2026 19:23

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

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 66 out of 102 changed files in this pull request and generated no new comments.

Suppressed comments (3)

app/src/config/dump_config.rs:66

  • DumpConfig::get_connection_string() builds a PostgreSQL URL by string concatenation without percent-encoding. Because this string is passed directly to sqlx (see Dump::process calling .connect(...)), credentials containing URL-reserved characters like @, :, #, %, etc. will produce an invalid URL and fail to connect.
    pub fn get_connection_string(&self) -> String {
        format!(
            "postgres://{}:{}@{}:{}/{}?sslmode={}",
            self.user,
            self.password,
            self.host,
            self.port,
            self.database,
            if self.ssl { "require" } else { "disable" }
        )
    }

app/tests/live_database.rs:24

  • This comment claims the defaults match the pgc CLI, but the CLI defaults --user and --password to empty strings (see app/src/main.rs). Either update the wording or align the defaults so the helper stays accurate.
    app/src/config/dump_config.rs:22
  • The scheme field doc says masks like sche* are allowed, but schema selection is done via SQL SIMILAR TO (see dump::core::Dump::build_schemas_query). sche* in SIMILAR TO does not mean a prefix glob, so this is misleading for users/config authors.
    /// Schema name. Mask allowed. For example: sche*
    pub scheme: String,

@nettrash
nettrash merged commit a69355e into v1.0.27 Aug 3, 2026
17 checks passed
@nettrash
nettrash deleted the 238-refactoring branch August 3, 2026 19:31
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.

2 participants