Skip to content

docs: note schema-form microtask batching gotcha for tests in ui-v2 AGENTS.md - #23007

Draft
github-actions[bot] wants to merge 1 commit into
mainfrom
claude/update-agents-md-a37d448
Draft

docs: note schema-form microtask batching gotcha for tests in ui-v2 AGENTS.md#23007
github-actions[bot] wants to merge 1 commit into
mainfrom
claude/update-agents-md-a37d448

Conversation

@github-actions

@github-actions github-actions Bot commented Sep 1, 2026

Copy link
Copy Markdown
Contributor

Automated AGENTS.md update triggered by commit a37d448.

This PR was generated by Claude Code analyzing the diff from the latest push to main and updating any stale AGENTS.md files.

Why this belongs in AGENTS.md
Path: ui-v2/src/components/AGENTS.md

Proposed text: Added one bullet to the Testing section:
"**Schema forms** (`@/components/schemas`, used by deployment/block/work-pool parameter forms): `SchemaFormInputObject` batches child value changes via `queueMicrotask`, not a debounce timer. After firing input events, await a microtask (`await act(async () => { await Promise.resolve(); })`) to see propagated values — `vi.useFakeTimers()`/`runAllTimers()` no longer applies here."

Non-obvious evidence: The diff rewrites `schema-form-input-object.tsx`'s value-propagation mechanism from a 10ms `useDebounceCallback` flush to a `queueMicrotask`-based pending-patch map. The existing test suite previously relied on `vi.useFakeTimers()` + `vi.runAllTimers()` to flush the debounce; the diff replaces those calls with `await act(async () => { await Promise.resolve(); })`. A future agent writing or fixing a test against any schema-driven form would naturally reach for fake timers (the previously-correct pattern) and get a silently-stale/failing test, since nothing in the component's public API signals the timing model changed.

Cross-cutting scope: `SchemaFormInputObject`/`LazySchemaForm` back parameter forms across at least seven unrelated domains (deployment run parameters, deployment schedule overrides, block document create/edit, work-pool base job template, flow-run resume dialog), confirmed via grep. This is a testing-pattern contract for the whole schema-form subsystem, not a detail of one call site.

Why not code comment/docstring: The component itself already has an inline comment explaining *why* patches are retained until acknowledged (the implementation rationale). What's missing is the *consumer-facing* contract for anyone testing code built on top of this component elsewhere in the tree — that lives naturally in the shared components AGENTS.md's existing Testing section, which already collects analogous JSDOM/timing gotchas (CSS custom properties, matchMedia, virtualized lists) in the same bullet-list format.

Durability: The microtask-batching behavior is a structural property of the component's flush strategy, not tied to the parameter-overrides feature that triggered this diff. It will keep being the reason tests against any schema form need `await act(async () => { await Promise.resolve(); })` long after this PR is old.

Counter-evidence checked: Grepped ui-v2/AGENTS.md, ui-v2/src/components/AGENTS.md, and ui-v2/src/hooks/AGENTS.md for "debounce", "runAllTimers", "useFakeTimers", "SchemaForm", "microtask" — no existing mentions, so nothing was stale to correct and this is net-new guidance. Confirmed the component's own code comment covers implementation rationale only, not the test-authoring implication, so no duplication.

Changed files in triggering push
ui-v2/src/components/deployments/deployment-details-page.tsx
ui-v2/src/components/deployments/deployment-schedules/deployment-schedule-dialog/cron-schedule-form.tsx
ui-v2/src/components/deployments/deployment-schedules/deployment-schedule-dialog/deployment-schedule-dialog.stories.tsx
ui-v2/src/components/deployments/deployment-schedules/deployment-schedule-dialog/deployment-schedule-dialog.test.tsx
ui-v2/src/components/deployments/deployment-schedules/deployment-schedule-dialog/deployment-schedule-dialog.tsx
ui-v2/src/components/deployments/deployment-schedules/deployment-schedule-dialog/interval-schedule-form.tsx
ui-v2/src/components/deployments/deployment-schedules/deployment-schedule-dialog/schedule-parameter-overrides-form-section.stories.tsx
ui-v2/src/components/deployments/deployment-schedules/deployment-schedule-dialog/schedule-parameter-overrides-form-section.tsx
ui-v2/src/components/deployments/deployment-schedules/deployment-schedule-dialog/use-schedule-parameter-overrides.test.ts
ui-v2/src/components/deployments/deployment-schedules/deployment-schedule-dialog/use-schedule-parameter-overrides.ts
ui-v2/src/components/schemas/schema-form-input-object.tsx
ui-v2/src/components/schemas/schema-form.test.tsx

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

0 participants