4.2.0: Support Rails 8.1#203
Merged
Merged
Conversation
afeng-mdsol
commented
Jun 23, 2026
| `bundle exec rails generate the_policy_machine:accessible_objects_for_operations_function -f` | ||
| `bundle exec rails generate the_policy_machine:update_accessible_objects_filter_performance -f` | ||
| FileUtils.cp('../add_test_columns_migration.rb', './db/migrate/99999999999999_add_test_columns.rb') | ||
| FileUtils.cp('../add_test_columns_migration.rb', './db/migrate/20260624162522_add_test_columns.rb') |
Contributor
Author
There was a problem hiding this comment.
ActiveRecord::InvalidMigrationTimestampError: (ActiveRecord::InvalidMigrationTimestampError)
Invalid timestamp 99999999999999 for migration file: add_test_columns.
Timestamp must be in form YYYYMMDDHHMMSS, and less than 20260624162521.
when setting up the test db to run specs
afeng-mdsol
force-pushed
the
support_rails8
branch
from
June 23, 2026 19:30
8a20d62 to
87b0a33
Compare
afeng-mdsol
marked this pull request as ready for review
June 23, 2026 19:30
There was a problem hiding this comment.
Pull request overview
Updates the gem to be compatible with Rails/ActiveRecord 8.1 by removing/avoiding deprecated APIs, updating adapter behavior for changed return types, and documenting the release.
Changes:
- Updated ActiveRecord adapter internals (config lookup, serialization API usage, postgres detection) for Rails 8.1.
- Updated SQL sanitization calls in the PostgreSQL adapter and transitive-closure maintenance in the MySQL2 adapter for Rails 8.1 behavior.
- Bumped gem dependencies/version and added release notes + Backstage component metadata.
Reviewed changes
Copilot reviewed 9 out of 9 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| test/tasks/setup.rake | Updates test-app setup to copy a specific migration filename |
| spec/policy_machine_storage_adapters/active_record_spec.rb | Avoids deprecated ActiveRecord::Base.connection usage in a spec |
| policy_machine.gemspec | Bumps ActiveRecord/Rails dependency requirements |
| lib/policy_machine/version.rb | Version bump for the release |
| lib/policy_machine_storage_adapters/active_record/postgresql.rb | Replaces deprecated SQL sanitization helper usage |
| lib/policy_machine_storage_adapters/active_record/mysql2.rb | Removes deprecated attr_accessible and adjusts execute-result handling |
| lib/policy_machine_storage_adapters/active_record.rb | Removes legacy AR branches; updates serialization + postgres detection |
| factbook.yaml | Adds Backstage component metadata |
| CHANGELOG.md | Adds 4.2.0 release notes |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
etmilord-3ds
approved these changes
Jun 26, 2026
Comment on lines
-73
to
-75
| if ::ActiveRecord::Base.respond_to?(:connection_db_config) | ||
| ::ActiveRecord::Base.connection_db_config.configuration_hash | ||
| else |
There was a problem hiding this comment.
Just curious, why did this need to be changed?
There was a problem hiding this comment.
ActiveRecord::Base.connection_config was deprecated sometime after Rails 6.1.
rails/rails#38005
chchan-mdsol
approved these changes
Jun 29, 2026
wdutymdsol
reviewed
Jun 29, 2026
| @@ -1,3 +1,3 @@ | |||
| namespace :pm do | |||
| namespace :test do | |||
| desc 'setup necessary scaffoliding for running policy machine specs' | |||
wdutymdsol
approved these changes
Jun 29, 2026
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.
@mdsol/platform-scalability
policy_machine.gemspec:
Widened activerecord dependency from ~> 7.1 to ~> 8.1
Widened rails dev dependency from ~> 7.1 to ~> 8.1
Removed deprecated s.test_files accessor
active_record.rb:
db_config: Removed legacy code paths for ActiveRecord < 6.0 and == 6.0; now uses the standard configs_for(env_name:, name:) + configuration_hash API
connection_db_config: Removed connection_config fallback (removed in Rails 7.1)
serialize: Fixed to use coder: keyword argument (active_record_serialize store, coder: serializer) as required by Rails 8.0+ (positional serializer argument was removed)
postgres?: Changed from ::ActiveRecord::Base.connection.class.name check to ::ActiveRecord::Base.connection_db_config.adapter == 'postgresql' (avoids deprecated ActiveRecord::Base.connection call)
postgresql.rb:
Replaced 3 uses of deprecated sanitize_sql_for_conditions with sanitize_sql
mysql2.rb:
Removed attr_accessible (removed from Rails since 4.0)
Fixed remove_from_transitive_closure to use .rows.flatten instead of .to_a for connection.execute results (compatible with ActiveRecord::Result returned in Rails 8.1)
active_record_spec.rb:
Changed ActiveRecord::Base.connection.execute to avoid deprecated bare ActiveRecord::Base.connection call
version.rb: Bumped to 4.2.0
CHANGELOG.md: Documented all changes
Relates to: https://github.com/mdsol/dalton/pull/5755