Skip to content

Publish the Party Created and Updated integration events through the outbox, versioned and pinned by a schema contract test (roadmap 1.13) - #129

Merged
KsiProgramming merged 2 commits into
mainfrom
plan/1.13-party-published-language
Nov 9, 2026
Merged

KsiProgramming merged 2 commits into
mainfrom
plan/1.13-party-published-language

Conversation

@KsiProgramming

Copy link
Copy Markdown
Owner

Roadmap phase

Phase: 1.13 Published language
Planning package: specs/2026-11-08-party-published-language/

Closes #38

Summary

Party Reference Data Directory now tells other contexts when a party is registered or its directory entry changes. This is the first published language in RimBank. Current Account (4.1) will use it to learn that a party exists, with no callback to Party.

Published language (new project RimBank.Party.PartyReferenceDataDirectory.PublishedLanguage, BCL only)

  • PartyReferenceDataDirectoryEntryCreated (BIAN channel PartyReferenceDataDirectoryEntry/Created) and PartyReferenceDataDirectoryEntryUpdated (…/Updated).
  • Each carries the Control Record state: entry id, PartyType, DirectoryEntryDateType (OpenDate / RefreshDate) and DirectoryEntryDate.
  • Each also carries EventId, OccurredAt and the entry's stream Version, so a consumer can order events and drop duplicates.
  • No PII and no Behavior Qualifier ids. The 8 BQ channels stay deferred (ADR 0024).
  • Values are strings, not enums, so a value added later never breaks an older consumer.

Command side only (CQRS)

  • A pure mapper in core (Publication/PartyReferenceDataDirectoryPublication) builds the events from the decided domain events, never from a view.
  • RegisterParty and UpdatePartyReferenceDataDirectoryEntry return (Result<Ack>, Event?). The event is cascaded into Wolverine's Marten outbox and commits in the same transaction as the domain events.
  • A refused command, an idempotent replay or a BQ command publishes nothing.
  • No query or view changes.

Versioning and contract

  • Each event declares Channel and MessageIdentity constants: party-reference-data-directory-entry.created.v1 and …updated.v1.
  • RimBank.Postgresql.PublishedLanguageMessageNaming puts every *.PublishedLanguage type on the wire under its declared identity, without a Wolverine attribute in the contract.
  • Each event's JSON schema, with its channel and identity, is pinned by an approved file exported with JsonSchemaExporter. No new package.
  • Changes may only add fields. A breaking change is a new .v2 type.

Docs

  • ADR 0036 (new): Party published language.
  • ADR 0024 amended: integration-channel table.
  • tech-stack §3 and §8.4, and the testing table, updated.
  • CONTRIBUTING: new "Published language" and "Changing a published event" notes.
  • RimBank.Host.http: a note on where to see the envelopes.
  • Roadmap 1.13 ticked.

Definition of done

  • Working code that follows tech-stack.md (naming, dependency rules, business-only names in core)
  • Commands and queries kept separate as described in tech-stack.md §8: commands go through decisions and return acknowledgements, queries read only from read models
  • Unit tests for domain and application logic, including a projection test (Given events → Then view) for every new or changed read model, plus integration tests (Testcontainers) for any adapter touched. No read model changed.
  • Every new or changed read model can be rebuilt from the context's own event store. N/A: no read model is new or changed.
  • Contexts stay loosely coupled as described in tech-stack.md §8.4: no shared or cross-context read models, and no cross-context references except .Subscriptions → .PublishedLanguage
  • Architecture tests green
  • Every new error path returns RFC 9457 Problem Details (on both HTTP and MCP). N/A: no new error path.
  • Every new BIAN operation exposed over HTTP is also exposed as an MCP tool, with a parity test. N/A: no new operation, only AsyncAPI channels.
  • GitHub Actions CI green (build, test, format, CodeQL). GitHub Actions is not running on this repository at the moment, so the full CI sequence was run locally instead (see Validation). CodeQL was not run.
  • An ADR in docs/adr/ for any significant or BIAN-interpretation decision (ADR 0036, and ADR 0024 amended)
  • The roadmap checkbox ticked in the same PR

Validation

The CI workflow's steps, run locally on Windows with Docker Desktop:

Step Command Result
Restore dotnet restore RimBank.slnx --locked-mode OK; the Linux lock file of RimBank.Architecture.Tests was updated by hand to match the Windows one
Build dotnet build RimBank.slnx -c Release --no-restore 0 warnings, 0 errors
Test dotnet test --solution RimBank.slnx -c Release --no-build 1986 / 1986 passed, 0 failed, 0 skipped (all 14 test projects, Testcontainers included)
Scripts python -m unittest discover -s scripts 11 tests OK
Format dotnet format RimBank.slnx --verify-no-changes --no-restore exit 0

New tests:

  • PartyReferenceDataDirectoryPublicationTests (unit): Register maps to Created and Update maps to Updated; every party type has a published value.
  • Register and Update handler tests (unit): one event on success, with the right version; null on not-found, version-conflict and decision errors.
  • PublishedLanguageOutboxTests (Testcontainers):
    • exactly one Created (version 1) and one Updated (version 2);
    • the stored envelope has the v1 identity and the expected JSON payload;
    • a stale version, an unknown entry, an idempotent replay and a Demographics update publish nothing;
    • one envelope per committed Control Record event, and none in the host's wolverine schema.
  • PartyPublishedLanguageSchemaTests: the approved schema matches, Wolverine writes the same property names, the wire round trip is stable, a v1 reader tolerates an added field, and each type goes on the wire under its declared identity.
  • PublishedLanguageMessageNamingTests: types outside .PublishedLanguage keep Wolverine's name, and registering twice is harmless.
  • Catalogue: each 1.13 channel maps to its event type, and each event's Channel matches its address in the BIAN AsyncAPI.

Manual demo: not completed. The AppHost started, and the host was healthy with the party schema's envelope tables in place. But the host rejects every Keycloak token (invalid_token, "The issuer … is invalid"), whatever address the token is issued for. This is a local Aspire/Keycloak authentication problem: Keycloak serves only HTTPS here, and the AppHost points the host at its http endpoint. This PR does not touch authentication, the AppHost or the host. The end-to-end behaviour is covered by the Testcontainers outbox tests above and by the unchanged Alba HTTP tests. The auth problem needs its own fix.

Review focus

  • Wire names are camelCase (Wolverine's default serializer), while BIAN names the fields in PascalCase. ADR 0036 accepts this, and 1.14 compares names without regard to case. Should the published language use its own serializer settings instead?
  • Identity through WolverineMessageNaming.InsertFirst. It is process-wide (static), so it only answers for *.PublishedLanguage types. Is a const MessageIdentity on a BCL record the right contract hook?
  • Routing: the events go to Party's own durable local queue, and with no consumer Wolverine logs them and discards them. 4.1 must decide how Current Account receives them and how a new consumer catches up on parties registered before it existed (ADR 0036, Consequences).
  • OccurredAt duplicates DirectoryEntryDate today. It is kept as the envelope's meaning, independent of the BIAN field.

🤖 Generated with Claude Code

KsiProgramming and others added 2 commits November 8, 2026 21:17
…ion events through the outbox)

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…outbox, versioned and pinned by a schema contract test (roadmap 1.13)

- New RimBank.Party.PartyReferenceDataDirectory.PublishedLanguage (BCL only): PartyReferenceDataDirectoryEntryCreated
  and ...Updated carry the Control Record state (id, party type, date type and date) with EventId, OccurredAt and the
  stream Version; each declares its BIAN Channel and a versioned MessageIdentity (...created.v1 / ...updated.v1).
- A pure mapper in core (Publication/) maps the decided domain events; RegisterParty and Update handlers cascade the
  event as (Result<Ack>, Event?), so it commits with the events and a refused command publishes nothing.
- RimBank.Postgresql registers PublishedLanguageMessageNaming so every *.PublishedLanguage type goes on the wire under
  its declared identity, without a Wolverine attribute in the contract.
- Outbox integration tests, approved JSON schema snapshots (JsonSchemaExporter), catalogue channel-to-event mapping,
  ADR 0036, ADR 0024, tech-stack, CONTRIBUTING and roadmap updated.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@KsiProgramming KsiProgramming added stage:1 Roadmap Stage 1: Party Reference Data Directory (first vertical slice) type:feature New business or platform behaviour area:domain Aggregates, decisions, events and invariants (write side) area:persistence Marten and PostgreSQL adapters, event store area:messaging Wolverine: dispatch, outbox, subscriptions, published language area:bian-conformance Conformance with the BIAN v14 OpenAPI and AsyncAPI specs context:party Party / Party Reference Data Directory labels Nov 8, 2026
@KsiProgramming KsiProgramming self-assigned this Nov 8, 2026
@KsiProgramming
KsiProgramming merged commit 77fe350 into main Nov 9, 2026
0 of 3 checks passed
@KsiProgramming
KsiProgramming deleted the plan/1.13-party-published-language branch November 10, 2026 16:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area:bian-conformance Conformance with the BIAN v14 OpenAPI and AsyncAPI specs area:domain Aggregates, decisions, events and invariants (write side) area:messaging Wolverine: dispatch, outbox, subscriptions, published language area:persistence Marten and PostgreSQL adapters, event store context:party Party / Party Reference Data Directory stage:1 Roadmap Stage 1: Party Reference Data Directory (first vertical slice) type:feature New business or platform behaviour

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1.13 Published language

1 participant