-
Notifications
You must be signed in to change notification settings - Fork 1.6k
Optimised Internal methods for adding relationships for import, fixed circular dependency, generated changeEvents #25582
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Optimised Internal methods for adding relationships for import, fixed circular dependency, generated changeEvents #25582
Conversation
- **Tag clearing fix**: Add deleteTagsByTarget before applying new tags in batch imports to match single entity import behavior, ensuring empty CSV fields properly clear existing tags - **Circular dependency detection fix**: Pre-track entities in dryRunCreatedEntities before parent resolution to enable proper circular reference validation during CSV team imports - Resolves test failures in TeamResourceIT.test_importCsv_circularDependency_trueRun and tag-related import issues - Maintains batch import performance while restoring pre-batch-import validation contracts
| List<EntityInterface> toUpdate = new ArrayList<>(); | ||
| List<EntityInterface> originals = new ArrayList<>(); | ||
|
|
||
| for (PendingEntityOperation op : ops) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Details
When an update operation has a null originalEntity, the code logs a warning but doesn't actually handle the entity:
} else {
// Verify we have the original entity for update
if (op.originalEntity != null) {
toUpdate.add(op.entity);
originals.add(op.originalEntity);
} else {
// Should not happen if createEntity logic is correct, but fallback safely
LOG.warn(
"Missing original entity for update operation: {}",
op.entity.getFullyQualifiedName());
// Treat as potential create or individual fallback?
// Safest is to let it fail or try individual update fallback
}
}The entity is silently dropped from processing - no exception is thrown, no fallback is executed, and no failure is recorded to the CSV import results. This could lead to data loss where users think their update succeeded (since no error is reported in the import results) but the entity was never actually updated.
Consider either:
- Adding the entity to a separate fallback list for individual processing
- Recording an import failure for this row
- Throwing an exception if this is truly unexpected
Was this helpful? React with 👍 / 👎
|
|
||
| // Validate hierarchy now that entity is pre-tracked | ||
| if (processRecord) { | ||
| TeamRepository repository = (TeamRepository) Entity.getEntityRepository(TEAM); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Details
In the overridden createEntity method, processRecord is checked but this check is likely incorrect:
@Override
protected void createEntity(CSVPrinter resultsPrinter, CSVRecord csvRecord, Team entity)
throws IOException {
// Validate hierarchy now that entity is pre-tracked
if (processRecord) { // This check is redundant/suspicious
TeamRepository repository = (TeamRepository) Entity.getEntityRepository(TEAM);The createEntity method is only called when processRecord is already true (from the createRecord method). Checking processRecord again inside createEntity is redundant and could be confusing. Additionally, if processRecord is modified elsewhere between the call and this check, it could lead to inconsistent state.
Consider removing the redundant check or documenting why it's necessary.
Was this helpful? React with 👍 / 👎
… batched operations
- Add batch lock check to HierarchicalLockManager - Add batch cache write to EntityRepository - Fix createManyEntitiesForImport with batched operations - Fix updateManyEntitiesForImport with batched operations - Add change event creation in flushPendingEntityOperations
🔍 CI failure analysis for c417d98: CSV import regression persists across backend (Java) and frontend (Playwright) tests. Python S3 test failure is infrastructure-related (AWS STS API version mismatch), NOT caused by PR changes. PR remains critically blocked by CSV import bug.IssueThe CSV import regression PERSISTS across ALL TEST LEVELS after commit c417d98 Root CauseCommit c417d98 added COMPREHENSIVE TEST FAILURE ANALYSISIntegration Tests - Backend (Java)PostgreSQL OpenSearch (Job 61823228366):
MySQL Elasticsearch (Job 61823228381):
E2E Tests - Frontend (Playwright)Shard 2 (Job 61823228355):
Shards 4 & 6 (Jobs 61823228347, 61823228346):
Shards 1 & 5:
Python Tests (Job 61823228333)Python 3.10:
Error: Analysis: This is an AWS SDK/STS API version compatibility issue in the test infrastructure, NOT related to the PR changes:
Status: CRITICAL FINDING: CSV Import Regression Confirmed at ALL Java/Frontend Test LevelsBackend Integration Tests: Frontend E2E Tests:
This confirms the CSV import regression affects BOTH the backend API layer AND the frontend UI layer, indicating a fundamental bug in the CSV import/export logic. AnalysisWhy did commit c417d98 fail to fix the issue? The commit added The actual problem:
Impact on E2E Tests: The E2E tests exercise the full CSV import/export workflow through the UI:
Since the backend CSV import logic is broken, the E2E tests fail when attempting to re-import the CSV files. What c417d98 did:
What's still broken:
Solution RequiredThe fix should address the entity tracking issue:
The batch storage improvements in c417d98 are good for performance, but they don't address the core issue with entity tracking and constraint resolution. Test Results SummaryIntegration Tests (Java): PostgreSQL OpenSearch (61823228366):
MySQL Elasticsearch (61823228381):
E2E Tests (Playwright): Shard 1 (61823228345):
Shard 2 (61823228355):
Shard 4 (61823228347):
Shard 5 (61823228351):
Shard 6 (61823228346):
Python Tests: Python 3.10 (61823228333):
ImpactThe PR remains CRITICALLY BLOCKED by CSV import regression:
Python S3 test failure is NOT blocking - it's an infrastructure issue (AWS STS API version mismatch) unrelated to the PR changes (no Python files modified). Code Review
|
| Auto-apply | Compact |
|
|
Was this helpful? React with 👍 / 👎 | Gitar
Describe your changes:
Fixes
I worked on ... because ...
Type of change:
Checklist:
Fixes <issue-number>: <short explanation>