Skip to content

[CSM Portal] case/CR detail cleanup: linked SRs to Related tab, remove redundant menu items, hide SLAs tab, CR page tabbed layout - #1267

Merged
rksk merged 11 commits into
wso2-open-operations:mainfrom
rksk:csm-linked-srs-to-related-tab
Jul 27, 2026
Merged

[CSM Portal] case/CR detail cleanup: linked SRs to Related tab, remove redundant menu items, hide SLAs tab, CR page tabbed layout#1267
rksk merged 11 commits into
wso2-open-operations:mainfrom
rksk:csm-linked-srs-to-related-tab

Conversation

@rksk

@rksk rksk commented Jul 27, 2026

Copy link
Copy Markdown
Contributor

Purpose

CSM portal cleanup and bug fixes, landing as a stacked set of related changes on this one PR (kept as a draft while more may be added — will mark ready for review once settled). Spans the CSM webapp (FE) and the Go entity-service.

  1. Move "Linked service requests" out of the case detail's Details tab into the Related tab, alongside child cases — both are "other records tied to this case," and Related was freed up once Watchers got its own tab (a prior, already-merged PR).
  2. Remove three case detail More-actions menu items that are now duplicate entry points for functionality their own tab already exposes directly: "Manage watchers" (Watchers tab does inline add/remove), "Link to another case" (the Related tab's own "Linked service requests" card has its own "Link to another case" button), and "Request a call" (the Call requests tab has its own "Create call request" button). "Create task" stays in the menu since the Tasks tab is still hidden and has no create affordance of its own.
  3. Hide the case detail SLAs tab (same hidden pattern already used for the Tasks tab).
  4. Give the change request detail page a tabbed layout matching the case detail page's, instead of a single long scrolling stack of cards: Overview stays visible above the tabs, with Approval / Details / Comments / Attachments each getting their own tab (Comments and Attachments show a count, following the case page's exact convention).
  5. Fix the project detail page's Issues tab so it shows every issue type for the project (cases, service requests, security reports, engagements), not just support cases. The tab was already unlocked (no case-type filter forced), but an empty type selection was being omitted from the search request entirely, and the backend defaults an omitted type filter to support cases only. The list now sends every known type explicitly whenever the type filter is unlocked and nothing is selected, so the backend default can't silently narrow the result.
  6. Fix three account-page field-name mismatches between the FE and the backend: the account detail/list pages read createdAt/updatedAt, but every backend account response shape returns createdOn/updatedOn; the account search request sent searchQuery at the top level, but the backend expects it nested under filters (matching the /cases/search payload shape); and the Tier value wasn't read at all for accounts coming from the alternate (non-Postgres) response shape, which names the field supportTier instead of tier (a plain string on the list view, an {id, label} ref on the detail view).
  7. Entity-service: give attachment uploads their own size cap instead of falling through to the generic 1 MiB request-body default, which was rejecting any attachment over ~1 MiB — including small, legitimate files well under the 10 MB limit the FE/BFF already advertise. New cap matches the BFF's own 15 MiB ceiling; the error message now states the real limit instead of a generic "request body too large."
  8. Entity-service: add the account's SF ID (Salesforce ID) to the ServiceNow-backed account mapping. The backing data source already carries this field and it's well populated in practice, but no layer was reading or forwarding it, so it always showed blank in the portal.
  9. Fix "Recently viewed" not showing a same-tab visit until a full reload: opening a case, then navigating away, then opening the panel could leave the just-visited case missing until reload. The per-user storage bucket resolves from an async ID-token claim via an optimistic cached-key seed, and the resolve/migrate step used to run only in a background effect decoupled from both the write and the read — so a visit recorded before that identity resolution settled could sit in the "pending" bucket without the already-mounted panel reliably picking it up. The write path and the read path now force that same resolution synchronously wherever they need the bucket key, and the reader re-reads storage immediately the moment its own identity settles, instead of relying solely on a dispatched event from elsewhere.

Goals

One way to do each thing, not two — remove menu shortcuts once their target tab makes the same action directly reachable. Bring the change request detail page's information architecture in line with the case detail page's, which already went through this same tabbed reorganization. Make the project detail Issues tab actually show everything its filters imply it should. Make the account pages render correctly regardless of which backend response shape an account came from, and show every field the backing data source actually has for an account. Make "Recently viewed" reflect a visit as soon as it happens, in the same tab, with no reload required.

Approach

Each change is a small, independent commit — see commit messages for detail. (1) is a pure JSX relocation (no handler/state logic changes); (2) removes dead menu entries plus their now-unused handlers/state (autoOpenCallCreate plumbing); (3) is a one-line TAB_DEFS change; (4) relocates existing cards into tab-content blocks with no changes to data fetching, mutations, or the recently-fixed request-approval/error-message handling; (5) is scoped to the shared issues-list component's query-filter merge (no change to the request/response contract) — an unlocked, empty type selection now resolves to the full known type list before the search request is built; (6) is FE-only — renames the account type's date fields, nests the search request's searchQuery under filters, and adds a small helper that resolves the Tier value from whichever of tier/supportTier (string or ref) the loaded account actually carries, since the FE has a single Account type shared across both backend response shapes; (7) adds a scoped size-limit override for the attachment-create handler only, leaving every other endpoint's default untouched; (8) adds the SF ID field to the ServiceNow account wire struct and domain types, wired through the existing SN-to-domain mapping, with round-trip tests; (9) is FE-only, scoped to the useRecentViews hook — extracts the resolve/migrate step into a shared helper called synchronously from both the record callback and the reader's own settle-effect, with unit coverage for the record-then-read-within-one-session scenario.

Release note

Case detail page cleanup: linked service requests moved to the Related tab, three redundant menu shortcuts removed, SLAs tab hidden for now. Change request detail page reorganized into tabs (Approval, Details, Comments, Attachments), matching the case detail page. Project detail page's Issues tab now shows all issue types for the project, not only support cases. Account pages now show correct created/updated dates, the Tier value, and the SF ID for every account, and account search works correctly again. Attachment uploads no longer fail for files over ~1 MiB. "Recently viewed" now reflects a visit immediately after navigating away, without needing a page reload.

Documentation

N/A — internal UI reorganization and bug fixes, no new contract/shape changes beyond the additive SF ID field (documented in openapi.yaml).

Security checks

  • Secure coding standards followed: yes
  • FindSecurityBugs / static analysis: N/A for TS/React — eslint/tsc clean; N/A for Go — go vet ./... clean
  • No secrets committed: yes

Related PRs

N/A

Summary by CodeRabbit

  • New Features
    • Change request detail now uses a tabbed layout for approvals, plans, comments, and attachments (with item counts).
    • Account pages now normalize and display tier plus Salesforce ID consistently; recent views keep working correctly as identity loads; related case content uses a responsive two-column layout.
  • Bug Fixes
    • Improved account search requests and table display fallbacks (including “Created”/“Last updated” formatting).
    • Removed duplicate items from case “More” actions and hidden the SLAs tab; simplified related call-request navigation behaviors.
    • Case issue filtering stays correct when no type is selected.
    • Case attachment uploads now return clearer, attachment-specific size-limit errors.

Now that watchers has its own tab, the Details tab's card layout has
room; move the Linked service requests card into the Related tab
alongside child cases so cross-case links live with other
case-relationship content instead of general details.
@coderabbitai

coderabbitai Bot commented Jul 27, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

Warning

Review limit reached

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

Next review available in: 43 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: e3fbb87c-6761-4057-8ff5-b7356b04682c

📥 Commits

Reviewing files that changed from the base of the PR and between 9e6134d and 200cbff.

📒 Files selected for processing (3)
  • entity-service/internal/handler/case_handler.go
  • entity-service/internal/handler/case_handler_test.go
  • entity-service/internal/handler/decode_test.go
📝 Walkthrough

Walkthrough

The PR updates CSM account contracts and rendering, adjusts case actions and filters, adds tabbed change-request content, synchronizes recent views with identity resolution, exposes ServiceNow Salesforce IDs, and adds endpoint-specific attachment body limits.

Changes

CSM account data and presentation

Layer / File(s) Summary
Account response and request contracts
apps/csm-portal/webapp/src/features/csm-accounts/types/csmAccounts.ts
Account types support alternate tier shapes, normalize tier values, use createdOn/updatedOn, and nest search queries under filters.
Account list and detail rendering
apps/csm-portal/webapp/src/features/csm-accounts/pages/*
Account pages use normalized tiers, updated timestamps, and placeholders for missing tier or Salesforce ID values.

CSM case UI behavior

Layer / File(s) Summary
Secondary action removal
apps/csm-portal/webapp/src/features/csm-cases/components/CaseActionBar.*
The overflow menu no longer includes watcher management, case linking, or call-request actions; related tests and imports are updated.
Case filter normalization
apps/csm-portal/webapp/src/features/csm-cases/components/CsmIssuesView.tsx
Empty case-type selections now resolve to all known case types before querying.
Case detail tabs and layout
apps/csm-portal/webapp/src/features/csm-cases/pages/CsmCaseDetailPage.tsx
The SLA tab is hidden, call-request auto-open wiring is removed, and related child cases use a responsive grid.

Change-request detail tabs

Layer / File(s) Summary
Tabbed change-request content
apps/csm-portal/webapp/src/features/csm-operations/pages/CsmChangeRequestDetailPage.tsx
Approval, details, comments, and attachments are rendered through a new active-tab configuration with comment and attachment counts.

Recent-view identity synchronization

Layer / File(s) Summary
Identity-aware storage coordination
apps/csm-portal/webapp/src/features/csm-recent/hooks/useRecentViews.ts
Recent-view hooks migrate pending storage to resolved user buckets and synchronize reads and writes after identity resolution.
Identity timing tests
apps/csm-portal/webapp/src/features/csm-recent/hooks/useRecentViews.test.ts
Tests cover identity resolution across existing readers, later mounts, and recorder instances.

Entity-service account and attachment contracts

Layer / File(s) Summary
ServiceNow Salesforce ID propagation
entity-service/internal/domain/entity.go, entity-service/internal/service/*, entity-service/openapi.yaml
Optional sfId values flow from ServiceNow payloads into domain responses and are documented in OpenAPI, with presence and absence tests.
Attachment request-size handling
entity-service/internal/handler/*
JSON decoding supports endpoint-specific limits and messages; case attachments use a dedicated limit with boundary tests.

Estimated code review effort: 5 (Critical) | ~120 minutes

Possibly related PRs

Suggested labels: Type/Improvement, Type/Bug

Suggested reviewers: cloby99, rashmika998

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title matches the main scope: CSM portal cleanup around case/CR detail changes and related UI fixes.
Description check ✅ Passed The description covers Purpose, Goals, Approach, Release note, Documentation, Security checks, and Related PRs; several optional template sections are missing.
Docstring Coverage ✅ Passed Docstring coverage is 80.95% which is sufficient. The required threshold is 80.00%.
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.

…ide SLAs tab

- Manage watchers, Link to another case, and Request a call are removed from
  the case detail More-actions menu: each now has a fully equivalent, directly
  reachable entry point in its own tab (Watchers tab's inline add/remove,
  Related tab's own "Link to another case" button, Call requests tab's own
  "Create call request" button), so keeping both was two ways to do one thing.
  Create task stays in the menu since the Tasks tab is still hidden and has no
  create affordance of its own.
- Removed the now-dead autoOpenCallCreate plumbing that only existed to
  support the removed "Request a call" menu item.
- SLAs tab hidden in TAB_DEFS (data/hooks untouched, same pattern already used
  for the Tasks tab).
@rksk
rksk marked this pull request as draft July 27, 2026 14:36
@rksk rksk changed the title [CSM Portal] move linked service requests into the Related tab [CSM Portal] case detail cleanup: linked SRs to Related tab, remove redundant More-actions items, hide SLAs tab Jul 27, 2026
@rksk rksk changed the title [CSM Portal] case detail cleanup: linked SRs to Related tab, remove redundant More-actions items, hide SLAs tab [CSM Portal] case/CR detail cleanup: linked SRs to Related tab, remove redundant menu items, hide SLAs tab, CR page tabbed layout Jul 27, 2026
rksk added 4 commits July 27, 2026 20:34
…ail Issues tab

The project detail page's Issues tab locks only the project filter, with
no case-type lock, so it should return every issue type for that project.
It was only ever showing support cases because an empty caseTypes filter
gets omitted from the /cases/search request entirely, and the
entity-service defaults an absent types filter to support cases only
rather than "no restriction".

Fix in CsmIssuesView: when the type filter is unlocked and nothing is
selected, send every known case type explicitly instead of omitting the
field, so the backend default can't silently narrow the result. Every
other CsmIssuesView caller locks caseTypes to a single value already, so
this only changes behavior for the one unlocked, multi-type view.
… search request shape

- Rename the Account type's createdAt/updatedAt to createdOn/updatedOn to
  match every account response shape (both data sources return the *On
  fields, never *At).
- Nest the account search request's searchQuery under filters, matching
  the backend's search payload shape and the pattern already used by the
  case search builder.
- Tolerate the alternate account response shape's supportTier field (a
  plain string on the list view, an {id, label} ref on the detail view)
  alongside tier, since the FE has one Account type shared across both
  data sources. Adds a resolveAccountTier helper used on both pages.
- Minor: show the existing empty-state placeholder for a blank SF ID on
  the accounts list, matching the detail page.
…f the generic 1 MiB default

CreateCaseAttachment routed through the generic decodeRequest helper, which
enforces a blanket 1 MiB JSON body cap meant for small structured payloads.
Any attachment upload over ~1 MiB (base64-encoded) was rejected with
"request body too large" even though it is well under every advertised
limit -- the FE's 10 MB client-side check and the csm-portal backend's own
15 MiB ceiling never got a chance to matter.

Add decodeRequestWithLimit, a variant of decodeRequest that accepts a
caller-supplied body size cap and too-large message, and use it for
CreateCaseAttachment with a 15 MiB cap -- matching the csm-portal backend's
own maxAttachmentBodyBytes ceiling (sized for a 10 MB file inflated by
base64 plus JSON overhead). The error message now states the actual limit
instead of the generic one. No other endpoint's cap changes.
Adds the field the backing data source already provides but wasn't
being forwarded: SNAccountView and SNAccountDetail gain SfID, wired
through from the ServiceNow account response's sfId field.
…l reload

useRecentViews' bucket-key resolution and the "pending" (pre-identity)
migration lived only in a background effect that ran independently of
both the record (write) path and the read path, so a visit recorded
before this browser's ID-token decode settled could sit unreflected in
an already-mounted reader until some unrelated event forced a re-read.

Extract the resolve/migrate step into a shared helper and call it
synchronously from both useRecordRecentView's write and
useRecentViews' own settle-effect, and force an explicit re-read the
moment a reader's own identity settles instead of only reacting to a
dispatched event from elsewhere. Adds unit coverage for the
record-then-read-within-one-session scenario.
@rksk
rksk marked this pull request as ready for review July 27, 2026 15:44
@rksk

rksk commented Jul 27, 2026

Copy link
Copy Markdown
Contributor Author

@coderabbitai review

@coderabbitai

coderabbitai Bot commented Jul 27, 2026

Copy link
Copy Markdown
Contributor
✅ Action performed

Review finished.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

@rksk

rksk commented Jul 27, 2026

Copy link
Copy Markdown
Contributor Author

@coderabbitai resume

@coderabbitai

coderabbitai Bot commented Jul 27, 2026

Copy link
Copy Markdown
Contributor
✅ Action performed

Reviews resumed.

# Conflicts:
#	entity-service/internal/domain/entity.go
#	entity-service/internal/service/sn_account_service.go
@rksk

rksk commented Jul 27, 2026

Copy link
Copy Markdown
Contributor Author

@coderabbitai resume

@coderabbitai

coderabbitai Bot commented Jul 27, 2026

Copy link
Copy Markdown
Contributor
✅ Action performed

Reviews resumed.

@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: 2

🧹 Nitpick comments (2)
apps/csm-portal/webapp/src/features/csm-operations/pages/CsmChangeRequestDetailPage.tsx (1)

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

Tabs aren't associated with their panels for assistive tech.

The four content blocks below are plain Box/Card elements with no role="tabpanel", id, or aria-labelledby, and the Tabs have no id/aria-controls. Screen reader users get a tablist that announces no relationship to the rendered content.

♿ Suggested wiring
             return (
               <Tab
                 key={t.id}
                 value={t.id}
+                id={`cr-tab-${t.id}`}
+                aria-controls={`cr-tabpanel-${t.id}`}
                 icon={t.icon}
                 iconPosition="start"
                 label={count ? `${t.label} (${count})` : t.label}
                 sx={{ minHeight: 44, textTransform: "none" }}
               />
             );

Then give each rendered block role="tabpanel", id={cr-tabpanel-} and aria-labelledby={cr-tab-}.

🤖 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-operations/pages/CsmChangeRequestDetailPage.tsx`
around lines 408 - 436, Associate the tabs and their rendered content panels for
accessibility. In the Tabs map within CsmChangeRequestDetailPage, add matching
ids and aria-controls to each Tab, and update each corresponding content
Box/Card block with role="tabpanel", id="cr-tabpanel-<id>", and
aria-labelledby="cr-tab-<id>"; keep the existing active-tab rendering behavior
unchanged.
apps/csm-portal/webapp/src/features/csm-cases/components/CaseActionBar.test.tsx (1)

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

Assert that removed actions are absent from the overflow menu.

The narrowed matrix stops dispatch testing, but does not prevent manage_watchers, link_case, or request_call from being reintroduced. Add one menu-level absence test.

Suggested test
+  it("does not expose actions now available from case-detail tabs", () => {
+    render(
+      <CaseActionBar
+        caseDetail={caseInState("awaiting_info", ["waiting_on_wso2"])}
+        onAction={vi.fn()}
+      />,
+    );
+
+    fireEvent.click(screen.getByRole("button", { name: /more/i }));
+
+    expect(screen.queryByRole("menuitem", { name: /manage watchers/i })).not.toBeInTheDocument();
+    expect(screen.queryByRole("menuitem", { name: /link to another case/i })).not.toBeInTheDocument();
+    expect(screen.queryByRole("menuitem", { name: /request a call/i })).not.toBeInTheDocument();
+  });
🤖 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-cases/components/CaseActionBar.test.tsx`
around lines 372 - 375, Add a menu-level test in the “CaseActionBar — Hold
auto-closure / Edit case details” suite that opens or renders the overflow menu
and asserts the removed actions manage_watchers, link_case, and request_call are
absent. Keep the existing SECONDARY_ITEMS dispatch matrix unchanged and verify
absence through visible menu action labels or identifiers.
🤖 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/webapp/src/features/csm-recent/hooks/useRecentViews.test.ts`:
- Around line 250-267: Update the test around useRecordRecentView so mockUserid
is reset to undefined before the recorder mounts, while preserving the reader’s
already-resolved shared identity. Then invoke the recorder and assert the entry
lands in the reader’s existing bucket, exercising the resolveActiveUserKey
fallback when the writer’s own userid is unresolved.

In `@entity-service/internal/handler/decode.go`:
- Around line 49-54: Update decodeRequestWithLimit’s trailing-data validation so
a *http.MaxBytesError from the second Decode is reported through the
size-specific tooLargeMsg path rather than the generic invalid-request message.
Add a regression test covering a valid first object followed by oversized
trailing data and assert the size-limit response.

---

Nitpick comments:
In
`@apps/csm-portal/webapp/src/features/csm-cases/components/CaseActionBar.test.tsx`:
- Around line 372-375: Add a menu-level test in the “CaseActionBar — Hold
auto-closure / Edit case details” suite that opens or renders the overflow menu
and asserts the removed actions manage_watchers, link_case, and request_call are
absent. Keep the existing SECONDARY_ITEMS dispatch matrix unchanged and verify
absence through visible menu action labels or identifiers.

In
`@apps/csm-portal/webapp/src/features/csm-operations/pages/CsmChangeRequestDetailPage.tsx`:
- Around line 408-436: Associate the tabs and their rendered content panels for
accessibility. In the Tabs map within CsmChangeRequestDetailPage, add matching
ids and aria-controls to each Tab, and update each corresponding content
Box/Card block with role="tabpanel", id="cr-tabpanel-<id>", and
aria-labelledby="cr-tab-<id>"; keep the existing active-tab rendering behavior
unchanged.
🪄 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: e2a319f1-9144-4285-996a-e9ab5c0343bf

📥 Commits

Reviewing files that changed from the base of the PR and between 6e04895 and d16be8c.

📒 Files selected for processing (17)
  • apps/csm-portal/webapp/src/features/csm-accounts/pages/CsmAccountDetailPage.tsx
  • apps/csm-portal/webapp/src/features/csm-accounts/pages/CsmAccountsPage.tsx
  • apps/csm-portal/webapp/src/features/csm-accounts/types/csmAccounts.ts
  • apps/csm-portal/webapp/src/features/csm-cases/components/CaseActionBar.test.tsx
  • apps/csm-portal/webapp/src/features/csm-cases/components/CaseActionBar.tsx
  • apps/csm-portal/webapp/src/features/csm-cases/components/CsmIssuesView.tsx
  • apps/csm-portal/webapp/src/features/csm-cases/pages/CsmCaseDetailPage.tsx
  • apps/csm-portal/webapp/src/features/csm-operations/pages/CsmChangeRequestDetailPage.tsx
  • apps/csm-portal/webapp/src/features/csm-recent/hooks/useRecentViews.test.ts
  • apps/csm-portal/webapp/src/features/csm-recent/hooks/useRecentViews.ts
  • entity-service/internal/domain/entity.go
  • entity-service/internal/handler/case_handler.go
  • entity-service/internal/handler/case_handler_test.go
  • entity-service/internal/handler/decode.go
  • entity-service/internal/service/sn_account_service.go
  • entity-service/internal/service/sn_account_service_test.go
  • entity-service/openapi.yaml

Comment thread entity-service/internal/handler/decode.go
…ing data

- useRecentViews.test.ts: the "unresolved-identity writer" test never
  actually left the writer's own identity unresolved before it mounted, so
  the resolveActiveUserKey fallback branch it claims to exercise was never
  hit. Reset the mock claim before the recorder mounts, then restore it
  before invoking the record call.
- decode.go: decodeRequestWithLimit's trailing-data check treated an
  oversized-body error from the second Decode() the same as any other
  trailing data, returning the generic "must contain a single JSON object"
  message instead of the caller's size-limit message. Handle
  *http.MaxBytesError explicitly on that path, with a regression test.

@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: 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 `@entity-service/internal/handler/decode_test.go`:
- Around line 42-50: Extend the test around decodeRequestWithLimit to assert
that the first decode succeeded by verifying dst.X equals "ok" after the call.
Keep the existing failure, status, and message assertions unchanged so the test
specifically covers oversized trailing data after a successful initial object
decode.
- Around line 32-35: Update the attachment-size error message used by the
handler in case_handler.go and the tooLargeMsg expectation in the test to
consistently state the promised 15 MiB limit, using accurate binary-size units.
Keep the test and caller messages identical.
🪄 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: 0e06f9d6-14d2-441d-8329-6a408473a03e

📥 Commits

Reviewing files that changed from the base of the PR and between d16be8c and 9e6134d.

📒 Files selected for processing (3)
  • apps/csm-portal/webapp/src/features/csm-recent/hooks/useRecentViews.test.ts
  • entity-service/internal/handler/decode.go
  • entity-service/internal/handler/decode_test.go
🚧 Files skipped from review as they are similar to previous changes (1)
  • apps/csm-portal/webapp/src/features/csm-recent/hooks/useRecentViews.test.ts

Comment thread entity-service/internal/handler/decode_test.go
Comment thread entity-service/internal/handler/decode_test.go Outdated
…onger test assertion

- Extracted the attachment too-large message into attachmentTooLargeMsg
  (case_handler.go) so the handler and both test files can no longer drift
  out of sync — it was previously duplicated as a literal string in each,
  and CodeRabbit flagged the new decode_test.go copy as inconsistent with
  the 15 MiB request-body cap. It's intentionally worded around the 10 MB
  file-size limit callers care about, not the raw request-body cap (which
  includes base64/JSON overhead the caller never sees) — documented in the
  new constant's comment.
- decode_test.go: assert dst.X == "ok" after the call, proving the test
  actually exercises the trailing-data check (the second Decode) rather
  than passing because the first Decode already failed.
@rksk
rksk merged commit bb869d9 into wso2-open-operations:main Jul 27, 2026
1 check passed
rksk added a commit to rksk/os-cs-tools that referenced this pull request Aug 6, 2026
hidden: true was reintroduced in wso2-open-operations#1267 with no recorded rationale, three
weeks after the tab shipped visible in wso2-open-operations#1049/wso2-open-operations#1079. The underlying data
path (useGetCsmCaseSlas -> BFF/entity-service POST /slas/search) works
and is already being fetched on page load; only the tab button was
unreachable.
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