Commit a0315da
authored
fix(agentic): deduplicate forwarded test ID targets (MetaMask#35762)
## **Description**
React can forward one `testID` and press handler through several fibers.
`pressTestId` now collapses only nested matches that share the same
handler, disabled state, and measured native target. Distinct nested or
sibling controls remain ambiguous and fail closed.
## **Changelog**
CHANGELOG entry: null
## **Related issues**
Refs: https://consensyssoftware.atlassian.net/browse/TAT-3919
Follow-up to MetaMask#35746 and
MetaMask/experimental-metamask-harness#207.
## **Manual testing steps**
```gherkin
Feature: Agentic press target resolution
Scenario: Press a test ID forwarded through nested React fibers
Given a Mobile dev build exposes one control through nested fibers
When a Recipe v1 flow presses the forwarded test ID
Then the control is pressed exactly once
And distinct nested controls remain ambiguous
```
Validation:
- `yarn jest app/dev-tools/AgenticService/AgenticService.test.ts
--no-coverage`
- `yarn lint:tsc`
- `yarn eslint --quiet app/dev-tools/AgenticService/AgenticService.ts
app/dev-tools/AgenticService/AgenticService.test.ts`
- Live iOS advanced-order recipe: 134/134 nodes passed on commit
`9c7554f2bf` source.
## **Screenshots/Recordings**
### **Before**
N/A. This changes a development-only control bridge.
### **After**
N/A. The bridge has no visible UI. Live iOS proof showed an active TWAP
card, a Chase row at `Running · 0%`, and all three Scale child orders.
## **Pre-merge author checklist**
- [x] I've followed [MetaMask Contributor
Docs](https://github.com/MetaMask/contributor-docs) and [MetaMask Mobile
Coding
Standards](https://github.com/MetaMask/metamask-mobile/blob/main/.github/guidelines/CODING_GUIDELINES.md).
- [x] I've completed the PR template to the best of my ability
- [x] I've included tests if applicable
- [x] I've documented my code using [JSDoc](https://jsdoc.app/) format
if applicable
- [x] I've applied the right labels on the PR (see [labeling
guidelines](https://github.com/MetaMask/metamask-mobile/blob/main/.github/guidelines/LABELING_GUIDELINES.md)).
Not required for external contributors.
#### Performance checks (if applicable)
- [x] I've tested on Android
- Ideally on a mid-range device; emulator is acceptable
- [x] I've tested with a power user scenario
- Use these [power-user
SRPs](https://consensyssoftware.atlassian.net/wiki/spaces/TL1/pages/edit-v2/401401446401?draftShareId=9d77e1e1-4bdc-4be1-9ebb-ccd916988d93)
to import wallets with many accounts and tokens
- [x] I've instrumented key operations with Sentry traces for production
performance metrics
- See [`trace()`](/app/util/trace.ts) for usage and
[`addToken`](/app/components/Views/AddAsset/components/AddCustomToken/AddCustomToken.tsx#L274)
for an example
For performance guidelines and tooling, see the [Performance
Guide](https://consensyssoftware.atlassian.net/wiki/spaces/TL1/pages/400085549067/Performance+Guide+for+Engineers).
## **Pre-merge reviewer checklist**
- [ ] I've manually tested the PR (e.g. pull and build branch, run the
app, test code being changed).
- [ ] I confirm that this PR addresses all acceptance criteria described
in the ticket it closes and includes the necessary testing evidence such
as recordings and or screenshots.
<!-- Generated with the help of the pr-description AI skill -->1 parent 8e11f95 commit a0315da
2 files changed
Lines changed: 76 additions & 3 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
902 | 902 | | |
903 | 903 | | |
904 | 904 | | |
| 905 | + | |
| 906 | + | |
| 907 | + | |
| 908 | + | |
| 909 | + | |
| 910 | + | |
| 911 | + | |
| 912 | + | |
| 913 | + | |
| 914 | + | |
| 915 | + | |
| 916 | + | |
| 917 | + | |
| 918 | + | |
| 919 | + | |
| 920 | + | |
| 921 | + | |
| 922 | + | |
| 923 | + | |
| 924 | + | |
| 925 | + | |
| 926 | + | |
| 927 | + | |
| 928 | + | |
| 929 | + | |
| 930 | + | |
| 931 | + | |
| 932 | + | |
| 933 | + | |
| 934 | + | |
| 935 | + | |
| 936 | + | |
| 937 | + | |
| 938 | + | |
| 939 | + | |
| 940 | + | |
| 941 | + | |
| 942 | + | |
| 943 | + | |
| 944 | + | |
| 945 | + | |
| 946 | + | |
| 947 | + | |
| 948 | + | |
| 949 | + | |
| 950 | + | |
| 951 | + | |
905 | 952 | | |
906 | 953 | | |
907 | 954 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
367 | 367 | | |
368 | 368 | | |
369 | 369 | | |
| 370 | + | |
| 371 | + | |
| 372 | + | |
| 373 | + | |
| 374 | + | |
| 375 | + | |
| 376 | + | |
| 377 | + | |
| 378 | + | |
| 379 | + | |
| 380 | + | |
| 381 | + | |
| 382 | + | |
| 383 | + | |
| 384 | + | |
| 385 | + | |
| 386 | + | |
| 387 | + | |
| 388 | + | |
| 389 | + | |
| 390 | + | |
| 391 | + | |
| 392 | + | |
| 393 | + | |
| 394 | + | |
370 | 395 | | |
371 | 396 | | |
372 | 397 | | |
| |||
1217 | 1242 | | |
1218 | 1243 | | |
1219 | 1244 | | |
| 1245 | + | |
1220 | 1246 | | |
1221 | 1247 | | |
1222 | | - | |
| 1248 | + | |
1223 | 1249 | | |
1224 | 1250 | | |
1225 | 1251 | | |
| |||
1239 | 1265 | | |
1240 | 1266 | | |
1241 | 1267 | | |
1242 | | - | |
| 1268 | + | |
1243 | 1269 | | |
1244 | 1270 | | |
1245 | 1271 | | |
1246 | 1272 | | |
1247 | 1273 | | |
1248 | | - | |
| 1274 | + | |
1249 | 1275 | | |
1250 | 1276 | | |
1251 | 1277 | | |
| |||
0 commit comments