Repository navigation
Experiment: slice 001 on the Clean Architecture Solution Template, counted against the twins - #15
Merged
Merged
Conversation
…into experiments/before-clean-template dotnet new ca-sln -n LayerCake.CleanTemplate -cf None -db postgresql -o experiments/before-clean-template Template as generated, plus the two edits it took to build in place on this machine: global.json floor lowered to the installed 10.0.1xx SDK band, and NU1902/NU1903 audit warnings on the template's own transitive graph added to the template's existing WarningsNotAsErrors list (TreatWarningsAsErrors is on). Not part of LayerCake.slnx; not on the scorecard.
…late, the template's way IApplicationDbContext instead of a repository, command and handler in one file, DTO with a nested AutoMapper profile and ProjectTo on reads, FluentValidation validator picked up by the template's pipeline, Guard.Against.NotFound for the 404, a new DuplicateCakeNameException mapped to 409 in the template's ProblemDetailsExceptionHandler, an IEndpointGroup with RoutePrefix /cakes, seeds in the template's initialiser. The template's int-keyed base entity goes generic the way its own comment suggests; the two Todo samples move to BaseAuditableEntity<int>. A /ping group is added for the shared ping scenario and counted separately.
…gainst the template tests/LayerCake.ContractTests.CleanTemplate is its own test project, outside LayerCake.slnx: one test process can load one MediatR and one AutoMapper, and the template's 14.1.0 / 16.1.1 unloaded the before twin's 12.5.0 / 14.0.0 when the reference was added to the shared suite (every before-twin scenario failed with a TypeLoadException before running). The twins keep their process; the template host references the existing suite for the unchanged scenario base classes and aliases the template's Web assembly because all three hosts expose a public top-level Program. Same Testcontainers PostgreSQL fixture, own database name because the template initialises with EnsureDeleted + EnsureCreated. Result as committed: 6/10 green (5/9 cakes + ping); the four error scenarios are red on content type alone (the template's exception handler writes application/json), status codes correct.
… build-log entry File inventory gains a final section outside the scorecard (9 created / 8 edited for the same three endpoints, scaffold edits, snapshot, line counts); the build log records the template version and command, the package graph, why the generated template did not build, every idiom difference from the before twin, the suite result and why four scenarios are red, the negative checks, the hop trace, the two price-rule file lists, the live run, and the calls left to Erik.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What this is
An experiment, not a slice: slice 001 (
POST /cakes,GET /cakes,GET /cakes/{id}) rebuilt on the Clean Architecture Solution Template (dotnet new ca-sln, version 10.8.0), run against the same contract scenarios as a third host, and counted. It exists to test the slide-2.5 claim that the before twin is "the way the templates generate" rather than reword it.It lives in
experiments/before-clean-template/andtests/LayerCake.ContractTests.CleanTemplate/, neither of which is inLayerCake.slnx.dotnet buildanddotnet testat the root are exactly what they were onmain; nothing undersrc/,openspec/,docs/slices/, or the shared scenario classes changed. The scorecard sections ofdocs/file-inventory.mdare untouched; the experiment has its own section at the end, anddocs/build-log.mdhas the full narrative.The number
Same three endpoints,
.csfiles created / edited:Running it
Docker running is the only prerequisite (Testcontainers PostgreSQL, same fixture as the twins). Result as committed: 6 of 10 green (ping plus five cake scenarios). The four error scenarios (two 400s, 404, 409) return the right status codes and are red on content type alone: the template's exception handler writes
application/json, neverapplication/problem+json. The two 400 bodies also carry no field names; the template builds aValidationProblemDetailsand serialises it as the base type, so theerrorsdictionary is dropped. One line in the template's handler (Results.Problem(problemDetails).ExecuteAsync) makes it 10 of 10; that was probed and reverted so the branch shows the template as shipped.The template host was also run live and driven from the repo's demo page; every route answered as the suite says.
Why the third host is a separate test project
Adding the template to
LayerCake.ContractTestsunified the test bin to MediatR 14.1.0 and AutoMapper 16.1.1, and every before-twin scenario failed with aTypeLoadExceptionbefore running. One process, one MediatR. The separate project references the existing suite for the unchanged scenario base classes and aliases the template's Web assembly because all three hosts expose a public top-levelProgram.Scaffold edits (outside the count)
global.jsonfloor lowered to the installed 10.0.1xx SDK band.NU1902;NU1903appended to the template's ownWarningsNotAsErrors: as generated on 2026-09-06 the template fails restore on NuGet audit warnings promoted to errors.Open calls
before-clean-arch) is worth about an hour.