Skip to content

[CSM Portal] fix Task/Problem follow-ups: null parent-case guard, On-suffix rename, keyboard accessibility - #1195

Merged
Rashmika998 merged 4 commits into
wso2-open-operations:mainfrom
rksk:task-parentcase-null-fix
Jul 21, 2026
Merged

Rashmika998 merged 4 commits into
wso2-open-operations:mainfrom
rksk:task-parentcase-null-fix

Conversation

@rksk

@rksk rksk commented Jul 21, 2026 •

Copy link
Copy Markdown
Contributor

Purpose

Follow-up fixes for two features merged earlier this session (Task tab on the Case detail page, Problem management): a null-safety crash in the task detail dialog, a naming-convention/schema-accuracy fix on Problem detail, and a keyboard-accessibility gap on the Problems list. No related issue link (internal tracking only).

Goals

  • Fix a crash in the Tasks tab's detail dialog when a task's parent-case reference is absent.
  • Align ProblemDetail's timestamp field names with this codebase's On suffix convention, and mark linkedIncidents nullable to match the actual wire format.
  • Make the Problems list's clickable rows keyboard-operable.

Approach

  • Task detail null guard: BeTaskDetail.parentCase widened to BeCaseNumberRef | null, matching the entity-service/BE schema's nullable: true. TaskDetailDialog now reads task.parentCase?.number ?? task.parentCase?.id ?? "—", consistent with how assignedTo/product already handle optionality in the same component.
  • Problem timestamp naming + nullability: renamed ProblemDetail.ResolvedAt/OpenedAt/ClosedAt to ResolvedOn/OpenedOn/ClosedOn (struct fields, JSON tags, and the SN-response mapping) across the entity-service, both openapi.yaml specs, and the webapp's BeProblemDetail type + ProblemDetailPage. Marked linkedIncidents nullable: true in the entity-service OpenAPI schema to match the Go implementation's actual nil-slice-serializes-to-null behavior.
  • Problems list keyboard accessibility: the clickable table row in ProblemsTab gained role="button", tabIndex={0}, an onKeyDown handler for Enter/Space, and an aria-label, mirroring the existing accessible-row pattern already used in ProductVulnerabilitiesTab.

User stories

  • As a CS engineer, opening a task's detail dialog never crashes, even when ServiceNow doesn't return a parent-case reference for that task.
  • As a CS engineer using only a keyboard, I can reach and open a problem's detail page from the Problems list.

Release note

  • Fixes a crash in the Case detail page's Tasks tab detail dialog when a task has no parent-case reference.
  • Renames Problem detail's timestamp fields to the platform's standard naming convention and corrects the OpenAPI spec for linkedIncidents.
  • Makes the Problems list keyboard-navigable.

Documentation

N/A — internal CS-engineer portal fixes; no external/product docs impacted.

Training

N/A — no training content impact.

Certification

N/A — no certification exam impact.

Marketing

N/A — internal tooling, not customer-facing.

Automation tests

  • Unit tests
    • webapp: TasksWidget.test.tsx covers a task detail with parentCase: null, asserting the dialog renders without throwing.
    • webapp: ProblemDetailPage.test.tsx updated for the renamed fields (10/10 passing).

Security checks

Samples

N/A — no new samples.

Related PRs

Stacked on top of #1194 (Tasks tab) and #1193 (Problem management), both already merged — this PR is a consolidated follow-up covering fixes found during CodeRabbit review and post-merge testing of both.

Migrations (if applicable)

N/A — no schema/data migration; type/naming-level fixes only.

Test environment

Verified locally: go build/go vet/go test clean (entity-service), go build/go vet clean (backend), tsc --noEmit/eslint clean and relevant vitest suites passing (webapp), on macOS.

Learning

Consolidated three small follow-up fixes into one PR rather than opening a separate PR per fix, per reviewer preference.

Summary by CodeRabbit

  • Changes
    • Problem details now use consistent “Opened on,” “Closed on,” and “Resolved on” timestamp fields.
    • Problem records now handle missing linked incidents and missing resolution details without breaking.
    • Task details display an em dash when a parent case is unavailable.
  • Accessibility
    • Problem table rows are now keyboard accessible, supporting Enter and Space navigation with descriptive labels.

…rence

TaskDetail.parentCase can be null when ServiceNow's parent-case lookup
comes back empty (the entity-service/BE layers already model it as
optional), but the webapp typed it as required and read
task.parentCase.number directly, which throws when the field is
actually absent.
@coderabbitai

coderabbitai Bot commented Jul 21, 2026 •

Copy link
Copy Markdown
Contributor

Review Change Stack

Caution

Review failed

The pull request is closed.

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: 2e554be5-53f8-4e5d-87b1-3b43d062338d

📥 Commits

Reviewing files that changed from the base of the PR and between 71a9469 and f11f464.

📒 Files selected for processing (1)
  • apps/csm-portal/webapp/src/features/csm-operations/components/ProblemsTab.tsx

📝 Walkthrough

Walkthrough

Problem detail timestamps were renamed from *At to *On across backend schemas, Go models, service mapping, frontend types, and rendering. Task details now support missing parent cases with a dash fallback. Problem rows gained keyboard navigation and accessibility attributes.

Changes

Problem detail and task interaction updates

Layer / File(s) Summary
Backend problem contract and mapping
entity-service/openapi.yaml, entity-service/internal/domain/entity.go, entity-service/internal/service/sn_problem_service.go, apps/csm-portal/backend/openapi.yaml
Problem detail schemas, models, and ServiceNow mappings now use nullable resolvedOn, openedOn, and closedOn fields while retaining resolvedBy; linkedIncidents is nullable in the entity-service schema.
Nullable task parent-case handling
apps/csm-portal/webapp/src/api/backend/types.ts, apps/csm-portal/webapp/src/features/csm-cases/components/TaskDetailDialog.tsx, apps/csm-portal/webapp/src/features/csm-cases/components/TasksWidget.test.tsx
Task details allow parentCase to be null, render — when it is absent, and test the fallback behavior.
Problem portal rendering and row interaction
apps/csm-portal/webapp/src/api/backend/types.ts, apps/csm-portal/webapp/src/features/csm-operations/pages/ProblemDetailPage.tsx, apps/csm-portal/webapp/src/features/csm-operations/pages/ProblemDetailPage.test.tsx, apps/csm-portal/webapp/src/features/csm-operations/components/ProblemsTab.tsx
Problem detail rendering and fixtures use the renamed timestamps; problem rows support Enter and Space navigation with focusability and accessible labels.

Estimated code review effort: 3 (Moderate) | ~20 minutes

Suggested labels: Type/Bug, Entity Service

Suggested reviewers: rashmika998, cloby99

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 75.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly reflects the main changes: null parent-case handling, timestamp renames, and keyboard accessibility.
Description check ✅ Passed The description follows the required template well and covers purpose, goals, approach, tests, and deployment-related sections.
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.

rksk added 2 commits July 21, 2026 22:09
…dIncidents nullable

Renames ProblemDetail.resolvedAt/openedAt/closedAt to resolvedOn/openedOn/closedOn
across the entity-service domain type, the SN mapping layer, both openapi specs,
and the CSM webapp FE type/page/test, matching this codebase's On-suffix timestamp
convention. Also marks linkedIncidents nullable in entity-service/openapi.yaml to
reflect that an empty collection serializes as JSON null.
Add role="button", tabIndex={0}, onKeyDown (Enter/Space), and an
aria-label to the clickable problem row in ProblemsTab, mirroring the
pattern already used in ProductVulnerabilitiesTab. Keyboard-only users
can now reach and activate a row to open its detail page.
@rksk rksk changed the title [CSM Portal] guard task detail dialog against a null parent-case reference [CSM Portal] fix Task/Problem follow-ups: null parent-case guard, On-suffix rename, keyboard accessibility Jul 21, 2026
@rksk

rksk commented Jul 21, 2026

Copy link
Copy Markdown
Contributor Author

@coderabbitai resume

@coderabbitai

coderabbitai Bot commented Jul 21, 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: 1

🧹 Nitpick comments (1)
apps/csm-portal/webapp/src/api/backend/types.ts (1)

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

Align type with nullable: true in the OpenAPI schema.

The backend OpenAPI schema explicitly marks linkedIncidents as nullable: true, and the API returns null rather than an empty array when no incidents are linked. Adding | null here ensures the TypeScript definition accurately reflects the payload.

♻️ Proposed refactor
-  linkedIncidents?: BeProblemRef[];
+  linkedIncidents?: BeProblemRef[] | null;
🤖 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/api/backend/types.ts` at line 1971, Update the
linkedIncidents property type to allow null values in addition to BeProblemRef
arrays, matching the nullable OpenAPI payload behavior.
🤖 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-operations/components/ProblemsTab.tsx`:
- Line 154: Remove the role="button" prop from the interactive TableRow in
ProblemsTab.tsx, preserving its native table-row semantics. Keep tabIndex,
aria-label, onClick, and onKeyDown unchanged so keyboard interaction remains
supported.

---

Nitpick comments:
In `@apps/csm-portal/webapp/src/api/backend/types.ts`:
- Line 1971: Update the linkedIncidents property type to allow null values in
addition to BeProblemRef arrays, matching the nullable OpenAPI payload behavior.
🪄 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

Run ID: 9ee70f9f-a40f-4801-a642-841923cb537b

📥 Commits

Reviewing files that changed from the base of the PR and between a1e8804 and 71a9469.

📒 Files selected for processing (10)
  • apps/csm-portal/backend/openapi.yaml
  • apps/csm-portal/webapp/src/api/backend/types.ts
  • apps/csm-portal/webapp/src/features/csm-cases/components/TaskDetailDialog.tsx
  • apps/csm-portal/webapp/src/features/csm-cases/components/TasksWidget.test.tsx
  • apps/csm-portal/webapp/src/features/csm-operations/components/ProblemsTab.tsx
  • apps/csm-portal/webapp/src/features/csm-operations/pages/ProblemDetailPage.test.tsx
  • apps/csm-portal/webapp/src/features/csm-operations/pages/ProblemDetailPage.tsx
  • entity-service/internal/domain/entity.go
  • entity-service/internal/service/sn_problem_service.go
  • entity-service/openapi.yaml

Comment thread apps/csm-portal/webapp/src/features/csm-operations/components/ProblemsTab.tsx Outdated
role="button" on a TableRow replaces its implicit "row" role, breaking
grid navigation and column association for screen-reader users. Keep
tabIndex/onKeyDown/aria-label for keyboard activation without
overriding native table semantics.
@Rashmika998
Rashmika998 merged commit 230e248 into wso2-open-operations:main Jul 21, 2026
1 check failed
@rksk

rksk commented Jul 21, 2026

Copy link
Copy Markdown
Contributor Author

@coderabbitai resume

@coderabbitai

coderabbitai Bot commented Jul 21, 2026

Copy link
Copy Markdown
Contributor
✅ Action performed

Reviews resumed.

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