Skip to content

fix(ios): Properly serialize arrays of Codable objects in widget config - #436

Open
galacticgibbon wants to merge 3 commits into
ABausG:mainfrom
galacticgibbon:fix/ios-codable-serialization
Open

fix(ios): Properly serialize arrays of Codable objects in widget config#436
galacticgibbon wants to merge 3 commits into
ABausG:mainfrom
galacticgibbon:fix/ios-codable-serialization

Conversation

@galacticgibbon

Copy link
Copy Markdown

Description

Supersedes #377, rebased onto current main and 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.swift where arrays of Codable objects (e.g. [EntryTypeEntity]) were not properly encoded when extracting widget configuration via getInstalledWidgets(). 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

@coderabbitai

coderabbitai Bot commented Jul 23, 2026

Copy link
Copy Markdown

Review Change Stack

Warning

Review limit reached

@galacticgibbon, you've reached your PR review limit, so we couldn't start this review.

Next review available in: 31 minutes

Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available.
You're only billed for reviews past your plan's rate limits ($0.25/file).

How can I continue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

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 configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro Plus

Run ID: 4579c6ac-2f37-49e0-b710-5379a8a94129

📥 Commits

Reviewing files that changed from the base of the PR and between ca7e0c3 and 41d00a1.

📒 Files selected for processing (1)
  • packages/home_widget/ios/home_widget/Sources/home_widget/HomeWidgetPlugin.swift

Walkthrough

Installed-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.

Changes

Intent Serialization

Layer / File(s) Summary
Array element normalization
packages/home_widget/ios/home_widget/Sources/home_widget/HomeWidgetPlugin.swift
Array intent values preserve numbers, strings, dictionaries, and nested arrays; Codable elements are encoded as JSON objects when possible, with string conversion as the fallback.

Estimated code review effort: 2 (Simple) | ~10 minutes

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title uses a valid conventional prefix and clearly summarizes the iOS array-serialization fix.
Description check ✅ Passed The description clearly explains the bug and fix, but it omits the template's checklist, breaking-change, and related-issues sections.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

📥 Commits

Reviewing files that changed from the base of the PR and between 0b42c89 and e39ee0a.

📒 Files selected for processing (1)
  • packages/home_widget/ios/home_widget/Sources/home_widget/HomeWidgetPlugin.swift

Comment thread packages/home_widget/ios/home_widget/Sources/home_widget/HomeWidgetPlugin.swift Outdated

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

📥 Commits

Reviewing files that changed from the base of the PR and between e39ee0a and ca7e0c3.

📒 Files selected for processing (1)
  • packages/home_widget/ios/home_widget/Sources/home_widget/HomeWidgetPlugin.swift

@codecov

codecov Bot commented Jul 29, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 96.30%. Comparing base (0b42c89) to head (41d00a1).

Additional details and impacted files

Impacted file tree graph

@@           Coverage Diff           @@
##             main     #436   +/-   ##
=======================================
  Coverage   96.30%   96.30%           
=======================================
  Files          57       57           
  Lines        3300     3300           
=======================================
  Hits         3178     3178           
  Misses        122      122           
Flag Coverage Δ
home_widget 100.00% <ø> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant