Skip to content

PEG-3447 Decouple sjp from material-client - #133

Open
allanmckenzie wants to merge 1 commit into
mainfrom
dev/sjp-decouple-material-client
Open

PEG-3447 Decouple sjp from material-client#133
allanmckenzie wants to merge 1 commit into
mainfrom
dev/sjp-decouple-material-client

Conversation

@allanmckenzie

@allanmckenzie allanmckenzie commented Aug 11, 2026

Copy link
Copy Markdown

What & why

material publishes a small hand-written Java library (material-client) that sjp compiles directly into its build, forcing material to release before sjp can complete its Java upgrade. This PR gives sjp its own copy of the adapter (Option B from the decoupling plan).

Runtime behaviour is unchangedsjp still calls material over HTTP exactly as before.

Raised by Platform Engineering for the sjp (Court Administration) team to review and merge.

Changes

  • New MaterialClient in sjp-query-api under uk.gov.moj.cpp.sjp.material.client — trimmed to the single method sjp uses (getMaterialWithHeader), injected logger. 100% unit coverage.
  • Removed the material-client JAR dependency from sjp-query-api; updated the consumer import and the resource test's never()-verify to the new type.
  • Kept the material-query-api:raml contract artifact.
  • Brought stale interface pins to latest released so the MoJ-latest-interfaces enforcer passes: material 17.0.85, referencedata 17.104.140, progression 17.0.286.

Testing

  • Full unit build green.
  • Integration suite ~250–251/254. The decoupling itself is verified working — the new MaterialClient bean resolves and invokes correctly in the deployed WAR, and all material / document-content IT paths pass.

Pre-existing IT flakiness (not caused by this change)

The small, shifting set of remaining IT failures is pre-existing harness/environment flakiness on our local stack, unrelated to this change (the affected flows don't use MaterialClient, and the /prosecutors contract is byte-identical between referencedata 17.104.137 and 17.104.140). Two clusters, for the owning team:

  1. referencedata /prosecutors 404 race (CaseUnassignmentIT, MultipleOffencesWithdrawalRequestedIT, FilterSessionByProsecutorIT). The async PartialAocpCriteriaNotificationProcessor calls getProsecutor via the framework Requester, which emits a doubled Accept header (…prosecutors+json, …prosecutors+json). The catch-all stub ReferenceDataServiceStub.stubQueryForAllProsecutors() matches with withHeader(ACCEPT, equalTo(mime)), which fails against the doubled header → async bleed-over prosecutor queries 404 → JMS rollback → stream stall. Suggested fix (verified locally to drop 404s from ~18k → 0): change that matcher to containing(mime). Not applied here, to keep this PR scoped to the material decoupling.
  2. Reflection-timing timeouts (AssignmentHelper … within 10 seconds, decision-saved not present, SearchCasesIT ES reflection). Event → viewstore/ES projection intermittently exceeds the tests' 10s/awaitility windows on our local stack (much slower than CI). Expected to pass on the team's CI.

Tracking: PEG-3447 (epic PEG-3295, Java 25 upgrade).

🤖 Generated with Claude Code

Copy material's material-client HTTP adapter into sjp as a self-contained class
so sjp no longer compiles the shared material-client JAR, removing the "material
must release first" constraint. Runtime behaviour is unchanged - sjp still calls
material over HTTP exactly as before.

- Add a trimmed, self-contained MaterialClient in sjp-query-api
  (uk.gov.moj.cpp.sjp.material.client): only the getMaterialWithHeader method sjp
  uses, injected logger. 100% unit coverage.
- Remove the material-client JAR dependency from sjp-query-api; update the
  consumer import and the resource test's never()-verify to the new type.
- Keep the material-query-api:raml contract artifact.
- Bring stale interface pins to latest released so the MoJ-latest-interfaces
  enforcer passes: material 17.0.85, referencedata 17.104.140, progression 17.0.286.

Full unit build green; sjp integration suite 251/254. The 3 remaining failures
(CaseUnassignmentIT, DefendantAcceptedAocpIT, MultipleOffencesWithdrawalRequestedIT)
are a pre-existing IT-harness issue - an async AOCP-notification flow gets a 404
from an unmatched referencedata /prosecutors stub, unrelated to this change (that
flow does not use MaterialClient; the /prosecutors contract is identical between
referencedata 17.104.137 and 17.104.140).
@allanmckenzie
allanmckenzie requested a review from a team as a code owner August 11, 2026 21:03
@allanmckenzie
allanmckenzie requested review from MrDudCowan, khajahasanshaik and madjava and removed request for a team August 11, 2026 21:03
@cpp-github-management

Copy link
Copy Markdown

Passed

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant