Skip to content

refactor(platform): move nsw-srilanka's caseflow and caseparty into platform - #443

Open
lokewate wants to merge 3 commits into
mainfrom
refactor/move-caseflow
Open

lokewate wants to merge 3 commits into
mainfrom
refactor/move-caseflow

Conversation

@lokewate

@lokewate lokewate commented Nov 30, 2026 •

Copy link
Copy Markdown
Contributor

Summary

Moves nsw-srilanka's case flows (caseflow) and case parties (caseparty) into core/platform, unchanged. Phase 4 of OpenNSW/nsw-srilanka#1248, issue OpenNSW/nsw-srilanka#1238.

The code was made generic in nsw-srilanka first (OpenNSW/nsw-srilanka#1339; OpenNSW/nsw-srilanka#1347 put caseparty on database/sql). OpenNSW/nsw-srilanka#1361 then moved the one scope name to nsw-srilanka's internal/scopes and rewrote the handlers' comments to name the path values they read instead of route paths, so this PR copies it from nsw-srilanka's main at OpenNSW/nsw-srilanka#1361's merge commit, d5b188df. A client flow starts with its variables under caseflow.DefaultVarNames (flowId, workflowId, caseId, input, callbackToken), each named after the start request field or path parameter it holds, unless the host passes caseflow.WithVarNames.

The tables stay in the host's migrations. First of three stacked PRs; the task API and then workflowadmin follow.

Type of Change

  • Refactoring (no functional changes)

Changes Made

Review commit by commit.

Commit What it does How to check it
6c93874 Copies internal/caseflow and internal/caseparty into platform/caseflow and platform/caseparty. Byte-for-byte copy (blob check below). It doesn't build by itself: it still imports nsw-srilanka.
b158b24 Rewrites the caseparty import to core/platform/caseparty, adds the SPDX headers (make license and core's pre-commit hook), and runs go mod tidy. Mechanical, commands in the commit message. Each file gains the 3 header lines; only import lines change otherwise. go.mod: go-sqlmock is added for the tests, at nsw-srilanka's version. The rewrite and go mod tidy share a commit because core's hook needs both to build and lint.
da33200 Lists the two packages in platform/README.md. Only Markdown.

Blob check

Each file in 6c93874 has the same blob as in nsw-srilanka at d5b188df (git rev-parse <commit>:<path>):

nsw-srilanka path blob
internal/caseflow/client_handler.go 38cb46ea0e48
internal/caseflow/client_handler_test.go c41794a59b80
internal/caseflow/config.go 201907a81d42
internal/caseflow/config_test.go 4d4bdbbd8442
internal/caseflow/repository.go 795de0a35299
internal/caseflow/repository_test.go 6453d17998cb
internal/caseflow/service.go f226d2626806
internal/caseflow/service_test.go 1f1cf6f0ea75
internal/caseflow/view.go ecd114de74fc
internal/caseparty/caseparty.go 410a36aa2332
internal/caseparty/caseparty_test.go 5abc7e9db209

The core path is the same with internal/ replaced by platform/.

Testing

  • All existing tests pass

The tests move with the code. go build ./..., go test -race ./caseflow/... ./caseparty/... and golangci-lint pass in platform/.

Related Issues

Related to OpenNSW/nsw-srilanka#1238, OpenNSW/nsw-srilanka#1248, OpenNSW/nsw-srilanka#1339

🤖 Generated with Claude Code

@lokewate lokewate added Type/Improvement Enhancement to existing functionality nsw-sl cleanup Moving generic code from nsw-srilanka into core (OpenNSW/nsw-srilanka#1248) labels Nov 30, 2026
@coderabbitai

coderabbitai Bot commented Nov 30, 2026 •

Copy link
Copy Markdown

Important

  • Trigger review

This repository does not receive automatic reviews because it has fewer than 10 stars.

Run configuration

  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: defaults
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: d864ea5c-e1f1-47fc-9788-7c7cdc9abcc4
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

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

@lokewate
lokewate added this pull request to stack #448 November 30, 2026 06:15
@lokewate
lokewate force-pushed the refactor/move-caseflow branch from 7cde8cc to 5b9ddf7 Compare November 30, 2026 06:19
lokewate added a commit to OpenNSW/nsw-srilanka that referenced this pull request Nov 30, 2026
OpenNSW/core#443 adds the caseflow and caseparty packages to
core/platform. Pinning to that PR's head lets the next commit switch
over to them; the pin moves to the merge commit once #443 merges.

The pin changes no other module version.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
lokewate added a commit to OpenNSW/nsw-srilanka that referenced this pull request Nov 30, 2026
…form

OpenNSW/core#443 moved the caseflow and caseparty packages into
core/platform unchanged. Import them from there, delete
internal/caseflow and internal/caseparty, and point the comments and
docs/agency.md at the core packages. Behaviour is unchanged.

Closes #1238

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@lokewate
lokewate force-pushed the refactor/move-caseflow branch from 5b9ddf7 to 7ef5ef2 Compare November 30, 2026 07:12
lokewate added a commit to OpenNSW/nsw-srilanka that referenced this pull request Nov 30, 2026
OpenNSW/core#443 adds the caseflow and caseparty packages to
core/platform. Pinning to that PR's head lets the next commit switch
over to them; the pin moves to the merge commit once #443 merges.

The pin changes no other module version.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
lokewate added a commit to OpenNSW/nsw-srilanka that referenced this pull request Nov 30, 2026
…form

OpenNSW/core#443 moved the caseflow and caseparty packages into
core/platform unchanged. Import them from there, delete
internal/caseflow and internal/caseparty, and point the comments and
docs/agency.md at the core packages. Behaviour is unchanged.

Closes #1238

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@lokewate
lokewate force-pushed the refactor/move-caseflow branch from 7ef5ef2 to d73d195 Compare November 30, 2026 09:42
lokewate added a commit to OpenNSW/nsw-srilanka that referenced this pull request Nov 30, 2026
OpenNSW/core#443 adds the caseflow and caseparty packages to
core/platform. Pinning to that PR's head lets the next commit switch
over to them; the pin moves to the merge commit once #443 merges.

The pin changes no other module version.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
lokewate added a commit to OpenNSW/nsw-srilanka that referenced this pull request Nov 30, 2026
…form

OpenNSW/core#443 moved the caseflow and caseparty packages into
core/platform unchanged. Import them from there, delete
internal/caseflow and internal/caseparty, and point the comments and
docs/agency.md at the core packages. Behaviour is unchanged.

Closes #1238

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@lokewate
lokewate force-pushed the refactor/move-caseflow branch from d73d195 to b2990c0 Compare December 1, 2026 06:37
@CLAassistant

Copy link
Copy Markdown

CLA assistant check
Thank you for your submission! We really appreciate it. Like many open source projects, we ask that you sign our Contributor License Agreement before we can accept your contribution.
You have signed the CLA already but the status is still pending? Let us recheck it.

@lokewate
lokewate marked this pull request as ready for review December 1, 2026 10:07
@lokewate
lokewate force-pushed the refactor/move-caseflow branch from b2990c0 to f5c3f94 Compare December 1, 2026 10:08
Comment thread platform/caseflow/client_handler.go Outdated
Comment on lines +22 to +25
// ScopeFlowStart gates POST /api/v1/internal/cases/{caseId}/flows. Starting a client flow
// creates the case if it is new, so only a system trusted to do that holds it. It is an M2M
// permission, kept apart from the officer's task:* scopes.
const ScopeFlowStart = "workflow:inject"

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Scopes should be defined in the nsw-srilanka/internal/scopes/scopes.go right?
Did we missed anything in the cleanup?

Also it's better to not mention like POST /api/v1/internal/cases/{caseId}/flows in the doc comments. Isn't Endpoint definitions should be defined at deployment repo?

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.

good catch, fell through the cracks

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 in OpenNSW/nsw-srilanka#1361, will pull here post merge to keep the core migration PRs clean

lokewate and others added 3 commits December 2, 2026 07:24
Byte-for-byte copies of nsw-srilanka's internal/caseflow and
internal/caseparty at 3f01ae915fba51ec3a2a8b97acb91d61a03a2031 (branch
refactor/1245-generic-case-wording, OpenNSW/nsw-srilanka#1339) into
platform/, tests included. No other changes. They do not build until the
import rewrite in the next commits.

Part of OpenNSW/nsw-srilanka#1248

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…uire its dependencies

Mechanical, no other changes:

  find platform/caseflow platform/caseparty -name '*.go' -print0 \
    | xargs -0 perl -pi -e 's#"github.com/OpenNSW/nsw-srilanka/internal/caseparty"#"github.com/OpenNSW/core/platform/caseparty"#'
  make license
  cd platform && GOWORK=off go mod tidy

make license and core's pre-commit hook add the SPDX headers to the copied
files. go.mod changes in this commit because the hook lints and builds the
module, which loads only once the imports resolve and go.mod is tidy. go mod
tidy adds DATA-DOG/go-sqlmock v1.5.2, the version nsw-srilanka requires, for
the tests.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

nsw-sl cleanup Moving generic code from nsw-srilanka into core (OpenNSW/nsw-srilanka#1248) Type/Improvement Enhancement to existing functionality

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants