feat(components): metadata-derived field locators on forms (ADR-0054 Phase 4)#1887
Merged
Conversation
…(ADR-0054 Phase 4)
Closes the renderer-side locator gap (ADR-0054 invariant C4) at the source: the
form renderer emits a stable `data-testid="field:{objectName}.{field}"` (plus
`data-field`) on every field wrapper, derived from metadata — so an automated (AI)
driver can target a field by object+name instead of i18n-fragile labels or
positional selectors.
- `FormSchema` gains an optional `objectName` (TS + zod); the form renderer
(`renderers/form/form.tsx`) emits the locator on each field's `FormItem`.
Object prefix omitted (`field:{field}`) when a form has no owning object.
- `FormItem` now accepts `data-*` attributes.
- `objectName` is threaded into the form schema by every form variant
(`ObjectForm` flat + sectioned, `ModalForm`, `DrawerForm`, `SplitForm`,
`WizardForm`) — so all generated forms inherit testable fields with zero
per-app work.
- 2 renderer unit tests (with/without objectName).
Verified in-browser (agent-browser/CDP): the showcase "new task" form renders 17
field wrappers with locators `field:showcase_task.title`, `.project`,
`.assignee`, `.status`, … and each resolves to a real input. Unit/type: form
renderer (34) + plugin-form (138) + components (4236) suites green; tsc build
green.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
|
The latest updates on your projects. Learn more about Vercel for GitHub. |
Contributor
✅ Console Performance Budget
📦 Bundle Size Report
Size Limits
|
xuyushun441-sys
added a commit
that referenced
this pull request
Jun 22, 2026
…ADR-0054 Phase 5) (#1890) Locks in the testability contract so it can't regress ("counts can only go down"). - **Conformance test** (`adr0054-ratchet.test.ts`, runs in the gating `pnpm test` job): fails the build if a new synthetic-event trigger (`dispatchEvent(new KeyboardEvent/MouseEvent/PointerEvent)`) appears anywhere in `packages/*/src` or `apps/*/src`. Legitimate `CustomEvent`/`PopStateEvent` dispatch (event bus / history nudge) stays allowed. - **Local ESLint rule** `object-ui/no-synthetic-event-trigger` flags the same pattern in-editor (the repo `Lint` workflow is manual `workflow_dispatch`, so the test — not lint — is the CI gate). Plain-JS RuleTester unit test. - **Last two offenders fixed**: the sidebar swipe-to-open gestures (`UnifiedSidebar`, `AppSidebar`) dispatched a synthetic click on the trigger; now call the idempotent `setOpenMobile(true)` directly (C1). Tree is clean at zero. - Docs: README "Testability ratchet" section; ADR-0054 marked all five phases shipped. Completes the ADR-0054 rollout (Phases 1 #1879, 2 #1882, 3 #1883, 4 #1887, 5). Co-authored-by: Jack Zhuang <277994282+os-zhuang@users.noreply.github.com> Co-authored-by: Claude Opus 4.8 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What & why
ADR-0054 "UI testability contract" — Phase 4 (locator coverage, C4). Closes the renderer-side locator gap at the source: the form renderer now emits a metadata-derived
data-testidon every field, so an automated (AI) driver can target a field by object + name instead of i18n-fragile labels or positional CSS/XPath.Changes
components/renderers/form/form.tsx): each field'sFormItemwrapper now carriesdata-testid="field:{objectName}.{field}"anddata-field="{field}", derived from the form'sobjectName+ field name. Object prefix omitted (field:{field}) when a form has no owning object.FormSchemagains an optionalobjectName(TS interface + zod).FormItemnow acceptsdata-*attributes.objectNamethreaded into the form schema by every form variant —ObjectForm(flat + sectioned),ModalForm,DrawerForm,SplitForm,WizardForm— so all generated forms inherit testable fields with zero per-app work.objectName).Verification (browser, agent-browser / CDP)
Worktree console (
:5182, mypackages/*/srcvia HMR) →app-showcasebackend (:3010):field:showcase_task.title,.project,.assignee,.status,.priority, … ✅field:showcase_task.titlehasdata-field="title"and resolves to a real<input>. ✅Unit/type: form-renderer (34, incl. 2 new) + plugin-form (138) + components (4236) suites green;
tscbuild green.ADR rollout
Phases 1 (#1879), 2 (#1882), 3 (#1883) merged. This is Phase 4. Next: Phase 5 (ratchet — ESLint rules + conformance to lock in the gains).
🤖 Generated with Claude Code