Skip to content

records import: add missing nodes#4120

Open
SteRiccio wants to merge 40 commits into
masterfrom
fix/records-import-add-missing-nodes
Open

records import: add missing nodes#4120
SteRiccio wants to merge 40 commits into
masterfrom
fix/records-import-add-missing-nodes

Conversation

@SteRiccio

Copy link
Copy Markdown
Member

No description provided.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

This PR updates the Arena Mobile records import job to “fix” imported records using RecordFixer, with the goal of inserting missing nodes (and generally normalizing imported record structures) during import.

Changes:

  • Use RecordFixer.fixRecord during cleanupCurrentRecord instead of custom node validation/cleanup logic.
  • Refactor trackFileUuids iteration from forEach to for...of.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread server/modules/mobile/service/arenaMobileDataImport/jobs/recordsImportJob.js Outdated

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 1 out of 1 changed files in this pull request and generated 2 comments.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread server/modules/mobile/service/arenaMobileDataImport/jobs/recordsImportJob.js Outdated
Comment thread server/modules/mobile/service/arenaMobileDataImport/jobs/recordsImportJob.js Outdated

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 6 out of 6 changed files in this pull request and generated 2 comments.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +27 to 28
super(ArenaMobileDataImportJob.type, params, [new RecordsImportJob(), new FilesImportJob(), new RecordCheckJob()])
}

Copilot AI Mar 12, 2026

Copy link

Choose a reason for hiding this comment

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

RecordCheckJob is now added to the mobile data import pipeline, but (unlike the Collect import / publish flows) this pipeline does not run SurveyRdbCreationJob / RecordsUniquenessValidationJob afterwards. Since RecordCheckJob clears record-keys validation, this can leave imported/updated records without correct duplicate-keys validation. Either add a uniqueness validation step after the check (full or limited to recordUuidsIncluded), or adjust RecordCheckJob so it doesn’t clear record-keys validation when no follow-up uniqueness validation will run.

Copilot uses AI. Check for mistakes.
Comment on lines +227 to +231
if (updateRdb) {
await RecordManager.assocRefDataToNodes({ survey, nodes: allUpdatedNodesArray }, tx)
const { rdbUpdates } = RecordManager.generateRdbUpates({ survey, record, nodesArray: allUpdatedNodesArray })
await this.rdbUpdatesBatchPersister.addItem(rdbUpdates)
}

Copilot AI Mar 12, 2026

Copy link

Choose a reason for hiding this comment

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

updateRdb triggers RDB updates, but this job always calls _clearRecordKeysValidation(record) and validateNodesAndPersistValidation does not validate record key/unique-node uniqueness by default. When RecordCheckJob runs without a subsequent RecordsUniquenessValidationJob/SurveyRdbCreationJob (e.g. the mobile import flow), this can permanently clear existing duplicate-keys validation and never recompute it. Consider either (1) not clearing record-keys validation in this flow, or (2) explicitly re-running record uniqueness validation for the affected records after RDB updates are applied (or flush/apply RDB updates before validating), so record-keys validation remains correct.

Copilot uses AI. Check for mistakes.
@sonarqubecloud

Copy link
Copy Markdown

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants