Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -50,9 +50,10 @@ extension RunnerAlertLabelVocabulary {
// Notification and privacy prompts.
("Allow", "允许"),
("Don’t Allow", "不允许"),
// App Tracking Transparency. iOS words the decline button two ways: iOS 26–27's zh_CN
// ships 要求App不追踪 and iOS 18.1's zh_CN (a physical iPhone 12 Pro Max, 2026-11-24)
// ships 要求App不跟踪; the table carries both, so either device wording resolves.
// App Tracking Transparency. zh_CN words the decline button two ways, and each OS build ships
// one: 要求App不跟踪 (iOS 18.1, a physical iPhone 12 Pro Max) and 要求App不追踪 (iOS 27.0 and
// 27.1, read from their TCC runtime images). The table carries both, so either wording resolves;
// the evidence doc attributes each row to the run or image that shows it.
("Ask App Not to Track", "要求App不追踪"),
("Ask App Not to Track", "要求App不跟踪"),
// Location.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,15 +58,18 @@
}

/// A Chinese device words the notification, tracking, and location prompts in labels no English
/// entry matches, which answered ALERT_BUTTON_NOT_FOUND before the built-in table.
/// entry matches, which answered ALERT_BUTTON_NOT_FOUND before the built-in table. Shipped iOS
/// versions word the tracking decline two ways, so the same prompt is resolved for each wording.
func testChineseDeviceVocabularyResolvesTheSystemPermissionPrompts() {
let notifications = ["不允许", "允许"]
XCTAssertEqual(RunnerAlertButtonChoice.buttonIndex(for: notifications, action: "dismiss", vocabulary: .device), 0)
XCTAssertEqual(RunnerAlertButtonChoice.buttonIndex(for: notifications, action: "accept", vocabulary: .device), 1)

let tracking = ["要求App不跟踪", "允许"]
XCTAssertEqual(RunnerAlertButtonChoice.buttonIndex(for: tracking, action: "dismiss", vocabulary: .device), 0)
XCTAssertEqual(RunnerAlertButtonChoice.buttonIndex(for: tracking, action: "accept", vocabulary: .device), 1)
for decline in ["要求App不跟踪", "要求App不追踪"] {
let tracking = [decline, "允许"]
XCTAssertEqual(RunnerAlertButtonChoice.buttonIndex(for: tracking, action: "dismiss", vocabulary: .device), 0, decline)
XCTAssertEqual(RunnerAlertButtonChoice.buttonIndex(for: tracking, action: "accept", vocabulary: .device), 1, decline)
}

let location = ["允许一次", "使用App时允许", "不允许"]
XCTAssertEqual(RunnerAlertButtonChoice.buttonIndex(for: location, action: "dismiss", vocabulary: .device), 2)
Expand Down Expand Up @@ -114,31 +117,35 @@

#if AGENT_DEVICE_RUNNER_UNIT_TESTS && os(iOS) && targetEnvironment(simulator)
extension RunnerTests {
/// Every built-in device row is a pair the OS itself ships: the row equals one (english,
/// localized) pair in `fromSystemStrings(languages: ["zh-Hans"])`, so a row can never drift from
/// the wording a zh-Hans device shows — except a wording the table carries for another shipped
/// iOS version's zh_CN (`versionedRows`): the OS of the lane this test runs on words that
/// prompt one way, and the physical-device run that pinned the other row ran on an OS whose
/// string files this lane cannot read. The read must also succeed — a failed read would make
/// this assertion vacuous — which the unwrapped table guarantees.
func testDeviceVocabularyRowsArePairsTheOSShipsForZhHans() throws {
let system = RunnerAlertLabelVocabulary.fromSystemStrings(languages: ["zh-Hans"])
let osPairs = system.rows.map { ($0.english, $0.localized) }
XCTAssertFalse(osPairs.isEmpty, "the OS string read answered nothing, so the rows are unverified")
let versionedRows: Set<String> = ["要求App不跟踪"]
for row in RunnerAlertLabelVocabulary.deviceTranslations where !versionedRows.contains(row.localized) {
/// Every row of the built-in table is a pair this runtime's zh_CN strings ship, except the two
/// wordings listed here, each shown by a different build.
///
/// zh_CN words the App Tracking Transparency decline two ways and one build shows one of them:
/// 要求App不跟踪 on the iOS 18.1 iPhone 12 Pro Max run, 要求App不追踪 in the iOS 27.0 and 27.1
/// runtime images, read from TCC's `REQUEST_ACCESS_DENY_kTCCServiceUserTracking`
/// (`docs/evidence/ios-zh-hans-att-wording-os-builds-2026-11-28.md`). They differ in one character,
/// so normalization cannot bridge them and the table keeps a row for each. One runtime's read can
/// pair at most one, so both are exempted here. The Chinese prompt test holds both rows and compiles
/// into the nightly iOS bundle, so the exemption cannot hide a dropped row. Run 46108117499 is what
/// the unexempted form reached: it failed 要求App不追踪 on the pinned
/// iOS 26.2 runtime, whose strings nothing here has read, proving only that the wording was not
/// that build's. Every other row stays held to this runtime's own strings, on a read asserted
/// non-empty.
func testDeviceVocabularyRowsArePairsTheOSShipsForZhHans() {
let observedWordings: [(english: String, localized: String)] = [
("Ask App Not to Track", "要求App不跟踪"),
("Ask App Not to Track", "要求App不追踪")
]
let osRows = RunnerAlertLabelVocabulary.fromSystemStrings(languages: ["zh-Hans"]).rows
XCTAssertFalse(osRows.isEmpty, "the OS string read answered nothing, so the rows are unverified")
for row in RunnerAlertLabelVocabulary.deviceTranslations {
if observedWordings.contains(where: { $0.english == row.english && $0.localized == row.localized }) { continue }
XCTAssertTrue(
osPairs.contains { $0.0 == row.english && $0.1 == row.localized },
osRows.contains(where: { $0.english == row.english && $0.localized == row.localized }),
"\(row.english) → \(row.localized) is not a pair the OS ships in zh-Hans"
)
}
for wording in versionedRows {
XCTAssertTrue(
RunnerAlertLabelVocabulary.deviceTranslations.contains { $0.localized == wording },
"the cross-version zh_CN wording \(wording) a physical device showed is missing from the table"
)
}
}

Check warning on line 148 in apple/runner/AgentDeviceRunner/AgentDeviceRunnerUITests/UnitTests/RunnerTests+AlertLabelVocabularyTests.swift

View check run for this annotation

apex-sentinel-staging / Apex Sentinel

minor: zh-Hans check no longer proves each exempted wording is a row the table carries

Deleting a row like `("Ask App Not to Track", "要求App不追踪")` from `deviceTranslations` now passes `testDeviceVocabularyRowsArePairsTheOSShipsForZhHans` silently: the matching `observedWordings` entry simply matches nothing and no assertion notices. The base's second loop enforced that each exemption entry corresponds to an actual table row; head replaced it with a hand-maintained `observedWordings` literal with nothing tying it back. The exemption direction also stays open: an entry that names a row nobody has read remains forever and exempts any future row with the same pair.
Comment thread
thymikee marked this conversation as resolved.
Resolved

/// The OS's own strings supply the translations: a Japanese device words the notification,
/// tracking, and location prompts in labels no English entry matches.
Expand Down
89 changes: 89 additions & 0 deletions docs/evidence/ios-zh-hans-att-wording-os-builds-2026-11-28.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,89 @@
# The zh-Hans App Tracking Transparency decline, per OS build, 2026-11-28

Evidence for #5117. The built-in table carries two Simplified Chinese wordings of the App Tracking
Transparency decline. Each one needs the OS build and the source it came from, because a run of the
runner sees one build's strings at a time and cannot tell whether the other wording exists.

## The observed wordings

| zh_CN wording | Code points | OS build | Source of the string |
| --- | --- | --- | --- |
| 要求App不跟踪 | 跟 U+8DDF, 踪 U+8E2A | iOS 18.1 | the button label on screen: iPhone 12 Pro Max (iPhone13,4), UDID `00008101-001E34993A7A001E`, `alert get` returned `["要求App不跟踪", "允许"]` — `ios-zh-hans-device-alert-runs-2026-11-24.md` §3 |
| 要求App不追踪 | 追 U+8FFD, 踪 U+8E2A | iOS 27.0 build `24A5423a`, iOS 27.1 build `24A94401` | `plutil -convert json` on each runtime image's `System/Library/PrivateFrameworks/TCC.framework/zh_CN.lproj/Localizable.strings`, key `REQUEST_ACCESS_DENY_kTCCServiceUserTracking` |
| not 要求App不追踪 | — | iOS 26.2 build `23C54` | XCTest Nightly's own assertion output (below) |

The 27.x read, on both images:

```
REQUEST_ACCESS_DENY_kTCCServiceUserTracking = 要求App不追踪
REQUEST_ACCESS_ALLOW_kTCCServiceUserTracking = 允许
```

The wordings differ in the seventh character alone: 追 U+8FFD against 跟 U+8DDF, both followed by
踪 U+8E2A. The vocabulary compares trimmed, lowercased labels, so no normalization bridges them. A
device that shows one matches only a row that carries that exact wording. That is why the table keeps
two rows for `Ask App Not to Track` rather than one.

## What the failing lane proved

XCTest Nightly run
[46108117499](https://github.com/callstack/agent-device/actions/runs/46108117499) (main
`f0b3cb68468555604a2885184685e39477b98252`), job `iOS Runner Full XCTest Suite (iPhone full
suite)`:

```
RunnerTests+AlertLabelVocabularyTests.swift:130: error: -[… testDeviceVocabularyRowsArePairsTheOSShipsForZhHans]
: XCTAssertTrue failed - Ask App Not to Track → 要求App不追踪 is not a pair the OS ships in zh-Hans
```

The same assertion fails on all four scheduled main runs since the test landed: 45547608570,
45755993894, 45940665731 and 46108117499. Each booted the runtime the workflow pins:

```
Selected iPhone 17 Pro (…) from com.apple.CoreSimulator.SimRuntime.iOS-26-2
{ platform:iOS Simulator, arch:arm64, …, OS:26.2, name:iPhone 17 Pro } build 23C54
```

Two things follow from that run's output. The read succeeded: the job reported exactly one failing
row, and the assertion's loop skipped the 跟踪 row, so the other seven rows are pairs of iOS 26.2's
zh_CN strings. And iOS 26.2 ships no `要求App不追踪` pair for that key. The run names the row it
could not find; it does not name the wording 26.2 does ship, and no 26.2 string file was read here,
so this document does not claim one.

The preceding scheduled run, 45327248552 (2026-11-24, main `ecb2089867`), passed on the same 26.2
runtime. `git merge-base --is-ancestor` settles the difference: `ecb2089867` is not a descendant of
`c543a2604f` (#4859), which added this assertion together with the 要求App不追踪 row, and the first
failing commit `b2d4ec0511` is. The lane's OS never changed; the assertion arrived.

## Why the CI check cannot require every row to be this lane's pair

`testDeviceVocabularyRowsArePairsTheOSShipsForZhHans` is compiled only for a simulated iOS, so each
run sees one build's pairs. A label that shipped two wordings across shipped builds can be a pair of
at most the builds that word it that way. Requiring every row to be this lane's pair therefore fails a
row the table has to keep — which is exactly the failure above, reached one day after #4859 merged.

Both wordings are therefore listed in the check as observed rather than compared to the lane, and the
check keeps holding the other seven rows — the notification and location pairs, the general-purpose
`OK`/`Cancel` rows, and SpringBoard's `Open` row — to this runtime's own strings, on a read asserted
non-empty. Recognition of each observed wording is not left to that exemption:
`testChineseDeviceVocabularyResolvesTheSystemPermissionPrompts` resolves the tracking prompt through
`.device` for both wordings, and its guard is `#if AGENT_DEVICE_RUNNER_UNIT_TESTS` alone, so it
compiles into the nightly iOS bundle, where run 46143098360 executed it, and into the macOS host
bundle. The host lane runs the suite in full, but Apple CI gates that lane on its macOS impact
selector and skips it for a draft, so the nightly, not the host lane, is where both wordings are
proven on every change to the runner. A dropped row fails the prompt test there, so the exemption in
the zh-Hans check cannot hide one.

A per-build attested set was the other option: assert that a wording the table carries beyond the
lane's own pairs is one some named build ships. It adds nothing here. The set of observed wordings is
already closed by the two rows and pinned by the prompt test, so the set and the table would be two
names for the same list.

## What the check does not catch

The two exempted rows are not compared to the lane's strings, so the check cannot confirm which
build ships which of them: a table that attributes 要求App不跟踪 to a build reading 追踪 stays green.
Only a device or runtime image can decide that attribution, and each of the two here comes from one
that did. A third, unobserved wording is still caught, because it is exempted by no entry: planted
as `要求App不追中`, it failed this check on the iOS 27.0 runtime. Dropping either observed row fails
the prompt test, which the nightly lane runs.
5 changes: 4 additions & 1 deletion docs/evidence/ios-zh-hans-device-alert-runs-2026-11-24.md
Original file line number Diff line number Diff line change
Expand Up @@ -58,10 +58,13 @@ $ agent-device alert dismiss --json
# run repeated after the fix.
```

The device words the decline button 要求App不**跟踪**, iOS 26.5–27.x's zh_CN
The device words the decline button 要求App不**跟踪**, iOS 27.0–27.1's zh_CN
ships 要求App不**追踪** (TCC `REQUEST_ACCESS_DENY_kTCCServiceUserTracking`, read
off the CoreSimulator runtime images): a version split no single-runtime
`fromSystemStrings` read can see. The table now carries both rows.
(The "26.5–27.x" range first written here was too wide: the pinned iOS 26.2 CI
runtime ships no 追踪 pair. See `ios-zh-hans-att-wording-os-builds-2026-11-28.md`
for what each build shows.)

After the fix (table carries both wordings, same head otherwise):

Expand Down
Loading