feat:add deployment status investigation support for portal assistant#638
feat:add deployment status investigation support for portal assistant#638yashodgayashan wants to merge 1 commit into
Conversation
|
Changeset detected — the following file(s) will be released with this PR: |
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (11)
✅ Files skipped from review due to trivial changes (1)
🚧 Files skipped from review as they are similar to previous changes (10)
📝 WalkthroughWalkthroughEstablishes a render-prop contract for investigation actions in the Environments component, extends the assistant API with a ChangesInvestigateDependencyButton investigation feature
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~25 minutes Suggested reviewers
Poem
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
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 |
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
There was a problem hiding this comment.
Actionable comments posted: 1
🧹 Nitpick comments (1)
plugins/openchoreo/src/components/Environments/components/EnvironmentDetailPanel.test.tsx (1)
46-47: ⚡ Quick winAdd explicit assertions for the new investigate-button branch.
This mock update is necessary, but the suite still doesn’t validate the newly added pending/failed integration path (including
caseTypemapping). Adding a couple of focused assertions here would prevent silent regressions.Suggested test direction
+jest.mock( + '`@openchoreo/backstage-plugin-openchoreo-portal-assistant`', + () => ({ + InvestigateDependencyButton: (props: any) => ( + <div data-testid="investigate-btn-props">{JSON.stringify(props)}</div> + ), + }), +); + +it('passes dependency_pending when statusReason is ConnectionsPending', () => { + // render with deployment.status = 'Pending', statusReason = 'ConnectionsPending' + // assert rendered props.caseType === 'dependency_pending' +}); + +it('passes runtime_debug for failed non-ConnectionsPending status', () => { + // render with deployment.status = 'Failed', statusReason != 'ConnectionsPending' + // assert rendered props.caseType === 'runtime_debug' +});🤖 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 `@plugins/openchoreo/src/components/Environments/components/EnvironmentDetailPanel.test.tsx` around lines 46 - 47, Add explicit test assertions in the EnvironmentDetailPanel test suite to validate the newly added pending/failed integration path for the investigate-button branch. Specifically, create focused test cases that assert the correct behavior when handling pending or failed states, including validation of the caseType mapping and verification that the investigate button renders appropriately in these scenarios. These assertions should directly test the conditional logic that was introduced with the useAssistantEnabled mock update to prevent silent regressions as the code evolves.
🤖 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
`@plugins/openchoreo-portal-assistant/src/components/InvestigateDependencyButton/InvestigateDependencyButton.tsx`:
- Around line 79-85: The warmup() call in the warmIfStale function is
fired-and-forgotten with the void operator, but any promise rejection from
assistantApi.warmup() can still propagate as an unhandled rejection. Add a
.catch() handler to the assistantApi.warmup() call chain to gracefully handle
any rejections and keep this best-effort warming path from causing unhandled
promise rejection errors. The catch handler should suppress the error without
throwing or logging, since warmup failures should not impact the user
experience.
---
Nitpick comments:
In
`@plugins/openchoreo/src/components/Environments/components/EnvironmentDetailPanel.test.tsx`:
- Around line 46-47: Add explicit test assertions in the EnvironmentDetailPanel
test suite to validate the newly added pending/failed integration path for the
investigate-button branch. Specifically, create focused test cases that assert
the correct behavior when handling pending or failed states, including
validation of the caseType mapping and verification that the investigate button
renders appropriately in these scenarios. These assertions should directly test
the conditional logic that was introduced with the useAssistantEnabled mock
update to prevent silent regressions as the code evolves.
🪄 Autofix (Beta)
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: defaults
Review profile: CHILL
Plan: Pro
Run ID: 02b7ed8f-5a75-4ee2-b63e-a8d0d944ffab
📒 Files selected for processing (6)
plugins/openchoreo-portal-assistant/src/api/PerchAgentApi.tsplugins/openchoreo-portal-assistant/src/components/InvestigateDependencyButton/InvestigateDependencyButton.test.tsxplugins/openchoreo-portal-assistant/src/components/InvestigateDependencyButton/InvestigateDependencyButton.tsxplugins/openchoreo-portal-assistant/src/index.tsplugins/openchoreo/src/components/Environments/components/EnvironmentDetailPanel.test.tsxplugins/openchoreo/src/components/Environments/components/EnvironmentDetailPanel.tsx
12eabd4 to
13d6214
Compare
| @@ -0,0 +1,6 @@ | |||
| --- | |||
| '@openchoreo/backstage-plugin-openchoreo-portal-assistant-backend': major | |||
There was a problem hiding this comment.
Any reason for bumping major? can't we consider minor?
There was a problem hiding this comment.
Updated to patch
13d6214 to
c25e9b5
Compare
There was a problem hiding this comment.
🧹 Nitpick comments (1)
plugins/openchoreo/src/components/Environments/components/EnvironmentDetailPanel.test.tsx (1)
683-734: ⚡ Quick winAdd coverage for pending-without-ConnectionsPending routing (Line 683).
The suite currently misses the
pending+ non-ConnectionsPendingbranch, which should map toruntime_debug. Adding that test will lock the branch behavior and prevent silent regressions.Suggested test addition
describe('Investigate with AI', () => { + it('uses runtime_debug for pending deployments without ConnectionsPending reason', () => { + renderPanel({ + selection: { + kind: 'env', + environment: makeEnv({ + name: 'staging', + deployment: { + status: 'NotReady', + statusReason: 'ImagePullBackOff', + }, + }), + }, + }); + const btn = screen.getByTestId('investigate-dependency-button'); + expect(btn).toHaveAttribute('data-casetype', 'runtime_debug'); + expect(btn).toHaveAttribute('data-status', 'Pending'); + });🤖 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 `@plugins/openchoreo/src/components/Environments/components/EnvironmentDetailPanel.test.tsx` around lines 683 - 734, The test suite for 'Investigate with AI' is missing coverage for the case where a deployment has a pending status but without the ConnectionsPending reason, which should map to the runtime_debug case type. Add a new test case within the describe block that creates an environment with a pending status (NotReady) but a different statusReason than ConnectionsPending, then verify that the investigate-dependency-button is displayed with data-casetype set to runtime_debug. This test should follow the same pattern as the existing test cases using renderPanel, makeEnv, screen.getByTestId, and expect statements to assert the correct data attributes are present.
🤖 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.
Nitpick comments:
In
`@plugins/openchoreo/src/components/Environments/components/EnvironmentDetailPanel.test.tsx`:
- Around line 683-734: The test suite for 'Investigate with AI' is missing
coverage for the case where a deployment has a pending status but without the
ConnectionsPending reason, which should map to the runtime_debug case type. Add
a new test case within the describe block that creates an environment with a
pending status (NotReady) but a different statusReason than ConnectionsPending,
then verify that the investigate-dependency-button is displayed with
data-casetype set to runtime_debug. This test should follow the same pattern as
the existing test cases using renderPanel, makeEnv, screen.getByTestId, and
expect statements to assert the correct data attributes are present.
ℹ️ Review info
⚙️ Run configuration
Configuration used: defaults
Review profile: CHILL
Plan: Pro
Run ID: 831b5e8f-62c2-4ca5-98f2-c3986f45079e
📒 Files selected for processing (11)
.changeset/lazy-olives-repeat.mdpackages/app/src/components/catalog/EntityPage.tsxplugins/openchoreo-portal-assistant/src/api/PerchAgentApi.tsplugins/openchoreo-portal-assistant/src/components/InvestigateDependencyButton/InvestigateDependencyButton.test.tsxplugins/openchoreo-portal-assistant/src/components/InvestigateDependencyButton/InvestigateDependencyButton.tsxplugins/openchoreo-portal-assistant/src/index.tsplugins/openchoreo/src/components/Environments/Environments.tsxplugins/openchoreo/src/components/Environments/EnvironmentsContext.tsxplugins/openchoreo/src/components/Environments/components/EnvironmentDetailPanel.test.tsxplugins/openchoreo/src/components/Environments/components/EnvironmentDetailPanel.tsxplugins/openchoreo/src/index.ts
✅ Files skipped from review due to trivial changes (1)
- .changeset/lazy-olives-repeat.md
🚧 Files skipped from review as they are similar to previous changes (4)
- plugins/openchoreo-portal-assistant/src/index.ts
- plugins/openchoreo-portal-assistant/src/components/InvestigateDependencyButton/InvestigateDependencyButton.test.tsx
- plugins/openchoreo-portal-assistant/src/api/PerchAgentApi.ts
- plugins/openchoreo-portal-assistant/src/components/InvestigateDependencyButton/InvestigateDependencyButton.tsx
Signed-off-by: yashodgayashan <yashodgayashan@gmail.com>
c25e9b5 to
7a7b9f7
Compare
Purpose
We have added investigation support for deployment status of OpenChoreo.
Goals
Add investigation button and provide the solution and the prompt whenever needed.
Screen.Recording.2026-06-17.at.10.57.17.mov
Approach
User stories
Release note
Documentation
Training
Certification
Marketing
Automation tests
Security checks
Samples
Related PRs
Migrations (if applicable)
Test environment
Learning
Summary by CodeRabbit
New Features
Tests