fix: make JsonSerializable type alias read-only - #2249
Merged
Merged
Conversation
ty 0.0.83 rejects e.g. `list[str]` where `list[JsonSerializable]` is expected, because `list`/`dict` are invariant. Using `Sequence`/`Mapping` makes plain lists and dicts of JSON values acceptable again. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_018m46SvjMFWEVxC4RDuegPN
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #2249 +/- ##
==========================================
+ Coverage 93.70% 93.75% +0.05%
==========================================
Files 181 181
Lines 12878 12884 +6
==========================================
+ Hits 12067 12080 +13
+ Misses 811 804 -7
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
- `CookieParam` is now a closed TypedDict, so it is accepted as JSON-serializable. `_from_playwright` builds it from declared keys only (the dropped keys were already ignored by `SessionCookies.set`). - Redis `push_data` encodes items itself instead of going through `arrappend`, whose `JsonType` stub rejects read-only `Sequence`/`Mapping` values. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_018m46SvjMFWEVxC4RDuegPN
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_018m46SvjMFWEVxC4RDuegPN
Replace the untyped `execute_command` call with `arrappend` fed by `_to_redis_json`, which ty checks against redis' `list`-based JSON type. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_018m46SvjMFWEVxC4RDuegPN
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_018m46SvjMFWEVxC4RDuegPN
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_018m46SvjMFWEVxC4RDuegPN
redis' `JsonType` types arrays as `list` although `arrappend` only encodes them, so a documented cast is simpler than copying every item. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_018m46SvjMFWEVxC4RDuegPN
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_018m46SvjMFWEVxC4RDuegPN
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_018m46SvjMFWEVxC4RDuegPN
Pijukatel
marked this pull request as ready for review
September 24, 2026 07:00
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.
Bumping
tyto 0.0.83 (#2243) fails type-check: it rejects e.g.list[str]aslist[JsonSerializable]becauselist/dictare invariant.Fix:
JsonSerializableuses read-onlyMapping/Sequence;CookieParambecomes a closed TypedDict; one documented cast where redis'JsonTyperequireslist.The lock bumps only
tyto 0.0.83 so CI proves the fix; no new errors in apify-sdk-python either; cookie conversion output unchanged.