Skip to content

fix(interact): cdp_interact value-injection for Controller inputs (#336)#372

Merged
Lykhoyda merged 7 commits into
mainfrom
fix/336-cdp-interact-value-coercion
Jul 1, 2026
Merged

fix(interact): cdp_interact value-injection for Controller inputs (#336)#372
Lykhoyda merged 7 commits into
mainfrom
fix/336-cdp-interact-value-coercion

Conversation

@Lykhoyda

@Lykhoyda Lykhoyda commented Jul 1, 2026

Copy link
Copy Markdown
Owner

Closes #336.

Problem

cdp_interact corrupted react-hook-form Controller-wrapped inputs two ways:

  1. Press → event object. press testID=<radio> called onPress({nativeEvent:{}}); for a value-bearing control whose onPress routes to the Controller's onChange, the event object became the field value → Zod "received object".
  2. Digit-string → number. setFieldValue value="15112345678" reached setValue as the number 15112345678z.string() fails "Expected string, received number".

Root cause (verified)

Fix

Testing

  • 7 new unit tests running the actual dist/injected-helpers.js in a VM against realistic RHF-shaped fiber trees (setFieldValue coerce/preserve/throw-safe/string-unchanged; press with-value/without-value/no-handler). Full suite 2537/2537.
  • Reviews: multi-LLM plan review (Codex + Gemini, no blocking findings — applied the one advisory: ES5 press return) + a final whole-branch review.
  • Device verification: deliberately skipped — the fix is pure JS value-handling logic with no external-runtime dependency (unlike bug: keyboard-occluded bottom-pinned taps land on the soft keyboard → flaky replays (iOS + Android) #356's maestro-runner case), the unit tests exercise the real helper JS, and the test-app has no FormProvider/press-value-radio target. Covered by unit + review + CI per maintainer decision.

Docs

Spec + TDD plan under docs/superpowers/{specs,plans}/2026-06-30-336-*.

🤖 Generated with Claude Code

Lykhoyda and others added 7 commits June 30, 2026 23:12
…ler inputs

Bug #2: type-match in setFieldValue (coerce number->string only when the field
currently holds a string), preserving the intentional number/boolean passthrough.
Bug #1: optional value on press (onPress(value) instead of the synthetic event)
for value-bearing controls like radios/chips. HELPERS_VERSION 32->33.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
… fix harness wording

Codex + Gemini reviewed the plan: no blocking/important findings. One unanimous
advisory applied — build the press result object imperatively (var + assignment)
instead of object-spread, matching the injected-helpers' deliberate ES5 style
(safe on older Hermes). Spec wording corrected: tests inline the runInteract VM
harness copied from gh-126, not a shared inject-harness.js.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
…; HELPERS_VERSION 33

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
…oc value/action

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
…n patch)

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
…field holds a string

Final-review finding: the setFieldValue string-coercion keys on the field's
current value, so string fields want a "" default. Describe now says so.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@Lykhoyda Lykhoyda merged commit 0a9a732 into main Jul 1, 2026
11 checks passed
@Lykhoyda Lykhoyda deleted the fix/336-cdp-interact-value-coercion branch July 1, 2026 13:54
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.

bug: cdp_interact value-injection coerces controlled form values to the wrong type (event-object for RadioBox, number for phone) → Zod fails

1 participant