Skip to content

[2.0] fix(data-products): port pickers hide assets that can't be ports and show why a port is rejected (#36729) - #36984

Merged
anuj-kumary merged 2 commits into
2.0from
anuj-kumary/port-picker-conflict-2.0
Nov 4, 2026
Merged

anuj-kumary merged 2 commits into
2.0from
anuj-kumary/port-picker-conflict-2.0

Conversation

@anuj-kumary

Copy link
Copy Markdown
Member

Backport of #36729 to 2.0.

Describe your changes:

When a backend rejected a data product port, the UI showed a generic "Error while adding assets!" toast. Two cases:

  1. Output port: the asset was already an input port of the same data product.
  2. Input port: the picked result was a tableColumn, which can never be a port.

Changes (same as #36729)

  • Port pickers hide assets of the other port kind (InputOutputPortsTab.component.tsx, DataProductPureUtils.ts). Opening Add Port fetches the other kind's ports (up to the API max of 1000) and excludes them with an ES ids query.
  • Rejected rows are shown inline (useAssetSelectionState.ts). An all-failed 400 carrying failedRequest sets the failed status, so each card shows its backend reason instead of a toast.
  • Clearer backend message (DataProductRepository): Asset 'X' is already an input port of this data product; an asset cannot be both an input and an output port. No API, status-code or schema change.

Differences from the main PR, because of what 2.0 lacks

Type of change:

  • Bug fix

Tests:

  • Jest (2.0 worktree, its own yarn install): AssetsSelectionModal/* + InputOutputPortsTab: 6 suites, 97/97 passed.
  • tsc --noEmit: no errors in any touched file (app and playwright/tsconfig.json). Prettier clean.
  • Diff-of-diffs against fix(data-products): port pickers hide assets that can't be ports and show why a port is rejected #36729 (whitespace-normalized): InputOutputPortsTab.component.tsx, DataProductPureUtils.ts, InputOutputPorts.spec.ts and DataProductResourceIT.java are identical to main. Every added line of useAssetSelectionState.test.ts is present.
  • Playwright spec: checked that the new test's helpers (createAssetRef, addInputPorts, navigateToPortsTab, 5 tables) all exist on 2.0. Not run locally. CI runs it, along with ESLint and the Java ITs.

Checklist:

  • I have read the CONTRIBUTING document.
  • For JSON Schema changes: no schema change.
  • I have added tests that cover the scenario.

…show why a port is rejected (#36729)

* fix(data-products): keep port pickers to assets that can be ports and show why a port is rejected

- Output port picker hides the data product's input ports, input port picker
  hides its output ports (ES `ids` exclusion; `id` is text-mapped).
- Asset selection shows the per-asset reasons of an all-failed bulk add (400
  BulkOperationResult) instead of the generic "Error while adding assets!" toast.
- Clearer backend message: "Asset 'X' is already an input port of this data
  product; an asset cannot be both an input and an output port".

* fix(data-products): keep each port picker's exclusions separate

A late port fetch for one picker could overwrite the other picker's
exclusion list when both Add Port buttons were clicked before the first
fetch returned.

* chore(ui): organize imports in InputOutputPortsTab test

2.0 backport notes:
- Includes the column exclusion (PORT_ASSETS_FILTER) from #35740, which 2.0 lacks.
- Adds ids to QueryFieldInterface, as on main, so the ids exclusion type-checks.
- Drops the held-port-change test edit (WorkflowDefinitionResourceIT); 2.0 has no port approvals.
- InputOutputPortsTab test keeps only the port picker suite.

(cherry picked from commit 97af5ab)
@anuj-kumary anuj-kumary added UI UI specific issues safe to test Add this label to run secure Github workflows on PRs skip-pr-checks Bypass PR metadata validation check labels Nov 3, 2026
@anuj-kumary
anuj-kumary requested a review from a team as a code owner November 3, 2026 17:54
@anuj-kumary anuj-kumary added the skip-pr-checks Bypass PR metadata validation check label Nov 3, 2026
@anuj-kumary
anuj-kumary requested a review from a team as a code owner November 3, 2026 17:54
@anuj-kumary
anuj-kumary requested review from Rohit0301 and mohityadav766 and removed request for a team November 3, 2026 17:54
@anuj-kumary anuj-kumary self-assigned this Nov 3, 2026
@github-actions

github-actions Bot commented Nov 3, 2026 •

Copy link
Copy Markdown
Contributor

Jest test Coverage

UI tests summary

Lines Statements Branches Functions
Coverage: 68%
68.64% (83637/121847) 53.66% (52022/96932) 54.33% (15436/28411)

@gitar-bot

gitar-bot Bot commented Nov 4, 2026

Copy link
Copy Markdown
Code Review ✅ Approved

🟡 Medium risk · Port pickers exclude opposite-kind ports and columns, but the 1,000-port cap may still expose conflicting assets that the backend rejects.

Backport of the port picker fix to 2.0: Add Port now excludes assets already on the other port kind via an ES ids query, and rejected port requests show per-asset backend reasons inline instead of a generic error toast. 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

@sonarqubecloud

sonarqubecloud Bot commented Nov 4, 2026

Copy link
Copy Markdown

This branch was previously deployed

1 inactive deployment
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.

3 participants