Skip to content

docs: 4 concept pages (event sourcing, hexagonal, Result, multi-tenancy)#21

Merged
Pomdapis merged 1 commit intomainfrom
pom-183-concepts-pages
Apr 26, 2026
Merged

docs: 4 concept pages (event sourcing, hexagonal, Result, multi-tenancy)#21
Pomdapis merged 1 commit intomainfrom
pom-183-concepts-pages

Conversation

@Pomdapis
Copy link
Copy Markdown
Contributor

Summary

Closes POM-183. Replaces the placeholders from POM-180 with full content for the four foundational concept pages.

Page Length Focus
event-sourcing.md ~110 lines Why ES, aggregates vs projections, versioning, snapshots
hexagonal-architecture.md ~120 lines Layering (Core ← App ← Adapters), worked example with billing port
result-pattern.md ~110 lines Result<T>, Error, anti-patterns, structured error types
multi-tenancy.md ~110 lines Multi-source resolution, validation, isolation strategies

Quality choices

  • Every page opens with the why before the how. The audience is a dev unfamiliar with DDD/ES, not a Compendium maintainer.
  • Code references are real and use GitHub permalinks pinned to ca25347 (the latest commit on main when this PR was opened) — no invented APIs.
  • Each page cross-links to its ADR for the long-form rationale, keeping the concepts pages tight.
  • Each closes with "Where to go next" to drive readers through the doc graph.

Validation

DocFX build verified locally: 0 errors. The 2 remaining warnings are pre-existing (template placeholder syntax in POM-185's ADR template).

Test plan

  • docfx build docs/docfx.json succeeds locally
  • All inline links and cross-links validated
  • Permalinks point to real source files
  • CI green
  • Pages live at /main/concepts/<page>.html after merge

…cy) (POM-183)

Replaces the placeholders introduced by POM-180 with full content for the
four foundational concepts of the framework. Each page:

- Explains the "why" before the "how"
- Includes an ASCII diagram of the layering or data flow
- Cites real Compendium source via GitHub permalinks pinned to ca25347
- Cross-links to the relevant ADR (0001 for Result, 0002/0003 for hexagonal,
  0004 for multi-tenancy, 0005 for event sourcing)
- Closes with "Where to go next" pointers

DocFX build verified locally: 0 errors, 2 cosmetic warnings (one is the
ADR template's placeholder syntax from POM-185).
Copilot AI review requested due to automatic review settings April 25, 2026 10:39
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds full documentation content for four foundational “Concepts” pages, replacing prior placeholders and linking the concepts to the relevant ADRs and source references.

Changes:

  • Documented the project’s Result<T> / Error approach and common usage/anti-patterns.
  • Documented the repository’s hexagonal (ports & adapters) layering model with a worked example.
  • Documented the multi-tenant request-boundary validation + TenantContext propagation model.
  • Documented event sourcing fundamentals (aggregates, projections, versioning/upcasting, snapshots) as used in Compendium.

Reviewed changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated 6 comments.

File Description
docs/concepts/result-pattern.md Replaces placeholder with detailed Result pattern guidance and links to core types.
docs/concepts/hexagonal-architecture.md Replaces placeholder with an explanation of Compendium’s hexagonal layering and examples.
docs/concepts/multi-tenancy.md Replaces placeholder with multi-tenant resolution/validation/isolation guidance and middleware references.
docs/concepts/event-sourcing.md Replaces placeholder with event sourcing overview tied to Compendium primitives and infrastructure.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

return Result.Success();
```

For richer composition (`Map`, `Bind`, `Tap`, etc.) see [`Result.Extensions.cs`](https://github.com/sassy-solutions/compendium/blob/ca25347/src/Core/Compendium.Core/Results/) — but use them sparingly. Loud explicit branching is usually clearer than a chain of monadic operators.

A few mistakes to avoid:

- **Wrapping arbitrary exceptions in `Result.Failure`**. If an exception is genuinely unexpected (out of disk, null reference in your code), let it bubble. Catching everything to "return a clean Result" hides bugs.
_logger.LogWarning(
"Tenant validation failed: {Error}. Path: {Path}",
validationResult.Error.Message,
SanitizeForLog(context.Request.Path));
}
```

The configurable bits (which header, which JWT claims, which paths to skip) live on [`TenantValidationMiddlewareOptions`](https://github.com/sassy-solutions/compendium/blob/ca25347/src/Adapters/Compendium.Adapters.AspNetCore/Security/TenantValidationMiddleware.cs#L226).
- [Hexagonal Architecture](hexagonal-architecture.md) — `TenantContext` is itself a port, with concrete implementations in adapters
- [Event Sourcing](event-sourcing.md) — events carry `AggregateId`; tenancy is enforced by the store, not by the event
- [ADR 0004](../adr/0004-multi-tenancy-strategy.md) — the decision and trade-offs
- [`samples/02-MultiTenant-WithPostgres`](https://github.com/sassy-solutions/compendium/tree/main/samples/02-MultiTenant-WithPostgres) — runnable two-tenant example
- [Hexagonal Architecture](hexagonal-architecture.md) — how aggregates stay decoupled from infrastructure
- [Multi-tenancy](multi-tenancy.md) — how events stay scoped to the right tenant
- [ADR 0005 — Event sourcing over state-stored](../adr/0005-event-sourcing-vs-state.md) — the decision and trade-offs
- [`samples/01-QuickStart-OrderAggregate`](https://github.com/sassy-solutions/compendium/tree/main/samples/01-QuickStart-OrderAggregate) — a runnable in-memory example
@Pomdapis Pomdapis merged commit d59d2ed into main Apr 26, 2026
9 checks passed
@Pomdapis Pomdapis deleted the pom-183-concepts-pages branch April 26, 2026 11:33
Pomdapis added a commit that referenced this pull request Apr 26, 2026
## Summary

PR #23 incorrectly bumped CHANGELOG to `[1.0.0-preview.2] - 2026-04-26`
with the quality-sweep entries — but tag `v1.0.0-preview.2` was already
cut on **2026-04-25** from a different commit set (PRs #1-7) and
**already published to nuget.org** (`Compendium.Core 1.0.0-preview.2` is
live). Reusing that version was a mistake.

This PR reconciles the CHANGELOG with the published reality and rolls
today's work into a new **preview.3**:

### `[1.0.0-preview.2] - 2026-04-25` — rewritten retroactively

Now matches the auto-generated GitHub release notes for
`v1.0.0-preview.2`:
- **Added** — `Compendium.Adapters.Shared` (PII masking utilities,
introduced in #3).
- **Changed** — Dependabot bumps #4-7, OSS governance scaffolding.
- **Security** — workflow `permissions:` block (#1), tenant log
sanitization (#2), email removal from adapter logs / GDPR (#3).

### `[1.0.0-preview.3] - 2026-04-26` — new

Everything since `v1.0.0-preview.2`:
- **Added** — DocFX site (#17), 5 ADRs (#14), public ROADMAP (#15),
getting-started guide (#20), 4 concept pages (#21), 8 adapter how-to
guides (#22).
- **Changed** — CodeQL Default Setup → `extended` query suite.
- **Security** — `softprops/action-gh-release` pinned to commit SHA
(#16, alert #28 closed).

## Test plan

- [ ] CI green on this PR.
- [ ] After merge, tag `v1.0.0-preview.3` triggers Release workflow
successfully.
- [ ] `Compendium.* @ 1.0.0-preview.3` published on nuget.org.
- [ ] GitHub Release `v1.0.0-preview.3` created with auto-generated
notes.

VK: POM-186 (Code Quality sweep parent).

Co-authored-by: sacha <sacha@scojhconsult.com>
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.

2 participants