Skip to content

[NAE-2451] Optimize and Reduce Outcome Size - #342

Open
renczesstefan wants to merge 4 commits into
release/7.0.2from
NAE-2451
Open

[NAE-2451] Optimize and Reduce Outcome Size #342
renczesstefan wants to merge 4 commits into
release/7.0.2from
NAE-2451

Conversation

@renczesstefan

@renczesstefan renczesstefan commented Jul 9, 2026

Copy link
Copy Markdown
Member

Description

Implements NAE-2451

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?

This was test manually and with unit tests.

Test Configuration

Name Tested on
OS macOS Tahoe 26.3
Runtime Node 20.17.0
Dependency Manager NPM 10.8.2
Framework version Angular 13.3.1
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 @machacjozef
  • 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 optional request parameters to case and task actions, data retrieval, and data updates.
    • Added default response field selections when custom parameters are not provided.
    • Added support for controlling subtree deletion during case deletion.
  • Tests
    • Updated service tests to cover request parameters for case and task operations.

Updated resource service methods to include additional query fields (`outcomes`, `outcome`, `task(stringId)`, etc.) for task and case-related API calls. This enhancement ensures more comprehensive data retrieval for operations like assign, cancel, delegate, finish, and data manipulation.
Updated resource service methods to include additional query fields (`outcomes`, `outcome`, `task(stringId)`, etc.) for task and case-related API calls. This enhancement ensures more comprehensive data retrieval for operations like assign, cancel, delegate, finish, and data manipulation.
Enhanced task and case-related API methods by introducing `HttpParams` to support additional query parameters. This change enables more versatile and detailed requests for task and case operations.
@renczesstefan renczesstefan self-assigned this Jul 9, 2026
@coderabbitai

coderabbitai Bot commented Jul 9, 2026

Copy link
Copy Markdown

Review Change Stack

Walkthrough

The engine resource services now accept optional request parameters. They apply default fields values when parameters are omitted. Tests pass HttpParams to the updated case and task methods.

Changes

Engine request parameter support

Layer / File(s) Summary
Case request parameters
projects/netgrif-components-core/src/lib/resources/engine-endpoint/case-resource.service.ts, projects/netgrif-components-core/src/lib/resources/engine-endpoint/case-resource.service.spec.ts
deleteCase and createCase accept optional parameters and apply default field selections. deleteSubtree remains conditional. Tests pass HttpParams.
Task request parameters
projects/netgrif-components-core/src/lib/resources/engine-endpoint/task-resource.service.ts, projects/netgrif-components-core/src/lib/resources/engine-endpoint/task-resource.service.spec.ts
Task actions and data methods accept parameters, apply default fields, and forward parameters from getData to rawGetData. Tests pass HttpParams.
Public task request parameters
projects/netgrif-components-core/src/lib/resources/engine-endpoint/public/public-task-resource.service.ts
Public task actions and data methods accept optional parameters and apply default response fields.

Estimated code review effort: 3 (Moderate) | ~20 minutes

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly identifies the main change: reducing outcome size through optimized resource service query parameters.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

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.

@machacjozef
machacjozef changed the base branch from release/7.0.0 to release/7.0.2 July 30, 2026 07:52

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Actionable comments posted: 2

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In
`@projects/netgrif-components-core/src/lib/resources/engine-endpoint/case-resource.service.spec.ts`:
- Line 78: Update the service tests to omit HttpParams and verify each method’s
default fields projection: deleteCase and createCase in
projects/netgrif-components-core/src/lib/resources/engine-endpoint/case-resource.service.spec.ts
(lines 78-78 and 116-116), and assignTask, cancelTask, delegateTask, finishTask,
getData, and setData in
projects/netgrif-components-core/src/lib/resources/engine-endpoint/task-resource.service.spec.ts
(lines 61-61, 77-77, 93-93, 109-109, 221-221, and 246-246). Assert that each
request includes its expected default fields parameter.

In
`@projects/netgrif-components-core/src/lib/resources/engine-endpoint/task-resource.service.ts`:
- Around line 206-211: Update the default fields in rawGetData to include
outcome alongside outcomes, task(stringId), and data, so getData receives the
response required by its responseOutcome.outcome.data access. Preserve
caller-provided params unchanged.
🪄 Autofix

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: ASSERTIVE

Plan: Pro Plus

Run ID: df7d027b-f8f2-4fac-8220-23fd6cb82e7c

📥 Commits

Reviewing files that changed from the base of the PR and between 757d792 and dcd9626.

📒 Files selected for processing (5)
  • projects/netgrif-components-core/src/lib/resources/engine-endpoint/case-resource.service.spec.ts
  • projects/netgrif-components-core/src/lib/resources/engine-endpoint/case-resource.service.ts
  • projects/netgrif-components-core/src/lib/resources/engine-endpoint/public/public-task-resource.service.ts
  • projects/netgrif-components-core/src/lib/resources/engine-endpoint/task-resource.service.spec.ts
  • projects/netgrif-components-core/src/lib/resources/engine-endpoint/task-resource.service.ts

inject([HttpTestingController],
(httpMock: HttpTestingController) => {
service.deleteCase('id').subscribe(res => {
service.deleteCase('id', false, new HttpParams()).subscribe(res => {

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

📐 Maintainability & Code Quality | 🟠 Major | ⚡ Quick win

Test the omitted-parameter behavior.

Every changed test supplies new HttpParams(). That bypasses the new default projection branch. Add no-parameter tests that assert the expected fields parameter.

  • projects/netgrif-components-core/src/lib/resources/engine-endpoint/case-resource.service.spec.ts#L78-L78: call deleteCase without HttpParams and assert its default projection.
  • projects/netgrif-components-core/src/lib/resources/engine-endpoint/case-resource.service.spec.ts#L116-L116: call createCase without HttpParams and assert its default projection.
  • projects/netgrif-components-core/src/lib/resources/engine-endpoint/task-resource.service.spec.ts#L61-L61: call assignTask without HttpParams and assert its default projection.
  • projects/netgrif-components-core/src/lib/resources/engine-endpoint/task-resource.service.spec.ts#L77-L77: call cancelTask without HttpParams and assert its default projection.
  • projects/netgrif-components-core/src/lib/resources/engine-endpoint/task-resource.service.spec.ts#L93-L93: call delegateTask without HttpParams and assert its default projection.
  • projects/netgrif-components-core/src/lib/resources/engine-endpoint/task-resource.service.spec.ts#L109-L109: call finishTask without HttpParams and assert its default projection.
  • projects/netgrif-components-core/src/lib/resources/engine-endpoint/task-resource.service.spec.ts#L221-L221: call getData without HttpParams and assert its default projection.
  • projects/netgrif-components-core/src/lib/resources/engine-endpoint/task-resource.service.spec.ts#L246-L246: call setData without HttpParams and assert its default projection.
📍 Affects 2 files
  • projects/netgrif-components-core/src/lib/resources/engine-endpoint/case-resource.service.spec.ts#L78-L78 (this comment)
  • projects/netgrif-components-core/src/lib/resources/engine-endpoint/case-resource.service.spec.ts#L116-L116
  • projects/netgrif-components-core/src/lib/resources/engine-endpoint/task-resource.service.spec.ts#L61-L61
  • projects/netgrif-components-core/src/lib/resources/engine-endpoint/task-resource.service.spec.ts#L77-L77
  • projects/netgrif-components-core/src/lib/resources/engine-endpoint/task-resource.service.spec.ts#L93-L93
  • projects/netgrif-components-core/src/lib/resources/engine-endpoint/task-resource.service.spec.ts#L109-L109
  • projects/netgrif-components-core/src/lib/resources/engine-endpoint/task-resource.service.spec.ts#L221-L221
  • projects/netgrif-components-core/src/lib/resources/engine-endpoint/task-resource.service.spec.ts#L246-L246
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In
`@projects/netgrif-components-core/src/lib/resources/engine-endpoint/case-resource.service.spec.ts`
at line 78, Update the service tests to omit HttpParams and verify each method’s
default fields projection: deleteCase and createCase in
projects/netgrif-components-core/src/lib/resources/engine-endpoint/case-resource.service.spec.ts
(lines 78-78 and 116-116), and assignTask, cancelTask, delegateTask, finishTask,
getData, and setData in
projects/netgrif-components-core/src/lib/resources/engine-endpoint/task-resource.service.spec.ts
(lines 61-61, 77-77, 93-93, 109-109, 221-221, and 246-246). Assert that each
request includes its expected default fields parameter.

Comment on lines +206 to +211
public rawGetData(taskId: string, params?: Params): Observable<EventOutcomeMessageResource> {
if (!params) {
params = new HttpParams();
params = params.set('fields', 'outcomes,task(stringId),data');
}
return this._resourceProvider.get$('task/' + taskId + "/data", this.SERVER_URL, params)

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🎯 Functional Correctness | 🟠 Major | ⚡ Quick win

Request outcome in the default projection.

When getData(taskId) omits params, this request does not select outcome. Line 233 then dereferences responseOutcome.outcome.data. Add outcome to the default fields to preserve the response required by getData.

Proposed fix
-            params = params.set('fields', 'outcomes,task(stringId),data');
+            params = params.set('fields', 'outcomes,outcome,task(stringId),data');
📝 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
public rawGetData(taskId: string, params?: Params): Observable<EventOutcomeMessageResource> {
if (!params) {
params = new HttpParams();
params = params.set('fields', 'outcomes,task(stringId),data');
}
return this._resourceProvider.get$('task/' + taskId + "/data", this.SERVER_URL, params)
public rawGetData(taskId: string, params?: Params): Observable<EventOutcomeMessageResource> {
if (!params) {
params = new HttpParams();
params = params.set('fields', 'outcomes,outcome,task(stringId),data');
}
return this._resourceProvider.get$('task/' + taskId + "/data", this.SERVER_URL, params)
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In
`@projects/netgrif-components-core/src/lib/resources/engine-endpoint/task-resource.service.ts`
around lines 206 - 211, Update the default fields in rawGetData to include
outcome alongside outcomes, task(stringId), and data, so getData receives the
response required by its responseOutcome.outcome.data access. Preserve
caller-provided params unchanged.

@sonarqubecloud

Copy link
Copy Markdown

Quality Gate Failed Quality Gate failed

Failed conditions
33.8% 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

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant