Skip to content

chore(history): populate incident treepath#1046

Open
HeleneW-dot wants to merge 2 commits intomainfrom
431-populate-treepath-incident
Open

chore(history): populate incident treepath#1046
HeleneW-dot wants to merge 2 commits intomainfrom
431-populate-treepath-incident

Conversation

@HeleneW-dot
Copy link
Contributor

@HeleneW-dot HeleneW-dot commented Feb 26, 2026

related to #431

Pull Request Template

Description

Populates incident treePath.
Note: in operate UI, cancelled instances do not show any incident UI parts so migrated incident history will not be shown in the UI regardless of treepath. Since implementation effort was low, I still added the truncated treepath for consistency in the same truncation manner as for process and flownode instances (only keeping root and leaf).

Type of Change

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • Documentation update
  • Refactoring (no functional changes)
  • Test-only changes (no production code changes)

Testing Checklist

Black-Box Testing Requirements

  • Tests follow black-box testing approach: verify behavior through observable outputs (logs, C8 API queries, real-world skip scenarios)
  • Tests DO NOT access implementation details (DbClient, IdKeyMapper, ..impl.. packages except logging constants)
  • Architecture tests pass (ArchitectureTest validates these rules)

Test Coverage

  • Added tests for new functionality
  • Updated tests for modified functionality
  • All tests pass locally

Architecture Compliance

Run architecture tests to ensure compliance:

mvn test -Dtest=ArchitectureTest

If architecture tests fail, refactor your tests to use:

  • LogCapturer for log assertions
  • camundaClient.new*SearchRequest() for C8 queries
  • Real-World skip scenarios (e.g., migrate children without parents)

Documentation

  • Updated TESTING_GUIDELINES.md if adding new test patterns
  • Added Javadoc comments for public APIs
  • Updated README if user-facing changes

Checklist

  • Code follows project style guidelines
  • Self-reviewed the code
  • Added comments for complex logic
  • No new compiler warnings
  • Dependent changes have been merged

Related Issues

#431

Copy link
Member

@venetrius venetrius left a comment

Choose a reason for hiding this comment

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

I had a few questions / suggestions.

if (!c7Client.hasWaitingExecution(c7Incident.getProcessInstanceId(), c7Incident.getActivityId())) { // Activities on async before waiting state will not have a flow node instance key, but should not be skipped
throw new EntitySkippedException(c7Incident, SKIP_REASON_MISSING_FLOW_NODE);
if (dbModel.flowNodeInstanceKey() == null) {
if (!c7Client.hasWaitingExecution(c7Incident.getProcessInstanceId(), c7Incident.getActivityId())) {
Copy link
Member

Choose a reason for hiding this comment

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

❓ If the incident is not skipped. Then the C7 execution is completed the incident will have an inconsistent tree patch in C8. Is that a trade off we accepted?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes the treePath is not a reason to skip the incidentMigration, I will add this to the documentation

.isEqualTo("PI_" + processInstanceKey + "/FNI_" + flownodeInstanceKey);
}

protected void assertOnIncidentBasicFields(IncidentEntity c8Incident, HistoricIncident c7Incident, ProcessInstance c7ChildInstance, ProcessInstance c7ParentInstance) {
Copy link
Member

Choose a reason for hiding this comment

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

🙃 Would it make sense to assert treePath here?

Copy link
Contributor Author

@HeleneW-dot HeleneW-dot Feb 27, 2026

Choose a reason for hiding this comment

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

Hm I felt the treepath is not one of the basic/important fields, if we wanted to assert it here we would also need to pass the IncidentDbModel as the treepath is not included in the IncidentEntity - I feel that its not worth this added effort

@HeleneW-dot HeleneW-dot force-pushed the 431-populate-treepath-incident branch from d284ad3 to b95f3e8 Compare February 27, 2026 08:01
Copy link
Member

@venetrius venetrius left a comment

Choose a reason for hiding this comment

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

👍 Looks good to me.

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