Skip to content

Write once, check by the rows changed, and tidy the shared layers - #48

Merged
stphnwlsh merged 2 commits into
mainfrom
feature/data-and-api-correctness
Nov 3, 2026
Merged

stphnwlsh merged 2 commits into
mainfrom
feature/data-and-api-correctness

Conversation

@stphnwlsh

@stphnwlsh stphnwlsh commented Nov 3, 2026 •

Copy link
Copy Markdown
Collaborator

Summary

Updating or deleting a review no longer checks that the review exists before it writes. The write goes first, and if no rows changed the handler throws not found. That's one trip to the database instead of two, and it closes the gap where another request could slip in between the check and the write. Update now returns the changed review from Application.

The database gets a few sensible defaults in one migration (AddCollationsAndIndexes):

  • queries don't track unless they need to
  • author names and movie titles sort without caring about case
  • the columns we sort and filter by have indexes
  • new rows get version 7 GUIDs, so inserts land at the end of the key index instead of somewhere random

While I was in there, some tidy-ups:

  • dropped the [ForeignKey] and [Required] attributes that repeated the fluent configuration
  • Page<T>.Items is now an IReadOnlyList<T>
  • the container owns MovieReviewsDatabase, so its connection gets closed
  • virtual is on every repository method
  • Version is now VersionInfo, so it stops tripping over System.Version, and its handler can be tested
  • removed usings the implicit usings already cover

The shared layers are the same as LeanMeanCleanApps/CleanMinimalApi#67, with the name swapped.

The GraphQL side picks up Hot Chocolate's mutation conventions. Each mutation takes one input and returns a payload, and validation and not found failures come back as typed errors in the payload (ValidationError with the failing fields, NotFoundError) instead of only as error codes in errors. deleteReview returns reviewId. The input types are generated now, so the hand-written Inputs folder is gone, and the schema snapshot is updated.

This one changes the schema, so any client that calls the mutations needs updating. Queries are untouched.

The data-access-ef-core, database-migrations, errors-and-exceptions, paging, unit-tests, test-design, api-conventions and expose-a-use-case skills now match the code.

Type of change

  • Breaking change (the generated solution or template parameters change in a way existing users will notice)
  • New feature
  • Refactoring or clean-up

Shared layers

  • This touches the Application or Infrastructure layers, tests, pipeline or repository setup, so it needs to be carried across all five templates.

Checklist

  • dotnet build and dotnet test pass locally with no warnings.
  • I added or updated tests, and line coverage stays at or above 95%.
  • If this changes how we do something, I updated the matching skill in .agents/skills.

Carries the shared changes from CleanMinimalApi. Mutations now take one
input and return a payload holding the result or a ValidationError or
NotFoundError. updateReview returns the updated review instead of a Boolean
and deleteReview returns the id it deleted. Queries keep the VALIDATION and
NOT_FOUND codes. Version is now VersionInfo.
@github-actions

github-actions Bot commented Nov 3, 2026 •

Copy link
Copy Markdown
Contributor

Build Pipeline

✅ Ready to merge. Every stage passed.

Stage Result Details
Build 🟢 Passed Version 2026.11.03.166-pr-48 · Template package 205 KB
Test 🟢 Passed 206 passed · 0 failed · 0 skipped · Template installs, builds and passes its tests
Coverage 🟢 Passed 100% (594 of 594 lines) · Needs 95%
Static Analysis 🟢 Passed No open CodeQL alerts
Dependency Review 🟢 Passed 0 vulnerable packages · 0 licence problems
Container Scan 🟢 Passed Image starts and answers · No open Trivy alerts

Commit 2c5e69c · Full run

@stphnwlsh
stphnwlsh merged commit ba86192 into main Nov 3, 2026
13 checks passed
@stphnwlsh
stphnwlsh deleted the feature/data-and-api-correctness branch November 3, 2026 23:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Development

Successfully merging this pull request may close these issues.

2 participants