Skip to content

Add missing 5.1 deprecation entries to rails-51-patterns.yml #85

@JuanVqz

Description

@JuanVqz

Problem

rails-upgrade/detection-scripts/patterns/rails-51-patterns.yml covers the removals that landed at Rails 5.1 (e.g. *_filter, redirect_to :back, render :text, use_transactional_fixtures) — all 13 entries are correctly classified breaking after the kind rollout in #59.

The file does not cover the new deprecations introduced at 5.1. Surfacing those is the right place to flag them: each one is the upstream warning that becomes a removal in a later version's patterns file. Without 5.1 deprecation entries, an app upgrading 5.0 → 5.1 has no early-warning hooks for things like ActionDispatch::ParamsParser::ParseError, Duration implicit coercion, or :quoted_id overrides — all of which start warning at 5.1 and bite later.

The same scoping bias may exist in other version files; this issue narrows scope to 5.1 specifically. Other versions can get sibling issues if confirmed.

Proposed entries (kind: deprecation)

Sourced from rails/rails v5.1.0 CHANGELOGs across actionpack, activerecord, activesupport, railties.

High-impact (typical apps)

  • ActionDispatch::ParamsParser::ParseError → use ActionDispatch::Http::Parameters::ParseError. (actionpack/CHANGELOG.md)
  • ActiveSupport::Duration implicit coercion to seconds in arithmetic with Numeric. (activesupport/CHANGELOG.md)
  • String :if / :unless conditions on set_callback / skip_callback. (activesupport/CHANGELOG.md.) Note: model-callback variant is already in rails-52-patterns.yml as CALLBACK_STRING_CONDITIONS; this is the lower-level set_callback deprecation that warns from 5.1.
  • ActiveSupport.halt_callback_chains_on_return_false — deprecated in 5.1, removed in 5.2. (activesupport/CHANGELOG.md.) The 5.2 removal is already in rails-52-patterns.yml (HALT_CALLBACK_CHAINS_ON_RETURN_FALSE, kind: breaking after PR Classify kind: for rails-52-patterns.yml (#60) #77's flip); the 5.1 deprecation warning is missing here.
  • config.action_controller.raise_on_unfiltered_parameters — already a no-op at 5.1, deprecated formally. (actionpack/CHANGELOG.md.)

AR-specific (apps that touch internals)

  • #quoted_id in quoting — deprecated 5.1, removed 5.2. (activerecord/CHANGELOG.md.) The 5.2 removal is in rails-52-patterns.yml (QUOTED_ID_METHOD, kind: breaking); the 5.1 deprecation warning is missing.
  • Locking records with unpersisted changes (#lock! on dirty record) — deprecated 5.1, raises in 5.2. (activerecord/CHANGELOG.md.) The 5.2 break is in rails-52-patterns.yml (LOCK_BANG_UNPERSISTED, kind: breaking); the 5.1 deprecation warning is missing.
  • Migrator.schema_migrations_table_name (activerecord)
  • supports_migrations? on connection adapters (activerecord; gem-targeted)
  • supports_primary_key? on connection adapters (activerecord; gem-targeted)
  • ColumnDumper#migration_keys (activerecord; gem-targeted)
  • :default arg to index_name_exists? (activerecord)

Per-entry shape

Each new entry follows the existing schema in rails-51-patterns.yml:

- name: "..."
  kind: "deprecation"
  pattern: "..."
  exclude: "..."
  search_paths:
    - "..."
  explanation: "..."
  fix: "..."
  variable_name: "..."

Test plan

  • Each new entry has a regex that compiles and a sensible search-paths list
  • Cross-checked against the 5.1.0 CHANGELOG and (where applicable) the source location of the ActiveSupport::Deprecation.warn call
  • bin/validate-patterns rails-upgrade/detection-scripts/patterns/rails-51-patterns.yml passes
  • bin/validate-patterns (all files) passes

Rationale for the gap

The original bulk import scoped each rails-XY-patterns.yml to "things that change at this hop's removal cycle" rather than "things the user should know about at this hop, including new deprecations". Adding deprecation entries at the version where the warning is introduced lets the detection workflow give earlier signal — users see kind: deprecation at 5.1 instead of being surprised by kind: breaking at 5.2.

Out of scope

  • Other version files (5.0, 5.2, 6.0, 6.1, 7.0, 7.1, 7.2, 8.0, 8.1) — likely have the same gap. Consider sibling issues if confirmed.
  • Reclassifying or modifying any existing entry in rails-51-patterns.yml.
  • Renaming the top-level breaking_changes: key — that's tracked in Rename breaking_changes: → upgrade_findings: across repo #68.

References

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions