## What & why After submitting, the self-service portal held the registration only in in-memory signals, so a **page refresh stranded an in-flight registration** — the reference and its "Documenten aanleveren" / "Trek aanvraag in" actions were lost, with no way back (the reference wasn't in the URL and there was no read endpoint). This is the gap a citizen hit in testing. Now the portal **resumes on load**: - **Domain:** `IRegistrationStore.FindOpenByBsnAsync` (the citizen's non-terminal INGEDIEND/IN_BEHANDELING registration) + `GET /registrations/current?bsn=`. - **BFF:** owner-scoped `GET /self-service/registrations` (bsn from the DigiD token) → the current registration, or **204** when none. Regenerated `services/bff/openapi.json`. - **Frontend:** `registration-page` calls it on init and restores the submitted view (reference + actions); 204 shows the submit form as before. api-client regenerated (orval). Closes #111 ## Definition of Done - [x] Linked issue (#111). - [x] TDD — store `FindOpenByBsnAsync` tests, BFF endpoint tests, an Angular component test (resume-on-load), a Playwright e2e (submit → reload → restored). - [x] Conventional Commits referencing #111. - [ ] CI green — validated locally (below); runner CI running. - [x] `docker compose up` reaches green health — fresh stack + full e2e (3 specs) green. - [x] Docs — `docs/synthetic-data.md` (new e2e users). - [ ] ADR — N/A (follows existing BFF/domain patterns; no boundary change). - [ ] Demo note — the flow is unchanged for the demo; no new demo-script section (happy to add one if wanted). ## Verified locally - Unit: Big 141 (+7 store tests), Bff 36 (+3 endpoint tests), all suites green. - Frontend: 12 self-service component tests (incl. resume-on-load); lint + build green. - **e2e (fresh CI stack): all 3 specs pass** — `registration`, `resume`, `withdrawal` (29.5s, single worker). - Mutation: domain **91.04%**, bff **100%** (break 90%). `make lint` clean. ## Notes for reviewers - **Shared-stack isolation:** resume-on-load restores any open registration for the logged-in bsn, so the self-service e2e specs can no longer share `jan-burger` (the verify-* API checks submit as `jan-burger`/`123456782` before the e2e). Each spec now has its own DigiD citizen (`emma`/`sanne`/`lars`-burger); `jan-burger` stays the documented citizen for the verify checks. This is the fix for the two intermittent e2e failures seen during development. - **Scope:** resumes the current **in-flight** registration only (terminal ones aren't resumed), per the issue's out-of-scope note. Reviewed-on: #119
132 lines
7.1 KiB
C#
132 lines
7.1 KiB
C#
using Big.Domain;
|
|
|
|
namespace Big.Application;
|
|
|
|
/// <summary>
|
|
/// The port to the workflow engine. Implemented by the Workflow Client in Infrastructure — the
|
|
/// <em>only</em> code that talks to Flowable (CLAUDE.md §8.2). The application asks it to start the
|
|
/// registratie process; it never knows Flowable exists.
|
|
/// </summary>
|
|
public interface IWorkflowClient
|
|
{
|
|
/// <summary>
|
|
/// Start one <c>registratie</c> process instance for the given registration, carrying the
|
|
/// registration id (so the <c>OpenZaakAanmaken</c> external task can be correlated back to its
|
|
/// aggregate) and the diploma origin (so the workflow's DMN can route foreign diplomas through
|
|
/// CBGV-advies, S-13). Returns the process instance id.
|
|
/// </summary>
|
|
Task<string> StartRegistrationProcessAsync(
|
|
RegistrationId registrationId, DiplomaOrigin diplomaOrigin, CancellationToken ct = default);
|
|
|
|
/// <summary>
|
|
/// Cancel a running <c>registratie</c> process on withdrawal (S-11): correlate the
|
|
/// <c>RegistratieIngetrokken</c> message to the instance, tripping the interrupting message event
|
|
/// that ends it (ADR-0014). Best-effort — if the instance is not waiting on that message (already
|
|
/// ended, or not yet parked) it is a no-op; the aggregate is INGETROKKEN regardless.
|
|
/// </summary>
|
|
Task WithdrawProcessAsync(string processInstanceId, CancellationToken ct = default);
|
|
|
|
/// <summary>
|
|
/// Signal that the required documents have arrived (S-10a): complete the <c>WachtOpDocumenten</c>
|
|
/// user task in the instance so the process leaves the 30-day wait state and continues to
|
|
/// beoordeling (ADR-0017). Best-effort — if the instance is not parked at that task (already
|
|
/// continued, or timed out) it is a no-op. The upload trigger that calls this is wired in S-10b.
|
|
/// </summary>
|
|
Task CompleteDocumentWaitAsync(string processInstanceId, CancellationToken ct = default);
|
|
}
|
|
|
|
/// <summary>
|
|
/// The port to the Anti-Corruption Layer. Implemented in Infrastructure by an HTTP client to the
|
|
/// ACL service — the <em>only</em> code that talks to ZGW (CLAUDE.md §8.1). The domain hands over a
|
|
/// bsn; the ACL default-fills the ZGW-mandatory fields (ADR-0003) and returns the created zaak URL.
|
|
/// </summary>
|
|
public interface IAclClient
|
|
{
|
|
/// <summary>Open a zaak for the registration. <paramref name="reference"/> is the registration's
|
|
/// own reference (its id); the ACL records it as the zaak's identificatie so the openbaar register
|
|
/// can show the same reference the zorgprofessional was given (S-09b follow-up, adr-proposal #78).</summary>
|
|
Task<Uri> OpenZaakAsync(string bsn, string reference, CancellationToken ct = default);
|
|
|
|
/// <summary>
|
|
/// Record the approval on the given zaak. The ACL translates this to the ZGW concept — setting
|
|
/// the zaak's final status — which OpenZaak notifies over NRC; the domain never names statustypen.
|
|
/// </summary>
|
|
Task ApproveZaakAsync(Uri zaakUrl, CancellationToken ct = default);
|
|
|
|
/// <summary>
|
|
/// Store an uploaded diploma against the zaak (S-10b). The domain hands over the zaak, the raw file
|
|
/// bytes, and the file's name/type; the ACL creates the ZGW informatieobject and relates it to the
|
|
/// zaak (§8.1). Returns the stored document's URL.
|
|
/// </summary>
|
|
Task<Uri> StoreDiplomaAsync(Uri zaakUrl, byte[] content, string fileName, string contentType, CancellationToken ct = default);
|
|
|
|
/// <summary>
|
|
/// Cancel the zaak on document-timeout expiry (S-10c): the 30-day document term lapsed, so the ACL
|
|
/// translates this to the ZGW cancellation status/resultaat. The domain never names statustypen.
|
|
/// </summary>
|
|
Task CancelZaakAsync(Uri zaakUrl, CancellationToken ct = default);
|
|
}
|
|
|
|
/// <summary>
|
|
/// The port to the behandelaar's user tasks in the workflow engine (S-12). Implemented by the
|
|
/// Workflow Client — the only code that talks to Flowable (§8.2). The application lists the open
|
|
/// <c>Beoordelen</c> tasks (the werkbak), claims one for a behandelaar, and completes it with the
|
|
/// decision; it never names Flowable's REST shapes.
|
|
/// </summary>
|
|
public interface IUserTaskClient
|
|
{
|
|
/// <summary>The werkbak: the <c>Beoordelen</c> tasks awaiting a behandelaar, each with the
|
|
/// registration it belongs to.</summary>
|
|
Task<IReadOnlyList<BeoordelingTask>> GetOpenBeoordelingenAsync(CancellationToken ct = default);
|
|
|
|
/// <summary>Claim a beoordeling task for a behandelaar (assigns it to them).</summary>
|
|
Task ClaimAsync(string taskId, string behandelaar, CancellationToken ct = default);
|
|
|
|
/// <summary>Complete a beoordeling task, carrying the decision into the process as the
|
|
/// <c>besluit</c> variable so the workflow can continue on the chosen branch.</summary>
|
|
Task CompleteBeoordelingAsync(string taskId, BeoordelingsBesluit besluit, CancellationToken ct = default);
|
|
}
|
|
|
|
/// <summary>A <c>Beoordelen</c> user task in the werkbak: the Flowable task id (needed to claim and
|
|
/// complete it) and the registration it carries as a process variable.</summary>
|
|
public sealed record BeoordelingTask(string TaskId, RegistrationId RegistrationId);
|
|
|
|
/// <summary>
|
|
/// Persistence port for the <see cref="Registration"/> aggregate. In-memory for the minimal slice
|
|
/// (ADR-0009); an EF-backed store is a documented follow-up, and this port keeps that change additive.
|
|
/// </summary>
|
|
public interface IRegistrationStore
|
|
{
|
|
/// <summary>Insert or update the registration, keyed on its id.</summary>
|
|
Task SaveAsync(Registration registration, CancellationToken ct = default);
|
|
|
|
/// <summary>Load a registration by id, or <c>null</c> if none exists.</summary>
|
|
Task<Registration?> GetAsync(RegistrationId id, CancellationToken ct = default);
|
|
|
|
/// <summary>The citizen's current <em>open</em> (non-terminal: INGEDIEND/IN_BEHANDELING)
|
|
/// registration, or <c>null</c> if they have none in flight. Lets the self-service portal resume
|
|
/// an existing registration after a refresh (S-26); terminal registrations are not resumed.</summary>
|
|
Task<Registration?> FindOpenByBsnAsync(string bsn, CancellationToken ct = default);
|
|
}
|
|
|
|
/// <summary>
|
|
/// An acquired <c>OpenZaakAanmaken</c> external-worker job: the Flowable job id (needed to complete
|
|
/// it) and the registration id it carries as a process variable.
|
|
/// </summary>
|
|
public sealed record OpenZaakJob(string JobId, RegistrationId RegistrationId);
|
|
|
|
/// <summary>
|
|
/// An acquired <c>BeoordelingEscaleren</c> escalation job (S-14): the Flowable job id and the process
|
|
/// instance whose still-open <c>Beoordelen</c> task must be reassigned from behandelaar to teamlead
|
|
/// once the 14-day boundary timer fires (ADR-0015).
|
|
/// </summary>
|
|
public sealed record EscalatieJob(string JobId, string ProcessInstanceId);
|
|
|
|
/// <summary>
|
|
/// An acquired <c>RegistratieVerlopen</c> job (S-10a): the Flowable job id and the registration id it
|
|
/// carries as a process variable. The 30-day boundary timer on <c>WachtOpDocumenten</c> spawns it when
|
|
/// the required documents were not supplied in time; expiring the correlated registration to VERLOPEN
|
|
/// cancels the case (ADR-0017).
|
|
/// </summary>
|
|
public sealed record RegistratieVerlopenJob(string JobId, RegistrationId RegistrationId);
|