Repository navigation
feat: parallel testing infrastructure and PostgreSQL backend improvements - #55
Merged
Merged
Conversation
Wire the testsuite database pool for postgres: register the pool reset handler, make scenario resolution pool-aware, install core and testsuite from the feature/parallel-testing branches, and run tests with -n 8.
…tration Without -p rhosocial.activerecord.testsuite.conftest the pooling hooks never run, so configure_pool_size stays 0 and every xdist worker falls back to the shared scenario database, racing on schema DDL. Load the plugin and guard the backend's own --scenarios option so both conftests coexist.
- Add named_expressions order_expressions (import-safe, prepare_orders_demo helper) - Add named_procedures order_workflow (OrderProcessingProcedure, max_concurrency=1 for psycopg single-connection concurrency limit) - Update bash scripts to reference real module paths instead of placeholders and full module paths for --list (package path returns no entries)
…IDENTITY ColumnConstraint(is_auto_increment=True) on PRIMARY_KEY was silently ignored, producing INTEGER PRIMARY KEY without auto-increment. PostgreSQL requires explicit GENERATED BY DEFAULT AS IDENTITY for auto-increment columns. The existing dialect_options['identity'] path is unaffected.
Dialect-level tests (no DB needed) verifying: 1. is_auto_increment=True produces correct auto-increment DDL keyword 2. All standard types (Integer/Text/Boolean/VarChar/Timestamp) compile 3. BooleanType + DEFAULT True is accepted 4. TimestampType maps to correct backend-specific type Prevents recurrence of bugs found in rbac cross-backend testing.
…nfig The backend read config.autocommit (requires_manual_commit and the auto-commit handlers in sync/async backends) to decide whether an explicit COMMIT is needed outside managed transactions, but the field did not exist on the dataclass, so passing autocommit=True raised a TypeError and the option was effectively dead. All other backends (mysql, sqlserver, clickhouse, snowflake, firebird) already declare it. Replace the defensive getattr() fallbacks with direct attribute access and add unit tests covering the default value, explicit assignment, conninfo exclusion, and requires_manual_commit() for both backends.
Regression tests for qualifier generation vs FROM context: plain field accessors, mixed/partial aliases, prebuilt-predicate reuse across contexts, explicit-alias joins, and an xfail sentinel documenting the accepted dynamic __table_name__ drift limitation. Companion to the python-activerecord fix that stops forcing table-name aliases on JOIN ranges.
Replace the R4 xfail sentinel with positive tests for the documented contract: after changing __table_name__ / __schema_name__, expressions built through field proxies pick up the new identity, and full DQL stays consistent across FROM / WHERE / SELECT. Seed an archive table and a second tenant-style schema so both switch directions assert real data.
Implements the optional setup_schema_fixtures capability: provisions ar_crm / ar_shop schemas with customers and orders tables (sync + async variants; DDL runs through a short-lived sync connection for async), tracks created schemas, and drops them in cleanup_after_test. Declares supports_schema() == True.
…tion in PostgresSchemaSupport
…ouble escaping hstore_to_array_operator passed the already-escaped '%%' operator to format_binary_operator, which escapes '%' again to '%%%%' (psycopg folds to '%%' instead of the expected '%'). Pass the raw '%' so format_binary_operator performs the single %->%% escape as the sole collection point.
…olumns PostgresListAdapter now parses JSON and PostgreSQL array literals via psycopg's array loader when reading list fields stored in TEXT columns, fixing the cross-backend round-trip exposed by stateflow tests.
…pe support - Add vector_search.py function module with pgvector search capabilities - Extend expression types with pgvector-related serialization - Add data_type_formatting mixin improvements - Add vector search and example compile test coverage
Codecov Report❌ Patch coverage is Additional details and impacted files@@ Coverage Diff @@
## release/v1.0.0.dev17 #55 +/- ##
========================================================
+ Coverage 74.67% 77.15% +2.47%
========================================================
Files 305 306 +1
Lines 12380 12530 +150
Branches 2001 2033 +32
========================================================
+ Hits 9245 9667 +422
+ Misses 2502 2172 -330
- Partials 633 691 +58
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
- extend PostgresListAdapter string parsing tests (JSON + PG array literal) - add HALFVEC/SPARSEVEC DDL format/parse and eq/hash coverage - cover vector_search edge cases (ip similarity, index options, invalid metric) - add _get_default_schema config-aware resolution tests for both introspection stacks - cover backend autocommit handler branches (sync + async, True/False) - add CLI --ssl mapping and --async flag tests - add CLI blackbox tests for introspect/status --async fix(cli): correct async introspect method names (remove _async suffix) The _handle_introspect_async path called nonexistent list_tables_async, list_views_async etc. Async introspector methods use the same names as sync (no _async suffix). Fixes broken async introspect branch.
CI runs against a fresh test_db where 'introspect tables' returns [], so assert json.loads(out) (truthy) fails. Assert the parsed JSON is a list instead, which holds whether or not tables exist.
The file name stateflow-cross-backend-issues.fixed.md does not follow the <issue_number>.<type>.md convention. Its content was already merged into the relevant fix commit.
|
vistart
added a commit
that referenced
this pull request
Sep 24, 2026
…ents (#55) * feat: parallel scenario tests with per-worker database pooling Wire the testsuite database pool for postgres: register the pool reset handler, make scenario resolution pool-aware, install core and testsuite from the feature/parallel-testing branches, and run tests with -n 8. * fix(test): load testsuite conftest plugin and guard --scenarios registration Without -p rhosocial.activerecord.testsuite.conftest the pooling hooks never run, so configure_pool_size stays 0 and every xdist worker falls back to the shared scenario database, racing on schema DDL. Load the plugin and guard the backend's own --scenarios option so both conftests coexist. * fix(test): apply pooled database names in backend and connection feature conftests * fix(test): apply pooled database names in worker connection params * fix(test): check for simultaneous double-hold instead of id uniqueness * fix(test): use a non-empty LSN range for pg_get_wal_records_info * feat: CLI async unification, --ssl param; postgres backend fixes * feat(postgres): add named expression/procedure example modules - Add named_expressions order_expressions (import-safe, prepare_orders_demo helper) - Add named_procedures order_workflow (OrderProcessingProcedure, max_concurrency=1 for psycopg single-connection concurrency limit) - Update bash scripts to reference real module paths instead of placeholders and full module paths for --list (package path returns no entries) * test(expression): add serialization round-trip coverage for PostgreSQL expressions * fix(dialect): translate is_auto_increment to GENERATED BY DEFAULT AS IDENTITY ColumnConstraint(is_auto_increment=True) on PRIMARY_KEY was silently ignored, producing INTEGER PRIMARY KEY without auto-increment. PostgreSQL requires explicit GENERATED BY DEFAULT AS IDENTITY for auto-increment columns. The existing dialect_options['identity'] path is unaffected. * test: add is_auto_increment/DDL regression tests Dialect-level tests (no DB needed) verifying: 1. is_auto_increment=True produces correct auto-increment DDL keyword 2. All standard types (Integer/Text/Boolean/VarChar/Timestamp) compile 3. BooleanType + DEFAULT True is accepted 4. TimestampType maps to correct backend-specific type Prevents recurrence of bugs found in rbac cross-backend testing. * fix(config): declare missing autocommit field on PostgresConnectionConfig The backend read config.autocommit (requires_manual_commit and the auto-commit handlers in sync/async backends) to decide whether an explicit COMMIT is needed outside managed transactions, but the field did not exist on the dataclass, so passing autocommit=True raised a TypeError and the option was effectively dead. All other backends (mysql, sqlserver, clickhouse, snowflake, firebird) already declare it. Replace the defensive getattr() fallbacks with direct attribute access and add unit tests covering the default value, explicit assignment, conninfo exclusion, and requires_manual_commit() for both backends. * test: cover column qualifier resolution under JOINs Regression tests for qualifier generation vs FROM context: plain field accessors, mixed/partial aliases, prebuilt-predicate reuse across contexts, explicit-alias joins, and an xfail sentinel documenting the accepted dynamic __table_name__ drift limitation. Companion to the python-activerecord fix that stops forcing table-name aliases on JOIN ranges. * test: cover dynamic table/schema names as supported usage Replace the R4 xfail sentinel with positive tests for the documented contract: after changing __table_name__ / __schema_name__, expressions built through field proxies pick up the new identity, and full DQL stays consistent across FROM / WHERE / SELECT. Seed an archive table and a second tenant-style schema so both switch directions assert real data. * feat(test): provide cross-schema fixtures for testsuite Implements the optional setup_schema_fixtures capability: provisions ar_crm / ar_shop schemas with customers and orders tables (sync + async variants; DDL runs through a short-lived sync connection for async), tracks created schemas, and drops them in cleanup_after_test. Declares supports_schema() == True. * feat(dialect): declare supports_schema capability and schema DDL tests * fix(protocols): declare supports_schema and supports_schema_authorization in PostgresSchemaSupport * test(provider): provision mixed default/non-default schema fixtures * test(adapters): offline adapter round-trip coverage for all types * docs: record stateflow cross-backend test issues (JSON/bool/RETURNING) * fix(hstore): pass raw % operator to format_binary_operator to avoid double escaping hstore_to_array_operator passed the already-escaped '%%' operator to format_binary_operator, which escapes '%' again to '%%%%' (psycopg folds to '%%' instead of the expected '%'). Pass the raw '%' so format_binary_operator performs the single %->%% escape as the sole collection point. * fix(adapters): parse array literals on read for list fields in TEXT columns PostgresListAdapter now parses JSON and PostgreSQL array literals via psycopg's array loader when reading list fields stored in TEXT columns, fixing the cross-backend round-trip exposed by stateflow tests. * test: add format_binary_operator % escaping and hstore operator tests * ci: update testsuite branch to release/v1.0.0.dev17 * ci: update rhosocial-activerecord branch to release/v1.0.0.dev30 * ci: update testsuite branch to release/v1.0.0.dev17 * feat(postgres): add pgvector vector_search function and expression type support - Add vector_search.py function module with pgvector search capabilities - Extend expression types with pgvector-related serialization - Add data_type_formatting mixin improvements - Add vector search and example compile test coverage * test: add targeted coverage for low-coverage patch areas - extend PostgresListAdapter string parsing tests (JSON + PG array literal) - add HALFVEC/SPARSEVEC DDL format/parse and eq/hash coverage - cover vector_search edge cases (ip similarity, index options, invalid metric) - add _get_default_schema config-aware resolution tests for both introspection stacks - cover backend autocommit handler branches (sync + async, True/False) - add CLI --ssl mapping and --async flag tests - add CLI blackbox tests for introspect/status --async fix(cli): correct async introspect method names (remove _async suffix) The _handle_introspect_async path called nonexistent list_tables_async, list_views_async etc. Async introspector methods use the same names as sync (no _async suffix). Fixes broken async introspect branch. * fix(test): tolerate empty table list in introspect blackbox tests CI runs against a fresh test_db where 'introspect tables' returns [], so assert json.loads(out) (truthy) fails. Assert the parsed JSON is a list instead, which holds whether or not tables exist. * chore: add changelog fragment for PR #55 * docs: remove non-standard changelog fragment The file name stateflow-cross-backend-issues.fixed.md does not follow the <issue_number>.<type>.md convention. Its content was already merged into the relevant fix commit.
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.



Description
This PR brings parallel testing support and coordinated PostgreSQL backend changes to the
release/v1.0.0.dev17line, aligned withpython-activerecordPR #118 (feature/parallel-testingmerged intorelease/v1.0.0.dev30).Issues: (add issue numbers here)
Type of change
feat: A new featuredocs: Documentation only changes (if related to the new feature)perf: A code change that improves performance (if part of the feature)test: Adding missing tests or correcting existing tests (for the new feature)chore: Changes to the build process or auxiliary tools and libraries such as documentation generation (if related to the new feature)ci: Changes to our CI configuration files and scripts (if related to the new feature)build: Changes that affect the build system or external dependencies (if related to the new feature)revert: Reverts a previous commitBreaking Change
Related Repositories/Packages
python-activerecord/release/v1.0.0.dev30— parallel testing infrastructure, expression/serialization, CLI unification (PR #118)python-activerecord-testsuite/release/v1.0.0.dev17— parallel-testing plugin, pool/serial mechanism, two-level execution classification, cross-schema fixtures, shared expression round-trip utils (PR test(transaction): add comprehensive transaction mode and advanced feature tests #20)Changes
CI / Infrastructure
rhosocial-activerecordbranch torelease/v1.0.0.dev30rhosocial-activerecord-testsuitebranch torelease/v1.0.0.dev17--scenariosregistrationpgvector / Vector Search
vector_searchfunction module with pgvector search capabilitiesPostgreSQL-Specific Features
supports_schemacapability and schema DDL testssupports_schemaandsupports_schema_authorizationinPostgresSchemaSupportis_auto_incrementtoGENERATED BY DEFAULT AS IDENTITYAdapter / Data Type Fixes
%operator toformat_binary_operatorto avoid double escapingis_auto_increment/DDL regression testsDialect / Expression
autocommitfield onPostgresConnectionConfig%escapingCLI
--sslparam; postgres backend fixespg_get_wal_records_infoTesting
Test Plan:
(Skipped local verification; CI will run full PostgreSQL matrix after PR creation.)
Checklist
README.md, etc.).changelog.d/<issue_number>.<type>.md).Additional Notes
Targets release:
release/v1.0.0.dev17