Repository navigation
docs: walk one booking through a sample that CI runs (#418) - #421
Merged
Merged
Conversation
samples/Bookings is a minimal-API booking service: a stay bound from the query string and a JSON body and validated by shape, an exclusion constraint added with explicit SQL in a migration, room features as a StringSet filtered with @>, availability as range_agg plus RangeSet.Except, and JSON answers. docs/walkthrough.md quotes it and says at each boundary what changes: canonical form, UTC and microseconds when stored, an open end stored open rather than as infinity, the literal on the wire. - consumer-smoke-test.sh runs the sample as a fifth consumer against the packed packages and its own PostgreSQL container, asserting every response, SQL line and stored row the page shows. - WalkthroughSampleConventionTests holds the page's C# blocks to the sample's source, its output blocks to the smoke test's asserts, and the sample's csproj to the shipped framework and version. - WalkthroughSampleTests hosts the linked sample in-process against the integration server and holds claims T01-T19. Co-Authored-By: Claude Opus 5.5 <[email protected]>
The sample's source is outside the site's page set, so the page links it by its GitHub URL. Co-Authored-By: Claude Opus 5.5 <[email protected]>
GitHub's dependency submission restores every project from nuget.org, and the sample named 11.0.0-preview.1, which exists only in the smoke test's feed: NU1102, red on every PR once merged, and the same for a reader who copies the folder. The project in the repository now names the newest release and its framework (10.2.0 on net10.0, PackageValidationBaselineVersion). The smoke consumer moves both to what the working tree ships before it builds, so CI still runs the sample against the packed packages. The migration is regenerated with EF Core 10's tools: an EF Core 11 snapshot overrides LastMigrationId, which EF Core 10 lacks. EF Core 11 applies the EF Core 10 migration with no pending model changes. TheSample_NamesTheNewestReleaseOnNuGet replaces the rule that pinned the sample to the unreleased version. Co-Authored-By: Claude Opus 5.5 <[email protected]>
The sample moves with the ApiCompat baseline, not with Version, and its migration is regenerated when the baseline's major changes. Co-Authored-By: Claude Opus 5.5 <[email protected]>
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.
Closes #418
Problem
Each guide covers one boundary: binding and JSON in
docs/serialization.md, mapping and queries indocs/efcore.md, the exclusion constraint in its own section. None shows them working together, and none says where a value changes on the way through: canonical form on construction, microsecond truncation when stored,infinityat the extremes, the literal on the wire. A walkthrough written as prose alone would go stale, because nothing runs its snippets.Change
samples/Bookings: a minimal-API booking service, used the way a consumer would use the package. It binds a stay from the query string and from a JSON body and validates it with a switch over the five shapes. It stores bookings under an exclusion constraint that a migration adds with explicit SQL (no ComplexIndexes). It filters rooms by aStringSetwith@>, aggregates a room's bookings withrange_aggand finds the free nights withRangeSet.Except. All answers are JSON. The migration was generated bydotnet ef migrations add(EF Core 10 tools), and the constraint SQL was added by hand.samples/Directory.Build.propsstops the repo's props, so the sample builds in place as it would in a reader's folder. The sample is not in the solution.The sample names the newest release on nuget.org,
10.2.0onnet10.0, not the version this branch ships. GitHub's Automatic Dependency Submission (submit-nuget) restores every project in the repository from nuget.org. The first push named11.0.0-preview.1, which exists only in the smoke test's local feed, and the restore failed with NU1102. Once merged, that would have been red onmainand on every PR. A reader who copies the folder has the same problem. So the project in the repository is a consumer of what is published: its version and framework are those of the newest release, which the repository already records asPackageValidationBaselineVersion. The smoke consumer moves both to what the working tree ships (Version, and this line's framework) before it builds, so CI still compiles and runs the sample against the packed packages, and checks that they resolved at that version. Nothing is excluded from the dependency graph. The migration had to be generated with EF Core 10's tools, because an EF Core 11 snapshot overridesLastMigrationId, which EF Core 10 doesn't have. EF Core 11 accepts the EF Core 10 migration with no pending model changes (the integration holder and the smoke test both run it on EF Core 11). When a release moves the baseline, the convention test asks for the sample to follow. When the major changes (at 11.0.0), the migration is regenerated with that major's tools.test/consumer-smoke-test.sh, fifth consumer: the script copies the sample out of the repository and moves its package reference and target framework to the version under test and this line's framework. It builds the sample against the feed (both modes), starts it against its own PostgreSQL container (VALUERANGES_POSTGRES_IMAGE, defaultpostgres:16-alpine) and drives it withcurl. It asserts every response as a whole line, every line of the two SQL statements in EF Core's log, and the rowspsqlreads back, including the constraint. Without Docker the consumer is skipped, and underCI=truethat is a failure. The container and the app are removed on every exit path. The script now haswrite_nuget_configandassert_linehelpers, and the walkthrough consumer runs before the ComplexIndexes consumer, which still ends the script early on the 11 line.docs/walkthrough.md(plain-docs voice): it quotes the sample and links its source. At each boundary it says what changes or that nothing does:[…,2026-07-05)binds as[…,2026-07-04];.1234567→.1234560on read-back, while the 201 still echoes the input);daterangehalf-open;[2026-01-01,), notinfinity;RangeSetis a JSON string, and a set is a JSON array.Every statement was checked against the sample's actual output, and the page's own commands were run as written.
WalkthroughSampleConventionTests: it fails when a C# block on the page is not a contiguous run of the file its<!-- sample: … -->marker names, or when a C# block has no marker. It also fails when a line of a JSON, SQL or text block on the page is not asserted by the smoke script, or whenBookings.csprojnames another package version than the newest release on nuget.org (RepoLayout.LatestRelease) or another framework than that release's (TheSample_NamesTheNewestReleaseOnNuGet).WalkthroughSampleTests(integration): it links the sample's source and hosts it in-process on the shared server, one database per test, so the page's claims have a holder the suite runs. It also covers theCheckStaybranches that the page doesn't show.Claims T01–T19 in
test/oracles/claims.json, all held byWalkthroughSampleTests.docs/walkthrough.mdis now a promise document (OracleCatalogue.PromiseDocuments,tools/oracles.cs,docs/oracles.md).Links: one row in the README's Documentation table, one row in
docs/getting-started.md's "Where to go next", and the docs site's navigation (site/toc.yml, under Guides after Getting started; merged with main after docs: publish the docs on GitHub Pages, one build per line #419). The page links the sample by its GitHub URL, becausesamples/is outside the site's page set. AGENTS.md describes the sample and the fifth consumer. The plain-docs skill lists the new page.Tests
dotnet test test/CodoMetis.ValueRanges.Conventions.Tests: 413 passed.test/CodoMetis.ValueRanges.AspNetCore.Tests: 92 passed.test/CodoMetis.ValueRanges.EFCore.PostgreSQL.IntegrationTests(local Docker, PostgreSQL 16): 305 passed../test/consumer-smoke-test.shpassed locally in both modes, against a pre-built feed and packing its own.site/build.sh . <out> "11.x (preview)": 0 warnings, and the walkthrough is in the navigation.site/build.sh <release/10.x worktree> <out> 10.xfails with oneInvalidFileLinkfor~/../docs/walkthrough.md, because 10.x has no walkthrough until the cherry-pick. So the Build (10.x) docs check is expected to fail on this PR. The Docs site: publish docs/ to GitHub Pages, one build per line, the stable line by default #417 session is adding a per-line TOC to the site config, and I've told it about this.dotnet run tools/oracles.cs status: 226 claims and 215 held before, 245 claims and 234 held after. The 11 unheld are unchanged (A02, A03, and the ComplexIndexes claims compiled out until main: re-enable the ComplexIndexes cross-tests and the joint smoke consumer against CodoMetis.EFCore.SchemaKit.PostgreSQL #333).EveryQuotedBlock_IsInTheSampleFileItNames. So do the sample's source edited alone (OrderBy→OrderByDescending) and an excerpt's relative indentation changed.EveryCSharpBlock_NamesTheSampleFileItQuotes.11.0.0-preview.1, or onnet11.0, failsTheSample_NamesTheNewestReleaseOnNuGet.EveryOutputBlock_IsAssertedByTheSmokeTest.WalkthroughSampleTests(the constraint is missing). The smoke test fails with exactly three assertions (the 409, the migration SQL, the stored constraint) and exits 1.Cherry-pick to
release/10.xNothing in the sample is 11-only. The sample (
net10.0,10.2.0, an EF Core 10 migration) is the same on both lines, so the cherry-pick needs only:Microsoft.AspNetCore.TestHostversion in the integration csproj: 10.x.tree/main. On 10.x it should nametree/release/10.x.🤖 Generated with Claude Code