Skip to content

enhance: refine DDD node and edge type#7

Merged
mroops0111 merged 2 commits into
masterfrom
enhance/ddd-ontology-canonical
May 26, 2026
Merged

enhance: refine DDD node and edge type#7
mroops0111 merged 2 commits into
masterfrom
enhance/ddd-ontology-canonical

Conversation

@mroops0111
Copy link
Copy Markdown
Owner

@mroops0111 mroops0111 commented May 26, 2026

Summary

Tighten contains to textbook DDD so the BoundedContext stops being a hub-and-spoke in the Graph view. The widened edge was duplicating signal already carried by accepts / emits / constrainedBy; the canonical form (matching ReDoc and Evans / Vernon) is BoundedContext --contains--> aggregate, full stop.

  • packages/ontology-ddd/src/DDDOntology.ts: contains.toTypes narrowed from ['aggregate','command','query','event','rule'] to ['aggregate']. StructuralValidator.checkEndpoints() reads the descriptor at runtime, so the new rule activates without any validator change.
  • packages/core/skills/braid-extract/SKILL.md: new "Canonical edges to add when emitting a new node" sub-section (per-type wiring table + ClarifyTicket guidance for orphans) + completion checklist item forbidding BC → non-aggregate contains edges.
  • packages/core/skills/braid-model/SKILL.md: audit-table row for the invalid shape + clarifying sentence in Step 2.

@mroops0111 mroops0111 force-pushed the enhance/ddd-ontology-canonical branch from 2a965f2 to 45ce619 Compare May 26, 2026 05:37
@mroops0111 mroops0111 changed the title enhance: narrow DDD ontology contains to canonical BC → aggregate only enhance: refine DDD node and edge type May 26, 2026
…rming + CQRS

Each node and edge `description` tags its sub-domain (Strategic DDD,
Tactical DDD, EventStorming, CQRS) and cites the canonical source so
LLMs and reviewers know which tradition each element comes from.

Node types (7 → 8): adds `policy` for Vernon Process Manager /
EventStorming Policy reactions.

Edge types (7 → 15):
- Tactical (+1): adds `enacts` (policy → command) so the
  `event triggers policy enacts command` chain is structural rather
  than implied.
- Tactical (revised): `contains` narrowed to BC → aggregate;
  `accepts` adds query; `emits` accepts both command-source
  (CQRS / EventStorming reading; preferred when extracting from PRD
  language) and aggregate-source (Vernon IDDD structural reading);
  `triggers` widened to include policy with N:N cardinality;
  `dependsOn` narrowed to aggregate → aggregate per Vernon's
  "Reference Other Aggregates by Identity" rule.
- Strategic (+7): Context Mapping patterns from Evans Blue Book Part
  IV (partnership, customerSupplier, conformist, sharedKernel,
  anticorruptionLayer, openHostService, publishedLanguage).

Schema:
- EdgeTypeDescriptor.description added (optional in Zod, required at
  builder time by defineOntology, matching NodeTypeDescriptor).

Skills (product-agnostic, definition-only for Context Mapping):
- braid-extract: canonical-edges table includes policy and both
  emits shapes + checklist updates; new Policy emission and Context
  Mapping sections (Context Mapping is ClarifyTicket-only).
- braid-model: Step 3 bridge edges covers the triggers/policy/enacts
  chain and BC-level Context Mapping guidance; Step 1 audit table
  adds two new rules for command-without-performedBy and
  aggregate-without-events gaps (model-time soft enforcement, not
  validator-blocking).
- shared/artifact-formats.md: fixed stale 'CONTAINS' uppercase
  example to lowercase 'contains'.

Tests:
- New packages/ontology-ddd/test/integration.test.ts (27 tests):
  dddOntology integration with StructuralValidator covering policy
  flow, all 7 Context Mapping edges (positive + negative), tactical
  canonical chain including both emits readings, query-emits-event
  rejection, description completeness.
- Updated packages/sdk/test/defineOntology.test.ts fixture to
  include description on edges (now required at builder time).

Validation philosophy:
- Validators enforce graph well-formedness (type system, references,
  evidence) and hard-block Apply on errors.
- Model audit rules enforce DDD modelling completeness (every cmd
  has an actor, every agg has events) and surface as new Proposals
  or ClarifyTickets rather than blocking.
- Semantic quality stays with AI extract + HITL review.

Migration: wipe workspace artifacts + Kùzu db, re-extract.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@mroops0111 mroops0111 force-pushed the enhance/ddd-ontology-canonical branch from 45ce619 to ce7e76a Compare May 26, 2026 07:03
- Preview header gains a `+N / ~M / -K` impact summary chip so small
  incremental proposals (e.g. model audit fixes adding a handful of
  edges) are legible without scanning the canvas for thin stroke
  differences.
- Added edges in the canvas use a 3px stroke (was 2) so an
  incremental fix stands out instead of blending into the existing
  topology.
- Node cards gain a small corner dot for every change kind (emerald
  for added, amber for updated, rose for removed). Previously added
  had no marker at all, leaving the diff vocabulary asymmetric.
- Proposal preview's graph navigator stays open by default and seeds
  the type filter with all types instead of just defaultVisible, so
  the reviewer does not have to expand the panel and tick chips to
  see the impact. Graph tab behaviour unchanged.
- Proposals and Clarify list pages auto-select the first item on
  mount and on status-switch so reviewers do not need an extra click
  to start working through a queue. Cross-tab focus sweep takes
  priority on Proposals so deep-links from Clarify still land
  correctly.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@mroops0111 mroops0111 merged commit 8185925 into master May 26, 2026
5 checks passed
@mroops0111 mroops0111 deleted the enhance/ddd-ontology-canonical branch May 26, 2026 14:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant