You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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
The performance gains from #55583 meant that, when testing upgrades from 8.0 to 8.1, suddenly the app crashed and stopped evaluating due to the raised NotImplementedError in the parent class:
Which is what was causing things to raise, tests to fail, etc.
This indexer isn't strictly required (there's a fallback), so it feels appropriate to do a proper deprecation cycle and then remove this behavior in a later version.
Detail
This Pull Request catches the NotImplementedError in this method and instead reports the deprecation. When that happens, the indexer will fall back to the lookup, so they don't get the performance gains, but their app will continue to run until the deprecation is addressed.
I also added some clarity to the deprecations so people will know what to expect.
Checklist
Before submitting the PR make sure the following are checked:
This Pull Request is related to one change. Unrelated changes should be opened in separate PRs.
Commit message has a detailed description of what changed and why. If this PR fixes a related issue include it in the commit message. Ex: [Fix #issue-number]
Tests are added or updated if you fix a bug or add a feature.
CHANGELOG files are updated for the changed libraries if there is a behavior change or additional feature. Minor bug fixes and documentation changes should not be included. Note: no changelog is included because the notes from Optimize Active Job argument serialization by ~5xΒ #55583 feel sufficient to me
The performance gains from rails#55583 meant that, when testing upgrades from 8.0 to 8.1, suddenly the app crashed and stopped evaluating due to the raised NotImplemented error in the parent class. This indexer isn't strictly required (there's a fallback), so it feels appropriate to do a proper deprecation cycle and then remove this behavior in a later version.
that-jill
changed the title
Deprecate usage of custom ActiveJob serializers
Deprecate usage of custom ActiveJob serializers without public #klass methods
Sep 24, 2025
Do you know how the custom serializers that have issues currently work if they didn't implement the klass method ? Active Job expects this method to be implemented per the interface of ObjectSerializer.
The reason will be displayed to describe this comment to others. Learn more.
I think this makes sense. We don't want apps to crash over an opt-in performance optimization. Warning first, and then raising later when/if this feature is mandatory seems best, though I'm not sure we can avoid the array search for subclasses.
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.
Motivation / Background
The performance gains from #55583 meant that, when testing upgrades from 8.0 to 8.1, suddenly the app crashed and stopped evaluating due to the raised
NotImplementedError
in the parent class:index_serializers
checks if the class responds to:klass
but in the case of custom serializers, it will also do, even if it doesn't have an implemented method because it inherits from the ObjectSerializer, which raises the
NotImplementedError
.Which is what was causing things to raise, tests to fail, etc.
This indexer isn't strictly required (there's a fallback), so it feels appropriate to do a proper deprecation cycle and then remove this behavior in a later version.
Detail
This Pull Request catches the NotImplementedError in this method and instead reports the deprecation. When that happens, the indexer will fall back to the lookup, so they don't get the performance gains, but their app will continue to run until the deprecation is addressed.
I also added some clarity to the deprecations so people will know what to expect.
Checklist
Before submitting the PR make sure the following are checked:
[Fix #issue-number]