Skip to content

History Migrator: Update skip reasons during retry#393

Draft
Copilot wants to merge 4 commits intomainfrom
copilot/keep-skip-reason-up-to-date
Draft

History Migrator: Update skip reasons during retry#393
Copilot wants to merge 4 commits intomainfrom
copilot/keep-skip-reason-up-to-date

Conversation

Copy link
Contributor

Copilot AI commented Nov 18, 2025

History Migrator: Update skip reasons during retry

Summary

Resolved merge conflicts after repository restructuring. The main codebase was reorganized with files moved to new locations.

Changes Applied

  1. BaseMigrator.java (new location): Applied the 3-line skip reason update fix to the saveRecord() method
  2. HistoryMigrationRetryTest.java (new location): Added test case shouldUpdateSkipReasonOnRetry() using public APIs

Repository Restructuring Handled

  • Old: core/src/main/java/io/camunda/migrator/HistoryMigrator.java

  • New: data-migrator/core/src/main/java/io/camunda/migration/data/impl/history/migrator/BaseMigrator.java

  • Old: qa/src/test/java/io/camunda/migrator/qa/history/HistoryMigrationRetryTest.java

  • New: data-migrator/qa/integration-tests/src/test/java/io/camunda/migration/data/qa/history/HistoryMigrationRetryTest.java

The Fix

protected void saveRecord(String c7Id, Long c8Key, TYPE type, Date createTime, String skipReason) {
  if (RETRY_SKIPPED.equals(mode)) {
    dbClient.updateC8KeyByC7IdAndType(c7Id, c8Key, type);
    if (c8Key == null && skipReason != null) {
      dbClient.updateSkipReason(c7Id, type, skipReason);  // Now updates skip reason
    }
  } else if (MIGRATE.equals(mode)) {
    dbClient.insert(c7Id, c8Key, createTime, type, skipReason);
  }
}

Test Approach

  • Creates natural skip scenario (C7 process without C8 deployment)
  • Verifies skipping via LIST_SKIPPED mode with CapturedOutput
  • Deploys to C8 and retries migration
  • Verifies successful migration via searchHistoricProcessInstances()

All changes use public APIs avoiding direct DbClient/IdKeyMapper usage for verification.

Original prompt

This section details on the original issue you should resolve

<issue_title>Data Migrator - History - Keep skip reason up to date</issue_title>
<issue_description>### User Story (Required on creation)

Functional Requirements (Required before implementation)

Technical Requirements (Required before implementation)

Limitations of Scope

Hints

Links

Breakdown

Pull Requests

Dev2QA handover

  • Does this ticket need a QA test and the testing goals are not clear from the description? Add a Dev2QA handover comment</issue_description>

Comments on the Issue (you are @copilot in this section)


✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.

@tasso94
Copy link
Member

tasso94 commented Nov 18, 2025

@copilot, can you please improve your test. Try to avoid using internal API like the DbClient or IdKeyMapper directly. Instead, try to produce a state using the public API.

Copilot AI changed the title [WIP] Update skip reason in data migrator history History Migrator: Update skip reasons during retry Nov 18, 2025
Copilot AI requested a review from tasso94 November 18, 2025 16:35
Copy link
Contributor Author

Copilot AI commented Nov 18, 2025

@copilot, can you please improve your test. Try to avoid using internal API like the DbClient or IdKeyMapper directly. Instead, try to produce a state using the public API.

Refactored the test in commit 801a367. The test now:

  • Creates a natural skip scenario by not deploying the process definition to C8
  • Verifies skipped entities using LIST_SKIPPED mode output (CapturedOutput)
  • Verifies successful migration using searchHistoricProcessInstances() C8 search API
  • No longer uses IdKeyMapper.findSkippedByType() or manual dbClient.insert() for setup

Copilot AI and others added 3 commits November 19, 2025 14:27
Co-authored-by: tasso94 <3015690+tasso94@users.noreply.github.com>
Co-authored-by: tasso94 <3015690+tasso94@users.noreply.github.com>
Co-authored-by: tasso94 <3015690+tasso94@users.noreply.github.com>
@tasso94 tasso94 force-pushed the copilot/keep-skip-reason-up-to-date branch from 801a367 to 5b2c0e8 Compare November 19, 2025 13:27
@tasso94
Copy link
Member

tasso94 commented Nov 19, 2025

@copilot, fix compilation errors.

…ing() and remove reset()

Co-authored-by: tasso94 <3015690+tasso94@users.noreply.github.com>
@tasso94
Copy link
Member

tasso94 commented Feb 17, 2026

@copilot, resolve merge conflicts.

Copy link
Contributor Author

Copilot AI commented Feb 17, 2026

@copilot, resolve merge conflicts.

Merge conflicts resolved in commit 619a1e3. Applied changes to new repository structure:

  • BaseMigrator.saveRecord() now updates skip reasons during RETRY_SKIPPED mode
  • Test shouldUpdateSkipReasonOnRetry() added to new test file location
  • All code relocated to data-migrator/ directory structure

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.

Data Migrator - History - Keep skip reason up to date

2 participants