Skip to content

refactor(mobile): share one exact-set check in the Expo config gate - #11196

Merged
iscekic merged 2 commits into
mainfrom
drain/expo-config-set-check
Nov 16, 2026
Merged

iscekic merged 2 commits into
mainfrom
drain/expo-config-set-check

Conversation

@iscekic

@iscekic iscekic commented Nov 16, 2026 •

Copy link
Copy Markdown
Collaborator

Evidence

Evidence: demonstrated — ran apps/mobile/scripts/assert-expo-config.mjs on the merge base and on this branch against the same evaluated config and twelve doctored copies of it; all thirteen runs printed the same message text and the same exit code on both revisions.

Change

apps/mobile/scripts/assert-expo-config.mjs compared three collections for exact membership with three unrelated expressions. It now has one local helper beside check:

/** True when `actual` holds exactly the members of `expected`, in any order. */
const sameMembers = (actual, expected) =>
  actual.length === expected.length && expected.every(value => actual.includes(value));

All three exact checks call it:

Check Before After
config.platforms Array.isArray(…) && length === … && PLATFORMS.every(includes) Array.isArray(…) && sameMembers(config.platforms, PLATFORMS)
android.blockedPermissions hoisted blockedPermissionsMatch with the same two conditions sameMembers(blockedPermissions, BLOCKED_PERMISSIONS)
ios.infoPlist.CFBundleLocalizations two complementary filters, pass condition a.length === 0 && b.length === 0 sameMembers([...new Set(localizations)], localeTags); the filters now only name the offending tags in the message

The locale check compares the distinct tags, because the two filters it replaces asked which languages are named rather than how often: a repeated tag names no extra language, and the top-level locales keys cannot repeat (Object.fromEntries collapses them). A repeated tag therefore keeps the outcome it had before, while a dropped, extra, or swapped tag still fails.

Not changed:

  • The android.permissions subset check (missingRequestedPermissions). It asks a different question: plugins add their own permissions, so the evaluated array is never exactly the requested list.
  • Every failure message, every check's position in the order, and the CFBundleLocalizations non-empty gate above the loop.
  • No assertion outcome changes for any config: the helper is the same predicate the three sites spelled out, and the locale comparison keeps the set semantics the filters had.

Verification

apps/mobile/scripts/assert-expo-config.mjs reads the evaluated config from npx expo config --json, so the doctored runs replaced that one command with a stub that prints a modified JSON copy of the real evaluated config. Output and exit code were captured for the merge base and for this branch, then compared with Node's runtime warnings removed.

Config variant Exit (base / head) Printed text
unmodified evaluated config 0 / 0 Expo config contract OK, identical
platforms: ["ios"] 1 / 1 identical
platforms: ["ios","android","web"] 1 / 1 identical
platforms: "ios,android" (not an array) 1 / 1 identical, no throw: the Array.isArray guard still short-circuits
blocked permissions, one dropped 1 / 1 identical
blocked permissions, one added 1 / 1 identical
blocked permissions, one swapped 1 / 1 identical
locale tags, one dropped 1 / 1 identical, naming the missing tag
locale tags, one extra 1 / 1 identical
locale tags, one swapped 1 / 1 identical, naming both tags
locale tags, one repeated 0 / 0 Expo config contract OK, identical
locale tags, one dropped and another repeated (same length) 1 / 1 identical, naming the missing tag
unknown locale tag added twice 1 / 1 identical, naming the tag twice

All thirteen variants produced byte-identical script output and the same exit code on both revisions; none differed, and the comparison covers every branch of the three changed checks.

The real path also ran on this branch:

cd apps/mobile && node scripts/assert-expo-config.mjs
# Expo config contract OK

oxfmt --list-different scripts/assert-expo-config.mjs reports no difference. apps/mobile lints only src, so the script is outside the lint job, as before.

Production prerequisites

None.

Rollout

Build-time guard only; no runtime, schema, secret, or configuration change. The release preflight runs this script as before.

Proxy answers

The owner's proxy gave these answers in the owner's place.

  1. Question: Test scope: The gate script apps/mobile/scripts/assert-expo-config.mjs has no unit test today (only the release-workflow text test). For this refactor, what should the permanent coverage be?
    Answer: No new test; keep the differential run as session evidence
    Confidence: 0.75 · Precedent: Speed and least work: "do the least amount of work possible, with no drop in quality"; scope: keep each PR diff to files the feature needs. The base-vs-head run on the valid config and the failing configs is the end-to-end proof; put it in the PR.
  2. Question: Duplicate tags: The refactor changes one reachable outcome: a duplicated language tag in the language list now failed the gate on this branch where the base passed it, and the failure message named no tag. How should this PR handle it?
    Answer: Restore exact base parity, dedupe before the check
    Confidence: 0.60 · Precedent: Keep the approved scope of a manual work item intact; the brief requires that every assertion outcome and message stay the same, so the refactor must not change behavior.

@iscekic iscekic added drain Work item from the findings drain janitor:maintainability Maintainability finding from the janitor labels Nov 16, 2026
@kilo-code-bot

kilo-code-bot Bot commented Nov 16, 2026 •

Copy link
Copy Markdown
Contributor

Code Review Summary

Status: No Issues Found | Recommendation: Merge

Executive Summary

The incremental change dedupes CFBundleLocalizations before the exact-set check, restoring base parity for repeated tags: with a duplicate-free localeTags from Object.keys, sameMembers(new Set(localizations), localeTags) is exactly the previous two-filter predicate, and the filters still name the offending tags from the original array.

Assumptions: [INFERENCE] none; the duplicate-tag parity claim was verified from the predicate logic in apps/mobile/scripts/assert-expo-config.mjs:262 and the unchanged filters at lines 259-260.

Files Reviewed (1 file)
  • apps/mobile/scripts/assert-expo-config.mjs
Previous Review Summary (commit c94ddb5)

Current summary above is authoritative. Previous snapshots are kept for context only.

Previous review (commit c94ddb5)

Status: No Issues Found | Recommendation: Merge

Executive Summary

The sameMembers helper is a correct set-equality predicate for all three call sites: PLATFORMS and BLOCKED_PERMISSIONS are duplicate-free literals, localeTags comes from Object.keys, and every actual keeps its array guard or ?? [] default.

Files Reviewed (1 file)
  • apps/mobile/scripts/assert-expo-config.mjs

Reviewed by deepseek-flash-latest · Input: 49.2K · Output: 3K · Cached: 219.9K

Review guidance: REVIEW.md from base branch main

@iscekic iscekic added the merge:bot Bot-owned review; merge when ready once readiness passes and a review approves. label Nov 16, 2026
The shared exact-set check counts members, so a repeated language tag in
CFBundleLocalizations would now fail where the previous filter-based test
accepted it. Compare the distinct tags, which keeps the assertion about which
languages are named rather than how often, and leaves every existing outcome
and message unchanged.
@iscekic
iscekic added this pull request to the merge queue Nov 16, 2026
Merged via the queue into main with commit b12e73a Nov 16, 2026
60 checks passed
@iscekic
iscekic deleted the drain/expo-config-set-check branch November 16, 2026 19:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

drain Work item from the findings drain janitor:maintainability Maintainability finding from the janitor merge:bot Bot-owned review; merge when ready once readiness passes and a review approves.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants