Skip to content

[CSM] Rework upstream error exposure, default filter panels open, dashboard widget polish - #1322

Merged
Rashmika998 merged 2 commits into
wso2-open-operations:mainfrom
Rashmika998:csm-portal-dashboard-ux-and-error-handling
Aug 2, 2026
Merged

[CSM] Rework upstream error exposure, default filter panels open, dashboard widget polish#1322
Rashmika998 merged 2 commits into
wso2-open-operations:mainfrom
Rashmika998:csm-portal-dashboard-ux-and-error-handling

Conversation

@Rashmika998

@Rashmika998 Rashmika998 commented Aug 2, 2026

Copy link
Copy Markdown
Contributor

Summary

  • Backend: split error mapping into mapUpstreamErrorGeneric (now the default for every endpoint — never echoes an upstream 4xx/5xx reason to the caller) and mapUpstreamError (kept only for the 10 PATCH/update handlers, where the upstream reason like "Invalid state transition" is genuinely caller-actionable). The full reason is still logged server-side via slog.ErrorContext either way.
  • Incidents filter bar: reworked layout (Priority / Product / SLA violated on one row, Created from/to on their own row) and capped both date pickers so they can't be set to a future date.
  • Filter panels default open: Incidents, Problems, and Change requests tabs (and the Time cards page) now default their filter panel open, matching Cases.
  • Dashboard widget tiles: added a resource-type icon, a themed hover ring (matching the customer-portal ListStatGrid pattern), and an info-icon affordance — tooltip copy intentionally left empty pending finalized per-widget messaging.
  • Widget-pilot refresh: clicking refresh now also invalidates every tile's own data query (previously it only refetched the dashboard's own metadata, leaving stale counts visible) and shows skeleton tiles until the new data resolves.

Test plan

  • go build ./..., go vet ./..., go test ./... (backend, all packages)
  • gosec -fmt=text ./... — 0 issues
  • tsc -b (webapp) — no type errors
  • eslint on changed webapp files — clean
  • vitest run (webapp) — 767 passing; the 9 failures in CaseActionBar.test.tsx and CsmAnnouncementsPage.test.tsx are pre-existing and unrelated (confirmed against a clean main checkout before this branch's changes)
  • Added/updated tests: AgentsLandingPagePilot.test.tsx (refresh re-fetches + skeleton), cases_test.go/incidents_test.go (new generic vs. detail-surfacing error-mapping tables)

Note: this backend change hasn't been deployed to the shared staging environment yet — testing against it will still show old behavior until it's redeployed.

🤖 Generated with Claude Code

Summary by CodeRabbit

  • Bug Fixes

    • Improved error handling across portal operations by preventing sensitive upstream error details from appearing in standard error responses.
    • Preserved actionable validation details for supported update operations.
    • Added date restrictions to incident filters, preventing future or invalid date ranges.
  • New Features

    • Added dashboard widget refresh behavior with loading placeholders and refreshed data.
    • Enhanced dashboard tiles with resource icons, themed styling, hover effects, and informational indicators.
    • Filter panels across operations and time cards now open by default.
    • Improved incident filter layout and responsiveness.

…oard widget icons and refresh skeleton

- backend: split mapUpstreamError into a PATCH-only variant that surfaces
  the upstream 400/409/422 reason, and mapUpstreamErrorGeneric (now the
  default for every other endpoint) that never echoes upstream detail to
  the caller; full reason is still logged server-side
- webapp: rework the Incidents filter bar layout (Priority/Product/SLA
  violated on one row, Created from/to on their own row) and cap both
  date pickers at today
- webapp: default the Incidents/Problems/Change requests/Time cards
  filter panels open (Cases already was)
- webapp: dashboard widget tiles get a resource-type icon, a themed hover
  ring, and an info affordance (tooltip copy intentionally empty pending
  finalized messaging)
- webapp: the widget-pilot refresh button now also invalidates every
  tile's own data query and shows skeletons until it resolves, instead of
  only refreshing the dashboard's own metadata

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
@coderabbitai

coderabbitai Bot commented Aug 2, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

Warning

Review limit reached

@Rashmika998, you've reached your PR review limit, so we couldn't start this review.

Next review available in: 33 minutes

Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available.
You're only billed for reviews past your plan's rate limits ($0.25/file).

How can I continue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews.

How do review limits work?

CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability.

For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window.

Please refer docs for additional details.

Review details
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro Plus

Run ID: a87db413-dea9-4942-a3de-a3994efab302

📥 Commits

Reviewing files that changed from the base of the PR and between 2cb33b2 and af65df6.

📒 Files selected for processing (5)
  • apps/csm-portal/backend/CLAUDE.md
  • apps/csm-portal/backend/internal/handler/change_requests_test.go
  • apps/csm-portal/backend/internal/handler/projects_test.go
  • apps/csm-portal/backend/internal/handler/response.go
  • apps/csm-portal/webapp/src/features/csm-operations/components/IncidentsFilterBar.tsx
📝 Walkthrough

Walkthrough

The PR adds mapUpstreamErrorGeneric for non-PATCH backend handlers and updates related tests and documentation. It also adds dashboard refresh behavior, widget icons and styling, expanded filter panels, incident date constraints, and query context in tests.

Changes

Backend upstream error handling

Layer / File(s) Summary
Generic error contract
apps/csm-portal/backend/internal/handler/response.go, apps/csm-portal/backend/CLAUDE.md
Defines generic upstream error mapping that suppresses upstream response bodies. Documents PATCH/update exceptions that retain mapUpstreamError.
Handler migration
apps/csm-portal/backend/internal/handler/*.go
Updates account, case, catalog, change-request, incident, project, product, task, time-card, user, and other non-PATCH handlers to use mapUpstreamErrorGeneric.
Error-mapping tests
apps/csm-portal/backend/internal/handler/*_test.go
Updates tests to use generic error cases and adds coverage for suppressed upstream bodies. PATCH tests retain the existing mappings.

Dashboard updates

Layer / File(s) Summary
Refresh and widget presentation
apps/csm-portal/webapp/src/features/csm-dashboard/components/AgentsLandingPagePilot.tsx, apps/csm-portal/webapp/src/features/csm-dashboard/components/AgentsLandingPagePilot.test.tsx, apps/csm-portal/webapp/src/features/csm-dashboard/components/DashboardWidgetTile.tsx, apps/csm-portal/webapp/src/features/csm-dashboard/config/widgetResourceConfig.ts
Refresh refetches dashboard metadata and widget data while showing skeletons. Widget tiles now use configured icons, theme colors, hover styling, and an informational icon.

Operations filter updates

Layer / File(s) Summary
Filter defaults and constraints
apps/csm-portal/webapp/src/features/csm-operations/components/*, apps/csm-portal/webapp/src/features/csm-timecards/pages/CsmTimeCardsPage.tsx
Operations and time-card filters open by default. Incident date pickers enforce start, end, and current-date limits.
Filter test harness
apps/csm-portal/webapp/src/features/csm-operations/pages/OperationsTabFiltersUrl.test.tsx
Wraps the test harness in a React Query provider with retries disabled.

Estimated code review effort: 4 (Complex) | ~45 minutes

Possibly related PRs

Suggested labels: Type/Improvement

Suggested reviewers: rksk

🚥 Pre-merge checks | ✅ 3 | ❌ 2

❌ Failed checks (2 warnings)

Check name Status Explanation Resolution
Description check ⚠️ Warning The description explains the main changes and testing, but it omits most required template sections, including documentation, security checks, release notes, and test environment. Complete the required template sections, or explicitly mark them as N/A with brief explanations where they do not apply.
Docstring Coverage ⚠️ Warning Docstring coverage is 28.57% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (3 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly summarizes the three main changes: upstream error handling, default-open filters, and dashboard widget improvements.
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.
✨ 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.

@Rashmika998
Rashmika998 requested a review from rksk August 2, 2026 03:51

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Actionable comments posted: 4

🧹 Nitpick comments (7)
apps/csm-portal/backend/internal/handler/cases_test.go (1)

77-100: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

Standardize the upstream-error test helper names.

The generic test behavior is correct, but the PR uses upstreamErrorsGeneric while the repository convention requires upstreamErrors(fallback). Rename the PATCH-specific matrix and use upstreamErrors for generic tests.

  • apps/csm-portal/backend/internal/handler/cases_test.go#L77-L100: rename the helper definitions and update all case-handler call sites.
  • apps/csm-portal/backend/internal/handler/task_slas_test.go#L80-L80: use upstreamErrors(fallback) for search tests.
  • apps/csm-portal/backend/internal/handler/tasks_test.go#L118-L118: use upstreamErrors(fallback) for case-task search tests.
  • apps/csm-portal/backend/internal/handler/time_cards_test.go#L67-L67: use upstreamErrors(fallback) for time-card creation tests.
  • apps/csm-portal/backend/internal/handler/updates_test.go#L72-L72: use upstreamErrors(fallback) for product-level retrieval tests.
  • apps/csm-portal/backend/internal/handler/users_test.go#L352-L352: use upstreamErrors(fallback) for user-search tests.

As per coding guidelines, handler tests must use upstreamErrors(fallback).

🤖 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 `@apps/csm-portal/backend/internal/handler/cases_test.go` around lines 77 -
100, Standardize the upstream-error test helpers by renaming the generic helper
to upstreamErrors(fallback) and the PATCH-specific matrix to the repository’s
expected distinct name, then update all case-handler call sites in
apps/csm-portal/backend/internal/handler/cases_test.go. Replace the helper usage
with upstreamErrors(fallback) in
apps/csm-portal/backend/internal/handler/task_slas_test.go:80,
tasks_test.go:118, time_cards_test.go:67, updates_test.go:72, and
users_test.go:352.

Source: Coding guidelines

apps/csm-portal/backend/internal/handler/accounts.go (1)

98-98: 🔒 Security & Privacy | 🔵 Trivial

Run the required backend security scan.

Run gosec -fmt=text ./... and resolve every finding before merge. Use #nosec only for an exact, justified suppression.

Based on learnings, every backend change must run gosec -fmt=text ./..., and exact #nosec suppressions require justification.

🤖 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 `@apps/csm-portal/backend/internal/handler/accounts.go` at line 98, Run the
required backend security scan with gosec -fmt=text ./... and resolve every
reported finding across the backend change, including the flow around
mapUpstreamErrorGeneric. Use an exact `#nosec` suppression only where the finding
is justified, and document the suppression rationale inline.

Source: Learnings

apps/csm-portal/backend/internal/handler/change_requests.go (1)

232-232: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

Add coverage for CreateComment failures.

CreateChangeRequestComment now maps errors from both GetChangeRequest and CreateComment. TestCreateChangeRequestComment only makes getChangeRequestFn fail. Add a case where the guard succeeds and createCommentFn returns each generic error. Assert the fallback message and status.

🤖 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 `@apps/csm-portal/backend/internal/handler/change_requests.go` at line 232,
Extend TestCreateChangeRequestComment with cases where getChangeRequestFn
succeeds and createCommentFn returns each generic error, then assert
CreateChangeRequestComment produces the fallback error message and expected
status. Keep the existing GetChangeRequest failure coverage unchanged.
apps/csm-portal/backend/internal/handler/configuration_items_test.go (1)

80-80: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

Reconcile the generic error fixture name across handler tests.

The changed tests use upstreamErrorsGeneric(...), while the applicable path instruction requires upstreamErrors(fallback). Preserve the generic body-hiding assertions, but rename the fixture or update the instruction so the repository has one clear test contract.

  • apps/csm-portal/backend/internal/handler/configuration_items_test.go#L80-L80: Reconcile the upstreamErrorsGeneric(...) call with the mandated helper name.
  • apps/csm-portal/backend/internal/handler/conversations_test.go#L130-L130: Reconcile the conversation-message error fixture.
  • apps/csm-portal/backend/internal/handler/conversations_test.go#L246-L246: Reconcile the conversation-search error fixture.
  • apps/csm-portal/backend/internal/handler/deployments_test.go#L86-L86: Reconcile the deployment-creation error fixture.
  • apps/csm-portal/backend/internal/handler/deployments_test.go#L163-L163: Reconcile the deployment-search error fixture.
  • apps/csm-portal/backend/internal/handler/deployments_test.go#L371-L371: Reconcile the deployed-product search error fixture.
  • apps/csm-portal/backend/internal/handler/deployments_test.go#L473-L473: Reconcile the deployed-product creation error fixture.
  • apps/csm-portal/backend/internal/handler/groups_test.go#L80-L80: Reconcile the group-search error fixture.

As per coding guidelines, handler tests must use upstreamErrors(fallback), withUser(), and decodeJSON[T]().

🤖 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 `@apps/csm-portal/backend/internal/handler/configuration_items_test.go` at line
80, Standardize the generic upstream-error fixture across handler tests by
replacing each upstreamErrorsGeneric(...) usage with the mandated
upstreamErrors(fallback) contract in
apps/csm-portal/backend/internal/handler/configuration_items_test.go:80,
conversations_test.go:130 and 246, deployments_test.go:86, 163, 371, and 473,
and groups_test.go:80. Preserve the existing generic body-hiding assertions and
ensure these tests continue using withUser() and decodeJSON[T]().

Source: Coding guidelines

apps/csm-portal/backend/internal/handler/projects.go (1)

179-179: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

Add coverage for GetProjectContact.

The changed handler uses mapUpstreamErrorGeneric, but the supplied apps/csm-portal/backend/internal/handler/projects_test.go context has no TestGetProjectContact. Add generic upstream-error cases with fallback "Failed to fetch the project contact." and assert that the upstream body is not returned.

🤖 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 `@apps/csm-portal/backend/internal/handler/projects.go` at line 179, Add a
TestGetProjectContact test covering generic upstream-error responses from the
handler, including the fallback message "Failed to fetch the project contact.".
Assert each response uses the mapped generic error and does not expose the
upstream response body.
apps/csm-portal/backend/internal/handler/problems_test.go (1)

86-86: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

Document upstreamErrorsGeneric in the handler-test convention.

The calls here are valid for non-PATCH handlers using mapUpstreamErrorGeneric, but the guideline still points only at upstreamErrors(fallback). Update that line to require upstreamErrorsGeneric(fallback) for the default generic upstream error table, or alias the generic table under that name as the documented convention.

🤖 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 `@apps/csm-portal/backend/internal/handler/problems_test.go` at line 86, Update
the handler-test convention to document upstreamErrorsGeneric(fallback) as the
default generic upstream error table, or alias the existing generic table under
that name. Apply this consistently at
apps/csm-portal/backend/internal/handler/problems_test.go:86, 166, and 244, and
apps/csm-portal/backend/internal/handler/projects_test.go:75, 153, and 264,
preserving the existing non-PATCH handler behavior.

Source: Coding guidelines

apps/csm-portal/backend/internal/handler/problems.go (1)

115-115: 🔒 Security & Privacy | 🔵 Trivial

Run the backend gosec scan before merge.

gosec is required for each backend change and must report zero issues. Install gosec via go install github.com/securego/gosec/v2/cmd/gosec@latest and run gosec -fmt=text ./... from apps/csm-portal/backend. Resolve any finding rather than suppressing it unless a #nosec annotation with justification already covers that exact case.

🤖 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 `@apps/csm-portal/backend/internal/handler/problems.go` at line 115, Run the
required gosec scan from apps/csm-portal/backend using gosec -fmt=text ./...,
after installing it with the specified go install command. Resolve every
reported security finding in the affected backend code, including the flow
around mapUpstreamErrorGeneric, and ensure the scan completes with zero issues
without adding unjustified suppression annotations.

Source: Learnings

🤖 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 `@apps/csm-portal/backend/internal/handler/response.go`:
- Around line 118-125: The response.go documentation must not endorse logging
full upstream error bodies through apierror.Error.Error(); revise it to require
sanitized status and operation summaries while preserving the fixed
client-facing fallback behavior. In
apps/csm-portal/backend/internal/handler/response.go lines 118-125, update the
mapUpstreamErrorGeneric documentation accordingly; in
apps/csm-portal/backend/CLAUDE.md line 69, remove the requirement to log the
full reason and state that backend logs contain only identifiers and sanitized
error summaries.

In
`@apps/csm-portal/webapp/src/features/csm-dashboard/components/DashboardWidgetTile.tsx`:
- Around line 101-118: Remove the empty Tooltip and its Info icon from
DashboardWidgetTile; do not leave an inactive affordance inside the navigable
card. Keep the tile layout and link behavior unchanged until meaningful tooltip
content and separate interaction handling are available.

In
`@apps/csm-portal/webapp/src/features/csm-operations/components/IncidentsFilterBar.tsx`:
- Around line 111-115: Update the today value in the filter-bar component so it
is recalculated after UTC midnight instead of being permanently cached by the
empty-dependency useMemo. Prefer deriving todayUTCDateOnly() during render,
while preserving the existing createdEndDate and fromMaxDate behavior.
- Around line 252-253: Update the two date-picker onChange handlers in
IncidentsFilterBar to validate typed dates before invoking onChange: ensure the
start date respects the existing opposite bound and the end date respects the
start bound and today, while preserving valid selections. Add focused tests
covering typed out-of-range values for both handlers.

---

Nitpick comments:
In `@apps/csm-portal/backend/internal/handler/accounts.go`:
- Line 98: Run the required backend security scan with gosec -fmt=text ./... and
resolve every reported finding across the backend change, including the flow
around mapUpstreamErrorGeneric. Use an exact `#nosec` suppression only where the
finding is justified, and document the suppression rationale inline.

In `@apps/csm-portal/backend/internal/handler/cases_test.go`:
- Around line 77-100: Standardize the upstream-error test helpers by renaming
the generic helper to upstreamErrors(fallback) and the PATCH-specific matrix to
the repository’s expected distinct name, then update all case-handler call sites
in apps/csm-portal/backend/internal/handler/cases_test.go. Replace the helper
usage with upstreamErrors(fallback) in
apps/csm-portal/backend/internal/handler/task_slas_test.go:80,
tasks_test.go:118, time_cards_test.go:67, updates_test.go:72, and
users_test.go:352.

In `@apps/csm-portal/backend/internal/handler/change_requests.go`:
- Line 232: Extend TestCreateChangeRequestComment with cases where
getChangeRequestFn succeeds and createCommentFn returns each generic error, then
assert CreateChangeRequestComment produces the fallback error message and
expected status. Keep the existing GetChangeRequest failure coverage unchanged.

In `@apps/csm-portal/backend/internal/handler/configuration_items_test.go`:
- Line 80: Standardize the generic upstream-error fixture across handler tests
by replacing each upstreamErrorsGeneric(...) usage with the mandated
upstreamErrors(fallback) contract in
apps/csm-portal/backend/internal/handler/configuration_items_test.go:80,
conversations_test.go:130 and 246, deployments_test.go:86, 163, 371, and 473,
and groups_test.go:80. Preserve the existing generic body-hiding assertions and
ensure these tests continue using withUser() and decodeJSON[T]().

In `@apps/csm-portal/backend/internal/handler/problems_test.go`:
- Line 86: Update the handler-test convention to document
upstreamErrorsGeneric(fallback) as the default generic upstream error table, or
alias the existing generic table under that name. Apply this consistently at
apps/csm-portal/backend/internal/handler/problems_test.go:86, 166, and 244, and
apps/csm-portal/backend/internal/handler/projects_test.go:75, 153, and 264,
preserving the existing non-PATCH handler behavior.

In `@apps/csm-portal/backend/internal/handler/problems.go`:
- Line 115: Run the required gosec scan from apps/csm-portal/backend using gosec
-fmt=text ./..., after installing it with the specified go install command.
Resolve every reported security finding in the affected backend code, including
the flow around mapUpstreamErrorGeneric, and ensure the scan completes with zero
issues without adding unjustified suppression annotations.

In `@apps/csm-portal/backend/internal/handler/projects.go`:
- Line 179: Add a TestGetProjectContact test covering generic upstream-error
responses from the handler, including the fallback message "Failed to fetch the
project contact.". Assert each response uses the mapped generic error and does
not expose the upstream response body.
🪄 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: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro Plus

Run ID: 81dc234b-26c4-4fc1-b605-6cdb13f59242

📥 Commits

Reviewing files that changed from the base of the PR and between a13382b and 2cb33b2.

📒 Files selected for processing (52)
  • apps/csm-portal/backend/CLAUDE.md
  • apps/csm-portal/backend/internal/handler/accounts.go
  • apps/csm-portal/backend/internal/handler/accounts_test.go
  • apps/csm-portal/backend/internal/handler/cases.go
  • apps/csm-portal/backend/internal/handler/cases_test.go
  • apps/csm-portal/backend/internal/handler/catalogs.go
  • apps/csm-portal/backend/internal/handler/change_requests.go
  • apps/csm-portal/backend/internal/handler/change_requests_test.go
  • apps/csm-portal/backend/internal/handler/configuration_items.go
  • apps/csm-portal/backend/internal/handler/configuration_items_test.go
  • apps/csm-portal/backend/internal/handler/conversations.go
  • apps/csm-portal/backend/internal/handler/conversations_test.go
  • apps/csm-portal/backend/internal/handler/deployments.go
  • apps/csm-portal/backend/internal/handler/deployments_test.go
  • apps/csm-portal/backend/internal/handler/groups.go
  • apps/csm-portal/backend/internal/handler/groups_test.go
  • apps/csm-portal/backend/internal/handler/incidents.go
  • apps/csm-portal/backend/internal/handler/incidents_test.go
  • apps/csm-portal/backend/internal/handler/notifications.go
  • apps/csm-portal/backend/internal/handler/problems.go
  • apps/csm-portal/backend/internal/handler/problems_test.go
  • apps/csm-portal/backend/internal/handler/product_vulnerabilities.go
  • apps/csm-portal/backend/internal/handler/products.go
  • apps/csm-portal/backend/internal/handler/products_test.go
  • apps/csm-portal/backend/internal/handler/projects.go
  • apps/csm-portal/backend/internal/handler/projects_test.go
  • apps/csm-portal/backend/internal/handler/reference.go
  • apps/csm-portal/backend/internal/handler/response.go
  • apps/csm-portal/backend/internal/handler/service_offerings.go
  • apps/csm-portal/backend/internal/handler/service_offerings_test.go
  • apps/csm-portal/backend/internal/handler/services.go
  • apps/csm-portal/backend/internal/handler/services_test.go
  • apps/csm-portal/backend/internal/handler/task_slas.go
  • apps/csm-portal/backend/internal/handler/task_slas_test.go
  • apps/csm-portal/backend/internal/handler/tasks.go
  • apps/csm-portal/backend/internal/handler/tasks_test.go
  • apps/csm-portal/backend/internal/handler/time_cards.go
  • apps/csm-portal/backend/internal/handler/time_cards_test.go
  • apps/csm-portal/backend/internal/handler/updates.go
  • apps/csm-portal/backend/internal/handler/updates_test.go
  • apps/csm-portal/backend/internal/handler/users.go
  • apps/csm-portal/backend/internal/handler/users_test.go
  • apps/csm-portal/webapp/src/features/csm-dashboard/components/AgentsLandingPagePilot.test.tsx
  • apps/csm-portal/webapp/src/features/csm-dashboard/components/AgentsLandingPagePilot.tsx
  • apps/csm-portal/webapp/src/features/csm-dashboard/components/DashboardWidgetTile.tsx
  • apps/csm-portal/webapp/src/features/csm-dashboard/config/widgetResourceConfig.ts
  • apps/csm-portal/webapp/src/features/csm-operations/components/ChangeRequestsTab.tsx
  • apps/csm-portal/webapp/src/features/csm-operations/components/IncidentsFilterBar.tsx
  • apps/csm-portal/webapp/src/features/csm-operations/components/IncidentsTab.tsx
  • apps/csm-portal/webapp/src/features/csm-operations/components/ProblemsTab.tsx
  • apps/csm-portal/webapp/src/features/csm-operations/pages/OperationsTabFiltersUrl.test.tsx
  • apps/csm-portal/webapp/src/features/csm-timecards/pages/CsmTimeCardsPage.tsx

Comment on lines +118 to +125
// mapUpstreamErrorGeneric is mapUpstreamError's counterpart for every
// non-PATCH endpoint: 401/403/404 still translate to the fixed messages, but
// every other case — 400, 409, 422, 5xx, and unmapped statuses alike — falls
// back to fallbackMsg instead of echoing the upstream body. The real reason
// is still available: the caller always logs it via
// slog.ErrorContext(ctx, ..., "err", err) before calling this, and
// apierror.Error.Error() includes both the status code and the body, so nothing
// is lost — it just isn't returned to the browser.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🔒 Security & Privacy | 🟠 Major | 🏗️ Heavy lift

Do not log raw upstream error bodies.

apierror.Error.Error() includes Body, and the documented callers pass err to slog.ErrorContext. This conflicts with the backend logging rule and can retain upstream PII or internal details.

  • apps/csm-portal/backend/internal/handler/response.go#L118-L125: document sanitized status and operation summaries instead of retaining the full upstream body.
  • apps/csm-portal/backend/CLAUDE.md#L69-L69: remove the requirement to log the full reason.

As per coding guidelines, backend logs must contain only identifiers and error summaries.

📍 Affects 2 files
  • apps/csm-portal/backend/internal/handler/response.go#L118-L125 (this comment)
  • apps/csm-portal/backend/CLAUDE.md#L69-L69
🤖 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 `@apps/csm-portal/backend/internal/handler/response.go` around lines 118 - 125,
The response.go documentation must not endorse logging full upstream error
bodies through apierror.Error.Error(); revise it to require sanitized status and
operation summaries while preserving the fixed client-facing fallback behavior.
In apps/csm-portal/backend/internal/handler/response.go lines 118-125, update
the mapUpstreamErrorGeneric documentation accordingly; in
apps/csm-portal/backend/CLAUDE.md line 69, remove the requirement to log the
full reason and state that backend logs contain only identifiers and sanitized
error summaries.

Source: Coding guidelines

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Fixed the documentation, but kept the actual logging behavior as-is per an explicit product decision: full upstream detail (status + body) is intended to stay in server-side logs — those are operator-facing, not caller-facing, so withholding it there wasn't the goal. Only the HTTP response to the client is meant to stay generic, which mapUpstreamErrorGeneric already enforces.

Reworded response.go's doc comment and CLAUDE.md to state this explicitly (full reason in logs is intentional, not an accidental leak) rather than reading as if mapUpstreamErrorGeneric were somehow responsible for sanitizing logs — it isn't, and never was.

Also worth noting: the slog.ErrorContext(ctx, ..., "err", err) pattern this flags predates this PR — it's the existing convention at all ~85 call sites, unchanged here. Not something introduced by this diff.

Comment added by Claude on behalf of @Rashmika998.

Comment on lines +101 to +118
{/* Tooltip copy is intentionally empty until the per-widget messages
are finalized — the icon renders now so the layout/interaction is
in place ahead of that content. */}
<Tooltip title="">
<Box
component="span"
sx={{
position: "absolute",
top: 8,
right: 8,
zIndex: 1,
display: "inline-flex",
color: "text.secondary",
}}
>
<Info size={14} />
</Box>
</Tooltip>

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win

Remove the inactive information affordance.

Tooltip title="" provides no information. The icon is inside the link card, so selecting it navigates to the tile target.

Remove the icon until tooltip content is available. Alternatively, provide nonempty tooltip text and separate interaction behavior.

🤖 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
`@apps/csm-portal/webapp/src/features/csm-dashboard/components/DashboardWidgetTile.tsx`
around lines 101 - 118, Remove the empty Tooltip and its Info icon from
DashboardWidgetTile; do not leave an inactive affordance inside the navigable
card. Keep the tile layout and link behavior unchanged until meaningful tooltip
content and separate interaction handling are available.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Declining this one — the empty tooltip is intentional, not an oversight. This came directly from the requester: render the info icon now (so the layout/interaction is in place), but leave the tooltip copy empty for the time being since the per-widget messaging hasn't been finalized yet. It'll be filled in once that copy is decided, in a follow-up change.

Comment added by Claude on behalf of @Rashmika998.

…t-of-range dates, add missing error-mapping test coverage

- IncidentsFilterBar: compute today's UTC date fresh each render instead of
  memoizing it for the component's lifetime (was frozen past a UTC
  midnight for a long-lived session); reject a manually-typed out-of-range
  date in both Created-date onChange handlers, since minDate/maxDate only
  constrain the calendar popup, not direct text entry
- response.go/CLAUDE.md: reword mapUpstreamErrorGeneric's doc comment to
  stop reading as an endorsement of logging raw upstream bodies; full
  upstream detail in server logs remains intentional (operator-facing,
  not caller-facing) per explicit product decision
- CLAUDE.md: document upstreamErrors vs. upstreamErrorsGeneric as two
  distinct, intentional test tables rather than a naming inconsistency
- change_requests_test.go: add the missing CreateComment-failure case to
  TestCreateChangeRequestComment (previously only GetChangeRequest failure
  was covered)
- projects_test.go: add TestGetProjectContact, which had no coverage at all

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
@Rashmika998

Copy link
Copy Markdown
Contributor Author

Addressed the remaining nitpicks from the review (no separate inline thread for these, so replying here):

  • upstreamErrors vs upstreamErrorsGeneric naming — this was flagged as an inconsistency, but it's intentional: upstreamErrors is the detail-surfacing table for the 10 PATCH-handler tests (calling mapUpstreamError), upstreamErrorsGeneric is the fallback-only table for every other handler's tests (calling mapUpstreamErrorGeneric). Rather than rename anything, I documented both in CLAUDE.md's Testing section so the two-table convention is explicit going forward.
  • Missing CreateComment failure coverage in TestCreateChangeRequestComment — added.
  • Missing TestGetProjectContact entirely — added, covering auth, both UUID guards, the success path, and upstream-error mapping.
  • "Run gosec" reminders on accounts.go/problems.go — already run as part of this PR's test plan (gosec -fmt=text ./..., 0 issues); no new findings from the CodeRabbit-flagged commit either.

The 4 actionable inline comments (raw-body-logging docs, the empty tooltip, the stale UTC-today bound, and typed out-of-range dates) were replied to individually on their own threads.

Comment added by Claude on behalf of @Rashmika998.

@Rashmika998
Rashmika998 merged commit 529c083 into wso2-open-operations:main Aug 2, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants