Skip to content

refactor(apple): reduce SnapshotPresentedSurface to the element-type rule the runner runs - #3632

Merged
thymikee merged 3 commits into
mainfrom
refactor/swift-presented-surface-element-type
Oct 15, 2026
Merged

thymikee merged 3 commits into
mainfrom
refactor/swift-presented-surface-element-type

Conversation

@thymikee

@thymikee thymikee commented Oct 15, 2026 •

Copy link
Copy Markdown
Member

Summary

Reduces the Swift SnapshotPresentedSurface to the element-type rule the runner actually runs, per the owner's note on #3579. The class-aware rule stays in TypeScript (collectPresentedSurface).

  • SnapshotPresentedSurface.swift drops from 260 to 37 lines. It keeps presentingElementTypes, the strict ASCII Element(<digits>) parse, and classify(_ acquisition:). It drops PresentedSurfaceNode, PresentedSurfaceCompleteness, classify(nodes:completeness:) and the class vocabulary. A repo-wide grep finds no other users.
  • No change in production output. The only caller (RunnerTests+SnapshotCapturePlan.swift:111) passed a RawAXNode acquisition, which mapped every node to className: nil. On that path the old rule could only answer presented (a presenting element type) or unknown. The new one-liner gives the same answers, and 19 of 19 golden cases match classBlindExpected.
  • The Swift parity test runs every fixture case through the acquisition entry point against classBlindExpected. All cases are kept. The TS test still checks both columns.
  • The fixture and TS comments are narrowed to the smaller Swift claim. No case or vocabulary changed.
  • chore(gates): the stale-row deletion is the follow-up refactor(maestro): shape the replay backend as a create(host) plugin #3623 left for the next PR off main.

6 files, +66/−357.

Validation

At a29eac862:

  • pnpm check (full gate): passes. 1,641 files and 14,296 tests pass, 1 skipped.
  • swift test in apple/snapshot-presentation: 22 tests pass. Breaking the Element(n) parse fails all 3 SnapshotPresentedSurfaceTests.
  • iOS runner built with AGENT_DEVICE_XCUITEST_INCLUDE_UNIT_TESTS=1 on an iPhone 17 simulator (iOS 27.1). 24 affected runner XCTests pass, including testSnapshotCaptureAssemblyClassifiesTheAcquisitionItPresented and testResolvedBlockingSystemModalPayloadStatesAPresentedSurface.
  • pnpm check:xctest-selection and pnpm check:packaged-runner-swift pass.

View guided diff Turn on auto-fix

…rule the runner runs

The runner's only caller classifies a RawAXNode acquisition, which carries no
UIKit class name, so the class-aware branch never ran in production. Keep the
element-type vocabulary, the strict Element(<digits>) parse, and the
acquisition entry point; the Swift parity test now checks every golden case
against classBlindExpected. The TypeScript rule and its two-column parity test
are unchanged.
#3623 put the entry on main, so the merge-base now carries it and the
no-growth rule governs it; the stale-row check asks the next PR to remove it.
@github-actions

github-actions Bot commented Oct 15, 2026 •

Copy link
Copy Markdown
Contributor

Size Report

Metric Base Current Diff
Installed (including dependencies) 5.25 MB 5.24 MB -12.0 kB
Package (unpacked) 5.25 MB 5.23 MB -12.0 kB
Package (download) 1.58 MB 1.57 MB -3.5 kB

Startup median (7 runs, lower is better):

Scenario Base Current Diff
CLI --version 27.2 ms 27.1 ms -0.2 ms
CLI --help 77.1 ms 77.0 ms -0.1 ms

@cubic-dev-ai cubic-dev-ai Bot left a comment •

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

All reported issues were addressed across 6 files

Reply with feedback, questions, or to request a fix.

View guided diff | Turn on auto-fix | Re-trigger cubic

Comment thread contracts/fixtures/ios-presented-surface.json Outdated
@thymikee

Copy link
Copy Markdown
Member Author

The code at 945f68c looks good. Not blocking: commit a29eac8 also deletes the replay-maestro-backend row in scripts/tests/eager-closure-budgets.ts, a gate cleanup left over from #3623 that does not belong to this change, so keep it as its own commit or land it separately, and take or leave this as you see fit.

All 19 checks pass at that commit. GitHub reports merge conflicts with main, so please refresh the branch against main before merge; no review change is needed after that. I did not run swift test, the runner XCTests, or the Element(n) parse mutation, so those results are as you reported them.

The one lower-priority thread that applied is fixed at this head, so please resolve it: #3632 (comment)

@thymikee

Copy link
Copy Markdown
Member Author

The merge conflict is gone and 945f68c is unchanged, so the earlier review stands: the code looks good and all checks pass. This is ready for a human review.

@thymikee thymikee added the ready-for-human Valid work that needs human implementation, judgment, or maintainer merge label Oct 15, 2026
@thymikee
thymikee merged commit 76c1c36 into main Oct 15, 2026
19 checks passed
@thymikee
thymikee deleted the refactor/swift-presented-surface-element-type branch October 15, 2026 13:54
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.

1 participant