Skip to content

fix: fill all PostgreSQL index and DDL feature coverage gaps - #39

Merged
vistart merged 6 commits into
release/v1.0.0.dev15from
fix/index-feature-coverage
Jun 1, 2026
Merged

vistart merged 6 commits into
release/v1.0.0.dev15from
fix/index-feature-coverage

Conversation

@vistart

@vistart vistart commented Jun 1, 2026

Copy link
Copy Markdown
Contributor

Description

This PR fills all remaining PostgreSQL index and DDL feature coverage gaps across protocols, mixins, expressions, and tests. All PostgreSQL-supported supports_*() methods now return correct values from their respective mixins, and the protocol conformance test suite covers all 54 PostgreSQL-specific protocol-mixin pairs.

Changes include:

Index DDL (8bfb608):

  • Add PostgresDropIndexExpression with CONCURRENTLY support (PG 18+)
  • Add PostgresAlterIndexExpression with all 8 ALTER INDEX action types
  • Add 7 IndexSupport protocol method overrides to PostgresIndexMixin
  • Add format_drop_index_statement and format_alter_index_statement to mixin
  • Add format_add_index_action/format_drop_index_action UnsupportedFeatureError stubs in dialect
  • 21 new test cases for all CREATE INDEX options, ALTER INDEX error paths, DROP INDEX CONCURRENTLY

Trigger & Index gap fill (7329e9f):

  • Add supports_trigger/supports_create_trigger/supports_drop_trigger to PostgresTriggerMixin
  • Add supports_create_index/supports_drop_index/supports_unique_index/supports_index_if_not_exists/supports_index_if_exists to PostgresIndexMixin
  • Add explicit fulltext method overrides returning False/UnsupportedFeatureError
  • Fix supports_index_if_not_exists version gate in dialect.py (PG 9.5+)

Table support (1ee5660):

  • Add supports_if_not_exists_table (PG 9.5+), supports_if_exists_table, supports_temporary_table, supports_table_partitioning (PG 10+), supports_table_tablespace to PostgresTableMixin
  • 8 test cases for all table feature detection methods

Test coverage (9bff787):

  • Add 10 unpaired extension protocol-mixin pairs to POSTGRES_PROTOCOL_MIXIN_PAIRS
  • All 54 PG-specific protocol-mixin pairs now covered in conformance tests

Type of change

  • feat: A new feature
  • test: Adding missing tests or correcting existing tests
  • fix: Bug fixes

Breaking Change

  • Yes
  • No

Testing

  • I have added new tests to cover my changes.
  • I have updated existing tests to reflect my changes.
  • All existing tests pass.

Test Plan:
Ran pytest tests/rhosocial/activerecord_postgres_test/feature/backend/postgres/ tests/rhosocial/activerecord_postgres_test/feature/backend/test_postgres_protocol_conformance.py - 517 passed.

Checklist

  • My code follows the project's code style guidelines.
  • I have performed a self-review of my own code.
  • My changes generate no new warnings.
  • I have added a Changelog fragment (changelog.d/<issue_number>.<type>.md).
  • I have verified that my changes do not introduce SQL injection vulnerabilities.
  • I have checked for potential performance regressions.

vistart added 4 commits June 1, 2026 21:40
- Add PostgresDropIndexExpression with CONCURRENTLY support (PG18+)
- Add PostgresAlterIndexExpression with all 8 ALTER INDEX action types
- Add PostgresIndexMixin protocol method overrides (7 methods)
- Add format_drop/alter_index_statement to PostgresIndexMixin
- Add format_add/drop_index_action UnsupportedFeatureError stubs in dialect
- Register 3 new expression/dialect pairs in protocol conformance tests
- Add 21 new test cases covering all CREATE INDEX options, ALTER INDEX
  error paths, DROP INDEX CONCURRENTLY, and WHERE expression protocol
- Add supports_trigger/supports_create_trigger/supports_drop_trigger
  to PostgresTriggerMixin (previously only in dialect.py)
- Add supports_create_index/supports_drop_index/supports_unique_index/
  supports_index_if_not_exists/supports_index_if_exists to PostgresIndexMixin
- Add explicit fulltext method overrides returning False/UnsupportedFeatureError
- Fix supports_index_if_not_exists version gate in dialect.py (PG 9.5+)
- Add corresponding unit tests for all new methods (16 new tests)
- All 489 related tests pass without regression
- Add supports_if_not_exists_table (PG 9.5+), supports_if_exists_table,
  supports_temporary_table, supports_table_partitioning (PG 10+),
  supports_table_tablespace to PostgresTableMixin
- Add version gates to dialect.py for if_not_exists_table and
  table_partitioning to match mixin
- Add 8 test cases for all table feature detection methods
- 425 related tests pass without regression
- Add 10 unpaired extension protocols to POSTGRES_PROTOCOL_MIXIN_PAIRS
  for forward/reverse coverage verification
- All 517 related tests pass without regression
@vistart vistart self-assigned this Jun 1, 2026
@vistart vistart added the bug Something isn't working label Jun 1, 2026
@codecov

codecov Bot commented Jun 1, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 70.44%. Comparing base (70b05ce) to head (108cb17).

Additional details and impacted files
@@                   Coverage Diff                    @@
##           release/v1.0.0.dev15      #39      +/-   ##
========================================================
+ Coverage                 69.29%   70.44%   +1.15%     
========================================================
  Files                       231      231              
  Lines                     10088    10234     +146     
  Branches                   1593     1613      +20     
========================================================
+ Hits                       6990     7209     +219     
+ Misses                     2569     2510      -59     
+ Partials                    529      515      -14     
Flag Coverage Δ
postgres-18 70.44% <100.00%> (+1.15%) ⬆️
python-3.14 70.44% <100.00%> (+1.15%) ⬆️
unittests 70.44% <100.00%> (+1.15%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

vistart added 2 commits June 1, 2026 22:50
- Add pragma: no cover to protocol ellipsis bodies and TYPE_CHECKING blocks
  (matching core project convention with per-line markers)
- Add direct mixin tests for PostgresIndexMixin, PostgresTableMixin,
  and PostgresTriggerMixin (not through PostgresDialect overrides)
- Add expression column, INCLUDE error paths, and unsupported ALTER INDEX
  action tests for index mixin
- Add trigger WITH condition expression test
- Add trigger with no-level (FOR EACH omitted) test
- All 5 files now at 100% statement and branch coverage
@sonarqubecloud

sonarqubecloud Bot commented Jun 1, 2026

Copy link
Copy Markdown

@vistart
vistart merged commit d0c9e5f into release/v1.0.0.dev15 Jun 1, 2026
15 checks passed
@vistart
vistart deleted the fix/index-feature-coverage branch June 4, 2026 05:22
@vistart vistart mentioned this pull request Jun 15, 2026
7 of 12 tasks
vistart added a commit that referenced this pull request Jun 15, 2026
* fix: fill all PostgreSQL index feature coverage gaps

- Add PostgresDropIndexExpression with CONCURRENTLY support (PG18+)
- Add PostgresAlterIndexExpression with all 8 ALTER INDEX action types
- Add PostgresIndexMixin protocol method overrides (7 methods)
- Add format_drop/alter_index_statement to PostgresIndexMixin
- Add format_add/drop_index_action UnsupportedFeatureError stubs in dialect
- Register 3 new expression/dialect pairs in protocol conformance tests
- Add 21 new test cases covering all CREATE INDEX options, ALTER INDEX
  error paths, DROP INDEX CONCURRENTLY, and WHERE expression protocol

* fix: complete remaining DDL feature gaps in trigger and index mixins

- Add supports_trigger/supports_create_trigger/supports_drop_trigger
  to PostgresTriggerMixin (previously only in dialect.py)
- Add supports_create_index/supports_drop_index/supports_unique_index/
  supports_index_if_not_exists/supports_index_if_exists to PostgresIndexMixin
- Add explicit fulltext method overrides returning False/UnsupportedFeatureError
- Fix supports_index_if_not_exists version gate in dialect.py (PG 9.5+)
- Add corresponding unit tests for all new methods (16 new tests)
- All 489 related tests pass without regression

* fix: add missing table feature methods to PostgresTableMixin

- Add supports_if_not_exists_table (PG 9.5+), supports_if_exists_table,
  supports_temporary_table, supports_table_partitioning (PG 10+),
  supports_table_tablespace to PostgresTableMixin
- Add version gates to dialect.py for if_not_exists_table and
  table_partitioning to match mixin
- Add 8 test cases for all table feature detection methods
- 425 related tests pass without regression

* test: add 10 missing extension protocol-mixin pairs to conformance tests

- Add 10 unpaired extension protocols to POSTGRES_PROTOCOL_MIXIN_PAIRS
  for forward/reverse coverage verification
- All 517 related tests pass without regression

* chore: add changelog fragment for PR #39

* test: achieve 100% coverage on 5 target files

- Add pragma: no cover to protocol ellipsis bodies and TYPE_CHECKING blocks
  (matching core project convention with per-line markers)
- Add direct mixin tests for PostgresIndexMixin, PostgresTableMixin,
  and PostgresTriggerMixin (not through PostgresDialect overrides)
- Add expression column, INCLUDE error paths, and unsupported ALTER INDEX
  action tests for index mixin
- Add trigger WITH condition expression test
- Add trigger with no-level (FOR EACH omitted) test
- All 5 files now at 100% statement and branch coverage
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant