Skip to content

[RHCLOUD-35781] Drawer feature enabling according to org#4307

Merged
g-duval merged 3 commits intoRedHatInsights:masterfrom
bonscji1:drawer-feature-enabling-according-org_id
Apr 8, 2026
Merged

[RHCLOUD-35781] Drawer feature enabling according to org#4307
g-duval merged 3 commits intoRedHatInsights:masterfrom
bonscji1:drawer-feature-enabling-according-org_id

Conversation

@bonscji1
Copy link
Copy Markdown
Contributor

@bonscji1 bonscji1 commented Apr 7, 2026

Summary by CodeRabbit

  • Improvements

    • Drawer notifications and drawer availability are now configurable per organization, so some orgs may see the Drawer option while others do not.
    • Subscription type choices (e.g., Drawer) and drawer processing now respect organization-specific settings.
  • Tests

    • Expanded test coverage verifying organization-specific drawer enablement, notification retrieval, and processing behavior.

jbonsch added 2 commits April 2, 2026 16:56
…over changes

Assisted-by: Claude Sonnet 4.5 (via Claude Code)
Assisted-by: Claude Sonnet 4.5 (via Claude Code)
@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai bot commented Apr 7, 2026

📝 Walkthrough

Walkthrough

Drawer enablement checks were made organization-aware by adding an orgId parameter to isDrawerEnabled(...) and threading that org context through configuration, repositories, router handlers, processors, and tests so drawer behavior is evaluated per organization.

Changes

Cohort / File(s) Summary
Configuration
backend/src/main/java/com/redhat/cloud/notifications/config/BackendConfig.java, engine/src/main/java/com/redhat/cloud/notifications/config/EngineConfig.java
Changed isDrawerEnabled()isDrawerEnabled(String orgId) and, when Unleash is enabled, build an UnleashContext with orgId to evaluate the drawer toggle; fallback to local flag when disabled.
Backend Repositories
backend/src/main/java/com/redhat/cloud/notifications/db/repositories/SubscriptionRepository.java, backend/src/main/java/com/redhat/cloud/notifications/db/repositories/TemplateRepository.java
Threaded orgId into subscription-type filtering: getAvailableTypes(...)getAvailableTypes(orgId) and isSubscriptionTypeSupported(..., orgId), switching drawer checks to use org-aware config.
Engine Processing
engine/src/main/java/com/redhat/cloud/notifications/events/ConnectorReceiver.java, engine/src/main/java/com/redhat/cloud/notifications/processors/drawer/DrawerProcessor.java
Made drawer processing org-scoped: DrawerProcessor now checks engineConfig.isDrawerEnabled(event.getOrgId()); ConnectorReceiver no longer gates calling drawer return logic by global flag.
Router Handlers (Backend)
backend/src/main/java/com/redhat/cloud/notifications/routers/handlers/drawer/DrawerResource.java, backend/src/main/java/com/redhat/cloud/notifications/routers/handlers/userconfig/UserConfigResource.java
Updated drawer availability checks to pass resolved orgId to isDrawerEnabled(orgId) and to pass orgId into template/repository calls where needed.
Backend Tests (Repository & Resource)
backend/src/test/.../TemplateRepositoryTest.java, backend/src/test/.../drawer/DrawerResourceTest.java
Added/mock BackendConfig with org-aware stubs, updated calls to include orgId, aligned test data (notifications/events) with event orgs, and added org-specific drawer behavior tests.
Backend Tests (UserConfig)
backend/src/test/.../userconfig/UserConfigResourceTemplateModuleTest.java, backend/src/test/.../userconfig/UserConfigResourceTest.java
Threaded orgId through helper builders and assertion helpers, changed drawer gating to backendConfig.isDrawerEnabled(orgId), updated stubs to anyString()/eq(orgId), and added tests verifying drawer present/absent per org.
Engine Tests
engine/src/test/.../events/ConnectorReceiverTest.java, engine/src/test/.../processors/drawer/DrawerProcessorTest.java
Added tests and spies for drawer callback handling, updated mocks to org-aware isDrawerEnabled(anyString()), and added a test ensuring processing occurs only for orgs with drawer enabled.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~22 minutes

Poem

🐰 I threaded IDs through every burrow and door,
Each drawer now opens for its own floor,
Org by org, neat rows align—
No more lost notes in a communal line,
Hooray! The hop of order once more. 🥕

🚥 Pre-merge checks | ✅ 2 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (2 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The PR title clearly and specifically describes the main change: making drawer feature enablement organization-specific rather than global.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

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.

@github-actions
Copy link
Copy Markdown
Contributor

github-actions bot commented Apr 7, 2026

SC Environment Impact Assessment

Overall Impact: 🟢 LOW

View full report

Summary

  • Total Issues: 2
  • 🟢 Low: 2

Detailed Findings

🟢 LOW Impact

Feature flag change detected

  • File: backend/src/main/java/com/redhat/cloud/notifications/config/BackendConfig.java
  • Category: feature_flags
  • Details:
    • Found Unleash in backend/src/main/java/com/redhat/cloud/notifications/config/BackendConfig.java at line 167
    • Found unleash in backend/src/main/java/com/redhat/cloud/notifications/config/BackendConfig.java at line 167
    • Found unleash in backend/src/main/java/com/redhat/cloud/notifications/config/BackendConfig.java at line 168
  • Recommendation: Verify feature flags are properly configured for SC Environment. Test bypass options for services not available in SC Environment.

Feature flag change detected

  • File: engine/src/main/java/com/redhat/cloud/notifications/config/EngineConfig.java
  • Category: feature_flags
  • Details:
    • Found Unleash in engine/src/main/java/com/redhat/cloud/notifications/config/EngineConfig.java at line 233
    • Found unleash in engine/src/main/java/com/redhat/cloud/notifications/config/EngineConfig.java at line 233
    • Found unleash in engine/src/main/java/com/redhat/cloud/notifications/config/EngineConfig.java at line 234
  • Recommendation: Verify feature flags are properly configured for SC Environment. Test bypass options for services not available in SC Environment.

Required Actions

  • Review all findings above
  • Verify SC Environment compatibility for all detected changes
  • Update deployment documentation if needed
  • Coordinate with ROSA Core team or deployment timeline

This assessment was automatically generated. Please review carefully and consult with the ROSA Core team for critical/high impact changes.

Copy link
Copy Markdown
Contributor

@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.

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
backend/src/main/java/com/redhat/cloud/notifications/routers/handlers/drawer/DrawerResource.java (1)

77-82: ⚠️ Potential issue | 🟠 Major

Apply the same org gate to PUT /read.

This GET path is now correctly org-scoped, but updateNotificationReadStatus(...) below still updates rows unconditionally. That leaves drawer-disabled orgs able to mutate hidden notifications if they already know the IDs.

Suggested change
 public Integer updateNotificationReadStatus(`@Context` SecurityContext securityContext, UpdateNotificationDrawerStatus drawerStatus) {
     String orgId = getOrgId(securityContext);
+    if (!backendConfig.isDrawerEnabled(orgId)) {
+        return 0;
+    }
     String username = getUsername(securityContext);
     return drawerRepository.updateReadStatus(orgId, username, drawerStatus.getNotificationIds(), drawerStatus.getReadStatus());
 }
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In
`@backend/src/main/java/com/redhat/cloud/notifications/routers/handlers/drawer/DrawerResource.java`
around lines 77 - 82, The PUT /read handler (updateNotificationReadStatus)
currently updates notifications regardless of org drawer enabled state; guard
the updater with the same org gate used in the GET path by checking
backendConfig.isDrawerEnabled(orgId) before performing any updates (e.g., before
calling drawerRepository.update... / updateNotificationReadStatus logic) and
return the appropriate no-op or error response when the drawer is disabled for
that org; ensure you reference updateNotificationReadStatus and
backendConfig.isDrawerEnabled(orgId) so the update path mirrors the GET path's
org-scoping.
🧹 Nitpick comments (5)
engine/src/test/java/com/redhat/cloud/notifications/events/ConnectorReceiverTest.java (1)

299-343: Test name is misleading relative to assertions.

At Line 299, the method name says “does not trigger drawer processing,” but the test verifies drawerProcessor.manageConnectorDrawerReturnsIfNeeded(...) is called once. Consider renaming to reflect that the handler is invoked but receives a non-drawer type payload.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In
`@engine/src/test/java/com/redhat/cloud/notifications/events/ConnectorReceiverTest.java`
around lines 299 - 343, The test method name
testNonDrawerCallbackDoesNotTriggerDrawerProcessing is misleading because it
asserts that drawerProcessor.manageConnectorDrawerReturnsIfNeeded(...) is called
once; rename the test to accurately describe behavior (e.g.,
testHandlerInvokedForNonDrawerTypeOr
testManagesConnectorReturnsForNonDrawerPayload) and update any references;
ensure the method signature and any usages (test framework annotations) are
updated to the new name so the assertions around
drawerProcessor.manageConnectorDrawerReturnsIfNeeded(...) and the captured
"details" type remain correct.
engine/src/main/java/com/redhat/cloud/notifications/config/EngineConfig.java (1)

182-182: Avoid logging drawer toggle state using a null org context.

At Line 182, isDrawerEnabled(null) can produce a value that doesn’t represent real per-org behavior. Consider logging this toggle as “org-scoped” (or logging a representative org in non-prod diagnostics) to avoid misleading startup config output.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@engine/src/main/java/com/redhat/cloud/notifications/config/EngineConfig.java`
at line 182, The startup config currently calls isDrawerEnabled(null) and logs
that value via config.put(drawerToggle, ...), which can be misleading because
null does not represent per-org behavior; update the logic around
config.put(drawerToggle, ...) to avoid invoking isDrawerEnabled(null) — instead
store a sentinel like "org-scoped" (or, only in non-prod diagnostics, call
isDrawerEnabled with a representative org id) so the startup output clearly
indicates the toggle is org-scoped rather than a global boolean; reference the
existing drawerToggle key and the isDrawerEnabled(...) method when making the
change.
backend/src/main/java/com/redhat/cloud/notifications/db/repositories/TemplateRepository.java (1)

359-361: Skip the drawer template lookup when the org is disabled.

In the DRAWER branch, checkIfExistDrawerTemplateByEventType(...) still hits the DB before the org toggle is evaluated. Since this method runs while building the user-config schema, disabled orgs pay for that query on every event type only to return false.

Suggested change
                 case DRAWER:
-                    checkIfExistDrawerTemplateByEventType(eventTypeId);
-                    return backendConfig.isDrawerEnabled(orgId);
+                    if (!backendConfig.isDrawerEnabled(orgId)) {
+                        return false;
+                    }
+                    checkIfExistDrawerTemplateByEventType(eventTypeId);
+                    return true;
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In
`@backend/src/main/java/com/redhat/cloud/notifications/db/repositories/TemplateRepository.java`
around lines 359 - 361, The DRAWER branch currently calls
checkIfExistDrawerTemplateByEventType(eventTypeId) before verifying org toggles,
causing unnecessary DB queries for disabled orgs; modify the logic in the
switch-case handling DRAWER so it first calls
backendConfig.isDrawerEnabled(orgId) and only calls
checkIfExistDrawerTemplateByEventType(eventTypeId) if the org toggle returns
true (i.e., short-circuit the DB lookup when isDrawerEnabled(orgId) is false).
backend/src/test/java/com/redhat/cloud/notifications/routers/handlers/userconfig/UserConfigResourceTemplateModuleTest.java (1)

137-145: Keep the request helper data-driven.

createSettingsValue(...) now silently drops DRAWER from the payload whenever the mock says the org is disabled. That makes disabled-org tests pass without actually exercising how the API behaves if a client still sends DRAWER.

One option is to let the caller decide whether the DRAWER field is present at all, instead of consulting backendConfig inside the helper.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In
`@backend/src/test/java/com/redhat/cloud/notifications/routers/handlers/userconfig/UserConfigResourceTemplateModuleTest.java`
around lines 137 - 145, The helper createSettingsValue currently consults
backendConfig.isDrawerEnabled(orgId) and omits the DRAWER entry when the org
mock is disabled; change the helper so the caller controls whether the DRAWER
field is included (e.g., add a parameter like includeDrawerField or accept
drawer as a nullable/Optional) and remove the
backendConfig.isDrawerEnabled(orgId) check from inside createSettingsValue;
update callers/tests to pass the desired include/omit behavior so disabled-org
tests can still exercise payloads that contain DRAWER and enabled-org tests can
omit it as needed (refer to createSettingsValue and
SettingsValuesByEventType.EventTypeSettingsValue to locate the helper and its
emailSubscriptionTypes handling).
backend/src/test/java/com/redhat/cloud/notifications/routers/handlers/userconfig/UserConfigResourceTest.java (1)

157-163: Keep the test payload and assertions independent from isDrawerEnabled.

These helpers consult the same mock as the resource, so the disabled-org path never sends a DRAWER payload and never checks that DRAWER stays absent in the response. That leaves a blind spot where the write/read flow could still accept or return drawer subscriptions for a disabled org without breaking these tests. Prefer building the request from the helper arguments, then asserting DRAWER is absent whenever the org is disabled.

Also applies to: 190-197, 727-773, 775-804

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In
`@backend/src/test/java/com/redhat/cloud/notifications/routers/handlers/userconfig/UserConfigResourceTest.java`
around lines 157 - 163, The helper createSettingsValue currently consults
backendConfig.isDrawerEnabled(orgId) and omits the DRAWER key from
eventTypeSettingsValue.emailSubscriptionTypes, making tests depend on the same
mock as the resource; change createSettingsValue (and the other similar helpers
mentioned) so it always sets
eventTypeSettingsValue.emailSubscriptionTypes.put(DRAWER, drawer) based solely
on the drawer argument (do not call backendConfig.isDrawerEnabled), and then
update assertions in tests to explicitly assert that DRAWER is absent in
responses when backendConfig.isDrawerEnabled(orgId) is false (and
present/handled when true), using the unique symbols createSettingsValue,
SettingsValuesByEventType.EventTypeSettingsValue, DRAWER,
emailSubscriptionTypes, and backendConfig.isDrawerEnabled to locate and modify
the relevant code paths.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Outside diff comments:
In
`@backend/src/main/java/com/redhat/cloud/notifications/routers/handlers/drawer/DrawerResource.java`:
- Around line 77-82: The PUT /read handler (updateNotificationReadStatus)
currently updates notifications regardless of org drawer enabled state; guard
the updater with the same org gate used in the GET path by checking
backendConfig.isDrawerEnabled(orgId) before performing any updates (e.g., before
calling drawerRepository.update... / updateNotificationReadStatus logic) and
return the appropriate no-op or error response when the drawer is disabled for
that org; ensure you reference updateNotificationReadStatus and
backendConfig.isDrawerEnabled(orgId) so the update path mirrors the GET path's
org-scoping.

---

Nitpick comments:
In
`@backend/src/main/java/com/redhat/cloud/notifications/db/repositories/TemplateRepository.java`:
- Around line 359-361: The DRAWER branch currently calls
checkIfExistDrawerTemplateByEventType(eventTypeId) before verifying org toggles,
causing unnecessary DB queries for disabled orgs; modify the logic in the
switch-case handling DRAWER so it first calls
backendConfig.isDrawerEnabled(orgId) and only calls
checkIfExistDrawerTemplateByEventType(eventTypeId) if the org toggle returns
true (i.e., short-circuit the DB lookup when isDrawerEnabled(orgId) is false).

In
`@backend/src/test/java/com/redhat/cloud/notifications/routers/handlers/userconfig/UserConfigResourceTemplateModuleTest.java`:
- Around line 137-145: The helper createSettingsValue currently consults
backendConfig.isDrawerEnabled(orgId) and omits the DRAWER entry when the org
mock is disabled; change the helper so the caller controls whether the DRAWER
field is included (e.g., add a parameter like includeDrawerField or accept
drawer as a nullable/Optional) and remove the
backendConfig.isDrawerEnabled(orgId) check from inside createSettingsValue;
update callers/tests to pass the desired include/omit behavior so disabled-org
tests can still exercise payloads that contain DRAWER and enabled-org tests can
omit it as needed (refer to createSettingsValue and
SettingsValuesByEventType.EventTypeSettingsValue to locate the helper and its
emailSubscriptionTypes handling).

In
`@backend/src/test/java/com/redhat/cloud/notifications/routers/handlers/userconfig/UserConfigResourceTest.java`:
- Around line 157-163: The helper createSettingsValue currently consults
backendConfig.isDrawerEnabled(orgId) and omits the DRAWER key from
eventTypeSettingsValue.emailSubscriptionTypes, making tests depend on the same
mock as the resource; change createSettingsValue (and the other similar helpers
mentioned) so it always sets
eventTypeSettingsValue.emailSubscriptionTypes.put(DRAWER, drawer) based solely
on the drawer argument (do not call backendConfig.isDrawerEnabled), and then
update assertions in tests to explicitly assert that DRAWER is absent in
responses when backendConfig.isDrawerEnabled(orgId) is false (and
present/handled when true), using the unique symbols createSettingsValue,
SettingsValuesByEventType.EventTypeSettingsValue, DRAWER,
emailSubscriptionTypes, and backendConfig.isDrawerEnabled to locate and modify
the relevant code paths.

In
`@engine/src/main/java/com/redhat/cloud/notifications/config/EngineConfig.java`:
- Line 182: The startup config currently calls isDrawerEnabled(null) and logs
that value via config.put(drawerToggle, ...), which can be misleading because
null does not represent per-org behavior; update the logic around
config.put(drawerToggle, ...) to avoid invoking isDrawerEnabled(null) — instead
store a sentinel like "org-scoped" (or, only in non-prod diagnostics, call
isDrawerEnabled with a representative org id) so the startup output clearly
indicates the toggle is org-scoped rather than a global boolean; reference the
existing drawerToggle key and the isDrawerEnabled(...) method when making the
change.

In
`@engine/src/test/java/com/redhat/cloud/notifications/events/ConnectorReceiverTest.java`:
- Around line 299-343: The test method name
testNonDrawerCallbackDoesNotTriggerDrawerProcessing is misleading because it
asserts that drawerProcessor.manageConnectorDrawerReturnsIfNeeded(...) is called
once; rename the test to accurately describe behavior (e.g.,
testHandlerInvokedForNonDrawerTypeOr
testManagesConnectorReturnsForNonDrawerPayload) and update any references;
ensure the method signature and any usages (test framework annotations) are
updated to the new name so the assertions around
drawerProcessor.manageConnectorDrawerReturnsIfNeeded(...) and the captured
"details" type remain correct.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: ff91adfe-fb03-4a9a-a1d2-549f9e7a92a1

📥 Commits

Reviewing files that changed from the base of the PR and between 0f79fc8 and 85d643d.

📒 Files selected for processing (14)
  • backend/src/main/java/com/redhat/cloud/notifications/config/BackendConfig.java
  • backend/src/main/java/com/redhat/cloud/notifications/db/repositories/SubscriptionRepository.java
  • backend/src/main/java/com/redhat/cloud/notifications/db/repositories/TemplateRepository.java
  • backend/src/main/java/com/redhat/cloud/notifications/routers/handlers/drawer/DrawerResource.java
  • backend/src/main/java/com/redhat/cloud/notifications/routers/handlers/userconfig/UserConfigResource.java
  • backend/src/test/java/com/redhat/cloud/notifications/db/repositories/TemplateRepositoryTest.java
  • backend/src/test/java/com/redhat/cloud/notifications/routers/handlers/drawer/DrawerResourceTest.java
  • backend/src/test/java/com/redhat/cloud/notifications/routers/handlers/userconfig/UserConfigResourceTemplateModuleTest.java
  • backend/src/test/java/com/redhat/cloud/notifications/routers/handlers/userconfig/UserConfigResourceTest.java
  • engine/src/main/java/com/redhat/cloud/notifications/config/EngineConfig.java
  • engine/src/main/java/com/redhat/cloud/notifications/events/ConnectorReceiver.java
  • engine/src/main/java/com/redhat/cloud/notifications/processors/drawer/DrawerProcessor.java
  • engine/src/test/java/com/redhat/cloud/notifications/events/ConnectorReceiverTest.java
  • engine/src/test/java/com/redhat/cloud/notifications/processors/drawer/DrawerProcessorTest.java

Assisted-by: Claude Sonnet 4.5 (via Claude Code)
Copy link
Copy Markdown
Contributor

@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.

🧹 Nitpick comments (2)
engine/src/test/java/com/redhat/cloud/notifications/events/ConnectorReceiverTest.java (2)

238-248: Consider adding verification of the downstream drawerNotificationRepository.create() call.

Since DrawerProcessor is a spy (real implementation executes), the test could verify that drawerNotificationRepository.create() is called with the expected arguments when processing a drawer callback. This would provide more complete coverage of the drawer callback flow.

💡 Optional enhancement for more complete verification
         assertEquals(historyId, historyIdCaptor.getValue().toString());
         Map<String, Object> capturedDetails = (Map<String, Object>) payloadCaptor.getValue().get("details");
         assertEquals("com.redhat.console.notification.toCamel.drawer", capturedDetails.get("type"));
+
+        verify(drawerNotificationRepository, times(1)).create(eq(event), eq("user1,user2"));
     }
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In
`@engine/src/test/java/com/redhat/cloud/notifications/events/ConnectorReceiverTest.java`
around lines 238 - 248, Add a verify for
drawerNotificationRepository.create(...) to the ConnectorReceiverTest so the
test asserts the DrawerProcessor (used as a spy) actually persisted the drawer
notification: locate the call to manageConnectorDrawerReturnsIfNeeded in
ConnectorReceiverTest and after the existing verify/asserts add a verification
of drawerNotificationRepository.create(...) (or capture its argument with
ArgumentCaptor<DrawerNotification>) and assert expected fields (e.g., historyId,
type from payload details, and any other expected properties). Ensure the test
uses the same mock instance of drawerNotificationRepository that DrawerProcessor
uses so the verify/captor observes the real invocation.

280-292: Minor inconsistency: missing error counter assertion.

The testDrawerCallbackProcessed test asserts that the error counter is 0 (line 236), but this test only checks the processed counter. For consistency, consider adding the error counter assertion here as well.

💡 Suggested fix for consistency
         inMemoryConnector.source(FROMCAMEL_CHANNEL).send(payload);
 
         micrometerAssertionHelper.awaitAndAssertCounterIncrement(MESSAGES_PROCESSED_COUNTER_NAME, 1);
+        micrometerAssertionHelper.assertCounterIncrement(MESSAGES_ERROR_COUNTER_NAME, 0);
 
         ArgumentCaptor<Map<String, Object>> payloadCaptor = ArgumentCaptor.forClass(Map.class);
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In
`@engine/src/test/java/com/redhat/cloud/notifications/events/ConnectorReceiverTest.java`
around lines 280 - 292, In testDrawerCallbackProcessed add the missing
error-counter assertion for consistency: after the
MESSAGES_PROCESSED_COUNTER_NAME check, assert that the ERROR_COUNTER_NAME is 0
using the micrometerAssertionHelper (e.g., call the appropriate helper method to
assert the error counter value is 0). Locate the testDrawerCallbackProcessed
method and add the assertion referencing MESSAGES_PROCESSED_COUNTER_NAME,
ERROR_COUNTER_NAME, and micrometerAssertionHelper so the test checks both
processed and error counters.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Nitpick comments:
In
`@engine/src/test/java/com/redhat/cloud/notifications/events/ConnectorReceiverTest.java`:
- Around line 238-248: Add a verify for drawerNotificationRepository.create(...)
to the ConnectorReceiverTest so the test asserts the DrawerProcessor (used as a
spy) actually persisted the drawer notification: locate the call to
manageConnectorDrawerReturnsIfNeeded in ConnectorReceiverTest and after the
existing verify/asserts add a verification of
drawerNotificationRepository.create(...) (or capture its argument with
ArgumentCaptor<DrawerNotification>) and assert expected fields (e.g., historyId,
type from payload details, and any other expected properties). Ensure the test
uses the same mock instance of drawerNotificationRepository that DrawerProcessor
uses so the verify/captor observes the real invocation.
- Around line 280-292: In testDrawerCallbackProcessed add the missing
error-counter assertion for consistency: after the
MESSAGES_PROCESSED_COUNTER_NAME check, assert that the ERROR_COUNTER_NAME is 0
using the micrometerAssertionHelper (e.g., call the appropriate helper method to
assert the error counter value is 0). Locate the testDrawerCallbackProcessed
method and add the assertion referencing MESSAGES_PROCESSED_COUNTER_NAME,
ERROR_COUNTER_NAME, and micrometerAssertionHelper so the test checks both
processed and error counters.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: f2afb592-07e4-4089-a127-bf8bc3ed5bdd

📥 Commits

Reviewing files that changed from the base of the PR and between 85d643d and e35e643.

📒 Files selected for processing (2)
  • engine/src/main/java/com/redhat/cloud/notifications/events/ConnectorReceiver.java
  • engine/src/test/java/com/redhat/cloud/notifications/events/ConnectorReceiverTest.java
🚧 Files skipped from review as they are similar to previous changes (1)
  • engine/src/main/java/com/redhat/cloud/notifications/events/ConnectorReceiver.java

Copy link
Copy Markdown
Contributor

@g-duval g-duval left a comment

Choose a reason for hiding this comment

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

LGTM

@g-duval
Copy link
Copy Markdown
Contributor

g-duval commented Apr 8, 2026

/retest

@g-duval
Copy link
Copy Markdown
Contributor

g-duval commented Apr 8, 2026

iqe test failures are unrelated

@g-duval g-duval merged commit 38021c8 into RedHatInsights:master Apr 8, 2026
52 checks passed
@bonscji1 bonscji1 deleted the drawer-feature-enabling-according-org_id branch April 8, 2026 13:35
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.

2 participants