Skip to content

[verify] #268 test fails without fix (do not merge)#269

Closed
yahonda wants to merge 1 commit intorsim:masterfrom
yahonda:verify-issue-234-test-fails
Closed

[verify] #268 test fails without fix (do not merge)#269
yahonda wants to merge 1 commit intorsim:masterfrom
yahonda:verify-issue-234-test-fails

Conversation

@yahonda
Copy link
Copy Markdown
Collaborator

@yahonda yahonda commented Apr 14, 2026

Do not merge. Temporary draft PR to confirm that the regression test added in #268 actually catches the bug from #234.

This branch contains only the test from #268 (without the fix in lib/plsql/schema.rb). Expectation:

  • test_gemfiles matrix entries for AR 7.0 / 7.1 should fail (they hit the deprecation warning).
  • AR 5.x / 6.x entries should skip (no ActiveRecord.default_timezone=).
  • AR 7.2 likely fails (still has the deprecated accessor); AR 8.0 passes (per-class accessor removed).

Once observed, this PR will be closed.

Capture deprecation warnings emitted while resolving
plsql.default_timezone with `activerecord_class` set, and assert that
no warning mentioning `default_timezone` was raised.

The test_gemfiles workflow exercises every supported ActiveRecord
version (5.0 through 8.0), so this test will catch any future
regression that re-introduces a call to the deprecated per-class
`default_timezone` accessor on AR 7.0/7.1.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@yahonda yahonda marked this pull request as ready for review April 14, 2026 00:54
@yahonda
Copy link
Copy Markdown
Collaborator Author

yahonda commented Apr 14, 2026

Verified — AR 7.0 fails on the new test in schema_spec.rb:221 with the exact deprecation message from #234. The test correctly catches the bug. Closing without merging.

@yahonda yahonda closed this Apr 14, 2026
@yahonda yahonda deleted the verify-issue-234-test-fails branch April 14, 2026 01:03
yahonda added a commit to yahonda/ruby-plsql that referenced this pull request Apr 14, 2026
Calling `ar_class.default_timezone` on Rails 7.0.x prints

  DEPRECATION WARNING: ActiveRecord::Base.default_timezone is
  deprecated and will be removed in Rails 7.1. Use
  ActiveRecord.default_timezone instead.

even though both accessors return the same value. The per-class
accessor was introduced as a deprecated proxy in Rails 7.0
(rails/rails@c3f43075a3) and removed entirely in Rails 7.1
(rails/rails@96c9db1b48), so the warning only fires on Rails 7.0.x.

Switch the order in PLSQL::Schema#default_timezone so that we ask the
module-level ActiveRecord.default_timezone first when it is available
(AR 7.0+) and only fall back to the per-class accessor on pre-7.0 AR
where the module-level one does not exist. This silences the warning
on Rails 7.0.x and is a no-op on Rails 7.1+ (where the per-class
accessor was already gone) and on Rails <= 6.x (where the module-level
accessor did not yet exist).

Add a regression test that captures deprecator output while resolving
plsql.default_timezone with `activerecord_class` set, and asserts that
no warning mentioning default_timezone was raised. The existing
ActiveRecord.default_timezone is captured before assignment and
restored from the ensure block alongside the deprecator behavior so
the test is order-independent.

Verified by rsim#269 / rsim#271 that the test fails on AR 7.0 without this fix
and passes on AR 7.1+ regardless.

Fixes rsim#234

References:
- rails/rails@c3f43075a3 (added the deprecated delegators in Rails 7.0)
- rails/rails@96c9db1b48 (removed them in Rails 7.1)

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
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.

1 participant