Skip to content

[Fix-18448][UI] Guard workflowDefinition before reading releaseState in the DAG node menu - #18670

Merged
SbloodyS merged 3 commits into
apache:devfrom
Adarsh-Me:fix/18448-workflow-definition-guard
Oct 6, 2026
Merged

SbloodyS merged 3 commits into
apache:devfrom
Adarsh-Me:fix/18448-workflow-definition-guard

Conversation

@Adarsh-Me

Copy link
Copy Markdown
Contributor

Was this PR generated or assisted by AI?

YES. An AI assistant drafted this two-line change and this description under my direction; I reviewed the diff and ran the repo's own frontend checks locally before pushing.

Purpose of the pull request

Fixes #18448

startDisplay and menuDisplay in dolphinscheduler-ui/src/views/projects/workflow/components/dag/index.tsx guarded props.definition but then read props.definition!.workflowDefinition.releaseState. ! is a TypeScript-only assertion with no runtime effect, so when workflowDefinition is undefined the right-click node menu throws TypeError: Cannot read properties of undefined (reading 'releaseState') and the DAG stops rendering.

Brief change log

  • dag/index.tsx: both computeds now read the release state through props.definition.workflowDefinition?.releaseState, so the start button and the "other" menu items are hidden in that transient state instead of throwing.

This is the pattern the same module already uses — dag-toolbar.tsx guards with props.definition?.workflowDefinition?.releaseState (lines 276 and 512). Behaviour is unchanged whenever workflowDefinition is present.

Verify this pull request

Ran the two steps of the Frontend workflow from dolphinscheduler-ui:

  • pnpm install (pnpm 7, as CI does) and pnpm run lint — exit 0, no problems reported, and the formatter left my two lines as written.
  • pnpm run build:prod (vue-tsc --noEmit && vite build --mode production) — exit 0: the type check reported no errors and the production bundle completed.

Two honesty notes: this host runs Node 24 while that workflow pins Node 16, and dolphinscheduler-ui has no test runner (package.json defines no test script and no test dependency: dev, build:prod, preview, lint, prettier), so I could not add the unit test for these computeds that I mentioned when claiming the issue. Introducing vitest plus its config and CI wiring does not belong in a bugfix; I am happy to do it in a follow-up PR if you want it.

Related: #18449 and #18542 are both still open with no review; SbloodyS assigned this issue to me on 2026-10-02, so here is the implementation.

startDisplay and menuDisplay checked props.definition but then read
props.definition!.workflowDefinition.releaseState. The ! assertion is
compile-time only, so an undefined workflowDefinition threw a TypeError
while the DAG node menu rendered. Read the release state through an
optional chain, matching dag-toolbar.tsx, so the start button and the
"other" menu items are hidden instead of breaking the page.
@Adarsh-Me
Adarsh-Me requested a review from SbloodyS as a code owner October 2, 2026 09:35
@boring-cyborg

boring-cyborg Bot commented Oct 2, 2026

Copy link
Copy Markdown

Thanks for opening this pull request! Please check out our contributing guidelines. (https://github.com/apache/dolphinscheduler/blob/dev/docs/docs/en/contribute/join/pull-request.md)

@github-actions github-actions Bot added the UI ui and front end related label Oct 2, 2026
@Adarsh-Me

Copy link
Copy Markdown
Contributor Author

CI has not actually run on this PR: 9 of its 10 workflow runs are parked at action_required (created 09:35:34Z, attempt 1, never approved or retried) and only pull-request-target-robot has completed. Could someone with write access approve the runs? I reproduced the Frontend gate locally (lint + build:prod, both exit 0) and the details are in the description. Thanks.

@SbloodyS SbloodyS added the bug Something isn't working label Oct 3, 2026
@SbloodyS SbloodyS added this to the 3.5.0 milestone Oct 3, 2026
@SbloodyS SbloodyS added the first time contributor First-time contributor label Oct 3, 2026
@SbloodyS SbloodyS changed the title [Fix-18448][ui] Guard workflowDefinition before reading releaseState in the DAG node menu [Fix-18448][UI] Guard workflowDefinition before reading releaseState in the DAG node menu Oct 3, 2026
@Adarsh-Me

Copy link
Copy Markdown
Contributor Author

CI update after today's re-run, nothing here needs the committer's action. Docs and E2E also fail on dev itself (Docs red on 15/15 nightly runs; E2E red at c63ecc9). Backend's license step diffs one line: the baseline expects minimatch-5.1.6.jar while the resolved build now ships 5.1.9 - a transitive webjar drift. This PR changes only dag/index.tsx.

@SbloodyS

SbloodyS commented Oct 5, 2026 •

Copy link
Copy Markdown
Member

CI update after today's re-run, nothing here needs the committer's action. Docs and E2E also fail on dev itself (Docs red on 15/15 nightly runs; E2E red at c63ecc9). Backend's license step diffs one line: the baseline expects minimatch-5.1.6.jar while the resolved build now ships 5.1.9 - a transitive webjar drift. This PR changes only dag/index.tsx.

I've rerun the CI.

@SbloodyS SbloodyS left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@SbloodyS
SbloodyS merged commit 93cb9a2 into apache:dev Oct 6, 2026
126 of 141 checks passed
@boring-cyborg

boring-cyborg Bot commented Oct 6, 2026

Copy link
Copy Markdown

Awesome work, congrats on your first merged pull request!

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

Labels

bug Something isn't working first time contributor First-time contributor UI ui and front end related

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug] [UI] Clicking edit on a task throws "Cannot read properties of undefined (reading 'releaseState')" when workflowDefinition is undefined

2 participants