GeezerVison is showing github.com — A counsellor can be created without a Matrix account, and the admin is told it worked · Issue #1194 · OpenResilienceInitiative/ORISO-UserService
A counsellor can be created without a Matrix account, and the admin is told it worked #1194Labels epic-last-issuesLast open work under an MVP epic, sorted back in without a release DescriptionWhat happens
CreateConsultantSaga creates the Matrix account inside a try/catch that logs and continues:
} catch (Exception e) {
log.error("Matrix user creation failed for consultant, but continuing", e);
}
...
createConsultantInMariaDBOrRollback(..., matrixUserId /* may be null */, ...);
Synapse throwing, Synapse answering without a user_id, and the plain username being unavailable all end the same way: the consultant row is written with matrixUserId = null and the admin panel gets 200 OK.
Such a record is refused by four facades:
CreateChatFacade:148
TeamDiscussionFacade:264
SessionSupervisorFacade:205
DirectSessionMatrixRoomService:58
So the counsellor exists, looks created, and cannot be used for counselling. Reported from the field as "I create a counsellor and they cannot get in" and as "the synchronisation is broken" — intermittently, because it depends on whether Synapse answered.
What this issue is not asking for
Making it fatal. That was tried in #1193 (f2cc462b) and reverted in 1bc27b1a: it turned 10 integration and E2E tests red, because the whole integration suite and the E2E suite run without a Synapse and every creation there succeeds. CreateConsultantSagaIT:228 asserts the stored matrixUserId is null. Tolerating an absent Matrix is a carried decision, and rolling back creation whenever Synapse is down trades a silent problem for an outage in counsellor onboarding.
What would actually close it
Make the incomplete state visible and repairable instead of silent:
- The creation response says the Matrix account is missing, rather than a plain 200 — so the admin panel can show it on the counsellor it just created.
- The consultant record carries the fact, so the counsellor list can mark such accounts instead of them looking identical to working ones.
- A way to complete the provisioning afterwards for an existing consultant, so the admin is not told to delete and recreate.
- The four facades above keep refusing — but with an error that names the cause, instead of behaving as if the counsellor were misconfigured.
Acceptance
- Creating a counsellor with Synapse unreachable still succeeds, and the admin can see from the UI that the account is incomplete.
- Repairing it afterwards produces a record indistinguishable from one created while Synapse was up.
- Tests cover the incomplete-then-repaired path against the real persistence, not only a mocked
MatrixSynapseService.
Note on the test suite
CreateConsultantSagaTest.stubKeycloakUserCreation leaves createUserId unstubbed, so every happy-path unit test in that class runs against a null matrixUserId and passes. Whoever picks this up should stub it for the tests that mean to exercise a fully provisioned consultant, otherwise the suite cannot tell the two states apart.
🤖 Generated with Claude Code
https://claude.ai/code/session_0188vTdHuqNtpdz4qMLv7apu Activityadded a commit that references this issue on Sep 19, 2026This issue will close once commit b6ed6e3 is merged into the 'main' branch.b6ed6e3 Storypapst commented on Sep 19, 2026 CollaboratorAuthor More actions Addressed in #1193 (b6ed6e32), against the acceptance criteria above.
- Creation response says it —
ConsultantDTO.chatIdentityStatus (PROVISIONED | MISSING), derived from matrixUserId in ConsultantResponseDTOBuilder. Creation still answers 200: the account and every other step genuinely succeeded, so the deviation from the "no 2xx on a failed step" rule is deliberate and the field carries the truth. Declared in api/useradminservice.yaml as an optional property; oasdiff breaking reports no breaking change.
- The record carries the fact — the same builder feeds
getConsultant and ConsultantSearchResultBuilder, so the counsellor list can mark such accounts.
- Discoverable —
MissingChatIdentityForConsultantViolationReportRule reports every affected consultant in the existing GET /useradmin/report, backed by ConsultantRepository#findWithoutChatIdentity (null or blank).
- Repairable —
POST /useradmin/consultants/{consultantId}/chat-identity. Idempotent: a consultant that already owns a chat identity is returned untouched and Synapse is not called at all. A failure leaves the record exactly as it was and answers 424, so the retry is safe.
- The four facades keep refusing — but now with
ConsultantChatIdentityService.missingChatIdentityMessage(...), which names the cause and the repair endpoint instead of "does not have Matrix credentials".
- Tested against the real persistence —
ConsultantChatIdentityRepairIT runs the saga with the chat server answering nothing, asserts the persisted matrixUserId is null and the response MISSING, repairs, and asserts the record and the report afterwards. Verified red twice against a mutated implementation.
Not changed: creation without a Synapse still succeeds. CreateConsultantSagaIT (8) and every E2E suite stay green with no Matrix server — 965 integration tests, 0 failures.
Your note about stubKeycloakUserCreation leaving createUserId unstubbed still stands for CreateConsultantSagaTest; the new IT is the suite that can tell the two states apart, so that fixture was left alone rather than changed under the existing 33 tests.
Generated by Claude Code Storypapst commented on Oct 15, 2026 CollaboratorAuthor More actions Field report, Caritas Staging, 2026-10-12/13 (v2.0.11): a counsellor (test account "Baruch Spinoza") who was created through the Admin panel gets 404 {"error":"Matrix user not configured"} from GET /service/matrix/me/token in the app. That is the answer MatrixMessageController gives when the counsellor row has no matrixUserId, so it is consistent with the failure described here. I did not read the row in MariaDB, so "no matrixUserId" is the reading of the code, not a measurement.
The same Staging run also showed a related, separate failure (UserService#1386): creating a counsellor with "Allow the user to create group chats" switched on returns 424 on the Keycloak role step. With that switch off, the counsellor was created with chatIdentityStatus: PROVISIONED.
Board: added to ORISO Roadmap as Medium, v2.0.12, so the carried decision in this issue (tolerating an absent Matrix) can be revisited with this field case.
Reviewer test plan
- Create a counsellor in the Admin panel on Staging → the panel tells the admin whether the chat account exists.
- Log in as that counsellor and open the app → no
404 Matrix user not configured.
- Open the counsellor row in the database →
matrixUserId is set, or the panel showed a warning when it was not.
Storypapst commented on Oct 30, 2026 CollaboratorAuthor More actions Board triage 2026-10-30 (decision by Frank): release field removed, the issue stays In progress without a release. v2.0.13 is already tagged, and only the most important items move to v2.0.15. This issue keeps its open work as described above. Assign a release again once it is close to done.
Generated by Claude Code
MetadataMetadataepic-last-issuesLast open work under an MVP epic, sorted back in without a release StatusShow more project fields
DevelopmentNo branches or pull requestsIssue actions
|