Skip to content

[NAE-2231] Unable to change behavior of taskRef on finish event witho…#371

Merged
tuplle merged 2 commits intorelease/6.4.2from
NAE-2231
Dec 1, 2025
Merged

[NAE-2231] Unable to change behavior of taskRef on finish event witho…#371
tuplle merged 2 commits intorelease/6.4.2from
NAE-2231

Conversation

@Retoocs
Copy link
Contributor

@Retoocs Retoocs commented Oct 14, 2025

Description

I have added a flag to the FinishTaskEventOutcome. The boolean flag is true if the task, that was finished, is still executable. This information needs frontend to prohibit reloading on non-existing tasks

Fixes NAE-2231

Dependencies

No new dependencies were introduced

Third party dependencies

No new dependencies were introduced

Blocking Pull requests

There are no dependencies on other PR

How Has Been This Tested?

Manually. I tested multiple situations for the updated code conditions

Test Configuration

Name Tested on
OS Ubuntu 24.04.1 LTS
Runtime Java 11
Dependency Manager Maven 3.6.3
Framework version Spring Boot 2.7.8
Run parameters
Other configuration

Checklist:

  • My code follows the style guidelines of this project
  • I have performed a self-review of my own code
  • My changes have been checked, personally or remotely, with @Kovy95
  • I have commented my code, particularly in hard-to-understand areas
  • I have resolved all conflicts with the target branch of the PR
  • I have updated and synced my code with the target branch
  • I have added tests that prove my fix is effective or that my feature works
  • New and existing tests pass locally with my changes:
    • Lint test
    • Unit tests
    • Integration tests
  • I have checked my contribution with code analysis tools:
  • I have made corresponding changes to the documentation:
    • Developer documentation
    • User Guides
    • Migration Guides

Summary by CodeRabbit

  • New Features

    • Added an indicator in finish-task results showing whether the task remains executable after completion.
    • Exposed this status in API responses so clients and UIs can react (e.g., show follow-up actions or keep controls enabled).
    • Improves clarity by distinguishing fully completed tasks from those that can still be acted upon.
  • Chores

    • Updated underlying Elasticsearch image to a newer patch release.

✏️ Tip: You can customize this high-level summary in your review settings.

…ut error message

- implement FinishTaskEventOutcome flag, which signals if the finished task still exists
@Retoocs Retoocs self-assigned this Oct 14, 2025
@Retoocs Retoocs added the bugfix A change that fixes a bug label Oct 14, 2025
@coderabbitai
Copy link

coderabbitai bot commented Oct 14, 2025

Walkthrough

Adds a boolean flag isTaskStillExecutable to FinishTaskEventOutcome, exposes it in LocalisedFinishTaskEventOutcome, and updates docker-compose.yml to use elasticsearch:7.17.28. The flag is computed during construction by checking if the task still exists in the case's tasks.

Changes

Cohort / File(s) Summary of Changes
Domain event outcome update
src/main/java/com/netgrif/application/engine/workflow/domain/eventoutcomes/taskoutcomes/FinishTaskEventOutcome.java
Added protected field isTaskStillExecutable. Imported java.util.Objects. Initialized field in constructor via new protected helper isTaskStillExecutable(Case, Task) which checks task presence by stringId.
Web response body update
src/main/java/com/netgrif/application/engine/workflow/web/responsebodies/eventoutcomes/LocalisedFinishTaskEventOutcome.java
Added protected Boolean isTaskStillExecutable with Lombok @Getter. Constructor sets it from outcome.isTaskStillExecutable() when outcome is non-null; added lombok.Getter import.
Compose configuration update
docker-compose.yml
Updated docker-elastic service image tag from elasticsearch:7.17.4 to elasticsearch:7.17.28. No other changes.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

  • Reviewers may want to inspect:
    • FinishTaskEventOutcome.java — correctness of isTaskStillExecutable comparison and null-safety.
    • LocalisedFinishTaskEventOutcome.java — Lombok getter naming and JSON serialization expectations.
    • docker-compose.yml — compatibility of the updated Elasticsearch image with the application.

Pre-merge checks

❌ Failed checks (1 warning, 1 inconclusive)
Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. You can run @coderabbitai generate docstrings to improve docstring coverage.
Title check ❓ Inconclusive The title is truncated (70 chars) and appears to reference issue NAE-2231, but the full context about preventing frontend reloads is cut off. Complete the PR title to clearly describe the primary change, such as 'Add isTaskStillExecutable flag to prevent frontend reload on finished task' or similar.
✅ Passed checks (1 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 3

📜 Review details

Configuration used: CodeRabbit UI

Review profile: ASSERTIVE

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 14eeaa1 and 240ee7d.

📒 Files selected for processing (2)
  • src/main/java/com/netgrif/application/engine/workflow/domain/eventoutcomes/taskoutcomes/FinishTaskEventOutcome.java (1 hunks)
  • src/main/java/com/netgrif/application/engine/workflow/web/responsebodies/eventoutcomes/LocalisedFinishTaskEventOutcome.java (1 hunks)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (6)
  • GitHub Check: task-list-completed
  • GitHub Check: task-list-completed
  • GitHub Check: task-list-completed
  • GitHub Check: task-list-completed
  • GitHub Check: task-list-completed
  • GitHub Check: task-list-completed
🔇 Additional comments (2)
src/main/java/com/netgrif/application/engine/workflow/domain/eventoutcomes/taskoutcomes/FinishTaskEventOutcome.java (2)

13-16: LGTM!

The field declaration is clear and well-documented.


24-24: LGTM!

The field initialization correctly delegates to the helper method.

Kovy95
Kovy95 previously approved these changes Oct 15, 2025
…ut error message

- Bump Elasticsearch image version in docker-compose from 7.17.4 to 7.17.28.
- Fix null-check and equality handling in task execution logic.
- Remove unnecessary whitespace in LocalisedFinishTaskEventOutcome.
Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 1

♻️ Duplicate comments (2)
src/main/java/com/netgrif/application/engine/workflow/web/responsebodies/eventoutcomes/LocalisedFinishTaskEventOutcome.java (1)

11-12: Field declaration is correct.

The use of Boolean wrapper type allows for null values, which is appropriate for this response body class. The @Getter annotation will generate the accessor method.

Note: A previous review comment suggested renaming the field to taskStillExecutable for a more conventional getter name, but this is a minor style consideration.

src/main/java/com/netgrif/application/engine/workflow/domain/eventoutcomes/taskoutcomes/FinishTaskEventOutcome.java (1)

33-36: Consider additional null safety and method naming clarity.

The implementation has improved with the task != null check and Objects.equals, but two concerns remain:

  1. Potential NPE: While task is checked for null, there's no guarantee that task.getStringId() won't throw an exception or return null. If getStringId() can return null, the current logic is safe; if it can throw, additional handling may be needed.

  2. Method naming: The name isTaskStillExecutable suggests checking whether a task can be executed, but the implementation only verifies existence in the case's task collection. A name like isTaskStillPresent or doesTaskStillExist would more accurately reflect the logic.

To verify the safety of task.getStringId(), run:

#!/bin/bash
# Description: Check Task.getStringId() implementation and usage patterns

# Find the Task class definition and getStringId method
echo "=== Finding Task class and getStringId method ==="
ast-grep --pattern $'class Task {
  $$$
  getStringId() {
    $$$
  }
  $$$
}'

# Check if getStringId can return null
echo -e "\n=== Checking for null checks on getStringId calls ==="
rg -nP --type=java -C3 '\.getStringId\(\)\s*(!= null|== null|\?\.)' 

# Look for @Nullable or @NotNull annotations on getStringId
echo -e "\n=== Checking for nullability annotations ==="
rg -nP --type=java -B5 'getStringId\s*\(' | rg -P '(@Nullable|@NotNull|@NonNull)'
📜 Review details

Configuration used: CodeRabbit UI

Review profile: ASSERTIVE

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 240ee7d and 14e4303.

📒 Files selected for processing (3)
  • docker-compose.yml (1 hunks)
  • src/main/java/com/netgrif/application/engine/workflow/domain/eventoutcomes/taskoutcomes/FinishTaskEventOutcome.java (1 hunks)
  • src/main/java/com/netgrif/application/engine/workflow/web/responsebodies/eventoutcomes/LocalisedFinishTaskEventOutcome.java (1 hunks)
🧰 Additional context used
🧠 Learnings (2)
📓 Common learnings
Learnt from: machacjozef
Repo: netgrif/application-engine PR: 367
File: application-engine/src/main/resources/application.yaml:24-24
Timestamp: 2025-10-20T11:44:44.907Z
Learning: In the netgrif/application-engine project, the correction of the Elasticsearch task index name from "_taks" to "_task" in application.yaml was approved by maintainer machacjozef, indicating that any data migration concerns for this typo fix are handled separately or not applicable to their deployment scenario.
📚 Learning: 2025-08-20T07:27:02.660Z
Learnt from: renczesstefan
Repo: netgrif/application-engine PR: 339
File: application-engine/src/main/java/com/netgrif/application/engine/elastic/service/ElasticTaskQueueManager.java:38-45
Timestamp: 2025-08-20T07:27:02.660Z
Learning: When reviewing ElasticTaskQueueManager changes, task.getTask().getId() returns the document identifier while task.getTaskId() returns the business task identifier. The queue operations should use consistent identifiers throughout the lifecycle (scheduling, processing, cleanup).

Applied to files:

  • src/main/java/com/netgrif/application/engine/workflow/web/responsebodies/eventoutcomes/LocalisedFinishTaskEventOutcome.java
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (1)
  • GitHub Check: Build
🔇 Additional comments (5)
src/main/java/com/netgrif/application/engine/workflow/web/responsebodies/eventoutcomes/LocalisedFinishTaskEventOutcome.java (2)

5-5: LGTM!

The import is correctly added to support the @Getter annotation.


16-18: Constructor initialization looks good.

The null check before accessing outcome.isTaskStillExecutable() is appropriate and prevents potential NPEs.

src/main/java/com/netgrif/application/engine/workflow/domain/eventoutcomes/taskoutcomes/FinishTaskEventOutcome.java (3)

9-9: LGTM!

The Objects import is correctly added to support null-safe equality checks in the helper method.


14-17: Field declaration and documentation are clear.

The javadoc clearly describes the field's purpose, and using a primitive boolean is appropriate for this domain object.


25-25: Constructor initialization is well-structured.

Delegating the logic to the helper method keeps the constructor clean and promotes code reuse.

@tuplle tuplle merged commit 3254c96 into release/6.4.2 Dec 1, 2025
5 of 7 checks passed
@tuplle tuplle deleted the NAE-2231 branch December 1, 2025 16:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bugfix A change that fixes a bug

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants