## What & why The ACL was handed a **pinned zaaktype URL** (`Acl__Defaults__ZaaktypeUrl`) + informatieobjecttype URL. OpenZaak assigns those UUIDs at creation, so every stack had to seed the catalogus and then capture + inject the resulting URLs out of band (CI's `run-domain-check.sh`; the local `local-seed`→`acl.env` bootstrap from ADR-0020). Brittle, and a stale/placeholder URL failed opaquely (OpenZaak 400). Now **the ACL resolves them itself** from OpenZaak's Catalogi API by stable business key: - config `ZaaktypeIdentificatie` (`BIG-REGISTRATIE`) / `InformatieobjecttypeOmschrijving` (`Diploma`); - a `CachedZaaktypeCatalog` resolves **lazily on first use** and caches (success only, so a pre-publish miss is retried — no startup ordering coupling); - a clear "No published … found" error replaces the opaque placeholder 400. Design in **ADR-0021** (proposed in #117). Closes #113 Closes #117 ## Consequences (the payoff) No stack captures/injects a server-assigned URL any more — `docker-compose.yml`/`.local.yml`, `run-domain-check.sh` and `local-seed` all drop it; the local `acl.env` shrinks to a single line. **One thing S-27 can't remove** (confirmed empirically during this work): OpenZaak validates the `zaaktype` field on zaak-create with Django's URLValidator and **rejects a single-label host** (`http://openzaak:8000/…` → `zaaktype: bad-url`). So the ACL's **base URL** must still point at a URL-valid host (a container IP); that base-URL injection from ADR-0020 stays (local `acl.env` now carries only it; CI keeps `ACL_OPENZAAK_BASEURL`). ADR-0021 records this. ## Definition of Done - [x] Linked issues (#113 slice, #117 adr-proposal). - [x] TDD — resolver + gateway-lookup unit tests, updated `AclService` tests (50 unit tests green). - [x] Implementation makes them pass; refactor of both compose stacks + verify scripts follows. - [x] Conventional Commits referencing #113. - [ ] CI green — see below. - [x] `docker compose up` reaches green health — verified: fresh `make local` + `make verify-local` green with **no zaaktype-URL injection**; `acl.env` is base-URL-only. - [x] Docs — ADR-0021 + demo-script S-27 note. - [x] ADR added (ADR-0021). - [x] Demo note appended. ## Verification done locally - **50 unit tests** pass (resolver resolve/cache/retry-on-failure; gateway match/miss/blank-key; all `AclService` paths). - **6 ACL integration tests** pass against a live seeded OpenZaak — incl. resolving the zaaktype + Diploma iot by business key, and a clear error for an unknown identificatie. - **Fresh `make local` + `make verify-local`**: full flow (submit → werkbak → openbaar) green; `acl.env` = `Acl__OpenZaak__BaseUrl` only. - `make lint` clean; ACL mutation ratchet run locally (see checks). ## Notes for reviewers - `IZaakGateway` gains two resolve methods; `AclService` depends on the new `IZaaktypeCatalog` (singleton, so the cache persists). - Supersedes the pinned-URL mechanism; ADR-0021 documents that ADR-0020's `seed-env`/entrypoint shim are **simplified** (base-URL only), not deleted, because of the URLValidator constraint above. Reviewed-on: #118
70 lines
3.0 KiB
C#
70 lines
3.0 KiB
C#
using Acceptance.Support;
|
|
using Acl.Application;
|
|
using Reqnroll;
|
|
using Xunit;
|
|
|
|
namespace Acceptance.Steps;
|
|
|
|
/// <summary>Bindings for <c>EenZaakOpenen.feature</c>. Reqnroll creates one
|
|
/// instance per scenario, so instance fields hold scenario-scoped state.</summary>
|
|
[Binding]
|
|
public sealed class EenZaakOpenenSteps
|
|
{
|
|
private readonly InMemoryZaakGateway _gateway = new();
|
|
private DomainRegistration? _registration;
|
|
private AclDefaults? _defaults;
|
|
private DateOnly _today;
|
|
private Uri? _returnedUrl;
|
|
|
|
[Given("a domain registration for BSN \"(.*)\"")]
|
|
public void GivenADomainRegistrationForBsn(string bsn)
|
|
=> _registration = new DomainRegistration(bsn, "ACC-REF-1");
|
|
|
|
[Given("the ACL is configured with these defaults:")]
|
|
public void GivenTheAclIsConfiguredWithTheseDefaults(DataTable defaults)
|
|
{
|
|
var values = ToFieldMap(defaults);
|
|
_defaults = new AclDefaults
|
|
{
|
|
Bronorganisatie = values["bronorganisatie"],
|
|
VerantwoordelijkeOrganisatie = values["verantwoordelijkeOrganisatie"],
|
|
Vertrouwelijkheidaanduiding = values["vertrouwelijkheidaanduiding"],
|
|
ZaaktypeIdentificatie = "BIG-REGISTRATIE",
|
|
InformatieobjecttypeOmschrijving = "Diploma",
|
|
};
|
|
// The ACL resolves the zaaktype by identificatie (S-27); the scenario's zaaktype URL is what
|
|
// the catalogus resolves it to, so the created zaak still carries that URL.
|
|
_gateway.ResolvedZaaktypeUrl = new Uri(values["zaaktype"]);
|
|
}
|
|
|
|
[Given("today is \"(.*)\"")]
|
|
public void GivenTodayIs(string date)
|
|
=> _today = DateOnly.Parse(date);
|
|
|
|
[When("the domain asks the ACL to open a zaak")]
|
|
public async Task WhenTheDomainAsksTheAclToOpenAZaak()
|
|
{
|
|
var service = new AclService(_gateway, _defaults!, new CachedZaaktypeCatalog(_gateway, _defaults!), new FixedClock(_today));
|
|
_returnedUrl = await service.OpenZaakAsync(_registration!);
|
|
}
|
|
|
|
[Then("a zaak is created with these default-filled fields")]
|
|
public void ThenAZaakIsCreatedWithTheseDefaultFilledFields(DataTable expected)
|
|
{
|
|
var request = Assert.IsType<ZaakRequest>(_gateway.Captured);
|
|
var fields = ToFieldMap(expected);
|
|
Assert.Equal(fields["bronorganisatie"], request.Bronorganisatie);
|
|
Assert.Equal(fields["verantwoordelijkeOrganisatie"], request.VerantwoordelijkeOrganisatie);
|
|
Assert.Equal(fields["vertrouwelijkheidaanduiding"], request.Vertrouwelijkheidaanduiding);
|
|
Assert.Equal(fields["zaaktype"], request.Zaaktype.ToString());
|
|
Assert.Equal(fields["startdatum"], request.Startdatum.ToString("yyyy-MM-dd"));
|
|
}
|
|
|
|
[Then("the ACL returns the URL of the created zaak")]
|
|
public void ThenTheAclReturnsTheUrlOfTheCreatedZaak()
|
|
=> Assert.Equal(InMemoryZaakGateway.CreatedZaakUrl, _returnedUrl);
|
|
|
|
private static Dictionary<string, string> ToFieldMap(DataTable table)
|
|
=> table.Rows.ToDictionary(r => r["field"], r => r["value"]);
|
|
}
|