Skip to content

v2.0: drop Rails < 7.1, reimplement sanitizes on top of normalizes#1

Merged
cmer merged 4 commits into
mainfrom
cmer/use-normalizes
Apr 27, 2026
Merged

v2.0: drop Rails < 7.1, reimplement sanitizes on top of normalizes#1
cmer merged 4 commits into
mainfrom
cmer/use-normalizes

Conversation

@cmer

@cmer cmer commented Apr 27, 2026

Copy link
Copy Markdown
Owner

Summary

  • Bumps minimum Rails to 7.1 and minimum Ruby to 3.2; drops Rails 6.x and 7.0 from the test matrix and adds Rails 7.1 / 7.2 appraisals (Rails 8 already supported).
  • Reimplements the sanitizes macro on top of Rails 7.1's ActiveRecord::Base.normalizes. The DSL is byte-for-byte identical, but normalization now runs at attribute assignment time instead of before_save, which gives free where/find_by hash-condition normalization and lets validations see normalized values.
  • Documents the subtle behavior changes (read-after-write returns the normalized value, legacy rows are no longer silently rewritten on save — use record.normalize_attribute(:col) to migrate) in CHANGELOG and README, and adds 10 new specs covering assignment-time semantics, query normalization, the legacy-row migration path, idempotency, nil handling, in-place mutation, and validation timing.
  • Adds CLAUDE.md with project guidance (commands, architecture, changelog workflow).

Test plan

  • bundle exec rspec passes (13 examples, 0 failures)
  • bundle exec appraisal rspec passes on Rails 7.1, 7.2, and 8.0
  • CI green on the PR

🤖 Generated with Claude Code

cmer and others added 4 commits April 27, 2026 10:41
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
…DE.md

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Drop support for Rails 6.x and 7.0. Add Rails 7.1 and 7.2 to the
Appraisal test matrix. Remove the concurrent-ruby dev dependency
that was only needed for older Rails.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
The sanitizes DSL is unchanged, but each declared column is now registered
via Rails 7.1's normalizes API, so normalization runs at attribute
assignment time instead of in a before_save callback. This brings free
where/find_by hash-condition normalization, makes validations see
normalized values, and removes the silent self-heal of legacy rows on
save (use record.normalize_attribute(:col) to migrate).

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@cmer cmer merged commit 68d9e06 into main Apr 27, 2026
3 checks passed
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