Skip to content

Record the Reference corporate and officer references as checked directory entries, on organisations only, completing the Reference BQ (roadmap 1.21) - #127

Merged
KsiProgramming merged 3 commits into
mainfrom
plan/1.21-reference-corporate-officer-refs
Nov 8, 2026
Merged

KsiProgramming merged 3 commits into
mainfrom
plan/1.21-reference-corporate-officer-refs

Conversation

@KsiProgramming

Copy link
Copy Markdown
Owner

Roadmap phase

Phase: 1.21 Reference BQ: corporate and officer references
Planning package: specs/2026-11-08-reference-corporate-officer-refs/

No phase issue to close: the board sync has not yet created the issues for 1.18–1.21 (rows added in 1.10 and 1.20). The roadmap-board run after this merge creates them, already closed (checked with --dry-run).

Summary

This records the last four BIAN Reference fields, the references to other parties. It completes the Reference BQ: all 24 UpdateReference fields are recorded, and PartyReferenceFields.Staged is empty.

What is recorded (ADR 0034)

  • CorporateCustomerReference, CorporateCustomerLegalEntityReference and CompanyOfficerReference record their PartyReference. Each one is the id of another registered directory entry, the same guarantee as the Associations associate (ADR 0033). There is one officer, because BIAN gives a single object.
  • CompanyOfficerRole is a plain Max35Text string, for example Director. BIAN types it as a Party, which has no role property. A role is only recorded with an officer.
  • Party-type rules (chosen in planning):
    • only an organisation's entry holds the references;
    • the corporate customer and the legal entity are organisations;
    • the officer is a person.
  • Refused parts: InvolvementReference, and any part of an object-shaped CompanyOfficerRole, give party.reference-field-not-supported.

Command side (CQRS)

  • UpdatePartyReferenceHandler loads each entry the Update sets through the write port IPartyDirectory, never a view, as RegisterPartyAssociationHandler does. References the Update keeps are not loaded again.

  • The pure Decide checks the loaded facts on the resulting Reference. Four new 422 codes:

    • party.corporate-references-need-organisation;
    • party.self-reference;
    • party.referenced-party-not-registered;
    • party.referenced-party-type-mismatch.

    A role without an officer is party.reference-invalid (400).

  • The entry Update (1.8) refuses PartyType: Person while corporate references are recorded, so the organisation rule cannot be broken from that side.

Query side: RetrievePartyReference reads the same inline view. Its Reference section gains CorporateReferences, a nullable member, so events and views stored before 1.21 still load, fold and rebuild.

HTTP: there are no new routes. The Update request and the Update/Retrieve response gain the four fields, reusing the Associations InvolvedPartyModel.

Docs

  • ADR 0034 is new. ADRs 0024 (the entry Update rule, the Reference paragraph, the error codes), 0029 (staging finished) and 0032 are amended.
  • The Reference/ tree in tech-stack §3.4 is updated, and the roadmap 1.21 checkbox is ticked.
  • RimBank.Host.http has new demo requests.

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
  • Every new or changed read model can be rebuilt from the context's own event store
  • 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). MCP: N/A, the Reference tools come in 1.17.
  • Every new BIAN operation exposed over HTTP is also exposed as an MCP tool, with a parity test. N/A: no new operation (same Reference/Update and Retrieve); the MCP tools are 1.17.
  • GitHub Actions CI green (build, test, format, CodeQL)
  • An ADR in docs/adr/ for any significant or BIAN-interpretation decision (ADR 0034, with amendments to 0024, 0029 and 0032)
  • The roadmap checkbox ticked in the same PR

Validation

  • dotnet restore RimBank.slnx --locked-mode: ok
  • dotnet build RimBank.slnx -c Release: 0 warnings, 0 errors
  • dotnet test --solution RimBank.slnx -c Release --no-build: 1852 passed, 0 failed
  • dotnet format RimBank.slnx --verify-no-changes: exit 0
  • Core:
    • CorporateReferencesDecisionTests (every rule, including the entry Update guard);
    • PartyCorporateReferencesTests (the role, partial update, and pre-1.21 JSON read back);
    • the reference cases of UpdatePartyReferenceHandlerTests (including an association id sent as a reference, which is "not registered" rather than an exception, and a kept reference that is not re-checked);
    • PartyReferenceChangesTests (staged fields pinned at 0);
    • the FsCheck partial-update law extended to the four fields;
    • projection tests for the new section and for a pre-1.21 event.
  • Alba: CorporateReferencesEndpointTests:
    • a 200 for Update and Retrieve;
    • 422 not registered, with detail naming the path;
    • 422 type mismatch;
    • 400 for a malformed id;
    • 422 for the Organisation→Person entry Update.
  • Log capture: ReferenceLogPrivacyTests shows that no referenced id or role is logged.
  • Testcontainers: PartyReferenceRoundTripTests checks on the write side, stores the ids as plain strings, and rebuilds the inline view.
  • Manual: the 1.21 requests at the end of src/RimBank.Host/RimBank.Host.http are written but have not been run against a live AppHost.

Review focus

  • The first party-type rule in the Reference BQ, and the guard it adds to the entry's own Update (1.8). Is coupling the entry Update to the Reference state acceptable?
  • Accepted drift. A referenced entry that later changes its own party type is not checked again (no cross-stream index on the write side, as for Associations uniqueness).
  • The 422 business-rule errors name the BIAN path in detail, not in errors. Error carries field errors only for validation (ADR 0015). Should Error.BusinessRule take field errors instead?
  • CompanyOfficerRole is read as a string. The request binds it as raw JSON, so an object is refused part by part.
  • Open questions: none.

🤖 Generated with Claude Code

KsiProgramming and others added 3 commits November 8, 2026 19:51
…ked entry ids with party-type rules

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…ctory entries, on organisations only (roadmap 1.21)

CorporateCustomerReference, CorporateCustomerLegalEntityReference and CompanyOfficerReference are other registered
entries, loaded by the Reference Update handler through the write port; the corporate customer and legal entity are
organisations, the officer a person, and only an organisation's entry holds them. CompanyOfficerRole is a Max35Text
that needs an officer. The entry Update refuses to make such an organisation a person.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
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:read-models Views, projections and queries (read side) area:api HTTP adapters: Minimal APIs, Problem Details, OpenAPI area:persistence Marten and PostgreSQL adapters, event store area:security Authentication, authorisation, PII, threat model context:party Party / Party Reference Data Directory labels Nov 8, 2026
@KsiProgramming KsiProgramming self-assigned this Nov 8, 2026
@KsiProgramming
KsiProgramming merged commit ce54ccb into main Nov 8, 2026
0 of 3 checks passed
@KsiProgramming
KsiProgramming deleted the plan/1.21-reference-corporate-officer-refs 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:api HTTP adapters: Minimal APIs, Problem Details, OpenAPI area:domain Aggregates, decisions, events and invariants (write side) area:persistence Marten and PostgreSQL adapters, event store area:read-models Views, projections and queries (read side) area:security Authentication, authorisation, PII, threat model 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 participant