Repository navigation
fix(data-products): port pickers hide assets that can't be ports and show why a port is rejected - #36729
Conversation
… 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".
❌ PR checklist incompleteThis PR cannot be merged until the following are addressed on its linked issue:
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 |
|
Hi there 👋 Thanks for your contribution! The OpenMetadata team will review the PR shortly! Once it has been labeled as Let us know if you need any help! |
|
| Count | Rule |
|---|---|
| 2 | openmetadata-imports/no-lower-layer-page-imports |
| 2 | react-hooks/exhaustive-deps |
| 1 | openmetadata-imports/review-sequential-api-calls |
| 1 | openmetadata-imports/no-impure-pure-utils |
All findings
| Location | Rule | Message | |
|---|---|---|---|
| 🟡 | src/components/DataAssets/AssetsSelectionModal/useAssetSelectionState.ts:48:1 |
openmetadata-imports/no-lower-layer-page-imports |
Pages are route-level composition modules. Move the shared implementation/type to a lower layer instead of importing a page from here. |
| 🟡 | src/components/DataAssets/AssetsSelectionModal/useAssetSelectionState.ts:199:5 |
react-hooks/exhaustive-deps |
React Hook useCallback has a missing dependency: 'activeFilter'. Either include it or remove the dependency array. |
| 🟡 | src/components/DataAssets/AssetsSelectionModal/useAssetSelectionState.ts:270:6 |
react-hooks/exhaustive-deps |
React Hook useEffect has a missing dependency: 'fetchEntities'. Either include it or remove the dependency array. |
| 🟡 | src/components/DataAssets/AssetsSelectionModal/useAssetSelectionState.ts:443:15 |
openmetadata-imports/review-sequential-api-calls |
Review these sequential API requests. If they are independent, start them together with Promise.all/Promise.allSettled; keep sequencing only when data-dependent |
| 🟡 | src/utils/DataProductPureUtils.ts:15:1 |
openmetadata-imports/no-impure-pure-utils |
Pure utilities must not depend on React, UI, state, hooks, pages, or REST clients. Move orchestration/rendering out or move shared types to a lower layer. |
| 🟡 | src/utils/DataProductPureUtils.ts:15:1 |
openmetadata-imports/no-lower-layer-page-imports |
Pages are route-level composition modules. Move the shared implementation/type to a lower layer instead of importing a page from here. |
Fix locally (fast - only checks files changed in this branch):
make ui-checkstyle-changedA 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.
…ort-conflict' into anuj-kumary/asset-input/output-port-conflict
Code Review ✅ Approved 1 closed / 1 findings🟡 Medium risk · Port-picker exclusions and inline bulk-error handling change selection behavior; failed or capped lookups could leave incompatible assets selectable and cause rejected saves. Port pickers now exclude assets that are already the opposite port kind, and rejected adds show the backend reason inline instead of a generic error toast. A race where one shared exclusion list could reach the wrong picker was resolved. No open issues found. ✅ 1 closed✅ Edge Case: Both port pickers share one oppositePortIds, so a late response can reach the wrong picker
VerificationRules No rules evaluated Functional validation Not enabledAuto-approval Not enabledFor more verification details, comment OptionsDisplay: compact → Showing compact verification results. Comment with these commands to change the behavior for this request:
Was this helpful? React with 👍 / 👎 | Powered by Gitar — free for open source |
|
|
Local Java test run: PASSED — details
Tests run locally
Why these tests
Commandsmvn -B package -pl openmetadata-service -am -Dspring-boot.repackage.skip=true -Dtest=EntityRepositoryTagCacheTest,RuleEvaluatorTest -Dsurefire.failIfNoSpecifiedTests=false
mvn -B verify -pl :openmetadata-integration-tests -am -Dspring-boot.repackage.skip=true -Pmysql-elasticsearch -DintegrationTests.lane=parallel -Dit.test=ConfigResourceIT,DataProductDomainMigrationIT,DataProductResourceIT,DatabaseSmokeIT,DomainAssetsColumnExclusionIT,DomainBulkAssetsDryRunIT,DomainIsolationIT,DomainMoveApprovalAuthorizationIT,DomainReassignmentAuthorizationIT,DomainRecreateSameNameIT,DomainResourceIT,GlossaryTermResourceIT,MultiDomainHasDomainIT,SeedDataPresenceIT,TableResourceIT,TestCaseCsvDomainIsolationIT,UserResourceIT -Dfailsafe.failIfNoSpecifiedTests=false -Dtest=NoUnitTestsInThisRun -Dsurefire.failIfNoSpecifiedTests=false
mvn -B verify -pl :openmetadata-integration-tests -am -Dspring-boot.repackage.skip=true -Pmysql-elasticsearch -DintegrationTests.lane=global-state -Dit.test=WorkflowDefinitionResourceIT -Dfailsafe.failIfNoSpecifiedTests=false -Dtest=NoUnitTestsInThisRun -Dsurefire.failIfNoSpecifiedTests=false
mvn -B verify -pl :openmetadata-integration-tests -am -Dspring-boot.repackage.skip=true -Pcache-tests -DintegrationTests.lane=parallel -Dit.test=OneTransactionFlushAtomicityIT -Dfailsafe.failIfNoSpecifiedTests=false -Dtest=NoUnitTestsInThisRun -Dsurefire.failIfNoSpecifiedTests=false |
🚦 Removed from the merge queue —
|
🚦 Removed from the merge queue —
|
…show why a port is rejected (#36729) (#36984) * 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)



Describe your changes:
Fixes #36802
Adding an asset as a data product port failed with a generic "Error while adding assets!" toast whenever the backend rejected it. Two reports:
tableColumn, which can never be a port.The backend is right to reject both. The UI offered assets it can't add and hid the reason:
BulkOperationResultwhose reasons are infailedRequest[].message;response.data.message, so it fell back to the generic text.Changes
InputOutputPortsTab.component.tsx,DataProductPureUtils.ts).idsquery;idis text-mapped in most indexes, so atermsonidnever matches.useAssetSelectionState.ts).failedRequestsets the selection's failed status, so each card shows its backend reason.DataProductRepository.PortRules.alreadyOpposite).Asset 'X' is already part of input ports and cannot be added to outputPortsAsset 'X' is already an input port of this data product; an asset cannot be both an input and an output portColumn results (report 2): on
main, #35740 already dropstableColumnfrom both port pickers (PORT_ASSETS_FILTER). That isn't on2.0, so a 2.0.x backport needs that hunk plus this PR.Type of change:
High-level design:
N/A — bug fix.
Tests:
Use cases covered
Unit tests
useAssetSelectionState.test.ts: an all-failed 400 shows each row's reason inline, with no toast.InputOutputPortsTab.component.test.tsx: the output port picker's query excludes the input port ids.AssetsSelectionModal+InputOutputPortsTab: 9 suites, 125/125 passed.Backend integration tests
DataProductResourceIT.test_assetCannotBeBothInputAndOutputPortDataProductResourceIT.test_assetCannotBeAddedToInputIfAlreadyOutputPortWorkflowDefinitionResourceIT.test_dataProductPortCannotBecomeBothKindsThroughOneRequestLocal Java test run: PASSED
c4dc42a24f05(baseorigin/main)Playwright (UI) tests
InputOutputPorts.spec.ts› Output port picker hides assets that are already input ports.--repeat-each=3.Manual testing performed
must_not: [{ ids }]filter returns 0 hits for that table, and 1 without it.PUT …/inputPorts/addwith atableColumnreturns 400 withfailedRequest[0].message;UI screen recording:
Recorded on this branch's UI (
c4dc42a24f0), Vite against a local OpenMetadata 2.0.0-SNAPSHOT backend.1. Output port picker hides assets that are already input ports
The first table is an input port, and both tables are data product assets. Only the second table is offered.
2. Input port picker hides assets that are already output ports
The first table is an output port. Searching for its exact name doesn't return it. Searching for the other table does.
3. A rejected save shows the reason on the asset card
The table was made an input port through the API while the output picker was open, then saved. The backend returns 400. The drawer shows the reason on that card and a "1 Error" count, with no generic "Error while adding assets!" toast.
The recording backend doesn't include this PR's Java change, so the text shown is the old wording. With this PR it reads "…is already an input port of this data product; an asset cannot be both an input and an output port".
4. A different table as each port: both save
One table is added as an input port and a different table as an output port, both through the pickers. Both are saved and listed.
Still screenshots
Checklist:
Fixes <issue-number>: <short explanation>— pending the support ticket.Fixes #<issue-number>above — pending the support ticket.🤖 Generated with Claude Code