Skip to content

iOS ApplicationData migration - #23705

Merged
MartinZikmund merged 19 commits into
masterfrom
dev/mazi/ios-appdata-migration
Sep 28, 2026
Merged

MartinZikmund merged 19 commits into
masterfrom
dev/mazi/ios-appdata-migration

Conversation

@MartinZikmund

@MartinZikmund MartinZikmund commented Jul 9, 2026 •

Copy link
Copy Markdown
Member

GitHub Issue: closes #1285

PR Type:

What changed? 🚀

PR Checklist ✅

@github-actions github-actions Bot added platform/ios 🍎 Categorizes an issue or PR as relevant to the iOS platform kind/documentation labels Jul 9, 2026
@unodevops

Copy link
Copy Markdown
Contributor

@MartinZikmund
MartinZikmund force-pushed the dev/mazi/ios-appdata-migration branch from d9b4282 to 8ac1acd Compare July 13, 2026 08:45
@github-actions

github-actions Bot commented Jul 13, 2026 •

Copy link
Copy Markdown
Contributor

Claude finished @MartinZikmund's task in 3m 16s —— View job


Review Complete

  • Gather context: read changed files and PR diff
  • Review Apple CS source changes
  • Review documentation changes
  • Post inline findings
  • Post summary

Summary

Verdict: fix-first — the migration sentinel key leaks into the public IPropertySet surface and is destroyed by Clear().

Issues by severity

Severity Count
High 1
Medium 2
Note 1

High — migration sentinel leaks into public API (3 related inline comments)
__uno_migrated is stored as a regular key inside _userDefaults, so it appears in Keys, inflates Count, is visible via ContainsKey/TryGetValue, is iterated by GetEnumerator, and — most importantly — is deleted by Clear(). After a Clear(), the sentinel is gone; the next cold-start will re-run the full migration loop (scanning NSUserDefaults.StandardUserDefaults). Fix by filtering the key out of all public-facing dictionary operations (see inline suggestions on Keys, Count, and Clear()).

Medium — non-atomic _migrated guard
The check-then-set on _migrated (a plain bool) is not atomic. If MigrateIfNeeded is called from two threads concurrently, both could race past the check and run the migration body in parallel. Use Interlocked.CompareExchange to make the guard correct (inline comment on line 22).

Medium — Synchronize() on every Remove() call
Remove() calls _userDefaults.Synchronize() after each deletion. Clear() calls Remove() per key, meaning Synchronize() fires once per entry in the loop. A single Synchronize() after the loop is sufficient and much cheaper.

Cross-cutting observations

  • GetEnumerator bug fix (line 150) is correct: the old code deserialized the key string instead of the value, always producing null values. Good catch.
  • Documentation (both applicationdata.md and migrating-to-uno-7.md) is well-structured, accurate, and matches the implementation. The one-way migration warning and the Synchronize explanation are particularly valuable.
  • The PR title and commits follow Conventional Commits format correctly.

@unodevops

Copy link
Copy Markdown
Contributor

@github-actions

github-actions Bot commented Jul 14, 2026 •

Copy link
Copy Markdown
Contributor

Claude finished @MartinZikmund's task in 5m 42s —— View job


Review Complete

  • Gather context: read changed files and PR diff
  • Review Apple CS source changes
  • Review documentation changes
  • Post inline findings
  • Post summary

Summary

Verdict: ship — the three issues flagged in the previous round are all fixed in the latest commit (7fc6e4e6). One new note was posted inline.

Issues from previous review — status

Issue Status
High: sentinel leaks into public API ✅ Fixed — IsInternalKey applied across Keys, Values, Count, ContainsKey, TryGetValue, GetEnumerator, Clear
Medium: non-atomic _migrated guard ✅ Fixed — volatile bool + lock(_migrationGate) is the correct double-checked locking pattern; a concurrent caller now waits for migration to finish rather than racing past
Medium: Synchronize() per-key in Clear() ✅ Fixed — Clear() now removes keys directly via RemoveObject (skipping Remove()) and calls Synchronize() once after the loop
Note: GetEnumerator value deserialization ✅ Correct — the prior bug (deserializing the key string instead of the value) is gone

New finding (1 note)

The IsInternalKey guard was added to all read/query paths but not to the two write paths (set accessor and Add(string, object)). Details and suggested fix in the inline comment on line 95. The impact is low (worst case: one extra empty migration scan on the next cold start), but completing the guard makes the sentinel invariant airtight.

Cross-cutting observations

  • Documentation (applicationdata.md and migrating-to-uno-7.md) is accurate, well-structured, and correctly describes the one-way migration and the new suite name.
  • Conventional Commits formatting on all three commits is correct.
  • No test coverage for the migration path (the PR checklist box is unchecked). Given iOS runtime tests are hard to run in CI, a unit-level test driving Migrate() with a mock NSUserDefaults would be worth adding in a follow-up, but it isn't blocking.

@MartinZikmund

Copy link
Copy Markdown
Member Author

Review threads addressed — commit 7fc6e4e6d4

All 5 unresolved threads were on src/Uno.UWP/Storage/ApplicationDataContainer.Apple.cs. Four were valid and are fixed; one was an acknowledgement needing no change.

While verifying them I also found something none of the bots flagged: the branch did not compile. The last CI run (build 221936) failed Build - Managed Binaries Build and iOS Skia Build Samples App with 8× the same error:

src/Uno.UWP/Storage/ApplicationDataContainer.Apple.cs(50,48): error CS1503:
Argument 2: cannot convert from 'Foundation.NSObject' to 'Foundation.NSString'

NSDictionary enumerates as KeyValuePair<NSObject, NSObject>, so pair.Key could not be passed to SetValueForKey(NSObject, NSString). That is fixed too (pattern-match the key to NSString, skipping non-string keys).

Fixed (4)

file:line reviewer point what changed
ApplicationDataContainer.Apple.cs:95 __uno_migrated sentinel leaks into Keys Added IsInternalKey(...) and filtered it out of Keys, Values, GetEnumerator, ContainsKey, TryGetValue and the indexer getter. Values now projects from the key/value pairs (not .Values) so it stays index-aligned with Keys. Remove inherits the guard via ContainsKey, so the sentinel can no longer be deleted through the public surface.
ApplicationDataContainer.Apple.cs:105 Count over-reports by 1 Count now counts only non-internal keys. Used the IsInternalKey filter rather than the suggested BoolForKey-subtraction, which would silently go wrong if the sentinel were ever absent.
ApplicationDataContainer.Apple.cs:133 Clear() deletes the sentinel → migration re-runs on next cold start; also Synchronize() per key Clear() now skips internal keys and calls _userDefaults.RemoveObject directly, with a single Synchronize() after the loop instead of one per entry.
ApplicationDataContainer.Apple.cs:22 _migrated is not volatile; check-then-set is not atomic Fixed, but not with the suggested Interlocked.CompareExchange: that lets the losing thread return while the migration is still running, so it can read a half-migrated container. Used textbook double-checked locking instead (volatile bool + lock), so a concurrent caller waits for the migration to finish. Migration body extracted into Migrate().

No change needed (1)

file:line reviewer point why
ApplicationDataContainer.Apple.cs:150 "the old code passed k.Key to Deserialize instead of k.Value — this fix is correct" Agreed — this thread is the bot confirming a fix already in the PR, not requesting one. No action. (The enumerator does now additionally filter the sentinel.)

Residual note (not blocking)

Writing to the reserved key directly (localSettings.Values["__uno_migrated"] = x) would still overwrite the sentinel and cause one redundant migration pass on the next cold start. That pass is harmless — the standard defaults have already been drained — so I left writes unguarded rather than silently swallowing a caller's write.


Validation level: code inspection only. I did not build, run, or test anything locally; the CS1503 diagnosis comes from reading the failed CI build log, and the fixes are reasoned from the source. Azure Pipelines will verify on this push — the previously failing Managed Binaries Build / iOS Skia Build Samples App legs are the ones to watch.

@unodevops

Copy link
Copy Markdown
Contributor

@MartinZikmund
MartinZikmund force-pushed the dev/mazi/ios-appdata-migration branch from 7fc6e4e to 685506f Compare August 11, 2026 07:58
@github-actions

github-actions Bot commented Aug 11, 2026 •

Copy link
Copy Markdown
Contributor

Claude finished @MartinZikmund's task in 5m 18s —— View job


Review Complete

  • Gather context: read changed files and PR diff
  • Review Apple CS source changes
  • Review documentation changes
  • Post inline findings
  • Post summary

Summary

Verdict: ship — all three issues from round 1 and the one note from round 2 are resolved. Two new notes posted inline; neither is blocking.

Issues from previous reviews — status

Issue Status
High: sentinel leaks into public API ✅ Fixed — IsInternalKey applied across all read/query paths
Medium: non-atomic _migrated guard ✅ Fixed — double-checked locking with volatile bool + lock
Medium: Synchronize() per-key in Clear() ✅ Fixed — single Synchronize() after the loop
Note: write paths leave sentinel unguarded ✅ Acknowledged — deliberate trade-off (harmless extra migration scan on next cold start if the reserved key is written by the caller)

New findings (2 notes, non-blocking)

Severity File Finding
Note ApplicationDataContainer.Apple.cs:97 IsInternalKey(NSObject) uses key?.ToString() which allocates a C# string per key; key is NSString s && s == MigrationKey is more efficient — inline suggestion posted
Note migrating-to-uno-7.md:322 Code comment reads "Before 7.0 the values were in StandardUserDefaults" but the snippet shows the 7.0+ access pattern — this reads backwards and could confuse readers; suggestion posted

Cross-cutting observations

  • Migration logic (MigrateIfNeeded + Migrate) is correct: one-way, idempotent on retry (if Migrate() throws, the sentinel is not set and migration is retried on next construction), and correctly iterates a dictionary snapshot so the live removal of each key during migration doesn't affect the enumeration.
  • Concurrency is sound: the volatile outer check avoids lock contention on the fast path; the inner double-check ensures a concurrent caller waits for migration to finish before reading the container.
  • No test coverage for the migration path — PR checklist box unchecked. Runtime tests for Apple are hard to run in CI. A unit-level test driving Migrate() with a mock NSUserDefaults would be valuable as a follow-up, but not blocking this PR.
  • Documentation is accurate and well-structured on both files.

Comment thread doc/articles/migrating-to-uno-7.md Resolved
MartinZikmund added a commit that referenced this pull request Aug 11, 2026
Settings lived in the shared standard user defaults, alongside keys owned
by the OS, Apple frameworks and native libraries, so enumerating or
clearing them saw — and deleted — unrelated native keys. They now live in
an UnoApplicationData suite, with a one-time migration of the values
Uno Platform recognizes as its own.

Also restores dictionary semantics in TryGetValue: ValueForKey is KVC, so
keys shadowed by NSUserDefaults members (description, count, ...) reported
a hit that was never stored.

Ports the implementation and documentation of #23705 onto the
NativeApplicationSettings abstraction, which replaces the file it changed.
Re-enables When_Nested_Container_Not_Included_In_Values on UIKit, which the
leak had forced off.
@unodevops

Copy link
Copy Markdown
Contributor

@unodevops

Copy link
Copy Markdown
Contributor

@unodevops

Copy link
Copy Markdown
Contributor

⚠️⚠️ The build 226925 has failed on Uno.UI - CI.

@MartinZikmund
MartinZikmund force-pushed the dev/mazi/ios-appdata-migration branch from 685506f to 11a9728 Compare August 14, 2026 18:26
@github-actions

github-actions Bot commented Aug 14, 2026 •

Copy link
Copy Markdown
Contributor

Claude finished @MartinZikmund's task in 3m 9s —— View job


Review Complete

  • Gather context: read changed files and PR diff
  • Review Apple CS source changes
  • Review documentation changes
  • Post inline findings
  • Post summary

Summary

Verdict: ship — no new issues found in this push. The implementation from round 2 is intact and correct. Two notes from round 3 remain unaddressed (re-posted as inline comments on the new commit).

Status of prior findings

Round Issue Status
1 High: sentinel leaks into public API ✅ Fixed
1 Medium: non-atomic _migrated guard ✅ Fixed
1 Medium: Synchronize() per-key in Clear() ✅ Fixed
2 Note: write paths leave sentinel unguarded ✅ Acknowledged (deliberate — harmless extra migration scan)
3 Note: IsInternalKey(NSObject) allocates via ?.ToString() ⚠️ Still open
3 Note: doc comment "Before 7.0..." precedes 7.0+ code block ⚠️ Still open

Open findings (2 notes, non-blocking)

Both are re-posted as inline comments on the latest commit:

  • ApplicationDataContainer.Apple.cs:97 — key?.ToString() allocates a managed string per key on every call to Keys, Values, Count, Clear, and GetEnumerator. Replacing with key is NSString s && s == MigrationKey avoids the allocation and is more idiomatic.
  • migrating-to-uno-7.md:435 — The inline comment "Before 7.0 the values were in StandardUserDefaults" is followed by the 7.0+ access pattern, which reads backwards. Reframing it as "In 7.0+, settings are in the dedicated UnoApplicationData suite" removes the ambiguity.

Cross-cutting observations

  • Migration logic is correct: one-way, idempotent on retry (sentinel only set after Migrate() completes), iterates a snapshot so live removals during migration don't affect enumeration.
  • Concurrency is sound: double-checked locking with volatile outer guard and lock(_migrationGate) inner guard.
  • CI — 3 checks still in progress (CodeQL, Check Links, this review); 2 passed (WinAppSDK Sync Generator Check, Pull Request Labeler). The previous build failure (226925) predates this push; watch for the managed-binaries and iOS Skia legs when they complete.

Comment thread doc/articles/migrating-to-uno-7.md Resolved
MartinZikmund added a commit that referenced this pull request Aug 14, 2026
Settings lived in the shared standard user defaults, alongside keys owned
by the OS, Apple frameworks and native libraries, so enumerating or
clearing them saw — and deleted — unrelated native keys. They now live in
an UnoApplicationData suite, with a one-time migration of the values
Uno Platform recognizes as its own.

Also restores dictionary semantics in TryGetValue: ValueForKey is KVC, so
keys shadowed by NSUserDefaults members (description, count, ...) reported
a hit that was never stored.

Ports the implementation and documentation of #23705 onto the
NativeApplicationSettings abstraction, which replaces the file it changed.
Re-enables When_Nested_Container_Not_Included_In_Values on UIKit, which the
leak had forced off.
@MartinZikmund
MartinZikmund force-pushed the dev/mazi/ios-appdata-migration branch from 20c079c to 6f8d3fe Compare September 25, 2026 22:21
@github-actions

github-actions Bot commented Sep 25, 2026 •

Copy link
Copy Markdown
Contributor

Claude finished @MartinZikmund's task in 4m 47s —— View job


Review Complete

  • Gather context: read PR history and current diff vs origin/master
  • Review LegacySettingsMigration.cs (new extracted migration logic + ISettingsMigrationStore)
  • Review ApplicationDataMigrator.UIKit.cs (thin Foundation adapter)
  • Review ApplicationDataContainer.UIKit.cs and UnoUserDefaults.UIKit.cs
  • Review unit test Given_LegacySettingsMigration.cs and runtime test changes
  • Review documentation changes
  • Post inline findings
  • Post summary

Summary

Verdict: ship — this branch has not changed since the round-8 review (Sept 24, verdict "ship"); same 16 commits, same SHAs. I re-derived the review independently rather than trusting that verdict, and reached the same conclusion: the opt-in migration design is sound and I found no correctness, concurrency, or data-loss issues.

Independent verification highlights

  • Data-loss gate (LegacySettingsMigration.Migrate): traced the full logic by hand and separately verified it against Given_LegacySettingsMigration.cs. Deletion from the source is correctly gated on target.Synchronize() returning true (throws IOException, source untouched, otherwise). A failed source flush after a successful target write only logs a warning — values then exist in both places, which the next call cleans up without re-overwriting a newer target value. The When_Source_Flush_Fails_Then_Retry_Keeps_Target_Value test in particular exercises this correctly: I traced the _pending/Persisted state transitions across both Migrate() calls and confirmed they match the assertions.
  • ApplicationDataContainer.UIKit.cs: Clear() now drops the whole suite via a single RemovePersistentDomain + Synchronize(), and all reads (Keys/Values/Count/ContainsKey/TryGetValue/GetEnumerator) go through UnoUserDefaults.Domain (persistentDomainForName:), which is correctly suite-scoped and won't pick up application/global domain keys the way dictionaryRepresentation (ToDictionary()) would.
  • Migration scope: ApplicationDataMigrator.MigrateSettings() correctly scans only the app's own persistent domain (PersistentDomainForName(bundleId)), falling back to the merged ToDictionary() only when no bundle identifier is available — resolves the "scan only the app domain" perf item from the last round.
  • Doc checklist numbering: verified directly — items run 1→18 with no duplicates or gaps, and the new item 18 correctly follows item 17.
  • Doc xrefs: Uno.Development.MigratingToUno7 and Uno.Features.ApplicationData both resolve to real uid: declarations.

New findings (2 notes, non-blocking, posted inline)

Both are unused-using cleanup items missed across the last few rounds:

  • src/Uno.WinRT/Storage/Internal/LegacySettingsMigration.cs:8 — unused using Windows.Storage;.
  • src/Uno.WinRT/Storage/ApplicationDataMigrator.UIKit.cs:3 — unused using System; (this one was actually already flagged as a cosmetic note in the round-7/8 discussion and never picked up).

Neither is build-breaking (IDE0005 isn't enforced as a warning in this repo).

(Correction note: my first inline comment on LegacySettingsMigration.cs:8 included a malformed suggestion block that would have introduced a duplicate using System.Linq; — I posted a follow-up on the same line correcting it to a plain line-deletion.)

Cross-cutting observations

  • Pre-existing, out of scope: on iOS/tvOS, LocalSettings and RoamingSettings share the exact same NSUserDefaultsPropertySet/suite with no locality distinction (unlike the Skia/WASM FilePropertySet(owner, Locality) implementations). This predates the PR — the old code used the same undifferentiated NSUserDefaults.StandardUserDefaults for both — so it's not a regression introduced here, just a limitation this PR doesn't (and isn't scoped to) address.
  • No dedicated test exercises the real NSUserDefaults-backed ApplicationDataMigrator.MigrateSettings() end-to-end (only the extracted pure LegacySettingsMigration logic and the container's suite-isolation runtime test). This has been discussed and accepted across prior rounds — no Apple TFM in Uno.UI.RuntimeTests.Skia, and reflection-based seeding would be a flaky test — so I'm not re-opening it as a blocker.
  • Conventional Commits formatting is correct across the branch.
    · Branch: dev/mazi/ios-appdata-migration

@unodevops

Copy link
Copy Markdown
Contributor

@nventive-devops

Copy link
Copy Markdown
Contributor

The build 235805 found UI Test snapshots differences: skia-linux-screenshots: 57, skia-windows-screenshots: 2310, wasm: 11

Details
  • skia-linux-screenshots: 57 changed over 2348

    🚨🚨 Comparison Details (first 20) 🚨🚨
    • ButtonClippingTestsControl.png-dark
    • ButtonClippingTestsControl.png
    • ClipboardTests.png-dark
    • Buttons.png-dark
    • Buttons.png
    • CalendarView_Theming.png-dark
    • CalendarView_Theming.png
    • DisplayInformation.png-dark
    • ContextRequested.png-dark
    • ContextRequested.png
    • DropDownButtonPage.png-dark
    • DropDownButtonPage.png
    • Focus_FocusVisual_Properties.png-dark
    • Examples.png-dark
    • Examples.png
    • ExpanderColorValidationPage.png-dark
    • ExpanderColorValidationPage.png
    • ImageIconPage.png-dark
    • Gamepad_CurrentReading.png-dark
    • Gamepad_CurrentReading.png
  • skia-windows-screenshots: 2310 changed over 2500

    🚨🚨 Comparison Details (first 20) 🚨🚨
    • AppBarButtonTest.png-dark
    • AppBar_KeyBoard.png
    • ApplicationViewSpanningRectsPage.png
    • AppWindowPresenters.png
    • Arrange_Performance01.png-dark
    • Attributed_text_Simple.png-dark
    • AutoBorderStretchwithbottommargin.png-dark
    • AutomationPropertiesExtensions_Role.png
    • AutoSuggestBoxChosenSuggestion.png-dark
    • AutoSuggestBoxChosenSuggestion.png
    • BadgeNotificationTests.png-dark
    • BadgeNotificationTests.png
    • Basics_Automated.png-dark
    • Basics_Automated.png
    • BezierSegment.png-dark
    • BezierSegment.png
    • BitmapImage_vs_SvgImageSource.png-dark
    • BitmapImage_vs_SvgImageSource.png
    • BorderTopwithmargins.png-dark
    • BorderTopwithmargins.png
  • wasm: 11 changed over 1076

    🚨🚨 Comparison Details (first 20) 🚨🚨
    • SamplesApp.Windows_UI_Xaml_Controls.ListView.ListViewSelectedItems
    • UITests.Microsoft_UI_Xaml_Controls.WebView2Tests.WebView2_NavigationProperties
    • UITests.Shared.Microsoft_UI_Xaml_Controls.ExpanderTests.WinUIExpanderPage
    • SamplesApp.Wasm.Windows_UI_Xaml_Controls.ListView.ListView_IsSelected
    • SamplesApp.Microsoft_UI_Xaml_Controls.WebView2Tests.WebView2_EnableDevTools
    • UITests.Shared.Windows_UI_Xaml_Controls.MediaPlayerElement.MediaPlayerElement_Minimal
    • UITests.Shared.Windows_UI_Xaml_Controls.MediaPlayerElement.MediaPlayerElement_Ogg_Extension
    • UITests.Uno_Web.Http.CookieManagerTests
    • UITests.Windows_UI_Xaml_Controls.CalendarView.CalendarView_Theming
    • UITests.Windows_UI_Xaml_Media_Animation.ColorAnimation_Background
    • Uno.UI.Samples.Content.UITests.WebView.WebView_AnchorNavigation

@unodevops

Copy link
Copy Markdown
Contributor

@github-actions

github-actions Bot commented Sep 28, 2026 •

Copy link
Copy Markdown
Contributor

Claude finished @MartinZikmund's task in 2m 52s —— View job


Review Complete

  • Gather context: read PR history and current diff vs origin/master
  • Review ApplicationDataContainer.UIKit.cs, ApplicationDataMigrator.UIKit.cs, LegacySettingsMigration.cs, UnoUserDefaults.UIKit.cs against AGENTS.md rules
  • Review unit test Given_LegacySettingsMigration.cs and runtime test changes
  • Review documentation changes
  • Post inline findings (none — see below)
  • Post summary

Summary

Verdict: ship. This trigger followed the latest commit (06eadcdf, "chore: Drop unused usings in ApplicationDataMigrator"), which removes the unused using System; and using System.Linq; from ApplicationDataMigrator.UIKit.cs — the last open cosmetic note from round 8/9. I re-derived a full review of the current state independently rather than trusting the prior "ship" verdicts, and found no new issues to post inline.

What I verified fresh

  • LegacySettingsMigration.Migrate (src/Uno.WinRT/Storage/Internal/LegacySettingsMigration.cs): traced the full control flow by hand against Given_LegacySettingsMigration.cs. Deletion from the source is correctly gated on target.Synchronize() returning true (throws IOException, source untouched otherwise); a failed source flush after a successful target write only logs a warning, leaving values in both places until the next call cleans up without clobbering a newer target value. This is the fix for the standing P1 data-loss finding from rounds 9–10, and it holds.
  • ApplicationDataMigrator.MigrateSettings(): correctly scopes the scan to the app's own persistent domain via PersistentDomainForName(bundleId), falling back to the merged ToDictionary() only when no bundle identifier is available.
  • ApplicationDataContainer.UIKit.cs: all read paths (Keys, Values, Count, ContainsKey, TryGetValue, GetEnumerator, indexer get) and Clear() go through UnoUserDefaults.Domain (persistentDomainForName:), which is correctly suite-scoped — confirmed this doesn't pick up application/global domain keys the way dictionaryRepresentation would, matching the new When_Cleared_Then_Only_Own_Keys_Are_Visible runtime test.
  • Code style: braces are present on every conditional in the changed files (including single-line bodies), tabs/Allman formatting is consistent, and the new files use file-scoped namespaces and #nullable enable per the repo's conventions.
  • Doc checklist numbering (doc/articles/migrating-to-uno-7.md): verified directly — both numbered lists in the file (lines 66–72 and 1023–1055) run sequentially with no duplicates or gaps; the iOS/tvOS migration item lands correctly at 18.
  • applicationdata.md: accurately describes the dedicated suite, the isolation guarantee, and links to the migration guide for pre-7.0 upgrade behavior; consistent with the implementation.

Cross-cutting observations (non-blocking, already accepted in prior rounds)

  • The opt-in migration design (no sentinel key, Clear() dropping the whole suite in one native call, migration logic decoupled from Foundation types behind ISettingsMigrationStore) remains the right architectural call — it's what made the failure-path unit tests possible without an Apple TFM in the test project.
  • LocalSettings/RoamingSettings sharing one undifferentiated suite on iOS/tvOS is a pre-existing limitation (not a regression), and is now explicitly documented in applicationdata.md:108.
  • No dedicated runtime test exercises the real NSUserDefaults-backed MigrateSettings() end-to-end — only the extracted pure logic (unit-tested) and the container's suite-isolation behavior (runtime-tested). This has been discussed and accepted across multiple rounds given the runtime tests project has no Apple TFM.
  • Conventional Commits formatting is correct on all commits, including the latest cleanup commit.

Branch: dev/mazi/ios-appdata-migration

@unodevops

Copy link
Copy Markdown
Contributor

@unodevops

Copy link
Copy Markdown
Contributor

@nventive-devops

Copy link
Copy Markdown
Contributor

The build 236003 found UI Test snapshots differences: skia-linux-screenshots: 57, skia-windows-screenshots: 2310, wasm: 11

Details
  • skia-linux-screenshots: 57 changed over 2348

    🚨🚨 Comparison Details (first 20) 🚨🚨
    • Buttons.png-dark
    • Buttons.png
    • ClipboardTests.png-dark
    • DisplayInformation.png-dark
    • ButtonClippingTestsControl.png-dark
    • ButtonClippingTestsControl.png
    • DropDownButtonPage.png-dark
    • DropDownButtonPage.png
    • CalendarView_Theming.png-dark
    • CalendarView_Theming.png
    • Examples.png-dark
    • Examples.png
    • ExpanderColorValidationPage.png-dark
    • ExpanderColorValidationPage.png
    • ContextRequested.png-dark
    • ElementLevelTheme.png-dark
    • ContextRequested.png
    • ElementLevelTheme.png
    • Gamepad_CurrentReading.png-dark
    • Gamepad_CurrentReading.png
  • skia-windows-screenshots: 2310 changed over 2500

    🚨🚨 Comparison Details (first 20) 🚨🚨
    • AnimatedIconPage.png
    • AppBarButtonTest.png-dark
    • AppBar_KeyBoard.png
    • ApplicationViewMode.png-dark
    • ApplicationViewSizing.png-dark
    • AppWindowFeatures.png-dark
    • AppWindowPresenters.png-dark
    • AppWindowPresenters.png
    • ArcSegment.png
    • Arrange_Performance01.png-dark
    • AuthenticationBroker_Demo.png-dark
    • Attributed_text_Simple.png-dark
    • AutoBorderStretchwithbottommargin.png
    • AuthenticationBroker_Demo.png
    • AutomationProperties_AutomationId.png
    • AutoBorderStretchwithtopmargin.png
    • AutoSuggestBoxChosenSuggestion.png
    • AutomationProperties_Name.png
    • AutoSuggestBox_BitmapIcon.png-dark
    • AutoSizedPathCentered.png-dark
  • wasm: 11 changed over 1076

    🚨🚨 Comparison Details (first 20) 🚨🚨
    • SamplesApp.Wasm.Windows_UI_Xaml_Controls.ListView.ListView_IsSelected
    • SamplesApp.Microsoft_UI_Xaml_Controls.WebView2Tests.WebView2_EnableDevTools
    • UITests.Microsoft_UI_Xaml_Controls.WebView2Tests.WebView2_NavigationProperties
    • UITests.Shared.Microsoft_UI_Xaml_Controls.ExpanderTests.WinUIExpanderPage
    • UITests.Shared.Windows_UI_Xaml_Controls.MediaPlayerElement.MediaPlayerElement_Minimal
    • UITests.Shared.Windows_UI_Xaml_Controls.MediaPlayerElement.MediaPlayerElement_Ogg_Extension
    • SamplesApp.Windows_UI_Xaml_Controls.ListView.ListViewSelectedItems
    • UITests.Uno_Web.Http.CookieManagerTests
    • UITests.Windows_UI_Xaml_Media_Animation.ColorAnimation_Background
    • UITests.Windows_UI_Xaml_Controls.CalendarView.CalendarView_Theming
    • Uno.UI.Samples.Content.UITests.WebView.WebView_AnchorNavigation

@MartinZikmund MartinZikmund added the ready-to-merge Automatically merge the PR once all '.mergify.yml' policies are met label Sep 28, 2026
@github-actions

github-actions Bot commented Sep 28, 2026 •

Copy link
Copy Markdown
Contributor

Claude finished @MartinZikmund's task in 2m 49s —— View job


Review Complete

  • Gather context: read current diff vs origin/master and changed files
  • Review ApplicationDataContainer.UIKit.cs, ApplicationDataMigrator.UIKit.cs, LegacySettingsMigration.cs, UnoUserDefaults.UIKit.cs against AGENTS.md rules
  • Review unit test Given_LegacySettingsMigration.cs and runtime test changes
  • Review documentation changes
  • Post inline findings (none — see below)
  • Post summary

Summary

Verdict: ship. The only commit since the last review round (fc559976, "docs: Note the UserDefaults privacy manifest entry") is a documentation-only addition to doc/articles/features/applicationdata.md — no source changes. I re-derived a full pass over the current state of the implementation, tests, and docs independently rather than trusting the prior rounds' "ship" verdicts (the most recent of which was also confirmed by @morning4coffe-dev's approving review), and found nothing to post inline.

What I verified fresh this round

  • New privacy-manifest doc section (applicationdata.md:118-133): accurate. NSUserDefaults is genuinely one of Apple's required-reason APIs, no auto-generation of PrivacyInfo.xcprivacy entries exists anywhere in Uno.Sdk/src/, so the manual-declaration guidance is correct and non-redundant. The CA92.1 reason code and its description ("data only the app itself can access") match Apple's published reason for that category, and the xref:Uno.Features.Uno.Sdk#apple-privacy-manifest-support anchor resolves to the real ## Apple Privacy Manifest Support heading in using-the-uno-sdk.md.
  • LegacySettingsMigration.Migrate: re-traced by hand against Given_LegacySettingsMigration.cs. Every source key is added to the removal list regardless of whether it was newer than the target (by design — a stale legacy value must be discarded from the source even when the target already won), deletion is correctly gated on target.Synchronize() succeeding (throws IOException, source untouched otherwise), and a failed source flush after a successful target write only logs a warning. This matches the documented crash-safety contract ("never in neither place").
  • ApplicationDataMigrator.MigrateSettings(): scans only the app's own persistent domain (PersistentDomainForName(bundleId)), falling back to the merged ToDictionary() only without a bundle identifier — correct given pre-7.0 Uno wrote directly to the app's own domain, not the global one.
  • ApplicationDataContainer.UIKit.cs: all read paths and Clear() go through UnoUserDefaults.Domain (suite-scoped persistentDomainForName:), which is what makes the isolation guarantee in the new runtime test (When_Cleared_Then_Only_Own_Keys_Are_Visible) hold.
  • Code style: braces on every conditional (including one-liners), tabs/Allman formatting, file-scoped namespaces + #nullable enable on the new files, no event Action/Action<T>, no blocking .Result/GetAwaiter().GetResult() calls, no edits under Generated/.
  • Tests: Given_LegacySettingsMigration.cs follows MSTest Given_/When_ conventions with an inline fake store (no Moq on a UI type, consistent with unit-tests.md); the runtime test addition correctly uses [PlatformCondition(ConditionMode.Include, RuntimeTestPlatforms.SkiaUIKit)] rather than gating with #if.

Cross-cutting observations (non-blocking, unchanged from prior rounds)

  • The opt-in migration design remains the right call: no reserved sentinel key, Clear() drops the whole suite in one native call, and the migration logic is decoupled from Foundation types behind ISettingsMigrationStore, which is what makes the failure/retry paths unit-testable without an Apple TFM in the test project.
  • No runtime test exercises the real NSUserDefaults-backed ApplicationDataMigrator.MigrateSettings() end-to-end — only the extracted pure logic (unit-tested) and the container's suite-isolation behavior (runtime-tested). This gap has been discussed and explicitly accepted across multiple rounds (no Apple TFM in Uno.UI.RuntimeTests.Skia).
  • Conventional Commits formatting is correct on all commits, including the latest doc commit.

Branch: dev/mazi/ios-appdata-migration

@unodevops

Copy link
Copy Markdown
Contributor

@unodevops

Copy link
Copy Markdown
Contributor

@nventive-devops

Copy link
Copy Markdown
Contributor

The build 236016 found UI Test snapshots differences: skia-linux-screenshots: 57, skia-windows-screenshots: 2310, wasm: 11

Details
  • skia-linux-screenshots: 57 changed over 2348

    🚨🚨 Comparison Details (first 20) 🚨🚨
    • ButtonClippingTestsControl.png-dark
    • ButtonClippingTestsControl.png
    • CalendarView_Theming.png-dark
    • CalendarView_Theming.png
    • ClipboardTests.png-dark
    • Buttons.png-dark
    • Buttons.png
    • DropDownButtonPage.png-dark
    • DropDownButtonPage.png
    • ContextRequested.png-dark
    • ContextRequested.png
    • ElementLevelTheme.png-dark
    • ElementLevelTheme.png
    • Gamepad_CurrentReading.png-dark
    • Gamepad_CurrentReading.png
    • Gamepad_Enumeration.png-dark
    • Gamepad_Enumeration.png
    • Examples.png-dark
    • Examples.png
    • ExpanderColorValidationPage.png-dark
  • skia-windows-screenshots: 2310 changed over 2500

    🚨🚨 Comparison Details (first 20) 🚨🚨
    • AndroidWindowInsets.png
    • AppBarToggleButtonTest.png
    • AppWindowClosing.png-dark
    • AppWindowPositionAndSize.png
    • ArcSegment.png
    • Attributed_text_Supserscript.png
    • AutoBorderStretchwithrightmargin.png
    • AutomationProperties_AutomationId.png-dark
    • AutoSizedTopLeft.png
    • AutoSuggestBoxChosenSuggestion.png-dark
    • BackGesture.png-dark
    • BackGesture.png
    • BasicEnability.png-dark
    • BasicEnability.png
    • BeginTime_MultipleAnimations.png-dark
    • BeginTime_MultipleAnimations.png
    • BitmapIcon_Monochromatic.png-dark
    • BitmapIcon_Monochromatic.png
    • BorderCenteredwithmargins.png-dark
    • BorderCenteredwithmargins.png
  • wasm: 11 changed over 1076

    🚨🚨 Comparison Details (first 20) 🚨🚨
    • SamplesApp.Windows_UI_Xaml_Controls.ListView.ListViewSelectedItems
    • UITests.Shared.Microsoft_UI_Xaml_Controls.ExpanderTests.WinUIExpanderPage
    • UITests.Microsoft_UI_Xaml_Controls.WebView2Tests.WebView2_NavigationProperties
    • SamplesApp.Wasm.Windows_UI_Xaml_Controls.ListView.ListView_IsSelected
    • UITests.Shared.Windows_UI_Xaml_Controls.MediaPlayerElement.MediaPlayerElement_Minimal
    • UITests.Shared.Windows_UI_Xaml_Controls.MediaPlayerElement.MediaPlayerElement_Ogg_Extension
    • SamplesApp.Microsoft_UI_Xaml_Controls.WebView2Tests.WebView2_EnableDevTools
    • UITests.Uno_Web.Http.CookieManagerTests
    • UITests.Windows_UI_Xaml_Media_Animation.ColorAnimation_Background
    • UITests.Windows_UI_Xaml_Controls.CalendarView.CalendarView_Theming
    • Uno.UI.Samples.Content.UITests.WebView.WebView_AnchorNavigation

@MartinZikmund
MartinZikmund merged commit e1292e0 into master Sep 28, 2026
58 checks passed
@mergify

mergify Bot commented Sep 28, 2026 •

Copy link
Copy Markdown
Contributor

This pull request does not currently match the merge queue conditions, so it cannot be queued from here. The box comes back if it matches again.

@MartinZikmund
MartinZikmund deleted the dev/mazi/ios-appdata-migration branch September 28, 2026 16:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area/automation Categorizes an issue or PR as relevant to project automation kind/documentation platform/ios 🍎 Categorizes an issue or PR as relevant to the iOS platform ready-to-merge Automatically merge the PR once all '.mergify.yml' policies are met

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Given_ApplicationDataContainer_When_GetAllKeys fails on iOS

5 participants