Skip to content

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

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 endpoints keep their 204 for update and delete, and the version endpoint returns VersionInfo, which shows up as the schema name in the OpenAPI document.

The data-access-ef-core, database-migrations, errors-and-exceptions, paging, unit-tests and test-design skills now match the code.

Type of change

  • Breaking change (the generated solution or template parameters change in a way existing users will notice)
  • 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. The version action now
returns VersionInfo.
@github-actions github-actions Bot added the enhancement New feature or request label Nov 3, 2026
@stphnwlsh stphnwlsh self-assigned this Nov 3, 2026
@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.144-pr-41 · Template package 196 KB
Test 🟢 Passed 225 passed · 0 failed · 0 skipped · Template installs, builds and passes its tests
Coverage 🟢 Passed 100% (607 of 607 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 e01b44b · Full run

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

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants