Skip to content

fix(ios): recognize the system prompts' Chinese wording on a physical device - #4859

Merged
thymikee merged 4 commits into
callstack:mainfrom
strzhao:community-alert-localized-labels
Nov 24, 2026
Merged

thymikee merged 4 commits into
callstack:mainfrom
strzhao:community-alert-localized-labels

Conversation

@strzhao

@strzhao strzhao commented Nov 20, 2026 •

Copy link
Copy Markdown
Contributor

Summary

alert accept/dismiss on a physical iOS device refused a Chinese permission prompt with ALERT_BUTTON_NOT_FOUND: the localized vocabulary (#4006) is the simulated OS's prompt strings; a device keeps those strings from the runner process, so the non-simulator build compiled system as English-only. The device build now carries a built-in table of the system prompts' Simplified Chinese wording; each entry pairs an English label with its localized wording, so a localized prompt ranks like its English original. The simulator still reads the OS strings for every preferred language; English is unchanged. The table grows only with device-confirmed wording.

Before / after

# zh-CN device, notification prompt ["不允许", "允许"]
alert dismiss   # before: ALERT_BUTTON_NOT_FOUND, nothing tapped
alert dismiss   # after: taps 不允许

# zh-CN device, location prompt ["仅本次允许", "仅在使用期间允许", "不允许"]
alert accept    # after: taps 仅在使用期间允许 (the lasting grant outranks 仅本次允许)

Guards and tests

#3627 holds unchanged: a row's source must be a whole preference label, a localized label resolves only for its source's action, and an entry both actions claim stays neutral, separate from #4526. Four table-driven tests in UnitTests/RunnerTests+AlertLabelVocabularyTests.swift run on every lane; a device-gated one pins system == device on the macOS host lane. check:xctest-selection reports 0 methods reachable by no lane.

Validation

tsc -b tsconfig.typecheck.json, command-surface suite 292, runner-tree guards 63, check:command-docs green. check:affected is green through format/lint/typecheck; its layering ratchet reads the private fork as origin/main, so the same layering rules were evaluated against old-origin/main: 0 violations. Swift behavior was verified by compiling the two sources and running 34 table assertions. Device evidence deferred per repo convention. CI is green here except this body rule; the first Coverage round tripped on the search hint repeating a description word.

🤖 Generated with Claude Code

@thymikee

Copy link
Copy Markdown
Member

Thanks for taking on the device wording gap.

At 599cd13, three rows in the device table do not match what iOS shows, so the fix does not yet work for location accept and ATT dismiss.

deviceTranslations hand-types three labels that differ from Apple's zh_CN strings (checked in the iOS 27.1 simulator runtime). Apple ships "Allow While Using App" as 使用App时允许 (the PR has 仅在使用期间允许), "Allow Once" as 允许一次 (the PR has 仅本次允许), and "Ask App Not to Track" as 要求App不追踪 (the PR has 要求 App 不跟踪, with a different verb and spaces, and normalization trims only the ends). On a zh-Hans device, alert accept on the location prompt [允许一次, 使用App时允许, 不允许] matches no accept pattern and answers ALERT_BUTTON_NOT_FOUND. alert dismiss on the ATT prompt [要求App不追踪, 允许] also refuses. Nothing taps the wrong button, but the issue's goal fails for these two prompts. Only the notification prompt and the generic OK/Cancel/Open rows work. The rule to satisfy: every deviceTranslations row must equal the value Apple ships for that key in zh_CN. Please enforce it in one simulator-lane test that asserts each row is a pair in fromSystemStrings(languages: ["zh-Hans"]) (or in the RunnerSystemPromptStrings.read output), then correct the three rows.

This changes alert accept/dismiss on physical iOS, and the PR body says the device evidence is deferred. Please run on a physical iPhone with Simplified Chinese as the preferred language, through the CLI, before merge: (1) notification prompt: alert get shows [不允许, 允许], alert dismiss succeeds, and the app's notification authorization reads denied; (2) location prompt: alert get shows the verbatim labels, alert accept taps 使用App时允许, and status reads authorizedWhenInUse; (3) ATT prompt: alert dismiss taps 要求App不追踪 and tracking status reads denied. Please paste the verbatim alert get labels into the PR.

Could a smaller fix work? The premise that a device runner cannot read the OS string files has no evidence yet. The reader resolves root from Foundation's bundle path, which on a device should be /System/Library/Frameworks/Foundation.framework, so root is empty. The listed bundles (UserNotificationsServer, TCC, CoreLocation, CoreServices) live under /System/Library, which app sandboxes can usually read. Would widening the gate to os(iOS) (simulator and device), with the existing fallback of English plus the AGENT_DEVICE_RUNNER_ALERT_VOCABULARY_UNAVAILABLE log when the source is unreadable, cover every language with Apple's own wording and add no table? One live run of RunnerSystemPromptStrings.read on a physical iPhone (logging success or the unavailable source) decides between the two designs. If the read fails, keep the table and pin each row to the simulator's zh_CN strings as above.

Not blocking, and these can be taken or left: the new tests build their fixtures from the table's own strings, so they pass with any wording and could use labels read from the OS zh_CN vocabulary instead; and the #else branch of os(iOS) && targetEnvironment(simulator) also covers the macOS runner build and tvOS, visionOS and watch targets, while the help names only a physical iOS device, and the table applies whatever the device language is (an English device showing a Chinese app's own alert would match 取消/好/打开 at their English roles), so naming those populations in one sentence or gating the table to os(iOS) would help.

The code needs the changes above before it can merge. The failing body-rules check (it reported 464 words outside code blocks, with a limit below 250) is likely unrelated: it grades only the PR title and body, and the code diff does not overlap its route. The current body counts about 244 words by the script's rule, so the check should pass on the edited body, and if it stays red it can be re-run or the body trimmed. There are no conflicts. Before merge, the wording rows must match Apple's zh_CN strings behind the simulator-lane test, and the live zh-Hans physical-device run must be posted.

Not verified here: Apple's wording was checked against the local iOS 27.1 simulator runtime's zh_CN string tables, not a physical device, and older iOS versions were not checked. Not verified here: whether a physical-device runner can read the /System/Library string bundles, whether the macOS runner build reaches chooseAlertButton with .system, and the Swift unit tests and check:xctest-selection were not run.

@thymikee

Copy link
Copy Markdown
Member

This head (599cd13) now conflicts with main. Please rebase onto main and push; the rebased head gets a delta review.

strzhao and others added 2 commits November 23, 2026 23:27
… device

On a physical iOS device, `alert accept`/`dismiss` refused a Chinese
permission prompt with ALERT_BUTTON_NOT_FOUND, because the label
vocabulary is only the OS prompt strings of a simulated OS (callstack#4006): a
device's runtime keeps its framework string files from the runner
process, so the non-simulator build compiled `system` as the English
vocabulary.

The device build now carries a built-in table of the system prompts'
Simplified Chinese wording instead: the notification, App Tracking
Transparency, and location prompts' buttons, the general-purpose 好/取消
pair, and the launch confirmation's 打开. Each entry pairs an English
button label with its localized wording, so the localized label ranks
exactly like the English original — 仅在使用期间允许 outranks 仅本次允许.
The callstack#3627 guards hold unchanged: a source must be a whole button label,
and a translation both actions claim stays unknown. English resolution
is untouched, and the simulator keeps reading the OS strings for every
preferred language. The table grows only with wording a device really
shows, so it starts at Simplified Chinese and other languages stay
unknown until device evidence names them.

Co-Authored-By: Claude Code <noreply@anthropic.com>
The device-coverage sentence puts the word "system" in the alert
description, so the "dialog system" search hint no longer adds a word
the text lacks; `command-tools-loading-meta`'s hint contract fails on
the repeat. "system" stays searchable through the description itself,
so the hint keeps "dialog" only.

Co-Authored-By: Claude Code <noreply@anthropic.com>
@strzhao
strzhao force-pushed the community-alert-localized-labels branch from 599cd13 to 511e50c Compare November 23, 2026 15:32
@strzhao

strzhao commented Nov 23, 2026

Copy link
Copy Markdown
Contributor Author

Rebased onto 0d38f89b11da104135211891157fbbd8b4318f77 (current upstream main); new head 511e50c87498ac73f67eb31b837b6446e1a8c855, pushed with --force-with-lease. No conflicts: the only overlapping file (website/docs/docs/commands.md) merged cleanly, and the full patch vs main is byte-identical to the pre-rebase patch except hunk line numbers. Gates: check:affected --run green through format/lint/typecheck; its layering ratchet still reads the private fork as origin/main and fails identically (11 violations, byte-identical list) when run at the upstream base itself, so none are introduced here; tsc -b tsconfig.typecheck.json examples/sdk/tsconfig.json exit 0.

@thymikee

Copy link
Copy Markdown
Member

Thanks for the update.

At 511e50c, the checks show 16 passing and none failing, and no conflicts are known. The code still has the two problems from the earlier review (#4859 (comment)), so it is not ready to merge.

Three deviceTranslations rows still differ from the zh_CN strings Apple ships (RunnerAlertLabelVocabulary.swift#L52). The iOS 27.0 simulator runtime has 使用App时允许, 允许一次 and 要求App不追踪. The table has 仅在使用期间允许, 仅本次允许 and 要求 App 不跟踪. On a zh-Hans physical device, alert accept on the location prompt [允许一次, 使用App时允许, 不允许] matches no accept row and returns ALERT_BUTTON_NOT_FOUND. alert dismiss on the tracking prompt [要求App不追踪, 允许] refuses too. The issue asks for these prompts to be recognized on a physical device, and the help and docs promise it. The rule is that every deviceTranslations row equals the value Apple ships for that key in zh_CN. Please add one simulator-lane test that asserts each row is a pair in fromSystemStrings(languages: ["zh-Hans"]) (or RunnerSystemPromptStrings.read), then correct the three rows. Could the OS-string read be widened to os(iOS) instead, if a device run shows the bundles are readable? That would let the table be deleted.

This change alters alert accept and alert dismiss on a physical iPhone, and no live device run is posted yet (RunnerAlertLabelVocabulary.swift#L112). Both the table wording and the premise that a device cannot read the OS strings are unproven. A live run is required before merge. On a physical iPhone with Simplified Chinese preferred, please run these through the CLI and paste the verbatim alert get output for each. (1) Notification prompt: alert get shows [不允许, 允许], alert dismiss succeeds, and authorization reads denied. (2) Location prompt: alert accept taps 使用App时允许, and status reads authorizedWhenInUse. (3) Tracking prompt: alert dismiss taps 要求App不追踪, and tracking status reads denied.

Not verified here: the Apple wording was checked against the iOS 27.0 simulator runtime only (CoreLocation locationd.strings and TCC), not a physical device or older iOS versions. Not verified here: whether a physical-device runner can read the /System/Library string bundles. Not verified here: the Swift unit tests and check:xctest-selection were not run locally.

Before merge, correct the three rows behind that simulator-lane test and post the zh-Hans physical-device run.

The three hand-typed rows drifted from Apple's zh_CN wording (使用App时允许,
允许一次, 要求App不追踪): on a zh-Hans device the location accept and the ATT
dismiss matched no row and answered ALERT_BUTTON_NOT_FOUND. The rows now
equal the OS strings, and a simulator-lane test pins every deviceTranslations
row to a pair in fromSystemStrings(["zh-Hans"]) so the table cannot drift
from the OS wording again; the vocabulary keeps the handed-in rows for it.
@thymikee

Copy link
Copy Markdown
Member

Thanks for the follow-up. Reviewed commit 3ad0a51 addresses the earlier findings (#4859 (comment)) in the simulator path, but one problem remains.

The non-simulator build sets system = device, so alert accept and dismiss on a physical iPhone now rank buttons through the built-in zh table (https://github.com/callstack/agent-device/blob/3ad0a51/apple/runner/AgentDeviceRunner/AgentDeviceRunnerUITests/RunnerAlertLabelVocabulary.swift#L112). That table is pinned to the simulator runtime's strings, and it is not shown that a device runner cannot read the OS string bundles. No live physical-device run is posted at this head, so the issue's goal of recognition on a physical device is not demonstrated. Please run, on a physical iPhone with Simplified Chinese preferred and through the CLI, and post the verbatim output for three prompts. First, the notification prompt: alert get shows [不允许, 允许], alert dismiss succeeds, and authorization reads denied. Second, the location prompt: alert get labels, then alert accept taps 使用App时允许 and status reads authorizedWhenInUse. Third, the ATT prompt: alert dismiss taps 要求App不追踪 and tracking status reads denied.

CI is green: 15 checks, 0 not passing at 3ad0a51. There are no conflicts. Not verified here: the new simulator-lane test was not run, and it is not confirmed that the PR iOS lane executed it at this head rather than only the nightly lane. Not verified here: older iOS versions and physical devices; Apple's zh_CN wording came from the earlier simulator-runtime check. The live zh-Hans physical-iPhone run above is required before merge.

…S versions show

A zh-Hans iPhone 12 Pro Max on iOS 18.1 words the ATT decline 要求App不跟踪;
the iOS 26.5-27.x zh_CN string tables the earlier simulator check pinned ship
要求App不追踪. The table carried only the newer wording, so alert dismiss on
the device answered ALERT_BUTTON_NOT_FOUND having tapped nothing. The table
now carries both rows, the zh-Hans pairs test keeps asserting every row equals
a pair this lane's OS ships except the cross-version wording it pins by
presence, and the device evidence doc records the three prompts' verbatim
alert get labels with the accept/dismiss outcomes and authorization
read-backs. A probe read on the device also answers the review's question:
the OS string tables are present on device but their localizations are not
readable, so widening the OS-string read to os(iOS) cannot replace the table.
@thymikee

Copy link
Copy Markdown
Member

Thanks for the follow-up. The one added row and its test at 79ef17b close the live-evidence gap from the earlier review (#4859 (comment)), and no new problems were found. All 15 checks pass at this commit and no conflicts are known, so the PR can merge. Not verified here: the notification and location runs were done at 3ad0a51 and the ATT fix run on the author's working tree, but the only production change since is the added row, so those results carry over. Not verified here: the authorization read-backs come from the probe app's status label as reported in the evidence doc, and only the iOS 18.1 device and iOS 26.5-27.x simulator wordings are attested, so other iOS versions' zh_CN wording was not checked. Not verified here: the Swift unit tests were not run locally; CI is green.

@thymikee thymikee added the ready-for-human Valid work that needs human implementation, judgment, or maintainer merge label Nov 24, 2026
@thymikee
thymikee merged commit c543a26 into callstack:main Nov 24, 2026
15 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ready-for-human Valid work that needs human implementation, judgment, or maintainer merge

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants