docs: milestone 8 phase 5 — architecture docs, benchmark suite redesign, UseBogus() perf fix - #53
Conversation
…ark strategy Milestone 8 Phase 5: absorb docs/architecture.md, docs/performance.md, docs/design-principles.md, and docs/manifesto.md's real content into the architecture/ hierarchy (design-principles, current/*, decision-log), tombstone all five pre-existing legacy pages (public-api.md included) so existing ADR links stay resolvable, write real roadmap/ content, and retire the "(legacy)" mkdocs.yml nav entries. Also adds ADR-0034: a full redesign of the benchmark suite's strategy, replacing the milestone-by-milestone accretion in benchmarks/Compono.Benchmarks with an audience-driven category taxonomy (Implementation Strategies, Consumer Scenarios, External Comparison, Feature Overhead, Scalability, Source Generation), a reused representative-model set, fair-comparison rules (handwritten construction as the theoretical ceiling, cached vs. uncached reflection as separate honest baselines), and explicit reporting rules - implementation of the suite itself is tracked as PLAN-0008 Phase 5 Part B, not yet done. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
…trategies, fix UseBogus() overhead Implements ADR-0034's benchmark redesign: Models/, Baselines/, and five category folders (ConsumerScenarios, ExternalComparison, FeatureOverhead, Scalability, SourceGeneration), replacing all 8 pre-redesign benchmark files. The Implementation Strategies category was implemented and then removed via an ADR-0034 Amendment - it compared different systems doing different amounts of work (bare construction vs. a full resolution pipeline), so a result from it couldn't be attributed to a cause or guide an optimization decision. Running the redesigned suite surfaced a real finding: UseBogus() cost ~865x a plain member rule, because BogusMemberNameProvider constructed a new Bogus.Faker on every resolution. Fixed via ADR-0027's Amendment: one Faker cached per thread (ThreadLocal<Faker>, trackAllValues: false), reseeded per request - safe under concurrent access because a thread-local instance is never touched by more than one thread, distinct from the shared-Faker<T> alternative ADR-0027 already considered and rejected. New coverage: a 200-way concurrency test and a convention-throws-mid-generate test. The fix cut UseBogus()'s isolated overhead from ~865x to ~6.3x and its full-profile cost from 903.4 us / 2,229 KB to 5.5 us / 7.0 KB. architecture/current/performance.md is rewritten from one full suite run (DefaultJob, all 5 categories) with a clarity pass: explicit AutoFixture-relative-to-Compono ratio direction, precise DefaultJob methodology wording, an explicit "equivalent work" definition, a note connecting the Consumer Scenario and Feature Overhead UseBogus() numbers' different scope, and consistent x formatting throughout. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
|
You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard. |
…ed doc comment The reused-Faker contract added to AddConvention's XML doc comment changed the generated API reference; the drift-detection CI gate caught it. Regenerated via .github/scripts/generate-api-reference.sh. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
There was a problem hiding this comment.
Pull request overview
Milestone 8 Phase 5 work: consolidates and retires legacy documentation into the new docs/architecture/ + docs/roadmap/ hierarchy, redesigns the benchmark suite per ADR-0034, and fixes a Compono.Bogus performance regression by caching a Bogus.Faker per thread (with new regression tests and updated docs).
Changes:
- Consolidate architecture/roadmap documentation, tombstone legacy pages to preserve existing ADR links, and update mkdocs navigation accordingly.
- Replace the legacy benchmark suite with a categorized, model-driven suite (Consumer Scenarios, External Comparison, Feature Overhead, Scalability, Source Generation) and document results in
architecture/current/performance.md. - Optimize
BogusMemberNameProviderby reusing a per-threadFakerand add concurrency/exception-safety regression coverage.
Reviewed changes
Copilot reviewed 63 out of 63 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| test/Compono.Bogus.Tests/DeterminismTests.cs | Adds concurrency regression test validating deterministic behavior with a shared provider instance. |
| test/Compono.Bogus.Tests/BogusMemberNameProviderTests.cs | Adds regression test ensuring exceptions in conventions don’t corrupt subsequent requests on the same thread. |
| src/Compono.Generators/Compono.Generators.csproj | Grants InternalsVisibleTo for benchmarks to directly construct the incremental generator. |
| src/Compono.Bogus/BogusOptions.cs | Updates XML docs to reflect per-thread Faker reuse contract for conventions. |
| src/Compono.Bogus/BogusMemberNameProvider.cs | Implements per-thread Faker caching and reseeding per request to address UseBogus() performance. |
| mkdocs.yml | Removes legacy nav entries after documentation consolidation. |
| docs/roadmap/proposed-adrs.md | Replaces placeholder with current-state content for proposed ADRs. |
| docs/roadmap/index.md | Replaces placeholder with roadmap framing and links to relevant indexes. |
| docs/roadmap/future-packages.md | Replaces placeholder with future-package candidates framing and ADR-backed rationale. |
| docs/reference/api/Compono.Bogus/Compono.BogusOptions.md | Updates generated API reference summary text for AddConvention to remove “request-local” wording. |
| docs/reference/api/Compono.Bogus/Compono.BogusOptions.AddConvention(string,System.Func_Bogus.Faker,string_).md | Updates generated API reference to document per-thread Faker reuse expectations. |
| docs/public-api.md | Tombstones legacy public-api page and points readers to new canonical docs locations. |
| docs/plans/0008-milestone-8-public-preview.md | Marks Phase 5 done and records benchmark redesign + perf fix work and verification notes. |
| docs/plans/0002-milestone-2-core-composition-engine.md | Updates legacy performance doc links to the new canonical performance page. |
| docs/performance.md | Tombstones legacy performance page and points to architecture/current/performance.md. |
| docs/packages/compono.md | Updates link target from legacy public-api page to new design principles page. |
| docs/manifesto.md | Tombstones legacy manifesto page and points to architecture/design-principles.md. |
| docs/documentation-architecture.md | Updates documentation-architecture status and notes reflecting consolidated docs and retired legacy pages. |
| docs/design-principles.md | Tombstones legacy design-principles page and points to architecture/design-principles.md. |
| docs/best-practices/performance-recommendations.md | Updates links to the new canonical performance documentation. |
| docs/architecture/index.md | Adds real Architecture landing content and links into the new hierarchy. |
| docs/architecture/design-principles.md | Populates design principles with consolidated manifesto/design-principles content. |
| docs/architecture/decision-log.md | Adds public-facing ADR index table including ADR-0034. |
| docs/architecture/current/source-generation.md | Populates source generation architecture documentation (generator responsibilities + reflection policy discussion). |
| docs/architecture/current/provider-pipeline.md | Populates provider pipeline documentation, including stage ordering and diagnostics notes. |
| docs/architecture/current/performance.md | Rewrites performance documentation to match ADR-0034 suite and publish results/methodology. |
| docs/architecture/current/generated-plans-and-discovery.md | Documents plan discovery/dispatch and records open questions around cache collisions/ALC rooting. |
| docs/architecture/current/deterministic-seeding.md | Documents deterministic seeding internals and DeriveSeed() contract. |
| docs/architecture.md | Tombstones legacy architecture page and points to the new architecture section entry points. |
| docs/adr/README.md | Adds ADR-0034 to the ADR index. |
| docs/adr/0034-benchmark-suite-strategy-and-redesign.md | Introduces ADR-0034 defining the redesigned benchmark suite structure and rules (with same-day amendment removing Implementation Strategies). |
| docs/adr/0027-compono-bogus-package-design.md | Adds amendment documenting the per-thread Faker caching fix and rationale. |
| benchmarks/Compono.Benchmarks/SourceGeneration/GeneratorDriverBenchmarks.cs | Adds in-process generator driver benchmarks (clean vs incremental) per ADR-0034. |
| benchmarks/Compono.Benchmarks/Scalability/GraphDepthScalingBenchmarks.cs | Adds shallow-vs-deep graph benchmark to catch depth-related scalability issues. |
| benchmarks/Compono.Benchmarks/Scalability/CollectionSizeScalingBenchmarks.cs | Adds collection-size scaling benchmark to catch regressions in collection dispatch. |
| benchmarks/Compono.Benchmarks/Scalability/BatchScalingBenchmarks.cs | Adds CreateMany scaling benchmark across a larger batch-size matrix. |
| benchmarks/Compono.Benchmarks/FeatureOverhead/SharingOverheadBenchmarks.cs | Adds benchmark isolating sharing mechanism overhead (CreateRow/ResolveShared). |
| benchmarks/Compono.Benchmarks/FeatureOverhead/NSubstituteOverheadBenchmarks.cs | Adds benchmark isolating UseNSubstitute() overhead vs an exact registration baseline. |
| benchmarks/Compono.Benchmarks/FeatureOverhead/ConfigurationOverheadBenchmarks.cs | Adds benchmark isolating incremental cost of member/type rules and a custom semantic provider. |
| benchmarks/Compono.Benchmarks/FeatureOverhead/BogusOverheadBenchmarks.cs | Adds benchmark isolating UseBogus() overhead vs a member-rule baseline. |
| benchmarks/Compono.Benchmarks/ExternalComparison/SimplePocoComparisonBenchmarks.cs | Adds AutoFixture comparison for the flat representative model. |
| benchmarks/Compono.Benchmarks/ExternalComparison/MediumAggregateComparisonBenchmarks.cs | Adds AutoFixture comparison for the moderately nested representative model. |
| benchmarks/Compono.Benchmarks/ConsumerScenarios/SharedValueBenchmarks.cs | Adds shared-value consumer scenario benchmark using core row APIs. |
| benchmarks/Compono.Benchmarks/ConsumerScenarios/RepresentativeModelBenchmarks.cs | Adds consumer-scenario benchmarks for the representative model set (including large collection). |
| benchmarks/Compono.Benchmarks/ConsumerScenarios/ProviderEnabledBenchmarks.cs | Adds consumer-scenario benchmarks for Bogus- and NSubstitute-enabled profiles. |
| benchmarks/Compono.Benchmarks/Compono.Benchmarks.csproj | Updates benchmark project references and adds conditional Basic.Reference.Assemblies packages for generator driver benchmarks. |
| benchmarks/Compono.Benchmarks/Models/SimplePoco.cs | Adds reused flat representative model replacing legacy Leaf. |
| benchmarks/Compono.Benchmarks/Models/SharedValueGraph.cs | Adds reused shared-value representative model set. |
| benchmarks/Compono.Benchmarks/Models/ProviderBackedModel.cs | Adds reused provider-eligible model for Bogus/NSubstitute scenarios. |
| benchmarks/Compono.Benchmarks/Models/MediumAggregate.cs | Adds reused “representative graph” model replacing legacy Customer/Address. |
| benchmarks/Compono.Benchmarks/Models/LargeCollection.cs | Adds reused model for collection-size scaling benchmarks. |
| benchmarks/Compono.Benchmarks/Models/DeepGraph.cs | Adds reused deep-graph model replacing legacy one-off deep graph benchmark types. |
| benchmarks/Compono.Benchmarks/Baselines/AutoFixtureComposer.cs | Adds AutoFixture baseline wrapper in new Baselines/ location per ADR-0034. |
| benchmarks/Compono.Benchmarks/ResolutionEcosystemBenchmarks.cs | Deletes legacy benchmark class replaced by the redesigned suite. |
| benchmarks/Compono.Benchmarks/ResolutionBenchmarkTypes.cs | Deletes legacy benchmark types replaced by Models/. |
| benchmarks/Compono.Benchmarks/ResolutionBenchmarks.cs | Deletes legacy batch scaling benchmark replaced by Scalability/BatchScalingBenchmarks. |
| benchmarks/Compono.Benchmarks/ResolutionArchitectureBenchmarks.cs | Deletes legacy architecture benchmark replaced by redesigned categories. |
| benchmarks/Compono.Benchmarks/ReflectionComposer.cs | Deletes legacy reflection baseline removed by ADR-0034 redesign/amendment. |
| benchmarks/Compono.Benchmarks/EcosystemBenchmarks.cs | Deletes legacy benchmark class replaced by ExternalComparison/*ComparisonBenchmarks. |
| benchmarks/Compono.Benchmarks/DeepGraphBenchmarks.cs | Deletes legacy deep-graph benchmark replaced by Scalability/GraphDepthScalingBenchmarks. |
| benchmarks/Compono.Benchmarks/BenchmarkTypes.cs | Deletes legacy flat representative type replaced by Models/SimplePoco. |
| benchmarks/Compono.Benchmarks/AutoFixtureComposer.cs | Deletes legacy baseline location replaced by Baselines/AutoFixtureComposer. |
| benchmarks/Compono.Benchmarks/ArchitectureBenchmarks.cs | Deletes legacy architecture benchmark class superseded by redesigned suite. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
j-d-ha
left a comment
There was a problem hiding this comment.
🛑 Adversarial review found blocking isolation, benchmark-validity, and documentation-link defects. Inline comments cover fixes; targeted Bogus tests pass, but current PR must resolve blockers before merge.
|
🐛 Legacy-page retirement is incomplete: living docs still link visitors to tombstones ( |
…, doc links Real defects found by adversarial review, all fixed: - BogusMemberNameProvider's thread-local Faker reuse was incomplete: a custom AddConvention delegate could mutate Faker state (DateTimeReference, a sub-generator, any of ~20 other public settable properties) that would leak into a later, unrelated built-in-convention request on the same thread - reseeding Random alone didn't restore isolation. Fixed by reusing the per-thread Faker only for built-in/alias conventions (BogusConventions.IsBuiltIn, reference-equality against the ten built-in delegates); a custom delegate now gets its own single-use Faker, matching its pre-optimization behavior. New regression test mutates DateTimeReference in a custom convention and proves it doesn't perturb a later built-in request. - The concurrency test used Parallel.ForEachAsync over a fully-synchronous body, which could pass serially by scheduler luck rather than proving genuine thread overlap. Replaced with real Thread + Barrier so all workers release simultaneously. - GeneratorDriverBenchmarks' "incremental" tree was built via a fresh ParseText call, not derived from the base tree via WithChangedText, so it measured a wholesale reparse under an incremental label. Fixed to derive it via an append-only WithChangedText edit, so unaffected nodes keep their base-tree identity. - GraphDepthScalingBenchmarks compared MediumAggregate (seven strings + a collection) against DeepGraph (one string), conflating depth with total value-generation work. Fixed to compare DeepLevel8 (depth 1, one string) against DeepGraph (depth 8, same leaf shape) - the isolated result is 4.47x the mean and 2.65x the allocation for 8x the depth. - architecture/current/performance.md violated ADR-0034's own Reporting Rules by omitting Error/StdDev/Gen0/Gen1 from most tables. Rewritten with the full mandatory column set on every table, from one fresh full suite run. - Fixed a broken double-hyphen MkDocs anchor (3 occurrences), a link to a heading removed from the rewritten performance page, and nine living docs still linking to tombstoned legacy pages instead of their canonical replacements (including docs/index.md's stale "~6.1x faster" claim tied to a deleted benchmark class). Reworded future-packages.md's claim that Compono.Generators is a fifth installable package - it's an embedded analyzer, not independently installable. One reviewer claim (returning GeneratorDriver from a benchmark method breaks standard net10 dry runs via missing Compono.Generators restore assets) was investigated directly from a fully clean bin/obj state, across both --job Dry and DefaultJob - did not reproduce, left as-is. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
|
Re: #53 (comment) — Fixed in 0d69cc1. Swept every real link (not just the 3 files you named) to the five tombstoned pages and repointed each to its canonical replacement:
Verified with a comprehensive grep across all of |
|
Re: #53 (review) — All 11 inline findings from this review addressed in 0d69cc1, replied to individually on each thread. Summary: Fixed:
Investigated, did not reproduce: the All 63 |
Summary
Milestone 8 Phase 5, in full:
docs/architecture.md,docs/performance.md,docs/design-principles.md,docs/manifesto.mdinto thearchitecture/hierarchy, tombstones all five pre-existing legacy pages (includingdocs/public-api.md) so existing ADR links stay resolvable, and writes realroadmap/content.benchmarks/Compono.Benchmarks— audience-driven categories, a reused representative-model set, fair-comparison rules, and reporting rules. The suite was fully implemented against it (six categories → later five, see below), run for real, andarchitecture/current/performance.mdrewritten from the results.UseBogus()costing ~865x a plain member rule. Root-caused toBogusMemberNameProviderconstructing a newBogus.Fakerper resolution, and fixed via ADR-0027's Amendment (oneFakercached per thread, reseeded per request) — cut to ~6.3x isolated, and the full-profile cost from 903.4 μs / 2,229 KB to 5.5 μs / 7.0 KB.Changes
Documentation
docs/architecture/index.md,design-principles.md,current/{source-generation,generated-plans-and-discovery,provider-pipeline,deterministic-seeding,performance}.md,decision-log.md— real contentdocs/roadmap/{index,proposed-adrs,future-packages}.md— real contentdocs/{architecture,manifesto,design-principles,performance,public-api}.md— tombstoned (not deleted; 24+ Accepted ADRs link to them by path)docs/adr/0034-benchmark-suite-strategy-and-redesign.md— new, with a same-day Amendment removing Implementation Strategiesdocs/adr/0027-compono-bogus-package-design.md— new Amendment documenting theFakercaching fix and why it differs from the shared-Faker<T>alternative that ADR already rejectedmkdocs.yml— five "(legacy)" nav entries removedBenchmark suite (
benchmarks/Compono.Benchmarks/)Models/,Baselines/,ConsumerScenarios/,ExternalComparison/,FeatureOverhead/,Scalability/,SourceGeneration/— replaces all 8 pre-redesign filesCompono.Benchmarks.csproj— addsCompono.NSubstitute/Compono.Bogusreferences, a real (non-analyzer-only)Compono.Generatorsreference, conditionalBasic.Reference.AssembliesBug fix (
src/Compono.Bogus/)BogusMemberNameProvidercaches oneFakerper thread (ThreadLocal<Faker>,trackAllValues: false) instead of constructing one per requestBogusOptions.AddConvention's XML doc updated for the new reused-FakercontractValidation
dotnet build Compono.slnx -c Release— 0 warnings, 0 errorsdotnet test—Compono.Bogus.Tests(62/62),Compono.Generators.Tests(84/84), run 5x for the new concurrency test's stabilityuv run mkdocs build --clean --strict— clean, no warnings--filter '*',DefaultJob, ~15 min) — every category produced real results;architecture/current/performance.md's tables all come from one such run🤖 Generated with Claude Code