Skip to content

Fix locale deletion and prepare Shipyard 1.0 (6) - #39

Merged
NayanBhut merged 3 commits into
mainfrom
codex/fix-locale-selection
Oct 16, 2026
Merged

NayanBhut merged 3 commits into
mainfrom
codex/fix-locale-selection

Conversation

@NayanBhut

@NayanBhut NayanBhut commented Oct 15, 2026 •

Copy link
Copy Markdown
Owner

Summary

  • fix App Info locale selection after deleting the selected localization
  • preserve a newer user selection when deletion finishes asynchronously
  • add focused coverage for stale lists and locale fallbacks
  • increment Shipyard to version 1.0 build 6

Verification and distribution

  • project-file lint passed
  • CI-matching Debug build passed
  • focused locale-selection test passed
  • Orca GUI test on Cleanify added five locales and deleted them one by one; the selector updated immediately without reloading
  • universal Release archive succeeded for Apple silicon and Intel
  • App Store Connect upload succeeded and build 1.0 (6) is processing
  • Developer ID notarization succeeded
  • the exported app and downloadable ZIP pass stapler validation, code-signature verification, and Gatekeeper assessment

@github-actions

github-actions Bot commented Oct 15, 2026 •

Copy link
Copy Markdown

🤖 Ollama Cloud PR Review (Model: kimi-k3:cloud)

Review: Locale selection after deletion

Overall this is a well-structured change with good test coverage of the new pure function. A few concerns below, ordered by importance.


  • [BUG]
  • Severity: [MEDIUM]
  • File: ShipyardAppInfoView.swift (line ~898)
  • Description: The old code unconditionally cleared drafts after a successful delete (for field in Field.allCases { drafts.removeValue(...) }, draftSignature = "", syncDrafts()). The new code delegates that cleanup entirely to switchToLocale(...), but there is an edge case where localeAfterDeleting returns the same locale that is currently selected: deleting the primary locale when it's the only localization left (remaining is empty → returns primaryLocale ?? ..., which equals removedLocale, and locale == removedLocale). Typical switchToLocale implementations early-return or no-op when the value doesn't change (and assigning the same value to @State won't trigger a reload). If that's the case here, the editor retains the deleted record's drafts, and a subsequent save() could silently recreate the localization the user just deleted. The implementation of switchToLocale isn't in the diff, so this needs verification.
  • Suggestion: Either confirm switchToLocale always re-syncs drafts even when the target equals the current locale, or explicitly reset drafts in the localeAfterDeleting(...) == locale path:
    let next = Self.localeAfterDeleting(...)
    if next == locale {
        for field in Field.allCases { drafts.removeValue(forKey: field.rawValue) }
        draftSignature = ""
        syncDrafts()
    } else {
        switchToLocale(next)
    }
    A test covering "delete the last localization which is the primary" would lock this in.

  • [BUG]
  • Severity: [LOW]
  • File: ShipyardAppInfoView.swift (line ~921)
  • Description: remaining.first makes the post-delete selection dependent on the ordering of locales. If locales is derived from a dictionary, a Set, or unstable API ordering, the chosen fallback locale can be nondeterministic across identical states.
  • Suggestion: If locales ordering isn't guaranteed stable, sort (e.g., by display name) before taking first, or document/assert that the array order is deterministic (e.g., primary-first from the API).

  • [BEST PRACTICE]
  • Severity: [LOW]
  • File: ShipyardAppInfoView.swift (line ~919)
  • Description: Locale matching uses exact string equality ($0 != removedLocale, remaining.contains(primaryLocale)). Locale identifiers are notorious for normalization differences (en-US vs en-us vs en_US). If locales, locale, and app.primaryLocale ever come from different sources with different normalization, the filter may fail to remove the deleted locale, and the picker could stay on the deleted record. All paths today appear to use App Store Connect's BCP 47 codes, so this is defensive only.
  • Suggestion: Compare case-insensitively ($0.compare(removedLocale, options: .caseInsensitive)) or normalize identifiers once via a helper before comparing.

  • [IMPROVEMENT]
  • Severity: [LOW]
  • File: App Store Tests/ValidationTests.swift (line 13)
  • Description: Branch coverage of localeAfterDeleting is good, but two behavioral cases worth locking in are untested: (1) deleting the primary locale while others remain (("en-US", ["en-US", "de-DE"], primary: "en-US") → "de-DE"), and (2) the already-refreshed state where removedLocale is no longer in availableLocales (("ca", ["en-US"], primary: "en-US")). The second case is important because the method's correctness relies on locales possibly being stale or fresh after the await.
  • Suggestion: Add these two assertions to document intent.

What looks good:

  • Capturing removedLocale before the await and guarding the switch with if locale == removedLocale correctly handles the user changing locale mid-flight. ✅
  • Filtering removedLocale out of availableLocales makes the function correct whether or not locales has refreshed post-deletion. Nice defensive design. ✅
  • Extracting the decision into a static pure function with unit tests is a solid pattern. ✅

Automated review by Ollama Cloud. The diff is untrusted input; findings may be inaccurate. If this review seems wrong, please provide feedback.

@NayanBhut

Copy link
Copy Markdown
Owner Author

Automated review triage:

  • Fixed: added a guard so a completed deletion does not overwrite a locale the user selected while the request was in flight.
  • Fixed: expanded the focused test to cover a stale list that still contains the removed locale, primary-locale fallback, and default-locale fallback.
  • Verified false positive: draft cleanup was not removed. switchToLocale assigns the new locale, clears every draft, resets draftSignature, and calls syncDrafts().
  • Verified: the focused test and the CI-matching Debug build pass after these changes.

@NayanBhut NayanBhut changed the title Fix App Info locale selection after deletion Fix locale deletion and prepare Shipyard 1.0 (6) Oct 15, 2026
@NayanBhut
NayanBhut merged commit 6ac2afd into main Oct 16, 2026
4 checks passed
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.

2 participants