Fix/unused workflow controller return types#419
Fix/unused workflow controller return types#419machacjozef merged 2 commits intorelease/7.0.0-rev10from
Conversation
|
✅ Actions performedReview triggered.
|
WalkthroughRefactors WorkflowController endpoints to return pre-built HATEOAS resources instead of constructing new PagedModel instances and adds logging and HATEOAS relation metadata to CaseResource. Changes
Estimated code review effort🎯 2 (Simple) | ⏱️ ~10 minutes Suggested labels
🚥 Pre-merge checks | ✅ 2 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (2 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. 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. Comment |
There was a problem hiding this comment.
Actionable comments posted: 2
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In
`@application-engine/src/main/java/com/netgrif/application/engine/workflow/web/responsebodies/CaseResource.java`:
- Line 20: The constructor debug log in CaseResource currently exposes
content.get_id() and class name; remove the identifier from the debug-level
message to avoid leaking IDs and reduce noise, and if you still need the ID for
troubleshooting move that detailed log to trace-level (e.g., use
log.debug("Creating CaseResource, locale={}", LocaleContextHolder.getLocale())
and log.trace(...) including content.get_id() and content.getClass().getName());
update the logging call in the CaseResource constructor accordingly so debug is
minimal and detailed identifiers are logged only at trace.
In
`@application-engine/src/main/java/com/netgrif/application/engine/workflow/web/WorkflowController.java`:
- Around line 132-142: The current debug logs in WorkflowController expose
identifiers and full PagedModel content; change them to only log non-sensitive
summaries: replace the first debug (which uses cases.map(Case::getStringId))
with a message that logs just counts like cases.getNumberOfElements() and
cases.getTotalElements(), and replace the later debug that logs the entire
PagedModel resources with a concise summary of paging info (pageable/page
number, size, total pages) and the assembler/selfLink relation; update the debug
calls around the variables cases and resources accordingly to avoid logging
identifiers or full objects.
ℹ️ Review info
Configuration used: Organization UI
Review profile: ASSERTIVE
Plan: Pro
📒 Files selected for processing (2)
application-engine/src/main/java/com/netgrif/application/engine/workflow/web/WorkflowController.javaapplication-engine/src/main/java/com/netgrif/application/engine/workflow/web/responsebodies/CaseResource.java
...e/src/main/java/com/netgrif/application/engine/workflow/web/responsebodies/CaseResource.java
Outdated
Show resolved
Hide resolved
...ion-engine/src/main/java/com/netgrif/application/engine/workflow/web/WorkflowController.java
Outdated
Show resolved
Hide resolved
|
Oops, something went wrong! Please try again later. 🐰 💔 |
|
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. Comment |
Updated logging level in `CaseResource` and `WorkflowController` to TRACE to capture granular debugging details without cluttering DEBUG-level logs. This change ensures better log granularity and improved log management.
There was a problem hiding this comment.
♻️ Duplicate comments (1)
application-engine/src/main/java/com/netgrif/application/engine/workflow/web/WorkflowController.java (1)
132-148:⚠️ Potential issue | 🟠 MajorAvoid logging case IDs and full paged payloads in TRACE logs.
Line 133 logs identifiers, and Line 141/Line 147 log the full
PagedModel. This can leak internal data and create oversized logs under trace-enabled troubleshooting.Proposed fix
- if (log.isTraceEnabled()) { - log.trace("Found {} cases with id {}.", cases.getNumberOfElements(), cases.map(Case::getStringId)); - } + if (log.isTraceEnabled()) { + log.trace("Search returned page: elementsOnPage={}, totalElements={}, page={}, size={}", + cases.getNumberOfElements(), cases.getTotalElements(), cases.getNumber(), cases.getSize()); + } @@ - if (log.isTraceEnabled()) { - log.trace("Paged model of {}", resources); - } + if (log.isTraceEnabled()) { + log.trace("Paged model built: elements={}, links={}", + resources.getContent().size(), resources.getLinks().size()); + } @@ - if (log.isTraceEnabled()) { - log.trace("Returning paged model with link: {}", resources); - } + if (log.isTraceEnabled()) { + log.trace("Returning search response for relation={}", selfLink.getRel()); + }🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@application-engine/src/main/java/com/netgrif/application/engine/workflow/web/WorkflowController.java` around lines 132 - 148, Replace the TRACE logs that output case identifiers and the full PagedModel in WorkflowController: remove or change the calls that log cases.map(Case::getStringId) and the full resources object (the log.trace lines referencing cases and resources) and instead log only non-sensitive metadata such as cases.getNumberOfElements(), pageable info, or the selfLink relation. Update the trace statements around the assembler.toModel(...) and ResourceLinkAssembler.addLinks(...) sections to avoid printing Case::getStringId or resources; keep minimal contextual messages (e.g., "Returning paged model with N elements and rel X") referencing cases.getNumberOfElements() and selfLink.getRel() to locate the code to modify.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Duplicate comments:
In
`@application-engine/src/main/java/com/netgrif/application/engine/workflow/web/WorkflowController.java`:
- Around line 132-148: Replace the TRACE logs that output case identifiers and
the full PagedModel in WorkflowController: remove or change the calls that log
cases.map(Case::getStringId) and the full resources object (the log.trace lines
referencing cases and resources) and instead log only non-sensitive metadata
such as cases.getNumberOfElements(), pageable info, or the selfLink relation.
Update the trace statements around the assembler.toModel(...) and
ResourceLinkAssembler.addLinks(...) sections to avoid printing Case::getStringId
or resources; keep minimal contextual messages (e.g., "Returning paged model
with N elements and rel X") referencing cases.getNumberOfElements() and
selfLink.getRel() to locate the code to modify.
ℹ️ Review info
Configuration used: Organization UI
Review profile: ASSERTIVE
Plan: Pro
📒 Files selected for processing (2)
application-engine/src/main/java/com/netgrif/application/engine/workflow/web/WorkflowController.javaapplication-engine/src/main/java/com/netgrif/application/engine/workflow/web/responsebodies/CaseResource.java
Description
Fixes unused workflowcontroller response, and adds additional logging to search endpoint.
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 tested manually.
Checklist:
Summary by CodeRabbit
Refactor
Chores