Skip to content

Testing section, generator guide, and less rationale - #29

Merged
ipjohnson merged 1 commit into
mainfrom
docs/testing-section
Aug 9, 2026
Merged

Testing section, generator guide, and less rationale#29
ipjohnson merged 1 commit into
mainfrom
docs/testing-section

Conversation

@ipjohnson

Copy link
Copy Markdown
Owner

Three changes to the docs site.

Testing is its own section

It was one page under Everything else. It now sits between Getting started and Registering in bulk, split by what each part is for:

Page
Testing modules [ModuleTest], where module attributes go, data-driven tests, scopes, what is worth testing
Mocks and values [Mock], [InjectValues], [TestExport], and which to reach for
Testing registrations asserting on descriptors — conventions, conditional registration, decorators, interceptors, package scans

Writing your own generator

New page at the end of Everything else, documenting the extension points DependencyModules.Conventions is built on: IDependencyModuleSourceGenerator, BaseSourceGenerator, BaseAttributeSourceGenerator<T>, emitting through DependencyFileWriter, and the analyzer packaging — which is unforgiving in ways that only appear after somebody installs the package.

It also carries the three rules that cost a day each: never put a symbol in a model, give every model structural equality, and keep the predicate syntax-only.

This page keeps its reasoning. Its readers are writing a generator, so the reasoning is the content.

Less rationale everywhere else

The pages were explaining why the library was designed the way it is — why the interface name appears twice, why an assembly is always named, why there is no default lifetime, what would have happened had we chosen otherwise. That is design-doc material. A reader wants to know what to write and what will happen.

Roughly forty passages cut or rewritten to state the rule and the fix. For example:

Before — There is no "scan everything I depend on", and there should not be. Walking every reference visits thousands of types on every keystroke where one named assembly visits its own — measured at roughly 700× the cost on a minimal eleven-reference compilation. Naming it with a type rather than a string means an assembly that is not referenced cannot be asked for. The mistake is unexpressible rather than diagnosable.

After — There is no "scan everything I depend on". Point each convention at the assembly you want, using any type from it as the marker.

The "Why the interface name appears twice" section is gone entirely, replaced by one line: implement Conventions explicitly, an implicit public one does not compile.

Kept where it changes what a reader does: that both branches of a conditional registration still ship, that only public types cross an assembly boundary, and that building a provider twice gives you two sets of singletons.

Build

Builds clean with no dead links; all four new and moved pages verified serving locally.

🤖 Generated with Claude Code

https://claude.ai/code/session_01C56x6Vv6HJ6ArfqwKsuSb9

Testing was one page filed under "Everything else". It is now a section of its
own between Getting started and Registering in bulk, split into what each part
is actually for: running tests against a module, substituting and supplying
values, and asserting on the registrations themselves.

Adds "Writing your own generator" at the end of Everything else, documenting the
extension points DependencyModules.Conventions is built on —
IDependencyModuleSourceGenerator, BaseSourceGenerator,
BaseAttributeSourceGenerator, emitting through DependencyFileWriter, and the
analyzer packaging that is unforgiving in ways only visible after someone
installs the package. It keeps its reasoning, because its readers are writing a
generator and the reasoning is the content.

Everywhere else the reasoning is gone. The pages were explaining why the library
was designed the way it was — why the interface name appears twice, why an
assembly is always named, why there is no default lifetime, what would have
happened had we chosen otherwise. A reader wants to know what to write and what
will happen, not what was weighed. Roughly forty passages cut or rewritten to
say the rule and the fix.

Kept where it changes what a reader does: that both branches of a conditional
registration still ship, that only public types cross an assembly boundary, that
building a provider twice gives two sets of singletons.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01C56x6Vv6HJ6ArfqwKsuSb9
@ipjohnson
ipjohnson merged commit 67a39e6 into main Aug 9, 2026
2 checks passed
@ipjohnson
ipjohnson deleted the docs/testing-section branch August 9, 2026 18:36
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