Skip to content

chore(history): populate process instance treepath#1029

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

chore(history): populate process instance treepath#1029
HeleneW-dot wants to merge 2 commits intomainfrom
431-populate-treepath-process-instance

Conversation

@HeleneW-dot
Copy link
Contributor

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

related to #431

Pull Request Template

Description

Adds treepath migration for process instances.

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

.historyCleanupDate(c8HistoryCleanupDate)
.endDate(c8EndTime);
.endDate(c8EndTime)
.treePath(generateTreepath(builder.build().rootProcessInstanceKey(), processInstanceKey));
Copy link
Member

Choose a reason for hiding this comment

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

To avoid calling build(), can be also the patch can be generated after Line 106. If there's no rootProcessInstanceKey, users can use interception to populate the treePath. We do it in other places as well.

Copy link
Member

Choose a reason for hiding this comment

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

I agree that calling build is not required here.
Consider tracking rootProcessInstanceKey in a local variable instead. The variable is already set in the block above (lines 100-108). Extracting it would be cleaner

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.

See my comments.
If treePath needs to contain the full hierarchy (all intermediate PI keys for deep structures like A→B→C), the current generateTreepath approach won't work. It only encodes root and current node.

Could you confirm whether deeper hierarchies are in scope?

public static String generateTreepath(Long rootProcessInstanceKey, Long processInstanceKey) {
return Objects.equals(rootProcessInstanceKey, processInstanceKey) ?
"PI_" + processInstanceKey :
"PI_" + rootProcessInstanceKey + "/PI_" + processInstanceKey;
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 hierarchy has more then 2 levels for example a chain A→B→C, process C's treePath would be PI_A/PI_C, skipping B.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

See the ticket description/slack link, the treepath is truncated to only keep root and leaf

Copy link
Member

Choose a reason for hiding this comment

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

Sorry, I missed that 👍

.historyCleanupDate(c8HistoryCleanupDate)
.endDate(c8EndTime);
.endDate(c8EndTime)
.treePath(generateTreepath(builder.build().rootProcessInstanceKey(), processInstanceKey));
Copy link
Member

Choose a reason for hiding this comment

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

I agree that calling build is not required here.
Consider tracking rootProcessInstanceKey in a local variable instead. The variable is already set in the block above (lines 100-108). Extracting it would be cleaner

@HeleneW-dot
Copy link
Contributor Author

If treePath needs to contain the full hierarchy (all intermediate PI keys for deep structures like A→B→C), the current generateTreepath approach won't work. It only encodes root and current node.
Could you confirm whether deeper hierarchies are in scope?

We only keep the truncated treepath with root and leaf, I documented this in the ticket together with the slack link for the discussion around this question

@HeleneW-dot HeleneW-dot force-pushed the 431-populate-treepath-process-instance branch 2 times, most recently from 88bb1cf to 6dd9fd5 Compare February 27, 2026 08:30
@HeleneW-dot HeleneW-dot force-pushed the 431-populate-treepath-process-instance branch from 6dd9fd5 to 8d69be7 Compare February 27, 2026 08:43
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.

3 participants