fix(ios): Properly serialize arrays of Codable objects in widget config - #436
fix(ios): Properly serialize arrays of Codable objects in widget config#436galacticgibbon wants to merge 3 commits into
Conversation
|
Warning Review limit reached
Next review available in: 31 minutes Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available. How can I continue?After more reviews become available, a review can be triggered using the To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews. How do review limits work?CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability. For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window. Please refer docs for additional details. Review details⚙️ Run configurationConfiguration used: Repository UI Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (1)
WalkthroughInstalled-widget configuration now normalizes array-valued intent parameters element by element, preserving JSON-compatible values, encoding Codable values when possible, and converting unsupported values to strings. ChangesIntent Serialization
Estimated code review effort: 2 (Simple) | ~10 minutes 🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In
`@packages/home_widget/ios/home_widget/Sources/home_widget/HomeWidgetPlugin.swift`:
- Around line 316-348: Update the array-handling branch in the Codable array
conversion block to store each element as a JSON-compatible value rather than
requiring [String: Any]. Preserve encoded dictionaries, numbers, booleans,
strings, and nested arrays, and when an individual element cannot be encoded,
append only its string representation instead of converting the entire array or
discarding previously encoded elements.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Repository UI
Review profile: CHILL
Plan: Pro Plus
Run ID: 264c826f-e15e-4cb9-8243-c7f70a7eef31
📒 Files selected for processing (1)
packages/home_widget/ios/home_widget/Sources/home_widget/HomeWidgetPlugin.swift
…lement Codable encoding with string fallback
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In
`@packages/home_widget/ios/home_widget/Sources/home_widget/HomeWidgetPlugin.swift`:
- Around line 323-340: Update the array-element conversion switch in
HomeWidgetPlugin to explicitly recognize NSNull and return it unchanged,
matching the scalar parameter handling near the surrounding conversion logic.
Ensure null array entries do not fall through to the string interpolation
fallback and remain JSON null.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Repository UI
Review profile: CHILL
Plan: Pro Plus
Run ID: d6aa3041-51fd-412b-ae6a-71af2a352d54
📒 Files selected for processing (1)
packages/home_widget/ios/home_widget/Sources/home_widget/HomeWidgetPlugin.swift
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #436 +/- ##
=======================================
Coverage 96.30% 96.30%
=======================================
Files 57 57
Lines 3300 3300
=======================================
Hits 3178 3178
Misses 122 122
Flags with carried forward coverage won't be shown. Click here to find out more. 🚀 New features to boost your workflow:
|
Description
Supersedes #377, rebased onto current
mainand now containing only the iOS fix — the unrelated Android change has been split out into #435 with its own motivation, as requested there.Fixes a serialization bug in
HomeWidgetPlugin.swiftwhere arrays ofCodableobjects (e.g.[EntryTypeEntity]) were not properly encoded when extracting widget configuration viagetInstalledWidgets(). The generic array case matched before the Codable-aware case, so elements came through as opaque descriptions instead of JSON dictionaries. Each element is now encoded to a JSON dictionary, with a string fallback for elements that fail to encode.🤖 Generated with Claude Code