Skip to content

Fixes #38363: open a form modal for inbox workflow transitions with required fields - #38400

Merged
harsh-vador merged 15 commits into
mainfrom
detail/bug-fix/fixes-38363-open-a-form-modal-for-inbox-workflow-t-a15b7e
Nov 24, 2026
Merged

harsh-vador merged 15 commits into
mainfrom
detail/bug-fix/fixes-38363-open-a-form-modal-for-inbox-workflow-t-a15b7e

Conversation

@detail-app

@detail-app detail-app Bot commented Nov 21, 2026 •

Copy link
Copy Markdown
Contributor

Detail bug report: View on Detail

Describe your changes:

Closes #38363

I worked on the inbox (Personal space › Tasks) task-resolution flow because a workflow transition whose transitionForms schema declared required non-comment fields was being fired immediately with no modal, sending a resolve body with only transitionId + resolutionType and no payload/newValue. The task then showed Resolved with none of the required form data collected or applied to the entity — silent data loss. The entity page's task tab (TaskTabNew) already handled this correctly via shouldOpenWorkflowTransitionModal; the inbox's handleTransition guard only consulted requiresComment and never inspected the transition's form schema.

Root cause: TaskDetailPanel only fetched a TaskFormSchema for legacy (non-workflow) tasks, so the inbox never saw transitionForms; the getTaskActionInput/needsTaskActionInput guard had no form-field check; and buildResolveBody's transition branch never derived newValue from a form payload. On the server, TaskFieldValidator.validateResolutionPayloadAgainstFormSchema early-returned on resolvedPayload == null && newValue == null, so the empty submission bypassed schema validation entirely.

Type of change:

  • Bug fix

High-level design:

N/A — small change. The fix mirrors TaskTabNew's existing transition-modal path:

  • TaskFormSchemaUtils.hasRequiredTaskFormFields — new helper that checks a form schema's required array. The inbox's guard uses this (rather than the broader hasTaskFormFields) so transitions whose form only carries optional fields (e.g. the seeded DAR approve with an optional comment) keep firing straight through.
  • taskResolve.utils.ts — getTaskActionInput/needsTaskActionInput gained an optional schema? param and a requiresForm flag (true when the transition's transitionForms schema has required fields). buildResolveBody's transition branch now derives newValue from the collected payload + the transition's uiSchema (mirroring TaskTabNew.runWorkflowTransition); a payload-mode transition (ui:resolution.mode: 'payload') yields no newValue.
  • TaskDetailPanel — resolves TaskFormSchema for every typed task (was: legacy only), so the guard can see transitionForms; gates resolve actions on formSchemaLoaded (a fast click before the schema loads cannot fire a form-bearing transition with no data); routes requiresForm && !requiresComment transitions to a new TaskTransitionFormModal; requiresComment keeps precedence (comment / incident-root-cause modal unchanged).
  • TaskTransitionFormModal (new) — reuses TaskPayloadSchemaFields (the same form the entity-page tab uses), seeds it from the task payload + schema defaults, blocks confirm while a required field is missing, and returns the payload to runTransition.

The server-side TaskFieldValidator early-return was intentionally not changed: removing it would reject the existing DAR reject flow (the inbox sends comment top-level, but the seeded transitionForms.reject requires comment in the payload) and would not even catch the reported scenario (the task's create payload already satisfies the approve form's required). The frontend fix is the complete fix; server hardening is a defense-in-depth follow-up.

pr38400-before-after pr38400-playwright-report

Tests:

Use cases covered

  • A workflow transition with requiresComment: false whose form declares required fields opens the form modal and does not fire until the user confirms.
  • On confirm, the resolve body carries transitionId, resolutionType, payload, and a derived newValue (field-mode) or no newValue (payload-mode).
  • The form is seeded from the task payload + schema defaults; confirm is disabled while a required field is missing.
  • requiresComment transitions (DAR reject, incident resolve) keep the comment / root-cause modal — unchanged.
  • Plain / optional-form transitions (no required) keep firing in one click — unchanged.
  • Assignee (re)assign transitions keep the assignee picker — unchanged.
  • The schema is now resolved for workflow-driven tasks; actions gate on schema load (no silent-fire race); a comment-save reload does not re-gate.
  • Bulk resolve (no per-task schema) treats requiresForm as false and behaves as before.

Unit tests

  • I added unit tests for the new/changed logic.
  • Files added/updated:
    • openmetadata-ui/.../InboxPage/taskResolve.utils.test.ts — requiresForm cases (incident, custom-approve, no-required, no-schema); buildResolveBody transition-branch newValue derivation (field-mode, payload-mode, no-schema).
    • openmetadata-ui/.../InboxPage/components/TaskTransitionFormModal.test.tsx (new) — seeding, required-field guard, confirm-on-fill, loading-suppress, cancel, overlay-dismiss, closed-render.
    • openmetadata-ui/.../InboxPage/components/TaskDetailPanel.test.tsx — form-modal routing (opens-not-fires, sends-payload-on-confirm, cancel, fires-immediately-when-no-required), schema-fetch-for-workflow, typeless-task skip.
    • openmetadata-ui/.../utils/TaskFormSchemaUtils.test.ts — hasRequiredTaskFormFields (required/non-required/empty/undefined, DAR-reject comment required).

Backend integration tests

  • Not applicable (no backend API changes).

Ingestion integration tests

  • Not applicable (no ingestion changes).

Playwright (UI) tests

  • Not applicable — the shipped TaskCustomFormWorkflow.spec.ts exercises the entity-page path (TaskTabNew), which already had the form modal and is unchanged by this fix. An inbox-path E2E for the new modal is a worthwhile follow-up but requires a running server with the workflow engine, which is not available in this session.

Manual testing performed

  • Could not perform a UI smoke: the Vite dev server starts (HTTP 200 on :3000) but there is no openmetadata-server on :8585 (the API proxy returns 502), and building the server distribution (mvn package -pl openmetadata-dist -am -DskipTests) exceeded the session time budget. The new component-level Jest tests assert the same behavior the smoke would check (modal opens-not-fires, payload+newValue on confirm, cancel, no-required fires immediately) against the real getTaskActionInput/buildResolveBody/TaskTransitionFormModal/TaskDetailPanel code without a server.

UI screen recording:

Not applicable — bug fix with no new user-facing feature surface beyond mirroring the existing entity-page transition modal; the Vite dev server is up but the backend (:8585) is not available in this session, so a Docker-stack recording could not be captured.

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
  • 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). — Not applicable (bug fix; backend not available in this session to record).
  • I have added tests (unit / integration / Playwright as applicable) and listed them above.
  • Self-review: I reviewed the final diff against REVIEW.md (the pr-checklist skill runs it) and fixed every 🔴 finding, or answered it on the line below.
  • Decision check: no durable decision added — the fix mirrors the existing TaskTabNew transition-modal pattern; the one judgment call (not changing TaskFieldValidator's early-return) is explained above and is a deferral, not a new contract.

Automatic Fixes PRs can be configured here.

RetriggerView in GreptileConfidence Score: 5/5

The PR appears safe to merge; no new blocking issues were found.

Summary

The PR makes Inbox workflow actions collect required form answers before resolving a task.

  • Inbox transitions collect required form fields before they resolve.
  • Bulk resolve leaves tasks needing form input for the inbox.

Reviews (10) · Last reviewed commit: "chore(playwright): regenerate the impact..." · Reviewed by Greptile

detail-app Bot and others added 2 commits November 21, 2026 06:09
- Required-field guard treats false/0 as valid answers, not missing
  (only absent/null/empty-string block confirm), so a required boolean
  set to false or a required number set to 0 can be submitted.
- Distinguish a failed schema lookup from a confirmed-missing schema:
  getResolvedTaskFormSchema gains an opt-in allowFallback flag; the
  inbox passes it for workflow-driven tasks so a fetch failure blocks
  the transition (with a retry) instead of falling back to the built-in
  default and letting a required-form transition fire with no payload.
- Keep the form schema helpers and TaskPayloadSchemaFields real in the
  modal tests (mock only the modal shell and the heavy editor widgets);
  drop comments that restate the test calls.

Addresses greptile review threads on #38400.
… bulk resolve

- Key the no-fallback lookup apart so other callers never get its undefined
- Resolve the schema on click instead of hiding the inbox actions until it loads
- Leave a bulk-resolved task whose transition form requires fields for the inbox
- Type the modal test's task fixture so tsc passes
detail-app Bot and others added 2 commits November 23, 2026 08:44
The PR's diff added a symlink at src/generated/antlr pointing to a
developer's local machine path (/Users/deuex/...). This path does not
exist on CI, and generated/antlr is not a generated output directory on
main (the antlr parser sources live in src/antlr/). The stray symlink
makes the generate-types CI fail because regenerating sources produces a
diff against it. Remove it.
@harsh-vador
harsh-vador enabled auto-merge (squash) November 24, 2026 05:46
@github-actions

Copy link
Copy Markdown
Contributor

UI browser tests

Ran: all test files (no impact map from main yet)

Result: ✅ 1070 passed · 154 skipped

Changed files no browser test loads
  • src/components/MyData/Widgets/MyTasksWidget/useBulkResolveTasks.ts
  • src/components/discovery/personal-space/InboxPage/components/TaskDetailPanel.tsx
  • src/components/discovery/personal-space/InboxPage/components/TaskTransitionFormModal.tsx
  • src/components/discovery/personal-space/InboxPage/taskResolve.utils.ts
  • src/utils/TaskFormSchemaUtils.ts

@harsh-vador
harsh-vador disabled auto-merge November 24, 2026 06:32
@harsh-vador
harsh-vador enabled auto-merge (squash) November 24, 2026 06:32
@harsh-vador
harsh-vador merged commit 9b59584 into main Nov 24, 2026
58 of 59 checks passed
@harsh-vador
harsh-vador deleted the detail/bug-fix/fixes-38363-open-a-form-modal-for-inbox-workflow-t-a15b7e branch November 24, 2026 06:33
harsh-vador added a commit that referenced this pull request Nov 24, 2026
…with required fields (backport 2.1 #38400) (#38445)

* fix(ui): open a form modal for inbox workflow transitions with required fields

(cherry picked from commit 44c61ab)

* fix(ui): address review on inbox transition form modal

- Required-field guard treats false/0 as valid answers, not missing
  (only absent/null/empty-string block confirm), so a required boolean
  set to false or a required number set to 0 can be submitted.
- Distinguish a failed schema lookup from a confirmed-missing schema:
  getResolvedTaskFormSchema gains an opt-in allowFallback flag; the
  inbox passes it for workflow-driven tasks so a fetch failure blocks
  the transition (with a retry) instead of falling back to the built-in
  default and letting a required-form transition fire with no payload.
- Keep the form schema helpers and TaskPayloadSchemaFields real in the
  modal tests (mock only the modal shell and the heavy editor widgets);
  drop comments that restate the test calls.

Addresses greptile review threads on #38400.

(cherry picked from commit bb1c991)

* fix(ui): keep strict schema lookups out of the shared cache and guard bulk resolve

- Key the no-fallback lookup apart so other callers never get its undefined
- Resolve the schema on click instead of hiding the inbox actions until it loads
- Leave a bulk-resolved task whose transition form requires fields for the inbox
- Type the modal test's task fixture so tsc passes

(cherry picked from commit 70b6b62)

* fix(ui): lock task actions while the transition form schema loads

(cherry picked from commit a6d6214)

* fix(ui): style the transition form required hint with the error token

(cherry picked from commit 0e02467)

* fix(ui): collect a transition's required form fields before its comment

(cherry picked from commit 1b58e30)

* test(ui): stub the provider's getContributions in the TaskDetailPanel cache test

* test(ui): stub the transition form helpers in the TaskDetailPanel cache test

* fix(ui): require the comment in the transition form when the transition requires one

(cherry picked from commit d9b3748)

* test(playwright): resolve a custom task's required transition form from the Inbox

(cherry picked from commit 5252389)

* chore(playwright): regenerate the impact map

* chore(ui): document the two intentional lint exceptions in the transition form

* refactor(ui): lazy-load the task form renderer instead of suppressing lint

* fix(ui): show a loader instead of the form controls while the transition form loads

---------

Co-authored-by: detail-app[bot] <180357370+detail-app[bot]@users.noreply.github.com>
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.

[Detail Bug] Inbox task resolution skips required workflow transition forms, resolving tasks without required data

4 participants