Skip to content

fix: tap with an ordinal + id-selector always misparsed (PT-26)#178

Merged
pbertsch merged 1 commit into
mainfrom
fix/pt26-ordinal-id-selector
Jul 7, 2026
Merged

fix: tap with an ordinal + id-selector always misparsed (PT-26)#178
pbertsch merged 1 commit into
mainfrom
fix/pt26-ordinal-id-selector

Conversation

@pbertsch

@pbertsch pbertsch commented Jul 7, 2026

Copy link
Copy Markdown
Member

Summary

The parser's ordinal-selector branch only checked for quoted text or a bare identifier after the ordinal, never an #id token -- so tap 1st #post_list_card left #post_list_card completely unconsumed, and it misparsed as a second, stray, unknown recipe call.

Fixed by accepting an id-selector after an ordinal too, preserving its # prefix in the selector's Text field.

Since Flutter itself enforces unique Keys among direct siblings, disambiguating repeated same-id rows by position also required a matching fix on the Dart agent side: the ordinal selector kind was hardcoded to always match by displayed text, never by id -- now it checks for the # prefix (matching the plain id selector kind's existing convention) and matches by key instead when present.

Test plan

  • go build ./..., go vet ./..., go test ./... all pass
  • staticcheck ./... clean
  • dart analyze lib/ clean, flutter test all pass (34 tests, including 2 new: a parser test and a Dart widget test)
  • Both new tests confirmed to fail against the pre-fix code, reproducing the exact reported error shape (parser) and the exact wrong finder behavior (Dart)
  • Real-device verification (iOS simulator): temporarily added a shared Semantics.identifier to e2e-test-workspace's repeated list rows, confirmed tap 1st #id and tap 2nd #id correctly land on the 1st/2nd row respectively (not just "doesn't error" -- verified actual positional correctness), then reverted the temporary app change

The parser's ordinal-selector branch only checked for quoted text or
a bare identifier after the ordinal, never an #id token - so
"tap 1st #post_list_card" left "#post_list_card" completely
unconsumed, and it misparsed as a second, stray, unknown recipe call.

Fixed by accepting an id-selector after an ordinal too, preserving
its "#" prefix in the selector's Text field.

Since Flutter itself enforces unique Keys among direct siblings,
disambiguating repeated same-id rows by position also required a
matching fix on the Dart agent side: the "ordinal" selector kind was
hardcoded to always match by displayed text, never by id - now it
checks for the "#" prefix (matching the plain "id" selector kind's
existing convention) and matches by key instead when present.

Confirmed via a parser test (checked to fail against the pre-fix
code, reproducing the exact reported error shape) and a Dart widget
test (checked to fail against the pre-fix finder.dart), plus
real-device verification: tapping "1st"/"2nd" against a real repeated
list correctly lands on the 1st/2nd row respectively, not just
"doesn't error."
@pbertsch pbertsch requested a review from a team as a code owner July 7, 2026 02:46
@pbertsch pbertsch added this pull request to the merge queue Jul 7, 2026
Merged via the queue into main with commit f4aa1a2 Jul 7, 2026
15 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant