Skip to content
CAI
Software that uses CAICheck a score

osoykan-archive/ProductContext-EventSourcing

39.6

Weak · 8 November 2026

11k

lines of production code

C#

primary language

7

measurements over time

CAI band scale
CAI trend line
CAI lens gauges

What this system is

This system is a .NET-based product management service that implements event sourcing and CQRS patterns to manage product data. It exposes a RESTful API for creating and updating products, content, and variants, while persisting state changes as events in EventStore. The system maintains read models in Couchbase and supports local development and Kubernetes deployment through automated infrastructure scripts.

Features

Add Docker and build infrastructure for local development

The project now includes a Dockerfile and docker-compose.yml to containerize the .NET application and its dependencies (EventStore, Couchbase) for local development and integration testing. Additionally, Cake build scripts (build.sh, build.ps1, build.cake) are added to automate build, test, and publish tasks, and the solution file is updated to include all project references and test projects.

(repo-wide) · high confidence

Added Helm charts for Couchbase, EventStore, and ProductContext deployments

New Helm chart packages have been added to the deployments directory for three services: Couchbase, EventStore, and ProductContext. Each chart includes standard Kubernetes templates for Deployments, Services, and Ingresses, along with default values and helper templates. The ProductContext chart is specifically configured with host networking, a rolling update strategy, and health check probes, while the other two charts follow a simpler default configuration.

deployments · high confidence

Added explicit state and routing infrastructure for aggregate roots and entities

The library introduces new base classes for building event-sourced aggregates: \AggregateRootEntity\ and \Entity\ (along with their generic counterparts \AggregateRootEntity\<TEntityState\>\ and \Entity\<TEntityState\>\) that provide core infrastructure for tracking state changes, routing events to handlers, and recording applied events. These classes support explicit state management and explicit routing, allowing developers to build domain models that track and replay events. The change also includes comprehensive unit tests for these new components, verifying behaviors such as null-checks, event application, and handler registration.

lib/AggregateSource · high confidence

Added product domain model with content and variant management

The product domain now supports creating products and managing their content and variants. Users can create a product, add content, and add variants with barcodes. The domain model includes aggregate roots for Product, ProductContent, ProductVariant, and VariantTypeValue, along with corresponding events and value types. Command handlers are provided for CreateProduct, AddContentToProduct, and AddVariantToProduct. The implementation also includes snapshot support for efficient state restoration.

src/ProductContext.Domain/Products · high confidence

Automated Couchbase initialization and configuration

The Docker environment for Couchbase is now fully automated. A new Dockerfile and accompanying scripts (configure.sh, by\_productId.ddoc) handle the complete setup of the Couchbase server, including memory quotas, service configuration, and the creation of the 'ProductContext' bucket with a specific 'by\_productId' view. This removes the need for manual database setup steps.

docker · high confidence

Initial WebAPI project structure with EventStore and Couchbase integration

The ProductContext.WebApi project is introduced, establishing the entry point (Program.cs) and startup configuration (Startup.cs) for the web application. The startup configuration registers dependencies for EventStore, Couchbase, and MediatR, and initializes projections using a Couchbase-based checkpoint store. Additionally, environment-specific configuration files (appsettings.Development.json, appsettings.Production.json, appsettings.Stage.json, and appsettings.json) are added to manage settings for different environments.

src/ProductContext.WebApi · high confidence

Introduce event sourcing and snapshotting infrastructure

The framework now includes core components for event sourcing and snapshotting. This adds a \ProjectionManager\ to manage event streams and projections, along with \DefaultEventDeserializer\ and \DefaultSnapshotDeserializer\ for handling event data. A \CouchbaseCheckpointStore\ is provided for persisting projection checkpoints, and an \EventStoreSnapshotter\ enables automatic snapshotting of aggregates. These changes support a new behavioral capability where the system can now track event positions, run projections, and maintain aggregate snapshots.

src/ProductContext.Framework · high confidence

Introduce product domain contracts and status enums

Added new command classes for creating products, adding content, and adding variants, all implementing MediatR's IRequest interface. Also added enums for product content status (Draft, Preparing, Approved) and variant types (Size, Color).

src/ProductContext.Domain/Contracts · high confidence

New Product Command API Endpoints

A new controller, ProductCommandsApi, has been added to handle product creation and content management. It exposes HTTP PUT endpoints for creating products, adding content, and adding variants, all routed under /api/product. The controller uses MediatR to dispatch commands, providing a consistent interface for product-related write operations.

src/ProductContext.WebApi/Controllers · high confidence

Behavioural changes

Product projections migrated to Couchbase

The product context now stores its read-model data in Couchbase instead of the previous storage mechanism. New document classes (ProductDocument, ProductContentDocument, ProductVariantDocument) have been introduced to represent the projected state, and the ProductProjection handler has been updated to persist events (ProductCreated, ContentAddedToProduct, VariantAddedToProduct) to the Couchbase bucket using the Projac framework.

src/ProductContext.Domain/Projections · high confidence

Test coverage

Added Docker-based integration test infrastructure for Couchbase and EventStore; Added domain tests for Product entity scenarios; Added unit tests for framework helpers and resolvers.

Dependencies

Updated project files and package references for the AggregateSource library

The build configuration for the AggregateSource library and its integrations (EventStore, NEventStore, Reactive, SqlStreamStore) has been updated. This includes adding new .csproj and packages.config files that define dependencies such as NUnit, EventStore.Client, NEventStore, and CompareNETObjects, ensuring the project can resolve and build against the correct library versions.

(dependencies) · high confidence

Written by cca.canine.dev from the codebase's own history, inside the signed delivery this page is composed from.

How this codebase got here

Score

  • CAI 41 → 40 (-1.0)
  • Rubric changed (rubric-2026.10.5 → rubric-2026.11.2) — scores are not directly comparable.

Lenses

  • Code Health 45 → 45 (+0.6)
  • Architecture 98 → 73 (-25.6)
  • Maturity 50 → 50 (+0.6)
  • Readiness 50 → 50 (+0.0)
  • Security 29 → 27 (-2.0)
  • Domain Modelling 75 → 75 (+0.0)
  • Performance 60 → 60 (+0.0)

Resolved (28)

  • Coverage not measured — no coverage collector is wired up
  • End-of-life runtime: .NET netcoreapp2.0 (lib/AggregateSource/src/Testing/AggregateSource.Testing.Tests/AggregateSource.Testing.Tests.csproj)
  • Inconsistent naming for the field storing expected events in test cases. Some use TheEvents (e.g., in ExceptionCentricAggregateFactoryTestRunnerTests and ExceptionCentricAggregateQueryTestRunnerTests), while others use TheExpectedEvents (e.g., in EventCentricAggregateFactoryTestRunnerTests). The concept is identical (the expected events for a test case), but the naming differs by the inclusion of the word 'Expected'.
  • Inconsistent naming of internal state fields representing the 'action' or 'step' in a test specification. _when is used in the Factory specification, while _then is used in the Query specification. In a Given-When-Then pattern, these should likely be consistent (e.g., both _when for the action, or both _then for the outcome, depending on the specific DSL design). However, Factory specs often test the 'When' (command execution) and Query specs test the 'Then' (result verification). This might be semantically correct. Let's look for a clearer violation.
  • Inconsistent property naming for the same conceptual role (holding the exception from a failed test execution). One uses 'ButException' while the other uses 'ButException'. While visually similar, the context suggests a potential typo or inconsistency in the suffix if one was intended to be 'Exception' and the other 'Error', or simply inconsistent naming between the Factory and Command test result types. However, looking closer, both are named 'ButException'. Let's look for a real inconsistency.
  • No direct assertions: Should_Add_Amount_instances_in_a_Closure_of_operations_style (lib/Value/Value.Tests/AmountTests.cs)
  • No direct assertions: Should_change_its_hashcode_everytime_the_dictionary_is_updated (lib/Value/Value.Tests/DictionaryByValueTests.cs)
  • No direct assertions: Should_change_its_hashcode_everytime_the_list_is_updated (lib/Value/Value.Tests/ListByValueTests.cs)
  • No direct assertions: Should_change_its_hashcode_everytime_the_set_is_updated (lib/Value/Value.Tests/SetByValueTests.cs)
  • No direct assertions: Should_consider_Equals_two_instances_with_same_ValueType_elements_in_same_order (lib/Value/Value.Tests/ListByValueTests.cs)
  • No direct assertions: Should_distinguish_a_value_type_instance_from_WTF_is_this_other_type (lib/Value/Value.Tests/ValueTypeTests.cs)
  • No direct assertions: Should_properly_expose_Contains (lib/Value/Value.Tests/ListByValueTests.cs)
  • No direct assertions: Should_properly_expose_Contains (lib/Value/Value.Tests/SetByValueTests.cs)
  • No direct assertions: Should_properly_expose_CopyTo (lib/Value/Value.Tests/ListByValueTests.cs)
  • No direct assertions: Should_properly_expose_CopyTo (lib/Value/Value.Tests/SetByValueTests.cs)
  • No direct assertions: Should_properly_expose_Count (lib/Value/Value.Tests/ListByValueTests.cs)
  • No direct assertions: Should_properly_expose_Count (lib/Value/Value.Tests/SetByValueTests.cs)
  • No direct assertions: Should_properly_expose_IEnumerable (lib/Value/Value.Tests/ListByValueTests.cs)
  • No direct assertions: Should_properly_expose_IndexOf (lib/Value/Value.Tests/ListByValueTests.cs)
  • No direct assertions: Should_properly_expose_IsProperSubsetOf (lib/Value/Value.Tests/SetByValueTests.cs)
  • …and 8 more

New (7)

  • End-of-life runtime: .NET netcoreapp2.0 (lib/AggregateSource/src/Core/AggregateSource.Content.ExplicitRouting/AggregateSource.Content.ExplicitRouting.csproj)
  • End-of-life runtime: .NET netcoreapp2.0 (lib/AggregateSource/src/Core/AggregateSource.ContentExplicitStateExplicitRouting/AggregateSource.Content.ExplicitStateExplicitRouting.csproj)
  • End-of-life runtime: .NET netcoreapp2.0 (lib/AggregateSource/src/Core/AggregateSource.Tests/AggregateSource.Tests.csproj)
  • End-of-life runtime: .NET netcoreapp2.0 (lib/AggregateSource/src/SqlStreamStore/AggregateSource.SqlStreamStore.Tests/AggregateSource.SqlStreamStore.Tests.csproj)
  • End-of-life runtime: .NET netcoreapp2.0 (lib/AggregateSource/src/SqlStreamStore/AggregateSource.SqlStreamStore/AggregateSource.SqlStreamStore.csproj)
  • End-of-life runtime: .NET netcoreapp2.0 (lib/AggregateSource/src/Testing/AggregateSource.Testing.NUnit/AggregateSource.Testing.NUnit.csproj)
  • End-of-life runtime: .NET netcoreapp2.0 (lib/AggregateSource/src/Testing/AggregateSource.Testing.Tests/AggregateSource.Testing.Tests.csproj)

API surface

  • Unchanged — 2 HTTP endpoints

Architecture

  • Unchanged — 2 containers · 2 contexts · 1 edges

Written by cca.canine.dev from the codebase's own history, inside the signed delivery this page is composed from.

Survey your own repository

osoykan-archive/ProductContext-EventSourcing was measured the same way every project in this corpus was: the same rubric, at a pinned commit, with the result published in full. Point a surveyor at a repository you know and see whether you agree with it.

About this page

  • The score is its most recent published measurement, taken on 8 November 2026 at a pinned commit. It is not a live figure and does not change until the project is measured again.
  • Measured at commit 95f41497bbdfa1b2af31df74a8367172de799056 — the exact code this score is about.
  • Scored under rubric-2026.11.2 — the same rubric and the same method as every other entry in this index.
  • Measured by Canine Code Analyzer (cca.canine.dev) using cca measure-2026.11.3+preprod-45ab2cab63de.