Closes #149. **Outcome:** approving a registration now writes the canonical register record to the **Objecten** API as a `RegisterRecord` object, alongside the ZGW eindstatus. OpenZaak holds the process, Objecten holds the register (ADR-0028). The write goes through the ACL (§8.1) and is idempotent on the zaak id, so a replayed approval updates the existing object rather than creating a second one. S-19 (#20) was split first (CLAUDE.md §13) — it bundled this with re-sourcing the read projection, which is now #150. ### What landed - `IRegisterRecordGateway` + `RegisterRecord` in `Acl.Application`; `ObjectenGateway` in `Acl.Infrastructure` (static Token auth, CRS headers, objecttype resolved by name to its highest **published** version). - `AclService.ApproveZaakAsync` writes the record after the eindstatus, keyed on the zaak UUID with the zaak's identificatie as reference. - Compose wiring for both stacks; `ADR-0028`; demo note; PRD §15 out-of-scope line retired. ### Three things only a live stack found Running the gateway against a real Objecten + Objecttypen pair while writing this turned up blockers CI would have hit after the fact: 1. **Objecten rejects an objecttype it has not been configured with**, by UUID — assigned at seed time by a one-shot that runs *after* Objecten's static setup_configuration. The UUID is now pinned on both sides. 2. **Objecten 500s on every write when its Notificaties config is absent** (`notifications_api_common` raises rather than skipping). Objecten → NRC has no broker, worker, kanaal or abonnement, so notifications are **disabled** rather than wired to drop every message; #150 turns them on for real. 3. **Objecttypen echoes the request Host into the objecttype `url`**, and Objecten only accepts the one matching its configured `api_root` — so the ACL must read Objecttypen at `http://objecttypen:8000`. This is why the new integration test only passes inside the compose network. All three are recorded in ADR-0028. ### Verification - `ObjectenGatewayIntegrationTests` (verify-acl, in-network): two writes for one id leave exactly one object with the second write's status. **Passing locally against live Objecten.** - The **Playwright happy path** asserts, after the behandelaar approves, that Objecten holds exactly one `RegisterRecord` for *that* reference — missing, duplicated, or non-public-safe all fail. - ACL mutation score **92.23%** (baseline 91.37%, break 90). - `make lint` / `make unit` green locally; full-stack `make verify` runs in CI. ## Definition of Done - [x] A linked Gitea issue exists (#149). - [x] Failing test written and committed first. - [x] Implementation makes the test pass. - [x] Refactor commit follows if structure improved. - [x] Conventional Commit messages referencing the issue (`refs #149`). - [x] All Gitea Actions CI jobs green (run 684). - [x] `docker compose up` from a fresh clone reaches green health checks within 3 minutes (verify-stack step 1). - [x] Docs touched — ADR-0028, demo note, PRD §15, BACKLOG. - [x] ADR added: `docs/architecture/adr-0028-objecten-holds-the-register.md`. - [x] Demo note appended to `docs/demo-script.md`. - [x] Closed by the merging PR (`closes #149`). 🤖 Generated with [Claude Code](https://claude.com/claude-code)Reviewed-on: #151
This commit was merged in pull request #151.
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
import { expect, test } from '@playwright/test';
|
||||
import { expect, request, test } from '@playwright/test';
|
||||
|
||||
// Walking-skeleton happy path (S-08d + S-09 + S-09b + S-12 + S-10a): a zorgprofessional logs in via
|
||||
// mock DigiD and submits through the self-service portal → BFF → domain; the entry appears in the
|
||||
@@ -109,4 +109,53 @@ test('DigiD submit → public INGEDIEND → documenten → behandelaar goedkeurt
|
||||
return staff.getByRole('row', { name: reference }).getByRole('cell', { name: 'INGESCHREVEN' }).count();
|
||||
}, { timeout: 30_000, intervals: [1_000, 2_000, 3_000, 5_000] })
|
||||
.toBeGreaterThan(0);
|
||||
|
||||
// S-19a: the same approval also wrote the canonical register record to Objecten (ADR-0028).
|
||||
// Asserted here rather than in verify-domain because this is the only check that drives a *real*
|
||||
// approval — verify-domain completes the Beoordelen task straight through Flowable REST, which
|
||||
// bypasses the domain `decide` path that calls the ACL.
|
||||
const records = await registerRecordsFor(reference);
|
||||
// Matched on OUR reference: the verify stack is shared and holds records from earlier checks.
|
||||
expect(records, `expected exactly one RegisterRecord for ${reference}`).toHaveLength(1);
|
||||
expect(records[0].status).toBe('INGESCHREVEN');
|
||||
// The register is world-readable, so the record must carry nothing but the public-safe fields
|
||||
// (ADR-0027) — Objecten's own schema validation enforces this, and this proves it end to end.
|
||||
expect(Object.keys(records[0]).sort()).toEqual(['id', 'reference', 'status']);
|
||||
});
|
||||
|
||||
const OBJECTEN = process.env.OBJECTEN_URL ?? 'http://objecten:8000';
|
||||
const OBJECTTYPEN = process.env.OBJECTTYPEN_URL ?? 'http://objecttypen:8000';
|
||||
const OBJECTEN_TOKEN = process.env.OBJECTEN_TOKEN ?? '1234567890abcdef1234567890abcdef12345678';
|
||||
const OBJECTTYPEN_TOKEN = process.env.OBJECTTYPEN_TOKEN ?? '0123456789abcdef0123456789abcdef01234567';
|
||||
|
||||
/**
|
||||
* The RegisterRecord objects Objecten holds for a registration reference.
|
||||
*
|
||||
* The objecttype is resolved by name rather than pinned: Objecttypen echoes the request Host into
|
||||
* the objecttype `url`, and Objecten only accepts the one matching its configured api_root — so
|
||||
* both must be reached by service name, exactly as the ACL reaches them (ADR-0028).
|
||||
*/
|
||||
async function registerRecordsFor(reference: string): Promise<Record<string, string>[]> {
|
||||
const api = await request.newContext();
|
||||
try {
|
||||
const types = await api.get(`${OBJECTTYPEN}/api/v2/objecttypes`, {
|
||||
headers: { Authorization: `Token ${OBJECTTYPEN_TOKEN}` },
|
||||
});
|
||||
expect(types.ok(), `Objecttypen returned ${types.status()}`).toBeTruthy();
|
||||
const objecttype = ((await types.json()).results as { url: string; name: string }[]).find(
|
||||
(o) => o.name === 'RegisterRecord',
|
||||
);
|
||||
if (!objecttype) throw new Error('the RegisterRecord objecttype is not registered in Objecttypen');
|
||||
|
||||
const objects = await api.get(`${OBJECTEN}/api/v2/objects`, {
|
||||
headers: { Authorization: `Token ${OBJECTEN_TOKEN}`, 'Accept-Crs': 'EPSG:4326' },
|
||||
params: { type: objecttype.url, data_attrs: `reference__exact__${reference}` },
|
||||
});
|
||||
expect(objects.ok(), `Objecten returned ${objects.status()}: ${await objects.text()}`).toBeTruthy();
|
||||
return ((await objects.json()).results as { record: { data: Record<string, string> } }[]).map(
|
||||
(o) => o.record.data,
|
||||
);
|
||||
} finally {
|
||||
await api.dispose();
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user