Skip to content

[CSM Portal][BE] fix: retire reopened case state, map to waiting_on_wso2 - #879

Merged
v15a1 merged 1 commit into
wso2-open-operations:v2from
Rashmika998:task/retire-reopened-state
Jun 17, 2026
Merged

v15a1 merged 1 commit into
wso2-open-operations:v2from
Rashmika998:task/retire-reopened-state

Conversation

@Rashmika998

@Rashmika998 Rashmika998 commented Jun 17, 2026 •

Copy link
Copy Markdown
Contributor

Summary

  • Maps the ServiceNow 'reopened' state label to waiting_on_wso2 in sn_case_service.go so the entity service never emits reopened to consumers
  • Removes CaseStateReopened domain constant, its validCaseState entry, and its outbound SN numeric state ID (1006) from the entity service
  • Removes the deprecated caseStateReopened branch from the CSM backend nextStates() state machine
  • Removes reopened from all OpenAPI spec state enums in the entity service

Closes wso2-enterprise/digiops-cs#2090

Test plan

  • All existing handler tests pass (go test ./... in apps/csm-portal/backend)
  • Both services build cleanly (go build ./...)
  • A SN case with state reopened is returned as waiting_on_wso2 from GET /cases/{id} and POST /cases/search
  • No nextStates response includes reopened

🤖 Generated with Claude Code

Summary by CodeRabbit

  • Breaking Changes
    • Removed the reopened case state. The support case workflow no longer supports this state, and the API will no longer accept it in case updates or searches. Existing cases in this state will be mapped to an alternative state.

…p to waiting_on_wso2

Map the SN 'reopened' label to waiting_on_wso2 in the entity service
so the state is never emitted to consumers. Remove the CaseStateReopened
domain constant, its validCaseState entry, and the outbound SN state ID.
Remove the deprecated caseStateReopened branch from the BE nextStates
state machine. Update OpenAPI spec to drop reopened from all state enums.

Closes wso2-open-operations#2090

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

coderabbitai Bot commented Jun 17, 2026 •

Copy link
Copy Markdown
Contributor

Review Change Stack

📝 Walkthrough

Walkthrough

The reopened case state is removed entirely across the stack: the exported CaseStateReopened domain constant is deleted, the ServiceNow numeric-state and label mappings are updated, the validCaseState map is corrected, all five OpenAPI schema enums are pruned, the portal state-machine constant and transition branch are removed, and the matching test row is dropped.

Changes

Remove reopened case state

Layer / File(s) Summary
Domain enum and service validation
entity-service/internal/domain/entity.go, entity-service/internal/service/case_service.go, entity-service/internal/service/sn_case_service.go
CaseStateReopened is removed from the domain enum and from validCaseState; snStateIDMap drops its numeric ID and snCaseStateMap remaps the "reopened" ServiceNow label to CaseStateWaitingOnWSO2.
OpenAPI schema enum updates
entity-service/openapi.yaml
reopened is removed from the state enum in UpdateCaseRequest, SearchCasesRequest.stateKeys.items, Case, CaseView, and CaseSearchView.
Portal state machine and test cleanup
apps/csm-portal/backend/internal/handler/state.go, apps/csm-portal/backend/internal/handler/cases_test.go
The caseStateReopened constant and its nextStates switch branch are deleted; the corresponding table-driven test row is removed.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Possibly related PRs

Suggested labels

Type/Bug, Area/Backend, App/CSM Portal, Entity Service

Suggested reviewers

  • cloby99

Poem

🐇 Hop hop, one state must go,
reopened bade its last hello.
The enum shrinks, the switch grows lean,
No "reopened" branch shall now be seen.
From awaiting_info we jump ahead —
To solution_proposed instead! 🎉

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 inconclusive)

Check name Status Explanation Resolution
Description check ❓ Inconclusive The PR description is well-structured and clearly explains the changes, purpose, and test plan, though it does not follow the full template structure required by the repository. Consider providing a more complete description using the template sections (Purpose, Goals, Approach, User stories, Release notes, Documentation, Security checks, etc.) to ensure comprehensive communication and alignment with repository standards.
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title accurately describes the main change: retiring the reopened case state and mapping it to waiting_on_wso2, which aligns with all the file changes across both services.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
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.

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

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

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@Rashmika998 Rashmika998 self-assigned this Jun 17, 2026
@Rashmika998 Rashmika998 added Type/Improvement Marks enhancements or improvements to existing features Area/Backend App/CSM Portal labels Jun 17, 2026
@v15a1
v15a1 merged commit 5d82aff into wso2-open-operations:v2 Jun 17, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

App/CSM Portal Area/Backend Type/Improvement Marks enhancements or improvements to existing features

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants