Skip to content

docs: walk one booking through a sample that CI runs (#418) - #421

Merged
CaffeinatedCoder merged 6 commits into
mainfrom
claude/418-walkthrough-9b3ad1
Oct 25, 2026
Merged

CaffeinatedCoder merged 6 commits into
mainfrom
claude/418-walkthrough-9b3ad1

Conversation

@CaffeinatedCoder

@CaffeinatedCoder CaffeinatedCoder commented Oct 25, 2026 •

Copy link
Copy Markdown
Owner

Closes #418

Problem

Each guide covers one boundary: binding and JSON in docs/serialization.md, mapping and queries in docs/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, infinity at 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 a StringSet with @>, aggregates a room's bookings with range_agg and finds the free nights with RangeSet.Except. All answers are JSON. The migration was generated by dotnet ef migrations add (EF Core 10 tools), and the constraint SQL was added by hand. samples/Directory.Build.props stops 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.0 on net10.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 named 11.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 on main and 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 as PackageValidationBaselineVersion. 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 overrides LastMigrationId, 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, default postgres:16-alpine) and drives it with curl. It asserts every response as a whole line, every line of the two SQL statements in EF Core's log, and the rows psql reads back, including the constraint. Without Docker the consumer is skipped, and under CI=true that is a failure. The container and the app are removed on every exit path. The script now has write_nuget_config and assert_line helpers, 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:

    • the stay […,2026-07-05) binds as […,2026-07-04];
    • features come back sorted;
    • the arrival is stored in UTC with six fraction digits (.1234567 → .1234560 on read-back, while the 201 still echoes the input);
    • PostgreSQL spells the daterange half-open;
    • an open end is stored [2026-01-01,), not infinity;
    • a range or RangeSet is 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 when Bookings.csproj names 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 the CheckStay branches that the page doesn't show.

  • Claims T01–T19 in test/oracles/claims.json, all held by WalkthroughSampleTests. docs/walkthrough.md is 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, because samples/ 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.sh passed 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.x fails with one InvalidFileLink for ~/../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).
  • Seeded and reverted (verify-the-guard):
    • A doc excerpt edited alone fails EveryQuotedBlock_IsInTheSampleFileItNames. So do the sample's source edited alone (OrderBy → OrderByDescending) and an excerpt's relative indentation changed.
    • A marker removed fails EveryCSharpBlock_NamesTheSampleFileItQuotes.
    • The sample's csproj at the unreleased 11.0.0-preview.1, or on net11.0, fails TheSample_NamesTheNewestReleaseOnNuGet.
    • The sample as committed (net10.0, 10.2.0 and EF Core 10 restored from nuget.org) was run against PostgreSQL 16: every response is byte-identical to the page.
    • A JSON response on the page edited alone fails EveryOutputBlock_IsAssertedByTheSmokeTest.
    • The exclusion-constraint SQL removed from the migration fails 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.x

Nothing 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:

  • The Microsoft.AspNetCore.TestHost version in the integration csproj: 10.x.
  • On 10.x the smoke script still runs the ComplexIndexes consumer after this one.
  • The page's link to the sample names tree/main. On 10.x it should name tree/release/10.x.

🤖 Generated with Claude Code

CaffeinatedCoder and others added 3 commits October 25, 2026 12:12
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]>
@CaffeinatedCoder CaffeinatedCoder added this to the 10.3.0 milestone Oct 25, 2026
@CaffeinatedCoder CaffeinatedCoder added documentation Improvements or additions to documentation area/ranges Range unions, variants and the shape engines area/range-set RangeSet and multirange algebra area/value-sets Value set families and wrapper arities package/efcore Affects CodoMetis.ValueRanges.EFCore.PostgreSQL area/json System.Text.Json and TypeConverter wire forms package/core Affects CodoMetis.ValueRanges labels Oct 25, 2026
CaffeinatedCoder and others added 3 commits October 25, 2026 12:21
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]>
@CaffeinatedCoder
CaffeinatedCoder merged commit 7e89fa2 into main Oct 25, 2026
14 checks passed
@CaffeinatedCoder
CaffeinatedCoder deleted the claude/418-walkthrough-9b3ad1 branch October 25, 2026 11:29
CaffeinatedCoder added a commit that referenced this pull request Oct 25, 2026
docs: walkthrough and docs-site entry points (10.x ports of #421 and #425)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area/json System.Text.Json and TypeConverter wire forms area/range-set RangeSet and multirange algebra area/ranges Range unions, variants and the shape engines area/value-sets Value set families and wrapper arities documentation Improvements or additions to documentation package/core Affects CodoMetis.ValueRanges package/efcore Affects CodoMetis.ValueRanges.EFCore.PostgreSQL

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Walkthrough: one booking app from request to response, as a sample that CI builds and runs

1 participant