Repository navigation
fix(limrun): normalize variant iOS scalar attributes into snapshot text - #3641
Conversation
There was a problem hiding this comment.
All reported issues were addressed across 4 files
Reply with feedback, questions, or to request a fix.
View guided diff | Turn on auto-fix | Re-trigger cubic
Size Report
Startup median (7 runs, lower is better):
|
|
I found no code problems in 42ab240. The change turns numeric and boolean Limrun iOS attributes into snapshot text, and the shape now matches the Apple tree. CI is unclear. Coverage failed in run 38724559473 and I could not read its log, so I do not know the cause. That job runs the unit suites, which include the changed provider-limrun tests, so please check whether the failure comes from this diff. Lint, Typecheck, Integration, Repo Guards and two Smoke jobs pass. Compatibility & Provenance, CodeQL and three Smoke jobs were still pending or queued when I looked. Before merge, please clear the red Coverage job and let the pending checks finish. Not blocking, and you can take or leave these: the doc comment on scalarText in https://github.com/callstack/agent-device/blob/42ab240/packages/provider-limrun/src/snapshot.ts#L157 says it is "the same normalization" and "the one place". It only mirrors optionalScalar at https://github.com/callstack/agent-device/blob/42ab240/packages/platform-apple/src/snapshot-source/tree.ts#L402, and the two differ on non-scalar input (Apple throws, Limrun stringifies). Softening the comment would be enough. Also, one flattenIosTree case with a numeric AXLabel and AXUniqueId would cover the label and identifier reads at https://github.com/callstack/agent-device/blob/42ab240/packages/provider-limrun/src/snapshot.test.ts#L20. Two open inline threads from other reviewers still apply and are not blocking: #3641 (comment) (adapter test coverage gap) and #3641 (comment) (label and identifier tests). They are the same gap as the test note above. I did not run the tests locally or do a live Limrun run, so fidelity to real responses rests on the raw nodes pasted in the issue. I also could not tell whether anything downstream relied on Limrun sending an explicit selected:false. This change now omits it, like the Apple tree. |
The Limrun iOS elementTree is JSON, and iOS AXValue is a variant attribute: the system photo picker's segmented tabs report the numbers 1/0. The raw mapping forwarded the number into RawSnapshotNode.value, which every producer publishes as text, so a consumer trusting that contract (the React Native overlay pass calling ?.trim()) threw and failed the whole snapshot. Normalize label, value, and identifier at the provider seam, the way the Apple tree normalizes its guest scalars, and derive selected: true from the Selected trait the picker reports on a tapped photo, matching the shape the Apple tree publishes. Closes #3634
A variant scalar can arrive in any text attribute over the provider's untyped JSON channel, so the mapping test now asserts a numeric label and a boolean identifier, and the picker adapter fixture carries a numeric AXUniqueId through acquisition. Soften the scalarText comment: it mirrors the Apple scalar reader's published shape but stringifies unexpected types instead of throwing.
42ab240 to
1fc35b5
Compare
|
Rebased onto main at Coverage red was not this diff. Run 38724559473 failed on Since the base moved, I reran locally on the new head: Non-blocking notes, both taken in 1fc35b5:
On |
|
The earlier findings from the 42ab240 review are fixed at 1fc35b5. The code looks good to me. The picker fixture now carries AXUniqueId:12 and asserts identifier '12' through captureLimrunIosSnapshot. The mapping test now covers numeric label 42 and boolean identifier true. The diff touches only the pure JSON-to-RawSnapshotNode mapper in provider-limrun and the CHANGELOG. The Smoke Tests failure has no job log at this head, and another run is still queued. Smoke lanes drive local simulators and emulators, not Limrun, so I read the failure as unrelated to this change. The earlier Coverage failure came from a stale eager-closure-budget approval on main, also outside this diff. I did not run a live Limrun session or the tests locally. I rely on your report of 209 provider-limrun tests and check:affected passing. I also did not re-trace the selected:false consumers myself. Both cubic-dev-ai threads (#3641 (comment) and #3641 (comment)) are fixed at this head, so you can resolve them. Nothing is left to change. Let the queued Smoke Tests finish, or re-run the cancelled one, then this is ready to merge. |
Summary
snapshotfailed withe?.trim is not a functionon any Limrun iOS screen whose nodes report a numeric accessibility value — the system photo picker's segmented tabs reportAXValue1/0as JSON numbers. iOSAXValueis a variant attribute, but the Limrun raw mapping forwarded it verbatim intoRawSnapshotNode.value, which every producer publishes as text; consumers (react-native-overlay,snapshot-state) legitimately call?.trim()trusting that contract.The fix repairs the construction path, not the guards:
packages/provider-limrun/src/snapshot.tsnow normalizes label/value/identifier through onescalarTextreader — the same normalization the Apple tree applies to its guest scalars — and widensIosTreeNode's text fields to the JSON union the provider actually sends. The issue's "Related (minor)" is the same seam:Selectedintraitsnow publishesselected: true(omitted otherwise), the shape the Apple tree uses, so picked photos are visible andselected:selectors work. 3 files, no shared-consumer changes.Closes #3634
Validation
Head
42ab24006. Same script mapping the picker's{ AXLabel: 'Photos', AXValue: 1 }node and trimmingvalue(base8c01a3787| head):value: 1 typeof: number/trim threw: value?.trim is not a functionvalue: "1" typeof: string/trim: 1pnpm check:affected --run: all runnable checks passed (128 files, 798 tests).vitest run --project unit-core: 14,288 passed.checkedis not derived from numericAXValueandSelectedyieldsselected: undefined.