The Wire · Showcase
RAILS FIXES THREE CRITICAL QUERY BUGS OVERNIGHT
By RepoJournal · Filed · About Rails
Rails patched three separate issues where SQL queries were silently producing wrong results: `regroup` was duplicating columns, `distinct.sum` was dropping its deduplication flag in grouped queries, and `week_field` was emitting invalid ISO week strings at year boundaries.
The `regroup` method is documented as shorthand for `unscope(:group).group(fields)`, but it wasn't honoring the deduplication that `group` performs [1]. Call `regroup(:a, :a)` and you'd get a duplicate column; call `unscope(:group).group(:a, :a)` and it would deduplicate. That inconsistency is now fixed [2]. Separately, a grouped sum with distinct was silently dropping the DISTINCT keyword, causing queries to return numerically wrong totals [3]. The ungrouped path was setting the flag correctly; the grouped path wasn't. Both issues are merged. A third fix addresses `week_field` generating invalid week strings at ISO year boundaries [7]. On the bootsnap side, the YAML cache was mutating its own arguments during cache misses, replacing `symbolize_names` with an unsupported `symbolize_keys` parameter that would crash psych [4]. That's patched [5]. CacheStore session deletion also now honors the `drop` option correctly [6].
Action items
- → Pull the latest rails/rails main if you use grouped sums with distinct or regroup in production rails/rails [plan]
- → Update bootsnap if you're seeing ArgumentError on symbolize_names in YAML cache hits rails/bootsnap [immediate]
References
- [1] Deduplicate columns in `regroup` rails/rails
- [2] Merge pull request #57897 from 55728/fix-regroup-deduplication rails/rails
- [3] Apply DISTINCT to a grouped `sum` rails/rails
- [4] Fix `CompileCache::YAML` cache options mutation & `symbolize_{keys,names}` ↗ rails/bootsnap
- [5] Merge pull request #558 from viralpraxis/fix-yaml-cache-kwargs-mutation rails/bootsnap
- [6] Merge pull request #57870 from 55728/fix-cache-session-store-honor-drop rails/rails
- [7] Merge pull request #57890 from 55728/fix-week-field-iso-week-year rails/rails
FAQ
- What changed in Rails on June 29, 2026?
- Rails patched three separate issues where SQL queries were silently producing wrong results: `regroup` was duplicating columns, `distinct.sum` was dropping its deduplication flag in grouped queries, and `week_field` was emitting invalid ISO week strings at year boundaries.
- What should Rails teams do about it?
- Pull the latest rails/rails main if you use grouped sums with distinct or regroup in production • Update bootsnap if you're seeing ArgumentError on symbolize_names in YAML cache hits
- Which Rails repositories shipped on June 29, 2026?
- rails/rails, rails/bootsnap