Skip to content

Conversation

@Retoocs
Copy link
Contributor

@Retoocs Retoocs commented Oct 14, 2025

Description

The problem was, that if you finish the task, which updates any taskRef, that is referenced in the task you are finishing, frontend tries to do reload. I have updated the implementation, that backend sends information, that the task which is being finished, does not exist and the frontend will not reload the task itself.

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

Test Configuration

Name Tested on
OS Ubuntu 24.04.1 LTS
Runtime Node 23.6.1
Dependency Manager NPM 11.0.0
Framework version Angular 19.2.2
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

    • Tasks now expose whether they are still executable.
    • Finishing a task updates and propagates the task’s executability status for consistent UI behavior.
  • Bug Fixes

    • Task content reloads after reference changes only when the task is still executable, reducing unnecessary updates and preventing unintended refreshes.

…ut error message

- fix reloading a non-existing task
@coderabbitai
Copy link

coderabbitai bot commented Oct 14, 2025

Walkthrough

Adds optional executable-state flags to event outcome and task interfaces. Updates finish-task flow to pass this flag into task state updates. TaskContentService stores the flag and gates TASK_REF-triggered reloads based on it.

Changes

Cohort / File(s) Summary of changes
Interfaces: Executable state flags
projects/netgrif-components-core/src/lib/event/model/event-outcomes/task-outcomes/finish-task-event-outcome.ts, projects/netgrif-components-core/src/lib/resources/interface/task.ts
Added optional booleans: FinishTaskEventOutcome.isTaskStillExecutable? and Task.isStillExecutable?.
Services: Propagation and gating
projects/netgrif-components-core/src/lib/task-content/services/task-content.service.ts, projects/netgrif-components-core/src/lib/task/services/finish-task.service.ts
Finish flow now passes isTaskStillExecutable into updateStateData(outcome, flag). Service stores the flag on Task and requires it (true/undefined) before triggering TASK_REF data reloads.

Sequence Diagram(s)

sequenceDiagram
  autonumber
  participant U as User
  participant C as Client UI
  participant F as FinishTaskService
  participant B as Backend
  participant T as TaskContentService

  U->>C: Finish task action
  C->>F: performFinishRequest(taskId)
  F->>B: POST /tasks/{id}/finish
  B-->>F: outcomeResource { outcome, success }
  alt success
    F->>T: updateStateData(outcome, outcome.isTaskStillExecutable)
    T->>T: this._task.isStillExecutable = flag
  else error
    F-->>C: Emit error
  end
Loading
sequenceDiagram
  participant UI as UI Field Update
  participant T as TaskContentService

  UI->>T: updateField(field)
  alt field.type == TASK_REF and (task.isStillExecutable === true or undefined)
    T->>T: Trigger task data reload
  else
    T->>T: Skip reload
  end
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

Pre-merge checks

❌ Failed checks (1 inconclusive)
Check name Status Explanation Resolution
Title Check ❓ Inconclusive The title includes the JIRA ticket and references a taskRef finish‐event issue but is truncated and does not clearly summarize the actual change—adding a boolean flag to control task reload on finish. As written, it remains vague and incomplete, making it difficult to understand the core fix at a glance. Please revise the title to clearly and succinctly capture the main change, for example: “Add isTaskStillExecutable flag to prevent reloading finished taskRef on finish event,” ensuring it is not truncated and reflects the implemented client‐side fix.
✅ Passed checks (2 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Docstring Coverage ✅ Passed No functions found in the changes. Docstring coverage check skipped.

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: 2

📜 Review details

Configuration used: CodeRabbit UI

Review profile: ASSERTIVE

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between f307847 and a7eb4fd.

📒 Files selected for processing (4)
  • projects/netgrif-components-core/src/lib/event/model/event-outcomes/task-outcomes/finish-task-event-outcome.ts (1 hunks)
  • projects/netgrif-components-core/src/lib/resources/interface/task.ts (1 hunks)
  • projects/netgrif-components-core/src/lib/task-content/services/task-content.service.ts (2 hunks)
  • projects/netgrif-components-core/src/lib/task/services/finish-task.service.ts (1 hunks)
🧰 Additional context used
🧬 Code graph analysis (1)
projects/netgrif-components-core/src/lib/task/services/finish-task.service.ts (1)
projects/netgrif-components-core/src/lib/event/model/event-outcomes/task-outcomes/finish-task-event-outcome.ts (1)
  • FinishTaskEventOutcome (4-6)
⏰ 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). (4)
  • GitHub Check: Matrix Test (18)
  • GitHub Check: Matrix Test (14)
  • GitHub Check: Matrix Test (16)
  • GitHub Check: Test with SonarCloud
🔇 Additional comments (3)
projects/netgrif-components-core/src/lib/event/model/event-outcomes/task-outcomes/finish-task-event-outcome.ts (1)

5-5: LGTM!

The property addition aligns with the PR objective to track task executability through event outcomes.

projects/netgrif-components-core/src/lib/task-content/services/task-content.service.ts (1)

209-216: LGTM! Default value ensures backward compatibility.

The isStillExecutable parameter defaults to true, which means existing code paths that don't explicitly pass this flag will assume tasks remain executable. This is appropriate for backward compatibility.

projects/netgrif-components-core/src/lib/task/services/finish-task.service.ts (1)

136-137: LGTM! Correctly propagates executable state.

The changes properly extract the isTaskStillExecutable flag from the finish response and pass it to updateStateData, completing the flow to prevent reloading finished tasks.

Comment on lines +73 to +74

isStillExecutable?: boolean;
Copy link

Choose a reason for hiding this comment

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

🧹 Nitpick | 🔵 Trivial

🧩 Analysis chain

Verify naming consistency across interfaces.

The property is named isStillExecutable here, but isTaskStillExecutable in FinishTaskEventOutcome. While the difference might be intentional (Task context vs Event context), consider whether consistent naming would improve clarity.

Run the following script to check for any other references to these properties:


🏁 Script executed:

#!/bin/bash
# Description: Check usage of the executable state properties across the codebase

echo "=== Checking for isStillExecutable references ==="
rg -n "isStillExecutable" --type=ts

echo -e "\n=== Checking for isTaskStillExecutable references ==="
rg -n "isTaskStillExecutable" --type=ts

Length of output: 1153


Align naming of executable flag across interfaces.
Task interface uses isStillExecutable but FinishTaskEventOutcome defines isTaskStillExecutable. Consider unifying to a single property name (e.g. isStillExecutable) for clarity.

🤖 Prompt for AI Agents
In projects/netgrif-components-core/src/lib/resources/interface/task.ts around
lines 73-74, the Task interface declares the flag as isStillExecutable while
related FinishTaskEventOutcome uses isTaskStillExecutable; rename the latter to
isStillExecutable so both interfaces use the exact same property name, then
update all references/usages, type imports, serializers/deserializers, and tests
to the new name to ensure consistency and no unresolved type or runtime errors.


protected updateField(chFields: ChangedFields, field: DataField<any>, frontendActions: Change, referenced: boolean = false): void {
if (this._fieldConverterService.resolveType(field) === FieldTypeResource.TASK_REF) {
if (this._fieldConverterService.resolveType(field) === FieldTypeResource.TASK_REF && (!!this._task?.isStillExecutable || this._task?.isStillExecutable === undefined)) {
Copy link

Choose a reason for hiding this comment

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

🧹 Nitpick | 🔵 Trivial

Simplify the conditional logic.

The double negation !! is redundant in this boolean context. The condition can be simplified for better readability.

Apply this diff to simplify the condition:

-        if (this._fieldConverterService.resolveType(field) === FieldTypeResource.TASK_REF && (!!this._task?.isStillExecutable || this._task?.isStillExecutable === undefined)) {
+        if (this._fieldConverterService.resolveType(field) === FieldTypeResource.TASK_REF && this._task?.isStillExecutable !== false) {

This alternative reads more clearly: "reload task data unless explicitly marked as not executable."

📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
if (this._fieldConverterService.resolveType(field) === FieldTypeResource.TASK_REF && (!!this._task?.isStillExecutable || this._task?.isStillExecutable === undefined)) {
if (this._fieldConverterService.resolveType(field) === FieldTypeResource.TASK_REF
&& this._task?.isStillExecutable !== false) {
🤖 Prompt for AI Agents
In
projects/netgrif-components-core/src/lib/task-content/services/task-content.service.ts
around line 239, simplify the conditional by removing the redundant double
negation; change the right-hand check to test that the task is not explicitly
false (e.g., this._task?.isStillExecutable !== false) so the whole condition
becomes: ensure the field type is TASK_REF and the task is not explicitly marked
as not executable, which reads as "reload task data unless explicitly marked as
not executable."

@sonarqubecloud
Copy link

Quality Gate Failed Quality Gate failed

Failed conditions
38.9% Coverage on New Code (required ≥ 50%)

See analysis details on SonarQube Cloud

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants