ARCH-6: Adopt single aggregate-per-command mapping contract #6

Closed
opened 2026-05-06 21:14:39 -07:00 by jwilger · 1 comment
Owner

Roadmap key: ARCH-6

Depends on: ARCH-2

Acceptance criteria

  • Model and architecture define mandatory command shape, router self-registration conventions, middleware ordering, and event-model fields required for strict completeness to validate command ownership.

Source

Created from .kilo/plans/1778116681638-nimble-star.md.

Roadmap key: `ARCH-6` Depends on: [ARCH-2](https://git.johnwilger.com/jwilger/anything_app/issues/2) ## Acceptance criteria - Model and architecture define mandatory command shape, router self-registration conventions, middleware ordering, and event-model fields required for strict completeness to validate command ownership. ## Source Created from `.kilo/plans/1778116681638-nimble-star.md`.
Author
Owner

Completed issue #6 on branch issue-6-single-aggregate-command-contract.

Summary:

  • Documented the mandatory single aggregate-per-command contract in docs/ARCHITECTURE.md and event_model/schema.md, including command module shape, aggregate module/name separation, router self-registration, middleware ordering, lifespan, and idempotency requirements.
  • Added a focused contract test for the strict completeness validator.
  • Updated the validator to reject state-change slices missing command ownership metadata, invalid aggregate pattern, non-self-registering router metadata, wrong middleware order, and missing idempotency keys for external-input commands.
  • Aligned bootstrap state-change YAML slices with aggregate.module, distinct aggregate names, and stable idempotency keys where required.

Verification:

  • npm run test:event-model-contract
  • npm run check:event-model
  • mix format --check-formatted
  • MIX_ENV=test mix compile --warnings-as-errors --force
  • MIX_ENV=prod mix compile --warnings-as-errors --force
  • mix test --warnings-as-errors

Skipped unavailable gates:

  • mix dialyzer --halt-exit-status (task not installed)
  • mix credo --strict (task not installed)
  • mix sobelow (task not installed)
Completed issue #6 on branch `issue-6-single-aggregate-command-contract`. Summary: - Documented the mandatory single aggregate-per-command contract in `docs/ARCHITECTURE.md` and `event_model/schema.md`, including command module shape, aggregate module/name separation, router self-registration, middleware ordering, lifespan, and idempotency requirements. - Added a focused contract test for the strict completeness validator. - Updated the validator to reject state-change slices missing command ownership metadata, invalid aggregate pattern, non-self-registering router metadata, wrong middleware order, and missing idempotency keys for external-input commands. - Aligned bootstrap state-change YAML slices with `aggregate.module`, distinct aggregate names, and stable idempotency keys where required. Verification: - `npm run test:event-model-contract` - `npm run check:event-model` - `mix format --check-formatted` - `MIX_ENV=test mix compile --warnings-as-errors --force` - `MIX_ENV=prod mix compile --warnings-as-errors --force` - `mix test --warnings-as-errors` Skipped unavailable gates: - `mix dialyzer --halt-exit-status` (task not installed) - `mix credo --strict` (task not installed) - `mix sobelow` (task not installed)
Sign in to join this conversation.
No description provided.