Skip to content

fix(snapshot): name every iOS element type in the XCTest runner - #4897

Merged
thymikee merged 4 commits into
mainfrom
fix/xctest-element-type-names
Nov 21, 2026
Merged

thymikee merged 4 commits into
mainfrom
fix/xctest-element-type-names

Conversation

@thymikee

@thymikee thymikee commented Nov 21, 2026 •

Copy link
Copy Markdown
Member

Summary

The iOS XCTest runner named 32 of the 83 element types the SDK numbers and published every other one as Element(<rawValue>), while the Simulator AX bridge names all 83 — so one node carried two type values depending on which producer served the capture (#4657). The runner's table now covers every raw value, and contracts/fixtures/ios-element-type-names.json is the one table both producers mirror, each side pinned to it by its own parity test. The review's scroll-container finding is fixed here too: an indicator's own names are ruled out before the fragment match, so a runner-served ScrollBar is no longer read as a scroll container.

Before / after

A real UIPickerView wheel (raw value 39), one node captured twice:

  • before: bridge PickerWheel, runner Element(39)
  • after: both producers PickerWheel

Validation

  • Both producers are pinned to the shared table for every raw value. On iPhone 18 Pro they failed at origin/main's table (55 mismatches, including Element(39) vs PickerWheel) and pass at head.
  • Runner-served proof: snapshot --actions --json of the new --agent-device-picker-wheel fixture reports backends {"apple-runner":2} and "type": "PickerWheel" for the wheel node. A dispatched XCTest Nightly run on this branch runs the #if os(iOS) wheel test remotely.
  • macOS host lane: 436 runner tests, 0 failures. Contract, capture, selector and maestro suites: 6393 pass. swift test --package-path apple/snapshot-presentation: 51 pass. pnpm check:xctest-selection and pnpm format pass.

Fixes #4657

🤖 Generated with Claude Code


Run Proof on this PR
Open in [code]smith · Need help on this PR? Tag @codesmith-bot with what you need.

View guided diff Turn on auto-fix

The runner's element-type table covered 32 raw values and published every
other one as Element(<rawValue>), while the Simulator AX bridge names all 83,
so one node carried two types depending on which producer served the capture
(#4657). The table now covers every raw value the SDK numbers, and
contracts/fixtures/ios-element-type-names.json is the one table both producers
mirror, each side pinned by its own parity test.
The fixture host gains a UIPickerView screen behind
--agent-device-picker-wheel, and a simulator-lane test asserts the walk
publishes its wheel as PickerWheel. The alert-surface read now takes the
shared table's names directly: its Alert/Sheet override duplicated two rows
the table covers.
@github-actions

github-actions Bot commented Nov 21, 2026 •

Copy link
Copy Markdown
Contributor

Size Report

Metric Base Current Diff
Installed (including dependencies) 6.48 MB 6.48 MB +3.0 kB
Package (unpacked) 6.48 MB 6.48 MB +3.0 kB
Package (download) 1.97 MB 1.97 MB +515 B

Startup median (7 runs, lower is better):

Scenario Base Current Diff
CLI --version 17.7 ms 17.5 ms -0.2 ms
CLI --help 36.8 ms 37.0 ms +0.2 ms

@apex-sentinel-staging

This comment has been minimized.

@apex-sentinel-staging apex-sentinel-staging Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Apex Sentinel: 1 new finding on 804cb85. The verdict and the full list are in the summary comment.

@thymikee

Copy link
Copy Markdown
Member Author

The runner-side change at 804cb85 has no remotely checkable proof yet, so it needs one more piece of evidence before merge. The changed producer is the XCTest runner's elementTypeName. The only CLI device check in the PR body was served by the bridge, and the bridge table is unchanged, so that check would also show PickerWheel at base. The runner-side unit test is gated on os(iOS), PR CI does not run it, and the local receipt cannot be opened remotely. This leaves the issue's completion condition, a UIPickerView captured through XCTest reporting type PickerWheel, without checkable evidence. Please attach one of two things: a CLI snapshot --json of the picker-wheel fixture (or any UIPickerView screen) where snapshotDiagnostics.stats.backends names the apple-runner producer and the wheel node has type PickerWheel, or a link to an xctest-nightly (or manually dispatched) iOS Simulator run at 804cb85 showing testPickerWheelScreenPublishesTheNamedElementType passed.

Not blocking, and these can be taken or left: the fixture description in contracts/fixtures/ios-element-type-names.json says both producers spell an unnamed raw value Element(), but the bridge reads unknown numbers as Other, and it also names a vitest/Swift-compile check that no code performs; the runner target also builds for macOS and tvOS, so those captures rename Element(N) to names too, which the Summary could state as a maintainer decision or follow-up issue; and the ScrollBar scroll-container behavior in isScrollableType already exists for bridge and Linux captures, so a follow-up issue to exclude 'scrollbar' there is enough.

The inline thread on ScrollBar being treated as a scrollable type still applies as a non-blocking follow-up: #4897 (comment)

The failing Body rules check looks unrelated to the diff, which does not touch the gate or workflow, and the body is about 234 words against the 250 limit, so a rerun should pass. No conflicts. Not verified here: the Swift and vitest suites, the '55 mismatches' count, whether the 81 SDK cases compile on tvOS/visionOS/watch SDKs, and the Body rules job logs. Before merge, the runner-served PickerWheel capture must be attached and Body rules rerun.

The scrollable-type rule matches fragments, so a producer's subclass answers
for it — which is also why the runner publishing ScrollBar made a 3pt scroll
bar read as its own scroll container (#4657 review). isScrollableNodeLike
already excluded the indicator locally at two call sites and not at the owner,
so the exclusion moves there and both copies go away.

The golden table's description also overstated two things the code does not
do: the bridge reports Other for a raw value no row names, and nothing runs
the vitest/Swift-compile check it named. The runner's table serves every
runner platform, so the Swift comment says which captures the rename reaches.
@blacksmith-sh

This comment has been minimized.

isScrollIndicatorNode reached snapshotNodeKindIncludesAny with nullable fields the
shared helper does not accept, so CI's tsc rejected the new guard and the checks
that compile against the package failed with it. Both scroll predicates now take
the kernel's own node shape, the shape every caller already passes.
@apex-sentinel-staging

Copy link
Copy Markdown

Apex Sentinel · ✅ Approve · review of 7f7959e

Since the review of 804cb85: 0 new · 0 still open · 1 no longer raised (1 marked fixed)

No open findings.

1 finding below minor hidden (user_settings.min_severity).

Reviewed with this repository's own Sentinel configuration (721adbc6985f).

💬 Talking to Sentinel

In a finding's thread, reply with:

Command What it does
@apex-sentinel-staging note <context> Adds context; Sentinel re-checks the cited code
@apex-sentinel-staging pivot <why> Says the finding is wrong; Sentinel re-checks the cited code
@apex-sentinel-staging like Marks the finding as useful
@apex-sentinel-staging dislike <why> Marks it as not useful, so it is not raised again

On this conversation, comment @apex-sentinel-staging review to run a full review once again.

@thymikee

thymikee commented Nov 21, 2026 •

Copy link
Copy Markdown
Member Author

Runner-side proof at 7f7959e

snapshot --actions --json on the new --agent-device-picker-wheel fixture, iPhone 18 Pro simulator, served by the XCTest runner (not the bridge) — snapshotDiagnostics.stats.backends names the producer and the wheel node is PickerWheel:

{
  "snapshotDiagnostics": { "stats": { "backends": { "apple-runner": 2 } } },
  "wheelNode": {
    "index": 2,
    "type": "PickerWheel",
    "value": "First",

    "rect": { "x": 9, "y": 262.5, "width": 372, "height": 291 },
    "depth": 2,
    "ref": "e3",
    "kind": "pickerwheel"
  }
}

The same CLI path with origin/main's elementTypeNamesByRawValue compiled into the runner publishes Element(39) for that node; raw value 39 is the wheel's, and --actions is the request that routes the capture to apple-runner.

The #if os(iOS) wheel test also runs remotely: XCTest Nightly dispatched at 7f7959e runs the full iOS Simulator suite, which reaches testPickerWheelScreenPublishesTheNamedElementType.

@thymikee

Copy link
Copy Markdown
Member Author

This PR is ready at 7f7959e. The earlier ScrollBar and indicator finding from 804cb85 is fixed: isScrollableType now rules those spellings out before the scroll fragment match, and snapshot-scroll.test.ts pins isScrollableType('ScrollBar') === false. Nothing from that review remains open.

CI shows 20 checks with 0 failing at this commit, and the earlier 01-settings.ad replay failure was on a prior push. XCTest Nightly ran at 7f7959e and both iOS jobs passed. The runner-served claim rests on testPickerWheelScreenPublishesTheNamedElementType, which covers the runner tree walk but not the daemon to CLI route. Not verified here: the CLI snapshot JSON in the author comment, and Vitest and tsc locally. No conflicts.

Not blocking, and fine to take or leave: isScrollableType now matches on normalizeType(value) instead of value.toLowerCase(), so XCUIElementTypeTable and AXTable now answer scrollable and a dotted class with scroll only in its package path now answers no. Neither commit message names this. Naming it in the PR body, or pinning one normalized case in snapshot-scroll.test.ts, would cover it. Not verified here: whether any non-iOS producer publishes a dotted type whose scroll fragment appears only in the package path.

The earlier inline thread on ScrollBar and indicator spellings (#4897 (comment)) no longer applies, because the code now rules those out before the fragment match. It can be resolved.

@thymikee thymikee added the ready-for-human Valid work that needs human implementation, judgment, or maintainer merge label Nov 21, 2026
@thymikee
thymikee merged commit 2f580ca into main Nov 21, 2026
26 of 27 checks passed
@thymikee
thymikee deleted the fix/xctest-element-type-names branch November 21, 2026 15:28
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

1 participant