Skip to content

Commit 191e5b3

Browse files
haklyrayclaude
andcommitted
feat: atomic solo-parent flip on Add Member apply (+ Postman tests)
Bumps dswd-4ps-dp-openspp-v2-module to apply the parent's is_solo_parent flip in the same transaction as the Add Member CR (no auto-CR), and adds Postman tests for the success path (single CR, no auto-update_individual_4ps) and the 422 conflict path (addMembers vs memberList disagreement). Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
1 parent fb9abcc commit 191e5b3

2 files changed

Lines changed: 47 additions & 2 deletions

File tree

postman/OpenSPP_4Ps_ChangesSubmission_Test.postman_collection.json

Lines changed: 46 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -145,10 +145,14 @@
145145
"exec": [
146146
"pm.test('Status is 201', () => pm.response.to.have.status(201));",
147147
"const json = pm.response.json();",
148-
"pm.test('Created 1 CR (add_member_4ps)', () => pm.expect(json.changeRequestCount).to.equal(1));",
148+
"pm.test('Exactly 1 CR is created (no separate solo-parent auto-CR)', () => pm.expect(json.changeRequestCount).to.equal(1));",
149149
"const addCR = json.changeRequests.find(cr => cr.requestType.code === 'add_member_4ps');",
150150
"pm.test('Has add_member_4ps CR', () => pm.expect(addCR).to.not.be.undefined);",
151151
"pm.test('Is newborn', () => pm.expect(addCR.detail.is_newborn_child).to.be.true);",
152+
"pm.test('Add Member CR is the only CR (apply directly updates parent)', () => {",
153+
" const updateInd = json.changeRequests.find(cr => cr.requestType.code === 'update_individual_4ps');",
154+
" pm.expect(updateInd, 'no update_individual_4ps CR should be auto-created').to.be.undefined;",
155+
"});",
152156
"console.log('Ticket:', json.ticketNumber, '| CRs:', json.changeRequestCount);"
153157
]
154158
}
@@ -173,6 +177,47 @@
173177
}
174178
}
175179
},
180+
{
181+
"name": "Add Newborn — conflicting solo parent (422)",
182+
"event": [
183+
{
184+
"listen": "test",
185+
"script": {
186+
"type": "text/javascript",
187+
"exec": [
188+
"pm.test('Status is 422', () => pm.response.to.have.status(422));",
189+
"const json = pm.response.json();",
190+
"pm.test('Error mentions conflicting isSoloParent', () => {",
191+
" const detail = (json.detail || json.message || '').toString();",
192+
" pm.expect(detail.toLowerCase()).to.include('conflict');",
193+
"});",
194+
"pm.test('Error names the disputed memberId4ps', () => {",
195+
" const detail = (json.detail || json.message || '').toString();",
196+
" pm.expect(detail).to.include('1101463');",
197+
"});"
198+
]
199+
}
200+
}
201+
],
202+
"request": {
203+
"method": "POST",
204+
"header": [],
205+
"body": {
206+
"mode": "raw",
207+
"raw": "{\n \"listahananId\": \"716649470-0-43202834\",\n \"autoSubmit\": false,\n \"description\": \"Conflict: newborn relationship says parent 1101463 is solo, memberList says they are not\",\n \"addMembers\": [\n {\n \"givenName\": \"Baby\",\n \"familyName\": \"AQUINO\",\n \"birthdate\": \"2026-03-01\",\n \"gender\": {\n \"system\": \"urn:iso:std:iso:5218\",\n \"code\": \"2\"\n },\n \"relationshipToHead\": {\n \"system\": \"urn:openspp:vocab:relationship\",\n \"code\": \"grandchild\"\n },\n \"isNewbornChild\": true,\n \"hasNoParents\": false,\n \"parentRelationships\": [\n {\n \"member\": {\n \"memberId4ps\": \"1101463\"\n },\n \"relationship\": {\n \"system\": \"urn:openspp:vocab:relationship\",\n \"code\": \"parent\"\n },\n \"isSoloParent\": true\n }\n ]\n }\n ],\n \"memberList\": [\n {\n \"memberId4ps\": \"1101463\",\n \"isSoloParent\": false\n }\n ]\n}",
208+
"options": {
209+
"raw": {
210+
"language": "json"
211+
}
212+
}
213+
},
214+
"url": {
215+
"raw": "{{api_base}}/4ps/ChangesSubmission",
216+
"host": ["{{api_base}}"],
217+
"path": ["4ps", "ChangesSubmission"]
218+
}
219+
}
220+
},
176221
{
177222
"name": "Delist Household (Reset for Reinstatement Test)",
178223
"event": [

0 commit comments

Comments
 (0)