Conversation
| final var mode = | ||
| importMode | ||
| ? IMPORT_OWNERS | ||
| : preserveUserOwners ? RETAIN : operation.isPatch() ? REPLACE : REPLACE_IF_NONEMPTY; |
There was a problem hiding this comment.
💡 Quality: Nested ternary for Mode selection hurts readability
The Mode selection uses a 4-way nested ternary (importMode ? IMPORT_OWNERS : preserveUserOwners ? RETAIN : operation.isPatch() ? REPLACE : REPLACE_IF_NONEMPTY). This is functionally correct but hard to scan and audit; a small extracted helper or switch/if-chain per the project's preference for switch expressions would make the owner-vs-domain mode differences clearer. Consider factoring the mode decision into a named private method.
Was this helpful? React with 👍 / 👎
Code Review 👍 Approved with suggestions 0 resolved / 1 findingsReconciles owner/domain references without database access and applies their current-state delta once, gating shared relationship writes during historical comparisons. Consider factoring the nested ternary for 💡 Quality: Nested ternary for Mode selection hurts readability📄 openmetadata-service/src/main/java/org/openmetadata/service/jdbi3/EntityRepository.java:9579-9582 📄 openmetadata-service/src/main/java/org/openmetadata/service/jdbi3/EntityRepository.java:9840-9843 The 🤖 Prompt for agentsOptionsDisplay: compact → Counting what did not apply, without listing it. Comment with these commands to change the behavior for this request:
Was this helpful? React with 👍 / 👎 | Powered by Gitar — free for open source |
Describe your changes:
Part of #32946 — 5/7 in the compatible repository stack, preserving the existing public/protected facade.
Reconciles owner/domain references without database access and applies their current-state delta once, gates shared relationship writes during historical comparisons and avoids rewriting unchanged chart dashboard memberships.
Type of change:
High-level design:
Base:
harshach/entity-stack-04-decisions· Next:harshach/entity-stack-06-shared-updates· Merge in order, retarget/restack children after their parent merges; this head requires no successor code.Tests:
Use cases covered
PATCH/import replacement, unchanged references, removal, session cancellation and persisted owner/domain reads by ID/name; six predecessor cases fail their write budget, all eight pass with the change
Unit tests
EntityReferenceChange100.0%,EntityRepository54.94%,ChartRepository72.3%; no class identity warningsBackend integration tests
EntityConsolidationWritesIT,EntityReferenceChangeTest,EntityRepositorySizeBudgetTestIngestion integration tests
Not applicable — no ingestion code changes
Playwright / UI recording
Not applicable — no UI changes
Manual testing performed
Automated local container executions above; no manual UI testing
Reproduce after building the backend and compiling ITs:
Checklist:
Draft: coverage and performance acceptance are incomplete, and the earlier combined artifact's broad RDF failure remains unresolved; focused passing results do not replace those gates.
Tested head:
b91c6413feb061e0cedf28f351f112b9632aabf8· Native artifact SHA-256:6e562484417305c2410ba686e831f1374b08559ff4f0212bd464edae168b54d4