Repository navigation
test(arch): seam-surface guard, no persistence type crosses a seam (#847) - #875
Conversation
|
Important
This repository does not receive automatic reviews because it has fewer than 10 stars. ⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Advanced Run ID: Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
|
@coderabbitai review |
|
|
Local Codex review round (CodeRabbit was rate-limited; owner rule is to substitute a local
Verification: |
|
@coderabbitai review |
|
|
Local Codex review, round 2 on e34556d (CodeRabbit's re-trigger was rate-limited). Five findings, all confirmed and fixed in 78f16d4, each with a fixture test:
Verification: |
|
Local Codex review, round 3 on 78f16d4. One finding, rated exotic by the reviewer: a method-level generic constraint was skipped when the type parameter appeared nowhere else in the signature ( Stopping the local review loop here, deliberately. Round 1 found 8 confirmed holes, round 2 found 5, round 3 found 1 exotic shape. The next round would be polishing against C# shapes this codebase does not use, which AGENTS.md's "prefer the boring guard" argues against. CodeRabbit's own round still lands when its window resets, and its findings will be handled. Verification: |
|
Codex (gpt-5.6-sol) review of record on c2ae9e7, in lieu of the CodeRabbit bot per the owner's decision: every fix claimed in the earlier rounds is present, no new defect. Ready to merge from the reviewer's side: CI green on c2ae9e7, closes #847, on the Modular monolith milestone. |
) Epic #514 slice 5, Track B. Reflection over every public interface under Cluckwork.Application.Features.* and Cluckwork.Application.Common, recursing through parameters, return types, generic arguments, arrays, byref and the public properties of any Cluckwork.* type reached. Forbidden: DbContext, DbSet<>, IQueryable, any Microsoft.EntityFrameworkCore type, the bases Entity<> and AggregateRoot<> as a declared type, any Cluckwork.Infrastructure type. A second leg pins that the Application assembly references no EF, Npgsql or Infrastructure assembly. 35 interfaces inspected today, floor 30, zero violations. Mutations recorded red, then reverted: IQueryable<Flock> on IFlockRepository; the EF package plus a DbSet<Expense> return (both legs red); the package without a lock regeneration (NU1004); a Task<Money> return stays green.
…legate holes (#847) Local Codex review round while CodeRabbit was rate-limited. Eight findings, all confirmed and fixed: constructed base interfaces are walked so an inherited generic argument counts; nested public interfaces are scanned; indexer parameters and event handler types are checked; any type implementing IQueryable is forbidden, not only the exact generic definitions; named delegates are walked through Invoke; generic parameters are walked through their constraints; property recursion happens once per generic definition so a self-expanding DTO terminates; the real-assembly gate moves to the file the decision record names. One fixture test per hole.
…on pointers (#847) Codex round 2 on the seam-surface walk. Members inherited from a base interface are checked on the constructed base so substituted arguments count; an interface's own generic constraints are walked; only property and event accessors are skipped, so static abstract operators are checked; function pointer signatures are walked. The test project allows unsafe blocks for the function-pointer fixture.
c2ae9e7 to
c44b4cb
Compare
Closes #847
Slice 5 of #514 (modular monolith), Track B. Enforcement only. No
src/file, no CI change, no package. Independent of #872 in code; it lands onmaindirectly.What this adds
tests/Cluckwork.Application.Tests/Architecture/SeamSurfaceScanner.cs— reflection over every public interface underCluckwork.Application.Features.*andCluckwork.Application.Common, recursing through parameters, return types, generic arguments, arrays, byref and the public properties of anyCluckwork.*type it reaches. Forbidden, as a first-match table:DbContextand subclasses,DbSet<>,IQueryable/IQueryable<>/IOrderedQueryable<>, anyMicrosoft.EntityFrameworkCoretype, the basesEntity<>andAggregateRoot<>as a declared type, anyCluckwork.Infrastructuretype. A second leg pins that the Application assembly references noMicrosoft.EntityFrameworkCore*,NpgsqlorCluckwork.Infrastructureassembly, which is what keeps the first leg'sDbSet/DbContextrows from being vacuous today.SeamSurfaceTests.cs— one fixture interface per rule in its own sub-namespace, one named assertion each, three green controls (concrete aggregate,PagedResult<T>,Money), and the floor test.SeamSurfaceRealAssemblyTestsis the gate: 35 interfaces inspected today, floor 30, zero violations.docs/decisions/847-seam-surface-guard.mdand one AGENTS.md paragraph under Application shape.Why now
Zero
IQueryablereturns in Application today and no EF package, so the guard starts with no exemptions. Its job is the day someone addsTask<IQueryable<Expense>> Query()because it made one call site shorter. Track B is nominally gated on #788/#789 for rebase reasons inProgram.cs; a test-only guard never touches that file.Mutation evidence (each recorded red, then reverted before commit)
IQueryable<Flock> Query();onIFlockRepository(with a throwaway stub onFlockRepositoryso the solution compiles far enough to run the test)IFlockRepository.Query exposes System.Linq.IQueryable1[[Cluckwork.Domain.Flocks.Flock…]] via IQueryable`Microsoft.EntityFrameworkCoreadded toCluckwork.Application.csproj, lock regenerated with--force-evaluate,DbSet<Expense> Set();onIFlockRepositoryCluckwork.Application references Microsoft.EntityFrameworkCoreandIFlockRepository.Set exposes Microsoft.EntityFrameworkCore.DbSet1[[…Expense…]] via DbSet`Microsoft.EntityFrameworkCoreadded to the csproj without regenerating the lockerror NU1004 … restore can't be run in locked mode(the fence in front of the guard)Task<Money> Total();on a repository interfacePassed! 2/2The issue's
DbSet/AppDbContext-in-src/mutations cannot compile as written (Application has no EF reference), which is exactly what leg 2 pins; mutation 2 is their compilable form.Verification
dotnet build Cluckwork.sln: 0 warnings.Cluckwork.Application.Tests: 304 passed (13 inSeamSurface*),Cluckwork.Domain.Tests: 491 passed.Documentationtests (19) andSchemaDocsTests(4) green on the new markdown.Mutation outputs
01-iqueryable-flock-repository.txt
02-dbset-with-ef-package.txt
03-ef-packageref-restore.txt
04-green-control-money-return.txt