Skip to content

Feature/modular bootstrapper#168

Merged
JasonMWebb merged 40 commits into
mainfrom
feature/modular-bootstrapper
May 17, 2026
Merged

Feature/modular bootstrapper#168
JasonMWebb merged 40 commits into
mainfrom
feature/modular-bootstrapper

Conversation

@JasonMWebb
Copy link
Copy Markdown
Collaborator

Added modularity to bootstrapper.

Multiple modules calling services.AddRCommon() in the same process today
produce duplicate singleton descriptors, reset internal guard flags, and
silently corrupt the datastore-name registry. The fix is a cached
IRCommonBuilder per IServiceCollection, sub-builder caching keyed by
concrete type, and explicit conflict semantics: merge for additive verbs,
throw for singleton-style verbs with different impls, eager hard-throws
plus auto-warning at finalize for soft duplicates.
Corrects verb-name mismatches (WithJsonSerialization not WithSerialization,
WithMemoryCaching/WithDistributedCaching not WithCaching), fixes AddProducer
dedup mechanism (descriptor-scan, not TryAddSingleton which would block
distinct producer types), preserves UnsupportedDataStoreException for
backward compat instead of switching to RCommonBuilderException, picks
a single finalize trigger (IHostedService at startup), specifies cache
lookup as the primary AddRCommon dedup guard, expands modified-files list
to cover all WithX verbs across the codebase (validation, CQRS, blobs,
multi-tenancy, state machines, email, security), and changes the
GetOrAddBuilder factory signature to parameterless so callers can close
over either IServiceCollection or IRCommonBuilder as the sub-builder
constructors require.
The Diagnostics section still listed dual finalize triggers
(Configure() OR hosted-service), contradicting the Finalize flow
section which had already committed to the hosted-service trigger
alone. Replace with a back-reference to the Finalize flow.
Per CLAUDE.md's project documentation structure, specs live at
docs/specs/{domain}/{domain}.md. The brainstorming design at
docs/superpowers/specs/2026-05-15-modular-bootstrapper-design.md
remains the implementation-detail reference; this spec captures the
testable contract that the plan must satisfy.
20 bite-sized TDD tasks covering: AddRCommon idempotency, GetOrAddBuilder
helper, SingletonRegistration tracker, DataStoreFactoryOptions collision
detection, AddProducer dedup, WithJsonSerialization singleton semantics,
per-provider routing migrations across 14 packages, finalize hosted
service, and multi-module integration tests for EF Core and MediatR.
Each task ends with a commit; full suite verified at the end.
- Fix Task 7 fakes: DataStoreValue requires concrete-class base, not
  interface; IDataStore has IAsyncDisposable + GetDbConnection so the
  fake must implement both.
- Fix Task 8: DataStoreValue exposes ConcreteType, not ImplementationType.
- Fix Task 10: EventSubscriptionManager path is under Producers/ and
  already uses HashSet<Type>, so list->set rework is unnecessary; only
  need to add HasProducerForBuilder lookup method.
- Fix Task 13: drop stray Configure<JsonDeserializeOptions> that wasn't
  in the original file; keep scope tight.
- Fix Tasks 9 and 19: complete IEventProducer test stubs with real
  ProduceEventAsync impls so the test files compile.
- Add comment in Task 2 explaining Configure() is a no-op return.
@JasonMWebb JasonMWebb merged commit 6d532e6 into main May 17, 2026
1 check passed
@JasonMWebb JasonMWebb deleted the feature/modular-bootstrapper branch May 17, 2026 21:58
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