Add tests for Sidekiq::JobRecord parsing and display contracts#7028
Merged
mperham merged 1 commit intoJun 4, 2026
Merged
Conversation
Four cohesive tests covering substantive, user-facing JobRecord behavior
that the existing api_test only touched indirectly:
- A malformed Redis payload is rendered safely instead of raising:
item is {}, args expose the raw string, klass is nil.
- The encrypt flag redacts the final positional argument to
'[encrypted data]' in display_args.
- A Hash payload is passed through to #item without re-parsing.
- A JSON string payload is parsed into the item hash and exposes klass
and args.
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Summary
Four cohesive tests covering substantive
JobRecordbehavior that the existing API tests only touched indirectly through specific Queue/ScheduledSet flows:JobRecord.new("not-json", "default")doesn't raise;itemis{},argsexpose the raw string for Web UI display,klassisnil. This is the recovery path inJobRecord#parse'srescue JSON::ParserError.self["encrypt"]is truthy,display_argsredacts the final positional argument to"[encrypted data]"so secrets aren't surfaced to the Web UI.#itemwithout re-parsing (the common path fromQueue#eachetc.).klassandargs.Test-only, no
lib/changes.Testing
bundle exec rakeis green (standard + lint:herb + full suite).