Skip to content

Fixes #35543: Open the Test Definition form in a drawer in every app mode - #35500

Queued
Vansh0310 wants to merge 5 commits into
open-metadata:mainfrom
Vansh0310:feat/test-definition-form-drawer
Queued

Vansh0310 wants to merge 5 commits into
open-metadata:mainfrom
Vansh0310:feat/test-definition-form-drawer

Conversation

@Vansh0310

@Vansh0310 Vansh0310 commented Oct 15, 2026 •

Copy link
Copy Markdown
Contributor
Screen.Recording.2026-10-15.at.5.46.35.PM.mov
Screen.Recording.2026-10-15.at.5.47.19.PM.mov

Describe your changes:

Fixes #35543

The Add / Edit Test Definition form in the Test Library now opens in the same right-side drawer in both app modes, and the drawer shows the same Form Hint as the Data Quality test case drawer.

  • AI mode (/observability/test-library): the centered AiFormModal is replaced by the drawer that classic mode already used.
  • Classic mode (/test-library): the drawer's static documentation panel (ServiceDocPanel, the full TestDefinitionForm.md) is replaced by the Show Hint toggle in the header and the per-field Form Hint column. The column shows the doc for the focused field and opens on the first field.
  • Width: 80vw with the hint, 60vw without it, the same as the test case drawer.
  • Fresh form on every open: the form is reset each time the drawer opens. In AI mode the form stays mounted between opens, and without this, Add Test Definition opened pre-filled with the last definition you edited (and saving it failed with "Entity already exists").

The Show Hint toggle here is built the same way as the test case drawer's. #35296 adds a shared ShowHintToggle and drawer width constants. A follow-up PR after #35296 merges will move this drawer and the test case drawer onto them.

Type of change:

  • Improvement

High-level design:

Follows #35230 (Data Quality forms in the drawer in every app mode), which did the same for the test case form.

  • TestDefinitionForm always renders through useFormDrawerWithHook. Its body is a HookForm in fieldDocDisplay="panel" mode with the Form Hint header, the empty state and the markdown renderer the modal used. The variant prop and the modal branch are removed, and both callers (TestDefinitionList in classic mode, observability/TestLibrary/TestLibraryPage in AI mode) get the drawer.
  • The form re-seeds its values when the drawer opens, as well as when initialValues changes. Resetting only on close is not enough for the drawer: its fields stay mounted while it slides out, and react-hook-form's useController re-registers each field with its last value on every render, which writes the closed definition back into the form. The modal unmounted its fields at once, so it never hit this.
  • TestDefinitionFormBody no longer reports the active field to its parent (onActiveFieldChange and its focus and click handlers). That only fed ServiceDocPanel. The Form Hint tracks focus through useFieldDoc, which the body already used for the SQL and parameter sections.
  • .github/playwright/impact-map.json gets an entry for components/TestLibrary/** and components/observability/TestLibrary/**. Before it, a change to the drawer shell or the AI-mode page was unmapped and selected the full suite. impact-map.generated.json is regenerated: it adds the two specs that now import the shared expectFormHint helper, and the FailureThreshold spec, which main's generated map was missing.

Compatibility: TestDefinitionFormProps.variant is removed. Nothing in OSS passes it any more. A Collate caller that still passes variant="modal" needs a companion change, as #35230 did.

Tests:

Use cases covered

  • AI mode → Test Library → Add Test Definition opens the drawer with Show Hint on and the Form Hint on the Name field. Create, edit and cancel go through the drawer.
  • Classic mode → Test Library → Add Test Definition opens the drawer with the Show Hint toggle. Filling Name shows the Name hint.
  • Turning Show Hint off hides the hint column and narrows the drawer. Values already typed stay in the form.

Unit tests

  • Updated TestDefinitionForm.test.tsx: the drawer renders with Show Hint on, the focused field's doc shows in the Form Hint, and turning Show Hint off hides it. Create, edit, no-op edit and failed create now save through the drawer's Save button.
  • Added a regression test: after an edit closes and a closing field writes its old value back, opening Add shows an empty form. It fails without the reseed-on-open fix.
  • Updated TestDefinitionFormBody.test.tsx and testDefinitionFormDocs.test.ts for the removed prop and the new wording.
  • Ran Jest on src/components/TestLibrary, src/components/observability/TestLibrary and src/pages/TestLibrary after the fix: 13 suites, 220 tests passed. Before the fix, the same plus src/components/DataQuality/AddDataQualityTest: 21 suites, 399 tests passed.
  • Coverage %: not measured.

Backend integration tests

  • Not applicable (no backend changes).

Ingestion integration tests

  • Not applicable (no ingestion changes).

Playwright (UI) tests

  • Updated Features/AIMode/Observability.spec.ts: the Test Library tests now open, create, edit and cancel through the drawer. They check the Show Hint toggle and the Form Hint (expectFormHint) and save with save-test-definition.
  • Updated Features/DataQuality/TestLibrary.spec.ts: checks the Show Hint toggle and the Name hint instead of the removed .drawer-doc-panel.
  • make playwright_affected selects 26 specs and reports no impact-map gaps.
  • Not run yet. The impacted specs still need a run against a local stack before this PR is marked ready.
  • .github/scripts/tests/test_playwright_ci_planning.py: 123 passed, 3 failed. On main the same file has 4 failures. This PR fixes test_committed_generated_impact_map_matches_the_generator_output. The other 3 fail on main too: test_basic_project_excludes_dedicated_state_specs, test_search_impact_mapping_includes_ingestion_project_for_schema_search and test_summary_reconciles_results_and_evaluates_performance_independently.

Manual testing performed

Ran this branch's UI (Vite on :3901) against a backend built from this branch (system/version revision 5b7cc1e881f), signed in as the local admin, viewport 1440×900.

Classic mode (/test-library):

  1. Add Test Definition opens the right-side drawer at 1152px (80vw) with Show Hint on and the Form Hint on Name.
  2. Focusing Display Name, Description and Entity Type switches the hint to each field's doc.
  3. Show Hint off: the hint column hides, the drawer narrows to 864px (60vw), and the typed Name is kept. Show Hint on again restores it.
  4. Created a definition (Name, Entity Type TABLE): POST /testDefinitions 201, success toast, drawer closed.
  5. Edited it: Name pre-filled and disabled, Entity Type TABLE. Changed Display Name: PATCH 200, success toast, row updated.

AI mode (/observability/test-library):

  1. Add Test Definition opens the same drawer (1152px, anchored right, Show Hint on, Form Hint on Name). No modal.
  2. Escape closes the drawer.
  3. Edited the same definition (added a description): PATCH 200, success toast, row updated.
  4. Found a bug: after any edit (saved or cancelled), Add opened pre-filled with that definition. main's AI modal does not do this. Fixed in this PR (see above). After the fix, Add after Edit → Cancel and after Edit → Save both open empty, and Edit still pre-fills.

Also seen, not changed here: on the first drawer open after a page load, switching from the pre-filled Name hint to Display Name once kept the Name text under the Display Name heading. It did not happen again on later opens. It comes from the shared markdown preview (RichTextEditorPreviewerV1), which the AI modal used in the same way.

Lint: ESLint + Prettier + organize-imports on the changed UI files, 0 errors. tsc --noEmit (src and playwright) reports no errors in the changed files.

UI screen recording:

Not added yet. This PR stays draft until a recording from a Docker build of this branch with sample data is attached.

Checklist:

  • I have read the CONTRIBUTING document.
  • My PR title is Fixes <issue-number>: <short explanation>
  • My PR is linked to a GitHub issue via Fixes #<issue-number> above.
  • I have commented on my code, particularly in hard-to-understand areas.
  • For JSON Schema changes: I updated the migration scripts or explained why it is not needed. (N/A, no schema changes)
  • For a UI feature or feature task: as part of PR creation, I ran the PR build in Docker with sample data and embedded a verified GitHub-hosted recording plus build/health evidence above (or explained why this requirement is not applicable).
  • I have added tests (unit / integration / Playwright as applicable) and listed them above.
  • Decision check: no new contract, default or ordering. The drawer behaviour follows feat(ui): open Data Quality forms in the drawer in every app mode #35230.

@github-actions

Copy link
Copy Markdown
Contributor

Hi there 👋 Thanks for your contribution!

The OpenMetadata team will review the PR shortly! Once it has been labeled as safe to test, the CI workflows
will start executing and we'll be able to make sure everything is working as expected.

Let us know if you need any help!

AI mode now opens the same slide-out drawer as classic mode for the Add/Edit
Test Definition form, replacing the centered AiFormModal. The drawer swaps its
ServiceDocPanel for the Show Hint toggle and the per-field Form Hint column
(HookForm panel mode), as the test case drawer does. It opens at 80vw with
the hint and 60vw without it.

- Drop the `variant` prop; every caller now gets the drawer.
- Remove the active-field reporting that only fed ServiceDocPanel
  (`onActiveFieldChange` and its focus and click handlers). The Form Hint
  tracks the focused field through useFieldDoc.
- Playwright: check the Show Hint toggle and the Form Hint instead of the
  removed doc panel, and save through the drawer's Save button.
The generated map reached only TestDefinitionFormBody, so a change to the
Test Definition drawer or the AI-mode Test Library page selected the full
suite. Route both folders to the Test Library and Test Definition specs and
the AI-mode Observability spec, and regenerate the generated map: it picks
up the two specs that now import the shared Form Hint helper, and the
FailureThreshold spec main had not regenerated for.
@Vansh0310
Vansh0310 force-pushed the feat/test-definition-form-drawer branch from df37784 to 5b7cc1e Compare October 15, 2026 11:16
@github-actions

Copy link
Copy Markdown
Contributor

Hi there 👋 Thanks for your contribution!

The OpenMetadata team will review the PR shortly! Once it has been labeled as safe to test, the CI workflows
will start executing and we'll be able to make sure everything is working as expected.

Let us know if you need any help!

In AI mode the form stays mounted between opens. After editing a
definition, Add Test Definition opened pre-filled with that definition, and
saving it failed with "Entity already exists". The form was reset when the
edit closed, but the drawer keeps its fields mounted while it slides out,
and react-hook-form's useController re-registers each field with its last
value on every render, which wrote the edited values back.

Reset the form when the drawer opens, before its fields mount, as well as
when the target definition changes. Classic mode was not affected because it
unmounts the form on close.
@github-actions

Copy link
Copy Markdown
Contributor

Hi there 👋 Thanks for your contribution!

The OpenMetadata team will review the PR shortly! Once it has been labeled as safe to test, the CI workflows
will start executing and we'll be able to make sure everything is working as expected.

Let us know if you need any help!

@Vansh0310
Vansh0310 marked this pull request as ready for review October 15, 2026 12:10
@github-actions

Copy link
Copy Markdown
Contributor

❌ PR checklist incomplete

This PR cannot be merged until the following are addressed on its linked issue:

  • No GitHub issue is linked. Link an issue in the Development section of the PR (or add Fixes #12345 to the description). For a same-org cross-repo issue, add Fixes open-metadata/<repo>#123 to the description.

The fields live on the linked issue in the Shipping project (open the issue → right sidebar → Projects). After you set them, re-run this check (or push a commit) — issue/project changes do not re-trigger it automatically.

Maintainers can bypass this check by adding the skip-pr-checks label.

@github-actions

Copy link
Copy Markdown
Contributor

Hi there 👋 Thanks for your contribution!

The OpenMetadata team will review the PR shortly! Once it has been labeled as safe to test, the CI workflows
will start executing and we'll be able to make sure everything is working as expected.

Let us know if you need any help!

@ShaileshParmar11 ShaileshParmar11 added the safe to test Add this label to run secure Github workflows on PRs label Oct 15, 2026
@github-actions

github-actions Bot commented Oct 15, 2026 •

Copy link
Copy Markdown
Contributor

Jest test Coverage

UI tests summary

Lines Statements Branches Functions
Coverage: 77%
77.8% (126637/162765) 64.42% (80046/124251) 65.66% (26718/40688)

Resolve the .github/playwright/impact-map.json conflict by keeping both appended entries: the Test Library drawer mapping from this branch and the Suggestions mapping from main.
@github-actions github-actions Bot removed the safe to test Add this label to run secure Github workflows on PRs label Oct 15, 2026
@github-actions

Copy link
Copy Markdown
Contributor

Hi there 👋 Thanks for your contribution!

The OpenMetadata team will review the PR shortly! Once it has been labeled as safe to test, the CI workflows
will start executing and we'll be able to make sure everything is working as expected.

Let us know if you need any help!

@gitar-bot

gitar-bot Bot commented Oct 15, 2026

Copy link
Copy Markdown
Code Review ✅ Approved

🟡 Medium risk · Moving Test Definition creation and editing into a persistent drawer changes form lifecycle; incorrect reseeding could submit stale values or block creation.

Moves the Test Definition form into the same right-side drawer in both AI and classic app modes, with the Form Hint column replacing the static doc panel and the form reseeding on each open so Add no longer pre-fills with the last edited definition. No issues found.

Verification

Rules No rules evaluated

Functional validation Not enabled

Set up

Auto-approval Not enabled

Set up

For more verification details, comment gitar display:verbose.

Options

Display: compact → Showing compact verification results.

Comment with these commands to change the behavior for this request:

Compact
gitar display:verbose         

Was this helpful? React with 👍 / 👎 | Powered by Gitar — free for open source

@ShaileshParmar11 ShaileshParmar11 added safe to test Add this label to run secure Github workflows on PRs skip-pr-checks Bypass PR metadata validation check UI UI specific issues labels Oct 15, 2026
@ShaileshParmar11 ShaileshParmar11 changed the title Open the Test Definition form in a drawer in every app mode Fixes #35543: Open the Test Definition form in a drawer in every app mode Oct 15, 2026
@sonarqubecloud

Copy link
Copy Markdown

@ShaileshParmar11
ShaileshParmar11 added this pull request to the merge queue Oct 15, 2026

This branch has not been deployed

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

Labels

safe to test Add this label to run secure Github workflows on PRs skip-pr-checks Bypass PR metadata validation check UI UI specific issues

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add/Edit Test Definition form should open in the same drawer with a Form Hint in every app mode

2 participants