feat(history): migrate C7 async-before/after job logs to C8#1018
Draft
feat(history): migrate C7 async-before/after job logs to C8#1018
Conversation
Copilot
AI
changed the title
[WIP] Migrate async-before/after job logs to C8
feat(history): migrate C7 async-before/after job logs to C8
Feb 19, 2026
1 task
feat(history): migrate async-before/after job logs from C7 to C8 related to #5331 - Add HISTORY_JOB type to IdKeyMapper.TYPE with HistoricJobLogEventEntity class mapping - Create JobMigrator: migrates C7 HistoricJobLog entries tracked by job ID (deduplicates multiple log entries per job) - Create JobTransformer: EntityInterceptor mapping C7 job log fields to C8 JobDbModel (state, retries, error, timing, etc.) - Add fetchAndHandleHistoricJobLogs() and getHistoricJobLog() to C7Client - Add insertJob() to C8Client - Add of(HistoricJobLog) factory method to C7Entity using getJobId() as tracking key - Add HistoricJobLog constructor to EntitySkippedException - Update IncidentMigrator: resolve jobKey for failedJob incidents from HISTORY_JOB tracking table; skip incident if the referenced job was explicitly skipped - Update HistoryMigrator: call migrateJobs() before migrateIncidents() - Enable previously-disabled test shouldNotMigrateIncidentsWhenJobIsSkipped (changed HISTORY_FLOW_NODE to HISTORY_JOB) - Add HistoryJobTest integration tests covering deduplication and incident FK population - Add asyncBeforeUserTaskProcess.bpmn for testing successfully-completed async-before jobs Co-authored-by: yanavasileva <26868499+yanavasileva@users.noreply.github.com> fix(history): update IncidentMigrator Javadoc to reflect job key validation Co-authored-by: yanavasileva <26868499+yanavasileva@users.noreply.github.com>
1f91dec to
2daf6cf
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Migrates Camunda 7
HistoricJobLogentries (async-before/after continuations) to C8JobDbModel, and wires the resulting C8 job key intofailedJobincidents.Core Design
HistoricJobLogentries per job are deduplicated — only the first log entry encountered creates a C8 job record.migrateJobs()runs beforemigrateIncidents()so the C8 job key is available for FK resolution.failedJobincidents,IncidentMigrator.resolveJobKey()looks up the C8 job key from theHISTORY_JOBtracking table. If the job was explicitly skipped (null c8Key), the incident is skipped too (SKIP_REASON_MISSING_JOB_REFERENCE).Changes
New production code:
JobMigrator— batch migratesHistoricJobLogentries; deduplicates bygetJobId()JobTransformer—EntityInterceptor<HistoricJobLog, JobDbModel.Builder>mapping state, retries, error message, deadline, timing, tenant, partition, element IDC7Client—fetchAndHandleHistoricJobLogs()(batch) +getHistoricJobLog(jobId)(retry mode)C8Client.insertJob()via existingJobMapperC7Entity.of(HistoricJobLog)usinggetJobId()as tracking keyEntitySkippedException(HistoricJobLog, msg)constructorIncidentMigrator.resolveJobKey()+isFailedJobIncident()Updated:
HistoryMigrator.migrate()— addsmigrateJobs()stepIdKeyMapper.TYPE.HISTORY_JOB→HistoricJobLogEventEntity.classHistoryMigratorLogs—SKIP_REASON_MISSING_JOB_REFERENCE,logMigratingJob()Tests:
HistoryJobTest— 3 integration tests: async-before migration, incident FK population, deduplication by job IDshouldNotMigrateIncidentsWhenJobIsSkipped(was@Disabled; fixed tracking type fromHISTORY_FLOW_NODE→HISTORY_JOB, fixed job execution to 3× to trigger incident)asyncBeforeUserTaskProcess.bpmn— test resource for successfully-completing async-before jobType of Change
Testing Checklist
Black-Box Testing Requirements
DbClient,IdKeyMapper,..impl..packages except logging constants)ArchitectureTestvalidates these rules)Test Coverage
Architecture Compliance
Run architecture tests to ensure compliance:
mvn test -Dtest=ArchitectureTestIf architecture tests fail, refactor your tests to use:
LogCapturerfor log assertionscamundaClient.new*SearchRequest()for C8 queriesDocumentation
Checklist
Warning
Firewall rules blocked me from connecting to one or more addresses (expand for details)
I tried to connect to the following addresses, but was blocked by firewall rules:
artifacts.camunda.com/usr/lib/jvm/temurin-17-jdk-amd64/bin/java /usr/lib/jvm/temurin-17-jdk-amd64/bin/java --enable-native-access=ALL-UNNAMED --add-exports jdk.compiler/com.sun.tools.javac.api=ALL-UNNAMED --add-exports jdk.compiler/com.sun.tools.javac.file=ALL-UNNAMED --add-exports jdk.compiler/com.sun.tools.javac.parser=ALL-UNNAMED --add-exports jdk.compiler/com.sun.tools.javac.tree=ALL-UNNAMED --add-exports jdk.compiler/com.sun.tools.javac.util=ALL-UNNAMED --add-opens=java.base/java.util=ALL-UNNAMED --add-opens=java.base/java.lang.reflect=ALL-UNNAMED --add-opens=java.base/java.text=ALL-UNNAMED --add-opens=java.desktop/java.awt.font=ALL-UNNAMED -classpath /usr/share/apache-maven-3.9.12/boot/plexus-classworlds-2.9.0.jar -Dclassworlds.conf=/usr/share/apache-maven-3.9.12/bin/m2.conf -Dmaven.home=/usr/share/apache-maven-3.9.12(dns block)docs.camunda.org/home/REDACTED/work/_temp/ghcca-node/node/bin/node /home/REDACTED/work/_temp/ghcca-node/node/bin/node --enable-source-maps /home/REDACTED/work/_temp/copilot-developer-action-main/dist/index.js(dns block)repository.sonatype.org/usr/lib/jvm/temurin-17-jdk-amd64/bin/java /usr/lib/jvm/temurin-17-jdk-amd64/bin/java --enable-native-access=ALL-UNNAMED --add-exports jdk.compiler/com.sun.tools.javac.api=ALL-UNNAMED --add-exports jdk.compiler/com.sun.tools.javac.file=ALL-UNNAMED --add-exports jdk.compiler/com.sun.tools.javac.parser=ALL-UNNAMED --add-exports jdk.compiler/com.sun.tools.javac.tree=ALL-UNNAMED --add-exports jdk.compiler/com.sun.tools.javac.util=ALL-UNNAMED --add-opens=java.base/java.util=ALL-UNNAMED --add-opens=java.base/java.lang.reflect=ALL-UNNAMED --add-opens=java.base/java.text=ALL-UNNAMED --add-opens=java.desktop/java.awt.font=ALL-UNNAMED -classpath /usr/share/apache-maven-3.9.12/boot/plexus-classworlds-2.9.0.jar -Dclassworlds.conf=/usr/share/apache-maven-3.9.12/bin/m2.conf -Dmaven.home=/usr/share/apache-maven-3.9.12(dns block)If you need me to access, download, or install something from one of these locations, you can either:
Original prompt
🔒 GitHub Advanced Security automatically protects Copilot coding agent pull requests. You can protect all pull requests by enabling Advanced Security for your repositories. Learn more about Advanced Security.