diff --git a/.editorconfig b/.editorconfig index c7ed559fe..3b14a7188 100644 --- a/.editorconfig +++ b/.editorconfig @@ -2,8 +2,13 @@ # no dependency and no CI job. Its job is to stop whitespace-only diffs from # burying real changes in review. # -# It is a convenience, NOT a gate — nothing enforces it. Do not cite it as the -# reason a formatter is unnecessary. +# TWO C# rules below are gated at build time, both under [*.{cs,csx}]: +# file-scoped namespaces and using-directive placement. EnforceCodeStyleInBuild +# in Directory.Build.props runs the IDE analyzers during the build, and +# TreatWarningsAsErrors is already true there, so a `:warning` severity here is +# a BUILD ERROR. That applies to any rule written at `:warning` in this file, +# not only these two. Everything else here is a convenience — do not cite an +# unenforced entry as the reason a formatter is unnecessary. root = true [*] @@ -22,6 +27,34 @@ trim_trailing_whitespace = false # .NET [*.{cs,csx}] indent_size = 4 +# Gated. Outside is the C# default, so a file from any template complies. Note +# that BOTH placements can shadow: a `using X;` inside a namespace resolves +# relative to that namespace and can bind to a sibling X, while one outside can +# be shadowed by a sibling namespace segment of the same simple name. The +# second is what renaming the FlockScope test namespace fixed. Fix a violation +# with `dotnet format style --diagnostics IDE0065 IDE0161 +# --severity warn --include `. +csharp_using_directive_placement = outside_namespace:warning +csharp_style_namespace_declarations = file_scoped:warning + +# #514: SeamSurfaceTests.cs and TableOwnerTests.cs each declare several +# namespaces in one file, one per fixture scenario. Their inside-namespace +# usings are load-bearing: 25 of them are RELATIVE aliases that resolve against +# the enclosing namespace (`using Fixtures = TableOwnerFixtures;`), so hoisting +# them would require fully qualifying every one. Only the placement rule is +# relaxed. IDE0161 needs no exemption here — it never reports on a compilation +# unit declaring more than one namespace. +[tests/Cluckwork.Application.Tests/Architecture/{SeamSurfaceTests,TableOwnerTests}.cs] +csharp_using_directive_placement = inside_namespace:silent + +# `dotnet ef migrations add` scaffolds a BLOCK-scoped namespace, so every future +# migration would fail IDE0161 without this, and the 19 existing ones do too. +# That, not #407's freeze, is why the exemption is here: it has to keep working +# for migrations nobody has written yet. Generated Designer and snapshot files +# carry and the analyzers skip them regardless. Migrations +# already place usings outside, so the placement rule needs no exemption. +[src/Cluckwork.Infrastructure/Persistence/Migrations/**] +csharp_style_namespace_declarations = block_scoped:silent [*.{csproj,props,targets,sln}] indent_size = 2 diff --git a/AGENTS.md b/AGENTS.md index a0f124e01..5ecd6c683 100644 --- a/AGENTS.md +++ b/AGENTS.md @@ -71,6 +71,7 @@ dotnet test Cluckwork.sln # 2887 tests as of 2026-09-21; integr - **Validation:** FluentValidation validators (`*Validator`), one per command; endpoints call `ValidateAsync` and return `ValidationProblem`. - **Endpoints:** minimal APIs grouped under `/api/v1/...` via `MapEndpoints`; writes require auth + an `Idempotency-Key` (middleware). - **Nullable enabled**, no unused usings — both are build-breaking. +- **`.editorconfig` at `:warning` is a build error, and two C# style rules are gated that way (#985).** `EnforceCodeStyleInBuild` in `Directory.Build.props` runs the IDE analyzers during the build, and `TreatWarningsAsErrors` is already true there, so **any** rule written at `:warning` in `.editorconfig` fails the build repo-wide the moment it is committed — adding one is a decision, not a preference. Two are gated today: `csharp_using_directive_placement = outside_namespace` (IDE0065) and `csharp_style_namespace_declarations = file_scoped` (IDE0161). Fix a violation with `dotnet format style --diagnostics IDE0065 IDE0161 --severity warn --include `; do not hand-move headers. Measured, so you can rely on it rather than re-deriving it: those two are the ONLY rules this property activates at warning severity, because 116 of the SDK's 121 code-style diagnostics default to `Hidden`, four to `Info`, and the repo carries no `.globalconfig`, ruleset, `AnalysisLevel`, `AnalysisMode` or `dotnet_diagnostic.*` entry. Two exemptions, each for a reason that is not "this file is awkward": `SeamSurfaceTests.cs` and `TableOwnerTests.cs` keep inside-namespace usings because 25 of them are relative aliases resolving against the enclosing namespace, and the EF migrations tree keeps block-scoped namespaces because `dotnet ef migrations add` scaffolds them, so the exemption has to keep working for migrations nobody has written yet. **Both placements can shadow**: a using inside a namespace resolves relative to it and can bind to a sibling, and a using outside can be shadowed by a sibling namespace segment of the same simple name. The second is real here — a test namespace named `FlockScope` shadowed the production `FlockScope` class and produced 13 errors across six files — so never introduce a namespace segment whose simple name is also a type. → [`985-csharp-style-gate.md`](docs/decisions/985-csharp-style-gate.md) - **Declare cross-module references in the module ledger (#514/#842).** `tests/Cluckwork.Application.Tests/Architecture/Data/module-ledger.json` names nine namespace owners: Access, Farm, FlockManagement, EggOperations, Commerce, GeneralInventory, Finance, Insights and Platform. Each cross-owner cell (`from`, `to`, `kind`, `reason`) lists the top-level types realising it. `ModuleLedgerRealTreeTests` walks every `.cs` under `src/`. Undeclared edges, stale rows, unowned namespaces, parse errors and file counts below the floor fail. An undeclared edge prints the JSON to add; read the code and extend the cell, never widen a reason. Key by owner and top-level type, never namespace or `file:line` (#632). `Customer.cs` under `Domain/Sales/` is not an edge because both ends are Commerce. **Platform is the free hub**: `Cluckwork.Api.*`, `Infrastructure.*` except `Identity`, `Domain.Common`, `Domain.Auditing` and `Application.Common` may reference anything and be referenced by anything. Narrowing this is Track B (#845–#847). Only review checks `kind`: `W` writes through the other owner in one transaction; `R` reads or validates. The ledger authorises no move; the design's status line still governs. → [`514-module-ledger.md`](docs/decisions/514-module-ledger.md) - **No persistence type crosses an Application seam (#514/#847).** Public interfaces under `Cluckwork.Application.Features.*` or `Cluckwork.Application.Common` may not reach `DbContext`, `DbSet<>`, `IQueryable`, any `Microsoft.EntityFrameworkCore` type, the bases `Entity`/`AggregateRoot` as declared types, or any `Cluckwork.Infrastructure` type. This covers parameters, return types, generic arguments and properties of returned `Cluckwork.*` types. `SeamSurfaceRealAssemblyTests` reflects over every such interface and fails closed below 30. A second assertion forbids Application assembly references to EF, Npgsql or Infrastructure, keeping the first from being vacuous. Return a DTO, value object, concrete aggregate or `PagedResult`. → [`847-seam-surface-guard.md`](docs/decisions/847-seam-surface-guard.md) diff --git a/Directory.Build.props b/Directory.Build.props index 8aae3d33e..3910ce0c6 100644 --- a/Directory.Build.props +++ b/Directory.Build.props @@ -9,6 +9,11 @@ enable enable true + + true diff --git a/docs/decisions/985-csharp-style-gate.md b/docs/decisions/985-csharp-style-gate.md new file mode 100644 index 000000000..7a197faf3 --- /dev/null +++ b/docs/decisions/985-csharp-style-gate.md @@ -0,0 +1,102 @@ +# Gate two C# style rules at build time (#985) + +**Rule in [`AGENTS.md`](../../AGENTS.md) → Conventions → Application shape.** + +No incident. This is an **accepted-risk** record: the risk taken is that a future +`:warning` entry in `.editorconfig` breaks the build for everyone, and the rule is +load-bearing because that is also the mechanism doing the work. + +## What was decided + +`csharp_using_directive_placement = outside_namespace` and +`csharp_style_namespace_declarations = file_scoped`, both at `:warning`, with +`EnforceCodeStyleInBuild` added beside the existing `TreatWarningsAsErrors`. That +combination makes each a build error. 590 files were swept to comply. + +## Why gate rather than leave it a preference + +`TreatWarningsAsErrors` is already global, so "warning but not error" is not a +state this repo has. It would mean `WarningsNotAsErrors` for two ids plus a +warning line in a CI log nobody reads. An analyzer also cannot tell a new file +from an old one, so "enforce for new code only" is not expressible. The honest +options were gate-all or gate-none, and the branch passed through a silent +middle state (`2cd96251`) that enforced nothing at all. + +Timing: #514's Track C adds nine module contracts across a dozen slices and +several authors, which is when an unenforced convention drifts. Rebase cost was +zero when this landed, because no other open PR touched a `.cs` file. + +## Why outside rather than inside + +The owner chose outside. Both placements have a shadowing failure mode, and the +first version of this change argued that outside was simply safer. **That was +wrong and the argument is recorded here so nobody repeats it.** + +- A `using X;` *inside* a namespace resolves relative to that namespace, so it + can bind to a sibling `X` instead of the global one. +- A `using` *outside* resolves from the global root, so a sibling namespace + segment whose simple name matches a type can shadow that type. + +The second is not theoretical in this repo. `FlockScope` was both +`Cluckwork.Infrastructure.Persistence.FlockScope` and the test namespace +`Cluckwork.Application.Tests.FlockScope`. Moving usings out of that namespace's +scope produced **13 errors across six files**, 11 `CS0118` and two `CS0234`, +reaching `CouplingMatrixRealTreeTests`, `TableOwnerRealModelTests` and the +tenant-bypass tests, not only the two files in the renamed namespace. The fix +was renaming the test namespace to `FlockScoping`, which is worth having anyway. + +**So the operative rule is not "outside is safe". It is: never introduce a +namespace segment whose simple name is also a type name.** + +## Blast radius, measured + +`EnforceCodeStyleInBuild` does not enable two rules. It runs the IDE analyzers, +so every code-style diagnostic at warning severity or above becomes an error +under `TreatWarningsAsErrors`. Reflecting over every `DiagnosticAnalyzer` in the +SDK's `Microsoft.CodeAnalysis.CodeStyle.dll` and +`Microsoft.CodeAnalysis.CSharp.CodeStyle.dll` gives 121 distinct ids: 116 default +`Hidden`, four `Info`, one `Warning`, and that one only reports when IDE0005 is +raised, which it is not. The repo carries no `.globalconfig`, ruleset, +`AnalysisLevel`, `AnalysisMode` or `dotnet_diagnostic.*` entry. A probe file with +about 25 common style deviations produced compiler warnings only, no `IDE*`. + +So the effective set is exactly {IDE0065, IDE0161} **by construction, not by +luck** — but the property's contract is open-ended, which is why the `AGENTS.md` +paragraph states that any future `:warning` entry is a gate. Build cost is about +one second on an eight-second full solution build. + +## The two exemptions + +`SeamSurfaceTests.cs` and `TableOwnerTests.cs` declare several namespaces per +file, one per fixture scenario. Only the *placement* rule is relaxed: 25 of their +usings are relative aliases resolving against the enclosing namespace +(`using Fixtures = TableOwnerFixtures;`), so hoisting them would mean fully +qualifying every one, a content change to two guard fixtures. IDE0161 needs no +exemption, because it never reports on a compilation unit declaring more than one +namespace — an earlier revision silenced it here anyway, which was dead +configuration. + +The EF migrations tree keeps block-scoped namespaces because +`dotnet ef migrations add` **scaffolds** them. Verified by scaffolding one at this +head. The exemption therefore has to keep working for migrations nobody has +written yet, which is a stronger reason than #407's freeze; the freeze explains +why existing files are not rewritten, not why future generated ones pass. +Designer and snapshot files carry `` and the analyzers skip +them regardless. + +## How the sweep was made reviewable + +`tools/style/move-usings-outside.py` is committed so the 590-file diff is +re-derivable in one command rather than read by hand. Review confirmed it +reproduces every file byte for byte from `main`. It is not the supported remedy +for new code; `dotnet format style --diagnostics IDE0065 IDE0161` is, and it +fixes both rules. + +A green build was not treated as sufficient. The compiler catches a name that +became ambiguous, not one that silently rebinds to a different valid type, so +review compared Roslyn bindings across all nine projects' real compiler inputs +including implicit and generated sources: 2,770 using targets and 351,085 +expression bindings matched, with no difference outside the intentional rename. +Four files that look like outliers by line-regex are not: their `using` lines sit +inside raw string literals that build synthetic source for the architecture +scanners to walk. diff --git a/docs/decisions/README.md b/docs/decisions/README.md index 0ef506a2d..f995d33aa 100644 --- a/docs/decisions/README.md +++ b/docs/decisions/README.md @@ -68,6 +68,7 @@ Starting a new record: copy [`TEMPLATE.md`](TEMPLATE.md). | [Backend test coverage measurement, report only (#776)](776-backend-coverage.md) | AGENTS · Build / test / run | | [Skip the web and image jobs on documentation-only pull requests (#782)](782-ci-job-gating.md) | AGENTS · CI security gates | | [Adopt a UI component library, and which one: MUI (#674)](674-ui-component-library.md) | `web/README.md` · Stack · and `specs/technical/tech_spec.md` §8.1 | +| [Gate two C# style rules at build time (#985)](985-csharp-style-gate.md) | AGENTS · Conventions | | [Cross-module references are declared in the module ledger (#514, #842)](514-module-ledger.md) | AGENTS · Conventions | | [No persistence type crosses an Application seam (#514, #847)](847-seam-surface-guard.md) | AGENTS · Conventions | diff --git a/src/Cluckwork.Api/AuthPolicies.cs b/src/Cluckwork.Api/AuthPolicies.cs index 64ca9acfc..3cdcecd7b 100644 --- a/src/Cluckwork.Api/AuthPolicies.cs +++ b/src/Cluckwork.Api/AuthPolicies.cs @@ -1,7 +1,7 @@ -namespace Cluckwork.Api; - using Cluckwork.Domain.Accounts; +namespace Cluckwork.Api; + // #103 — the role → capability map (spec §5.1/§5.3), replacing #73's binary // Admin/other split. One policy per capability tier; endpoint groups pick a // tier, never a raw role name (#84). diff --git a/src/Cluckwork.Api/Cli/BootstrapAdminCliCommand.cs b/src/Cluckwork.Api/Cli/BootstrapAdminCliCommand.cs index cf2dda2a4..23cb4bb29 100644 --- a/src/Cluckwork.Api/Cli/BootstrapAdminCliCommand.cs +++ b/src/Cluckwork.Api/Cli/BootstrapAdminCliCommand.cs @@ -1,11 +1,11 @@ -namespace Cluckwork.Api.Cli; - using Cluckwork.Infrastructure.Identity; using Cluckwork.Infrastructure.Persistence; using Microsoft.AspNetCore.Builder; using Microsoft.EntityFrameworkCore; using Microsoft.Extensions.DependencyInjection; +namespace Cluckwork.Api.Cli; + // `bootstrap-admin --email ` (#283) — first-run admin provisioning. Same // run-then-exit, fail-loud shape as seed/migrate/recover-admin: migrates the // schema (idempotent, like every other one-shot verb), then creates the diff --git a/src/Cluckwork.Api/Cli/CliDispatcher.cs b/src/Cluckwork.Api/Cli/CliDispatcher.cs index a025957f1..15cfbb620 100644 --- a/src/Cluckwork.Api/Cli/CliDispatcher.cs +++ b/src/Cluckwork.Api/Cli/CliDispatcher.cs @@ -1,7 +1,7 @@ -namespace Cluckwork.Api.Cli; - using Microsoft.AspNetCore.Builder; +namespace Cluckwork.Api.Cli; + // Routes args[0] to a one-off ICliCommand. Program.cs calls TryRunAsync right // after Build(): a non-null result is the command's exit code (return it and // never start the web host); null means no CLI verb matched, so this is a normal diff --git a/src/Cluckwork.Api/Cli/ICliCommand.cs b/src/Cluckwork.Api/Cli/ICliCommand.cs index ba7b56977..38da4f04c 100644 --- a/src/Cluckwork.Api/Cli/ICliCommand.cs +++ b/src/Cluckwork.Api/Cli/ICliCommand.cs @@ -1,7 +1,7 @@ -namespace Cluckwork.Api.Cli; - using Microsoft.AspNetCore.Builder; +namespace Cluckwork.Api.Cli; + // A one-off, run-then-exit operator command on the API binary. Dispatched from // Program.cs immediately after Build() and // BEFORE the web host starts — Kestrel and the hosted services never run for diff --git a/src/Cluckwork.Api/Cli/ListAccountsCliCommand.cs b/src/Cluckwork.Api/Cli/ListAccountsCliCommand.cs index 145ab8c1d..cd420cbb4 100644 --- a/src/Cluckwork.Api/Cli/ListAccountsCliCommand.cs +++ b/src/Cluckwork.Api/Cli/ListAccountsCliCommand.cs @@ -1,10 +1,10 @@ -namespace Cluckwork.Api.Cli; - using Cluckwork.Infrastructure.Persistence; using Microsoft.AspNetCore.Builder; using Microsoft.EntityFrameworkCore; using Microsoft.Extensions.DependencyInjection; +namespace Cluckwork.Api.Cli; + // `list-accounts` (#531) — a read-only operator verb that prints every farm's // code, name and active state. Moved forward from #533 deliberately: #532 makes // the farm code mandatory at login, so the first upgraded deployment needs a diff --git a/src/Cluckwork.Api/Cli/MigrateCliCommand.cs b/src/Cluckwork.Api/Cli/MigrateCliCommand.cs index a44c7e3e0..9a9a4a02b 100644 --- a/src/Cluckwork.Api/Cli/MigrateCliCommand.cs +++ b/src/Cluckwork.Api/Cli/MigrateCliCommand.cs @@ -1,11 +1,11 @@ -namespace Cluckwork.Api.Cli; - using Cluckwork.Infrastructure.Persistence; using Microsoft.AspNetCore.Builder; using Microsoft.EntityFrameworkCore; using Microsoft.Extensions.DependencyInjection; using Microsoft.Extensions.Logging; +namespace Cluckwork.Api.Cli; + // `migrate` (#263) — applies EF migrations then EXITS: the pre-deploy-job // entrypoint that lets a production deploy run schema DDL under a dedicated // migrator/owner credential (a one-off job), with `Database:MigrateOnStartup=false` diff --git a/src/Cluckwork.Api/Cli/ProvisionAccountCliCommand.cs b/src/Cluckwork.Api/Cli/ProvisionAccountCliCommand.cs index 09fcac6ee..4de705205 100644 --- a/src/Cluckwork.Api/Cli/ProvisionAccountCliCommand.cs +++ b/src/Cluckwork.Api/Cli/ProvisionAccountCliCommand.cs @@ -1,10 +1,10 @@ -namespace Cluckwork.Api.Cli; - using Cluckwork.Domain.Accounts; using Cluckwork.Infrastructure.Identity; using Microsoft.AspNetCore.Builder; using Microsoft.Extensions.DependencyInjection; +namespace Cluckwork.Api.Cli; + // Creates one farm, its canonical reference data, and its first Owner in one // transaction. It deliberately does not migrate: production runs this through // the least-privilege runtime database role after the migrate job has finished. diff --git a/src/Cluckwork.Api/Cli/ReactivateAccountCliCommand.cs b/src/Cluckwork.Api/Cli/ReactivateAccountCliCommand.cs index ff37e8f8d..3b6e7bfae 100644 --- a/src/Cluckwork.Api/Cli/ReactivateAccountCliCommand.cs +++ b/src/Cluckwork.Api/Cli/ReactivateAccountCliCommand.cs @@ -1,9 +1,9 @@ -namespace Cluckwork.Api.Cli; - using Cluckwork.Infrastructure.Identity; using Microsoft.AspNetCore.Builder; using Microsoft.Extensions.DependencyInjection; +namespace Cluckwork.Api.Cli; + // `reactivate-account --slug [--reason ]` (#534) — brings a suspended // farm back. Suspension deletes nothing, so reactivation restores the farm // exactly — with one deliberate exception: sessions that predate the suspension diff --git a/src/Cluckwork.Api/Cli/RecoverAdminCliCommand.cs b/src/Cluckwork.Api/Cli/RecoverAdminCliCommand.cs index c329c42d9..fbea995d4 100644 --- a/src/Cluckwork.Api/Cli/RecoverAdminCliCommand.cs +++ b/src/Cluckwork.Api/Cli/RecoverAdminCliCommand.cs @@ -1,9 +1,9 @@ -namespace Cluckwork.Api.Cli; - using Cluckwork.Infrastructure.Identity; using Microsoft.AspNetCore.Builder; using Microsoft.Extensions.DependencyInjection; +namespace Cluckwork.Api.Cli; + // `recover-admin --email [--account ] [--reason ]` (#265) — offline // break-glass recovery for a locked-out account (a sole Owner with a lost // password and no email/SMTP reset path would otherwise need direct DB surgery). diff --git a/src/Cluckwork.Api/Cli/RenameAccountCliCommand.cs b/src/Cluckwork.Api/Cli/RenameAccountCliCommand.cs index f7d7aa285..299a1c534 100644 --- a/src/Cluckwork.Api/Cli/RenameAccountCliCommand.cs +++ b/src/Cluckwork.Api/Cli/RenameAccountCliCommand.cs @@ -1,10 +1,10 @@ -namespace Cluckwork.Api.Cli; - using Cluckwork.Domain.Accounts; using Cluckwork.Infrastructure.Identity; using Microsoft.AspNetCore.Builder; using Microsoft.Extensions.DependencyInjection; +namespace Cluckwork.Api.Cli; + // `rename-account --slug --new-slug [--reason ]` (#732) — changes a // farm's code. The reason it exists: a database upgraded from before multi-farm tenancy // gets `default-farm` from the AddAccountSlug migration, nothing asks at migration time, diff --git a/src/Cluckwork.Api/Cli/SeedCliCommand.cs b/src/Cluckwork.Api/Cli/SeedCliCommand.cs index dcca062b4..b9e5ac0b3 100644 --- a/src/Cluckwork.Api/Cli/SeedCliCommand.cs +++ b/src/Cluckwork.Api/Cli/SeedCliCommand.cs @@ -1,11 +1,11 @@ -namespace Cluckwork.Api.Cli; - using Cluckwork.Infrastructure.Persistence; using Microsoft.AspNetCore.Builder; using Microsoft.EntityFrameworkCore; using Microsoft.Extensions.DependencyInjection; using Microsoft.Extensions.Logging; +namespace Cluckwork.Api.Cli; + // `seed --profile [--farm-code ]` (#280) — a one-off command on the // same binary, not a serving-process code path: it migrates the schema, runs the // requested profile's seeder(s), then EXITS (Kestrel and the hosted services diff --git a/src/Cluckwork.Api/Cli/SuspendAccountCliCommand.cs b/src/Cluckwork.Api/Cli/SuspendAccountCliCommand.cs index 5c271be93..6ed430047 100644 --- a/src/Cluckwork.Api/Cli/SuspendAccountCliCommand.cs +++ b/src/Cluckwork.Api/Cli/SuspendAccountCliCommand.cs @@ -1,11 +1,11 @@ -namespace Cluckwork.Api.Cli; - using Cluckwork.Infrastructure.Identity; using Cluckwork.Infrastructure.Persistence; using Microsoft.AspNetCore.Builder; using Microsoft.EntityFrameworkCore; using Microsoft.Extensions.DependencyInjection; +namespace Cluckwork.Api.Cli; + // `suspend-account --slug [--reason ]` (#534) — takes a farm offline. // Enforcement is already live (#532): Account.IsActive is read by // CredentialEpochMiddleware on EVERY authenticated request, so suspension bites diff --git a/src/Cluckwork.Api/Configuration/FarmBannerOptions.cs b/src/Cluckwork.Api/Configuration/FarmBannerOptions.cs index eb714fbba..d34b83a90 100644 --- a/src/Cluckwork.Api/Configuration/FarmBannerOptions.cs +++ b/src/Cluckwork.Api/Configuration/FarmBannerOptions.cs @@ -1,8 +1,8 @@ -namespace Cluckwork.Api.Configuration; - using Cluckwork.Domain.Media; using Microsoft.Extensions.Options; +namespace Cluckwork.Api.Configuration; + // #179 — the OPERATIONAL cap on a farm-banner upload, tunable per deployment // under the domain's hard ceiling (ImageSanitizer.MaxBannerByteLengthCeiling). // Mirrors FarmLogoOptions exactly; kept separate because the banner (a wide, diff --git a/src/Cluckwork.Api/Configuration/FarmLogoOptions.cs b/src/Cluckwork.Api/Configuration/FarmLogoOptions.cs index affe79fb3..2d3e50945 100644 --- a/src/Cluckwork.Api/Configuration/FarmLogoOptions.cs +++ b/src/Cluckwork.Api/Configuration/FarmLogoOptions.cs @@ -1,8 +1,8 @@ -namespace Cluckwork.Api.Configuration; - using Cluckwork.Domain.Media; using Microsoft.Extensions.Options; +namespace Cluckwork.Api.Configuration; + // #123 — the OPERATIONAL cap on a farm-logo upload, tunable per deployment // under the domain's hard ceiling (ImageSanitizer.MaxByteLengthCeiling). The // endpoint reads it, holds the upload to it, surfaces it to the SPA so the diff --git a/src/Cluckwork.Api/Configuration/OtlpOptions.cs b/src/Cluckwork.Api/Configuration/OtlpOptions.cs index 5130a91ea..f213b9a59 100644 --- a/src/Cluckwork.Api/Configuration/OtlpOptions.cs +++ b/src/Cluckwork.Api/Configuration/OtlpOptions.cs @@ -1,7 +1,7 @@ -namespace Cluckwork.Api.Configuration; - using OpenTelemetry.Exporter; +namespace Cluckwork.Api.Configuration; + // OTLP export settings (#214). Bound from the "Otlp" section and validated // eagerly at boot (repo convention): a malformed protocol or endpoint fails // startup with a pointed message — never silently, never on the first export. diff --git a/src/Cluckwork.Api/Endpoints/Accounts/AccountEndpoints.cs b/src/Cluckwork.Api/Endpoints/Accounts/AccountEndpoints.cs index 4379b7694..54eff12c2 100644 --- a/src/Cluckwork.Api/Endpoints/Accounts/AccountEndpoints.cs +++ b/src/Cluckwork.Api/Endpoints/Accounts/AccountEndpoints.cs @@ -1,5 +1,3 @@ -namespace Cluckwork.Api.Endpoints.Accounts; - using Cluckwork.Application.Common; using Cluckwork.Application.Features.Accounts; using Cluckwork.Application.Features.Accounts.UpdateFarmSettings; @@ -11,6 +9,8 @@ namespace Cluckwork.Api.Endpoints.Accounts; using FluentValidation; using Microsoft.Extensions.Options; +namespace Cluckwork.Api.Endpoints.Accounts; + public static class AccountEndpoints { public static RouteGroupBuilder MapAccountEndpoints(this RouteGroupBuilder group) diff --git a/src/Cluckwork.Api/Endpoints/Accounts/FarmBannerEndpoints.cs b/src/Cluckwork.Api/Endpoints/Accounts/FarmBannerEndpoints.cs index 20e93b114..6930314e6 100644 --- a/src/Cluckwork.Api/Endpoints/Accounts/FarmBannerEndpoints.cs +++ b/src/Cluckwork.Api/Endpoints/Accounts/FarmBannerEndpoints.cs @@ -1,5 +1,3 @@ -namespace Cluckwork.Api.Endpoints.Accounts; - using System.Buffers; using Cluckwork.Api.Configuration; using Cluckwork.Application.Features.Accounts; @@ -12,6 +10,8 @@ namespace Cluckwork.Api.Endpoints.Accounts; using Microsoft.Net.Http.Headers; using Cluckwork.Api.Hosting; +namespace Cluckwork.Api.Endpoints.Accounts; + // #179 — the farm banner: upload, serve, remove. Mirrors FarmLogoEndpoints.cs // exactly, including the raw-body-PUT and ETag/304 reasoning documented there; // only the asset (banner vs logo, its own size cap, its own error codes) and diff --git a/src/Cluckwork.Api/Endpoints/Accounts/FarmLogoEndpoints.cs b/src/Cluckwork.Api/Endpoints/Accounts/FarmLogoEndpoints.cs index 3eeb738dd..df0c33bb9 100644 --- a/src/Cluckwork.Api/Endpoints/Accounts/FarmLogoEndpoints.cs +++ b/src/Cluckwork.Api/Endpoints/Accounts/FarmLogoEndpoints.cs @@ -1,5 +1,3 @@ -namespace Cluckwork.Api.Endpoints.Accounts; - using System.Buffers; using Cluckwork.Api.Configuration; using Cluckwork.Application.Features.Accounts; @@ -12,6 +10,8 @@ namespace Cluckwork.Api.Endpoints.Accounts; using Microsoft.Net.Http.Headers; using Cluckwork.Api.Hosting; +namespace Cluckwork.Api.Endpoints.Accounts; + // #123 — the farm logo: upload, serve, remove. // // The upload takes a RAW body rather than multipart/form-data. Multipart would diff --git a/src/Cluckwork.Api/Endpoints/Audit/AuditEndpoints.cs b/src/Cluckwork.Api/Endpoints/Audit/AuditEndpoints.cs index 96f4778ea..991ceff6c 100644 --- a/src/Cluckwork.Api/Endpoints/Audit/AuditEndpoints.cs +++ b/src/Cluckwork.Api/Endpoints/Audit/AuditEndpoints.cs @@ -1,9 +1,9 @@ -namespace Cluckwork.Api.Endpoints.Audit; - using Cluckwork.Application.Features.Audit; using Cluckwork.Domain.Auditing; using Cluckwork.Infrastructure.Persistence; +namespace Cluckwork.Api.Endpoints.Audit; + // #93 — read-only audit viewer. There is deliberately NO mutation surface: // events append inside the transactions that create them and never change. public static class AuditEndpoints diff --git a/src/Cluckwork.Api/Endpoints/Auth/AuthEndpoints.cs b/src/Cluckwork.Api/Endpoints/Auth/AuthEndpoints.cs index aa8e98b8b..a03c74237 100644 --- a/src/Cluckwork.Api/Endpoints/Auth/AuthEndpoints.cs +++ b/src/Cluckwork.Api/Endpoints/Auth/AuthEndpoints.cs @@ -1,5 +1,3 @@ -namespace Cluckwork.Api.Endpoints.Auth; - using Cluckwork.Api.Hosting; using Cluckwork.Api.Middleware; using Cluckwork.Api.RateLimiting; @@ -13,6 +11,8 @@ namespace Cluckwork.Api.Endpoints.Auth; using FluentValidation; using Microsoft.Extensions.Options; +namespace Cluckwork.Api.Endpoints.Auth; + public static class AuthEndpoints { // #309 — the refresh token is a 256-bit value rendered as standard Base64 diff --git a/src/Cluckwork.Api/Endpoints/Auth/LoginRequestValidator.cs b/src/Cluckwork.Api/Endpoints/Auth/LoginRequestValidator.cs index 012779dd0..0fdfc4c07 100644 --- a/src/Cluckwork.Api/Endpoints/Auth/LoginRequestValidator.cs +++ b/src/Cluckwork.Api/Endpoints/Auth/LoginRequestValidator.cs @@ -1,9 +1,9 @@ -namespace Cluckwork.Api.Endpoints.Auth; - using Cluckwork.Application.Features.Users; using Cluckwork.Domain.Accounts; using FluentValidation; +namespace Cluckwork.Api.Endpoints.Auth; + // #309 — MAX-length-only guard on the login credentials, plus a not-null guard // (see below). Deliberately NO NotEmpty / MinLength: an empty ("") or short // email/password must still flow into identity.LoginAsync and come back as the diff --git a/src/Cluckwork.Api/Endpoints/Auth/StepUpRequestValidator.cs b/src/Cluckwork.Api/Endpoints/Auth/StepUpRequestValidator.cs index 665fcdd73..ea1d56187 100644 --- a/src/Cluckwork.Api/Endpoints/Auth/StepUpRequestValidator.cs +++ b/src/Cluckwork.Api/Endpoints/Auth/StepUpRequestValidator.cs @@ -1,8 +1,8 @@ -namespace Cluckwork.Api.Endpoints.Auth; - using Cluckwork.Application.Features.Users; using FluentValidation; +namespace Cluckwork.Api.Endpoints.Auth; + // #308 — MAX-length-only, matching LoginRequestValidator's rationale: an // empty/short password must still flow to IStepUpGrantService.IssueAsync and // come back as the same non-enumerating "Current password is incorrect." diff --git a/src/Cluckwork.Api/Endpoints/Catalog/ProductEndpoints.cs b/src/Cluckwork.Api/Endpoints/Catalog/ProductEndpoints.cs index c8ceabe11..b7db71d59 100644 --- a/src/Cluckwork.Api/Endpoints/Catalog/ProductEndpoints.cs +++ b/src/Cluckwork.Api/Endpoints/Catalog/ProductEndpoints.cs @@ -1,5 +1,3 @@ -namespace Cluckwork.Api.Endpoints.Catalog; - using Cluckwork.Api.Validation; using Cluckwork.Application.Features.Catalog; using Cluckwork.Application.Features.Catalog.CreateProduct; @@ -10,6 +8,8 @@ namespace Cluckwork.Api.Endpoints.Catalog; using Cluckwork.Infrastructure.Persistence; using FluentValidation; +namespace Cluckwork.Api.Endpoints.Catalog; + // #97 — product catalog (part 1: egg products only). Writes are configuration // → admin-only (F19 principle); reads stay open so sales screens can render // product names for any user (part 2). diff --git a/src/Cluckwork.Api/Endpoints/ClientErrors/ClientErrorEndpoints.cs b/src/Cluckwork.Api/Endpoints/ClientErrors/ClientErrorEndpoints.cs index ba7d429b4..4b52d5459 100644 --- a/src/Cluckwork.Api/Endpoints/ClientErrors/ClientErrorEndpoints.cs +++ b/src/Cluckwork.Api/Endpoints/ClientErrors/ClientErrorEndpoints.cs @@ -1,10 +1,10 @@ -namespace Cluckwork.Api.Endpoints.ClientErrors; - using System.Text.Json; using Cluckwork.Api.RateLimiting; using Microsoft.AspNetCore.Http.Features; using Cluckwork.Api.Hosting; +namespace Cluckwork.Api.Endpoints.ClientErrors; + // #217 — the SPA's ErrorBoundary reports render crashes here so the operator // learns a screen is crashing without a support screenshot. The report is // WRITTEN TO THE LOG and stored nowhere else: no table, no retention question, diff --git a/src/Cluckwork.Api/Endpoints/Customers/CustomerEndpoints.cs b/src/Cluckwork.Api/Endpoints/Customers/CustomerEndpoints.cs index 7f9b1eec0..5585d8048 100644 --- a/src/Cluckwork.Api/Endpoints/Customers/CustomerEndpoints.cs +++ b/src/Cluckwork.Api/Endpoints/Customers/CustomerEndpoints.cs @@ -1,5 +1,3 @@ -namespace Cluckwork.Api.Endpoints.Customers; - using Cluckwork.Api.Validation; using Cluckwork.Application.Features.Customers; using Cluckwork.Application.Features.Customers.CreateCustomer; @@ -8,6 +6,8 @@ namespace Cluckwork.Api.Endpoints.Customers; using Cluckwork.Infrastructure.Persistence; using FluentValidation; +namespace Cluckwork.Api.Endpoints.Customers; + public static class CustomerEndpoints { private const int DefaultPageSize = 100; diff --git a/src/Cluckwork.Api/Endpoints/DailyEntries/DailyEntryEndpoints.cs b/src/Cluckwork.Api/Endpoints/DailyEntries/DailyEntryEndpoints.cs index d77ce99fe..dc5696797 100644 --- a/src/Cluckwork.Api/Endpoints/DailyEntries/DailyEntryEndpoints.cs +++ b/src/Cluckwork.Api/Endpoints/DailyEntries/DailyEntryEndpoints.cs @@ -1,5 +1,3 @@ -namespace Cluckwork.Api.Endpoints.DailyEntries; - using System.Text.Json; using Cluckwork.Api.Validation; using Cluckwork.Application.Features.DailyEntries.AdjustDailyEntry; @@ -10,6 +8,8 @@ namespace Cluckwork.Api.Endpoints.DailyEntries; using Cluckwork.Infrastructure.Persistence; using FluentValidation; +namespace Cluckwork.Api.Endpoints.DailyEntries; + public static class DailyEntryEndpoints { private static readonly string EntryNotFoundCode = "DailyEntry.NotFound"; diff --git a/src/Cluckwork.Api/Endpoints/EggGrades/EggGradeEndpoints.cs b/src/Cluckwork.Api/Endpoints/EggGrades/EggGradeEndpoints.cs index e68b8f65a..9b495dba0 100644 --- a/src/Cluckwork.Api/Endpoints/EggGrades/EggGradeEndpoints.cs +++ b/src/Cluckwork.Api/Endpoints/EggGrades/EggGradeEndpoints.cs @@ -1,5 +1,3 @@ -namespace Cluckwork.Api.Endpoints.EggGrades; - using Cluckwork.Api.Validation; using Cluckwork.Application.Features.Audit; using Cluckwork.Application.Features.EggGrades; @@ -10,6 +8,8 @@ namespace Cluckwork.Api.Endpoints.EggGrades; using Cluckwork.Infrastructure.Persistence; using FluentValidation; +namespace Cluckwork.Api.Endpoints.EggGrades; + public static class EggGradeEndpoints { public static RouteGroupBuilder MapEggGradeEndpoints(this RouteGroupBuilder group) diff --git a/src/Cluckwork.Api/Endpoints/Expenses/ExpenseEndpoints.cs b/src/Cluckwork.Api/Endpoints/Expenses/ExpenseEndpoints.cs index d07bf5477..e4079da06 100644 --- a/src/Cluckwork.Api/Endpoints/Expenses/ExpenseEndpoints.cs +++ b/src/Cluckwork.Api/Endpoints/Expenses/ExpenseEndpoints.cs @@ -1,5 +1,3 @@ -namespace Cluckwork.Api.Endpoints.Expenses; - using Cluckwork.Api.Validation; using Cluckwork.Application.Features.Accounts; using Cluckwork.Application.Features.Audit; @@ -12,6 +10,8 @@ namespace Cluckwork.Api.Endpoints.Expenses; using Cluckwork.Infrastructure.Persistence; using FluentValidation; +namespace Cluckwork.Api.Endpoints.Expenses; + // Money data is admin-only end to end (#87): the agreed split keeps production // data open to workers and money behind the Admin role, so BOTH groups below // carry AdminOnly — reads included, unlike the grade catalog. diff --git a/src/Cluckwork.Api/Endpoints/Export/CsvExport.cs b/src/Cluckwork.Api/Endpoints/Export/CsvExport.cs index f06fc05d2..f5f9dace4 100644 --- a/src/Cluckwork.Api/Endpoints/Export/CsvExport.cs +++ b/src/Cluckwork.Api/Endpoints/Export/CsvExport.cs @@ -1,9 +1,9 @@ -namespace Cluckwork.Api.Endpoints.Export; - using System.Globalization; using System.Text; using Cluckwork.Application.Features.Export; +namespace Cluckwork.Api.Endpoints.Export; + // #95 — RFC 4180 CSV: CRLF rows, quote-doubling, UTF-8 with BOM (Excel needs // the BOM to detect the encoding). Rows stream straight from the source // enumerable to the output — an export never materializes in memory. diff --git a/src/Cluckwork.Api/Endpoints/Export/ExportEndpoints.cs b/src/Cluckwork.Api/Endpoints/Export/ExportEndpoints.cs index 817cd68e9..df83ba1a8 100644 --- a/src/Cluckwork.Api/Endpoints/Export/ExportEndpoints.cs +++ b/src/Cluckwork.Api/Endpoints/Export/ExportEndpoints.cs @@ -1,5 +1,3 @@ -namespace Cluckwork.Api.Endpoints.Export; - using System.IO.Compression; using System.IO.Pipelines; using System.Text.Json; @@ -7,6 +5,8 @@ namespace Cluckwork.Api.Endpoints.Export; using Cluckwork.Application.Features.Export; using Cluckwork.Infrastructure.Persistence; +namespace Cluckwork.Api.Endpoints.Export; + // #95 — manual backup (spec §17.5). Read-only, admin-only (group policy in // Program.cs): exports are a bulk copy of the account, money data included. // Responses stream — rows go database → CSV encoder → wire without ever diff --git a/src/Cluckwork.Api/Endpoints/Flocks/FlockEndpoints.cs b/src/Cluckwork.Api/Endpoints/Flocks/FlockEndpoints.cs index 5c6ad4e1a..75e371215 100644 --- a/src/Cluckwork.Api/Endpoints/Flocks/FlockEndpoints.cs +++ b/src/Cluckwork.Api/Endpoints/Flocks/FlockEndpoints.cs @@ -1,5 +1,3 @@ -namespace Cluckwork.Api.Endpoints.Flocks; - using Cluckwork.Api.Validation; using Cluckwork.Application.Features.Audit; using Cluckwork.Application.Features.Flocks; @@ -13,6 +11,8 @@ namespace Cluckwork.Api.Endpoints.Flocks; using Cluckwork.Infrastructure.Persistence; using FluentValidation; +namespace Cluckwork.Api.Endpoints.Flocks; + public static class FlockEndpoints { private const int DefaultPageSize = 100; diff --git a/src/Cluckwork.Api/Endpoints/Inventory/InventoryEndpoints.cs b/src/Cluckwork.Api/Endpoints/Inventory/InventoryEndpoints.cs index 4d7c0ad40..a48d5fed3 100644 --- a/src/Cluckwork.Api/Endpoints/Inventory/InventoryEndpoints.cs +++ b/src/Cluckwork.Api/Endpoints/Inventory/InventoryEndpoints.cs @@ -1,5 +1,3 @@ -namespace Cluckwork.Api.Endpoints.Inventory; - using Cluckwork.Api.Validation; using Cluckwork.Application.Features.Inventory; using Cluckwork.Application.Features.Inventory.CreateInventoryItem; @@ -11,6 +9,8 @@ namespace Cluckwork.Api.Endpoints.Inventory; using Cluckwork.Infrastructure.Persistence; using FluentValidation; +namespace Cluckwork.Api.Endpoints.Inventory; + public static class InventoryEndpoints { private const int DefaultPageSize = 100; diff --git a/src/Cluckwork.Api/Endpoints/Me/MeEndpoints.cs b/src/Cluckwork.Api/Endpoints/Me/MeEndpoints.cs index 3e99c1d9b..f09ac30f8 100644 --- a/src/Cluckwork.Api/Endpoints/Me/MeEndpoints.cs +++ b/src/Cluckwork.Api/Endpoints/Me/MeEndpoints.cs @@ -1,5 +1,3 @@ -namespace Cluckwork.Api.Endpoints.Me; - using Cluckwork.Api.Validation; using Cluckwork.Application.Common; using Cluckwork.Application.Features.Users.SetLanguage; @@ -8,6 +6,8 @@ namespace Cluckwork.Api.Endpoints.Me; using Cluckwork.Infrastructure.Persistence; using FluentValidation; +namespace Cluckwork.Api.Endpoints.Me; + // #45 — the user-scoped counterpart to the farm-scoped /account group. Identity // comes from the JWT (sub), not the body. Mounted on the DEFAULT auth policy so // every role, ReadOnly included, can read their identity and set their language. diff --git a/src/Cluckwork.Api/Endpoints/Reports/ReportConcurrencyLimitFilter.cs b/src/Cluckwork.Api/Endpoints/Reports/ReportConcurrencyLimitFilter.cs index c570668ba..3592f137e 100644 --- a/src/Cluckwork.Api/Endpoints/Reports/ReportConcurrencyLimitFilter.cs +++ b/src/Cluckwork.Api/Endpoints/Reports/ReportConcurrencyLimitFilter.cs @@ -1,8 +1,8 @@ -namespace Cluckwork.Api.Endpoints.Reports; - using Cluckwork.Infrastructure.Persistence; using Cluckwork.Infrastructure.RateLimiting; +namespace Cluckwork.Api.Endpoints.Reports; + // #311/#545 — caps concurrently in-flight report queries per account so one // account firing many overlapping report requests cannot drive unbounded DB/CPU // cost; excess work returns a retryable 429 rather than queueing or running diff --git a/src/Cluckwork.Api/Endpoints/Reports/ReportEndpoints.cs b/src/Cluckwork.Api/Endpoints/Reports/ReportEndpoints.cs index 88a4af37b..c1ba57140 100644 --- a/src/Cluckwork.Api/Endpoints/Reports/ReportEndpoints.cs +++ b/src/Cluckwork.Api/Endpoints/Reports/ReportEndpoints.cs @@ -1,10 +1,10 @@ -namespace Cluckwork.Api.Endpoints.Reports; - using Cluckwork.Application.Common; using Cluckwork.Application.Features.Flocks; using Cluckwork.Application.Features.Reports; using Cluckwork.Infrastructure.Persistence; +namespace Cluckwork.Api.Endpoints.Reports; + // #91 — core reports. Production is open to every signed-in user (workers // record it, workers may read it); the money summaries are AdminOnly, reads // included (#87/#89 split). diff --git a/src/Cluckwork.Api/Endpoints/Sales/PaymentEndpoints.cs b/src/Cluckwork.Api/Endpoints/Sales/PaymentEndpoints.cs index 9963261ea..88c64a6d0 100644 --- a/src/Cluckwork.Api/Endpoints/Sales/PaymentEndpoints.cs +++ b/src/Cluckwork.Api/Endpoints/Sales/PaymentEndpoints.cs @@ -1,5 +1,3 @@ -namespace Cluckwork.Api.Endpoints.Sales; - using Cluckwork.Api.Validation; using Cluckwork.Application.Features.Sales; using Cluckwork.Application.Features.Sales.RecordPayment; @@ -8,6 +6,8 @@ namespace Cluckwork.Api.Endpoints.Sales; using Cluckwork.Infrastructure.Persistence; using FluentValidation; +namespace Cluckwork.Api.Endpoints.Sales; + // Customer payments (#89/#104). Settlement is the Sales tier // (Owner/Manager/Sales — spec §5.1); voiding a payment is the corrective // tier (Owner/Manager only). diff --git a/src/Cluckwork.Api/Endpoints/Sales/SaleEndpoints.cs b/src/Cluckwork.Api/Endpoints/Sales/SaleEndpoints.cs index 1a904f20a..fd1e4fed4 100644 --- a/src/Cluckwork.Api/Endpoints/Sales/SaleEndpoints.cs +++ b/src/Cluckwork.Api/Endpoints/Sales/SaleEndpoints.cs @@ -1,5 +1,3 @@ -namespace Cluckwork.Api.Endpoints.Sales; - using Cluckwork.Api.Validation; using Cluckwork.Application.Common; using Cluckwork.Application.Features.Audit; @@ -19,6 +17,8 @@ namespace Cluckwork.Api.Endpoints.Sales; using Microsoft.AspNetCore.Authorization; using System.Security.Claims; +namespace Cluckwork.Api.Endpoints.Sales; + public static class SaleEndpoints { private const int DefaultPageSize = 100; diff --git a/src/Cluckwork.Api/Endpoints/Stock/StockEndpoints.cs b/src/Cluckwork.Api/Endpoints/Stock/StockEndpoints.cs index 0a44db773..0beba093d 100644 --- a/src/Cluckwork.Api/Endpoints/Stock/StockEndpoints.cs +++ b/src/Cluckwork.Api/Endpoints/Stock/StockEndpoints.cs @@ -1,5 +1,3 @@ -namespace Cluckwork.Api.Endpoints.Stock; - using Cluckwork.Api.Validation; using Cluckwork.Application.Common; using Cluckwork.Application.Features.EggLots; @@ -7,6 +5,8 @@ namespace Cluckwork.Api.Endpoints.Stock; using Cluckwork.Infrastructure.Persistence; using FluentValidation; +namespace Cluckwork.Api.Endpoints.Stock; + public static class StockEndpoints { public static RouteGroupBuilder MapStockEndpoints(this RouteGroupBuilder group) diff --git a/src/Cluckwork.Api/Endpoints/Users/UserEndpoints.cs b/src/Cluckwork.Api/Endpoints/Users/UserEndpoints.cs index 0d043507c..30bcddc49 100644 --- a/src/Cluckwork.Api/Endpoints/Users/UserEndpoints.cs +++ b/src/Cluckwork.Api/Endpoints/Users/UserEndpoints.cs @@ -1,5 +1,3 @@ -namespace Cluckwork.Api.Endpoints.Users; - using Cluckwork.Api.Hosting; using Cluckwork.Api.Validation; using Cluckwork.Application.Common; @@ -17,6 +15,8 @@ namespace Cluckwork.Api.Endpoints.Users; using FluentValidation; using Microsoft.AspNetCore.Mvc; +namespace Cluckwork.Api.Endpoints.Users; + // #73 — minimal user management: enough for an admin to create a worker (or // another admin) and see who exists. Full user administration is the RBAC slice. public static class UserEndpoints diff --git a/src/Cluckwork.Api/Endpoints/Water/WaterUsageEndpoints.cs b/src/Cluckwork.Api/Endpoints/Water/WaterUsageEndpoints.cs index 344086046..92496e38d 100644 --- a/src/Cluckwork.Api/Endpoints/Water/WaterUsageEndpoints.cs +++ b/src/Cluckwork.Api/Endpoints/Water/WaterUsageEndpoints.cs @@ -1,5 +1,3 @@ -namespace Cluckwork.Api.Endpoints.Water; - using Cluckwork.Api.Validation; using Cluckwork.Application.Features.Inventory; using Cluckwork.Application.Features.Inventory.RecordWaterUsage; @@ -8,6 +6,8 @@ namespace Cluckwork.Api.Endpoints.Water; using Cluckwork.Infrastructure.Persistence; using FluentValidation; +namespace Cluckwork.Api.Endpoints.Water; + public static class WaterUsageEndpoints { private const int DefaultPageSize = 100; diff --git a/src/Cluckwork.Api/HealthChecks/DatabaseReadyHealthCheck.cs b/src/Cluckwork.Api/HealthChecks/DatabaseReadyHealthCheck.cs index d5a016f76..33dc7d0a4 100644 --- a/src/Cluckwork.Api/HealthChecks/DatabaseReadyHealthCheck.cs +++ b/src/Cluckwork.Api/HealthChecks/DatabaseReadyHealthCheck.cs @@ -1,9 +1,9 @@ -namespace Cluckwork.Api.HealthChecks; - using Cluckwork.Infrastructure.Persistence; using Microsoft.EntityFrameworkCore; using Microsoft.Extensions.Diagnostics.HealthChecks; +namespace Cluckwork.Api.HealthChecks; + // Readiness = the database is reachable AND the schema is current (tech spec: // "DB connectivity, migrations applied"). A connectivity-only check would // report healthy against a stale schema when Database:MigrateOnStartup=false diff --git a/src/Cluckwork.Api/HealthChecks/DurableJobWorkerHealthCheck.cs b/src/Cluckwork.Api/HealthChecks/DurableJobWorkerHealthCheck.cs index 6a7e5a754..34435df65 100644 --- a/src/Cluckwork.Api/HealthChecks/DurableJobWorkerHealthCheck.cs +++ b/src/Cluckwork.Api/HealthChecks/DurableJobWorkerHealthCheck.cs @@ -1,8 +1,8 @@ -namespace Cluckwork.Api.HealthChecks; - using Cluckwork.Infrastructure.Jobs; using Microsoft.Extensions.Diagnostics.HealthChecks; +namespace Cluckwork.Api.HealthChecks; + // A silently stalled job worker (stuck handler, loop death) would otherwise be // invisible until entries stop locking (#69). Degraded — never Unhealthy — so // a background stall reports on /health/ready without pulling API traffic diff --git a/src/Cluckwork.Api/Hosting/BindingFailureResponse.cs b/src/Cluckwork.Api/Hosting/BindingFailureResponse.cs index a6ce8e063..31594e843 100644 --- a/src/Cluckwork.Api/Hosting/BindingFailureResponse.cs +++ b/src/Cluckwork.Api/Hosting/BindingFailureResponse.cs @@ -1,9 +1,9 @@ -namespace Cluckwork.Api.Hosting; - using Cluckwork.Api.Validation; using Microsoft.AspNetCore.Diagnostics; using Microsoft.AspNetCore.Http.Metadata; +namespace Cluckwork.Api.Hosting; + // #398 review (Codex) — RouteHandlerOptions.ThrowOnBadRequest is forced true // in every environment (see Program.cs), so a JSON-binding failure (a // fractional quantity into an int, an unparseable date/guid, malformed JSON diff --git a/src/Cluckwork.Api/Hosting/CluckworkEdgeSecurityServiceCollectionExtensions.cs b/src/Cluckwork.Api/Hosting/CluckworkEdgeSecurityServiceCollectionExtensions.cs index d7b8055f6..ec6f2bae2 100644 --- a/src/Cluckwork.Api/Hosting/CluckworkEdgeSecurityServiceCollectionExtensions.cs +++ b/src/Cluckwork.Api/Hosting/CluckworkEdgeSecurityServiceCollectionExtensions.cs @@ -1,8 +1,8 @@ -namespace Cluckwork.Api.Hosting; - using Microsoft.AspNetCore.HostFiltering; using Microsoft.AspNetCore.HttpOverrides; +namespace Cluckwork.Api.Hosting; + internal static class CluckworkEdgeSecurityServiceCollectionExtensions { public static IServiceCollection AddCluckworkEdgeSecurity( diff --git a/src/Cluckwork.Api/Hosting/CluckworkFeatureServiceCollectionExtensions.cs b/src/Cluckwork.Api/Hosting/CluckworkFeatureServiceCollectionExtensions.cs index 0f8a612b1..357d8190a 100644 --- a/src/Cluckwork.Api/Hosting/CluckworkFeatureServiceCollectionExtensions.cs +++ b/src/Cluckwork.Api/Hosting/CluckworkFeatureServiceCollectionExtensions.cs @@ -1,5 +1,3 @@ -namespace Cluckwork.Api.Hosting; - using Cluckwork.Api.Configuration; using Cluckwork.Application.Common; using Cluckwork.Application.Features.Accounts; @@ -57,6 +55,8 @@ namespace Cluckwork.Api.Hosting; using FluentValidation; using Microsoft.Extensions.Options; +namespace Cluckwork.Api.Hosting; + internal static class CluckworkFeatureServiceCollectionExtensions { public static IServiceCollection AddCluckworkFeatures( diff --git a/src/Cluckwork.Api/Hosting/CluckworkIdentityServiceCollectionExtensions.cs b/src/Cluckwork.Api/Hosting/CluckworkIdentityServiceCollectionExtensions.cs index 7bfe51c79..109ed924c 100644 --- a/src/Cluckwork.Api/Hosting/CluckworkIdentityServiceCollectionExtensions.cs +++ b/src/Cluckwork.Api/Hosting/CluckworkIdentityServiceCollectionExtensions.cs @@ -1,5 +1,3 @@ -namespace Cluckwork.Api.Hosting; - using System.Security.Cryptography; using Cluckwork.Api.Configuration; using Cluckwork.Api.Middleware; @@ -11,6 +9,8 @@ namespace Cluckwork.Api.Hosting; using Microsoft.AspNetCore.Identity; using Microsoft.IdentityModel.Tokens; +namespace Cluckwork.Api.Hosting; + internal static class CluckworkIdentityServiceCollectionExtensions { // role is OneShot for the operator verbs. Nothing here issues or validates a diff --git a/src/Cluckwork.Api/Hosting/CluckworkJobServiceCollectionExtensions.cs b/src/Cluckwork.Api/Hosting/CluckworkJobServiceCollectionExtensions.cs index 99d055bfa..1cf4b2853 100644 --- a/src/Cluckwork.Api/Hosting/CluckworkJobServiceCollectionExtensions.cs +++ b/src/Cluckwork.Api/Hosting/CluckworkJobServiceCollectionExtensions.cs @@ -1,8 +1,8 @@ -namespace Cluckwork.Api.Hosting; - using Cluckwork.Infrastructure.Jobs; using Microsoft.Extensions.Logging; +namespace Cluckwork.Api.Hosting; + internal static class CluckworkJobServiceCollectionExtensions { public static IServiceCollection AddCluckworkJobs( diff --git a/src/Cluckwork.Api/Hosting/CluckworkPersistenceServiceCollectionExtensions.cs b/src/Cluckwork.Api/Hosting/CluckworkPersistenceServiceCollectionExtensions.cs index 72759b3c0..387aea120 100644 --- a/src/Cluckwork.Api/Hosting/CluckworkPersistenceServiceCollectionExtensions.cs +++ b/src/Cluckwork.Api/Hosting/CluckworkPersistenceServiceCollectionExtensions.cs @@ -1,5 +1,3 @@ -namespace Cluckwork.Api.Hosting; - using Cluckwork.Application.Common; using Cluckwork.Infrastructure.Identity; using Cluckwork.Infrastructure.Jobs; @@ -10,6 +8,8 @@ namespace Cluckwork.Api.Hosting; using Cluckwork.Infrastructure.Time; using Microsoft.EntityFrameworkCore; +namespace Cluckwork.Api.Hosting; + internal static class CluckworkPersistenceServiceCollectionExtensions { public static CluckworkPersistenceRegistration AddCluckworkPersistence( diff --git a/src/Cluckwork.Api/Hosting/CluckworkRateLimitingServiceCollectionExtensions.cs b/src/Cluckwork.Api/Hosting/CluckworkRateLimitingServiceCollectionExtensions.cs index 81337278b..b56480bfc 100644 --- a/src/Cluckwork.Api/Hosting/CluckworkRateLimitingServiceCollectionExtensions.cs +++ b/src/Cluckwork.Api/Hosting/CluckworkRateLimitingServiceCollectionExtensions.cs @@ -1,5 +1,3 @@ -namespace Cluckwork.Api.Hosting; - using System.Globalization; using System.Net; using System.Threading.RateLimiting; @@ -10,6 +8,8 @@ namespace Cluckwork.Api.Hosting; using Microsoft.AspNetCore.RateLimiting; using Microsoft.Extensions.Logging; +namespace Cluckwork.Api.Hosting; + internal static class CluckworkRateLimitingServiceCollectionExtensions { // #347 review — role is OneShot for the operator verbs. Every limiter built diff --git a/src/Cluckwork.Api/Hosting/CluckworkSharedStateServiceCollectionExtensions.cs b/src/Cluckwork.Api/Hosting/CluckworkSharedStateServiceCollectionExtensions.cs index df53c5130..0bca29d85 100644 --- a/src/Cluckwork.Api/Hosting/CluckworkSharedStateServiceCollectionExtensions.cs +++ b/src/Cluckwork.Api/Hosting/CluckworkSharedStateServiceCollectionExtensions.cs @@ -1,8 +1,8 @@ -namespace Cluckwork.Api.Hosting; - using Cluckwork.Api.Configuration; using Cluckwork.Infrastructure.SharedState; +namespace Cluckwork.Api.Hosting; + // #543 — binds SharedStateOptions, runs the serving-only connection-string // guard, then delegates registration to Infrastructure. internal static class CluckworkSharedStateServiceCollectionExtensions diff --git a/src/Cluckwork.Api/Hosting/CluckworkTelemetryServiceCollectionExtensions.cs b/src/Cluckwork.Api/Hosting/CluckworkTelemetryServiceCollectionExtensions.cs index 8baa40033..8875c6d15 100644 --- a/src/Cluckwork.Api/Hosting/CluckworkTelemetryServiceCollectionExtensions.cs +++ b/src/Cluckwork.Api/Hosting/CluckworkTelemetryServiceCollectionExtensions.cs @@ -1,5 +1,3 @@ -namespace Cluckwork.Api.Hosting; - using Cluckwork.Api.Configuration; using Cluckwork.Api.Logging; using OpenTelemetry.Exporter; @@ -8,6 +6,8 @@ namespace Cluckwork.Api.Hosting; using OpenTelemetry.Trace; using Serilog; +namespace Cluckwork.Api.Hosting; + internal static class CluckworkTelemetryServiceCollectionExtensions { // role is OneShot for the operator verbs (migrate / seed / recover-admin / diff --git a/src/Cluckwork.Api/Hosting/DefaultResponseCaching.cs b/src/Cluckwork.Api/Hosting/DefaultResponseCaching.cs index 6e7e4b751..82e8fe3c6 100644 --- a/src/Cluckwork.Api/Hosting/DefaultResponseCaching.cs +++ b/src/Cluckwork.Api/Hosting/DefaultResponseCaching.cs @@ -1,7 +1,7 @@ -namespace Cluckwork.Api.Hosting; - using Microsoft.Net.Http.Headers; +namespace Cluckwork.Api.Hosting; + // #312 — origin-side safe cache default. The app previously emitted no // Cache-Control on API responses at all, so a browser cache, a misconfigured // intermediary, or a future edge rule could retain tenant data (JSON bodies, diff --git a/src/Cluckwork.Api/Hosting/FarmBannerRequestBodyCap.cs b/src/Cluckwork.Api/Hosting/FarmBannerRequestBodyCap.cs index f1a13359c..b2c4b868d 100644 --- a/src/Cluckwork.Api/Hosting/FarmBannerRequestBodyCap.cs +++ b/src/Cluckwork.Api/Hosting/FarmBannerRequestBodyCap.cs @@ -1,10 +1,10 @@ -namespace Cluckwork.Api.Hosting; - using Cluckwork.Api.Configuration; using Cluckwork.Api.Endpoints.Accounts; using Microsoft.AspNetCore.Http.Features; using Microsoft.Extensions.Options; +namespace Cluckwork.Api.Hosting; + // #179 — the farm-banner upload cap, mirroring FarmLogoRequestBodyCap.cs // exactly (see that file for the full reasoning: why a middleware ahead of // IdempotencyMiddleware, why not WithMaxRequestBodyBytes). diff --git a/src/Cluckwork.Api/Hosting/FarmLogoRequestBodyCap.cs b/src/Cluckwork.Api/Hosting/FarmLogoRequestBodyCap.cs index b2a58b52b..70c500cd5 100644 --- a/src/Cluckwork.Api/Hosting/FarmLogoRequestBodyCap.cs +++ b/src/Cluckwork.Api/Hosting/FarmLogoRequestBodyCap.cs @@ -1,10 +1,10 @@ -namespace Cluckwork.Api.Hosting; - using Cluckwork.Api.Configuration; using Cluckwork.Api.Endpoints.Accounts; using Microsoft.AspNetCore.Http.Features; using Microsoft.Extensions.Options; +namespace Cluckwork.Api.Hosting; + // #442 — the farm-logo upload cap, moved from INSIDE the SetLogo handler to a // middleware registered before IdempotencyMiddleware (mirroring // RequestBodyLimit.UseCluckworkRequestBodyLimit, right next to which this is diff --git a/src/Cluckwork.Api/Hosting/OtlpConfigurationResolver.cs b/src/Cluckwork.Api/Hosting/OtlpConfigurationResolver.cs index 2c5c5f835..54150a99e 100644 --- a/src/Cluckwork.Api/Hosting/OtlpConfigurationResolver.cs +++ b/src/Cluckwork.Api/Hosting/OtlpConfigurationResolver.cs @@ -1,7 +1,7 @@ -namespace Cluckwork.Api.Hosting; - using Cluckwork.Api.Configuration; +namespace Cluckwork.Api.Hosting; + internal enum OtlpTransportProfileSource { Canonical, diff --git a/src/Cluckwork.Api/Hosting/ProcessRole.cs b/src/Cluckwork.Api/Hosting/ProcessRole.cs index e6b7fd0e1..b0073e252 100644 --- a/src/Cluckwork.Api/Hosting/ProcessRole.cs +++ b/src/Cluckwork.Api/Hosting/ProcessRole.cs @@ -1,7 +1,7 @@ -namespace Cluckwork.Api.Hosting; - using Cluckwork.Api.Cli; +namespace Cluckwork.Api.Hosting; + // #347 — what this process was started to BE, decided once from args before // anything is registered or built. // diff --git a/src/Cluckwork.Api/Hosting/RequestBodyLimit.cs b/src/Cluckwork.Api/Hosting/RequestBodyLimit.cs index b9b32753b..5c8b13e9b 100644 --- a/src/Cluckwork.Api/Hosting/RequestBodyLimit.cs +++ b/src/Cluckwork.Api/Hosting/RequestBodyLimit.cs @@ -1,7 +1,7 @@ -namespace Cluckwork.Api.Hosting; - using Microsoft.AspNetCore.Http.Features; +namespace Cluckwork.Api.Hosting; + // #309 — a per-endpoint request-body byte cap that rejects an oversized body // BEFORE the framework binds it (and, for the auth endpoints, before the // password reaches the PBKDF2 hasher). diff --git a/src/Cluckwork.Api/Hosting/SpaShell.cs b/src/Cluckwork.Api/Hosting/SpaShell.cs index 4e0b4349d..cd106a24a 100644 --- a/src/Cluckwork.Api/Hosting/SpaShell.cs +++ b/src/Cluckwork.Api/Hosting/SpaShell.cs @@ -1,11 +1,11 @@ -namespace Cluckwork.Api.Hosting; - using System.Text; using Cluckwork.Api.Security; using Microsoft.Extensions.FileProviders; using Microsoft.Extensions.Primitives; using Microsoft.Net.Http.Headers; +namespace Cluckwork.Api.Hosting; + // #873 — the built SPA's index.html, served as a TEMPLATED response rather than // as a static file, because one value in it has to match the response's own // Content-Security-Policy header: the style nonce Emotion needs before MUI's diff --git a/src/Cluckwork.Api/Hosting/StaticAssetCaching.cs b/src/Cluckwork.Api/Hosting/StaticAssetCaching.cs index fc31d7c5a..03c3f54a2 100644 --- a/src/Cluckwork.Api/Hosting/StaticAssetCaching.cs +++ b/src/Cluckwork.Api/Hosting/StaticAssetCaching.cs @@ -1,8 +1,8 @@ -namespace Cluckwork.Api.Hosting; - using Microsoft.AspNetCore.StaticFiles; using Microsoft.Net.Http.Headers; +namespace Cluckwork.Api.Hosting; + // #141 — cache policy for the SPA served from wwwroot. Vite emits content-hashed // files under /assets/ (e.g. index-4af3c1.js): the name changes whenever the // bytes do, so they are safe to cache forever ('immutable'). index.html is the diff --git a/src/Cluckwork.Api/Logging/ExceptionRedactingSink.cs b/src/Cluckwork.Api/Logging/ExceptionRedactingSink.cs index a9f983d34..19083c3ef 100644 --- a/src/Cluckwork.Api/Logging/ExceptionRedactingSink.cs +++ b/src/Cluckwork.Api/Logging/ExceptionRedactingSink.cs @@ -1,8 +1,8 @@ -namespace Cluckwork.Api.Logging; - using Serilog.Core; using Serilog.Events; +namespace Cluckwork.Api.Logging; + // The structural gap a property-mutating ILogEventEnricher cannot close, split // out of #273's log-redaction work as its own reviewable unit (codex review // round 2, P1b). diff --git a/src/Cluckwork.Api/Logging/RedactingLoggerPipeline.cs b/src/Cluckwork.Api/Logging/RedactingLoggerPipeline.cs index c2598a8a6..cf708d022 100644 --- a/src/Cluckwork.Api/Logging/RedactingLoggerPipeline.cs +++ b/src/Cluckwork.Api/Logging/RedactingLoggerPipeline.cs @@ -1,11 +1,11 @@ -namespace Cluckwork.Api.Logging; - using Microsoft.Extensions.Primitives; using Serilog; using Serilog.Configuration; using Serilog.Core; using Serilog.Events; +namespace Cluckwork.Api.Logging; + // #273 codex review (round 2, P1b) — builds this host's Serilog pipeline so // that NO sink can be reached except through ExceptionRedactingSink. // diff --git a/src/Cluckwork.Api/Logging/SensitiveDataRedactionEnricher.cs b/src/Cluckwork.Api/Logging/SensitiveDataRedactionEnricher.cs index a2b5af78b..b85056c9e 100644 --- a/src/Cluckwork.Api/Logging/SensitiveDataRedactionEnricher.cs +++ b/src/Cluckwork.Api/Logging/SensitiveDataRedactionEnricher.cs @@ -1,10 +1,10 @@ -namespace Cluckwork.Api.Logging; - using System.Text; using System.Text.RegularExpressions; using Serilog.Core; using Serilog.Events; +namespace Cluckwork.Api.Logging; + // #273 — redact credentials, tokens, cookies, connection strings, and emails // BEFORE any log line leaves the process, regardless of sink: RedactingLoggerPipeline // wires this enricher in front of every sink this host has — console today, and any diff --git a/src/Cluckwork.Api/Middleware/AmbientPrincipalMiddleware.cs b/src/Cluckwork.Api/Middleware/AmbientPrincipalMiddleware.cs index 60d266725..fb19e776e 100644 --- a/src/Cluckwork.Api/Middleware/AmbientPrincipalMiddleware.cs +++ b/src/Cluckwork.Api/Middleware/AmbientPrincipalMiddleware.cs @@ -1,7 +1,7 @@ -namespace Cluckwork.Api.Middleware; - using System.Security.Claims; +namespace Cluckwork.Api.Middleware; + // #532 — /auth/login is AllowAnonymous, but AllowAnonymous does NOT stop // UseAuthentication from populating context.User when a bearer happens to be // present. Three middlewares downstream then read that principal, and once diff --git a/src/Cluckwork.Api/Middleware/CredentialEpochMiddleware.cs b/src/Cluckwork.Api/Middleware/CredentialEpochMiddleware.cs index 6c72aa589..d6deaf18a 100644 --- a/src/Cluckwork.Api/Middleware/CredentialEpochMiddleware.cs +++ b/src/Cluckwork.Api/Middleware/CredentialEpochMiddleware.cs @@ -1,5 +1,3 @@ -namespace Cluckwork.Api.Middleware; - using System.Globalization; using System.IdentityModel.Tokens.Jwt; using Cluckwork.Infrastructure.Persistence; @@ -7,6 +5,8 @@ namespace Cluckwork.Api.Middleware; using Microsoft.AspNetCore.Mvc; using Microsoft.EntityFrameworkCore; +namespace Cluckwork.Api.Middleware; + // #364 — server-side access-token revocation. Every authenticated request is // bound to the credential epoch held by its exact (user, account) row. Missing // and malformed claims deliberately become retired epoch zero, never an opt-out. diff --git a/src/Cluckwork.Api/Middleware/FlockScopeResolutionMiddleware.cs b/src/Cluckwork.Api/Middleware/FlockScopeResolutionMiddleware.cs index cf197a81f..198756cf6 100644 --- a/src/Cluckwork.Api/Middleware/FlockScopeResolutionMiddleware.cs +++ b/src/Cluckwork.Api/Middleware/FlockScopeResolutionMiddleware.cs @@ -1,10 +1,10 @@ -namespace Cluckwork.Api.Middleware; - using Cluckwork.Infrastructure.Identity; using Cluckwork.Infrastructure.Persistence; using Microsoft.AspNetCore.Diagnostics; using Microsoft.EntityFrameworkCore; +namespace Cluckwork.Api.Middleware; + // #388 — resolves FlockScope per request from UserRoleAssignment rows. // Runs AFTER TenantResolutionMiddleware (which resolves AccountId from the JWT // and the acting user) and BEFORE CredentialEpochMiddleware. It touches no diff --git a/src/Cluckwork.Api/Middleware/ForbiddenProblemResultHandler.cs b/src/Cluckwork.Api/Middleware/ForbiddenProblemResultHandler.cs index fee3a3bef..a5d792370 100644 --- a/src/Cluckwork.Api/Middleware/ForbiddenProblemResultHandler.cs +++ b/src/Cluckwork.Api/Middleware/ForbiddenProblemResultHandler.cs @@ -1,9 +1,9 @@ -namespace Cluckwork.Api.Middleware; - using Microsoft.AspNetCore.Authorization; using Microsoft.AspNetCore.Authorization.Policy; using Microsoft.AspNetCore.Mvc; +namespace Cluckwork.Api.Middleware; + // Role-denied requests get a problem body naming the missing role (#73) — // the framework default is an empty 403. public sealed class ForbiddenProblemResultHandler : IAuthorizationMiddlewareResultHandler diff --git a/src/Cluckwork.Api/Middleware/IdempotencyMiddleware.cs b/src/Cluckwork.Api/Middleware/IdempotencyMiddleware.cs index 117bec7ff..991b1a034 100644 --- a/src/Cluckwork.Api/Middleware/IdempotencyMiddleware.cs +++ b/src/Cluckwork.Api/Middleware/IdempotencyMiddleware.cs @@ -1,5 +1,3 @@ -namespace Cluckwork.Api.Middleware; - using System.Security.Cryptography; using System.Text; using Cluckwork.Infrastructure.Identity; @@ -8,6 +6,8 @@ namespace Cluckwork.Api.Middleware; using Microsoft.EntityFrameworkCore; using Microsoft.Extensions.Options; +namespace Cluckwork.Api.Middleware; + // #307 — a database-coordinated claim/lease protocol, replacing the old // process-local-lock + execute + insert flow (#289's stripe, kept only as a // comment below for history). That flow could never be correct across diff --git a/src/Cluckwork.Api/Middleware/MustChangePasswordMiddleware.cs b/src/Cluckwork.Api/Middleware/MustChangePasswordMiddleware.cs index 056fb98c9..ecbd7486d 100644 --- a/src/Cluckwork.Api/Middleware/MustChangePasswordMiddleware.cs +++ b/src/Cluckwork.Api/Middleware/MustChangePasswordMiddleware.cs @@ -1,8 +1,8 @@ -namespace Cluckwork.Api.Middleware; - using Microsoft.AspNetCore.Diagnostics; using Microsoft.AspNetCore.Mvc; +namespace Cluckwork.Api.Middleware; + // #283 — the server-side half of the first-run "you must set a new password" // gate. TenantResolutionMiddleware (immediately before this in Program.cs's // pipeline) has already read the authenticated principal's claims; this reads diff --git a/src/Cluckwork.Api/Middleware/TenantResolutionMiddleware.cs b/src/Cluckwork.Api/Middleware/TenantResolutionMiddleware.cs index a17b4c471..95bc6d39d 100644 --- a/src/Cluckwork.Api/Middleware/TenantResolutionMiddleware.cs +++ b/src/Cluckwork.Api/Middleware/TenantResolutionMiddleware.cs @@ -1,8 +1,8 @@ -namespace Cluckwork.Api.Middleware; - using Cluckwork.Infrastructure.Identity; using Cluckwork.Infrastructure.Persistence; +namespace Cluckwork.Api.Middleware; + // Reads account_id claim from the authenticated principal and populates TenantContext // before any endpoint handler runs (tech spec §4.2 point 1). Also resolves the // acting user — sub, email AND ROLES (#93). diff --git a/src/Cluckwork.Api/RateLimiting/RateLimitingOptions.cs b/src/Cluckwork.Api/RateLimiting/RateLimitingOptions.cs index ef510280f..8fa81dcb9 100644 --- a/src/Cluckwork.Api/RateLimiting/RateLimitingOptions.cs +++ b/src/Cluckwork.Api/RateLimiting/RateLimitingOptions.cs @@ -1,7 +1,7 @@ -namespace Cluckwork.Api.RateLimiting; - using System.Net; +namespace Cluckwork.Api.RateLimiting; + public sealed class RateLimitingOptions { public const string SectionName = "RateLimiting"; diff --git a/src/Cluckwork.Api/Security/SecurityHeaders.cs b/src/Cluckwork.Api/Security/SecurityHeaders.cs index 4f41a0cc7..4b62e8684 100644 --- a/src/Cluckwork.Api/Security/SecurityHeaders.cs +++ b/src/Cluckwork.Api/Security/SecurityHeaders.cs @@ -1,7 +1,7 @@ -namespace Cluckwork.Api.Security; - using System.Security.Cryptography; +namespace Cluckwork.Api.Security; + // #144 — a handful of response headers, hand-rolled rather than pulling in an // external security-headers package. Applied via Response.OnStarting so they // land on EVERY response — API, static files, the SPA shell, and error diff --git a/src/Cluckwork.Api/Validation/ValidationResponse.cs b/src/Cluckwork.Api/Validation/ValidationResponse.cs index 196da603f..2971ae656 100644 --- a/src/Cluckwork.Api/Validation/ValidationResponse.cs +++ b/src/Cluckwork.Api/Validation/ValidationResponse.cs @@ -1,7 +1,7 @@ -namespace Cluckwork.Api.Validation; - using FluentValidation.Results; +namespace Cluckwork.Api.Validation; + // Additive `errorCodes` companion to the standard `errors` dictionary (#45). // // `errors` is unchanged: { field: ["English message", ...] }. `errorCodes` is a diff --git a/src/Cluckwork.Application/Common/IFlockScopeGuard.cs b/src/Cluckwork.Application/Common/IFlockScopeGuard.cs index 59a9a9fa8..2d25be38f 100644 --- a/src/Cluckwork.Application/Common/IFlockScopeGuard.cs +++ b/src/Cluckwork.Application/Common/IFlockScopeGuard.cs @@ -1,7 +1,7 @@ -namespace Cluckwork.Application.Common; - using Cluckwork.Domain.Common; +namespace Cluckwork.Application.Common; + // #103 (spec §5.3): workers may record production only for assigned flocks. // Owners/Managers always pass. A worker with NO assignment rows keeps // account-wide access (grandfathering #73 workers); the first assignment diff --git a/src/Cluckwork.Application/Common/IIdentityProvider.cs b/src/Cluckwork.Application/Common/IIdentityProvider.cs index 27874df21..3c35cb1c3 100644 --- a/src/Cluckwork.Application/Common/IIdentityProvider.cs +++ b/src/Cluckwork.Application/Common/IIdentityProvider.cs @@ -1,7 +1,7 @@ -namespace Cluckwork.Application.Common; - using Cluckwork.Domain.Catalog; +namespace Cluckwork.Application.Common; + public enum RefreshTokenRevocationOutcome { OutOfScope, diff --git a/src/Cluckwork.Application/Common/IStepUpGrantService.cs b/src/Cluckwork.Application/Common/IStepUpGrantService.cs index 6ca838325..65358fb5b 100644 --- a/src/Cluckwork.Application/Common/IStepUpGrantService.cs +++ b/src/Cluckwork.Application/Common/IStepUpGrantService.cs @@ -1,7 +1,7 @@ -namespace Cluckwork.Application.Common; - using Cluckwork.Domain.Common; +namespace Cluckwork.Application.Common; + // #308/#360/#606 — recent-authentication proof required for every interactive // user creation, administrative password reset, role change (#355), // login-email change and disable/re-enable (#356), and flock assignment or diff --git a/src/Cluckwork.Application/Common/ResultLogging.cs b/src/Cluckwork.Application/Common/ResultLogging.cs index 00c3f18d4..7ebd679c1 100644 --- a/src/Cluckwork.Application/Common/ResultLogging.cs +++ b/src/Cluckwork.Application/Common/ResultLogging.cs @@ -1,8 +1,8 @@ -namespace Cluckwork.Application.Common; - using Cluckwork.Domain.Common; using Microsoft.Extensions.Logging; +namespace Cluckwork.Application.Common; + // #216 — expected failures surface as Warning with the failure reason, one // consistent shape across every money-path handler (ErrorCode is the stable // query key). Success transitions log Information in the handlers themselves. diff --git a/src/Cluckwork.Application/Features/Accounts/FarmSettingsRules.cs b/src/Cluckwork.Application/Features/Accounts/FarmSettingsRules.cs index bd7cbe827..fff0b01ab 100644 --- a/src/Cluckwork.Application/Features/Accounts/FarmSettingsRules.cs +++ b/src/Cluckwork.Application/Features/Accounts/FarmSettingsRules.cs @@ -1,7 +1,7 @@ -namespace Cluckwork.Application.Features.Accounts; - using System.Globalization; +namespace Cluckwork.Application.Features.Accounts; + public static class FarmSettingsRules { public static bool IsKnownTimeZone(string? timeZoneId) diff --git a/src/Cluckwork.Application/Features/Accounts/IAccountRepository.cs b/src/Cluckwork.Application/Features/Accounts/IAccountRepository.cs index f4532fa46..e5248f7d5 100644 --- a/src/Cluckwork.Application/Features/Accounts/IAccountRepository.cs +++ b/src/Cluckwork.Application/Features/Accounts/IAccountRepository.cs @@ -1,7 +1,7 @@ -namespace Cluckwork.Application.Features.Accounts; - using Cluckwork.Domain.Accounts; +namespace Cluckwork.Application.Features.Accounts; + public interface IAccountRepository { // The current tenant's account (query-filter scoped). Untracked — every diff --git a/src/Cluckwork.Application/Features/Accounts/IFarmLogoRepository.cs b/src/Cluckwork.Application/Features/Accounts/IFarmLogoRepository.cs index df7e71b95..5f089b470 100644 --- a/src/Cluckwork.Application/Features/Accounts/IFarmLogoRepository.cs +++ b/src/Cluckwork.Application/Features/Accounts/IFarmLogoRepository.cs @@ -1,7 +1,7 @@ -namespace Cluckwork.Application.Features.Accounts; - using Cluckwork.Domain.Accounts; +namespace Cluckwork.Application.Features.Accounts; + // The logo/banner bytes are the largest thing this application stores, so the // port is split by how much of the row each caller actually needs (#123), and // by which of the two independent images (logo vs banner, #179) it wants — a diff --git a/src/Cluckwork.Application/Features/Accounts/RemoveFarmBanner/RemoveFarmBannerHandler.cs b/src/Cluckwork.Application/Features/Accounts/RemoveFarmBanner/RemoveFarmBannerHandler.cs index 1072f00f9..ee4f1d3a9 100644 --- a/src/Cluckwork.Application/Features/Accounts/RemoveFarmBanner/RemoveFarmBannerHandler.cs +++ b/src/Cluckwork.Application/Features/Accounts/RemoveFarmBanner/RemoveFarmBannerHandler.cs @@ -1,9 +1,9 @@ -namespace Cluckwork.Application.Features.Accounts.RemoveFarmBanner; - using Cluckwork.Application.Common; using Cluckwork.Domain.Accounts; using Cluckwork.Domain.Common; +namespace Cluckwork.Application.Features.Accounts.RemoveFarmBanner; + // #179 — clear the farm banner. Mirrors RemoveFarmLogoHandler: clears only the // banner's own columns, and deletes the shared row only once the logo is also // unset (see FarmLogo.cs for why the row is shared). diff --git a/src/Cluckwork.Application/Features/Accounts/RemoveFarmLogo/RemoveFarmLogoHandler.cs b/src/Cluckwork.Application/Features/Accounts/RemoveFarmLogo/RemoveFarmLogoHandler.cs index 3ec87da54..3f5580e77 100644 --- a/src/Cluckwork.Application/Features/Accounts/RemoveFarmLogo/RemoveFarmLogoHandler.cs +++ b/src/Cluckwork.Application/Features/Accounts/RemoveFarmLogo/RemoveFarmLogoHandler.cs @@ -1,9 +1,9 @@ -namespace Cluckwork.Application.Features.Accounts.RemoveFarmLogo; - using Cluckwork.Application.Common; using Cluckwork.Domain.Accounts; using Cluckwork.Domain.Common; +namespace Cluckwork.Application.Features.Accounts.RemoveFarmLogo; + // #123 — clear the farm logo, falling the SPA chrome back to app branding. public sealed class RemoveFarmLogoHandler( IFarmLogoRepository logos, diff --git a/src/Cluckwork.Application/Features/Accounts/SetFarmBanner/SetFarmBannerHandler.cs b/src/Cluckwork.Application/Features/Accounts/SetFarmBanner/SetFarmBannerHandler.cs index 7c0629fe6..045efe502 100644 --- a/src/Cluckwork.Application/Features/Accounts/SetFarmBanner/SetFarmBannerHandler.cs +++ b/src/Cluckwork.Application/Features/Accounts/SetFarmBanner/SetFarmBannerHandler.cs @@ -1,10 +1,10 @@ -namespace Cluckwork.Application.Features.Accounts.SetFarmBanner; - using Cluckwork.Application.Common; using Cluckwork.Domain.Accounts; using Cluckwork.Domain.Common; using Cluckwork.Domain.Media; +namespace Cluckwork.Application.Features.Accounts.SetFarmBanner; + // #179 — upload or replace the farm banner. Mirrors SetFarmLogoHandler exactly; // the only difference is which side of the shared FarmLogo row it writes and // which ImageAssetKind it sanitizes against (see ImageSanitizer.ImageAssetKind). diff --git a/src/Cluckwork.Application/Features/Accounts/SetFarmLogo/SetFarmLogoHandler.cs b/src/Cluckwork.Application/Features/Accounts/SetFarmLogo/SetFarmLogoHandler.cs index 831e52582..15ae11431 100644 --- a/src/Cluckwork.Application/Features/Accounts/SetFarmLogo/SetFarmLogoHandler.cs +++ b/src/Cluckwork.Application/Features/Accounts/SetFarmLogo/SetFarmLogoHandler.cs @@ -1,10 +1,10 @@ -namespace Cluckwork.Application.Features.Accounts.SetFarmLogo; - using Cluckwork.Application.Common; using Cluckwork.Domain.Accounts; using Cluckwork.Domain.Common; using Cluckwork.Domain.Media; +namespace Cluckwork.Application.Features.Accounts.SetFarmLogo; + // #123 — upload or replace the farm logo. // // The uploaded bytes are never stored. ImageSanitizer walks the container and diff --git a/src/Cluckwork.Application/Features/Accounts/UpdateFarmSettings/UpdateFarmSettingsHandler.cs b/src/Cluckwork.Application/Features/Accounts/UpdateFarmSettings/UpdateFarmSettingsHandler.cs index 56b1ce474..607b82bf8 100644 --- a/src/Cluckwork.Application/Features/Accounts/UpdateFarmSettings/UpdateFarmSettingsHandler.cs +++ b/src/Cluckwork.Application/Features/Accounts/UpdateFarmSettings/UpdateFarmSettingsHandler.cs @@ -1,11 +1,11 @@ -namespace Cluckwork.Application.Features.Accounts.UpdateFarmSettings; - using Cluckwork.Application.Common; using Cluckwork.Application.Features.Catalog; using Cluckwork.Domain.Accounts; using Cluckwork.Domain.Catalog; using Cluckwork.Domain.Sales; +namespace Cluckwork.Application.Features.Accounts.UpdateFarmSettings; + public sealed class UpdateFarmSettingsHandler( IAccountRepository accounts, ICurrencyBoundRowProbe currencyBoundRows, diff --git a/src/Cluckwork.Application/Features/Accounts/UpdateFarmSettings/UpdateFarmSettingsValidator.cs b/src/Cluckwork.Application/Features/Accounts/UpdateFarmSettings/UpdateFarmSettingsValidator.cs index 082796996..ca4e53552 100644 --- a/src/Cluckwork.Application/Features/Accounts/UpdateFarmSettings/UpdateFarmSettingsValidator.cs +++ b/src/Cluckwork.Application/Features/Accounts/UpdateFarmSettings/UpdateFarmSettingsValidator.cs @@ -1,5 +1,3 @@ -namespace Cluckwork.Application.Features.Accounts.UpdateFarmSettings; - using System.Globalization; using Cluckwork.Application.Features.Accounts; using Cluckwork.Domain.Accounts; @@ -7,6 +5,8 @@ namespace Cluckwork.Application.Features.Accounts.UpdateFarmSettings; using Cluckwork.Domain.Sales; using FluentValidation; +namespace Cluckwork.Application.Features.Accounts.UpdateFarmSettings; + public sealed class UpdateFarmSettingsValidator : AbstractValidator { // A sample instant with an unambiguous day, month, hour and minute, so a diff --git a/src/Cluckwork.Application/Features/Audit/IAuditEventRepository.cs b/src/Cluckwork.Application/Features/Audit/IAuditEventRepository.cs index e3f0e8ece..dbe228859 100644 --- a/src/Cluckwork.Application/Features/Audit/IAuditEventRepository.cs +++ b/src/Cluckwork.Application/Features/Audit/IAuditEventRepository.cs @@ -1,7 +1,7 @@ -namespace Cluckwork.Application.Features.Audit; - using Cluckwork.Domain.Auditing; +namespace Cluckwork.Application.Features.Audit; + // Read side of the audit trail (#93). Append happens through IAuditWriter; // there is intentionally no update/remove surface anywhere. public interface IAuditEventRepository diff --git a/src/Cluckwork.Application/Features/Catalog/CreateProduct/CreateProductHandler.cs b/src/Cluckwork.Application/Features/Catalog/CreateProduct/CreateProductHandler.cs index ee97367dd..8bcda8724 100644 --- a/src/Cluckwork.Application/Features/Catalog/CreateProduct/CreateProductHandler.cs +++ b/src/Cluckwork.Application/Features/Catalog/CreateProduct/CreateProductHandler.cs @@ -1,5 +1,3 @@ -namespace Cluckwork.Application.Features.Catalog.CreateProduct; - using Cluckwork.Application.Common; using Cluckwork.Application.Features.Accounts; using Cluckwork.Application.Features.EggGrades; @@ -7,6 +5,8 @@ namespace Cluckwork.Application.Features.Catalog.CreateProduct; using Cluckwork.Domain.Catalog; using Cluckwork.Domain.Common; +namespace Cluckwork.Application.Features.Catalog.CreateProduct; + public sealed class CreateProductHandler( IProductRepository products, IEggGradeRepository grades, diff --git a/src/Cluckwork.Application/Features/Catalog/CreateProduct/CreateProductValidator.cs b/src/Cluckwork.Application/Features/Catalog/CreateProduct/CreateProductValidator.cs index 14b6d72fc..003aeaf30 100644 --- a/src/Cluckwork.Application/Features/Catalog/CreateProduct/CreateProductValidator.cs +++ b/src/Cluckwork.Application/Features/Catalog/CreateProduct/CreateProductValidator.cs @@ -1,8 +1,8 @@ -namespace Cluckwork.Application.Features.Catalog.CreateProduct; - using Cluckwork.Domain.Catalog; using FluentValidation; +namespace Cluckwork.Application.Features.Catalog.CreateProduct; + public sealed class CreateProductValidator : AbstractValidator { // Egg products may only use units that resolve to eggs through diff --git a/src/Cluckwork.Application/Features/Catalog/ICatalogRepositories.cs b/src/Cluckwork.Application/Features/Catalog/ICatalogRepositories.cs index 1eeba21f9..e898ced3c 100644 --- a/src/Cluckwork.Application/Features/Catalog/ICatalogRepositories.cs +++ b/src/Cluckwork.Application/Features/Catalog/ICatalogRepositories.cs @@ -1,7 +1,7 @@ -namespace Cluckwork.Application.Features.Catalog; - using Cluckwork.Domain.Catalog; +namespace Cluckwork.Application.Features.Catalog; + public interface IProductRepository { Task GetByIdAsync(Guid id, CancellationToken ct = default); diff --git a/src/Cluckwork.Application/Features/Catalog/SetProductActive/SetProductActiveHandler.cs b/src/Cluckwork.Application/Features/Catalog/SetProductActive/SetProductActiveHandler.cs index 5273b2c3c..2dfdd6c30 100644 --- a/src/Cluckwork.Application/Features/Catalog/SetProductActive/SetProductActiveHandler.cs +++ b/src/Cluckwork.Application/Features/Catalog/SetProductActive/SetProductActiveHandler.cs @@ -1,9 +1,9 @@ -namespace Cluckwork.Application.Features.Catalog.SetProductActive; - using Cluckwork.Application.Common; using Cluckwork.Domain.Catalog; using Cluckwork.Domain.Common; +namespace Cluckwork.Application.Features.Catalog.SetProductActive; + public sealed class SetProductActiveHandler( IProductRepository products, IUnitOfWork unitOfWork, diff --git a/src/Cluckwork.Application/Features/Catalog/UpdateEggUnitConversion/UpdateEggUnitConversionHandler.cs b/src/Cluckwork.Application/Features/Catalog/UpdateEggUnitConversion/UpdateEggUnitConversionHandler.cs index 00386191e..7bb589672 100644 --- a/src/Cluckwork.Application/Features/Catalog/UpdateEggUnitConversion/UpdateEggUnitConversionHandler.cs +++ b/src/Cluckwork.Application/Features/Catalog/UpdateEggUnitConversion/UpdateEggUnitConversionHandler.cs @@ -1,9 +1,9 @@ -namespace Cluckwork.Application.Features.Catalog.UpdateEggUnitConversion; - using Cluckwork.Application.Common; using Cluckwork.Domain.Catalog; using Cluckwork.Domain.Common; +namespace Cluckwork.Application.Features.Catalog.UpdateEggUnitConversion; + public sealed record UpdateEggUnitConversionCommand(Guid ConversionId, int EggsPerUnit, bool Active); public sealed class UpdateEggUnitConversionHandler( diff --git a/src/Cluckwork.Application/Features/Catalog/UpdateEggUnitConversion/UpdateEggUnitConversionValidator.cs b/src/Cluckwork.Application/Features/Catalog/UpdateEggUnitConversion/UpdateEggUnitConversionValidator.cs index 0ec9ca742..f59b64821 100644 --- a/src/Cluckwork.Application/Features/Catalog/UpdateEggUnitConversion/UpdateEggUnitConversionValidator.cs +++ b/src/Cluckwork.Application/Features/Catalog/UpdateEggUnitConversion/UpdateEggUnitConversionValidator.cs @@ -1,7 +1,7 @@ -namespace Cluckwork.Application.Features.Catalog.UpdateEggUnitConversion; - using FluentValidation; +namespace Cluckwork.Application.Features.Catalog.UpdateEggUnitConversion; + public sealed class UpdateEggUnitConversionValidator : AbstractValidator { public UpdateEggUnitConversionValidator() diff --git a/src/Cluckwork.Application/Features/Catalog/UpdateProduct/UpdateProductHandler.cs b/src/Cluckwork.Application/Features/Catalog/UpdateProduct/UpdateProductHandler.cs index cd820280a..fd68dd9d5 100644 --- a/src/Cluckwork.Application/Features/Catalog/UpdateProduct/UpdateProductHandler.cs +++ b/src/Cluckwork.Application/Features/Catalog/UpdateProduct/UpdateProductHandler.cs @@ -1,11 +1,11 @@ -namespace Cluckwork.Application.Features.Catalog.UpdateProduct; - using Cluckwork.Application.Common; using Cluckwork.Application.Features.Accounts; using Cluckwork.Application.Features.EggGrades; using Cluckwork.Domain.Catalog; using Cluckwork.Domain.Common; +namespace Cluckwork.Application.Features.Catalog.UpdateProduct; + public sealed class UpdateProductHandler( IProductRepository products, IEggGradeRepository grades, diff --git a/src/Cluckwork.Application/Features/Catalog/UpdateProduct/UpdateProductValidator.cs b/src/Cluckwork.Application/Features/Catalog/UpdateProduct/UpdateProductValidator.cs index e733ae282..03fa9a610 100644 --- a/src/Cluckwork.Application/Features/Catalog/UpdateProduct/UpdateProductValidator.cs +++ b/src/Cluckwork.Application/Features/Catalog/UpdateProduct/UpdateProductValidator.cs @@ -1,8 +1,8 @@ -namespace Cluckwork.Application.Features.Catalog.UpdateProduct; - using Cluckwork.Domain.Catalog; using FluentValidation; +namespace Cluckwork.Application.Features.Catalog.UpdateProduct; + public sealed class UpdateProductValidator : AbstractValidator { public UpdateProductValidator() diff --git a/src/Cluckwork.Application/Features/Customers/CreateCustomer/CreateCustomerHandler.cs b/src/Cluckwork.Application/Features/Customers/CreateCustomer/CreateCustomerHandler.cs index 0b57b6887..560c9de47 100644 --- a/src/Cluckwork.Application/Features/Customers/CreateCustomer/CreateCustomerHandler.cs +++ b/src/Cluckwork.Application/Features/Customers/CreateCustomer/CreateCustomerHandler.cs @@ -1,10 +1,10 @@ -namespace Cluckwork.Application.Features.Customers.CreateCustomer; - using Cluckwork.Application.Common; using Cluckwork.Application.Features.Customers; using Cluckwork.Domain.Common; using Cluckwork.Domain.Sales; +namespace Cluckwork.Application.Features.Customers.CreateCustomer; + public sealed class CreateCustomerHandler( ICustomerRepository customers, IUnitOfWork unitOfWork, diff --git a/src/Cluckwork.Application/Features/Customers/CreateCustomer/CreateCustomerValidator.cs b/src/Cluckwork.Application/Features/Customers/CreateCustomer/CreateCustomerValidator.cs index 1d192d0b2..30c741978 100644 --- a/src/Cluckwork.Application/Features/Customers/CreateCustomer/CreateCustomerValidator.cs +++ b/src/Cluckwork.Application/Features/Customers/CreateCustomer/CreateCustomerValidator.cs @@ -1,8 +1,8 @@ -namespace Cluckwork.Application.Features.Customers.CreateCustomer; - using Cluckwork.Domain.Sales; using FluentValidation; +namespace Cluckwork.Application.Features.Customers.CreateCustomer; + public sealed class CreateCustomerValidator : AbstractValidator { public CreateCustomerValidator() diff --git a/src/Cluckwork.Application/Features/Customers/ICustomerRepository.cs b/src/Cluckwork.Application/Features/Customers/ICustomerRepository.cs index 1a58e6152..872344d0f 100644 --- a/src/Cluckwork.Application/Features/Customers/ICustomerRepository.cs +++ b/src/Cluckwork.Application/Features/Customers/ICustomerRepository.cs @@ -1,8 +1,8 @@ -namespace Cluckwork.Application.Features.Customers; - using Cluckwork.Application.Common; using Cluckwork.Domain.Sales; +namespace Cluckwork.Application.Features.Customers; + public interface ICustomerRepository : IRepository { Task> ListAsync(int limit, int offset, CancellationToken ct = default); diff --git a/src/Cluckwork.Application/Features/Customers/UpdateCustomer/UpdateCustomerHandler.cs b/src/Cluckwork.Application/Features/Customers/UpdateCustomer/UpdateCustomerHandler.cs index 6841c74bf..b59a2dcd0 100644 --- a/src/Cluckwork.Application/Features/Customers/UpdateCustomer/UpdateCustomerHandler.cs +++ b/src/Cluckwork.Application/Features/Customers/UpdateCustomer/UpdateCustomerHandler.cs @@ -1,10 +1,10 @@ -namespace Cluckwork.Application.Features.Customers.UpdateCustomer; - using Cluckwork.Application.Common; using Cluckwork.Application.Features.Customers; using Cluckwork.Domain.Common; using Cluckwork.Domain.Sales; +namespace Cluckwork.Application.Features.Customers.UpdateCustomer; + public sealed class UpdateCustomerHandler( ICustomerRepository customers, IUnitOfWork unitOfWork, diff --git a/src/Cluckwork.Application/Features/Customers/UpdateCustomer/UpdateCustomerValidator.cs b/src/Cluckwork.Application/Features/Customers/UpdateCustomer/UpdateCustomerValidator.cs index c5783b45c..c1a6a2add 100644 --- a/src/Cluckwork.Application/Features/Customers/UpdateCustomer/UpdateCustomerValidator.cs +++ b/src/Cluckwork.Application/Features/Customers/UpdateCustomer/UpdateCustomerValidator.cs @@ -1,8 +1,8 @@ -namespace Cluckwork.Application.Features.Customers.UpdateCustomer; - using Cluckwork.Domain.Sales; using FluentValidation; +namespace Cluckwork.Application.Features.Customers.UpdateCustomer; + public sealed class UpdateCustomerValidator : AbstractValidator { public UpdateCustomerValidator() diff --git a/src/Cluckwork.Application/Features/DailyEntries/AdjustDailyEntry/AdjustDailyEntryCommand.cs b/src/Cluckwork.Application/Features/DailyEntries/AdjustDailyEntry/AdjustDailyEntryCommand.cs index 613acd71a..f02e49606 100644 --- a/src/Cluckwork.Application/Features/DailyEntries/AdjustDailyEntry/AdjustDailyEntryCommand.cs +++ b/src/Cluckwork.Application/Features/DailyEntries/AdjustDailyEntry/AdjustDailyEntryCommand.cs @@ -1,7 +1,7 @@ -namespace Cluckwork.Application.Features.DailyEntries.AdjustDailyEntry; - using Cluckwork.Application.Features.DailyEntries.RecordDailyEntry; +namespace Cluckwork.Application.Features.DailyEntries.AdjustDailyEntry; + // Version = the base the client loaded the entry at; a stale one gets a // deterministic 409 instead of silently overwriting another admin's // correction (same end-to-end contract as water corrections, PR #77). diff --git a/src/Cluckwork.Application/Features/DailyEntries/AdjustDailyEntry/AdjustDailyEntryHandler.cs b/src/Cluckwork.Application/Features/DailyEntries/AdjustDailyEntry/AdjustDailyEntryHandler.cs index 31cd7dc02..10458a5c1 100644 --- a/src/Cluckwork.Application/Features/DailyEntries/AdjustDailyEntry/AdjustDailyEntryHandler.cs +++ b/src/Cluckwork.Application/Features/DailyEntries/AdjustDailyEntry/AdjustDailyEntryHandler.cs @@ -1,5 +1,3 @@ -namespace Cluckwork.Application.Features.DailyEntries.AdjustDailyEntry; - using Cluckwork.Application.Common; using Cluckwork.Application.Features.DailyEntries; using Cluckwork.Application.Features.EggGrades; @@ -11,6 +9,8 @@ namespace Cluckwork.Application.Features.DailyEntries.AdjustDailyEntry; using Cluckwork.Domain.Flocks; using Microsoft.Extensions.Logging; +namespace Cluckwork.Application.Features.DailyEntries.AdjustDailyEntry; + // #69 — the corrective half of the production → stock bridge. Adjusting a // submitted/locked entry must keep three things consistent in ONE transaction: // the entry itself (totals + grade lines, ManagerAdjusted), its egg lots diff --git a/src/Cluckwork.Application/Features/DailyEntries/AdjustDailyEntry/AdjustDailyEntryValidator.cs b/src/Cluckwork.Application/Features/DailyEntries/AdjustDailyEntry/AdjustDailyEntryValidator.cs index 116e76fc7..67d3fba50 100644 --- a/src/Cluckwork.Application/Features/DailyEntries/AdjustDailyEntry/AdjustDailyEntryValidator.cs +++ b/src/Cluckwork.Application/Features/DailyEntries/AdjustDailyEntry/AdjustDailyEntryValidator.cs @@ -1,8 +1,8 @@ -namespace Cluckwork.Application.Features.DailyEntries.AdjustDailyEntry; - using Cluckwork.Domain.Eggs; using FluentValidation; +namespace Cluckwork.Application.Features.DailyEntries.AdjustDailyEntry; + public sealed class AdjustDailyEntryValidator : AbstractValidator { public AdjustDailyEntryValidator() diff --git a/src/Cluckwork.Application/Features/DailyEntries/ConditionGradeGuard.cs b/src/Cluckwork.Application/Features/DailyEntries/ConditionGradeGuard.cs index 4e2acca1f..175bfda83 100644 --- a/src/Cluckwork.Application/Features/DailyEntries/ConditionGradeGuard.cs +++ b/src/Cluckwork.Application/Features/DailyEntries/ConditionGradeGuard.cs @@ -1,9 +1,9 @@ -namespace Cluckwork.Application.Features.DailyEntries; - using Cluckwork.Application.Features.EggGrades; using Cluckwork.Domain.Common; using Cluckwork.Domain.Eggs; +namespace Cluckwork.Application.Features.DailyEntries; + // #396 — a condition grade is fed by its Daily Entry COUNTER and never by a // manual grade line. // diff --git a/src/Cluckwork.Application/Features/DailyEntries/IDailyEntryRepository.cs b/src/Cluckwork.Application/Features/DailyEntries/IDailyEntryRepository.cs index a3502b9ac..cdd1055c4 100644 --- a/src/Cluckwork.Application/Features/DailyEntries/IDailyEntryRepository.cs +++ b/src/Cluckwork.Application/Features/DailyEntries/IDailyEntryRepository.cs @@ -1,8 +1,8 @@ -namespace Cluckwork.Application.Features.DailyEntries; - using Cluckwork.Application.Common; using Cluckwork.Domain.Eggs; +namespace Cluckwork.Application.Features.DailyEntries; + public interface IDailyEntryRepository : IRepository { // Untracked read for GET endpoints (the tracked GetByIdAsync is the write path). diff --git a/src/Cluckwork.Application/Features/DailyEntries/RecordDailyEntry/RecordDailyEntryHandler.cs b/src/Cluckwork.Application/Features/DailyEntries/RecordDailyEntry/RecordDailyEntryHandler.cs index 89042e74e..adba9eb74 100644 --- a/src/Cluckwork.Application/Features/DailyEntries/RecordDailyEntry/RecordDailyEntryHandler.cs +++ b/src/Cluckwork.Application/Features/DailyEntries/RecordDailyEntry/RecordDailyEntryHandler.cs @@ -1,5 +1,3 @@ -namespace Cluckwork.Application.Features.DailyEntries.RecordDailyEntry; - using Cluckwork.Application.Common; using Cluckwork.Application.Features.DailyEntries; using Cluckwork.Application.Features.EggGrades; @@ -9,6 +7,8 @@ namespace Cluckwork.Application.Features.DailyEntries.RecordDailyEntry; using Cluckwork.Domain.Flocks; using Microsoft.Extensions.Logging; +namespace Cluckwork.Application.Features.DailyEntries.RecordDailyEntry; + public sealed class RecordDailyEntryHandler( IDailyEntryRepository repository, IEggGradeRepository eggGrades, diff --git a/src/Cluckwork.Application/Features/DailyEntries/RecordDailyEntry/RecordDailyEntryValidator.cs b/src/Cluckwork.Application/Features/DailyEntries/RecordDailyEntry/RecordDailyEntryValidator.cs index ccd44bf50..6c26908d1 100644 --- a/src/Cluckwork.Application/Features/DailyEntries/RecordDailyEntry/RecordDailyEntryValidator.cs +++ b/src/Cluckwork.Application/Features/DailyEntries/RecordDailyEntry/RecordDailyEntryValidator.cs @@ -1,8 +1,8 @@ -namespace Cluckwork.Application.Features.DailyEntries.RecordDailyEntry; - using Cluckwork.Application.Common; using FluentValidation; +namespace Cluckwork.Application.Features.DailyEntries.RecordDailyEntry; + public sealed class RecordDailyEntryValidator : AbstractValidator { public RecordDailyEntryValidator(IFarmClock farmClock) diff --git a/src/Cluckwork.Application/Features/DailyEntries/SubmitDailyEntry/SubmitDailyEntryHandler.cs b/src/Cluckwork.Application/Features/DailyEntries/SubmitDailyEntry/SubmitDailyEntryHandler.cs index 5b3bc3ffb..e0b659d2c 100644 --- a/src/Cluckwork.Application/Features/DailyEntries/SubmitDailyEntry/SubmitDailyEntryHandler.cs +++ b/src/Cluckwork.Application/Features/DailyEntries/SubmitDailyEntry/SubmitDailyEntryHandler.cs @@ -1,5 +1,3 @@ -namespace Cluckwork.Application.Features.DailyEntries.SubmitDailyEntry; - using Cluckwork.Application.Common; using Cluckwork.Application.Features.EggGrades; using Cluckwork.Application.Features.EggLots; @@ -10,6 +8,8 @@ namespace Cluckwork.Application.Features.DailyEntries.SubmitDailyEntry; using Cluckwork.Domain.Flocks; using Microsoft.Extensions.Logging; +namespace Cluckwork.Application.Features.DailyEntries.SubmitDailyEntry; + // The production -> stock bridge (#8): submitting a daily entry turns its grade // lines into egg lots, one lot per grade, dated by the entry, and its mortality // count into a bird-movement ledger row (#54). Submit + lots + movement commit diff --git a/src/Cluckwork.Application/Features/DailyEntries/VoidDailyEntry/VoidDailyEntryHandler.cs b/src/Cluckwork.Application/Features/DailyEntries/VoidDailyEntry/VoidDailyEntryHandler.cs index 823afcaf5..56da7d7a7 100644 --- a/src/Cluckwork.Application/Features/DailyEntries/VoidDailyEntry/VoidDailyEntryHandler.cs +++ b/src/Cluckwork.Application/Features/DailyEntries/VoidDailyEntry/VoidDailyEntryHandler.cs @@ -1,5 +1,3 @@ -namespace Cluckwork.Application.Features.DailyEntries.VoidDailyEntry; - using Cluckwork.Application.Common; using Cluckwork.Application.Features.DailyEntries; using Cluckwork.Application.Features.EggGrades; @@ -11,6 +9,8 @@ namespace Cluckwork.Application.Features.DailyEntries.VoidDailyEntry; using Cluckwork.Domain.Flocks; using Microsoft.Extensions.Logging; +namespace Cluckwork.Application.Features.DailyEntries.VoidDailyEntry; + // #69 (spec §8.1/§9.5) — void reverses everything the entry's submit created: // each egg lot is emptied (blocked if any of its eggs were already sold), the // day's mortality gets a compensating negative Adjustment ledger row, and the diff --git a/src/Cluckwork.Application/Features/DailyEntries/VoidDailyEntry/VoidDailyEntryValidator.cs b/src/Cluckwork.Application/Features/DailyEntries/VoidDailyEntry/VoidDailyEntryValidator.cs index 952d8a3b9..1ff945142 100644 --- a/src/Cluckwork.Application/Features/DailyEntries/VoidDailyEntry/VoidDailyEntryValidator.cs +++ b/src/Cluckwork.Application/Features/DailyEntries/VoidDailyEntry/VoidDailyEntryValidator.cs @@ -1,8 +1,8 @@ -namespace Cluckwork.Application.Features.DailyEntries.VoidDailyEntry; - using Cluckwork.Domain.Eggs; using FluentValidation; +namespace Cluckwork.Application.Features.DailyEntries.VoidDailyEntry; + public sealed class VoidDailyEntryValidator : AbstractValidator { public VoidDailyEntryValidator() diff --git a/src/Cluckwork.Application/Features/EggGrades/CreateEggGrade/CreateEggGradeHandler.cs b/src/Cluckwork.Application/Features/EggGrades/CreateEggGrade/CreateEggGradeHandler.cs index fd4a5dc33..eedb1fa3e 100644 --- a/src/Cluckwork.Application/Features/EggGrades/CreateEggGrade/CreateEggGradeHandler.cs +++ b/src/Cluckwork.Application/Features/EggGrades/CreateEggGrade/CreateEggGradeHandler.cs @@ -1,10 +1,10 @@ -namespace Cluckwork.Application.Features.EggGrades.CreateEggGrade; - using Cluckwork.Application.Common; using Cluckwork.Domain.Accounts; using Cluckwork.Domain.Common; using Cluckwork.Domain.Eggs; +namespace Cluckwork.Application.Features.EggGrades.CreateEggGrade; + public sealed class CreateEggGradeHandler( IEggGradeRepository grades, IAuditWriter audit, diff --git a/src/Cluckwork.Application/Features/EggGrades/CreateEggGrade/CreateEggGradeValidator.cs b/src/Cluckwork.Application/Features/EggGrades/CreateEggGrade/CreateEggGradeValidator.cs index de748a588..eb6402c41 100644 --- a/src/Cluckwork.Application/Features/EggGrades/CreateEggGrade/CreateEggGradeValidator.cs +++ b/src/Cluckwork.Application/Features/EggGrades/CreateEggGrade/CreateEggGradeValidator.cs @@ -1,8 +1,8 @@ -namespace Cluckwork.Application.Features.EggGrades.CreateEggGrade; - using Cluckwork.Domain.Eggs; using FluentValidation; +namespace Cluckwork.Application.Features.EggGrades.CreateEggGrade; + public sealed class CreateEggGradeValidator : AbstractValidator { public CreateEggGradeValidator() diff --git a/src/Cluckwork.Application/Features/EggGrades/EggGradeFloorPolicy.cs b/src/Cluckwork.Application/Features/EggGrades/EggGradeFloorPolicy.cs index 405b151c1..2ead9c7e1 100644 --- a/src/Cluckwork.Application/Features/EggGrades/EggGradeFloorPolicy.cs +++ b/src/Cluckwork.Application/Features/EggGrades/EggGradeFloorPolicy.cs @@ -1,8 +1,8 @@ -namespace Cluckwork.Application.Features.EggGrades; - using Cluckwork.Application.Common; using Cluckwork.Domain.Accounts; +namespace Cluckwork.Application.Features.EggGrades; + // #911 — who may put a low-stock floor on a grade. One place, because two // handlers ask it and a screen asks the same question from the token: a second // copy would let the Grades dialog offer a field the handler refuses. diff --git a/src/Cluckwork.Application/Features/EggGrades/IEggGradeRepository.cs b/src/Cluckwork.Application/Features/EggGrades/IEggGradeRepository.cs index 12b762261..5cb0f0d53 100644 --- a/src/Cluckwork.Application/Features/EggGrades/IEggGradeRepository.cs +++ b/src/Cluckwork.Application/Features/EggGrades/IEggGradeRepository.cs @@ -1,8 +1,8 @@ -namespace Cluckwork.Application.Features.EggGrades; - using Cluckwork.Application.Common; using Cluckwork.Domain.Eggs; +namespace Cluckwork.Application.Features.EggGrades; + public interface IEggGradeRepository : IRepository { // Active grades for the current tenant, saleable and not, in sort order. diff --git a/src/Cluckwork.Application/Features/EggGrades/SetEggGradeActive/SetEggGradeActiveHandler.cs b/src/Cluckwork.Application/Features/EggGrades/SetEggGradeActive/SetEggGradeActiveHandler.cs index 7883d01fe..727bd72aa 100644 --- a/src/Cluckwork.Application/Features/EggGrades/SetEggGradeActive/SetEggGradeActiveHandler.cs +++ b/src/Cluckwork.Application/Features/EggGrades/SetEggGradeActive/SetEggGradeActiveHandler.cs @@ -1,8 +1,8 @@ -namespace Cluckwork.Application.Features.EggGrades.SetEggGradeActive; - using Cluckwork.Application.Common; using Cluckwork.Domain.Common; +namespace Cluckwork.Application.Features.EggGrades.SetEggGradeActive; + // Backs both POST /egg-grades/{id}/activate and /deactivate. Deactivation only // stops NEW grading/order lines (capture flows filter to active grades); live // stock in the grade keeps selling until the lots drain, and historical rows diff --git a/src/Cluckwork.Application/Features/EggGrades/UpdateEggGrade/UpdateEggGradeHandler.cs b/src/Cluckwork.Application/Features/EggGrades/UpdateEggGrade/UpdateEggGradeHandler.cs index 739bb9359..0ae73b08d 100644 --- a/src/Cluckwork.Application/Features/EggGrades/UpdateEggGrade/UpdateEggGradeHandler.cs +++ b/src/Cluckwork.Application/Features/EggGrades/UpdateEggGrade/UpdateEggGradeHandler.cs @@ -1,8 +1,8 @@ -namespace Cluckwork.Application.Features.EggGrades.UpdateEggGrade; - using Cluckwork.Application.Common; using Cluckwork.Domain.Common; +namespace Cluckwork.Application.Features.EggGrades.UpdateEggGrade; + public sealed class UpdateEggGradeHandler( IEggGradeRepository grades, IUnitOfWork unitOfWork, diff --git a/src/Cluckwork.Application/Features/EggGrades/UpdateEggGrade/UpdateEggGradeValidator.cs b/src/Cluckwork.Application/Features/EggGrades/UpdateEggGrade/UpdateEggGradeValidator.cs index ee715b41d..b5cb20ac2 100644 --- a/src/Cluckwork.Application/Features/EggGrades/UpdateEggGrade/UpdateEggGradeValidator.cs +++ b/src/Cluckwork.Application/Features/EggGrades/UpdateEggGrade/UpdateEggGradeValidator.cs @@ -1,8 +1,8 @@ -namespace Cluckwork.Application.Features.EggGrades.UpdateEggGrade; - using Cluckwork.Domain.Eggs; using FluentValidation; +namespace Cluckwork.Application.Features.EggGrades.UpdateEggGrade; + public sealed class UpdateEggGradeValidator : AbstractValidator { public UpdateEggGradeValidator() diff --git a/src/Cluckwork.Application/Features/EggLots/IEggLotRepository.cs b/src/Cluckwork.Application/Features/EggLots/IEggLotRepository.cs index e9bf0546c..0040155d2 100644 --- a/src/Cluckwork.Application/Features/EggLots/IEggLotRepository.cs +++ b/src/Cluckwork.Application/Features/EggLots/IEggLotRepository.cs @@ -1,8 +1,8 @@ -namespace Cluckwork.Application.Features.EggLots; - using Cluckwork.Application.Common; using Cluckwork.Domain.Eggs; +namespace Cluckwork.Application.Features.EggLots; + public interface IEggLotRepository : IRepository { // Returns FIFO-ordered available lots for the account across ALL requested diff --git a/src/Cluckwork.Application/Features/EggLots/RecordEggLotMovement/RecordEggLotMovementHandler.cs b/src/Cluckwork.Application/Features/EggLots/RecordEggLotMovement/RecordEggLotMovementHandler.cs index a0ba566c5..9959a315b 100644 --- a/src/Cluckwork.Application/Features/EggLots/RecordEggLotMovement/RecordEggLotMovementHandler.cs +++ b/src/Cluckwork.Application/Features/EggLots/RecordEggLotMovement/RecordEggLotMovementHandler.cs @@ -1,11 +1,11 @@ -namespace Cluckwork.Application.Features.EggLots.RecordEggLotMovement; - using Cluckwork.Application.Common; using Cluckwork.Application.Features.Eggs; using Cluckwork.Domain.Common; using Cluckwork.Domain.Eggs; using Microsoft.Extensions.Logging; +namespace Cluckwork.Application.Features.EggLots.RecordEggLotMovement; + // Standalone stock write-off / reconciliation (#406): removes lost stock // (breakage, spoilage, internal use) or applies a recount via a compensating // ledger row — production is never restated; that is the daily entry's fact. diff --git a/src/Cluckwork.Application/Features/EggLots/RecordEggLotMovement/RecordEggLotMovementValidator.cs b/src/Cluckwork.Application/Features/EggLots/RecordEggLotMovement/RecordEggLotMovementValidator.cs index 09345ffca..7d88d9e8f 100644 --- a/src/Cluckwork.Application/Features/EggLots/RecordEggLotMovement/RecordEggLotMovementValidator.cs +++ b/src/Cluckwork.Application/Features/EggLots/RecordEggLotMovement/RecordEggLotMovementValidator.cs @@ -1,8 +1,8 @@ -namespace Cluckwork.Application.Features.EggLots.RecordEggLotMovement; - using Cluckwork.Domain.Eggs; using FluentValidation; +namespace Cluckwork.Application.Features.EggLots.RecordEggLotMovement; + public sealed class RecordEggLotMovementValidator : AbstractValidator { public RecordEggLotMovementValidator() diff --git a/src/Cluckwork.Application/Features/Eggs/IEggInventoryMovementRepository.cs b/src/Cluckwork.Application/Features/Eggs/IEggInventoryMovementRepository.cs index eb45d54a1..47b9ae0a7 100644 --- a/src/Cluckwork.Application/Features/Eggs/IEggInventoryMovementRepository.cs +++ b/src/Cluckwork.Application/Features/Eggs/IEggInventoryMovementRepository.cs @@ -1,7 +1,7 @@ -namespace Cluckwork.Application.Features.Eggs; - using Cluckwork.Domain.Eggs; +namespace Cluckwork.Application.Features.Eggs; + public interface IEggInventoryMovementRepository { Task AddAsync(EggInventoryMovement movement, CancellationToken ct = default); diff --git a/src/Cluckwork.Application/Features/Expenses/AdjustExpense/AdjustExpenseHandler.cs b/src/Cluckwork.Application/Features/Expenses/AdjustExpense/AdjustExpenseHandler.cs index a9015372f..714c7dd07 100644 --- a/src/Cluckwork.Application/Features/Expenses/AdjustExpense/AdjustExpenseHandler.cs +++ b/src/Cluckwork.Application/Features/Expenses/AdjustExpense/AdjustExpenseHandler.cs @@ -1,9 +1,9 @@ -namespace Cluckwork.Application.Features.Expenses.AdjustExpense; - using Cluckwork.Application.Common; using Cluckwork.Application.Features.Flocks; using Cluckwork.Domain.Common; +namespace Cluckwork.Application.Features.Expenses.AdjustExpense; + public sealed class AdjustExpenseHandler( IExpenseRepository expenses, IExpenseCategoryRepository categories, diff --git a/src/Cluckwork.Application/Features/Expenses/AdjustExpense/AdjustExpenseValidator.cs b/src/Cluckwork.Application/Features/Expenses/AdjustExpense/AdjustExpenseValidator.cs index 16efa46ba..38d3a7677 100644 --- a/src/Cluckwork.Application/Features/Expenses/AdjustExpense/AdjustExpenseValidator.cs +++ b/src/Cluckwork.Application/Features/Expenses/AdjustExpense/AdjustExpenseValidator.cs @@ -1,9 +1,9 @@ -namespace Cluckwork.Application.Features.Expenses.AdjustExpense; - using Cluckwork.Domain.Expenses; using Cluckwork.Application.Common; using FluentValidation; +namespace Cluckwork.Application.Features.Expenses.AdjustExpense; + public sealed class AdjustExpenseValidator : AbstractValidator { public AdjustExpenseValidator(IFarmClock farmClock) diff --git a/src/Cluckwork.Application/Features/Expenses/CreateExpense/CreateExpenseHandler.cs b/src/Cluckwork.Application/Features/Expenses/CreateExpense/CreateExpenseHandler.cs index b220abad3..a2fc7b400 100644 --- a/src/Cluckwork.Application/Features/Expenses/CreateExpense/CreateExpenseHandler.cs +++ b/src/Cluckwork.Application/Features/Expenses/CreateExpense/CreateExpenseHandler.cs @@ -1,5 +1,3 @@ -namespace Cluckwork.Application.Features.Expenses.CreateExpense; - using Cluckwork.Application.Common; using Cluckwork.Application.Features.Accounts; using Cluckwork.Application.Features.Flocks; @@ -7,6 +5,8 @@ namespace Cluckwork.Application.Features.Expenses.CreateExpense; using Cluckwork.Domain.Common; using Cluckwork.Domain.Expenses; +namespace Cluckwork.Application.Features.Expenses.CreateExpense; + public sealed class CreateExpenseHandler( IExpenseRepository expenses, IExpenseCategoryRepository categories, diff --git a/src/Cluckwork.Application/Features/Expenses/CreateExpense/CreateExpenseValidator.cs b/src/Cluckwork.Application/Features/Expenses/CreateExpense/CreateExpenseValidator.cs index eb373ea90..7350d260e 100644 --- a/src/Cluckwork.Application/Features/Expenses/CreateExpense/CreateExpenseValidator.cs +++ b/src/Cluckwork.Application/Features/Expenses/CreateExpense/CreateExpenseValidator.cs @@ -1,9 +1,9 @@ -namespace Cluckwork.Application.Features.Expenses.CreateExpense; - using Cluckwork.Domain.Expenses; using Cluckwork.Application.Common; using FluentValidation; +namespace Cluckwork.Application.Features.Expenses.CreateExpense; + public sealed class CreateExpenseValidator : AbstractValidator { public CreateExpenseValidator(IFarmClock farmClock) diff --git a/src/Cluckwork.Application/Features/Expenses/CreateExpenseCategory/CreateExpenseCategoryHandler.cs b/src/Cluckwork.Application/Features/Expenses/CreateExpenseCategory/CreateExpenseCategoryHandler.cs index 5ab632f43..94be2c65c 100644 --- a/src/Cluckwork.Application/Features/Expenses/CreateExpenseCategory/CreateExpenseCategoryHandler.cs +++ b/src/Cluckwork.Application/Features/Expenses/CreateExpenseCategory/CreateExpenseCategoryHandler.cs @@ -1,10 +1,10 @@ -namespace Cluckwork.Application.Features.Expenses.CreateExpenseCategory; - using Cluckwork.Application.Common; using Cluckwork.Domain.Accounts; using Cluckwork.Domain.Common; using Cluckwork.Domain.Expenses; +namespace Cluckwork.Application.Features.Expenses.CreateExpenseCategory; + public sealed class CreateExpenseCategoryHandler( IExpenseCategoryRepository categories, IUnitOfWork unitOfWork) diff --git a/src/Cluckwork.Application/Features/Expenses/CreateExpenseCategory/CreateExpenseCategoryValidator.cs b/src/Cluckwork.Application/Features/Expenses/CreateExpenseCategory/CreateExpenseCategoryValidator.cs index 78d8abd4f..83991087e 100644 --- a/src/Cluckwork.Application/Features/Expenses/CreateExpenseCategory/CreateExpenseCategoryValidator.cs +++ b/src/Cluckwork.Application/Features/Expenses/CreateExpenseCategory/CreateExpenseCategoryValidator.cs @@ -1,8 +1,8 @@ -namespace Cluckwork.Application.Features.Expenses.CreateExpenseCategory; - using Cluckwork.Domain.Expenses; using FluentValidation; +namespace Cluckwork.Application.Features.Expenses.CreateExpenseCategory; + public sealed class CreateExpenseCategoryValidator : AbstractValidator { public CreateExpenseCategoryValidator() diff --git a/src/Cluckwork.Application/Features/Expenses/IExpenseRepositories.cs b/src/Cluckwork.Application/Features/Expenses/IExpenseRepositories.cs index f0ea4c178..6d1f4f8aa 100644 --- a/src/Cluckwork.Application/Features/Expenses/IExpenseRepositories.cs +++ b/src/Cluckwork.Application/Features/Expenses/IExpenseRepositories.cs @@ -1,8 +1,8 @@ -namespace Cluckwork.Application.Features.Expenses; - using Cluckwork.Application.Common; using Cluckwork.Domain.Expenses; +namespace Cluckwork.Application.Features.Expenses; + public interface IExpenseCategoryRepository : IRepository { // Active categories for the current tenant's farm, name order. diff --git a/src/Cluckwork.Application/Features/Expenses/UpdateExpenseCategory/UpdateExpenseCategoryHandler.cs b/src/Cluckwork.Application/Features/Expenses/UpdateExpenseCategory/UpdateExpenseCategoryHandler.cs index a3695b03c..2758c25b0 100644 --- a/src/Cluckwork.Application/Features/Expenses/UpdateExpenseCategory/UpdateExpenseCategoryHandler.cs +++ b/src/Cluckwork.Application/Features/Expenses/UpdateExpenseCategory/UpdateExpenseCategoryHandler.cs @@ -1,8 +1,8 @@ -namespace Cluckwork.Application.Features.Expenses.UpdateExpenseCategory; - using Cluckwork.Application.Common; using Cluckwork.Domain.Common; +namespace Cluckwork.Application.Features.Expenses.UpdateExpenseCategory; + public sealed class UpdateExpenseCategoryHandler( IExpenseCategoryRepository categories, IUnitOfWork unitOfWork, diff --git a/src/Cluckwork.Application/Features/Expenses/UpdateExpenseCategory/UpdateExpenseCategoryValidator.cs b/src/Cluckwork.Application/Features/Expenses/UpdateExpenseCategory/UpdateExpenseCategoryValidator.cs index 7fc046af5..b59a1f3ba 100644 --- a/src/Cluckwork.Application/Features/Expenses/UpdateExpenseCategory/UpdateExpenseCategoryValidator.cs +++ b/src/Cluckwork.Application/Features/Expenses/UpdateExpenseCategory/UpdateExpenseCategoryValidator.cs @@ -1,8 +1,8 @@ -namespace Cluckwork.Application.Features.Expenses.UpdateExpenseCategory; - using Cluckwork.Domain.Expenses; using FluentValidation; +namespace Cluckwork.Application.Features.Expenses.UpdateExpenseCategory; + public sealed class UpdateExpenseCategoryValidator : AbstractValidator { public UpdateExpenseCategoryValidator() diff --git a/src/Cluckwork.Application/Features/Flocks/ArchiveFlock/ArchiveFlockHandler.cs b/src/Cluckwork.Application/Features/Flocks/ArchiveFlock/ArchiveFlockHandler.cs index 8d0b509e6..b0adcd514 100644 --- a/src/Cluckwork.Application/Features/Flocks/ArchiveFlock/ArchiveFlockHandler.cs +++ b/src/Cluckwork.Application/Features/Flocks/ArchiveFlock/ArchiveFlockHandler.cs @@ -1,10 +1,10 @@ -namespace Cluckwork.Application.Features.Flocks.ArchiveFlock; - using Cluckwork.Application.Common; using Cluckwork.Application.Features.Flocks; using Cluckwork.Domain.Common; using Cluckwork.Domain.Flocks; +namespace Cluckwork.Application.Features.Flocks.ArchiveFlock; + public sealed class ArchiveFlockHandler( IFlockRepository flocks, IUnitOfWork unitOfWork, diff --git a/src/Cluckwork.Application/Features/Flocks/CreateFlock/CreateFlockHandler.cs b/src/Cluckwork.Application/Features/Flocks/CreateFlock/CreateFlockHandler.cs index df41d9381..8db6004b7 100644 --- a/src/Cluckwork.Application/Features/Flocks/CreateFlock/CreateFlockHandler.cs +++ b/src/Cluckwork.Application/Features/Flocks/CreateFlock/CreateFlockHandler.cs @@ -1,11 +1,11 @@ -namespace Cluckwork.Application.Features.Flocks.CreateFlock; - using Cluckwork.Application.Common; using Cluckwork.Application.Features.Flocks; using Cluckwork.Domain.Accounts; using Cluckwork.Domain.Common; using Cluckwork.Domain.Flocks; +namespace Cluckwork.Application.Features.Flocks.CreateFlock; + public sealed class CreateFlockHandler( IFlockRepository flocks, IAuditWriter audit, diff --git a/src/Cluckwork.Application/Features/Flocks/CreateFlock/CreateFlockValidator.cs b/src/Cluckwork.Application/Features/Flocks/CreateFlock/CreateFlockValidator.cs index f715b6637..6df8cee58 100644 --- a/src/Cluckwork.Application/Features/Flocks/CreateFlock/CreateFlockValidator.cs +++ b/src/Cluckwork.Application/Features/Flocks/CreateFlock/CreateFlockValidator.cs @@ -1,8 +1,8 @@ -namespace Cluckwork.Application.Features.Flocks.CreateFlock; - using Cluckwork.Application.Common; using FluentValidation; +namespace Cluckwork.Application.Features.Flocks.CreateFlock; + public sealed class CreateFlockValidator : AbstractValidator { public CreateFlockValidator(IFarmClock farmClock) diff --git a/src/Cluckwork.Application/Features/Flocks/DepleteFlock/DepleteFlockHandler.cs b/src/Cluckwork.Application/Features/Flocks/DepleteFlock/DepleteFlockHandler.cs index 4eff3ff04..c1834f88f 100644 --- a/src/Cluckwork.Application/Features/Flocks/DepleteFlock/DepleteFlockHandler.cs +++ b/src/Cluckwork.Application/Features/Flocks/DepleteFlock/DepleteFlockHandler.cs @@ -1,10 +1,10 @@ -namespace Cluckwork.Application.Features.Flocks.DepleteFlock; - using Cluckwork.Application.Common; using Cluckwork.Application.Features.Flocks; using Cluckwork.Domain.Common; using Cluckwork.Domain.Flocks; +namespace Cluckwork.Application.Features.Flocks.DepleteFlock; + public sealed class DepleteFlockHandler( IFlockRepository flocks, IUnitOfWork unitOfWork, diff --git a/src/Cluckwork.Application/Features/Flocks/FlockReference.cs b/src/Cluckwork.Application/Features/Flocks/FlockReference.cs index 153313e9d..325a129bc 100644 --- a/src/Cluckwork.Application/Features/Flocks/FlockReference.cs +++ b/src/Cluckwork.Application/Features/Flocks/FlockReference.cs @@ -1,7 +1,7 @@ -namespace Cluckwork.Application.Features.Flocks; - using Cluckwork.Domain.Flocks; +namespace Cluckwork.Application.Features.Flocks; + // Current display data for one flock, read out of the tenant's own visible // flocks so a returned page of rows can name its flocks in one grouped lookup // instead of leaning on whatever picker results the SPA happens to have loaded diff --git a/src/Cluckwork.Application/Features/Flocks/IBirdMovementRepository.cs b/src/Cluckwork.Application/Features/Flocks/IBirdMovementRepository.cs index 08ca7b636..235b9464b 100644 --- a/src/Cluckwork.Application/Features/Flocks/IBirdMovementRepository.cs +++ b/src/Cluckwork.Application/Features/Flocks/IBirdMovementRepository.cs @@ -1,8 +1,8 @@ -namespace Cluckwork.Application.Features.Flocks; - using Cluckwork.Application.Common; using Cluckwork.Domain.Flocks; +namespace Cluckwork.Application.Features.Flocks; + public interface IBirdMovementRepository : IRepository { // Newest first (date, then id) — ledger browsing. diff --git a/src/Cluckwork.Application/Features/Flocks/IFlockRepository.cs b/src/Cluckwork.Application/Features/Flocks/IFlockRepository.cs index c98c23b6b..be71a07b0 100644 --- a/src/Cluckwork.Application/Features/Flocks/IFlockRepository.cs +++ b/src/Cluckwork.Application/Features/Flocks/IFlockRepository.cs @@ -1,8 +1,8 @@ -namespace Cluckwork.Application.Features.Flocks; - using Cluckwork.Application.Common; using Cluckwork.Domain.Flocks; +namespace Cluckwork.Application.Features.Flocks; + public interface IFlockRepository : IRepository { // Archived flocks are hidden by default — they only appear in the diff --git a/src/Cluckwork.Application/Features/Flocks/ReactivateFlock/ReactivateFlockHandler.cs b/src/Cluckwork.Application/Features/Flocks/ReactivateFlock/ReactivateFlockHandler.cs index 0e3fc8777..d52b94211 100644 --- a/src/Cluckwork.Application/Features/Flocks/ReactivateFlock/ReactivateFlockHandler.cs +++ b/src/Cluckwork.Application/Features/Flocks/ReactivateFlock/ReactivateFlockHandler.cs @@ -1,10 +1,10 @@ -namespace Cluckwork.Application.Features.Flocks.ReactivateFlock; - using Cluckwork.Application.Common; using Cluckwork.Application.Features.Flocks; using Cluckwork.Domain.Common; using Cluckwork.Domain.Flocks; +namespace Cluckwork.Application.Features.Flocks.ReactivateFlock; + public sealed class ReactivateFlockHandler( IFlockRepository flocks, IUnitOfWork unitOfWork, diff --git a/src/Cluckwork.Application/Features/Flocks/RecordBirdMovement/RecordBirdMovementHandler.cs b/src/Cluckwork.Application/Features/Flocks/RecordBirdMovement/RecordBirdMovementHandler.cs index 7fd58fe6a..97c99f7dc 100644 --- a/src/Cluckwork.Application/Features/Flocks/RecordBirdMovement/RecordBirdMovementHandler.cs +++ b/src/Cluckwork.Application/Features/Flocks/RecordBirdMovement/RecordBirdMovementHandler.cs @@ -1,11 +1,11 @@ -namespace Cluckwork.Application.Features.Flocks.RecordBirdMovement; - using Cluckwork.Application.Common; using Cluckwork.Application.Features.Flocks; using Cluckwork.Domain.Common; using Cluckwork.Domain.Flocks; using Microsoft.Extensions.Logging; +namespace Cluckwork.Application.Features.Flocks.RecordBirdMovement; + public sealed class RecordBirdMovementHandler( IFlockRepository flocks, IBirdMovementRepository movements, diff --git a/src/Cluckwork.Application/Features/Flocks/RecordBirdMovement/RecordBirdMovementValidator.cs b/src/Cluckwork.Application/Features/Flocks/RecordBirdMovement/RecordBirdMovementValidator.cs index 6fae7c750..aaff85773 100644 --- a/src/Cluckwork.Application/Features/Flocks/RecordBirdMovement/RecordBirdMovementValidator.cs +++ b/src/Cluckwork.Application/Features/Flocks/RecordBirdMovement/RecordBirdMovementValidator.cs @@ -1,9 +1,9 @@ -namespace Cluckwork.Application.Features.Flocks.RecordBirdMovement; - using Cluckwork.Application.Common; using Cluckwork.Domain.Flocks; using FluentValidation; +namespace Cluckwork.Application.Features.Flocks.RecordBirdMovement; + public sealed class RecordBirdMovementValidator : AbstractValidator { private static readonly string[] ManualTypes = [nameof(BirdMovementType.Cull), nameof(BirdMovementType.Adjustment)]; diff --git a/src/Cluckwork.Application/Features/Flocks/UpdateFlock/UpdateFlockHandler.cs b/src/Cluckwork.Application/Features/Flocks/UpdateFlock/UpdateFlockHandler.cs index 891217320..8e4633947 100644 --- a/src/Cluckwork.Application/Features/Flocks/UpdateFlock/UpdateFlockHandler.cs +++ b/src/Cluckwork.Application/Features/Flocks/UpdateFlock/UpdateFlockHandler.cs @@ -1,10 +1,10 @@ -namespace Cluckwork.Application.Features.Flocks.UpdateFlock; - using Cluckwork.Application.Common; using Cluckwork.Application.Features.Flocks; using Cluckwork.Domain.Common; using Cluckwork.Domain.Flocks; +namespace Cluckwork.Application.Features.Flocks.UpdateFlock; + public sealed class UpdateFlockHandler( IFlockRepository flocks, IUnitOfWork unitOfWork, diff --git a/src/Cluckwork.Application/Features/Flocks/UpdateFlock/UpdateFlockValidator.cs b/src/Cluckwork.Application/Features/Flocks/UpdateFlock/UpdateFlockValidator.cs index b21faf733..12dc4c657 100644 --- a/src/Cluckwork.Application/Features/Flocks/UpdateFlock/UpdateFlockValidator.cs +++ b/src/Cluckwork.Application/Features/Flocks/UpdateFlock/UpdateFlockValidator.cs @@ -1,9 +1,9 @@ -namespace Cluckwork.Application.Features.Flocks.UpdateFlock; - using Cluckwork.Domain.Flocks; using Cluckwork.Application.Common; using FluentValidation; +namespace Cluckwork.Application.Features.Flocks.UpdateFlock; + public sealed class UpdateFlockValidator : AbstractValidator { public UpdateFlockValidator(IFarmClock farmClock) diff --git a/src/Cluckwork.Application/Features/Inventory/CreateInventoryItem/CreateInventoryItemHandler.cs b/src/Cluckwork.Application/Features/Inventory/CreateInventoryItem/CreateInventoryItemHandler.cs index ba66448a2..60f0737d0 100644 --- a/src/Cluckwork.Application/Features/Inventory/CreateInventoryItem/CreateInventoryItemHandler.cs +++ b/src/Cluckwork.Application/Features/Inventory/CreateInventoryItem/CreateInventoryItemHandler.cs @@ -1,11 +1,11 @@ -namespace Cluckwork.Application.Features.Inventory.CreateInventoryItem; - using Cluckwork.Application.Common; using Cluckwork.Application.Features.Accounts; using Cluckwork.Domain.Accounts; using Cluckwork.Domain.Common; using Cluckwork.Domain.Inventory; +namespace Cluckwork.Application.Features.Inventory.CreateInventoryItem; + public sealed class CreateInventoryItemHandler( IInventoryItemRepository items, IAccountRepository accounts, diff --git a/src/Cluckwork.Application/Features/Inventory/CreateInventoryItem/CreateInventoryItemValidator.cs b/src/Cluckwork.Application/Features/Inventory/CreateInventoryItem/CreateInventoryItemValidator.cs index a300229a2..d8244a7ce 100644 --- a/src/Cluckwork.Application/Features/Inventory/CreateInventoryItem/CreateInventoryItemValidator.cs +++ b/src/Cluckwork.Application/Features/Inventory/CreateInventoryItem/CreateInventoryItemValidator.cs @@ -1,8 +1,8 @@ -namespace Cluckwork.Application.Features.Inventory.CreateInventoryItem; - using Cluckwork.Domain.Inventory; using FluentValidation; +namespace Cluckwork.Application.Features.Inventory.CreateInventoryItem; + public sealed class CreateInventoryItemValidator : AbstractValidator { public CreateInventoryItemValidator() diff --git a/src/Cluckwork.Application/Features/Inventory/IFeedUsageRepository.cs b/src/Cluckwork.Application/Features/Inventory/IFeedUsageRepository.cs index 05218b1f8..ee080eef2 100644 --- a/src/Cluckwork.Application/Features/Inventory/IFeedUsageRepository.cs +++ b/src/Cluckwork.Application/Features/Inventory/IFeedUsageRepository.cs @@ -1,8 +1,8 @@ -namespace Cluckwork.Application.Features.Inventory; - using Cluckwork.Application.Common; using Cluckwork.Domain.Inventory; +namespace Cluckwork.Application.Features.Inventory; + // Create-only like the movement ledger: corrections happen through // compensating inventory adjustments, never by editing the usage record. public interface IFeedUsageRepository : IRepository diff --git a/src/Cluckwork.Application/Features/Inventory/IInventoryItemRepository.cs b/src/Cluckwork.Application/Features/Inventory/IInventoryItemRepository.cs index c1e432f80..2413f1f1c 100644 --- a/src/Cluckwork.Application/Features/Inventory/IInventoryItemRepository.cs +++ b/src/Cluckwork.Application/Features/Inventory/IInventoryItemRepository.cs @@ -1,8 +1,8 @@ -namespace Cluckwork.Application.Features.Inventory; - using Cluckwork.Application.Common; using Cluckwork.Domain.Inventory; +namespace Cluckwork.Application.Features.Inventory; + public interface IInventoryItemRepository : IRepository { // Catalog view, name order. includeInactive for management/display lookups diff --git a/src/Cluckwork.Application/Features/Inventory/IInventoryLotRepository.cs b/src/Cluckwork.Application/Features/Inventory/IInventoryLotRepository.cs index 1a82a2836..43e9de501 100644 --- a/src/Cluckwork.Application/Features/Inventory/IInventoryLotRepository.cs +++ b/src/Cluckwork.Application/Features/Inventory/IInventoryLotRepository.cs @@ -1,8 +1,8 @@ -namespace Cluckwork.Application.Features.Inventory; - using Cluckwork.Application.Common; using Cluckwork.Domain.Inventory; +namespace Cluckwork.Application.Features.Inventory; + public interface IInventoryLotRepository : IRepository { // FIFO-ordered lots with stock remaining for one item, locked FOR UPDATE — diff --git a/src/Cluckwork.Application/Features/Inventory/IInventoryMovementRepository.cs b/src/Cluckwork.Application/Features/Inventory/IInventoryMovementRepository.cs index 92c12f1b9..5cede4e71 100644 --- a/src/Cluckwork.Application/Features/Inventory/IInventoryMovementRepository.cs +++ b/src/Cluckwork.Application/Features/Inventory/IInventoryMovementRepository.cs @@ -1,8 +1,8 @@ -namespace Cluckwork.Application.Features.Inventory; - using Cluckwork.Application.Common; using Cluckwork.Domain.Inventory; +namespace Cluckwork.Application.Features.Inventory; + // Append-only ledger: the infrastructure implementation throws // NotSupportedException from Update/Remove (BirdMovement pattern) — mistakes // get compensating Adjustment rows, never edits. diff --git a/src/Cluckwork.Application/Features/Inventory/IWaterUsageRepository.cs b/src/Cluckwork.Application/Features/Inventory/IWaterUsageRepository.cs index 219ab0d46..4e2e8c062 100644 --- a/src/Cluckwork.Application/Features/Inventory/IWaterUsageRepository.cs +++ b/src/Cluckwork.Application/Features/Inventory/IWaterUsageRepository.cs @@ -1,8 +1,8 @@ -namespace Cluckwork.Application.Features.Inventory; - using Cluckwork.Application.Common; using Cluckwork.Domain.Inventory; +namespace Cluckwork.Application.Features.Inventory; + // Editable records (unlike feed usage): water has no lots/ledger behind it, // so corrections are plain updates guarded by the Version token. public interface IWaterUsageRepository : IRepository diff --git a/src/Cluckwork.Application/Features/Inventory/RecordAdjustment/RecordAdjustmentHandler.cs b/src/Cluckwork.Application/Features/Inventory/RecordAdjustment/RecordAdjustmentHandler.cs index 0be7d0002..f56894b78 100644 --- a/src/Cluckwork.Application/Features/Inventory/RecordAdjustment/RecordAdjustmentHandler.cs +++ b/src/Cluckwork.Application/Features/Inventory/RecordAdjustment/RecordAdjustmentHandler.cs @@ -1,10 +1,10 @@ -namespace Cluckwork.Application.Features.Inventory.RecordAdjustment; - using Cluckwork.Application.Common; using Cluckwork.Domain.Common; using Cluckwork.Domain.Inventory; using Microsoft.Extensions.Logging; +namespace Cluckwork.Application.Features.Inventory.RecordAdjustment; + // Stock correction (#66 part 2): fixes a typo'd purchase or writes off // spoiled feed via a compensating ledger row — the original movement is never // edited (append-only, spec §12.3). Lot is taken FOR UPDATE so corrections diff --git a/src/Cluckwork.Application/Features/Inventory/RecordAdjustment/RecordAdjustmentValidator.cs b/src/Cluckwork.Application/Features/Inventory/RecordAdjustment/RecordAdjustmentValidator.cs index efc19cc4c..61f083276 100644 --- a/src/Cluckwork.Application/Features/Inventory/RecordAdjustment/RecordAdjustmentValidator.cs +++ b/src/Cluckwork.Application/Features/Inventory/RecordAdjustment/RecordAdjustmentValidator.cs @@ -1,8 +1,8 @@ -namespace Cluckwork.Application.Features.Inventory.RecordAdjustment; - using Cluckwork.Domain.Inventory; using FluentValidation; +namespace Cluckwork.Application.Features.Inventory.RecordAdjustment; + public sealed class RecordAdjustmentValidator : AbstractValidator { public RecordAdjustmentValidator() diff --git a/src/Cluckwork.Application/Features/Inventory/RecordFeedUsage/RecordFeedUsageHandler.cs b/src/Cluckwork.Application/Features/Inventory/RecordFeedUsage/RecordFeedUsageHandler.cs index efa295402..a4d8ff2f9 100644 --- a/src/Cluckwork.Application/Features/Inventory/RecordFeedUsage/RecordFeedUsageHandler.cs +++ b/src/Cluckwork.Application/Features/Inventory/RecordFeedUsage/RecordFeedUsageHandler.cs @@ -1,11 +1,11 @@ -namespace Cluckwork.Application.Features.Inventory.RecordFeedUsage; - using Cluckwork.Application.Common; using Cluckwork.Application.Features.Flocks; using Cluckwork.Domain.Common; using Cluckwork.Domain.Inventory; using Microsoft.Extensions.Logging; +namespace Cluckwork.Application.Features.Inventory.RecordFeedUsage; + // Feeding a flock (spec §12.4): consumes the item's lots FIFO under the // canonical (ReceivedDate, Id) FOR UPDATE lock, appends one Usage ledger row // per lot drained (lot-level provenance — the #60 lesson) referencing the diff --git a/src/Cluckwork.Application/Features/Inventory/RecordFeedUsage/RecordFeedUsageValidator.cs b/src/Cluckwork.Application/Features/Inventory/RecordFeedUsage/RecordFeedUsageValidator.cs index 5914dac5c..b1fd20b35 100644 --- a/src/Cluckwork.Application/Features/Inventory/RecordFeedUsage/RecordFeedUsageValidator.cs +++ b/src/Cluckwork.Application/Features/Inventory/RecordFeedUsage/RecordFeedUsageValidator.cs @@ -1,8 +1,8 @@ -namespace Cluckwork.Application.Features.Inventory.RecordFeedUsage; - using Cluckwork.Domain.Inventory; using FluentValidation; +namespace Cluckwork.Application.Features.Inventory.RecordFeedUsage; + public sealed class RecordFeedUsageValidator : AbstractValidator { public RecordFeedUsageValidator() diff --git a/src/Cluckwork.Application/Features/Inventory/RecordPurchase/RecordPurchaseHandler.cs b/src/Cluckwork.Application/Features/Inventory/RecordPurchase/RecordPurchaseHandler.cs index ab20c55bf..050776208 100644 --- a/src/Cluckwork.Application/Features/Inventory/RecordPurchase/RecordPurchaseHandler.cs +++ b/src/Cluckwork.Application/Features/Inventory/RecordPurchase/RecordPurchaseHandler.cs @@ -1,11 +1,11 @@ -namespace Cluckwork.Application.Features.Inventory.RecordPurchase; - using Cluckwork.Application.Common; using Cluckwork.Application.Features.Accounts; using Cluckwork.Domain.Common; using Cluckwork.Domain.Inventory; using Microsoft.Extensions.Logging; +namespace Cluckwork.Application.Features.Inventory.RecordPurchase; + // Receiving stock (spec §12.2): creates the lot AND its Purchase ledger row // atomically. Runs under a FOR UPDATE lock on the item row so the unit read // here can't interleave with a unit edit that saw no lots yet (TOCTOU). diff --git a/src/Cluckwork.Application/Features/Inventory/RecordPurchase/RecordPurchaseValidator.cs b/src/Cluckwork.Application/Features/Inventory/RecordPurchase/RecordPurchaseValidator.cs index 1f85ec298..d6b5e5a81 100644 --- a/src/Cluckwork.Application/Features/Inventory/RecordPurchase/RecordPurchaseValidator.cs +++ b/src/Cluckwork.Application/Features/Inventory/RecordPurchase/RecordPurchaseValidator.cs @@ -1,8 +1,8 @@ -namespace Cluckwork.Application.Features.Inventory.RecordPurchase; - using Cluckwork.Domain.Inventory; using FluentValidation; +namespace Cluckwork.Application.Features.Inventory.RecordPurchase; + public sealed class RecordPurchaseValidator : AbstractValidator { public RecordPurchaseValidator() diff --git a/src/Cluckwork.Application/Features/Inventory/RecordWaterUsage/RecordWaterUsageHandler.cs b/src/Cluckwork.Application/Features/Inventory/RecordWaterUsage/RecordWaterUsageHandler.cs index ecd65fe81..3b0255d6e 100644 --- a/src/Cluckwork.Application/Features/Inventory/RecordWaterUsage/RecordWaterUsageHandler.cs +++ b/src/Cluckwork.Application/Features/Inventory/RecordWaterUsage/RecordWaterUsageHandler.cs @@ -1,11 +1,11 @@ -namespace Cluckwork.Application.Features.Inventory.RecordWaterUsage; - using Cluckwork.Application.Common; using Cluckwork.Application.Features.Flocks; using Cluckwork.Domain.Common; using Cluckwork.Domain.Inventory; using Microsoft.Extensions.Logging; +namespace Cluckwork.Application.Features.Inventory.RecordWaterUsage; + // Water consumed by a flock on a day (spec §12.5). No inventory behind it — // a plain insert; corrections are Version-guarded updates. public sealed class RecordWaterUsageHandler( diff --git a/src/Cluckwork.Application/Features/Inventory/RecordWaterUsage/RecordWaterUsageValidator.cs b/src/Cluckwork.Application/Features/Inventory/RecordWaterUsage/RecordWaterUsageValidator.cs index bd251d24f..4b5cdad44 100644 --- a/src/Cluckwork.Application/Features/Inventory/RecordWaterUsage/RecordWaterUsageValidator.cs +++ b/src/Cluckwork.Application/Features/Inventory/RecordWaterUsage/RecordWaterUsageValidator.cs @@ -1,8 +1,8 @@ -namespace Cluckwork.Application.Features.Inventory.RecordWaterUsage; - using Cluckwork.Domain.Inventory; using FluentValidation; +namespace Cluckwork.Application.Features.Inventory.RecordWaterUsage; + public sealed class RecordWaterUsageValidator : AbstractValidator { public RecordWaterUsageValidator() diff --git a/src/Cluckwork.Application/Features/Inventory/SetInventoryItemActiveHandler.cs b/src/Cluckwork.Application/Features/Inventory/SetInventoryItemActiveHandler.cs index 921d6c557..2511ec4e2 100644 --- a/src/Cluckwork.Application/Features/Inventory/SetInventoryItemActiveHandler.cs +++ b/src/Cluckwork.Application/Features/Inventory/SetInventoryItemActiveHandler.cs @@ -1,9 +1,9 @@ -namespace Cluckwork.Application.Features.Inventory; - using Cluckwork.Application.Common; using Cluckwork.Domain.Common; using Cluckwork.Domain.Inventory; +namespace Cluckwork.Application.Features.Inventory; + public sealed class SetInventoryItemActiveHandler( IInventoryItemRepository items, IUnitOfWork unitOfWork) diff --git a/src/Cluckwork.Application/Features/Inventory/UpdateInventoryItem/UpdateInventoryItemHandler.cs b/src/Cluckwork.Application/Features/Inventory/UpdateInventoryItem/UpdateInventoryItemHandler.cs index 36768453e..ef470bab1 100644 --- a/src/Cluckwork.Application/Features/Inventory/UpdateInventoryItem/UpdateInventoryItemHandler.cs +++ b/src/Cluckwork.Application/Features/Inventory/UpdateInventoryItem/UpdateInventoryItemHandler.cs @@ -1,10 +1,10 @@ -namespace Cluckwork.Application.Features.Inventory.UpdateInventoryItem; - using Cluckwork.Application.Common; using Cluckwork.Application.Features.Accounts; using Cluckwork.Domain.Common; using Cluckwork.Domain.Inventory; +namespace Cluckwork.Application.Features.Inventory.UpdateInventoryItem; + public sealed class UpdateInventoryItemHandler( IInventoryItemRepository items, IAccountRepository accounts, diff --git a/src/Cluckwork.Application/Features/Inventory/UpdateInventoryItem/UpdateInventoryItemValidator.cs b/src/Cluckwork.Application/Features/Inventory/UpdateInventoryItem/UpdateInventoryItemValidator.cs index bfd796865..8ec313ae8 100644 --- a/src/Cluckwork.Application/Features/Inventory/UpdateInventoryItem/UpdateInventoryItemValidator.cs +++ b/src/Cluckwork.Application/Features/Inventory/UpdateInventoryItem/UpdateInventoryItemValidator.cs @@ -1,8 +1,8 @@ -namespace Cluckwork.Application.Features.Inventory.UpdateInventoryItem; - using Cluckwork.Domain.Inventory; using FluentValidation; +namespace Cluckwork.Application.Features.Inventory.UpdateInventoryItem; + public sealed class UpdateInventoryItemValidator : AbstractValidator { public UpdateInventoryItemValidator() diff --git a/src/Cluckwork.Application/Features/Inventory/UpdateWaterUsage/UpdateWaterUsageHandler.cs b/src/Cluckwork.Application/Features/Inventory/UpdateWaterUsage/UpdateWaterUsageHandler.cs index ce6572b96..3342da981 100644 --- a/src/Cluckwork.Application/Features/Inventory/UpdateWaterUsage/UpdateWaterUsageHandler.cs +++ b/src/Cluckwork.Application/Features/Inventory/UpdateWaterUsage/UpdateWaterUsageHandler.cs @@ -1,10 +1,10 @@ -namespace Cluckwork.Application.Features.Inventory.UpdateWaterUsage; - using Cluckwork.Application.Common; using Cluckwork.Application.Features.Flocks; using Cluckwork.Domain.Common; using Cluckwork.Domain.Inventory; +namespace Cluckwork.Application.Features.Inventory.UpdateWaterUsage; + // Correcting a water record (#67; corrections join the admin-gated surface // with #73). Optimistic concurrency is end-to-end: the client sends the base // Version it loaded, a mismatch is a deterministic 409 — the EF token alone diff --git a/src/Cluckwork.Application/Features/Inventory/UpdateWaterUsage/UpdateWaterUsageValidator.cs b/src/Cluckwork.Application/Features/Inventory/UpdateWaterUsage/UpdateWaterUsageValidator.cs index 80bb63937..1e2e45025 100644 --- a/src/Cluckwork.Application/Features/Inventory/UpdateWaterUsage/UpdateWaterUsageValidator.cs +++ b/src/Cluckwork.Application/Features/Inventory/UpdateWaterUsage/UpdateWaterUsageValidator.cs @@ -1,8 +1,8 @@ -namespace Cluckwork.Application.Features.Inventory.UpdateWaterUsage; - using Cluckwork.Domain.Inventory; using FluentValidation; +namespace Cluckwork.Application.Features.Inventory.UpdateWaterUsage; + public sealed class UpdateWaterUsageValidator : AbstractValidator { public UpdateWaterUsageValidator() diff --git a/src/Cluckwork.Application/Features/Sales/AddOrderItem/AddOrderItemHandler.cs b/src/Cluckwork.Application/Features/Sales/AddOrderItem/AddOrderItemHandler.cs index 41cf29061..539934a57 100644 --- a/src/Cluckwork.Application/Features/Sales/AddOrderItem/AddOrderItemHandler.cs +++ b/src/Cluckwork.Application/Features/Sales/AddOrderItem/AddOrderItemHandler.cs @@ -1,5 +1,3 @@ -namespace Cluckwork.Application.Features.Sales.AddOrderItem; - using Cluckwork.Application.Common; using Cluckwork.Application.Features.Catalog; using Cluckwork.Application.Features.EggGrades; @@ -8,6 +6,8 @@ namespace Cluckwork.Application.Features.Sales.AddOrderItem; using Cluckwork.Domain.Common; using Cluckwork.Domain.Sales; +namespace Cluckwork.Application.Features.Sales.AddOrderItem; + public sealed class AddOrderItemHandler( ISalesOrderRepository orders, IProductRepository products, diff --git a/src/Cluckwork.Application/Features/Sales/AddOrderItem/AddOrderItemValidator.cs b/src/Cluckwork.Application/Features/Sales/AddOrderItem/AddOrderItemValidator.cs index 1c900b2c6..82b9aa37e 100644 --- a/src/Cluckwork.Application/Features/Sales/AddOrderItem/AddOrderItemValidator.cs +++ b/src/Cluckwork.Application/Features/Sales/AddOrderItem/AddOrderItemValidator.cs @@ -1,7 +1,7 @@ -namespace Cluckwork.Application.Features.Sales.AddOrderItem; - using FluentValidation; +namespace Cluckwork.Application.Features.Sales.AddOrderItem; + public sealed class AddOrderItemValidator : AbstractValidator { public AddOrderItemValidator() diff --git a/src/Cluckwork.Application/Features/Sales/CancelSalesOrder/CancelSalesOrderHandler.cs b/src/Cluckwork.Application/Features/Sales/CancelSalesOrder/CancelSalesOrderHandler.cs index 5d281f39e..1cf379564 100644 --- a/src/Cluckwork.Application/Features/Sales/CancelSalesOrder/CancelSalesOrderHandler.cs +++ b/src/Cluckwork.Application/Features/Sales/CancelSalesOrder/CancelSalesOrderHandler.cs @@ -1,11 +1,11 @@ -namespace Cluckwork.Application.Features.Sales.CancelSalesOrder; - using Cluckwork.Application.Common; using Cluckwork.Application.Features.Sales; using Cluckwork.Domain.Common; using Cluckwork.Domain.Sales; using Microsoft.Extensions.Logging; +namespace Cluckwork.Application.Features.Sales.CancelSalesOrder; + public sealed class CancelSalesOrderHandler( ISalesOrderRepository orders, IAuditWriter audit, diff --git a/src/Cluckwork.Application/Features/Sales/ConfirmSale/ConfirmSaleHandler.cs b/src/Cluckwork.Application/Features/Sales/ConfirmSale/ConfirmSaleHandler.cs index d582645ab..d54b8a4fa 100644 --- a/src/Cluckwork.Application/Features/Sales/ConfirmSale/ConfirmSaleHandler.cs +++ b/src/Cluckwork.Application/Features/Sales/ConfirmSale/ConfirmSaleHandler.cs @@ -1,5 +1,3 @@ -namespace Cluckwork.Application.Features.Sales.ConfirmSale; - using System.Globalization; using Cluckwork.Application.Common; using Cluckwork.Application.Features.Accounts; @@ -13,6 +11,8 @@ namespace Cluckwork.Application.Features.Sales.ConfirmSale; using Cluckwork.Domain.Sales; using Microsoft.Extensions.Logging; +namespace Cluckwork.Application.Features.Sales.ConfirmSale; + public sealed class ConfirmSaleHandler( IAccountRepository accounts, ISalesOrderRepository salesOrders, diff --git a/src/Cluckwork.Application/Features/Sales/ConfirmSale/ConfirmSaleValidator.cs b/src/Cluckwork.Application/Features/Sales/ConfirmSale/ConfirmSaleValidator.cs index 44ea98128..d4e691284 100644 --- a/src/Cluckwork.Application/Features/Sales/ConfirmSale/ConfirmSaleValidator.cs +++ b/src/Cluckwork.Application/Features/Sales/ConfirmSale/ConfirmSaleValidator.cs @@ -1,8 +1,8 @@ -namespace Cluckwork.Application.Features.Sales.ConfirmSale; - using Cluckwork.Domain.Sales; using FluentValidation; +namespace Cluckwork.Application.Features.Sales.ConfirmSale; + // #721 — mirrors only the SYNTACTIC half of SalesOrder.Confirm's discount rule, // the way VoidSaleValidator mirrors Void's. Whether a reason is REQUIRED depends // on the order's lines, which only the aggregate can see, and the seeders reach diff --git a/src/Cluckwork.Application/Features/Sales/ConfirmSale/SaleAllocationPlanner.cs b/src/Cluckwork.Application/Features/Sales/ConfirmSale/SaleAllocationPlanner.cs index bc0fec48f..8a00a714a 100644 --- a/src/Cluckwork.Application/Features/Sales/ConfirmSale/SaleAllocationPlanner.cs +++ b/src/Cluckwork.Application/Features/Sales/ConfirmSale/SaleAllocationPlanner.cs @@ -1,8 +1,8 @@ -namespace Cluckwork.Application.Features.Sales.ConfirmSale; - using Cluckwork.Domain.Eggs; using Cluckwork.Domain.Sales; +namespace Cluckwork.Application.Features.Sales.ConfirmSale; + public sealed record PlannedEggLotDraw(Guid SalesOrderItemId, Guid EggLotId, int Quantity); // #612 — whether the plan covered the whole order, and — when it did not — diff --git a/src/Cluckwork.Application/Features/Sales/CreateSalesOrder/CreateSalesOrderHandler.cs b/src/Cluckwork.Application/Features/Sales/CreateSalesOrder/CreateSalesOrderHandler.cs index 07c1cbe32..367717994 100644 --- a/src/Cluckwork.Application/Features/Sales/CreateSalesOrder/CreateSalesOrderHandler.cs +++ b/src/Cluckwork.Application/Features/Sales/CreateSalesOrder/CreateSalesOrderHandler.cs @@ -1,11 +1,11 @@ -namespace Cluckwork.Application.Features.Sales.CreateSalesOrder; - using Cluckwork.Application.Common; using Cluckwork.Application.Features.Accounts; using Cluckwork.Application.Features.Customers; using Cluckwork.Domain.Common; using Cluckwork.Domain.Sales; +namespace Cluckwork.Application.Features.Sales.CreateSalesOrder; + public sealed class CreateSalesOrderHandler( ICustomerRepository customers, IAccountRepository accounts, diff --git a/src/Cluckwork.Application/Features/Sales/CreateSalesOrder/CreateSalesOrderValidator.cs b/src/Cluckwork.Application/Features/Sales/CreateSalesOrder/CreateSalesOrderValidator.cs index b167933a8..a98ddaccd 100644 --- a/src/Cluckwork.Application/Features/Sales/CreateSalesOrder/CreateSalesOrderValidator.cs +++ b/src/Cluckwork.Application/Features/Sales/CreateSalesOrder/CreateSalesOrderValidator.cs @@ -1,7 +1,7 @@ -namespace Cluckwork.Application.Features.Sales.CreateSalesOrder; - using FluentValidation; +namespace Cluckwork.Application.Features.Sales.CreateSalesOrder; + public sealed class CreateSalesOrderValidator : AbstractValidator { public CreateSalesOrderValidator() diff --git a/src/Cluckwork.Application/Features/Sales/IPaymentRepository.cs b/src/Cluckwork.Application/Features/Sales/IPaymentRepository.cs index f3000dbf0..17b9ea7d9 100644 --- a/src/Cluckwork.Application/Features/Sales/IPaymentRepository.cs +++ b/src/Cluckwork.Application/Features/Sales/IPaymentRepository.cs @@ -1,8 +1,8 @@ -namespace Cluckwork.Application.Features.Sales; - using Cluckwork.Application.Common; using Cluckwork.Domain.Sales; +namespace Cluckwork.Application.Features.Sales; + public interface IPaymentRepository : IRepository { // All payments of one order, oldest first (a settlement history reads diff --git a/src/Cluckwork.Application/Features/Sales/ISalesOrderAllocationRepository.cs b/src/Cluckwork.Application/Features/Sales/ISalesOrderAllocationRepository.cs index 6cbbb7147..95909f0da 100644 --- a/src/Cluckwork.Application/Features/Sales/ISalesOrderAllocationRepository.cs +++ b/src/Cluckwork.Application/Features/Sales/ISalesOrderAllocationRepository.cs @@ -1,7 +1,7 @@ -namespace Cluckwork.Application.Features.Sales; - using Cluckwork.Domain.Sales; +namespace Cluckwork.Application.Features.Sales; + // Deliberately not IRepository: allocations are written as a batch inside the // confirm transaction and only ever mutated by marking them released inside // the void transaction. Rows are never deleted — they are the traceability diff --git a/src/Cluckwork.Application/Features/Sales/ISalesOrderRepository.cs b/src/Cluckwork.Application/Features/Sales/ISalesOrderRepository.cs index 31433ed47..8390d8df1 100644 --- a/src/Cluckwork.Application/Features/Sales/ISalesOrderRepository.cs +++ b/src/Cluckwork.Application/Features/Sales/ISalesOrderRepository.cs @@ -1,8 +1,8 @@ -namespace Cluckwork.Application.Features.Sales; - using Cluckwork.Application.Common; using Cluckwork.Domain.Sales; +namespace Cluckwork.Application.Features.Sales; + public interface ISalesOrderRepository : IRepository { // Untracked read for GET endpoints (the tracked GetByIdAsync is the write path). diff --git a/src/Cluckwork.Application/Features/Sales/RecordPayment/RecordPaymentHandler.cs b/src/Cluckwork.Application/Features/Sales/RecordPayment/RecordPaymentHandler.cs index fa1342d7b..d97e2ff03 100644 --- a/src/Cluckwork.Application/Features/Sales/RecordPayment/RecordPaymentHandler.cs +++ b/src/Cluckwork.Application/Features/Sales/RecordPayment/RecordPaymentHandler.cs @@ -1,10 +1,10 @@ -namespace Cluckwork.Application.Features.Sales.RecordPayment; - using Cluckwork.Application.Common; using Cluckwork.Domain.Common; using Cluckwork.Domain.Sales; using Microsoft.Extensions.Logging; +namespace Cluckwork.Application.Features.Sales.RecordPayment; + // Records a customer payment against a confirmed order (spec §10.11). // // Locking: the order row is taken FOR UPDATE, then the settled total is diff --git a/src/Cluckwork.Application/Features/Sales/RecordPayment/RecordPaymentValidator.cs b/src/Cluckwork.Application/Features/Sales/RecordPayment/RecordPaymentValidator.cs index 9af65b3ed..a6a201566 100644 --- a/src/Cluckwork.Application/Features/Sales/RecordPayment/RecordPaymentValidator.cs +++ b/src/Cluckwork.Application/Features/Sales/RecordPayment/RecordPaymentValidator.cs @@ -1,9 +1,9 @@ -namespace Cluckwork.Application.Features.Sales.RecordPayment; - using Cluckwork.Domain.Sales; using Cluckwork.Application.Common; using FluentValidation; +namespace Cluckwork.Application.Features.Sales.RecordPayment; + public sealed class RecordPaymentValidator : AbstractValidator { public RecordPaymentValidator(IFarmClock farmClock) diff --git a/src/Cluckwork.Application/Features/Sales/RemoveOrderItem/RemoveOrderItemHandler.cs b/src/Cluckwork.Application/Features/Sales/RemoveOrderItem/RemoveOrderItemHandler.cs index b61b101d8..811a8f493 100644 --- a/src/Cluckwork.Application/Features/Sales/RemoveOrderItem/RemoveOrderItemHandler.cs +++ b/src/Cluckwork.Application/Features/Sales/RemoveOrderItem/RemoveOrderItemHandler.cs @@ -1,10 +1,10 @@ -namespace Cluckwork.Application.Features.Sales.RemoveOrderItem; - using Cluckwork.Application.Common; using Cluckwork.Application.Features.Sales; using Cluckwork.Domain.Common; using Cluckwork.Domain.Sales; +namespace Cluckwork.Application.Features.Sales.RemoveOrderItem; + public sealed class RemoveOrderItemHandler( ISalesOrderRepository orders, IAuditWriter audit, diff --git a/src/Cluckwork.Application/Features/Sales/UpdateOrderItem/UpdateOrderItemHandler.cs b/src/Cluckwork.Application/Features/Sales/UpdateOrderItem/UpdateOrderItemHandler.cs index f1bee0133..a377eb7df 100644 --- a/src/Cluckwork.Application/Features/Sales/UpdateOrderItem/UpdateOrderItemHandler.cs +++ b/src/Cluckwork.Application/Features/Sales/UpdateOrderItem/UpdateOrderItemHandler.cs @@ -1,11 +1,11 @@ -namespace Cluckwork.Application.Features.Sales.UpdateOrderItem; - using Cluckwork.Application.Common; using Cluckwork.Application.Features.Catalog; using Cluckwork.Application.Features.Sales; using Cluckwork.Domain.Common; using Cluckwork.Domain.Sales; +namespace Cluckwork.Application.Features.Sales.UpdateOrderItem; + public sealed class UpdateOrderItemHandler( ISalesOrderRepository orders, IProductRepository products, diff --git a/src/Cluckwork.Application/Features/Sales/UpdateOrderItem/UpdateOrderItemValidator.cs b/src/Cluckwork.Application/Features/Sales/UpdateOrderItem/UpdateOrderItemValidator.cs index 76ba38c0d..1a3d3072f 100644 --- a/src/Cluckwork.Application/Features/Sales/UpdateOrderItem/UpdateOrderItemValidator.cs +++ b/src/Cluckwork.Application/Features/Sales/UpdateOrderItem/UpdateOrderItemValidator.cs @@ -1,7 +1,7 @@ -namespace Cluckwork.Application.Features.Sales.UpdateOrderItem; - using FluentValidation; +namespace Cluckwork.Application.Features.Sales.UpdateOrderItem; + public sealed class UpdateOrderItemValidator : AbstractValidator { public UpdateOrderItemValidator() diff --git a/src/Cluckwork.Application/Features/Sales/VoidPayment/VoidPaymentHandler.cs b/src/Cluckwork.Application/Features/Sales/VoidPayment/VoidPaymentHandler.cs index d50fdea16..e7ef62a74 100644 --- a/src/Cluckwork.Application/Features/Sales/VoidPayment/VoidPaymentHandler.cs +++ b/src/Cluckwork.Application/Features/Sales/VoidPayment/VoidPaymentHandler.cs @@ -1,10 +1,10 @@ -namespace Cluckwork.Application.Features.Sales.VoidPayment; - using Cluckwork.Application.Common; using Cluckwork.Domain.Common; using Cluckwork.Domain.Sales; using Microsoft.Extensions.Logging; +namespace Cluckwork.Application.Features.Sales.VoidPayment; + // Undo of a mistaken payment (#89): status flip + reason, never a delete — // the row stays for the ledger, and the order's outstanding grows back. public sealed class VoidPaymentHandler( diff --git a/src/Cluckwork.Application/Features/Sales/VoidPayment/VoidPaymentValidator.cs b/src/Cluckwork.Application/Features/Sales/VoidPayment/VoidPaymentValidator.cs index aa215006d..91a052a7f 100644 --- a/src/Cluckwork.Application/Features/Sales/VoidPayment/VoidPaymentValidator.cs +++ b/src/Cluckwork.Application/Features/Sales/VoidPayment/VoidPaymentValidator.cs @@ -1,8 +1,8 @@ -namespace Cluckwork.Application.Features.Sales.VoidPayment; - using Cluckwork.Domain.Sales; using FluentValidation; +namespace Cluckwork.Application.Features.Sales.VoidPayment; + public sealed class VoidPaymentValidator : AbstractValidator { public VoidPaymentValidator() diff --git a/src/Cluckwork.Application/Features/Sales/VoidSale/VoidSaleHandler.cs b/src/Cluckwork.Application/Features/Sales/VoidSale/VoidSaleHandler.cs index 992dfce46..c77adbb18 100644 --- a/src/Cluckwork.Application/Features/Sales/VoidSale/VoidSaleHandler.cs +++ b/src/Cluckwork.Application/Features/Sales/VoidSale/VoidSaleHandler.cs @@ -1,5 +1,3 @@ -namespace Cluckwork.Application.Features.Sales.VoidSale; - using Cluckwork.Application.Common; using Cluckwork.Application.Features.EggLots; using Cluckwork.Application.Features.Eggs; @@ -8,6 +6,8 @@ namespace Cluckwork.Application.Features.Sales.VoidSale; using Cluckwork.Domain.Sales; using Microsoft.Extensions.Logging; +namespace Cluckwork.Application.Features.Sales.VoidSale; + // Undo of a mistaken confirm (#60): Confirmed → Voided, returning every // allocated quantity to the exact lot it was drawn from and marking the // allocation rows released (never deleted — they are the sale→lot diff --git a/src/Cluckwork.Application/Features/Sales/VoidSale/VoidSaleValidator.cs b/src/Cluckwork.Application/Features/Sales/VoidSale/VoidSaleValidator.cs index 1f24ab7c0..71b815f96 100644 --- a/src/Cluckwork.Application/Features/Sales/VoidSale/VoidSaleValidator.cs +++ b/src/Cluckwork.Application/Features/Sales/VoidSale/VoidSaleValidator.cs @@ -1,8 +1,8 @@ -namespace Cluckwork.Application.Features.Sales.VoidSale; - using Cluckwork.Domain.Sales; using FluentValidation; +namespace Cluckwork.Application.Features.Sales.VoidSale; + public sealed class VoidSaleValidator : AbstractValidator { public VoidSaleValidator() diff --git a/src/Cluckwork.Application/Features/Users/AssignFlock/AssignFlockHandler.cs b/src/Cluckwork.Application/Features/Users/AssignFlock/AssignFlockHandler.cs index 57b6bde13..00cd8afea 100644 --- a/src/Cluckwork.Application/Features/Users/AssignFlock/AssignFlockHandler.cs +++ b/src/Cluckwork.Application/Features/Users/AssignFlock/AssignFlockHandler.cs @@ -1,10 +1,10 @@ -namespace Cluckwork.Application.Features.Users.AssignFlock; - using Cluckwork.Application.Common; using Cluckwork.Application.Features.Flocks; using Cluckwork.Domain.Accounts; using Cluckwork.Domain.Common; +namespace Cluckwork.Application.Features.Users.AssignFlock; + // #103 (spec §5.2/§5.3) — narrow a worker to assigned flocks. The FIRST // assignment flips the user from account-wide (grandfathered) to scoped. // #606 — every interactive assignment requires a fresh step-up grant, the diff --git a/src/Cluckwork.Application/Features/Users/ChangeOwnPassword/ChangeOwnPasswordHandler.cs b/src/Cluckwork.Application/Features/Users/ChangeOwnPassword/ChangeOwnPasswordHandler.cs index 320aa34eb..e37211f0c 100644 --- a/src/Cluckwork.Application/Features/Users/ChangeOwnPassword/ChangeOwnPasswordHandler.cs +++ b/src/Cluckwork.Application/Features/Users/ChangeOwnPassword/ChangeOwnPasswordHandler.cs @@ -1,8 +1,8 @@ -namespace Cluckwork.Application.Features.Users.ChangeOwnPassword; - using Cluckwork.Application.Common; using Cluckwork.Domain.Common; +namespace Cluckwork.Application.Features.Users.ChangeOwnPassword; + public sealed class ChangeOwnPasswordHandler(IIdentityProvider identity) { public Task> HandleAsync( diff --git a/src/Cluckwork.Application/Features/Users/ChangeOwnPassword/ChangeOwnPasswordValidator.cs b/src/Cluckwork.Application/Features/Users/ChangeOwnPassword/ChangeOwnPasswordValidator.cs index dab5cd93a..e6a2b862f 100644 --- a/src/Cluckwork.Application/Features/Users/ChangeOwnPassword/ChangeOwnPasswordValidator.cs +++ b/src/Cluckwork.Application/Features/Users/ChangeOwnPassword/ChangeOwnPasswordValidator.cs @@ -1,7 +1,7 @@ -namespace Cluckwork.Application.Features.Users.ChangeOwnPassword; - using FluentValidation; +namespace Cluckwork.Application.Features.Users.ChangeOwnPassword; + public sealed class ChangeOwnPasswordValidator : AbstractValidator { public ChangeOwnPasswordValidator() diff --git a/src/Cluckwork.Application/Features/Users/ChangeUserEmail/ChangeUserEmailHandler.cs b/src/Cluckwork.Application/Features/Users/ChangeUserEmail/ChangeUserEmailHandler.cs index ea554a4e1..546fe8844 100644 --- a/src/Cluckwork.Application/Features/Users/ChangeUserEmail/ChangeUserEmailHandler.cs +++ b/src/Cluckwork.Application/Features/Users/ChangeUserEmail/ChangeUserEmailHandler.cs @@ -1,8 +1,8 @@ -namespace Cluckwork.Application.Features.Users.ChangeUserEmail; - using Cluckwork.Application.Common; using Cluckwork.Domain.Common; +namespace Cluckwork.Application.Features.Users.ChangeUserEmail; + public sealed class ChangeUserEmailHandler(IIdentityProvider identity, IStepUpGrantService stepUp) { public async Task HandleAsync( diff --git a/src/Cluckwork.Application/Features/Users/ChangeUserEmail/ChangeUserEmailValidator.cs b/src/Cluckwork.Application/Features/Users/ChangeUserEmail/ChangeUserEmailValidator.cs index 9b3599d52..a7f76948f 100644 --- a/src/Cluckwork.Application/Features/Users/ChangeUserEmail/ChangeUserEmailValidator.cs +++ b/src/Cluckwork.Application/Features/Users/ChangeUserEmail/ChangeUserEmailValidator.cs @@ -1,7 +1,7 @@ -namespace Cluckwork.Application.Features.Users.ChangeUserEmail; - using FluentValidation; +namespace Cluckwork.Application.Features.Users.ChangeUserEmail; + public sealed class ChangeUserEmailValidator : AbstractValidator { public ChangeUserEmailValidator() diff --git a/src/Cluckwork.Application/Features/Users/ChangeUserRole/ChangeUserRoleHandler.cs b/src/Cluckwork.Application/Features/Users/ChangeUserRole/ChangeUserRoleHandler.cs index d88f9dfaa..808257afa 100644 --- a/src/Cluckwork.Application/Features/Users/ChangeUserRole/ChangeUserRoleHandler.cs +++ b/src/Cluckwork.Application/Features/Users/ChangeUserRole/ChangeUserRoleHandler.cs @@ -1,9 +1,9 @@ -namespace Cluckwork.Application.Features.Users.ChangeUserRole; - using Cluckwork.Application.Common; using Cluckwork.Application.Features.Users.CreateUser; using Cluckwork.Domain.Common; +namespace Cluckwork.Application.Features.Users.ChangeUserRole; + // #355/#360 — every role change mutates a durable authorization set. The role // capability sets are not totally ordered (Worker and Sales grant different // operations), and classifying old/new privilege would add a racy read before diff --git a/src/Cluckwork.Application/Features/Users/ChangeUserRole/ChangeUserRoleValidator.cs b/src/Cluckwork.Application/Features/Users/ChangeUserRole/ChangeUserRoleValidator.cs index 202ac797f..79272f8d5 100644 --- a/src/Cluckwork.Application/Features/Users/ChangeUserRole/ChangeUserRoleValidator.cs +++ b/src/Cluckwork.Application/Features/Users/ChangeUserRole/ChangeUserRoleValidator.cs @@ -1,8 +1,8 @@ -namespace Cluckwork.Application.Features.Users.ChangeUserRole; - using Cluckwork.Application.Features.Users.CreateUser; using FluentValidation; +namespace Cluckwork.Application.Features.Users.ChangeUserRole; + public sealed class ChangeUserRoleValidator : AbstractValidator { public ChangeUserRoleValidator() diff --git a/src/Cluckwork.Application/Features/Users/CreateUser/CreateUserHandler.cs b/src/Cluckwork.Application/Features/Users/CreateUser/CreateUserHandler.cs index c077a9d8a..9035d1057 100644 --- a/src/Cluckwork.Application/Features/Users/CreateUser/CreateUserHandler.cs +++ b/src/Cluckwork.Application/Features/Users/CreateUser/CreateUserHandler.cs @@ -1,9 +1,9 @@ -namespace Cluckwork.Application.Features.Users.CreateUser; - using Cluckwork.Application.Common; using Cluckwork.Application.Features.Users; using Cluckwork.Domain.Common; +namespace Cluckwork.Application.Features.Users.CreateUser; + // #103 — users are created with any assignable role (spec §5.1), or as a // plain worker ("Worker" = no role row at all). // diff --git a/src/Cluckwork.Application/Features/Users/CreateUser/CreateUserValidator.cs b/src/Cluckwork.Application/Features/Users/CreateUser/CreateUserValidator.cs index cc493f33b..9f10d736a 100644 --- a/src/Cluckwork.Application/Features/Users/CreateUser/CreateUserValidator.cs +++ b/src/Cluckwork.Application/Features/Users/CreateUser/CreateUserValidator.cs @@ -1,7 +1,7 @@ -namespace Cluckwork.Application.Features.Users.CreateUser; - using FluentValidation; +namespace Cluckwork.Application.Features.Users.CreateUser; + public sealed class CreateUserValidator : AbstractValidator { public const string AdminRole = Cluckwork.Domain.Accounts.Roles.Owner; diff --git a/src/Cluckwork.Application/Features/Users/DisableUser/DisableUserHandler.cs b/src/Cluckwork.Application/Features/Users/DisableUser/DisableUserHandler.cs index 1dce38429..2e511578d 100644 --- a/src/Cluckwork.Application/Features/Users/DisableUser/DisableUserHandler.cs +++ b/src/Cluckwork.Application/Features/Users/DisableUser/DisableUserHandler.cs @@ -1,8 +1,8 @@ -namespace Cluckwork.Application.Features.Users.DisableUser; - using Cluckwork.Application.Common; using Cluckwork.Domain.Common; +namespace Cluckwork.Application.Features.Users.DisableUser; + // #356 — disable a user. Step-up (#308) is required UNCONDITIONALLY, in both // directions: unlike a role change, where demoting a Sales user to ReadOnly is // ordinary administration, every disable revokes somebody's access outright. diff --git a/src/Cluckwork.Application/Features/Users/DisableUser/DisableUserValidator.cs b/src/Cluckwork.Application/Features/Users/DisableUser/DisableUserValidator.cs index 7788c12a1..a63862fda 100644 --- a/src/Cluckwork.Application/Features/Users/DisableUser/DisableUserValidator.cs +++ b/src/Cluckwork.Application/Features/Users/DisableUser/DisableUserValidator.cs @@ -1,7 +1,7 @@ -namespace Cluckwork.Application.Features.Users.DisableUser; - using FluentValidation; +namespace Cluckwork.Application.Features.Users.DisableUser; + public sealed class DisableUserValidator : AbstractValidator { // Well under AuditEvent.MaxReasonLength (500), which TRUNCATES rather than diff --git a/src/Cluckwork.Application/Features/Users/EnableUser/EnableUserHandler.cs b/src/Cluckwork.Application/Features/Users/EnableUser/EnableUserHandler.cs index 6125db8ed..9d3f073ab 100644 --- a/src/Cluckwork.Application/Features/Users/EnableUser/EnableUserHandler.cs +++ b/src/Cluckwork.Application/Features/Users/EnableUser/EnableUserHandler.cs @@ -1,8 +1,8 @@ -namespace Cluckwork.Application.Features.Users.EnableUser; - using Cluckwork.Application.Common; using Cluckwork.Domain.Common; +namespace Cluckwork.Application.Features.Users.EnableUser; + // #356 — re-enable a disabled user. There is deliberately no validator: the // command carries no free-text field, only the route's id and the step-up // header. See IIdentityProvider.EnableUserAsync for why this path must NOT diff --git a/src/Cluckwork.Application/Features/Users/IUserRoleAssignmentRepository.cs b/src/Cluckwork.Application/Features/Users/IUserRoleAssignmentRepository.cs index d0cca7186..80fe41736 100644 --- a/src/Cluckwork.Application/Features/Users/IUserRoleAssignmentRepository.cs +++ b/src/Cluckwork.Application/Features/Users/IUserRoleAssignmentRepository.cs @@ -1,7 +1,7 @@ -namespace Cluckwork.Application.Features.Users; - using Cluckwork.Domain.Accounts; +namespace Cluckwork.Application.Features.Users; + public interface IUserRoleAssignmentRepository { Task> ListByUserAsync(Guid userId, CancellationToken ct = default); diff --git a/src/Cluckwork.Application/Features/Users/SetLanguage/SetLanguageHandler.cs b/src/Cluckwork.Application/Features/Users/SetLanguage/SetLanguageHandler.cs index 272953d91..da9c9b91b 100644 --- a/src/Cluckwork.Application/Features/Users/SetLanguage/SetLanguageHandler.cs +++ b/src/Cluckwork.Application/Features/Users/SetLanguage/SetLanguageHandler.cs @@ -1,8 +1,8 @@ -namespace Cluckwork.Application.Features.Users.SetLanguage; - using Cluckwork.Application.Common; using Cluckwork.Domain.Common; +namespace Cluckwork.Application.Features.Users.SetLanguage; + // The user id comes from the token (the endpoint), never the body: a caller can // only ever set their OWN language. Account-scoped inside the provider. public sealed class SetLanguageHandler(IIdentityProvider identity) diff --git a/src/Cluckwork.Application/Features/Users/SetLanguage/SetLanguageValidator.cs b/src/Cluckwork.Application/Features/Users/SetLanguage/SetLanguageValidator.cs index d8b5d9850..843d40892 100644 --- a/src/Cluckwork.Application/Features/Users/SetLanguage/SetLanguageValidator.cs +++ b/src/Cluckwork.Application/Features/Users/SetLanguage/SetLanguageValidator.cs @@ -1,8 +1,8 @@ -namespace Cluckwork.Application.Features.Users.SetLanguage; - using System.Text.RegularExpressions; using FluentValidation; +namespace Cluckwork.Application.Features.Users.SetLanguage; + public sealed partial class SetLanguageValidator : AbstractValidator { public SetLanguageValidator() diff --git a/src/Cluckwork.Application/Features/Users/SetStepperUnit/SetStepperUnitHandler.cs b/src/Cluckwork.Application/Features/Users/SetStepperUnit/SetStepperUnitHandler.cs index 72b6e6777..1db54bbc7 100644 --- a/src/Cluckwork.Application/Features/Users/SetStepperUnit/SetStepperUnitHandler.cs +++ b/src/Cluckwork.Application/Features/Users/SetStepperUnit/SetStepperUnitHandler.cs @@ -1,10 +1,10 @@ -namespace Cluckwork.Application.Features.Users.SetStepperUnit; - using Cluckwork.Application.Common; using Cluckwork.Application.Features.Catalog; using Cluckwork.Domain.Catalog; using Cluckwork.Domain.Common; +namespace Cluckwork.Application.Features.Users.SetStepperUnit; + // The user id comes from the token (the endpoint), never the body: a caller can // only ever set their OWN stepper-unit preference. Account-scoped inside the // provider, same as SetLanguageHandler. diff --git a/src/Cluckwork.Application/Features/Users/SetStepperUnit/SetStepperUnitValidator.cs b/src/Cluckwork.Application/Features/Users/SetStepperUnit/SetStepperUnitValidator.cs index 04a9540d3..1e2e4d493 100644 --- a/src/Cluckwork.Application/Features/Users/SetStepperUnit/SetStepperUnitValidator.cs +++ b/src/Cluckwork.Application/Features/Users/SetStepperUnit/SetStepperUnitValidator.cs @@ -1,8 +1,8 @@ -namespace Cluckwork.Application.Features.Users.SetStepperUnit; - using Cluckwork.Domain.Catalog; using FluentValidation; +namespace Cluckwork.Application.Features.Users.SetStepperUnit; + public sealed class SetStepperUnitValidator : AbstractValidator { public SetStepperUnitValidator() diff --git a/src/Cluckwork.Application/Features/Users/SetUserPassword/SetUserPasswordHandler.cs b/src/Cluckwork.Application/Features/Users/SetUserPassword/SetUserPasswordHandler.cs index afb5ea337..05e5850d0 100644 --- a/src/Cluckwork.Application/Features/Users/SetUserPassword/SetUserPasswordHandler.cs +++ b/src/Cluckwork.Application/Features/Users/SetUserPassword/SetUserPasswordHandler.cs @@ -1,8 +1,8 @@ -namespace Cluckwork.Application.Features.Users.SetUserPassword; - using Cluckwork.Application.Common; using Cluckwork.Domain.Common; +namespace Cluckwork.Application.Features.Users.SetUserPassword; + // #165 base behaviour; #308/#360 — every administrative reset replaces an // authenticator and can turn a short-lived stolen Owner token into an // independently renewable login, regardless of the target's role. Validate a diff --git a/src/Cluckwork.Application/Features/Users/SetUserPassword/SetUserPasswordValidator.cs b/src/Cluckwork.Application/Features/Users/SetUserPassword/SetUserPasswordValidator.cs index 55ebaa744..37df0e72b 100644 --- a/src/Cluckwork.Application/Features/Users/SetUserPassword/SetUserPasswordValidator.cs +++ b/src/Cluckwork.Application/Features/Users/SetUserPassword/SetUserPasswordValidator.cs @@ -1,7 +1,7 @@ -namespace Cluckwork.Application.Features.Users.SetUserPassword; - using FluentValidation; +namespace Cluckwork.Application.Features.Users.SetUserPassword; + public sealed class SetUserPasswordValidator : AbstractValidator { public SetUserPasswordValidator() diff --git a/src/Cluckwork.Application/Features/Users/UpdateUser/UpdateUserHandler.cs b/src/Cluckwork.Application/Features/Users/UpdateUser/UpdateUserHandler.cs index 9247c0a74..de9d7b997 100644 --- a/src/Cluckwork.Application/Features/Users/UpdateUser/UpdateUserHandler.cs +++ b/src/Cluckwork.Application/Features/Users/UpdateUser/UpdateUserHandler.cs @@ -1,9 +1,9 @@ -namespace Cluckwork.Application.Features.Users.UpdateUser; - using Cluckwork.Application.Common; using Cluckwork.Application.Features.Users; using Cluckwork.Domain.Common; +namespace Cluckwork.Application.Features.Users.UpdateUser; + // #163 — the update is scoped to the caller's account inside the provider, so a // user id from another tenant resolves to NotFound, never a cross-account edit. public sealed class UpdateUserHandler(IIdentityProvider identity) diff --git a/src/Cluckwork.Application/Features/Users/UpdateUser/UpdateUserValidator.cs b/src/Cluckwork.Application/Features/Users/UpdateUser/UpdateUserValidator.cs index 3cf269862..ecf5ff41e 100644 --- a/src/Cluckwork.Application/Features/Users/UpdateUser/UpdateUserValidator.cs +++ b/src/Cluckwork.Application/Features/Users/UpdateUser/UpdateUserValidator.cs @@ -1,7 +1,7 @@ -namespace Cluckwork.Application.Features.Users.UpdateUser; - using FluentValidation; +namespace Cluckwork.Application.Features.Users.UpdateUser; + public sealed class UpdateUserValidator : AbstractValidator { public UpdateUserValidator() diff --git a/src/Cluckwork.Domain/Accounts/Account.cs b/src/Cluckwork.Domain/Accounts/Account.cs index 0aff100b3..8b8724768 100644 --- a/src/Cluckwork.Domain/Accounts/Account.cs +++ b/src/Cluckwork.Domain/Accounts/Account.cs @@ -1,9 +1,9 @@ -namespace Cluckwork.Domain.Accounts; - using System.Text.RegularExpressions; using Cluckwork.Domain.Catalog; using Cluckwork.Domain.Sales; +namespace Cluckwork.Domain.Accounts; + // The farm's own settings row. Spec §3.2 models `farms` as a table under the // account; there is no farms aggregate yet (SeedDefaults.FarmId is a stand-in), // so for the single-farm Phase 1 the §4.5 localization fields live here on the diff --git a/src/Cluckwork.Domain/Accounts/CurrencyCatalog.cs b/src/Cluckwork.Domain/Accounts/CurrencyCatalog.cs index f20b940e2..5cde3e357 100644 --- a/src/Cluckwork.Domain/Accounts/CurrencyCatalog.cs +++ b/src/Cluckwork.Domain/Accounts/CurrencyCatalog.cs @@ -1,9 +1,9 @@ -namespace Cluckwork.Domain.Accounts; - using System.Collections.Frozen; using System.Globalization; using System.Text; +namespace Cluckwork.Domain.Accounts; + // Spec §4.6 "Currency derivation fallback": Phase 1 ships a static ISO 4217 // lookup. Symbol and minor unit come from deliberately DIFFERENT sources: // diff --git a/src/Cluckwork.Domain/Accounts/FarmLogo.cs b/src/Cluckwork.Domain/Accounts/FarmLogo.cs index 53390550a..7107fed5a 100644 --- a/src/Cluckwork.Domain/Accounts/FarmLogo.cs +++ b/src/Cluckwork.Domain/Accounts/FarmLogo.cs @@ -1,9 +1,9 @@ -namespace Cluckwork.Domain.Accounts; - using System.Security.Cryptography; using Cluckwork.Domain.Common; using Cluckwork.Domain.Media; +namespace Cluckwork.Domain.Accounts; + // The farm's logo AND banner (#123, #179). Spec §3.2 has no logo field — this // slice adds one, and the spec is updated alongside. // diff --git a/src/Cluckwork.Domain/Catalog/EggUnitConversion.cs b/src/Cluckwork.Domain/Catalog/EggUnitConversion.cs index c43a5ec77..1e7b7fe75 100644 --- a/src/Cluckwork.Domain/Catalog/EggUnitConversion.cs +++ b/src/Cluckwork.Domain/Catalog/EggUnitConversion.cs @@ -1,7 +1,7 @@ -namespace Cluckwork.Domain.Catalog; - using Cluckwork.Domain.Common; +namespace Cluckwork.Domain.Catalog; + // Spec §9.7 — eggs are stored as individual eggs, but products sell in packed // units, and there is NO implicit fixed factor: a carton is 12, 18, or 30 eggs // depending on the market. Each account carries one row per unit code; part 2 diff --git a/src/Cluckwork.Domain/Catalog/Product.cs b/src/Cluckwork.Domain/Catalog/Product.cs index 244bba90d..e229c8cbc 100644 --- a/src/Cluckwork.Domain/Catalog/Product.cs +++ b/src/Cluckwork.Domain/Catalog/Product.cs @@ -1,7 +1,7 @@ -namespace Cluckwork.Domain.Catalog; - using Cluckwork.Domain.Common; +namespace Cluckwork.Domain.Catalog; + // Product catalog (spec §10.1) — what the farm sells. Phase 1 only egg // products are creatable (they map to an egg grade via // ProductEggGradeMapping); the enum already carries the future types so the diff --git a/src/Cluckwork.Domain/Catalog/ProductEggGradeMapping.cs b/src/Cluckwork.Domain/Catalog/ProductEggGradeMapping.cs index 9bddbe62a..2a0e4179c 100644 --- a/src/Cluckwork.Domain/Catalog/ProductEggGradeMapping.cs +++ b/src/Cluckwork.Domain/Catalog/ProductEggGradeMapping.cs @@ -1,7 +1,7 @@ -namespace Cluckwork.Domain.Catalog; - using Cluckwork.Domain.Common; +namespace Cluckwork.Domain.Catalog; + // Spec §10.2 — egg products map to egg grades; part 2 allocates a sold line's // eggs from lots of the mapped grade. Phase 1 enforces exactly ONE mapping per // product (unique index on ProductId); multi-grade products (mixed cartons) diff --git a/src/Cluckwork.Domain/Eggs/DailyEntry.cs b/src/Cluckwork.Domain/Eggs/DailyEntry.cs index 421ba48e1..bb56d9db9 100644 --- a/src/Cluckwork.Domain/Eggs/DailyEntry.cs +++ b/src/Cluckwork.Domain/Eggs/DailyEntry.cs @@ -1,7 +1,7 @@ -namespace Cluckwork.Domain.Eggs; - using System.Text.Json; +namespace Cluckwork.Domain.Eggs; + public sealed class DailyEntry : AggregateRoot, IMutableRecord { public const int MaxReasonLength = 500; diff --git a/src/Cluckwork.Domain/Media/ImageSanitizer.cs b/src/Cluckwork.Domain/Media/ImageSanitizer.cs index 28c3e5cbe..f938b7d90 100644 --- a/src/Cluckwork.Domain/Media/ImageSanitizer.cs +++ b/src/Cluckwork.Domain/Media/ImageSanitizer.cs @@ -1,9 +1,9 @@ -namespace Cluckwork.Domain.Media; - using System.Buffers.Binary; using System.Collections.Frozen; using Cluckwork.Domain.Common; +namespace Cluckwork.Domain.Media; + // #123 — what a farm logo upload is allowed to be. // // This walks the container and rewrites it. It never decodes pixels, and that diff --git a/src/Cluckwork.Domain/Sales/Customer.cs b/src/Cluckwork.Domain/Sales/Customer.cs index be856f524..e032aae1e 100644 --- a/src/Cluckwork.Domain/Sales/Customer.cs +++ b/src/Cluckwork.Domain/Sales/Customer.cs @@ -1,7 +1,7 @@ -namespace Cluckwork.Domain.Sales; - using Cluckwork.Domain.Common; +namespace Cluckwork.Domain.Sales; + // MVP customer (issue #10): reference-app shape — name + phone required, // email/address/note optional. Balances, credit terms, and payments are // Phase 1.1. diff --git a/src/Cluckwork.Infrastructure/Identity/AccountLockout.cs b/src/Cluckwork.Infrastructure/Identity/AccountLockout.cs index 1c1addef6..28d9946b3 100644 --- a/src/Cluckwork.Infrastructure/Identity/AccountLockout.cs +++ b/src/Cluckwork.Infrastructure/Identity/AccountLockout.cs @@ -1,9 +1,9 @@ -namespace Cluckwork.Infrastructure.Identity; - using Cluckwork.Infrastructure.Persistence; using Microsoft.AspNetCore.Identity; using Microsoft.EntityFrameworkCore; +namespace Cluckwork.Infrastructure.Identity; + // #128 per-account lockout, shared by EVERY password-verification oracle rather // than living inside one of them. // diff --git a/src/Cluckwork.Infrastructure/Identity/AccountProvisioner.cs b/src/Cluckwork.Infrastructure/Identity/AccountProvisioner.cs index 382a56511..c69ae0d3d 100644 --- a/src/Cluckwork.Infrastructure/Identity/AccountProvisioner.cs +++ b/src/Cluckwork.Infrastructure/Identity/AccountProvisioner.cs @@ -1,5 +1,3 @@ -namespace Cluckwork.Infrastructure.Identity; - using Cluckwork.Application.Common; using Cluckwork.Application.Features.Accounts; using Cluckwork.Domain.Accounts; @@ -10,6 +8,8 @@ namespace Cluckwork.Infrastructure.Identity; using Microsoft.EntityFrameworkCore; using Npgsql; +namespace Cluckwork.Infrastructure.Identity; + public sealed class AccountProvisioner( AppDbContext db, TenantContext tenant, diff --git a/src/Cluckwork.Infrastructure/Identity/AccountRenameService.cs b/src/Cluckwork.Infrastructure/Identity/AccountRenameService.cs index c9b8dc567..1f0bcc336 100644 --- a/src/Cluckwork.Infrastructure/Identity/AccountRenameService.cs +++ b/src/Cluckwork.Infrastructure/Identity/AccountRenameService.cs @@ -1,5 +1,3 @@ -namespace Cluckwork.Infrastructure.Identity; - using Cluckwork.Application.Common; using Cluckwork.Application.Features.Accounts; using Cluckwork.Domain.Accounts; @@ -7,6 +5,8 @@ namespace Cluckwork.Infrastructure.Identity; using Cluckwork.Infrastructure.Persistence; using Microsoft.EntityFrameworkCore; +namespace Cluckwork.Infrastructure.Identity; + // #732 — changes a farm's code. The operator surface is the `rename-account` verb; this is // the domain path that replaces the guarded raw UPDATE #731 documented, which bumped // Version by hand, wrote no audit row and checked neither the pattern nor the reserved set. diff --git a/src/Cluckwork.Infrastructure/Identity/AccountScopedUserValidator.cs b/src/Cluckwork.Infrastructure/Identity/AccountScopedUserValidator.cs index 3567ff401..90d879f78 100644 --- a/src/Cluckwork.Infrastructure/Identity/AccountScopedUserValidator.cs +++ b/src/Cluckwork.Infrastructure/Identity/AccountScopedUserValidator.cs @@ -1,11 +1,11 @@ -namespace Cluckwork.Infrastructure.Identity; - using System.ComponentModel.DataAnnotations; using Cluckwork.Infrastructure.Persistence; using Microsoft.AspNetCore.Identity; using Microsoft.EntityFrameworkCore; using Microsoft.Extensions.DependencyInjection; +namespace Cluckwork.Infrastructure.Identity; + // #532 — REPLACES Identity's stock UserValidator. It does not // run beside it, and that distinction is the whole point: UserManager runs // EVERY registered IUserValidator, and the stock one always performs a GLOBAL diff --git a/src/Cluckwork.Infrastructure/Identity/AccountSuspensionService.cs b/src/Cluckwork.Infrastructure/Identity/AccountSuspensionService.cs index 3af23ef48..d100ea71f 100644 --- a/src/Cluckwork.Infrastructure/Identity/AccountSuspensionService.cs +++ b/src/Cluckwork.Infrastructure/Identity/AccountSuspensionService.cs @@ -1,11 +1,11 @@ -namespace Cluckwork.Infrastructure.Identity; - using Cluckwork.Application.Common; using Cluckwork.Application.Features.Accounts; using Cluckwork.Domain.Common; using Cluckwork.Infrastructure.Persistence; using Microsoft.EntityFrameworkCore; +namespace Cluckwork.Infrastructure.Identity; + // #532 — takes a farm offline and brings it back. #534 ships the operator verbs // (`suspend-account` / `reactivate-account`) that call this. Shipping it // callerless matched #531, which added Account.Suspend()/Reactivate() the same diff --git a/src/Cluckwork.Infrastructure/Identity/AccountUserDirectory.cs b/src/Cluckwork.Infrastructure/Identity/AccountUserDirectory.cs index 9061f7a44..072011a76 100644 --- a/src/Cluckwork.Infrastructure/Identity/AccountUserDirectory.cs +++ b/src/Cluckwork.Infrastructure/Identity/AccountUserDirectory.cs @@ -1,10 +1,10 @@ -namespace Cluckwork.Infrastructure.Identity; - using Cluckwork.Infrastructure.Persistence; using Microsoft.AspNetCore.Identity; using Microsoft.EntityFrameworkCore; using Microsoft.Extensions.DependencyInjection; +namespace Cluckwork.Infrastructure.Identity; + // #532 — the ONE place production code resolves a user by an ambiguous // identifier. Once an email can exist in several farms, every globally scoped // Identity lookup is either wrong or a crash: diff --git a/src/Cluckwork.Infrastructure/Identity/AdminRecoveryService.cs b/src/Cluckwork.Infrastructure/Identity/AdminRecoveryService.cs index f0b136d29..e311b06ab 100644 --- a/src/Cluckwork.Infrastructure/Identity/AdminRecoveryService.cs +++ b/src/Cluckwork.Infrastructure/Identity/AdminRecoveryService.cs @@ -1,5 +1,3 @@ -namespace Cluckwork.Infrastructure.Identity; - using Cluckwork.Application.Common; using Cluckwork.Application.Features.Accounts; using Cluckwork.Domain.Common; @@ -7,6 +5,8 @@ namespace Cluckwork.Infrastructure.Identity; using Microsoft.AspNetCore.Identity; using Microsoft.EntityFrameworkCore; +namespace Cluckwork.Infrastructure.Identity; + // #265 — offline break-glass account recovery. Motivating case: a single-Owner // farm loses its password and there is no email/SMTP reset path, so the only // other recourse is direct DB surgery. Invoked by the `recover-admin` CLI diff --git a/src/Cluckwork.Infrastructure/Identity/ApplicationRole.cs b/src/Cluckwork.Infrastructure/Identity/ApplicationRole.cs index 64c4c89ad..48458181b 100644 --- a/src/Cluckwork.Infrastructure/Identity/ApplicationRole.cs +++ b/src/Cluckwork.Infrastructure/Identity/ApplicationRole.cs @@ -1,7 +1,7 @@ -namespace Cluckwork.Infrastructure.Identity; - using Microsoft.AspNetCore.Identity; +namespace Cluckwork.Infrastructure.Identity; + public sealed class ApplicationRole : IdentityRole { public ApplicationRole() { } diff --git a/src/Cluckwork.Infrastructure/Identity/ApplicationUser.cs b/src/Cluckwork.Infrastructure/Identity/ApplicationUser.cs index dc8c7a59f..b884fcd19 100644 --- a/src/Cluckwork.Infrastructure/Identity/ApplicationUser.cs +++ b/src/Cluckwork.Infrastructure/Identity/ApplicationUser.cs @@ -1,9 +1,9 @@ -namespace Cluckwork.Infrastructure.Identity; - using Cluckwork.Domain.Catalog; using Cluckwork.Domain.Common; using Microsoft.AspNetCore.Identity; +namespace Cluckwork.Infrastructure.Identity; + public sealed class ApplicationUser : IdentityUser, IMutableRecord { public Guid AccountId { get; set; } diff --git a/src/Cluckwork.Infrastructure/Identity/AuthSecurityEventLogger.cs b/src/Cluckwork.Infrastructure/Identity/AuthSecurityEventLogger.cs index b38839b66..a68b6a10c 100644 --- a/src/Cluckwork.Infrastructure/Identity/AuthSecurityEventLogger.cs +++ b/src/Cluckwork.Infrastructure/Identity/AuthSecurityEventLogger.cs @@ -1,9 +1,9 @@ -namespace Cluckwork.Infrastructure.Identity; - using Cluckwork.Application.Common; using Microsoft.AspNetCore.Http; using Microsoft.Extensions.Logging; +namespace Cluckwork.Infrastructure.Identity; + // #273 codex review (P1b) — single emission point for the LoginFailed / // AccountLockedOut security events, shared by EVERY password-verification // oracle: IdentityProvider.LoginAsync AND StepUpGrantService.IssueAsync diff --git a/src/Cluckwork.Infrastructure/Identity/CurrentUserContext.cs b/src/Cluckwork.Infrastructure/Identity/CurrentUserContext.cs index 8e02bf2c8..59b1e211b 100644 --- a/src/Cluckwork.Infrastructure/Identity/CurrentUserContext.cs +++ b/src/Cluckwork.Infrastructure/Identity/CurrentUserContext.cs @@ -1,7 +1,7 @@ -namespace Cluckwork.Infrastructure.Identity; - using Cluckwork.Application.Common; +namespace Cluckwork.Infrastructure.Identity; + // The acting actor for the current unit of work. Scoped. // // Usually resolved by TenantResolutionMiddleware from the JWT's sub + email diff --git a/src/Cluckwork.Infrastructure/Identity/FirstRunAdminService.cs b/src/Cluckwork.Infrastructure/Identity/FirstRunAdminService.cs index 924bd7568..f9530ff8f 100644 --- a/src/Cluckwork.Infrastructure/Identity/FirstRunAdminService.cs +++ b/src/Cluckwork.Infrastructure/Identity/FirstRunAdminService.cs @@ -1,5 +1,3 @@ -namespace Cluckwork.Infrastructure.Identity; - using Cluckwork.Application.Common; using Cluckwork.Domain.Accounts; using Cluckwork.Domain.Common; @@ -8,6 +6,8 @@ namespace Cluckwork.Infrastructure.Identity; using Microsoft.EntityFrameworkCore; using Microsoft.Extensions.Logging; +namespace Cluckwork.Infrastructure.Identity; + // #283 Part 2 — first-run admin provisioning. Invoked ONLY by the // `bootstrap-admin` CLI command (Cli/BootstrapAdminCliCommand.cs), a one-shot // operator command, never an HTTP endpoint and never a serving-boot side diff --git a/src/Cluckwork.Infrastructure/Identity/FirstRunStatusService.cs b/src/Cluckwork.Infrastructure/Identity/FirstRunStatusService.cs index 8651be73b..688f28cdf 100644 --- a/src/Cluckwork.Infrastructure/Identity/FirstRunStatusService.cs +++ b/src/Cluckwork.Infrastructure/Identity/FirstRunStatusService.cs @@ -1,10 +1,10 @@ -namespace Cluckwork.Infrastructure.Identity; - using Cluckwork.Domain.Accounts; using Cluckwork.Infrastructure.Persistence; using Microsoft.AspNetCore.Identity; using Microsoft.EntityFrameworkCore; +namespace Cluckwork.Infrastructure.Identity; + // #283 follow-up — first-run DISCOVERABILITY. The provisioning mechanism itself // (FirstRunAdminService, the `bootstrap-admin` verb) is unchanged; the gap this // closes is that a freshly migrated DEFAULT ACCOUNT has no administrator to diff --git a/src/Cluckwork.Infrastructure/Identity/IdentityProvider.cs b/src/Cluckwork.Infrastructure/Identity/IdentityProvider.cs index 4414e3b54..0a13b2a88 100644 --- a/src/Cluckwork.Infrastructure/Identity/IdentityProvider.cs +++ b/src/Cluckwork.Infrastructure/Identity/IdentityProvider.cs @@ -1,5 +1,3 @@ -namespace Cluckwork.Infrastructure.Identity; - using System.Runtime.ExceptionServices; using System.Security.Cryptography; using Cluckwork.Application.Common; @@ -17,6 +15,8 @@ namespace Cluckwork.Infrastructure.Identity; using Microsoft.Extensions.Options; using Npgsql; +namespace Cluckwork.Infrastructure.Identity; + public sealed class IdentityProvider( UserManager userManager, RoleManager roleManager, diff --git a/src/Cluckwork.Infrastructure/Identity/JwtTokenService.cs b/src/Cluckwork.Infrastructure/Identity/JwtTokenService.cs index c3d1dde14..c4602ddd6 100644 --- a/src/Cluckwork.Infrastructure/Identity/JwtTokenService.cs +++ b/src/Cluckwork.Infrastructure/Identity/JwtTokenService.cs @@ -1,5 +1,3 @@ -namespace Cluckwork.Infrastructure.Identity; - using System.IdentityModel.Tokens.Jwt; using System.Security.Claims; using System.Security.Cryptography; @@ -7,6 +5,8 @@ namespace Cluckwork.Infrastructure.Identity; using Microsoft.Extensions.Options; using Microsoft.IdentityModel.Tokens; +namespace Cluckwork.Infrastructure.Identity; + public interface IJwtTokenService { TokenPair CreateTokenPair(ApplicationUser user, IReadOnlyCollection roles, string refreshToken); diff --git a/src/Cluckwork.Infrastructure/Identity/PersistentStepUpGrantRegistry.cs b/src/Cluckwork.Infrastructure/Identity/PersistentStepUpGrantRegistry.cs index a40644d66..26a67837a 100644 --- a/src/Cluckwork.Infrastructure/Identity/PersistentStepUpGrantRegistry.cs +++ b/src/Cluckwork.Infrastructure/Identity/PersistentStepUpGrantRegistry.cs @@ -1,10 +1,10 @@ -namespace Cluckwork.Infrastructure.Identity; - using Cluckwork.Infrastructure.Persistence; using Cluckwork.Infrastructure.SharedState; using Microsoft.EntityFrameworkCore; using Microsoft.Extensions.DependencyInjection; +namespace Cluckwork.Infrastructure.Identity; + // #338 — the shared-store implementation of the two step-up-grant guarantees, // replacing InMemoryStepUpGrantRegistry now that both tables have left the // process: diff --git a/src/Cluckwork.Infrastructure/Identity/RefreshToken.cs b/src/Cluckwork.Infrastructure/Identity/RefreshToken.cs index 02bac7eed..710f233ba 100644 --- a/src/Cluckwork.Infrastructure/Identity/RefreshToken.cs +++ b/src/Cluckwork.Infrastructure/Identity/RefreshToken.cs @@ -1,8 +1,8 @@ -namespace Cluckwork.Infrastructure.Identity; - using Microsoft.EntityFrameworkCore; using Microsoft.EntityFrameworkCore.Metadata.Builders; +namespace Cluckwork.Infrastructure.Identity; + // Durable, rotating refresh token (tech spec §7.4). The raw token is never stored; // only its SHA-256 hash. Rotation revokes the presented token and issues a new one, // so a leaked token is single-use and reuse is detectable. diff --git a/src/Cluckwork.Infrastructure/Identity/StepUpGrantService.cs b/src/Cluckwork.Infrastructure/Identity/StepUpGrantService.cs index 58b912bb2..b63579ebd 100644 --- a/src/Cluckwork.Infrastructure/Identity/StepUpGrantService.cs +++ b/src/Cluckwork.Infrastructure/Identity/StepUpGrantService.cs @@ -1,5 +1,3 @@ -namespace Cluckwork.Infrastructure.Identity; - using System.Globalization; using System.IdentityModel.Tokens.Jwt; using System.Security.Claims; @@ -12,6 +10,8 @@ namespace Cluckwork.Infrastructure.Identity; using Microsoft.Extensions.Options; using Microsoft.IdentityModel.Tokens; +namespace Cluckwork.Infrastructure.Identity; + // #308/#360 — THREAT MODEL + MECHANISM (owner-decided; see issues #308 and // #360). // diff --git a/src/Cluckwork.Infrastructure/Identity/TemporaryPassword.cs b/src/Cluckwork.Infrastructure/Identity/TemporaryPassword.cs index 1a9c34cb7..a9c11fb4c 100644 --- a/src/Cluckwork.Infrastructure/Identity/TemporaryPassword.cs +++ b/src/Cluckwork.Infrastructure/Identity/TemporaryPassword.cs @@ -1,7 +1,7 @@ -namespace Cluckwork.Infrastructure.Identity; - using System.Security.Cryptography; +namespace Cluckwork.Infrastructure.Identity; + // #265 — generates a strong random password for break-glass account recovery. // It satisfies the Identity policy configured in Program.cs (RequiredLength = 12 // plus the framework defaults: at least one lowercase, uppercase, digit and diff --git a/src/Cluckwork.Infrastructure/Identity/TimingEqualization.cs b/src/Cluckwork.Infrastructure/Identity/TimingEqualization.cs index 546b23db0..e84e6f375 100644 --- a/src/Cluckwork.Infrastructure/Identity/TimingEqualization.cs +++ b/src/Cluckwork.Infrastructure/Identity/TimingEqualization.cs @@ -1,7 +1,7 @@ -namespace Cluckwork.Infrastructure.Identity; - using Microsoft.AspNetCore.Identity; +namespace Cluckwork.Infrastructure.Identity; + // Shared PBKDF2 timing-equalization hash (#128 / #308): verifying an // incoming password against this costs the same as a real password check, so // a branch that skips the real check (unknown user, wrong account) doesn't diff --git a/src/Cluckwork.Infrastructure/Jobs/DailyEntryLockSweep.cs b/src/Cluckwork.Infrastructure/Jobs/DailyEntryLockSweep.cs index b6bfd8fdd..ec4f74f5e 100644 --- a/src/Cluckwork.Infrastructure/Jobs/DailyEntryLockSweep.cs +++ b/src/Cluckwork.Infrastructure/Jobs/DailyEntryLockSweep.cs @@ -1,5 +1,3 @@ -namespace Cluckwork.Infrastructure.Jobs; - using Cluckwork.Application.Common; using Cluckwork.Domain.Eggs; using Cluckwork.Infrastructure.Persistence; @@ -7,6 +5,8 @@ namespace Cluckwork.Infrastructure.Jobs; using Microsoft.Extensions.DependencyInjection; using Microsoft.Extensions.Logging; +namespace Cluckwork.Infrastructure.Jobs; + // #69 — spec §8.1 default: submitted entries lock automatically once they are // older than 7 farm-local days, counted in the account's own timezone (the // boundary every date rule now shares — #35/#155). Runs from the diff --git a/src/Cluckwork.Infrastructure/Jobs/DurableJobWorker.cs b/src/Cluckwork.Infrastructure/Jobs/DurableJobWorker.cs index 268edf9de..6dfd52679 100644 --- a/src/Cluckwork.Infrastructure/Jobs/DurableJobWorker.cs +++ b/src/Cluckwork.Infrastructure/Jobs/DurableJobWorker.cs @@ -1,11 +1,11 @@ -namespace Cluckwork.Infrastructure.Jobs; - using Cluckwork.Infrastructure.Persistence; using Microsoft.EntityFrameworkCore; using Microsoft.Extensions.DependencyInjection; using Microsoft.Extensions.Hosting; using Microsoft.Extensions.Logging; +namespace Cluckwork.Infrastructure.Jobs; + public sealed class DurableJob { public Guid Id { get; set; } diff --git a/src/Cluckwork.Infrastructure/Jobs/IdempotencyRecordPurgeSweep.cs b/src/Cluckwork.Infrastructure/Jobs/IdempotencyRecordPurgeSweep.cs index 5522cf95d..49f44f66e 100644 --- a/src/Cluckwork.Infrastructure/Jobs/IdempotencyRecordPurgeSweep.cs +++ b/src/Cluckwork.Infrastructure/Jobs/IdempotencyRecordPurgeSweep.cs @@ -1,10 +1,10 @@ -namespace Cluckwork.Infrastructure.Jobs; - using Cluckwork.Infrastructure.Persistence; using Microsoft.EntityFrameworkCore; using Microsoft.Extensions.DependencyInjection; using Microsoft.Extensions.Logging; +namespace Cluckwork.Infrastructure.Jobs; + // #259 — idempotency_records grows without bound: IdempotencyMiddleware inserts // a claim per idempotent write and marks it Completed with the replay payload, // but nothing ever deletes an old row. This sweep purges rows whose CreatedAt is diff --git a/src/Cluckwork.Infrastructure/Jobs/PostgresLeaderLease.cs b/src/Cluckwork.Infrastructure/Jobs/PostgresLeaderLease.cs index 26ba95f12..13285522d 100644 --- a/src/Cluckwork.Infrastructure/Jobs/PostgresLeaderLease.cs +++ b/src/Cluckwork.Infrastructure/Jobs/PostgresLeaderLease.cs @@ -1,9 +1,9 @@ -namespace Cluckwork.Infrastructure.Jobs; - using System.Data; using Microsoft.Extensions.Logging; using Npgsql; +namespace Cluckwork.Infrastructure.Jobs; + // #271 — the background worker's single-runner gate. Exactly one API instance may // run the durable-job poll and the three recurring sweeps; a session-scoped // Postgres advisory lock provides that mutual exclusion across replicas without a diff --git a/src/Cluckwork.Infrastructure/Jobs/RefreshTokenPurgeSweep.cs b/src/Cluckwork.Infrastructure/Jobs/RefreshTokenPurgeSweep.cs index 147805457..1ced3766c 100644 --- a/src/Cluckwork.Infrastructure/Jobs/RefreshTokenPurgeSweep.cs +++ b/src/Cluckwork.Infrastructure/Jobs/RefreshTokenPurgeSweep.cs @@ -1,10 +1,10 @@ -namespace Cluckwork.Infrastructure.Jobs; - using Cluckwork.Infrastructure.Persistence; using Microsoft.EntityFrameworkCore; using Microsoft.Extensions.DependencyInjection; using Microsoft.Extensions.Logging; +namespace Cluckwork.Infrastructure.Jobs; + // #270 — refresh_tokens grows without bound: every login/refresh inserts a // row and rotation keeps inserting, but nothing ever deletes an // expired/revoked row. This sweep purges rows whose OWN ExpiresAt — the diff --git a/src/Cluckwork.Infrastructure/Persistence/AmbientTransaction.cs b/src/Cluckwork.Infrastructure/Persistence/AmbientTransaction.cs index 7eb98810c..d8424015a 100644 --- a/src/Cluckwork.Infrastructure/Persistence/AmbientTransaction.cs +++ b/src/Cluckwork.Infrastructure/Persistence/AmbientTransaction.cs @@ -1,9 +1,9 @@ -namespace Cluckwork.Infrastructure.Persistence; - using Microsoft.EntityFrameworkCore; using Microsoft.EntityFrameworkCore.Infrastructure; using Microsoft.EntityFrameworkCore.Storage; +namespace Cluckwork.Infrastructure.Persistence; + // #307 — IdempotencyMiddleware wraps a whole write request in one transaction // on the request's scoped AppDbContext, so the domain mutation and the // idempotency completion record commit (or roll back) as ONE atomic unit — diff --git a/src/Cluckwork.Infrastructure/Persistence/AppDbContext.cs b/src/Cluckwork.Infrastructure/Persistence/AppDbContext.cs index d173edb83..19d48b157 100644 --- a/src/Cluckwork.Infrastructure/Persistence/AppDbContext.cs +++ b/src/Cluckwork.Infrastructure/Persistence/AppDbContext.cs @@ -1,5 +1,3 @@ -namespace Cluckwork.Infrastructure.Persistence; - using Cluckwork.Domain.Accounts; using Cluckwork.Domain.Auditing; using Cluckwork.Domain.Catalog; @@ -15,6 +13,8 @@ namespace Cluckwork.Infrastructure.Persistence; using Microsoft.EntityFrameworkCore; using Microsoft.EntityFrameworkCore.Metadata; +namespace Cluckwork.Infrastructure.Persistence; + public class AppDbContext(DbContextOptions options, TenantContext tenant, FlockScope flockScope) : IdentityDbContext(options) { diff --git a/src/Cluckwork.Infrastructure/Persistence/AppDbContextDesignTimeFactory.cs b/src/Cluckwork.Infrastructure/Persistence/AppDbContextDesignTimeFactory.cs index 9b208b1a3..8eaacf605 100644 --- a/src/Cluckwork.Infrastructure/Persistence/AppDbContextDesignTimeFactory.cs +++ b/src/Cluckwork.Infrastructure/Persistence/AppDbContextDesignTimeFactory.cs @@ -1,5 +1,3 @@ -namespace Cluckwork.Infrastructure.Persistence; - using System.Net; using Cluckwork.Infrastructure.Persistence.Interceptors; using Cluckwork.Infrastructure.Providers; @@ -8,6 +6,8 @@ namespace Cluckwork.Infrastructure.Persistence; using Microsoft.EntityFrameworkCore.Design; using Npgsql; +namespace Cluckwork.Infrastructure.Persistence; + // #318 — `dotnet ef` design-time tooling fails closed. There is no default connection: an // unset/blank CLUCKWORK_MIGRATIONS_CONNECTION used to fall back to a predictable // Host=localhost;...;Username=postgres;Password=postgres, letting a typo silently target the diff --git a/src/Cluckwork.Infrastructure/Persistence/BusinessRecordModel.cs b/src/Cluckwork.Infrastructure/Persistence/BusinessRecordModel.cs index 777632fdc..90a09762a 100644 --- a/src/Cluckwork.Infrastructure/Persistence/BusinessRecordModel.cs +++ b/src/Cluckwork.Infrastructure/Persistence/BusinessRecordModel.cs @@ -1,11 +1,11 @@ -namespace Cluckwork.Infrastructure.Persistence; - using Cluckwork.Domain.Common; using Cluckwork.Infrastructure.Persistence.Configurations; using Microsoft.EntityFrameworkCore; using Microsoft.EntityFrameworkCore.Metadata; using Microsoft.EntityFrameworkCore.Metadata.Builders; +namespace Cluckwork.Infrastructure.Persistence; + internal static class BusinessRecordModel { private static readonly BusinessRecordContribution[] Contributions = diff --git a/src/Cluckwork.Infrastructure/Persistence/BusinessRecordOrdering.cs b/src/Cluckwork.Infrastructure/Persistence/BusinessRecordOrdering.cs index 43c48d0ae..8fca09e23 100644 --- a/src/Cluckwork.Infrastructure/Persistence/BusinessRecordOrdering.cs +++ b/src/Cluckwork.Infrastructure/Persistence/BusinessRecordOrdering.cs @@ -1,9 +1,9 @@ -namespace Cluckwork.Infrastructure.Persistence; - using System.Linq.Expressions; using Cluckwork.Domain.Common; using Microsoft.EntityFrameworkCore; +namespace Cluckwork.Infrastructure.Persistence; + internal static class BusinessRecordOrdering { private const string SequenceProperty = "Sequence"; diff --git a/src/Cluckwork.Infrastructure/Persistence/Configurations/AccountConfiguration.cs b/src/Cluckwork.Infrastructure/Persistence/Configurations/AccountConfiguration.cs index b8f2fa99d..9d6cb7305 100644 --- a/src/Cluckwork.Infrastructure/Persistence/Configurations/AccountConfiguration.cs +++ b/src/Cluckwork.Infrastructure/Persistence/Configurations/AccountConfiguration.cs @@ -1,9 +1,9 @@ -namespace Cluckwork.Infrastructure.Persistence.Configurations; - using Cluckwork.Domain.Accounts; using Microsoft.EntityFrameworkCore; using Microsoft.EntityFrameworkCore.Metadata.Builders; +namespace Cluckwork.Infrastructure.Persistence.Configurations; + // The account row carries the farm's §4.5 localization settings until a farms // aggregate exists (#123). Everything the settings screen writes is length- and // concurrency-bounded here. diff --git a/src/Cluckwork.Infrastructure/Persistence/Configurations/ApplicationUserConfiguration.cs b/src/Cluckwork.Infrastructure/Persistence/Configurations/ApplicationUserConfiguration.cs index aa0ba1cda..015bdce2d 100644 --- a/src/Cluckwork.Infrastructure/Persistence/Configurations/ApplicationUserConfiguration.cs +++ b/src/Cluckwork.Infrastructure/Persistence/Configurations/ApplicationUserConfiguration.cs @@ -1,9 +1,9 @@ -namespace Cluckwork.Infrastructure.Persistence.Configurations; - using Cluckwork.Infrastructure.Identity; using Microsoft.EntityFrameworkCore; using Microsoft.EntityFrameworkCore.Metadata.Builders; +namespace Cluckwork.Infrastructure.Persistence.Configurations; + // ApplicationUser is otherwise mapped by IdentityDbContext's conventions; this // only bounds the #45 language column. base.OnModelCreating runs before // ApplyConfigurationsFromAssembly, so this is additive — DisplayName stays text. diff --git a/src/Cluckwork.Infrastructure/Persistence/Configurations/AuditEventConfiguration.cs b/src/Cluckwork.Infrastructure/Persistence/Configurations/AuditEventConfiguration.cs index 888b00372..0d6d4461f 100644 --- a/src/Cluckwork.Infrastructure/Persistence/Configurations/AuditEventConfiguration.cs +++ b/src/Cluckwork.Infrastructure/Persistence/Configurations/AuditEventConfiguration.cs @@ -1,9 +1,9 @@ -namespace Cluckwork.Infrastructure.Persistence.Configurations; - using Cluckwork.Domain.Auditing; using Microsoft.EntityFrameworkCore; using Microsoft.EntityFrameworkCore.Metadata.Builders; +namespace Cluckwork.Infrastructure.Persistence.Configurations; + public sealed class AuditEventConfiguration : IEntityTypeConfiguration { public void Configure(EntityTypeBuilder builder) diff --git a/src/Cluckwork.Infrastructure/Persistence/Configurations/CatalogConfiguration.cs b/src/Cluckwork.Infrastructure/Persistence/Configurations/CatalogConfiguration.cs index b194c6133..506745423 100644 --- a/src/Cluckwork.Infrastructure/Persistence/Configurations/CatalogConfiguration.cs +++ b/src/Cluckwork.Infrastructure/Persistence/Configurations/CatalogConfiguration.cs @@ -1,10 +1,10 @@ -namespace Cluckwork.Infrastructure.Persistence.Configurations; - using Cluckwork.Domain.Catalog; using Cluckwork.Domain.Eggs; using Microsoft.EntityFrameworkCore; using Microsoft.EntityFrameworkCore.Metadata.Builders; +namespace Cluckwork.Infrastructure.Persistence.Configurations; + public sealed class ProductConfiguration : IEntityTypeConfiguration { public void Configure(EntityTypeBuilder builder) diff --git a/src/Cluckwork.Infrastructure/Persistence/Configurations/DailyEntryConfiguration.cs b/src/Cluckwork.Infrastructure/Persistence/Configurations/DailyEntryConfiguration.cs index 3a7b07f4d..5375bd3dd 100644 --- a/src/Cluckwork.Infrastructure/Persistence/Configurations/DailyEntryConfiguration.cs +++ b/src/Cluckwork.Infrastructure/Persistence/Configurations/DailyEntryConfiguration.cs @@ -1,9 +1,9 @@ -namespace Cluckwork.Infrastructure.Persistence.Configurations; - using Cluckwork.Domain.Eggs; using Microsoft.EntityFrameworkCore; using Microsoft.EntityFrameworkCore.Metadata.Builders; +namespace Cluckwork.Infrastructure.Persistence.Configurations; + internal static class EggOperationsBusinessRecords { public static readonly BusinessRecordContribution Contribution = new( diff --git a/src/Cluckwork.Infrastructure/Persistence/Configurations/EggInventoryMovementConfiguration.cs b/src/Cluckwork.Infrastructure/Persistence/Configurations/EggInventoryMovementConfiguration.cs index 5326bd127..60537becb 100644 --- a/src/Cluckwork.Infrastructure/Persistence/Configurations/EggInventoryMovementConfiguration.cs +++ b/src/Cluckwork.Infrastructure/Persistence/Configurations/EggInventoryMovementConfiguration.cs @@ -1,9 +1,9 @@ -namespace Cluckwork.Infrastructure.Persistence.Configurations; - using Cluckwork.Domain.Eggs; using Microsoft.EntityFrameworkCore; using Microsoft.EntityFrameworkCore.Metadata.Builders; +namespace Cluckwork.Infrastructure.Persistence.Configurations; + public sealed class EggInventoryMovementConfiguration : IEntityTypeConfiguration { public void Configure(EntityTypeBuilder builder) diff --git a/src/Cluckwork.Infrastructure/Persistence/Configurations/EggLotConfiguration.cs b/src/Cluckwork.Infrastructure/Persistence/Configurations/EggLotConfiguration.cs index 3fb2ab7ca..19e8a2872 100644 --- a/src/Cluckwork.Infrastructure/Persistence/Configurations/EggLotConfiguration.cs +++ b/src/Cluckwork.Infrastructure/Persistence/Configurations/EggLotConfiguration.cs @@ -1,9 +1,9 @@ -namespace Cluckwork.Infrastructure.Persistence.Configurations; - using Cluckwork.Domain.Eggs; using Microsoft.EntityFrameworkCore; using Microsoft.EntityFrameworkCore.Metadata.Builders; +namespace Cluckwork.Infrastructure.Persistence.Configurations; + public sealed class EggLotConfiguration : IEntityTypeConfiguration { public void Configure(EntityTypeBuilder builder) diff --git a/src/Cluckwork.Infrastructure/Persistence/Configurations/ExpenseConfiguration.cs b/src/Cluckwork.Infrastructure/Persistence/Configurations/ExpenseConfiguration.cs index 475f933be..a551d88bd 100644 --- a/src/Cluckwork.Infrastructure/Persistence/Configurations/ExpenseConfiguration.cs +++ b/src/Cluckwork.Infrastructure/Persistence/Configurations/ExpenseConfiguration.cs @@ -1,9 +1,9 @@ -namespace Cluckwork.Infrastructure.Persistence.Configurations; - using Cluckwork.Domain.Expenses; using Microsoft.EntityFrameworkCore; using Microsoft.EntityFrameworkCore.Metadata.Builders; +namespace Cluckwork.Infrastructure.Persistence.Configurations; + internal static class FinanceBusinessRecords { public static readonly BusinessRecordContribution Contribution = new( diff --git a/src/Cluckwork.Infrastructure/Persistence/Configurations/FarmLogoConfiguration.cs b/src/Cluckwork.Infrastructure/Persistence/Configurations/FarmLogoConfiguration.cs index ce0088702..87db65b1e 100644 --- a/src/Cluckwork.Infrastructure/Persistence/Configurations/FarmLogoConfiguration.cs +++ b/src/Cluckwork.Infrastructure/Persistence/Configurations/FarmLogoConfiguration.cs @@ -1,10 +1,10 @@ -namespace Cluckwork.Infrastructure.Persistence.Configurations; - using Cluckwork.Domain.Accounts; using Cluckwork.Domain.Media; using Microsoft.EntityFrameworkCore; using Microsoft.EntityFrameworkCore.Metadata.Builders; +namespace Cluckwork.Infrastructure.Persistence.Configurations; + // #123, #179 — the farm logo AND banner's shared table. See FarmLogo for why // it is not a column on accounts, and for the name discrepancy (this row also // holds the banner) kept deliberately. diff --git a/src/Cluckwork.Infrastructure/Persistence/Configurations/FlockConfiguration.cs b/src/Cluckwork.Infrastructure/Persistence/Configurations/FlockConfiguration.cs index e5e9a8fda..06a4bbe54 100644 --- a/src/Cluckwork.Infrastructure/Persistence/Configurations/FlockConfiguration.cs +++ b/src/Cluckwork.Infrastructure/Persistence/Configurations/FlockConfiguration.cs @@ -1,9 +1,9 @@ -namespace Cluckwork.Infrastructure.Persistence.Configurations; - using Cluckwork.Domain.Flocks; using Microsoft.EntityFrameworkCore; using Microsoft.EntityFrameworkCore.Metadata.Builders; +namespace Cluckwork.Infrastructure.Persistence.Configurations; + internal static class FlockManagementBusinessRecords { public static readonly BusinessRecordContribution Contribution = new( diff --git a/src/Cluckwork.Infrastructure/Persistence/Configurations/InventoryConfiguration.cs b/src/Cluckwork.Infrastructure/Persistence/Configurations/InventoryConfiguration.cs index ab953a876..aef371ba6 100644 --- a/src/Cluckwork.Infrastructure/Persistence/Configurations/InventoryConfiguration.cs +++ b/src/Cluckwork.Infrastructure/Persistence/Configurations/InventoryConfiguration.cs @@ -1,9 +1,9 @@ -namespace Cluckwork.Infrastructure.Persistence.Configurations; - using Cluckwork.Domain.Inventory; using Microsoft.EntityFrameworkCore; using Microsoft.EntityFrameworkCore.Metadata.Builders; +namespace Cluckwork.Infrastructure.Persistence.Configurations; + internal static class GeneralInventoryBusinessRecords { public static readonly BusinessRecordContribution Contribution = new( diff --git a/src/Cluckwork.Infrastructure/Persistence/Configurations/PaymentConfiguration.cs b/src/Cluckwork.Infrastructure/Persistence/Configurations/PaymentConfiguration.cs index 7499e5f5b..4f7edf66a 100644 --- a/src/Cluckwork.Infrastructure/Persistence/Configurations/PaymentConfiguration.cs +++ b/src/Cluckwork.Infrastructure/Persistence/Configurations/PaymentConfiguration.cs @@ -1,9 +1,9 @@ -namespace Cluckwork.Infrastructure.Persistence.Configurations; - using Cluckwork.Domain.Sales; using Microsoft.EntityFrameworkCore; using Microsoft.EntityFrameworkCore.Metadata.Builders; +namespace Cluckwork.Infrastructure.Persistence.Configurations; + public sealed class PaymentConfiguration : IEntityTypeConfiguration { public void Configure(EntityTypeBuilder builder) diff --git a/src/Cluckwork.Infrastructure/Persistence/Configurations/SalesOrderConfiguration.cs b/src/Cluckwork.Infrastructure/Persistence/Configurations/SalesOrderConfiguration.cs index f4a4ca0c7..cc8881fb4 100644 --- a/src/Cluckwork.Infrastructure/Persistence/Configurations/SalesOrderConfiguration.cs +++ b/src/Cluckwork.Infrastructure/Persistence/Configurations/SalesOrderConfiguration.cs @@ -1,9 +1,9 @@ -namespace Cluckwork.Infrastructure.Persistence.Configurations; - using Cluckwork.Domain.Sales; using Microsoft.EntityFrameworkCore; using Microsoft.EntityFrameworkCore.Metadata.Builders; +namespace Cluckwork.Infrastructure.Persistence.Configurations; + internal static class CommerceBusinessRecords { public static readonly BusinessRecordContribution Contribution = new( diff --git a/src/Cluckwork.Infrastructure/Persistence/Configurations/UserRoleAssignmentConfiguration.cs b/src/Cluckwork.Infrastructure/Persistence/Configurations/UserRoleAssignmentConfiguration.cs index 8a1a6ff56..896dd21ea 100644 --- a/src/Cluckwork.Infrastructure/Persistence/Configurations/UserRoleAssignmentConfiguration.cs +++ b/src/Cluckwork.Infrastructure/Persistence/Configurations/UserRoleAssignmentConfiguration.cs @@ -1,9 +1,9 @@ -namespace Cluckwork.Infrastructure.Persistence.Configurations; - using Cluckwork.Domain.Accounts; using Microsoft.EntityFrameworkCore; using Microsoft.EntityFrameworkCore.Metadata.Builders; +namespace Cluckwork.Infrastructure.Persistence.Configurations; + public sealed class UserRoleAssignmentConfiguration : IEntityTypeConfiguration { public void Configure(EntityTypeBuilder builder) diff --git a/src/Cluckwork.Infrastructure/Persistence/DemoDataSeeder.cs b/src/Cluckwork.Infrastructure/Persistence/DemoDataSeeder.cs index 5a646c690..5a6749ae7 100644 --- a/src/Cluckwork.Infrastructure/Persistence/DemoDataSeeder.cs +++ b/src/Cluckwork.Infrastructure/Persistence/DemoDataSeeder.cs @@ -1,7 +1,4 @@ using Cluckwork.Application.Common; - -namespace Cluckwork.Infrastructure.Persistence; - using Cluckwork.Application.Features.Customers.CreateCustomer; using Cluckwork.Application.Features.DailyEntries.RecordDailyEntry; using Cluckwork.Application.Features.DailyEntries.SubmitDailyEntry; @@ -20,6 +17,8 @@ namespace Cluckwork.Infrastructure.Persistence; using Microsoft.EntityFrameworkCore; using Microsoft.Extensions.Logging; +namespace Cluckwork.Infrastructure.Persistence; + // SeedStatus / SeedResult moved to SeedResult.cs (#279) — shared by both this // seeder and SimulationDataSeeder. diff --git a/src/Cluckwork.Infrastructure/Persistence/IdempotencyRecord.cs b/src/Cluckwork.Infrastructure/Persistence/IdempotencyRecord.cs index a61d01b1c..c1f09c6ba 100644 --- a/src/Cluckwork.Infrastructure/Persistence/IdempotencyRecord.cs +++ b/src/Cluckwork.Infrastructure/Persistence/IdempotencyRecord.cs @@ -1,7 +1,7 @@ -namespace Cluckwork.Infrastructure.Persistence; - using Microsoft.EntityFrameworkCore; +namespace Cluckwork.Infrastructure.Persistence; + // #307 — the claim/result states of the database-coordinated idempotency // protocol. InProgress means a lease is held (LeaseOwner/LeaseExpiresAt are // meaningful); Completed means the mutation's result was durably published diff --git a/src/Cluckwork.Infrastructure/Persistence/Interceptors/TenantStampInterceptor.cs b/src/Cluckwork.Infrastructure/Persistence/Interceptors/TenantStampInterceptor.cs index 3d81ebbd8..e1a5a6d5e 100644 --- a/src/Cluckwork.Infrastructure/Persistence/Interceptors/TenantStampInterceptor.cs +++ b/src/Cluckwork.Infrastructure/Persistence/Interceptors/TenantStampInterceptor.cs @@ -1,5 +1,3 @@ -namespace Cluckwork.Infrastructure.Persistence.Interceptors; - using Cluckwork.Application.Common; using Cluckwork.Domain.Common; using Microsoft.EntityFrameworkCore; @@ -8,6 +6,8 @@ namespace Cluckwork.Infrastructure.Persistence.Interceptors; using Microsoft.Extensions.Logging; using Microsoft.Extensions.Logging.Abstractions; +namespace Cluckwork.Infrastructure.Persistence.Interceptors; + // Stamps AccountId on every newly inserted entity so writes can't be mis-tagged // even if a handler forgets to pass it (tech spec §4.2, point 3), AND refuses // any tracked write whose AccountId is not the resolved tenant's (#546). diff --git a/src/Cluckwork.Infrastructure/Persistence/PlatformBusinessRecords.cs b/src/Cluckwork.Infrastructure/Persistence/PlatformBusinessRecords.cs index 9a593d724..152669011 100644 --- a/src/Cluckwork.Infrastructure/Persistence/PlatformBusinessRecords.cs +++ b/src/Cluckwork.Infrastructure/Persistence/PlatformBusinessRecords.cs @@ -1,10 +1,10 @@ -namespace Cluckwork.Infrastructure.Persistence; - using Cluckwork.Domain.Auditing; using Cluckwork.Infrastructure.Identity; using Cluckwork.Infrastructure.Jobs; using Microsoft.AspNetCore.Identity; +namespace Cluckwork.Infrastructure.Persistence; + internal static class PlatformBusinessRecords { public static readonly BusinessRecordContribution Contribution = new( diff --git a/src/Cluckwork.Infrastructure/Persistence/SimulationDataSeeder.cs b/src/Cluckwork.Infrastructure/Persistence/SimulationDataSeeder.cs index dfe412c98..4be77f70a 100644 --- a/src/Cluckwork.Infrastructure/Persistence/SimulationDataSeeder.cs +++ b/src/Cluckwork.Infrastructure/Persistence/SimulationDataSeeder.cs @@ -1,5 +1,3 @@ -namespace Cluckwork.Infrastructure.Persistence; - using System.Security.Cryptography; using System.Text; using System.Text.Json; @@ -46,6 +44,8 @@ namespace Cluckwork.Infrastructure.Persistence; using Microsoft.Extensions.Logging; using Microsoft.Extensions.Options; +namespace Cluckwork.Infrastructure.Persistence; + // #243 load-test simulation seeder: the additional cast (Managers/Sales/ // Workers/ReadOnly beyond the seeded admin), a minimal flock topology, one // flock-restricted worker, the primary account's non-UTC timezone, a second diff --git a/src/Cluckwork.Infrastructure/Persistence/SimulationSeedState.cs b/src/Cluckwork.Infrastructure/Persistence/SimulationSeedState.cs index b35b2c6cc..bba91f54f 100644 --- a/src/Cluckwork.Infrastructure/Persistence/SimulationSeedState.cs +++ b/src/Cluckwork.Infrastructure/Persistence/SimulationSeedState.cs @@ -1,7 +1,7 @@ -namespace Cluckwork.Infrastructure.Persistence; - using Microsoft.EntityFrameworkCore; +namespace Cluckwork.Infrastructure.Persistence; + // #279 review (codex re-check) — a durable bookmark for the simulation seed, so // idempotency never depends on INFERRING state from the fixture rows themselves. // Exactly one row per seeded account (AccountId is the PK): diff --git a/src/Cluckwork.Infrastructure/Persistence/SingleAttemptExecution.cs b/src/Cluckwork.Infrastructure/Persistence/SingleAttemptExecution.cs index a79827dff..ad40fa3e8 100644 --- a/src/Cluckwork.Infrastructure/Persistence/SingleAttemptExecution.cs +++ b/src/Cluckwork.Infrastructure/Persistence/SingleAttemptExecution.cs @@ -1,9 +1,9 @@ -namespace Cluckwork.Infrastructure.Persistence; - using System.Runtime.ExceptionServices; using Microsoft.EntityFrameworkCore; using Microsoft.EntityFrameworkCore.Infrastructure; +namespace Cluckwork.Infrastructure.Persistence; + // #269 — the retry BOUNDARY. // // EnableRetryOnFailure (PostgresDbContextConfigurator) makes EF replay a diff --git a/src/Cluckwork.Infrastructure/Persistence/UnitOfWork.cs b/src/Cluckwork.Infrastructure/Persistence/UnitOfWork.cs index 7a6eb2ad0..6f3b3b217 100644 --- a/src/Cluckwork.Infrastructure/Persistence/UnitOfWork.cs +++ b/src/Cluckwork.Infrastructure/Persistence/UnitOfWork.cs @@ -1,7 +1,7 @@ -namespace Cluckwork.Infrastructure.Persistence; - using Cluckwork.Application.Common; +namespace Cluckwork.Infrastructure.Persistence; + public sealed class UnitOfWork(AppDbContext db) : IUnitOfWork { public Task SaveChangesAsync(CancellationToken ct = default) => diff --git a/src/Cluckwork.Infrastructure/Providers/IDbProviderConfigurator.cs b/src/Cluckwork.Infrastructure/Providers/IDbProviderConfigurator.cs index 2dca7ef43..fb0f56014 100644 --- a/src/Cluckwork.Infrastructure/Providers/IDbProviderConfigurator.cs +++ b/src/Cluckwork.Infrastructure/Providers/IDbProviderConfigurator.cs @@ -1,7 +1,7 @@ -namespace Cluckwork.Infrastructure.Providers; - using Microsoft.EntityFrameworkCore; +namespace Cluckwork.Infrastructure.Providers; + // Abstraction for provider-specific DbContext configuration (tech spec §5.3). // Selected at startup from "Database:Provider" config key. public interface IDbProviderConfigurator diff --git a/src/Cluckwork.Infrastructure/Providers/Postgres/PostgresConnectionString.cs b/src/Cluckwork.Infrastructure/Providers/Postgres/PostgresConnectionString.cs index a94251f6f..f4ecd8434 100644 --- a/src/Cluckwork.Infrastructure/Providers/Postgres/PostgresConnectionString.cs +++ b/src/Cluckwork.Infrastructure/Providers/Postgres/PostgresConnectionString.cs @@ -1,8 +1,8 @@ -namespace Cluckwork.Infrastructure.Providers.Postgres; - using System.Data.Common; using Npgsql; +namespace Cluckwork.Infrastructure.Providers.Postgres; + // Normalizes a Postgres connection string and enforces the production TLS floor. // Call this ONCE at startup (composition root); the result is a plain Npgsql key-value // string safe to hand to UseNpgsql on every DbContext resolution. diff --git a/src/Cluckwork.Infrastructure/Providers/Postgres/PostgresDbContextConfigurator.cs b/src/Cluckwork.Infrastructure/Providers/Postgres/PostgresDbContextConfigurator.cs index c5d0b7d85..75cff2f1f 100644 --- a/src/Cluckwork.Infrastructure/Providers/Postgres/PostgresDbContextConfigurator.cs +++ b/src/Cluckwork.Infrastructure/Providers/Postgres/PostgresDbContextConfigurator.cs @@ -1,7 +1,7 @@ -namespace Cluckwork.Infrastructure.Providers.Postgres; - using Microsoft.EntityFrameworkCore; +namespace Cluckwork.Infrastructure.Providers.Postgres; + public sealed class PostgresDbContextConfigurator : IDbProviderConfigurator { // Migrations live here so provider-specific SQL stays separate (tech spec §5.2). diff --git a/src/Cluckwork.Infrastructure/RateLimiting/DistributedIpFixedWindowPolicy.cs b/src/Cluckwork.Infrastructure/RateLimiting/DistributedIpFixedWindowPolicy.cs index af55846e2..3ec6ad741 100644 --- a/src/Cluckwork.Infrastructure/RateLimiting/DistributedIpFixedWindowPolicy.cs +++ b/src/Cluckwork.Infrastructure/RateLimiting/DistributedIpFixedWindowPolicy.cs @@ -1,11 +1,11 @@ -namespace Cluckwork.Infrastructure.RateLimiting; - using System.Threading.RateLimiting; using Cluckwork.Infrastructure.SharedState; using Microsoft.AspNetCore.Http; using Microsoft.AspNetCore.RateLimiting; using Microsoft.Extensions.DependencyInjection; +namespace Cluckwork.Infrastructure.RateLimiting; + // #544 — the public IRateLimiterPolicy the Api layer registers for each IP-keyed auth // policy (login / refresh / client-errors). It is the ONLY bridge across the assembly // boundary: the internal IFixedWindowCounter port stays internal to Infrastructure and is diff --git a/src/Cluckwork.Infrastructure/RateLimiting/DistributedIpFixedWindowRateLimiter.cs b/src/Cluckwork.Infrastructure/RateLimiting/DistributedIpFixedWindowRateLimiter.cs index 2cef800fa..978e89ed5 100644 --- a/src/Cluckwork.Infrastructure/RateLimiting/DistributedIpFixedWindowRateLimiter.cs +++ b/src/Cluckwork.Infrastructure/RateLimiting/DistributedIpFixedWindowRateLimiter.cs @@ -1,9 +1,9 @@ -namespace Cluckwork.Infrastructure.RateLimiting; - using System.Threading; using System.Threading.RateLimiting; using Cluckwork.Infrastructure.SharedState; +namespace Cluckwork.Infrastructure.RateLimiting; + // #544 — the per-IP fixed-window RateLimiter that enforces its budget through the // SHARED IFixedWindowCounter (Redis-backed with in-process fallback, #543) instead of // ASP.NET's per-process partition state. One instance is created per partition key (the diff --git a/src/Cluckwork.Infrastructure/RateLimiting/DistributedReportConcurrencyLimiter.cs b/src/Cluckwork.Infrastructure/RateLimiting/DistributedReportConcurrencyLimiter.cs index 4dd241a73..e51ff3fb2 100644 --- a/src/Cluckwork.Infrastructure/RateLimiting/DistributedReportConcurrencyLimiter.cs +++ b/src/Cluckwork.Infrastructure/RateLimiting/DistributedReportConcurrencyLimiter.cs @@ -1,10 +1,10 @@ -namespace Cluckwork.Infrastructure.RateLimiting; - using Cluckwork.Application.Common; using Cluckwork.Infrastructure.SharedState; using Microsoft.Extensions.Logging; using StackExchange.Redis; +namespace Cluckwork.Infrastructure.RateLimiting; + // #545 — per-account report concurrency cap enforced through the shared lease // backends (#543), replacing the process-local PartitionedRateLimiter (#311). // diff --git a/src/Cluckwork.Infrastructure/RateLimiting/RateLimitKey.cs b/src/Cluckwork.Infrastructure/RateLimiting/RateLimitKey.cs index f49ccbbef..174091345 100644 --- a/src/Cluckwork.Infrastructure/RateLimiting/RateLimitKey.cs +++ b/src/Cluckwork.Infrastructure/RateLimiting/RateLimitKey.cs @@ -1,8 +1,8 @@ -namespace Cluckwork.Infrastructure.RateLimiting; - using System.Net; using System.Net.Sockets; +namespace Cluckwork.Infrastructure.RateLimiting; + // Derives the rate-limit partition key from the resolved client IP. The IP // itself is resolved by the framework ForwardedHeaders middleware; this only // decides the bucket granularity. diff --git a/src/Cluckwork.Infrastructure/RateLimiting/ReportConcurrencyCapRegistration.cs b/src/Cluckwork.Infrastructure/RateLimiting/ReportConcurrencyCapRegistration.cs index 9cbdcd9b1..dba3d699d 100644 --- a/src/Cluckwork.Infrastructure/RateLimiting/ReportConcurrencyCapRegistration.cs +++ b/src/Cluckwork.Infrastructure/RateLimiting/ReportConcurrencyCapRegistration.cs @@ -1,10 +1,10 @@ -namespace Cluckwork.Infrastructure.RateLimiting; - using Cluckwork.Infrastructure.SharedState; using Microsoft.Extensions.DependencyInjection; using Microsoft.Extensions.Logging; using StackExchange.Redis; +namespace Cluckwork.Infrastructure.RateLimiting; + // #545 — registers the distributed report-concurrency cap. Factory-deferred so // IConnectionMultiplexer/TimeProvider resolve on first use (after Build), // independent of registration order (mirrors SharedStateRegistration). A diff --git a/src/Cluckwork.Infrastructure/RateLimiting/ReportConcurrencyPermit.cs b/src/Cluckwork.Infrastructure/RateLimiting/ReportConcurrencyPermit.cs index 0a235bda7..3f75537c2 100644 --- a/src/Cluckwork.Infrastructure/RateLimiting/ReportConcurrencyPermit.cs +++ b/src/Cluckwork.Infrastructure/RateLimiting/ReportConcurrencyPermit.cs @@ -1,9 +1,9 @@ -namespace Cluckwork.Infrastructure.RateLimiting; - using Cluckwork.Application.Common; using Cluckwork.Infrastructure.SharedState; using Microsoft.Extensions.Logging; +namespace Cluckwork.Infrastructure.RateLimiting; + // #545 — the outcome of a single renewal, which drives re-accounting. // Renewed: the slot is still ours. Lost: a REACHABLE backend rejected the renewal // (the slot's TTL lapsed and it may have been re-granted) — the running report is diff --git a/src/Cluckwork.Infrastructure/Repositories/AccountRepository.cs b/src/Cluckwork.Infrastructure/Repositories/AccountRepository.cs index 45af19be3..0ea997e8e 100644 --- a/src/Cluckwork.Infrastructure/Repositories/AccountRepository.cs +++ b/src/Cluckwork.Infrastructure/Repositories/AccountRepository.cs @@ -1,10 +1,10 @@ -namespace Cluckwork.Infrastructure.Repositories; - using Cluckwork.Application.Features.Accounts; using Cluckwork.Domain.Accounts; using Cluckwork.Infrastructure.Persistence; using Microsoft.EntityFrameworkCore; +namespace Cluckwork.Infrastructure.Repositories; + public sealed class AccountRepository(AppDbContext db, TenantContext tenant) : IAccountRepository { // The account query filter is self-scoped (AccountId == Id == tenant), so diff --git a/src/Cluckwork.Infrastructure/Repositories/AuditEventRepository.cs b/src/Cluckwork.Infrastructure/Repositories/AuditEventRepository.cs index d6ac8b5fe..9059ef8bd 100644 --- a/src/Cluckwork.Infrastructure/Repositories/AuditEventRepository.cs +++ b/src/Cluckwork.Infrastructure/Repositories/AuditEventRepository.cs @@ -1,11 +1,11 @@ -namespace Cluckwork.Infrastructure.Repositories; - using Cluckwork.Application.Common; using Cluckwork.Application.Features.Audit; using Cluckwork.Domain.Auditing; using Cluckwork.Infrastructure.Persistence; using Microsoft.EntityFrameworkCore; +namespace Cluckwork.Infrastructure.Repositories; + public sealed class AuditEventRepository(AppDbContext db, TenantContext tenant) : IAuditEventRepository { public async Task> ListAsync( diff --git a/src/Cluckwork.Infrastructure/Repositories/AuditWriter.cs b/src/Cluckwork.Infrastructure/Repositories/AuditWriter.cs index ac8e3af57..7369483c9 100644 --- a/src/Cluckwork.Infrastructure/Repositories/AuditWriter.cs +++ b/src/Cluckwork.Infrastructure/Repositories/AuditWriter.cs @@ -1,10 +1,10 @@ -namespace Cluckwork.Infrastructure.Repositories; - using System.Text.Json; using Cluckwork.Application.Common; using Cluckwork.Domain.Auditing; using Cluckwork.Infrastructure.Persistence; +namespace Cluckwork.Infrastructure.Repositories; + // Appends to the handler's OWN unit of work — no SaveChanges here, so the // event commits or rolls back with the change it records (tech spec: audit is // domain data, same transaction). diff --git a/src/Cluckwork.Infrastructure/Repositories/BirdMovementRepository.cs b/src/Cluckwork.Infrastructure/Repositories/BirdMovementRepository.cs index b2d9018a8..755adf6fa 100644 --- a/src/Cluckwork.Infrastructure/Repositories/BirdMovementRepository.cs +++ b/src/Cluckwork.Infrastructure/Repositories/BirdMovementRepository.cs @@ -1,10 +1,10 @@ -namespace Cluckwork.Infrastructure.Repositories; - using Cluckwork.Application.Features.Flocks; using Cluckwork.Domain.Flocks; using Cluckwork.Infrastructure.Persistence; using Microsoft.EntityFrameworkCore; +namespace Cluckwork.Infrastructure.Repositories; + public sealed class BirdMovementRepository(AppDbContext db) : IBirdMovementRepository { // Reads rely on the tenant query filter (AccountId == current tenant). diff --git a/src/Cluckwork.Infrastructure/Repositories/CatalogRepositories.cs b/src/Cluckwork.Infrastructure/Repositories/CatalogRepositories.cs index 1a1400700..5f7d241b8 100644 --- a/src/Cluckwork.Infrastructure/Repositories/CatalogRepositories.cs +++ b/src/Cluckwork.Infrastructure/Repositories/CatalogRepositories.cs @@ -1,10 +1,10 @@ -namespace Cluckwork.Infrastructure.Repositories; - using Cluckwork.Application.Features.Catalog; using Cluckwork.Domain.Catalog; using Cluckwork.Infrastructure.Persistence; using Microsoft.EntityFrameworkCore; +namespace Cluckwork.Infrastructure.Repositories; + public sealed class ProductRepository(AppDbContext db) : IProductRepository { public Task GetByIdAsync(Guid id, CancellationToken ct = default) => diff --git a/src/Cluckwork.Infrastructure/Repositories/CurrencyBoundRowProbe.cs b/src/Cluckwork.Infrastructure/Repositories/CurrencyBoundRowProbe.cs index c920973b0..b70db5ed6 100644 --- a/src/Cluckwork.Infrastructure/Repositories/CurrencyBoundRowProbe.cs +++ b/src/Cluckwork.Infrastructure/Repositories/CurrencyBoundRowProbe.cs @@ -1,9 +1,9 @@ -namespace Cluckwork.Infrastructure.Repositories; - using Cluckwork.Application.Features.Accounts; using Cluckwork.Infrastructure.Persistence; using Microsoft.EntityFrameworkCore; +namespace Cluckwork.Infrastructure.Repositories; + // Everything that has snapshotted the farm currency, scoped to the current // tenant by the query filters. Short-circuits: on a working farm the first // probe usually answers it. diff --git a/src/Cluckwork.Infrastructure/Repositories/CustomerRepository.cs b/src/Cluckwork.Infrastructure/Repositories/CustomerRepository.cs index 79585075b..7b5b5f971 100644 --- a/src/Cluckwork.Infrastructure/Repositories/CustomerRepository.cs +++ b/src/Cluckwork.Infrastructure/Repositories/CustomerRepository.cs @@ -1,10 +1,10 @@ -namespace Cluckwork.Infrastructure.Repositories; - using Cluckwork.Application.Features.Customers; using Cluckwork.Domain.Sales; using Cluckwork.Infrastructure.Persistence; using Microsoft.EntityFrameworkCore; +namespace Cluckwork.Infrastructure.Repositories; + public sealed class CustomerRepository(AppDbContext db) : ICustomerRepository { // Reads rely on the tenant query filter (AccountId == current tenant). diff --git a/src/Cluckwork.Infrastructure/Repositories/DailyEntryRepository.cs b/src/Cluckwork.Infrastructure/Repositories/DailyEntryRepository.cs index 3e9369406..b3b7c97c0 100644 --- a/src/Cluckwork.Infrastructure/Repositories/DailyEntryRepository.cs +++ b/src/Cluckwork.Infrastructure/Repositories/DailyEntryRepository.cs @@ -1,10 +1,10 @@ -namespace Cluckwork.Infrastructure.Repositories; - using Cluckwork.Application.Features.DailyEntries; using Cluckwork.Domain.Eggs; using Cluckwork.Infrastructure.Persistence; using Microsoft.EntityFrameworkCore; +namespace Cluckwork.Infrastructure.Repositories; + public sealed class DailyEntryRepository(AppDbContext db) : IDailyEntryRepository { // Grades are always eager-loaded: RecordProduction does a full replace of the diff --git a/src/Cluckwork.Infrastructure/Repositories/EggGradeRepository.cs b/src/Cluckwork.Infrastructure/Repositories/EggGradeRepository.cs index 946756d7c..7847b0195 100644 --- a/src/Cluckwork.Infrastructure/Repositories/EggGradeRepository.cs +++ b/src/Cluckwork.Infrastructure/Repositories/EggGradeRepository.cs @@ -1,10 +1,10 @@ -namespace Cluckwork.Infrastructure.Repositories; - using Cluckwork.Application.Features.EggGrades; using Cluckwork.Domain.Eggs; using Cluckwork.Infrastructure.Persistence; using Microsoft.EntityFrameworkCore; +namespace Cluckwork.Infrastructure.Repositories; + public sealed class EggGradeRepository(AppDbContext db) : IEggGradeRepository { // Reads rely on the tenant query filter (AccountId == current tenant). diff --git a/src/Cluckwork.Infrastructure/Repositories/EggInventoryMovementRepository.cs b/src/Cluckwork.Infrastructure/Repositories/EggInventoryMovementRepository.cs index 92d121235..0283b2484 100644 --- a/src/Cluckwork.Infrastructure/Repositories/EggInventoryMovementRepository.cs +++ b/src/Cluckwork.Infrastructure/Repositories/EggInventoryMovementRepository.cs @@ -1,10 +1,10 @@ -namespace Cluckwork.Infrastructure.Repositories; - using Cluckwork.Application.Features.Eggs; using Cluckwork.Domain.Eggs; using Cluckwork.Infrastructure.Persistence; using Microsoft.EntityFrameworkCore; +namespace Cluckwork.Infrastructure.Repositories; + public sealed class EggInventoryMovementRepository(AppDbContext db) : IEggInventoryMovementRepository { public async Task AddAsync(EggInventoryMovement movement, CancellationToken ct = default) => diff --git a/src/Cluckwork.Infrastructure/Repositories/EggLotRepository.cs b/src/Cluckwork.Infrastructure/Repositories/EggLotRepository.cs index ce12cd098..521f7c299 100644 --- a/src/Cluckwork.Infrastructure/Repositories/EggLotRepository.cs +++ b/src/Cluckwork.Infrastructure/Repositories/EggLotRepository.cs @@ -1,10 +1,10 @@ -namespace Cluckwork.Infrastructure.Repositories; - using Cluckwork.Application.Features.EggLots; using Cluckwork.Domain.Eggs; using Cluckwork.Infrastructure.Persistence; using Microsoft.EntityFrameworkCore; +namespace Cluckwork.Infrastructure.Repositories; + public sealed class EggLotRepository(AppDbContext db) : IEggLotRepository { public Task GetByIdAsync(Guid id, CancellationToken ct = default) => diff --git a/src/Cluckwork.Infrastructure/Repositories/ExpenseRepositories.cs b/src/Cluckwork.Infrastructure/Repositories/ExpenseRepositories.cs index 89f71e4cf..43987a964 100644 --- a/src/Cluckwork.Infrastructure/Repositories/ExpenseRepositories.cs +++ b/src/Cluckwork.Infrastructure/Repositories/ExpenseRepositories.cs @@ -1,10 +1,10 @@ -namespace Cluckwork.Infrastructure.Repositories; - using Cluckwork.Application.Features.Expenses; using Cluckwork.Domain.Expenses; using Cluckwork.Infrastructure.Persistence; using Microsoft.EntityFrameworkCore; +namespace Cluckwork.Infrastructure.Repositories; + public sealed class ExpenseCategoryRepository(AppDbContext db) : IExpenseCategoryRepository { // Reads rely on the tenant query filter (AccountId == current tenant). diff --git a/src/Cluckwork.Infrastructure/Repositories/ExportQueries.cs b/src/Cluckwork.Infrastructure/Repositories/ExportQueries.cs index e8a91448b..d4eb5f084 100644 --- a/src/Cluckwork.Infrastructure/Repositories/ExportQueries.cs +++ b/src/Cluckwork.Infrastructure/Repositories/ExportQueries.cs @@ -1,5 +1,3 @@ -namespace Cluckwork.Infrastructure.Repositories; - using System.Data; using System.Runtime.CompilerServices; using Cluckwork.Application.Features.Export; @@ -7,6 +5,8 @@ namespace Cluckwork.Infrastructure.Repositories; using Microsoft.EntityFrameworkCore; using Microsoft.EntityFrameworkCore.Storage; +namespace Cluckwork.Infrastructure.Repositories; + // #95 — flattens every tenant-owned dataset for CSV export. Rows come through // the global tenant query filters, so an export only ever contains the calling // account's data. Money is exported as raw minor units + currency columns — diff --git a/src/Cluckwork.Infrastructure/Repositories/FarmLogoRepository.cs b/src/Cluckwork.Infrastructure/Repositories/FarmLogoRepository.cs index 3764c0134..aa5ca4839 100644 --- a/src/Cluckwork.Infrastructure/Repositories/FarmLogoRepository.cs +++ b/src/Cluckwork.Infrastructure/Repositories/FarmLogoRepository.cs @@ -1,10 +1,10 @@ -namespace Cluckwork.Infrastructure.Repositories; - using Cluckwork.Application.Features.Accounts; using Cluckwork.Domain.Accounts; using Cluckwork.Infrastructure.Persistence; using Microsoft.EntityFrameworkCore; +namespace Cluckwork.Infrastructure.Repositories; + // One row per tenant, so FirstOrDefault under the query filter is the farm's // logo (#123). public sealed class FarmLogoRepository(AppDbContext db) : IFarmLogoRepository diff --git a/src/Cluckwork.Infrastructure/Repositories/FeedUsageRepository.cs b/src/Cluckwork.Infrastructure/Repositories/FeedUsageRepository.cs index d819ee1f6..423823a1b 100644 --- a/src/Cluckwork.Infrastructure/Repositories/FeedUsageRepository.cs +++ b/src/Cluckwork.Infrastructure/Repositories/FeedUsageRepository.cs @@ -1,10 +1,10 @@ -namespace Cluckwork.Infrastructure.Repositories; - using Cluckwork.Application.Features.Inventory; using Cluckwork.Domain.Inventory; using Cluckwork.Infrastructure.Persistence; using Microsoft.EntityFrameworkCore; +namespace Cluckwork.Infrastructure.Repositories; + public sealed class FeedUsageRepository(AppDbContext db) : IFeedUsageRepository { public Task GetByIdAsync(Guid id, CancellationToken ct = default) => diff --git a/src/Cluckwork.Infrastructure/Repositories/FlockRepository.cs b/src/Cluckwork.Infrastructure/Repositories/FlockRepository.cs index 98ae46924..864a90f34 100644 --- a/src/Cluckwork.Infrastructure/Repositories/FlockRepository.cs +++ b/src/Cluckwork.Infrastructure/Repositories/FlockRepository.cs @@ -1,10 +1,10 @@ -namespace Cluckwork.Infrastructure.Repositories; - using Cluckwork.Application.Features.Flocks; using Cluckwork.Domain.Flocks; using Cluckwork.Infrastructure.Persistence; using Microsoft.EntityFrameworkCore; +namespace Cluckwork.Infrastructure.Repositories; + public sealed class FlockRepository(AppDbContext db) : IFlockRepository { // Reads rely on the tenant query filter (AccountId == current tenant), so the diff --git a/src/Cluckwork.Infrastructure/Repositories/InventoryItemRepository.cs b/src/Cluckwork.Infrastructure/Repositories/InventoryItemRepository.cs index d0a96a949..701b40c30 100644 --- a/src/Cluckwork.Infrastructure/Repositories/InventoryItemRepository.cs +++ b/src/Cluckwork.Infrastructure/Repositories/InventoryItemRepository.cs @@ -1,10 +1,10 @@ -namespace Cluckwork.Infrastructure.Repositories; - using Cluckwork.Application.Features.Inventory; using Cluckwork.Domain.Inventory; using Cluckwork.Infrastructure.Persistence; using Microsoft.EntityFrameworkCore; +namespace Cluckwork.Infrastructure.Repositories; + public sealed class InventoryItemRepository(AppDbContext db) : IInventoryItemRepository { public Task GetByIdAsync(Guid id, CancellationToken ct = default) => diff --git a/src/Cluckwork.Infrastructure/Repositories/InventoryLotRepository.cs b/src/Cluckwork.Infrastructure/Repositories/InventoryLotRepository.cs index ed22c7372..b03641f26 100644 --- a/src/Cluckwork.Infrastructure/Repositories/InventoryLotRepository.cs +++ b/src/Cluckwork.Infrastructure/Repositories/InventoryLotRepository.cs @@ -1,10 +1,10 @@ -namespace Cluckwork.Infrastructure.Repositories; - using Cluckwork.Application.Features.Inventory; using Cluckwork.Domain.Inventory; using Cluckwork.Infrastructure.Persistence; using Microsoft.EntityFrameworkCore; +namespace Cluckwork.Infrastructure.Repositories; + public sealed class InventoryLotRepository(AppDbContext db) : IInventoryLotRepository { public Task GetByIdAsync(Guid id, CancellationToken ct = default) => diff --git a/src/Cluckwork.Infrastructure/Repositories/InventoryMovementRepository.cs b/src/Cluckwork.Infrastructure/Repositories/InventoryMovementRepository.cs index c55b838ce..01c5c31b9 100644 --- a/src/Cluckwork.Infrastructure/Repositories/InventoryMovementRepository.cs +++ b/src/Cluckwork.Infrastructure/Repositories/InventoryMovementRepository.cs @@ -1,10 +1,10 @@ -namespace Cluckwork.Infrastructure.Repositories; - using Cluckwork.Application.Features.Inventory; using Cluckwork.Domain.Inventory; using Cluckwork.Infrastructure.Persistence; using Microsoft.EntityFrameworkCore; +namespace Cluckwork.Infrastructure.Repositories; + public sealed class InventoryMovementRepository(AppDbContext db) : IInventoryMovementRepository { public Task GetByIdAsync(Guid id, CancellationToken ct = default) => diff --git a/src/Cluckwork.Infrastructure/Repositories/LiteralSearch.cs b/src/Cluckwork.Infrastructure/Repositories/LiteralSearch.cs index 4d6618760..2cd8151f2 100644 --- a/src/Cluckwork.Infrastructure/Repositories/LiteralSearch.cs +++ b/src/Cluckwork.Infrastructure/Repositories/LiteralSearch.cs @@ -1,7 +1,7 @@ -namespace Cluckwork.Infrastructure.Repositories; - using Microsoft.EntityFrameworkCore; +namespace Cluckwork.Infrastructure.Repositories; + // #512 — literal name search, shared by the flock and customer discovery // queries because the two routes must not drift on the one thing the picker // contract promises: what the user typed is data, never pattern syntax. diff --git a/src/Cluckwork.Infrastructure/Repositories/PaymentRepository.cs b/src/Cluckwork.Infrastructure/Repositories/PaymentRepository.cs index 0c1288fd0..3415d8a74 100644 --- a/src/Cluckwork.Infrastructure/Repositories/PaymentRepository.cs +++ b/src/Cluckwork.Infrastructure/Repositories/PaymentRepository.cs @@ -1,10 +1,10 @@ -namespace Cluckwork.Infrastructure.Repositories; - using Cluckwork.Application.Features.Sales; using Cluckwork.Domain.Sales; using Cluckwork.Infrastructure.Persistence; using Microsoft.EntityFrameworkCore; +namespace Cluckwork.Infrastructure.Repositories; + public sealed class PaymentRepository(AppDbContext db) : IPaymentRepository { // Reads rely on the tenant query filter (AccountId == current tenant). diff --git a/src/Cluckwork.Infrastructure/Repositories/ReportQueries.cs b/src/Cluckwork.Infrastructure/Repositories/ReportQueries.cs index 8460af67f..da5f6025a 100644 --- a/src/Cluckwork.Infrastructure/Repositories/ReportQueries.cs +++ b/src/Cluckwork.Infrastructure/Repositories/ReportQueries.cs @@ -1,11 +1,11 @@ -namespace Cluckwork.Infrastructure.Repositories; - using Cluckwork.Application.Features.Reports; using Cluckwork.Domain.Eggs; using Cluckwork.Domain.Sales; using Cluckwork.Infrastructure.Persistence; using Microsoft.EntityFrameworkCore; +namespace Cluckwork.Infrastructure.Repositories; + public sealed class ReportQueries(AppDbContext db) : IReportQueries { // Official entries only: Draft isn't submitted, Voided vacated its day (#82). diff --git a/src/Cluckwork.Infrastructure/Repositories/SalesOrderAllocationRepository.cs b/src/Cluckwork.Infrastructure/Repositories/SalesOrderAllocationRepository.cs index 6681141a7..d5f8a1f9c 100644 --- a/src/Cluckwork.Infrastructure/Repositories/SalesOrderAllocationRepository.cs +++ b/src/Cluckwork.Infrastructure/Repositories/SalesOrderAllocationRepository.cs @@ -1,10 +1,10 @@ -namespace Cluckwork.Infrastructure.Repositories; - using Cluckwork.Application.Features.Sales; using Cluckwork.Domain.Sales; using Cluckwork.Infrastructure.Persistence; using Microsoft.EntityFrameworkCore; +namespace Cluckwork.Infrastructure.Repositories; + public sealed class SalesOrderAllocationRepository(AppDbContext db) : ISalesOrderAllocationRepository { public async Task AddRangeAsync( diff --git a/src/Cluckwork.Infrastructure/Repositories/SalesOrderRepository.cs b/src/Cluckwork.Infrastructure/Repositories/SalesOrderRepository.cs index f29812c29..f1546e26e 100644 --- a/src/Cluckwork.Infrastructure/Repositories/SalesOrderRepository.cs +++ b/src/Cluckwork.Infrastructure/Repositories/SalesOrderRepository.cs @@ -1,10 +1,10 @@ -namespace Cluckwork.Infrastructure.Repositories; - using Cluckwork.Application.Features.Sales; using Cluckwork.Domain.Sales; using Cluckwork.Infrastructure.Persistence; using Microsoft.EntityFrameworkCore; +namespace Cluckwork.Infrastructure.Repositories; + public sealed class SalesOrderRepository(AppDbContext db) : ISalesOrderRepository { public Task GetByIdAsync(Guid id, CancellationToken ct = default) => diff --git a/src/Cluckwork.Infrastructure/Repositories/UserRoleAssignmentRepository.cs b/src/Cluckwork.Infrastructure/Repositories/UserRoleAssignmentRepository.cs index 9db4ecbac..1c4ef649b 100644 --- a/src/Cluckwork.Infrastructure/Repositories/UserRoleAssignmentRepository.cs +++ b/src/Cluckwork.Infrastructure/Repositories/UserRoleAssignmentRepository.cs @@ -1,5 +1,3 @@ -namespace Cluckwork.Infrastructure.Repositories; - using Cluckwork.Application.Common; using Cluckwork.Application.Features.Users; using Cluckwork.Domain.Accounts; @@ -7,6 +5,8 @@ namespace Cluckwork.Infrastructure.Repositories; using Cluckwork.Infrastructure.Persistence; using Microsoft.EntityFrameworkCore; +namespace Cluckwork.Infrastructure.Repositories; + public sealed class UserRoleAssignmentRepository(AppDbContext db) : IUserRoleAssignmentRepository { public async Task> ListByUserAsync( diff --git a/src/Cluckwork.Infrastructure/Repositories/WaterUsageRepository.cs b/src/Cluckwork.Infrastructure/Repositories/WaterUsageRepository.cs index 8247cba36..9ee8d9620 100644 --- a/src/Cluckwork.Infrastructure/Repositories/WaterUsageRepository.cs +++ b/src/Cluckwork.Infrastructure/Repositories/WaterUsageRepository.cs @@ -1,10 +1,10 @@ -namespace Cluckwork.Infrastructure.Repositories; - using Cluckwork.Application.Features.Inventory; using Cluckwork.Domain.Inventory; using Cluckwork.Infrastructure.Persistence; using Microsoft.EntityFrameworkCore; +namespace Cluckwork.Infrastructure.Repositories; + public sealed class WaterUsageRepository(AppDbContext db) : IWaterUsageRepository { public Task GetByIdAsync(Guid id, CancellationToken ct = default) => diff --git a/src/Cluckwork.Infrastructure/SharedState/IFixedWindowCounter.cs b/src/Cluckwork.Infrastructure/SharedState/IFixedWindowCounter.cs index 9fe2ec815..d987e3491 100644 --- a/src/Cluckwork.Infrastructure/SharedState/IFixedWindowCounter.cs +++ b/src/Cluckwork.Infrastructure/SharedState/IFixedWindowCounter.cs @@ -1,8 +1,8 @@ -namespace Cluckwork.Infrastructure.SharedState; - using System.Threading; using System.Threading.Tasks; +namespace Cluckwork.Infrastructure.SharedState; + // #543 — atomic increment within a fixed time window (port for the auth // limiters, #544, and the report concurrency cap, #545). // diff --git a/src/Cluckwork.Infrastructure/SharedState/InProcessFixedWindowCounter.cs b/src/Cluckwork.Infrastructure/SharedState/InProcessFixedWindowCounter.cs index 7e61dbdee..a74f18372 100644 --- a/src/Cluckwork.Infrastructure/SharedState/InProcessFixedWindowCounter.cs +++ b/src/Cluckwork.Infrastructure/SharedState/InProcessFixedWindowCounter.cs @@ -1,8 +1,8 @@ -namespace Cluckwork.Infrastructure.SharedState; - using System.Threading; using System.Threading.Tasks; +namespace Cluckwork.Infrastructure.SharedState; + // #543 — in-process fallback (Option B: a // deliberately single-instance deploy runs without Redis). // diff --git a/src/Cluckwork.Infrastructure/SharedState/RedisClaimOnceStore.cs b/src/Cluckwork.Infrastructure/SharedState/RedisClaimOnceStore.cs index e5dada28d..c3ea2b838 100644 --- a/src/Cluckwork.Infrastructure/SharedState/RedisClaimOnceStore.cs +++ b/src/Cluckwork.Infrastructure/SharedState/RedisClaimOnceStore.cs @@ -1,7 +1,7 @@ -namespace Cluckwork.Infrastructure.SharedState; - using StackExchange.Redis; +namespace Cluckwork.Infrastructure.SharedState; + // #543 — Redis (shared, multi-replica). // // Single-use claim via the native atomic SET-if-not-exists-with-expiry: Redis diff --git a/src/Cluckwork.Infrastructure/SharedState/RedisFixedWindowCounter.cs b/src/Cluckwork.Infrastructure/SharedState/RedisFixedWindowCounter.cs index 9a4109c1f..15d9e5e44 100644 --- a/src/Cluckwork.Infrastructure/SharedState/RedisFixedWindowCounter.cs +++ b/src/Cluckwork.Infrastructure/SharedState/RedisFixedWindowCounter.cs @@ -1,9 +1,9 @@ -namespace Cluckwork.Infrastructure.SharedState; - using System.Threading; using System.Threading.Tasks; using StackExchange.Redis; +namespace Cluckwork.Infrastructure.SharedState; + // #543 — Redis (shared, multi-replica). // // Server-time-bucketed fixed window: the bucket is derived from Redis's OWN diff --git a/src/Cluckwork.Infrastructure/SharedState/RedisLease.cs b/src/Cluckwork.Infrastructure/SharedState/RedisLease.cs index bc0dbef55..128841196 100644 --- a/src/Cluckwork.Infrastructure/SharedState/RedisLease.cs +++ b/src/Cluckwork.Infrastructure/SharedState/RedisLease.cs @@ -1,7 +1,7 @@ -namespace Cluckwork.Infrastructure.SharedState; - using StackExchange.Redis; +namespace Cluckwork.Infrastructure.SharedState; + // #543 — Redis (shared, multi-replica). // // Acquire is the native atomic SET-if-not-exists-with-expiry (value = the diff --git a/src/Cluckwork.Infrastructure/SharedState/ResilientClaimOnceStore.cs b/src/Cluckwork.Infrastructure/SharedState/ResilientClaimOnceStore.cs index 6c6890611..ab30017a2 100644 --- a/src/Cluckwork.Infrastructure/SharedState/ResilientClaimOnceStore.cs +++ b/src/Cluckwork.Infrastructure/SharedState/ResilientClaimOnceStore.cs @@ -1,9 +1,9 @@ -namespace Cluckwork.Infrastructure.SharedState; - using Cluckwork.Application.Common; using Microsoft.Extensions.Logging; using StackExchange.Redis; +namespace Cluckwork.Infrastructure.SharedState; + // #543 — resilient decorator over (grant // replay, #338). FAILS CLOSED: when Redis throws, the claim is DENIED. // Grant replay gates privileged operations (create Owner, reset Owner diff --git a/src/Cluckwork.Infrastructure/SharedState/ResilientFixedWindowCounter.cs b/src/Cluckwork.Infrastructure/SharedState/ResilientFixedWindowCounter.cs index 808775aa7..007cbb472 100644 --- a/src/Cluckwork.Infrastructure/SharedState/ResilientFixedWindowCounter.cs +++ b/src/Cluckwork.Infrastructure/SharedState/ResilientFixedWindowCounter.cs @@ -1,11 +1,11 @@ -namespace Cluckwork.Infrastructure.SharedState; - using System.Threading; using System.Threading.Tasks; using Cluckwork.Application.Common; using Microsoft.Extensions.Logging; using StackExchange.Redis; +namespace Cluckwork.Infrastructure.SharedState; + // #543 — resilient decorator over (auth // limiter, #544). FALLS BACK to the in-process implementation when Redis // throws, and alarms. Falling back to a per-process partition means N diff --git a/src/Cluckwork.Infrastructure/SharedState/SharedStateRegistration.cs b/src/Cluckwork.Infrastructure/SharedState/SharedStateRegistration.cs index 1fa5bfb37..385ed8751 100644 --- a/src/Cluckwork.Infrastructure/SharedState/SharedStateRegistration.cs +++ b/src/Cluckwork.Infrastructure/SharedState/SharedStateRegistration.cs @@ -1,9 +1,9 @@ -namespace Cluckwork.Infrastructure.SharedState; - using Microsoft.Extensions.DependencyInjection; using Microsoft.Extensions.Logging; using StackExchange.Redis; +namespace Cluckwork.Infrastructure.SharedState; + // #543 — registers the three shared-state ports. Blank connection string => // in-process implementations (Option B). A configured connection string => // Redis primary wrapped in the resilient decorators (in-process fallback), diff --git a/src/Cluckwork.Infrastructure/Time/FarmClock.cs b/src/Cluckwork.Infrastructure/Time/FarmClock.cs index e7f0f3700..f1bee1c0a 100644 --- a/src/Cluckwork.Infrastructure/Time/FarmClock.cs +++ b/src/Cluckwork.Infrastructure/Time/FarmClock.cs @@ -1,9 +1,9 @@ -namespace Cluckwork.Infrastructure.Time; - using Cluckwork.Application.Common; using Cluckwork.Application.Features.Accounts; using Microsoft.Extensions.Logging; +namespace Cluckwork.Infrastructure.Time; + // Scoped: a tenant's timezone cannot change inside one request, so the account // is read at most once and reused by every boundary check in that request — // the stock read and the allocation in the same request cannot disagree. diff --git a/src/Cluckwork.Infrastructure/Time/SystemClock.cs b/src/Cluckwork.Infrastructure/Time/SystemClock.cs index d377c545e..9cd669bae 100644 --- a/src/Cluckwork.Infrastructure/Time/SystemClock.cs +++ b/src/Cluckwork.Infrastructure/Time/SystemClock.cs @@ -1,7 +1,7 @@ -namespace Cluckwork.Infrastructure.Time; - using Cluckwork.Application.Common; +namespace Cluckwork.Infrastructure.Time; + public sealed class SystemClock : IClock { public DateTime UtcNow => DateTime.UtcNow; diff --git a/tests/Cluckwork.Api.IntegrationTests/AccountIdConcurrencyTokenModelTests.cs b/tests/Cluckwork.Api.IntegrationTests/AccountIdConcurrencyTokenModelTests.cs index d66db460f..17019e0ea 100644 --- a/tests/Cluckwork.Api.IntegrationTests/AccountIdConcurrencyTokenModelTests.cs +++ b/tests/Cluckwork.Api.IntegrationTests/AccountIdConcurrencyTokenModelTests.cs @@ -1,11 +1,11 @@ -namespace Cluckwork.Api.IntegrationTests; - using Cluckwork.Domain.Eggs; using Cluckwork.Domain.Inventory; using Cluckwork.Infrastructure.Identity; using Cluckwork.Infrastructure.Persistence; using Microsoft.EntityFrameworkCore; +namespace Cluckwork.Api.IntegrationTests; + // #562 — pins the model walk at the end of AppDbContext.OnModelCreating that // makes AccountId a concurrency token on every entity carrying one. // diff --git a/tests/Cluckwork.Api.IntegrationTests/AccountIdShapeFailClosedTests.cs b/tests/Cluckwork.Api.IntegrationTests/AccountIdShapeFailClosedTests.cs index 9e5d0e543..10c22a4ee 100644 --- a/tests/Cluckwork.Api.IntegrationTests/AccountIdShapeFailClosedTests.cs +++ b/tests/Cluckwork.Api.IntegrationTests/AccountIdShapeFailClosedTests.cs @@ -1,10 +1,10 @@ -namespace Cluckwork.Api.IntegrationTests; - using Cluckwork.Application.Common; using Cluckwork.Infrastructure.Persistence; using Cluckwork.Infrastructure.Persistence.Interceptors; using Microsoft.EntityFrameworkCore; +namespace Cluckwork.Api.IntegrationTests; + // #673 — tenant isolation's two write-side layers both key on AccountId being a // non-nullable Guid, and both used to walk PAST any other shape: no concurrency // token from the #562 model walk, no check in TenantStampInterceptor. That is diff --git a/tests/Cluckwork.Api.IntegrationTests/AccountLifecycleCommandTests.cs b/tests/Cluckwork.Api.IntegrationTests/AccountLifecycleCommandTests.cs index b0be9de35..a7aa0765c 100644 --- a/tests/Cluckwork.Api.IntegrationTests/AccountLifecycleCommandTests.cs +++ b/tests/Cluckwork.Api.IntegrationTests/AccountLifecycleCommandTests.cs @@ -1,5 +1,3 @@ -namespace Cluckwork.Api.IntegrationTests; - using System.Diagnostics; using System.Net; using System.Net.Http.Json; @@ -8,6 +6,8 @@ namespace Cluckwork.Api.IntegrationTests; using Microsoft.AspNetCore.Mvc; using Microsoft.EntityFrameworkCore; +namespace Cluckwork.Api.IntegrationTests; + [Collection(IntegrationCollection.Name)] public sealed class AccountLifecycleCommandTests(CluckworkWebApplicationFactory factory) { diff --git a/tests/Cluckwork.Api.IntegrationTests/AccountLockoutTests.cs b/tests/Cluckwork.Api.IntegrationTests/AccountLockoutTests.cs index 0451c1d2b..e2d95a3b4 100644 --- a/tests/Cluckwork.Api.IntegrationTests/AccountLockoutTests.cs +++ b/tests/Cluckwork.Api.IntegrationTests/AccountLockoutTests.cs @@ -1,5 +1,3 @@ -namespace Cluckwork.Api.IntegrationTests; - using System.Linq; using System.Net; using System.Net.Http.Json; @@ -9,6 +7,8 @@ namespace Cluckwork.Api.IntegrationTests; using Microsoft.AspNetCore.Identity; using Microsoft.Extensions.DependencyInjection; +namespace Cluckwork.Api.IntegrationTests; + // #128 — the configured account lockout must actually fire: repeated failed // logins lock the account (rejecting even the correct password), a success // resets the counter, and lockout is per-account. The shared factory disables diff --git a/tests/Cluckwork.Api.IntegrationTests/AccountMaxDiscountMigrationTests.cs b/tests/Cluckwork.Api.IntegrationTests/AccountMaxDiscountMigrationTests.cs index 49543e5fb..31607efc5 100644 --- a/tests/Cluckwork.Api.IntegrationTests/AccountMaxDiscountMigrationTests.cs +++ b/tests/Cluckwork.Api.IntegrationTests/AccountMaxDiscountMigrationTests.cs @@ -1,5 +1,3 @@ -namespace Cluckwork.Api.IntegrationTests; - using Cluckwork.Api.IntegrationTests.Infrastructure; using Cluckwork.Infrastructure.Persistence; using Cluckwork.Infrastructure.Persistence.Interceptors; @@ -9,6 +7,8 @@ namespace Cluckwork.Api.IntegrationTests; using Microsoft.EntityFrameworkCore.Infrastructure; using Microsoft.EntityFrameworkCore.Migrations; +namespace Cluckwork.Api.IntegrationTests; + // #727 — the AddAccountMaxDiscountBasisPoints migration, same // throwaway-Postgres, no-WebApplicationFactory pattern as // WorkerSaleAllocationPolicyMigrationTests. The assertion is the opposite of diff --git a/tests/Cluckwork.Api.IntegrationTests/AccountProvisioningTests.cs b/tests/Cluckwork.Api.IntegrationTests/AccountProvisioningTests.cs index 281c04711..8d873268f 100644 --- a/tests/Cluckwork.Api.IntegrationTests/AccountProvisioningTests.cs +++ b/tests/Cluckwork.Api.IntegrationTests/AccountProvisioningTests.cs @@ -1,5 +1,3 @@ -namespace Cluckwork.Api.IntegrationTests; - using System.Net; using Cluckwork.Api.IntegrationTests.Infrastructure; using Cluckwork.Application.Common; @@ -12,6 +10,8 @@ namespace Cluckwork.Api.IntegrationTests; using Microsoft.EntityFrameworkCore; using Microsoft.Extensions.DependencyInjection; +namespace Cluckwork.Api.IntegrationTests; + // Several failure checks compare database-wide counts. Give the class its own // database so unrelated integration tests cannot change those counts. public sealed class AccountProvisioningFactory : CluckworkWebApplicationFactory; diff --git a/tests/Cluckwork.Api.IntegrationTests/AccountRenameServiceTests.cs b/tests/Cluckwork.Api.IntegrationTests/AccountRenameServiceTests.cs index 8962932bf..1d534f854 100644 --- a/tests/Cluckwork.Api.IntegrationTests/AccountRenameServiceTests.cs +++ b/tests/Cluckwork.Api.IntegrationTests/AccountRenameServiceTests.cs @@ -1,5 +1,3 @@ -namespace Cluckwork.Api.IntegrationTests; - using Cluckwork.Api.IntegrationTests.Infrastructure; using Cluckwork.Application.Common; using Cluckwork.Infrastructure.Identity; @@ -7,6 +5,8 @@ namespace Cluckwork.Api.IntegrationTests; using Microsoft.EntityFrameworkCore; using Microsoft.Extensions.DependencyInjection; +namespace Cluckwork.Api.IntegrationTests; + // #732 — service contract below the CLI. The stale-source test is a REAL two-writer // schedule: a transaction holds the source row, the service resolves the old slug and // queues on FOR UPDATE, then the holder renames and commits. The service must inspect the diff --git a/tests/Cluckwork.Api.IntegrationTests/AccountScopedIdentityMigrationTests.cs b/tests/Cluckwork.Api.IntegrationTests/AccountScopedIdentityMigrationTests.cs index 6fc8873b3..42167a758 100644 --- a/tests/Cluckwork.Api.IntegrationTests/AccountScopedIdentityMigrationTests.cs +++ b/tests/Cluckwork.Api.IntegrationTests/AccountScopedIdentityMigrationTests.cs @@ -1,5 +1,3 @@ -namespace Cluckwork.Api.IntegrationTests; - using Cluckwork.Api.IntegrationTests.Infrastructure; using Cluckwork.Infrastructure.Persistence; using Cluckwork.Infrastructure.Persistence.Interceptors; @@ -10,6 +8,8 @@ namespace Cluckwork.Api.IntegrationTests; using Microsoft.EntityFrameworkCore.Migrations; using Npgsql; +namespace Cluckwork.Api.IntegrationTests; + // #532 — THE GUARANTEE that ApplicationUserIndexModelTests points to: it runs // EF's migrator to completion against a throwaway Postgres (same shape as // AccountSlugMigrationTests) and proves the database itself — not the diff --git a/tests/Cluckwork.Api.IntegrationTests/AccountScopedUserValidatorRegistrationTests.cs b/tests/Cluckwork.Api.IntegrationTests/AccountScopedUserValidatorRegistrationTests.cs index 9d70482f6..ad99c9155 100644 --- a/tests/Cluckwork.Api.IntegrationTests/AccountScopedUserValidatorRegistrationTests.cs +++ b/tests/Cluckwork.Api.IntegrationTests/AccountScopedUserValidatorRegistrationTests.cs @@ -1,10 +1,10 @@ -namespace Cluckwork.Api.IntegrationTests; - using Cluckwork.Api.IntegrationTests.Infrastructure; using Cluckwork.Infrastructure.Identity; using Microsoft.AspNetCore.Identity; using Microsoft.Extensions.DependencyInjection; +namespace Cluckwork.Api.IntegrationTests; + // #532 — the ORDER guard. AddIdentityCore registers the stock validator with // TryAddScoped, so registering ours BEFORE it makes that a no-op. Registering // ours AFTER leaves BOTH, and the stock one's global FindByNameAsync then diff --git a/tests/Cluckwork.Api.IntegrationTests/AccountScopedUserValidatorTests.cs b/tests/Cluckwork.Api.IntegrationTests/AccountScopedUserValidatorTests.cs index 8058633dc..c81d3e07a 100644 --- a/tests/Cluckwork.Api.IntegrationTests/AccountScopedUserValidatorTests.cs +++ b/tests/Cluckwork.Api.IntegrationTests/AccountScopedUserValidatorTests.cs @@ -1,5 +1,3 @@ -namespace Cluckwork.Api.IntegrationTests; - using Cluckwork.Api.IntegrationTests.Infrastructure; using Cluckwork.Infrastructure.Identity; using Cluckwork.Infrastructure.Persistence; @@ -7,6 +5,8 @@ namespace Cluckwork.Api.IntegrationTests; using Microsoft.EntityFrameworkCore; using Microsoft.Extensions.DependencyInjection; +namespace Cluckwork.Api.IntegrationTests; + // #532 — the validator runs on Identity's UPDATE pipeline, not only on create. // AccountLockout.RecordFailedAccessAsync reads a failed IdentityResult as a lost // concurrency race: it reloads and retries ten times, then returns false. So a diff --git a/tests/Cluckwork.Api.IntegrationTests/AccountSlugMigrationTests.cs b/tests/Cluckwork.Api.IntegrationTests/AccountSlugMigrationTests.cs index b1b94a750..f9b0b9e61 100644 --- a/tests/Cluckwork.Api.IntegrationTests/AccountSlugMigrationTests.cs +++ b/tests/Cluckwork.Api.IntegrationTests/AccountSlugMigrationTests.cs @@ -1,5 +1,3 @@ -namespace Cluckwork.Api.IntegrationTests; - using Cluckwork.Api.IntegrationTests.Infrastructure; using System.Text.RegularExpressions; using Cluckwork.Infrastructure.Persistence; @@ -11,6 +9,8 @@ namespace Cluckwork.Api.IntegrationTests; using Microsoft.EntityFrameworkCore.Migrations; using Npgsql; +namespace Cluckwork.Api.IntegrationTests; + // #531/#407 — the AddAccountSlug backfill. The migration adds Slug nullable, // backfills a deterministic per-row value, tightens to NOT NULL, then adds a // unique index. This drives EF's migrator directly against a throwaway Postgres diff --git a/tests/Cluckwork.Api.IntegrationTests/AccountSlugRaceTests.cs b/tests/Cluckwork.Api.IntegrationTests/AccountSlugRaceTests.cs index 527ec5ec3..4cf7db1bb 100644 --- a/tests/Cluckwork.Api.IntegrationTests/AccountSlugRaceTests.cs +++ b/tests/Cluckwork.Api.IntegrationTests/AccountSlugRaceTests.cs @@ -1,8 +1,8 @@ -namespace Cluckwork.Api.IntegrationTests; - using Cluckwork.Api.IntegrationTests.Infrastructure; using Microsoft.EntityFrameworkCore; +namespace Cluckwork.Api.IntegrationTests; + // #531 — Suspend()/Reactivate() each bump the account's Version concurrency // token, so two writers racing the SAME row cannot both win: the loser's // UPDATE ... WHERE "Version" = N matches zero rows and EF raises diff --git a/tests/Cluckwork.Api.IntegrationTests/AccountSuspensionTests.cs b/tests/Cluckwork.Api.IntegrationTests/AccountSuspensionTests.cs index 35addc751..f9edbafce 100644 --- a/tests/Cluckwork.Api.IntegrationTests/AccountSuspensionTests.cs +++ b/tests/Cluckwork.Api.IntegrationTests/AccountSuspensionTests.cs @@ -1,5 +1,3 @@ -namespace Cluckwork.Api.IntegrationTests; - using System.Net; using System.Net.Http.Json; using Cluckwork.Api.Endpoints.Auth; @@ -11,6 +9,8 @@ namespace Cluckwork.Api.IntegrationTests; using Microsoft.EntityFrameworkCore; using Microsoft.Extensions.DependencyInjection; +namespace Cluckwork.Api.IntegrationTests; + // #532 — AccountSuspensionService. The service has NO caller in this slice (#534 // ships the operator verbs), so these tests are the only thing that exercises it // and they invoke it directly out of DI. diff --git a/tests/Cluckwork.Api.IntegrationTests/AdminGatingTests.cs b/tests/Cluckwork.Api.IntegrationTests/AdminGatingTests.cs index 706b73241..638e3b215 100644 --- a/tests/Cluckwork.Api.IntegrationTests/AdminGatingTests.cs +++ b/tests/Cluckwork.Api.IntegrationTests/AdminGatingTests.cs @@ -1,5 +1,3 @@ -namespace Cluckwork.Api.IntegrationTests; - using System.Net; using System.Text.Json; using Cluckwork.Api.Endpoints.Auth; @@ -10,6 +8,8 @@ namespace Cluckwork.Api.IntegrationTests; using Microsoft.EntityFrameworkCore; using Microsoft.Extensions.DependencyInjection; +namespace Cluckwork.Api.IntegrationTests; + // #73 — Admin vs not-Admin. The principle under test: anything that undoes, // corrects, or reconfigures is admin-only; recording the day's work is open // to any authenticated user. The SPA hides gated controls, but these tests diff --git a/tests/Cluckwork.Api.IntegrationTests/AdminRecoveryServiceTests.cs b/tests/Cluckwork.Api.IntegrationTests/AdminRecoveryServiceTests.cs index acf27d425..cb7b94b7a 100644 --- a/tests/Cluckwork.Api.IntegrationTests/AdminRecoveryServiceTests.cs +++ b/tests/Cluckwork.Api.IntegrationTests/AdminRecoveryServiceTests.cs @@ -1,5 +1,3 @@ -namespace Cluckwork.Api.IntegrationTests; - using Cluckwork.Api.IntegrationTests.Infrastructure; using Cluckwork.Application.Common; using Cluckwork.Domain.Accounts; @@ -9,6 +7,8 @@ namespace Cluckwork.Api.IntegrationTests; using Microsoft.EntityFrameworkCore; using Microsoft.Extensions.DependencyInjection; +namespace Cluckwork.Api.IntegrationTests; + // #265 — break-glass recovery fixture: seeds a known admin into its OWN // Postgres container so resetting that admin's password (which the tests do) // can't disturb any other suite. Own container per the #279 isolation rule: a diff --git a/tests/Cluckwork.Api.IntegrationTests/AllowedHostsGuardTests.cs b/tests/Cluckwork.Api.IntegrationTests/AllowedHostsGuardTests.cs index 3b8b16236..1081716c0 100644 --- a/tests/Cluckwork.Api.IntegrationTests/AllowedHostsGuardTests.cs +++ b/tests/Cluckwork.Api.IntegrationTests/AllowedHostsGuardTests.cs @@ -1,9 +1,9 @@ -namespace Cluckwork.Api.IntegrationTests; - using System.Net; using Cluckwork.Api.IntegrationTests.Infrastructure; using Microsoft.AspNetCore.Hosting; +namespace Cluckwork.Api.IntegrationTests; + // #319 — appsettings.json defaults AllowedHosts to "*"; a Production deploy that // omits or misnames the host variable (a blank ${CLUCKWORK_HOST} substitution was // observed) silently disables Host-header filtering (#144) and a forged Host is diff --git a/tests/Cluckwork.Api.IntegrationTests/AmbientPrincipalOnLoginTests.cs b/tests/Cluckwork.Api.IntegrationTests/AmbientPrincipalOnLoginTests.cs index 979d8f324..ab9626296 100644 --- a/tests/Cluckwork.Api.IntegrationTests/AmbientPrincipalOnLoginTests.cs +++ b/tests/Cluckwork.Api.IntegrationTests/AmbientPrincipalOnLoginTests.cs @@ -1,5 +1,3 @@ -namespace Cluckwork.Api.IntegrationTests; - using System.Net; using System.Net.Http.Headers; using System.Reflection; @@ -8,6 +6,8 @@ namespace Cluckwork.Api.IntegrationTests; using Cluckwork.Infrastructure.Persistence; using Microsoft.EntityFrameworkCore; +namespace Cluckwork.Api.IntegrationTests; + // #532 — /auth/login must behave IDENTICALLY whether or not the caller happens // to send a bearer. AllowAnonymous does not deliver that: UseAuthentication // still populates context.User, and three middlewares downstream read it. diff --git a/tests/Cluckwork.Api.IntegrationTests/AppDbContextDesignTimeFactoryTests.cs b/tests/Cluckwork.Api.IntegrationTests/AppDbContextDesignTimeFactoryTests.cs index b4c2233ad..5147f297b 100644 --- a/tests/Cluckwork.Api.IntegrationTests/AppDbContextDesignTimeFactoryTests.cs +++ b/tests/Cluckwork.Api.IntegrationTests/AppDbContextDesignTimeFactoryTests.cs @@ -1,9 +1,9 @@ -namespace Cluckwork.Api.IntegrationTests; - using Cluckwork.Infrastructure.Persistence; using Microsoft.EntityFrameworkCore; using Npgsql; +namespace Cluckwork.Api.IntegrationTests; + // #318 — `dotnet ef` design-time tooling fails closed: no predictable postgres/postgres // fallback, and every target is held to the SAME Production TLS floor (#261/#262) as a real // boot, except an explicitly acknowledged LOOPBACK development target. Pure unit coverage diff --git a/tests/Cluckwork.Api.IntegrationTests/ApplicationUserIndexModelTests.cs b/tests/Cluckwork.Api.IntegrationTests/ApplicationUserIndexModelTests.cs index 01e64e0ea..e714ff060 100644 --- a/tests/Cluckwork.Api.IntegrationTests/ApplicationUserIndexModelTests.cs +++ b/tests/Cluckwork.Api.IntegrationTests/ApplicationUserIndexModelTests.cs @@ -1,10 +1,10 @@ -namespace Cluckwork.Api.IntegrationTests; - using Cluckwork.Infrastructure.Identity; using Cluckwork.Infrastructure.Persistence; using Microsoft.EntityFrameworkCore; using Microsoft.EntityFrameworkCore.Metadata; +namespace Cluckwork.Api.IntegrationTests; + // #532 — a CHEAP FAST-FAIL on the built EF model. It is deliberately NOT the // guarantee: it cannot catch "model changed, migration never added", because // tools/schema-docs/generate.sh --check compares the MIGRATED DATABASE to the diff --git a/tests/Cluckwork.Api.IntegrationTests/AtomicIdempotencyProtocolTests.cs b/tests/Cluckwork.Api.IntegrationTests/AtomicIdempotencyProtocolTests.cs index a20b8a587..5a1651209 100644 --- a/tests/Cluckwork.Api.IntegrationTests/AtomicIdempotencyProtocolTests.cs +++ b/tests/Cluckwork.Api.IntegrationTests/AtomicIdempotencyProtocolTests.cs @@ -1,5 +1,3 @@ -namespace Cluckwork.Api.IntegrationTests; - using System.Diagnostics; using System.Net; using Cluckwork.Api.IntegrationTests.Infrastructure; @@ -7,6 +5,8 @@ namespace Cluckwork.Api.IntegrationTests; using Microsoft.AspNetCore.Hosting; using Microsoft.EntityFrameworkCore; +namespace Cluckwork.Api.IntegrationTests; + // #307 — the database-coordinated claim/lease idempotency protocol. Covers // what IdempotencyReplayTests / IdempotencyUserScopeTests don't: // - a request-hash conflict on key reuse (never invokes the handler); diff --git a/tests/Cluckwork.Api.IntegrationTests/AuditActorTests.cs b/tests/Cluckwork.Api.IntegrationTests/AuditActorTests.cs index de538a859..ceea7447b 100644 --- a/tests/Cluckwork.Api.IntegrationTests/AuditActorTests.cs +++ b/tests/Cluckwork.Api.IntegrationTests/AuditActorTests.cs @@ -1,5 +1,3 @@ -namespace Cluckwork.Api.IntegrationTests; - using Cluckwork.Api.IntegrationTests.Infrastructure; using Cluckwork.Application.Common; using Cluckwork.Domain.Accounts; @@ -9,6 +7,8 @@ namespace Cluckwork.Api.IntegrationTests; using Microsoft.EntityFrameworkCore; using Microsoft.Extensions.DependencyInjection; +namespace Cluckwork.Api.IntegrationTests; + // #500 — IAuditWriter fails closed on an unresolved ACTOR, symmetrically with // the unresolved-TENANT guard it has had since #94. // diff --git a/tests/Cluckwork.Api.IntegrationTests/AuditProvenanceTests.cs b/tests/Cluckwork.Api.IntegrationTests/AuditProvenanceTests.cs index e2a16f398..3777de6fc 100644 --- a/tests/Cluckwork.Api.IntegrationTests/AuditProvenanceTests.cs +++ b/tests/Cluckwork.Api.IntegrationTests/AuditProvenanceTests.cs @@ -1,5 +1,3 @@ -namespace Cluckwork.Api.IntegrationTests; - using System.Net; using Cluckwork.Api.IntegrationTests.Infrastructure; using Cluckwork.Application.Features.Audit; @@ -8,6 +6,8 @@ namespace Cluckwork.Api.IntegrationTests; using Microsoft.EntityFrameworkCore; using Microsoft.Extensions.DependencyInjection; +namespace Cluckwork.Api.IntegrationTests; + // #494 — "who created this, and who last changed it" derived from the // append-only audit trail rather than from new columns on every aggregate. // The lookup is raw SQL (DISTINCT ON), so it bypasses the EF tenant query diff --git a/tests/Cluckwork.Api.IntegrationTests/AuditTests.cs b/tests/Cluckwork.Api.IntegrationTests/AuditTests.cs index 424620306..d32c6e0a4 100644 --- a/tests/Cluckwork.Api.IntegrationTests/AuditTests.cs +++ b/tests/Cluckwork.Api.IntegrationTests/AuditTests.cs @@ -1,9 +1,9 @@ -namespace Cluckwork.Api.IntegrationTests; - using System.Net; using Cluckwork.Api.IntegrationTests.Infrastructure; using Cluckwork.Domain.Auditing; +namespace Cluckwork.Api.IntegrationTests; + // #93 — the audit trail is domain data: written in the same transaction as // the change (a failed action leaves nothing), actor captured from the JWT, // viewer admin-only. diff --git a/tests/Cluckwork.Api.IntegrationTests/AuthBodyLimitTests.cs b/tests/Cluckwork.Api.IntegrationTests/AuthBodyLimitTests.cs index cb0aeb18f..a244a73bb 100644 --- a/tests/Cluckwork.Api.IntegrationTests/AuthBodyLimitTests.cs +++ b/tests/Cluckwork.Api.IntegrationTests/AuthBodyLimitTests.cs @@ -1,5 +1,3 @@ -namespace Cluckwork.Api.IntegrationTests; - using System.Net; using System.Net.Http.Headers; using System.Net.Http.Json; @@ -12,6 +10,8 @@ namespace Cluckwork.Api.IntegrationTests; using Microsoft.AspNetCore.TestHost; using Microsoft.Extensions.DependencyInjection; +namespace Cluckwork.Api.IntegrationTests; + // #309 — an oversized credential must be rejected BEFORE JSON binding and BEFORE // the PBKDF2 hasher (including the unknown-user timing-equalization hash), while // within-limit inputs keep the existing non-enumerating 401 and still pay the diff --git a/tests/Cluckwork.Api.IntegrationTests/AuthCookieContractTests.cs b/tests/Cluckwork.Api.IntegrationTests/AuthCookieContractTests.cs index 5b9a0c28a..4821a62a3 100644 --- a/tests/Cluckwork.Api.IntegrationTests/AuthCookieContractTests.cs +++ b/tests/Cluckwork.Api.IntegrationTests/AuthCookieContractTests.cs @@ -1,5 +1,3 @@ -namespace Cluckwork.Api.IntegrationTests; - using System.Net; using System.Net.Http.Headers; using System.Text.Json; @@ -7,6 +5,8 @@ namespace Cluckwork.Api.IntegrationTests; using Cluckwork.Api.IntegrationTests.Infrastructure; using Microsoft.AspNetCore.Mvc.Testing; +namespace Cluckwork.Api.IntegrationTests; + // #145 — the refresh token is delivered only as an HttpOnly cookie; the body // carries just the access token. CSRF posture: refresh/logout require the custom // header. These assert the wire contract. diff --git a/tests/Cluckwork.Api.IntegrationTests/AuthRateLimitLoggingTests.cs b/tests/Cluckwork.Api.IntegrationTests/AuthRateLimitLoggingTests.cs index 6bfdaa3e5..3ecfe66c1 100644 --- a/tests/Cluckwork.Api.IntegrationTests/AuthRateLimitLoggingTests.cs +++ b/tests/Cluckwork.Api.IntegrationTests/AuthRateLimitLoggingTests.cs @@ -1,5 +1,3 @@ -namespace Cluckwork.Api.IntegrationTests; - using System.Collections.Concurrent; using System.Net; using System.Net.Http.Headers; @@ -12,6 +10,8 @@ namespace Cluckwork.Api.IntegrationTests; using Serilog.Core; using Serilog.Events; +namespace Cluckwork.Api.IntegrationTests; + // #273 — Auth.RateLimitRejected: a 429 against the login/refresh policies is a // brute-force/credential-stuffing signal worth its own stable event; a 429 // against the client-errors policy (#217, log-pipeline volume, not a diff --git a/tests/Cluckwork.Api.IntegrationTests/BaseReferenceDataMigrationTests.cs b/tests/Cluckwork.Api.IntegrationTests/BaseReferenceDataMigrationTests.cs index c309114ed..19cbcda63 100644 --- a/tests/Cluckwork.Api.IntegrationTests/BaseReferenceDataMigrationTests.cs +++ b/tests/Cluckwork.Api.IntegrationTests/BaseReferenceDataMigrationTests.cs @@ -1,5 +1,3 @@ -namespace Cluckwork.Api.IntegrationTests; - using Cluckwork.Domain.Accounts; using Cluckwork.Domain.Catalog; using Cluckwork.Domain.Eggs; @@ -10,6 +8,8 @@ namespace Cluckwork.Api.IntegrationTests; using Cluckwork.Infrastructure.Providers.Postgres; using Microsoft.EntityFrameworkCore; +namespace Cluckwork.Api.IntegrationTests; + // #245 — what survives of MigrationUpgradePathTests after the InitialCreate // squash. // diff --git a/tests/Cluckwork.Api.IntegrationTests/BaselineSeedCurrencyTests.cs b/tests/Cluckwork.Api.IntegrationTests/BaselineSeedCurrencyTests.cs index bffb284f4..65e0de593 100644 --- a/tests/Cluckwork.Api.IntegrationTests/BaselineSeedCurrencyTests.cs +++ b/tests/Cluckwork.Api.IntegrationTests/BaselineSeedCurrencyTests.cs @@ -1,10 +1,10 @@ -namespace Cluckwork.Api.IntegrationTests; - using System.Net; using System.Net.Http.Headers; using Cluckwork.Api.IntegrationTests.Infrastructure; using Cluckwork.Domain.Accounts; +namespace Cluckwork.Api.IntegrationTests; + // #178 — the #283 migration-baked default account writes none of the // currency-binding row types (§4.6), so a freshly provisioned farm must boot // with its currency still editable. Nothing else pins this: if a priced diff --git a/tests/Cluckwork.Api.IntegrationTests/BirdMovementTests.cs b/tests/Cluckwork.Api.IntegrationTests/BirdMovementTests.cs index 7be995e13..88560f04f 100644 --- a/tests/Cluckwork.Api.IntegrationTests/BirdMovementTests.cs +++ b/tests/Cluckwork.Api.IntegrationTests/BirdMovementTests.cs @@ -1,9 +1,9 @@ -namespace Cluckwork.Api.IntegrationTests; - using System.Net; using Cluckwork.Api.IntegrationTests.Infrastructure; using Microsoft.EntityFrameworkCore; +namespace Cluckwork.Api.IntegrationTests; + // #54 — bird movement ledger: mortality generated at submit, manual // culls/adjustments, current-count math, and lifecycle gating. [Collection(IntegrationCollection.Name)] diff --git a/tests/Cluckwork.Api.IntegrationTests/BodyReadingEndpointTests.cs b/tests/Cluckwork.Api.IntegrationTests/BodyReadingEndpointTests.cs index 47b559450..18854abcd 100644 --- a/tests/Cluckwork.Api.IntegrationTests/BodyReadingEndpointTests.cs +++ b/tests/Cluckwork.Api.IntegrationTests/BodyReadingEndpointTests.cs @@ -1,5 +1,3 @@ -namespace Cluckwork.Api.IntegrationTests; - using System.IO.Pipelines; using System.Reflection; using Cluckwork.Api.Hosting; @@ -9,6 +7,8 @@ namespace Cluckwork.Api.IntegrationTests; using Microsoft.AspNetCore.Routing; using Microsoft.Extensions.DependencyInjection; +namespace Cluckwork.Api.IntegrationTests; + // #398 review rounds 7-8 — BindingFailureResponse.ConcernsRequestBody decides // whether a 400 binding failure is reported under `body` or `query`, and it // reads the ENDPOINT's contract to do it. An endpoint that declares a typed body diff --git a/tests/Cluckwork.Api.IntegrationTests/BootstrapAdminCommandTests.cs b/tests/Cluckwork.Api.IntegrationTests/BootstrapAdminCommandTests.cs index b5b07c188..c782b70fb 100644 --- a/tests/Cluckwork.Api.IntegrationTests/BootstrapAdminCommandTests.cs +++ b/tests/Cluckwork.Api.IntegrationTests/BootstrapAdminCommandTests.cs @@ -1,5 +1,3 @@ -namespace Cluckwork.Api.IntegrationTests; - using System.Diagnostics; using Cluckwork.Api.IntegrationTests.Infrastructure; using Cluckwork.Application.Common; @@ -10,6 +8,8 @@ namespace Cluckwork.Api.IntegrationTests; using Microsoft.EntityFrameworkCore; using Microsoft.Extensions.DependencyInjection; +namespace Cluckwork.Api.IntegrationTests; + // #283 — `dotnet Cluckwork.Api.dll bootstrap-admin --email ` end to end, as // a real SUBPROCESS (same binary/entry point an operator runs), exactly like // SeedCommandTests does for `seed --profile demo`: WebApplicationFactory never diff --git a/tests/Cluckwork.Api.IntegrationTests/BootstrapAdvisoryLockContinuityTests.cs b/tests/Cluckwork.Api.IntegrationTests/BootstrapAdvisoryLockContinuityTests.cs index 9e6ccb956..5a63926ad 100644 --- a/tests/Cluckwork.Api.IntegrationTests/BootstrapAdvisoryLockContinuityTests.cs +++ b/tests/Cluckwork.Api.IntegrationTests/BootstrapAdvisoryLockContinuityTests.cs @@ -1,5 +1,3 @@ -namespace Cluckwork.Api.IntegrationTests; - using System.Data.Common; using Cluckwork.Api.IntegrationTests.Infrastructure; using Cluckwork.Domain.Accounts; @@ -12,6 +10,8 @@ namespace Cluckwork.Api.IntegrationTests; using Microsoft.Extensions.DependencyInjection; using Npgsql; +namespace Cluckwork.Api.IntegrationTests; + // #269 review round 2 (codex 3696740950, P1) — "reacquire the bootstrap lock // after read retries". // diff --git a/tests/Cluckwork.Api.IntegrationTests/BusinessRecordChronologyMigrationTests.cs b/tests/Cluckwork.Api.IntegrationTests/BusinessRecordChronologyMigrationTests.cs index 092e22b3d..38ed2dde4 100644 --- a/tests/Cluckwork.Api.IntegrationTests/BusinessRecordChronologyMigrationTests.cs +++ b/tests/Cluckwork.Api.IntegrationTests/BusinessRecordChronologyMigrationTests.cs @@ -1,5 +1,3 @@ -namespace Cluckwork.Api.IntegrationTests; - using Cluckwork.Api.IntegrationTests.Infrastructure; using Cluckwork.Domain.Accounts; using Cluckwork.Domain.Common; @@ -14,6 +12,8 @@ namespace Cluckwork.Api.IntegrationTests; using Microsoft.EntityFrameworkCore.Infrastructure; using Microsoft.EntityFrameworkCore.Migrations; +namespace Cluckwork.Api.IntegrationTests; + public sealed class BusinessRecordChronologyMigrationTests { private const string PreviousMigration = "20260911135948_AddAccountMaxDiscountBasisPoints"; diff --git a/tests/Cluckwork.Api.IntegrationTests/BusinessRecordModelTests.cs b/tests/Cluckwork.Api.IntegrationTests/BusinessRecordModelTests.cs index b3ec6c74c..860486e78 100644 --- a/tests/Cluckwork.Api.IntegrationTests/BusinessRecordModelTests.cs +++ b/tests/Cluckwork.Api.IntegrationTests/BusinessRecordModelTests.cs @@ -1,5 +1,3 @@ -namespace Cluckwork.Api.IntegrationTests; - using Cluckwork.Domain.Accounts; using Cluckwork.Domain.Common; using Cluckwork.Domain.Eggs; @@ -11,6 +9,8 @@ namespace Cluckwork.Api.IntegrationTests; using Microsoft.EntityFrameworkCore; using Microsoft.EntityFrameworkCore.Metadata; +namespace Cluckwork.Api.IntegrationTests; + public sealed class BusinessRecordModelTests { private static readonly Type[] CreatedOnlyTypes = diff --git a/tests/Cluckwork.Api.IntegrationTests/BusinessRecordTimestampTests.cs b/tests/Cluckwork.Api.IntegrationTests/BusinessRecordTimestampTests.cs index fa16adfd3..1c1803bbb 100644 --- a/tests/Cluckwork.Api.IntegrationTests/BusinessRecordTimestampTests.cs +++ b/tests/Cluckwork.Api.IntegrationTests/BusinessRecordTimestampTests.cs @@ -1,9 +1,9 @@ -namespace Cluckwork.Api.IntegrationTests; - using Cluckwork.Api.IntegrationTests.Infrastructure; using Cluckwork.Domain.Sales; using Microsoft.EntityFrameworkCore; +namespace Cluckwork.Api.IntegrationTests; + [Collection(IntegrationCollection.Name)] public sealed class BusinessRecordTimestampTests(CluckworkWebApplicationFactory factory) { diff --git a/tests/Cluckwork.Api.IntegrationTests/CatalogTests.cs b/tests/Cluckwork.Api.IntegrationTests/CatalogTests.cs index 5c5816f73..95064579f 100644 --- a/tests/Cluckwork.Api.IntegrationTests/CatalogTests.cs +++ b/tests/Cluckwork.Api.IntegrationTests/CatalogTests.cs @@ -1,8 +1,8 @@ -namespace Cluckwork.Api.IntegrationTests; - using System.Net; using Cluckwork.Api.IntegrationTests.Infrastructure; +namespace Cluckwork.Api.IntegrationTests; + // #97 (part 1) — product catalog: egg products mapped to grades, packed-unit // conversions, admin-gated writes, seeded defaults, audit trail. [Collection(IntegrationCollection.Name)] diff --git a/tests/Cluckwork.Api.IntegrationTests/ChangeUserEmailRaceTests.cs b/tests/Cluckwork.Api.IntegrationTests/ChangeUserEmailRaceTests.cs index 889388907..5c8377568 100644 --- a/tests/Cluckwork.Api.IntegrationTests/ChangeUserEmailRaceTests.cs +++ b/tests/Cluckwork.Api.IntegrationTests/ChangeUserEmailRaceTests.cs @@ -1,5 +1,3 @@ -namespace Cluckwork.Api.IntegrationTests; - using System.Data.Common; using System.Net; using System.Net.Http.Json; @@ -22,6 +20,8 @@ namespace Cluckwork.Api.IntegrationTests; using Microsoft.Extensions.DependencyInjection; using Npgsql; +namespace Cluckwork.Api.IntegrationTests; + public sealed class ChangeUserEmailFinalSaveFactory : CluckworkWebApplicationFactory { public ChangeUserEmailFinalSaveInterceptor Interceptor { get; } = new(); diff --git a/tests/Cluckwork.Api.IntegrationTests/ChangeUserEmailTests.cs b/tests/Cluckwork.Api.IntegrationTests/ChangeUserEmailTests.cs index d45d07494..6e562f16a 100644 --- a/tests/Cluckwork.Api.IntegrationTests/ChangeUserEmailTests.cs +++ b/tests/Cluckwork.Api.IntegrationTests/ChangeUserEmailTests.cs @@ -1,5 +1,3 @@ -namespace Cluckwork.Api.IntegrationTests; - using System.Net; using System.Net.Http.Json; using Cluckwork.Api.Endpoints.Auth; @@ -13,6 +11,8 @@ namespace Cluckwork.Api.IntegrationTests; using Microsoft.EntityFrameworkCore; using Microsoft.Extensions.DependencyInjection; +namespace Cluckwork.Api.IntegrationTests; + [Collection(IntegrationCollection.Name)] public sealed class ChangeUserEmailTests(CluckworkWebApplicationFactory factory) { diff --git a/tests/Cluckwork.Api.IntegrationTests/ChangeUserRoleRaceTests.cs b/tests/Cluckwork.Api.IntegrationTests/ChangeUserRoleRaceTests.cs index 665064758..b970b55d7 100644 --- a/tests/Cluckwork.Api.IntegrationTests/ChangeUserRoleRaceTests.cs +++ b/tests/Cluckwork.Api.IntegrationTests/ChangeUserRoleRaceTests.cs @@ -1,5 +1,3 @@ -namespace Cluckwork.Api.IntegrationTests; - using Cluckwork.Api.IntegrationTests.Infrastructure; using Cluckwork.Application.Common; using Cluckwork.Application.Features.Users.ChangeUserRole; @@ -8,6 +6,8 @@ namespace Cluckwork.Api.IntegrationTests; using Microsoft.EntityFrameworkCore; using Microsoft.Extensions.DependencyInjection; +namespace Cluckwork.Api.IntegrationTests; + // #355 — the Users.LastOwner guard and the actor-still-Owner re-check are both // evaluated inside IdentityProvider.ChangeUserRoleAsync's account-locked // transaction. Two things make several of their branches unreachable through diff --git a/tests/Cluckwork.Api.IntegrationTests/ChangeUserRoleTests.cs b/tests/Cluckwork.Api.IntegrationTests/ChangeUserRoleTests.cs index bc0a2618f..7d12b60bd 100644 --- a/tests/Cluckwork.Api.IntegrationTests/ChangeUserRoleTests.cs +++ b/tests/Cluckwork.Api.IntegrationTests/ChangeUserRoleTests.cs @@ -1,5 +1,3 @@ -namespace Cluckwork.Api.IntegrationTests; - using System.Net; using System.Net.Http.Headers; using System.Net.Http.Json; @@ -8,6 +6,8 @@ namespace Cluckwork.Api.IntegrationTests; using Microsoft.EntityFrameworkCore; using Microsoft.Extensions.DependencyInjection; +namespace Cluckwork.Api.IntegrationTests; + // #355 — promote/demote an existing user's role. HTTP-driven scenarios that // exercise the full pipeline (self-target guard, validation, step-up header, // idempotency). Guard-boundary and race scenarios live in diff --git a/tests/Cluckwork.Api.IntegrationTests/CliDispatcherTests.cs b/tests/Cluckwork.Api.IntegrationTests/CliDispatcherTests.cs index 3b72231e9..696fab7a0 100644 --- a/tests/Cluckwork.Api.IntegrationTests/CliDispatcherTests.cs +++ b/tests/Cluckwork.Api.IntegrationTests/CliDispatcherTests.cs @@ -1,8 +1,8 @@ -namespace Cluckwork.Api.IntegrationTests; - using System.Linq; using Cluckwork.Api.Cli; +namespace Cluckwork.Api.IntegrationTests; + // #288 — the extracted CLI dispatcher. Each command is covered end-to-end by its // own subprocess test (SeedCommandTests, MigrateCommandTests, // RecoverAdminCommandTests); these cover the ROUTING itself. No Docker. diff --git a/tests/Cluckwork.Api.IntegrationTests/ClientErrorReportTests.cs b/tests/Cluckwork.Api.IntegrationTests/ClientErrorReportTests.cs index 06f6d11c2..9b78ae95d 100644 --- a/tests/Cluckwork.Api.IntegrationTests/ClientErrorReportTests.cs +++ b/tests/Cluckwork.Api.IntegrationTests/ClientErrorReportTests.cs @@ -1,5 +1,3 @@ -namespace Cluckwork.Api.IntegrationTests; - using System.Net; using Cluckwork.Api.IntegrationTests.Infrastructure; using Microsoft.AspNetCore.Hosting; @@ -7,6 +5,8 @@ namespace Cluckwork.Api.IntegrationTests; using Microsoft.Extensions.DependencyInjection; using Serilog.Events; +namespace Cluckwork.Api.IntegrationTests; + // #217 — the SPA's ErrorBoundary reports render crashes to the API, which // writes them to the server log at Error level with structured fields. The // endpoint is anonymous (the login screen can crash too), size-capped and diff --git a/tests/Cluckwork.Api.IntegrationTests/ConnectionTlsFloorWiringTests.cs b/tests/Cluckwork.Api.IntegrationTests/ConnectionTlsFloorWiringTests.cs index 709ed9a26..122b99188 100644 --- a/tests/Cluckwork.Api.IntegrationTests/ConnectionTlsFloorWiringTests.cs +++ b/tests/Cluckwork.Api.IntegrationTests/ConnectionTlsFloorWiringTests.cs @@ -1,8 +1,8 @@ -namespace Cluckwork.Api.IntegrationTests; - using Cluckwork.Api.IntegrationTests.Infrastructure; using Microsoft.AspNetCore.Hosting; +namespace Cluckwork.Api.IntegrationTests; + // #262 — proves the Production TLS floor is WIRED into startup (Program.cs calls // PostgresConnectionString.NormalizeAndValidate once, before Build, with isProduction and // the AllowInsecureConnection opt-out). The floor's LOGIC is unit-tested in diff --git a/tests/Cluckwork.Api.IntegrationTests/CredentialEpochRaceTests.cs b/tests/Cluckwork.Api.IntegrationTests/CredentialEpochRaceTests.cs index d8d982e48..efd665376 100644 --- a/tests/Cluckwork.Api.IntegrationTests/CredentialEpochRaceTests.cs +++ b/tests/Cluckwork.Api.IntegrationTests/CredentialEpochRaceTests.cs @@ -1,5 +1,3 @@ -namespace Cluckwork.Api.IntegrationTests; - using System.Data.Common; using System.Net; using Cluckwork.Api.IntegrationTests.Infrastructure; @@ -13,6 +11,8 @@ namespace Cluckwork.Api.IntegrationTests; using Microsoft.EntityFrameworkCore.Diagnostics; using Microsoft.Extensions.DependencyInjection; +namespace Cluckwork.Api.IntegrationTests; + public sealed class CredentialEpochRaceFactory : CluckworkWebApplicationFactory { public EpochReplayBarrierInterceptor Barrier { get; } = new(); diff --git a/tests/Cluckwork.Api.IntegrationTests/CredentialEpochTests.cs b/tests/Cluckwork.Api.IntegrationTests/CredentialEpochTests.cs index 29cd6a3d1..73c5bd733 100644 --- a/tests/Cluckwork.Api.IntegrationTests/CredentialEpochTests.cs +++ b/tests/Cluckwork.Api.IntegrationTests/CredentialEpochTests.cs @@ -1,5 +1,3 @@ -namespace Cluckwork.Api.IntegrationTests; - using System.Net; using System.IdentityModel.Tokens.Jwt; using System.Security.Claims; @@ -15,6 +13,8 @@ namespace Cluckwork.Api.IntegrationTests; using Microsoft.Extensions.DependencyInjection; using Microsoft.IdentityModel.Tokens; +namespace Cluckwork.Api.IntegrationTests; + [Collection(IntegrationCollection.Name)] public sealed class CredentialEpochTests(CluckworkWebApplicationFactory factory) { diff --git a/tests/Cluckwork.Api.IntegrationTests/CurrencyLockRaceTests.cs b/tests/Cluckwork.Api.IntegrationTests/CurrencyLockRaceTests.cs index 6090b0ebf..506fa53a9 100644 --- a/tests/Cluckwork.Api.IntegrationTests/CurrencyLockRaceTests.cs +++ b/tests/Cluckwork.Api.IntegrationTests/CurrencyLockRaceTests.cs @@ -1,5 +1,3 @@ -namespace Cluckwork.Api.IntegrationTests; - using Cluckwork.Api.IntegrationTests.Infrastructure; using Cluckwork.Application.Features.Accounts.UpdateFarmSettings; using Cluckwork.Application.Features.Expenses.CreateExpense; @@ -9,6 +7,8 @@ namespace Cluckwork.Api.IntegrationTests; using Microsoft.EntityFrameworkCore; using Microsoft.Extensions.DependencyInjection; +namespace Cluckwork.Api.IntegrationTests; + // #162 — the ACTUAL close of §4.6's read-then-write window, the one // CurrencyLockSerializationTests proves SERIALIZABLE cannot deliver: every // handler that stamps Account.DefaultCurrencyCode onto a new row takes FOR diff --git a/tests/Cluckwork.Api.IntegrationTests/CurrencyLockSerializationTests.cs b/tests/Cluckwork.Api.IntegrationTests/CurrencyLockSerializationTests.cs index 18a7404af..6401599c2 100644 --- a/tests/Cluckwork.Api.IntegrationTests/CurrencyLockSerializationTests.cs +++ b/tests/Cluckwork.Api.IntegrationTests/CurrencyLockSerializationTests.cs @@ -1,5 +1,3 @@ -namespace Cluckwork.Api.IntegrationTests; - using System.Data; using Cluckwork.Api.IntegrationTests.Infrastructure; using Cluckwork.Domain.Accounts; @@ -7,6 +5,8 @@ namespace Cluckwork.Api.IntegrationTests; using Cluckwork.Infrastructure.Persistence; using Microsoft.EntityFrameworkCore; +namespace Cluckwork.Api.IntegrationTests; + // #123 / #159 review — why UpdateFarmSettingsHandler does NOT use SERIALIZABLE // to close §4.6's read-then-write window. // diff --git a/tests/Cluckwork.Api.IntegrationTests/CustomerAndOrderTests.cs b/tests/Cluckwork.Api.IntegrationTests/CustomerAndOrderTests.cs index 320e97788..9e191f335 100644 --- a/tests/Cluckwork.Api.IntegrationTests/CustomerAndOrderTests.cs +++ b/tests/Cluckwork.Api.IntegrationTests/CustomerAndOrderTests.cs @@ -1,9 +1,9 @@ -namespace Cluckwork.Api.IntegrationTests; - using System.Net; using Cluckwork.Api.IntegrationTests.Infrastructure; using Microsoft.EntityFrameworkCore; +namespace Cluckwork.Api.IntegrationTests; + // #10 + #11 — customers and the order create/add-item surface. The final test // drives the whole MVP loop through the public API alone (no harness seeding // beyond the account/user/grades). diff --git a/tests/Cluckwork.Api.IntegrationTests/DailyEntryAdjustTests.cs b/tests/Cluckwork.Api.IntegrationTests/DailyEntryAdjustTests.cs index c2c0683fb..5da4a3a27 100644 --- a/tests/Cluckwork.Api.IntegrationTests/DailyEntryAdjustTests.cs +++ b/tests/Cluckwork.Api.IntegrationTests/DailyEntryAdjustTests.cs @@ -1,5 +1,3 @@ -namespace Cluckwork.Api.IntegrationTests; - using System.Net; using System.Text.Json; using Cluckwork.Api.IntegrationTests.Infrastructure; @@ -9,6 +7,8 @@ namespace Cluckwork.Api.IntegrationTests; using Microsoft.EntityFrameworkCore; using Microsoft.Extensions.DependencyInjection; +namespace Cluckwork.Api.IntegrationTests; + // #69 — adjusting/voiding submitted entries must keep the entry, its egg lots, // and the bird ledger consistent in one transaction, and must never touch // eggs that already left the farm (sold/allocated). diff --git a/tests/Cluckwork.Api.IntegrationTests/DailyEntryGradeTests.cs b/tests/Cluckwork.Api.IntegrationTests/DailyEntryGradeTests.cs index 01f3c9254..fbd7c5dc1 100644 --- a/tests/Cluckwork.Api.IntegrationTests/DailyEntryGradeTests.cs +++ b/tests/Cluckwork.Api.IntegrationTests/DailyEntryGradeTests.cs @@ -1,9 +1,9 @@ -namespace Cluckwork.Api.IntegrationTests; - using System.Net; using Cluckwork.Api.IntegrationTests.Infrastructure; using Microsoft.EntityFrameworkCore; +namespace Cluckwork.Api.IntegrationTests; + // #6: daily entry captures sellable production by grade, referencing EggGrade // rows (spec §9.1/9.2). Covers the HTTP round-trip, full-replace semantics on // re-record (in-place reconcile, unique (DailyEntryId, EggGradeId) index), and diff --git a/tests/Cluckwork.Api.IntegrationTests/DemoSeedActorTests.cs b/tests/Cluckwork.Api.IntegrationTests/DemoSeedActorTests.cs index 76a15919f..9abad8065 100644 --- a/tests/Cluckwork.Api.IntegrationTests/DemoSeedActorTests.cs +++ b/tests/Cluckwork.Api.IntegrationTests/DemoSeedActorTests.cs @@ -1,5 +1,3 @@ -namespace Cluckwork.Api.IntegrationTests; - using Cluckwork.Api.IntegrationTests.Infrastructure; using Cluckwork.Domain.Accounts; using Cluckwork.Infrastructure.Identity; @@ -8,6 +6,8 @@ namespace Cluckwork.Api.IntegrationTests; using Microsoft.EntityFrameworkCore; using Microsoft.Extensions.DependencyInjection; +namespace Cluckwork.Api.IntegrationTests; + // #500 — who signs the demo fixture. // // The no-Owner fact and the attribution fact need different starting states. diff --git a/tests/Cluckwork.Api.IntegrationTests/DemoSeedTests.cs b/tests/Cluckwork.Api.IntegrationTests/DemoSeedTests.cs index aaf242e29..8db9f7416 100644 --- a/tests/Cluckwork.Api.IntegrationTests/DemoSeedTests.cs +++ b/tests/Cluckwork.Api.IntegrationTests/DemoSeedTests.cs @@ -1,5 +1,3 @@ -namespace Cluckwork.Api.IntegrationTests; - using System.Net.Http.Headers; using Cluckwork.Api.IntegrationTests.Infrastructure; using Cluckwork.Domain.Accounts; @@ -9,6 +7,8 @@ namespace Cluckwork.Api.IntegrationTests; using Microsoft.EntityFrameworkCore; using Microsoft.Extensions.DependencyInjection; +namespace Cluckwork.Api.IntegrationTests; + // #58 — Demo sample data: seeds once through the real domain path on a fresh // catalog, no-ops on the second call, and never runs on boot. // diff --git a/tests/Cluckwork.Api.IntegrationTests/DetachedTenantWriteTests.cs b/tests/Cluckwork.Api.IntegrationTests/DetachedTenantWriteTests.cs index 4abf1f4af..0b8df81d3 100644 --- a/tests/Cluckwork.Api.IntegrationTests/DetachedTenantWriteTests.cs +++ b/tests/Cluckwork.Api.IntegrationTests/DetachedTenantWriteTests.cs @@ -1,11 +1,11 @@ -namespace Cluckwork.Api.IntegrationTests; - using Cluckwork.Api.IntegrationTests.Infrastructure; using Cluckwork.Domain.Common; using Cluckwork.Domain.Eggs; using Cluckwork.Domain.Inventory; using Microsoft.EntityFrameworkCore; +namespace Cluckwork.Api.IntegrationTests; + // #562 — the write guard's provenance gap, closed at the database. // // TenantStampInterceptor compares AccountId's ORIGINAL value against the diff --git a/tests/Cluckwork.Api.IntegrationTests/DisableUserRaceTests.cs b/tests/Cluckwork.Api.IntegrationTests/DisableUserRaceTests.cs index 862706cd6..452a8f1e6 100644 --- a/tests/Cluckwork.Api.IntegrationTests/DisableUserRaceTests.cs +++ b/tests/Cluckwork.Api.IntegrationTests/DisableUserRaceTests.cs @@ -1,5 +1,3 @@ -namespace Cluckwork.Api.IntegrationTests; - using System.Net; using System.Net.Http.Json; using Cluckwork.Api.Endpoints.Auth; @@ -12,6 +10,8 @@ namespace Cluckwork.Api.IntegrationTests; using Microsoft.EntityFrameworkCore; using Microsoft.Extensions.DependencyInjection; +namespace Cluckwork.Api.IntegrationTests; + // #356 — the guards that a sequential test cannot reach. // // The last-active-Owner guard is NOT race-safe on the strength of diff --git a/tests/Cluckwork.Api.IntegrationTests/DisableUserTests.cs b/tests/Cluckwork.Api.IntegrationTests/DisableUserTests.cs index 3f6a65a63..b7e0a6cdc 100644 --- a/tests/Cluckwork.Api.IntegrationTests/DisableUserTests.cs +++ b/tests/Cluckwork.Api.IntegrationTests/DisableUserTests.cs @@ -1,5 +1,3 @@ -namespace Cluckwork.Api.IntegrationTests; - using System.Net; using System.Net.Http.Json; using Cluckwork.Api.Endpoints.Auth; @@ -8,6 +6,8 @@ namespace Cluckwork.Api.IntegrationTests; using Microsoft.EntityFrameworkCore; using Microsoft.Extensions.DependencyInjection; +namespace Cluckwork.Api.IntegrationTests; + // #356 — disable / re-enable a user. HTTP-driven scenarios exercising the full // pipeline (self-target guard, step-up header, idempotency, body cap). // diff --git a/tests/Cluckwork.Api.IntegrationTests/DistributedIpFixedWindowRateLimiterTests.cs b/tests/Cluckwork.Api.IntegrationTests/DistributedIpFixedWindowRateLimiterTests.cs index 18934720a..0c889d250 100644 --- a/tests/Cluckwork.Api.IntegrationTests/DistributedIpFixedWindowRateLimiterTests.cs +++ b/tests/Cluckwork.Api.IntegrationTests/DistributedIpFixedWindowRateLimiterTests.cs @@ -1,10 +1,10 @@ -namespace Cluckwork.Api.IntegrationTests; - using Cluckwork.Api.IntegrationTests.SharedState; // FakeTimeProvider (local test clock) using Cluckwork.Infrastructure.RateLimiting; using Cluckwork.Infrastructure.SharedState; using System.Threading.RateLimiting; +namespace Cluckwork.Api.IntegrationTests; + // #544 — direct unit tests for the distributed per-IP limiter (no Docker: a // hand-written counter stub + FakeTimeProvider). The integration wiring tests // hit these paths only indirectly; this file covers the edges they don't: diff --git a/tests/Cluckwork.Api.IntegrationTests/DistributedRateLimiterWiringTests.cs b/tests/Cluckwork.Api.IntegrationTests/DistributedRateLimiterWiringTests.cs index fbd570568..e5f4e0ab7 100644 --- a/tests/Cluckwork.Api.IntegrationTests/DistributedRateLimiterWiringTests.cs +++ b/tests/Cluckwork.Api.IntegrationTests/DistributedRateLimiterWiringTests.cs @@ -1,5 +1,3 @@ -namespace Cluckwork.Api.IntegrationTests; - using System.Collections.Concurrent; using System.Net; using Cluckwork.Api.IntegrationTests.Infrastructure; @@ -15,6 +13,8 @@ namespace Cluckwork.Api.IntegrationTests; using Serilog.Events; using StackExchange.Redis; +namespace Cluckwork.Api.IntegrationTests; + // #544 — the WIRING of the distributed limiter, driven through the real // rate-limiting middleware on a CluckworkWebApplicationFactory with the // DI-registered IFixedWindowCounter replaced by a controllable double: diff --git a/tests/Cluckwork.Api.IntegrationTests/DurableJobWorkerLeaderGateTests.cs b/tests/Cluckwork.Api.IntegrationTests/DurableJobWorkerLeaderGateTests.cs index c4fbf3a3e..f3e3a6928 100644 --- a/tests/Cluckwork.Api.IntegrationTests/DurableJobWorkerLeaderGateTests.cs +++ b/tests/Cluckwork.Api.IntegrationTests/DurableJobWorkerLeaderGateTests.cs @@ -1,9 +1,9 @@ -namespace Cluckwork.Api.IntegrationTests; - using Cluckwork.Infrastructure.Jobs; using Microsoft.Extensions.DependencyInjection; using Microsoft.Extensions.Logging.Abstractions; +namespace Cluckwork.Api.IntegrationTests; + // #271 — the worker's leadership gate. The poll (and therefore the sweeps) runs only // while this instance is the leader; a follower does no work but stays healthy; a // FAULTED acquisition (could not reach the lock) does no work AND does not stamp the diff --git a/tests/Cluckwork.Api.IntegrationTests/DurableJobWorkerResilienceTests.cs b/tests/Cluckwork.Api.IntegrationTests/DurableJobWorkerResilienceTests.cs index 7ad13b996..bb35ac13c 100644 --- a/tests/Cluckwork.Api.IntegrationTests/DurableJobWorkerResilienceTests.cs +++ b/tests/Cluckwork.Api.IntegrationTests/DurableJobWorkerResilienceTests.cs @@ -1,11 +1,11 @@ -namespace Cluckwork.Api.IntegrationTests; - using System.Net; using Cluckwork.Api.IntegrationTests.Infrastructure; using Cluckwork.Infrastructure.Jobs; using Microsoft.Extensions.DependencyInjection; using Microsoft.Extensions.Logging.Abstractions; +namespace Cluckwork.Api.IntegrationTests; + // #65 — a transient failure inside one poll iteration must never escape into // ExecuteAsync, where the host default (StopHost) would take the API down. // Plain unit tests: the worker is exercised through its guarded iteration diff --git a/tests/Cluckwork.Api.IntegrationTests/EggGradeFloorRaceTests.cs b/tests/Cluckwork.Api.IntegrationTests/EggGradeFloorRaceTests.cs index c32259146..143b2d73c 100644 --- a/tests/Cluckwork.Api.IntegrationTests/EggGradeFloorRaceTests.cs +++ b/tests/Cluckwork.Api.IntegrationTests/EggGradeFloorRaceTests.cs @@ -1,5 +1,3 @@ -namespace Cluckwork.Api.IntegrationTests; - using System.Data.Common; using System.Net; using Cluckwork.Api.IntegrationTests.Infrastructure; @@ -10,6 +8,8 @@ namespace Cluckwork.Api.IntegrationTests; using Microsoft.EntityFrameworkCore.Diagnostics; using Microsoft.Extensions.DependencyInjection; +namespace Cluckwork.Api.IntegrationTests; + public sealed class EggGradeFloorRaceFactory : CluckworkWebApplicationFactory { public GradeReadRendezvousInterceptor Rendezvous { get; } = new(); diff --git a/tests/Cluckwork.Api.IntegrationTests/EggGradeLowStockFloorTests.cs b/tests/Cluckwork.Api.IntegrationTests/EggGradeLowStockFloorTests.cs index dd96c5a99..2e2089cba 100644 --- a/tests/Cluckwork.Api.IntegrationTests/EggGradeLowStockFloorTests.cs +++ b/tests/Cluckwork.Api.IntegrationTests/EggGradeLowStockFloorTests.cs @@ -1,10 +1,10 @@ -namespace Cluckwork.Api.IntegrationTests; - using System.Net; using Cluckwork.Api.IntegrationTests.Infrastructure; using Cluckwork.Domain.Accounts; using Microsoft.EntityFrameworkCore; +namespace Cluckwork.Api.IntegrationTests; + // #911 — the per-grade low-stock floor over the API: who may move it, what // GET /stock reports about it, and the Version-token race the aggregate-mutation // rule requires of a new mutation (AGENTS.md). diff --git a/tests/Cluckwork.Api.IntegrationTests/EggGradeManagementTests.cs b/tests/Cluckwork.Api.IntegrationTests/EggGradeManagementTests.cs index 875902da5..66f3914ba 100644 --- a/tests/Cluckwork.Api.IntegrationTests/EggGradeManagementTests.cs +++ b/tests/Cluckwork.Api.IntegrationTests/EggGradeManagementTests.cs @@ -1,9 +1,9 @@ -namespace Cluckwork.Api.IntegrationTests; - using System.Net; using Cluckwork.Api.IntegrationTests.Infrastructure; using Microsoft.EntityFrameworkCore; +namespace Cluckwork.Api.IntegrationTests; + // #42 — egg grade management: CRUD over the API, case-insensitive name // uniqueness, deactivation semantics, and the Version-token race required by // the aggregate-mutation rule (AGENTS.md). diff --git a/tests/Cluckwork.Api.IntegrationTests/EggLedgerTests.cs b/tests/Cluckwork.Api.IntegrationTests/EggLedgerTests.cs index 7dbcb32e1..f56a03876 100644 --- a/tests/Cluckwork.Api.IntegrationTests/EggLedgerTests.cs +++ b/tests/Cluckwork.Api.IntegrationTests/EggLedgerTests.cs @@ -1,8 +1,8 @@ -namespace Cluckwork.Api.IntegrationTests; - using System.Net; using Cluckwork.Api.IntegrationTests.Infrastructure; +namespace Cluckwork.Api.IntegrationTests; + // #101 — the egg movement ledger. Every lot mutation writes an explicit // signed row in the same transaction, and the cached QuantityAvailable must // always equal the sum of the lot's movements (tech-spec §212 rule). diff --git a/tests/Cluckwork.Api.IntegrationTests/EggLotConcurrencyTests.cs b/tests/Cluckwork.Api.IntegrationTests/EggLotConcurrencyTests.cs index 416f9ae5f..700e9cc4e 100644 --- a/tests/Cluckwork.Api.IntegrationTests/EggLotConcurrencyTests.cs +++ b/tests/Cluckwork.Api.IntegrationTests/EggLotConcurrencyTests.cs @@ -1,9 +1,9 @@ -namespace Cluckwork.Api.IntegrationTests; - using System.Net; using Cluckwork.Api.IntegrationTests.Infrastructure; using Microsoft.EntityFrameworkCore; +namespace Cluckwork.Api.IntegrationTests; + // tech spec §3.3 / §10.9.1 / §11: concurrent confirmation against the same egg lot must // serialize on the FOR UPDATE lock — exactly one sale allocates, the other is rejected, // and the lot is never oversold. diff --git a/tests/Cluckwork.Api.IntegrationTests/EggLotWriteOffTests.cs b/tests/Cluckwork.Api.IntegrationTests/EggLotWriteOffTests.cs index 01f00f2ac..ce38a0d08 100644 --- a/tests/Cluckwork.Api.IntegrationTests/EggLotWriteOffTests.cs +++ b/tests/Cluckwork.Api.IntegrationTests/EggLotWriteOffTests.cs @@ -1,5 +1,3 @@ -namespace Cluckwork.Api.IntegrationTests; - using System.Net; using System.Net.Http.Json; using System.Text.Json; @@ -7,6 +5,8 @@ namespace Cluckwork.Api.IntegrationTests; using Cluckwork.Domain.Eggs; using Microsoft.EntityFrameworkCore; +namespace Cluckwork.Api.IntegrationTests; + // #406 — standalone stock write-off / reconciliation against a single egg // lot: available moves, production never restates, the ledger stays the // source of truth for the cached balance. diff --git a/tests/Cluckwork.Api.IntegrationTests/ErrorCodesContractTests.cs b/tests/Cluckwork.Api.IntegrationTests/ErrorCodesContractTests.cs index cff23e629..bb5390663 100644 --- a/tests/Cluckwork.Api.IntegrationTests/ErrorCodesContractTests.cs +++ b/tests/Cluckwork.Api.IntegrationTests/ErrorCodesContractTests.cs @@ -1,9 +1,9 @@ -namespace Cluckwork.Api.IntegrationTests; - using System.Net; using System.Text.Json; using Cluckwork.Api.IntegrationTests.Infrastructure; +namespace Cluckwork.Api.IntegrationTests; + [Collection(IntegrationCollection.Name)] public sealed class ErrorCodesContractTests(CluckworkWebApplicationFactory factory) { diff --git a/tests/Cluckwork.Api.IntegrationTests/ExceptionHandlerReExecutionTests.cs b/tests/Cluckwork.Api.IntegrationTests/ExceptionHandlerReExecutionTests.cs index e47e1b8ed..052283f24 100644 --- a/tests/Cluckwork.Api.IntegrationTests/ExceptionHandlerReExecutionTests.cs +++ b/tests/Cluckwork.Api.IntegrationTests/ExceptionHandlerReExecutionTests.cs @@ -1,5 +1,3 @@ -namespace Cluckwork.Api.IntegrationTests; - using System.Net; using System.Security.Cryptography; using System.Text; @@ -14,6 +12,8 @@ namespace Cluckwork.Api.IntegrationTests; using Microsoft.EntityFrameworkCore; using Microsoft.Extensions.DependencyInjection; +namespace Cluckwork.Api.IntegrationTests; + // The faults these tests need are injected as validator replacements, so the // throw originates INSIDE the endpoint — downstream of IdempotencyMiddleware, // exactly where a real handler fault would. Malformed JSON is deliberately NOT diff --git a/tests/Cluckwork.Api.IntegrationTests/ExpensesTests.cs b/tests/Cluckwork.Api.IntegrationTests/ExpensesTests.cs index a5dcf1e2a..d685ae550 100644 --- a/tests/Cluckwork.Api.IntegrationTests/ExpensesTests.cs +++ b/tests/Cluckwork.Api.IntegrationTests/ExpensesTests.cs @@ -1,9 +1,9 @@ -namespace Cluckwork.Api.IntegrationTests; - using System.Net; using Cluckwork.Api.IntegrationTests.Infrastructure; using Microsoft.EntityFrameworkCore; +namespace Cluckwork.Api.IntegrationTests; + // #87 — basic expenses: farm-scoped category catalog (grade pattern) and // money-out records with a snapshotted currency, server-side period totals, // and version-guarded admin corrections. diff --git a/tests/Cluckwork.Api.IntegrationTests/ExportTests.cs b/tests/Cluckwork.Api.IntegrationTests/ExportTests.cs index 6bea31cf0..f6f91aaca 100644 --- a/tests/Cluckwork.Api.IntegrationTests/ExportTests.cs +++ b/tests/Cluckwork.Api.IntegrationTests/ExportTests.cs @@ -1,5 +1,3 @@ -namespace Cluckwork.Api.IntegrationTests; - using System.IO.Compression; using System.Net; using System.Text; @@ -7,6 +5,8 @@ namespace Cluckwork.Api.IntegrationTests; using Cluckwork.Api.IntegrationTests.Infrastructure; using Cluckwork.Domain.Accounts; +namespace Cluckwork.Api.IntegrationTests; + // #95 — manual backup: admin-only CSV export per dataset + full-account zip. // The CSVs must be tenant-scoped, RFC 4180-escaped, and formula-guarded. [Collection(IntegrationCollection.Name)] diff --git a/tests/Cluckwork.Api.IntegrationTests/FarmBannerMigrationDowngradeTests.cs b/tests/Cluckwork.Api.IntegrationTests/FarmBannerMigrationDowngradeTests.cs index 71dbc5a7d..5df820b03 100644 --- a/tests/Cluckwork.Api.IntegrationTests/FarmBannerMigrationDowngradeTests.cs +++ b/tests/Cluckwork.Api.IntegrationTests/FarmBannerMigrationDowngradeTests.cs @@ -1,5 +1,3 @@ -namespace Cluckwork.Api.IntegrationTests; - using Cluckwork.Api.IntegrationTests.Infrastructure; using Cluckwork.Domain.Accounts; using Cluckwork.Domain.Media; @@ -11,6 +9,8 @@ namespace Cluckwork.Api.IntegrationTests; using Microsoft.EntityFrameworkCore.Infrastructure; using Microsoft.EntityFrameworkCore.Migrations; +namespace Cluckwork.Api.IntegrationTests; + // Codex review of #496 (AddFarmBannerColumns): the pre-banner schema required // every FarmLogos row to carry a real logo, so a banner-only row (Content // NULL, BannerContent set) that this migration's Up() allows has no valid diff --git a/tests/Cluckwork.Api.IntegrationTests/FarmBannerTests.cs b/tests/Cluckwork.Api.IntegrationTests/FarmBannerTests.cs index 50ae05e8f..28091ad73 100644 --- a/tests/Cluckwork.Api.IntegrationTests/FarmBannerTests.cs +++ b/tests/Cluckwork.Api.IntegrationTests/FarmBannerTests.cs @@ -1,5 +1,3 @@ -namespace Cluckwork.Api.IntegrationTests; - using System.Net; using System.Net.Http.Headers; using System.Net.Http.Json; @@ -8,6 +6,8 @@ namespace Cluckwork.Api.IntegrationTests; using Cluckwork.Domain.Media; using Microsoft.EntityFrameworkCore; +namespace Cluckwork.Api.IntegrationTests; + // #179 — the farm banner over the wire. FarmLogoTests.cs already proves // ImageSanitizer's format/security guarantees survive the round trip; these // cover what's NEW here — the banner's own route, its own size/error-code diff --git a/tests/Cluckwork.Api.IntegrationTests/FarmClockTests.cs b/tests/Cluckwork.Api.IntegrationTests/FarmClockTests.cs index 9f78692d9..cd624aa2b 100644 --- a/tests/Cluckwork.Api.IntegrationTests/FarmClockTests.cs +++ b/tests/Cluckwork.Api.IntegrationTests/FarmClockTests.cs @@ -1,11 +1,11 @@ -namespace Cluckwork.Api.IntegrationTests; - using Cluckwork.Application.Common; using Cluckwork.Application.Features.Accounts; using Cluckwork.Domain.Accounts; using Cluckwork.Infrastructure.Time; using Microsoft.Extensions.Logging.Abstractions; +namespace Cluckwork.Api.IntegrationTests; + // #35. Plain unit tests (no container): FarmClock is the single date boundary // the stock read, the FIFO allocation and the future-date validators all share, // so its edges are worth pinning directly. diff --git a/tests/Cluckwork.Api.IntegrationTests/FarmLocalBoundaryBehindUtcTests.cs b/tests/Cluckwork.Api.IntegrationTests/FarmLocalBoundaryBehindUtcTests.cs index 36a09a1af..f6141cadb 100644 --- a/tests/Cluckwork.Api.IntegrationTests/FarmLocalBoundaryBehindUtcTests.cs +++ b/tests/Cluckwork.Api.IntegrationTests/FarmLocalBoundaryBehindUtcTests.cs @@ -1,5 +1,3 @@ -namespace Cluckwork.Api.IntegrationTests; - using System.Net; using System.Net.Http.Json; using Cluckwork.Api.IntegrationTests.Infrastructure; @@ -8,6 +6,8 @@ namespace Cluckwork.Api.IntegrationTests; using Microsoft.EntityFrameworkCore; using Microsoft.Extensions.DependencyInjection; +namespace Cluckwork.Api.IntegrationTests; + // #155, the other direction. FarmLocalBoundarySweepTests uses a farm AHEAD of // UTC (Auckland), where the old code REFUSED legitimate work. Here the farm is // BEHIND UTC (Los Angeles), where the old code did the opposite and ACCEPTED diff --git a/tests/Cluckwork.Api.IntegrationTests/FarmLocalBoundarySweepTests.cs b/tests/Cluckwork.Api.IntegrationTests/FarmLocalBoundarySweepTests.cs index 980606ff2..70378c105 100644 --- a/tests/Cluckwork.Api.IntegrationTests/FarmLocalBoundarySweepTests.cs +++ b/tests/Cluckwork.Api.IntegrationTests/FarmLocalBoundarySweepTests.cs @@ -1,5 +1,3 @@ -namespace Cluckwork.Api.IntegrationTests; - using System.Net; using System.Net.Http.Json; using Cluckwork.Api.IntegrationTests.Infrastructure; @@ -8,6 +6,8 @@ namespace Cluckwork.Api.IntegrationTests; using Microsoft.EntityFrameworkCore; using Microsoft.Extensions.DependencyInjection; +namespace Cluckwork.Api.IntegrationTests; + // #155 — the boundaries #35 left on UTC, now on the farm clock. Every case here // is a farm AHEAD of UTC, which is the direction that used to REFUSE legitimate // work: at 10:00 on July 16 in Auckland it is still July 15 in UTC, so the diff --git a/tests/Cluckwork.Api.IntegrationTests/FarmLocalRestrictionTests.cs b/tests/Cluckwork.Api.IntegrationTests/FarmLocalRestrictionTests.cs index 94809e323..3492eaacb 100644 --- a/tests/Cluckwork.Api.IntegrationTests/FarmLocalRestrictionTests.cs +++ b/tests/Cluckwork.Api.IntegrationTests/FarmLocalRestrictionTests.cs @@ -1,5 +1,3 @@ -namespace Cluckwork.Api.IntegrationTests; - using System.Net; using System.Net.Http.Json; using Cluckwork.Api.IntegrationTests.Infrastructure; @@ -7,6 +5,8 @@ namespace Cluckwork.Api.IntegrationTests; using Microsoft.AspNetCore.TestHost; using Microsoft.Extensions.DependencyInjection; +namespace Cluckwork.Api.IntegrationTests; + // #35 end-to-end. The FarmClock unit tests prove the conversion; these prove the // STOCK READ and the SALE actually use it — reverting either call site to // clock.TodayUtc leaves the unit tests green but fails these. diff --git a/tests/Cluckwork.Api.IntegrationTests/FarmLogoOptionsTests.cs b/tests/Cluckwork.Api.IntegrationTests/FarmLogoOptionsTests.cs index 6f90a26dc..5a2243bb1 100644 --- a/tests/Cluckwork.Api.IntegrationTests/FarmLogoOptionsTests.cs +++ b/tests/Cluckwork.Api.IntegrationTests/FarmLogoOptionsTests.cs @@ -1,9 +1,9 @@ -namespace Cluckwork.Api.IntegrationTests; - using Cluckwork.Api.Configuration; using Cluckwork.Domain.Media; using Microsoft.Extensions.Options; +namespace Cluckwork.Api.IntegrationTests; + // #123 — the operational upload cap is config, validated at boot so a // misconfigured value fails the start rather than the first upload. A value // above the ceiling would hand every request a buffer larger than the column diff --git a/tests/Cluckwork.Api.IntegrationTests/FarmLogoRequestBodyCapTests.cs b/tests/Cluckwork.Api.IntegrationTests/FarmLogoRequestBodyCapTests.cs index a3452dca9..21651695d 100644 --- a/tests/Cluckwork.Api.IntegrationTests/FarmLogoRequestBodyCapTests.cs +++ b/tests/Cluckwork.Api.IntegrationTests/FarmLogoRequestBodyCapTests.cs @@ -1,5 +1,3 @@ -namespace Cluckwork.Api.IntegrationTests; - using System.Text.Json; using Cluckwork.Api.Configuration; using Cluckwork.Api.Endpoints.Accounts; @@ -10,6 +8,8 @@ namespace Cluckwork.Api.IntegrationTests; using Microsoft.Extensions.Logging; using Microsoft.Extensions.Options; +namespace Cluckwork.Api.IntegrationTests; + // #442 review (codex) — KestrelRequestBodyLimitTests' Kestrel-backed tests // prove the observable RESPONSE SHAPE for an oversized logo upload, but // proving WHEN the cap fires relative to "whatever runs next" (Idempotency- diff --git a/tests/Cluckwork.Api.IntegrationTests/FarmLogoTests.cs b/tests/Cluckwork.Api.IntegrationTests/FarmLogoTests.cs index 485a71ac9..21a3953c2 100644 --- a/tests/Cluckwork.Api.IntegrationTests/FarmLogoTests.cs +++ b/tests/Cluckwork.Api.IntegrationTests/FarmLogoTests.cs @@ -1,5 +1,3 @@ -namespace Cluckwork.Api.IntegrationTests; - using System.Buffers.Binary; using System.Net; using System.Net.Http.Headers; @@ -11,6 +9,8 @@ namespace Cluckwork.Api.IntegrationTests; using Microsoft.EntityFrameworkCore; using Microsoft.Extensions.Options; +namespace Cluckwork.Api.IntegrationTests; + // #123 slice 2 — the farm logo over the wire: who may upload one, what a stored // image is allowed to be, and what comes back out. // diff --git a/tests/Cluckwork.Api.IntegrationTests/FarmSettingsTests.cs b/tests/Cluckwork.Api.IntegrationTests/FarmSettingsTests.cs index 89ba2280d..b55fa0773 100644 --- a/tests/Cluckwork.Api.IntegrationTests/FarmSettingsTests.cs +++ b/tests/Cluckwork.Api.IntegrationTests/FarmSettingsTests.cs @@ -1,5 +1,3 @@ -namespace Cluckwork.Api.IntegrationTests; - using System.Net; using System.Net.Http.Json; using Cluckwork.Api.IntegrationTests.Infrastructure; @@ -8,6 +6,8 @@ namespace Cluckwork.Api.IntegrationTests; using Microsoft.EntityFrameworkCore; using Microsoft.Extensions.DependencyInjection; +namespace Cluckwork.Api.IntegrationTests; + // #123 slice 1 — farm settings over the wire: the account read every role needs // for §4.5 formatting, the owner-only settings screen, §4.6's currency lock, // and the two guards that keep the settings themselves trustworthy (version diff --git a/tests/Cluckwork.Api.IntegrationTests/FeedUsageTests.cs b/tests/Cluckwork.Api.IntegrationTests/FeedUsageTests.cs index fd1c3651f..fac7a9ea9 100644 --- a/tests/Cluckwork.Api.IntegrationTests/FeedUsageTests.cs +++ b/tests/Cluckwork.Api.IntegrationTests/FeedUsageTests.cs @@ -1,9 +1,9 @@ -namespace Cluckwork.Api.IntegrationTests; - using System.Net; using Cluckwork.Api.IntegrationTests.Infrastructure; using Microsoft.EntityFrameworkCore; +namespace Cluckwork.Api.IntegrationTests; + // #66 (PR 2) — feed usage + corrections: FIFO lot consumption under the // canonical lock, per-lot Usage ledger rows with lot-cost estimates, and the // compensating Adjustment/Discard path that makes typo'd purchases fixable. diff --git a/tests/Cluckwork.Api.IntegrationTests/FirstRunAdminUnlockCleanupTests.cs b/tests/Cluckwork.Api.IntegrationTests/FirstRunAdminUnlockCleanupTests.cs index 4af8a6b35..a3743f560 100644 --- a/tests/Cluckwork.Api.IntegrationTests/FirstRunAdminUnlockCleanupTests.cs +++ b/tests/Cluckwork.Api.IntegrationTests/FirstRunAdminUnlockCleanupTests.cs @@ -1,5 +1,3 @@ -namespace Cluckwork.Api.IntegrationTests; - using System.Data.Common; using Cluckwork.Api.IntegrationTests.Infrastructure; using Cluckwork.Domain.Accounts; @@ -13,6 +11,8 @@ namespace Cluckwork.Api.IntegrationTests; using Microsoft.Extensions.DependencyInjection; using Npgsql; +namespace Cluckwork.Api.IntegrationTests; + // PR #339 review — a session-scoped pg_advisory_unlock that fails AFTER // FirstRunAdminService.ProvisionUnderLockAsync already committed the first // Owner must not discard that successful Result: the generated temporary diff --git a/tests/Cluckwork.Api.IntegrationTests/FirstRunLoginNoticeTests.cs b/tests/Cluckwork.Api.IntegrationTests/FirstRunLoginNoticeTests.cs index e37b1e6d0..bdb261112 100644 --- a/tests/Cluckwork.Api.IntegrationTests/FirstRunLoginNoticeTests.cs +++ b/tests/Cluckwork.Api.IntegrationTests/FirstRunLoginNoticeTests.cs @@ -1,5 +1,3 @@ -namespace Cluckwork.Api.IntegrationTests; - using System.Net; using System.Net.Http.Json; using Cluckwork.Api.Endpoints.Auth; @@ -11,6 +9,8 @@ namespace Cluckwork.Api.IntegrationTests; using Microsoft.EntityFrameworkCore; using Microsoft.Extensions.DependencyInjection; +namespace Cluckwork.Api.IntegrationTests; + // #283 follow-up — how a sign-in on an instance with NO administrator reports // itself, so the login screen can explain the dead end instead of showing the // generic denial. diff --git a/tests/Cluckwork.Api.IntegrationTests/FlockManagementTests.cs b/tests/Cluckwork.Api.IntegrationTests/FlockManagementTests.cs index 29e949b1f..3f57929ba 100644 --- a/tests/Cluckwork.Api.IntegrationTests/FlockManagementTests.cs +++ b/tests/Cluckwork.Api.IntegrationTests/FlockManagementTests.cs @@ -1,9 +1,9 @@ -namespace Cluckwork.Api.IntegrationTests; - using System.Net; using Cluckwork.Api.IntegrationTests.Infrastructure; using Microsoft.EntityFrameworkCore; +namespace Cluckwork.Api.IntegrationTests; + // #47 — flock management: update/deplete/archive over the API, archived // exclusion from default lists, capture gating on flock status, and the // Version-token race (AGENTS.md aggregate-mutation rule). diff --git a/tests/Cluckwork.Api.IntegrationTests/FlockScopeMiddlewareTests.cs b/tests/Cluckwork.Api.IntegrationTests/FlockScopeMiddlewareTests.cs index 90e8500cb..651673db4 100644 --- a/tests/Cluckwork.Api.IntegrationTests/FlockScopeMiddlewareTests.cs +++ b/tests/Cluckwork.Api.IntegrationTests/FlockScopeMiddlewareTests.cs @@ -1,5 +1,3 @@ -namespace Cluckwork.Api.IntegrationTests; - using System.Net; using Cluckwork.Api.Endpoints.Auth; using Cluckwork.Api.IntegrationTests.Infrastructure; @@ -11,6 +9,8 @@ namespace Cluckwork.Api.IntegrationTests; using Microsoft.AspNetCore.Http; using Microsoft.EntityFrameworkCore; +namespace Cluckwork.Api.IntegrationTests; + // #388 — FlockScopeResolutionMiddleware: resolution outcomes per persona, and // the single-assignment contract. Scoping itself (filtered reads) is asserted // in FlockScopeTests (Increment 2). diff --git a/tests/Cluckwork.Api.IntegrationTests/FlockScopeTests.cs b/tests/Cluckwork.Api.IntegrationTests/FlockScopeTests.cs index fcd64cf5f..9c517760f 100644 --- a/tests/Cluckwork.Api.IntegrationTests/FlockScopeTests.cs +++ b/tests/Cluckwork.Api.IntegrationTests/FlockScopeTests.cs @@ -1,5 +1,3 @@ -namespace Cluckwork.Api.IntegrationTests; - using System.Net; using Cluckwork.Api.Endpoints.Auth; using Cluckwork.Api.IntegrationTests.Infrastructure; @@ -17,6 +15,8 @@ namespace Cluckwork.Api.IntegrationTests; using Microsoft.EntityFrameworkCore; using Microsoft.Extensions.DependencyInjection; +namespace Cluckwork.Api.IntegrationTests; + // #388 — the read scoping itself (INV-1): a Worker scoped to one flock sees // only that flock's rows + farm-wide rows; unassigned flock detail is 404 // (symmetric filtering — the row simply is not there, not 403). diff --git a/tests/Cluckwork.Api.IntegrationTests/ForwardedHeaderTrustKestrelTests.cs b/tests/Cluckwork.Api.IntegrationTests/ForwardedHeaderTrustKestrelTests.cs index d3d2a3d2a..1f11adac4 100644 --- a/tests/Cluckwork.Api.IntegrationTests/ForwardedHeaderTrustKestrelTests.cs +++ b/tests/Cluckwork.Api.IntegrationTests/ForwardedHeaderTrustKestrelTests.cs @@ -1,5 +1,3 @@ -namespace Cluckwork.Api.IntegrationTests; - using System.Net; using System.Net.Http.Json; using Cluckwork.Api.IntegrationTests.Infrastructure; @@ -9,6 +7,8 @@ namespace Cluckwork.Api.IntegrationTests; using Microsoft.AspNetCore.TestHost; using Microsoft.Extensions.DependencyInjection; +namespace Cluckwork.Api.IntegrationTests; + // #343 — RateLimitingTests and SecurityHeadersForwardedProxyTests prove the // forwarded-header trust decision using FakeRemoteIpStartupFilter, which // synthesizes Connection.RemoteIpAddress from a test header because the diff --git a/tests/Cluckwork.Api.IntegrationTests/FutureLotAllocationTests.cs b/tests/Cluckwork.Api.IntegrationTests/FutureLotAllocationTests.cs index 511fd463d..0ba439818 100644 --- a/tests/Cluckwork.Api.IntegrationTests/FutureLotAllocationTests.cs +++ b/tests/Cluckwork.Api.IntegrationTests/FutureLotAllocationTests.cs @@ -1,9 +1,9 @@ -namespace Cluckwork.Api.IntegrationTests; - using System.Net; using System.Net.Http.Json; using Cluckwork.Api.IntegrationTests.Infrastructure; +namespace Cluckwork.Api.IntegrationTests; + // #35: the stock read and FIFO allocation must agree about what exists. The // stock query has always hidden future-dated production ("if it ever slips in"); // the allocation query did not, so a lot dated ahead of today was invisible in diff --git a/tests/Cluckwork.Api.IntegrationTests/GlobalUserLookupGuardTests.cs b/tests/Cluckwork.Api.IntegrationTests/GlobalUserLookupGuardTests.cs index 8b3307214..2d57dcd03 100644 --- a/tests/Cluckwork.Api.IntegrationTests/GlobalUserLookupGuardTests.cs +++ b/tests/Cluckwork.Api.IntegrationTests/GlobalUserLookupGuardTests.cs @@ -1,7 +1,7 @@ -namespace Cluckwork.Api.IntegrationTests; - using System.IO; +namespace Cluckwork.Api.IntegrationTests; + // #532 — a globally-scoped Identity user lookup is a tenant-isolation defect // once one email can belong to several farms: // diff --git a/tests/Cluckwork.Api.IntegrationTests/HandlerLoggingTests.cs b/tests/Cluckwork.Api.IntegrationTests/HandlerLoggingTests.cs index be6e4146c..01c84d76d 100644 --- a/tests/Cluckwork.Api.IntegrationTests/HandlerLoggingTests.cs +++ b/tests/Cluckwork.Api.IntegrationTests/HandlerLoggingTests.cs @@ -1,8 +1,8 @@ -namespace Cluckwork.Api.IntegrationTests; - using Cluckwork.Api.IntegrationTests.Infrastructure; using Serilog.Events; +namespace Cluckwork.Api.IntegrationTests; + // #216 — money-path handlers narrate state transitions: Information on // success with stable ids, Warning with the failure reason on a failed // Result. AccountId rides on every in-request event via the tenant diff --git a/tests/Cluckwork.Api.IntegrationTests/HealthCheckCliCommandTests.cs b/tests/Cluckwork.Api.IntegrationTests/HealthCheckCliCommandTests.cs index b95dd39f3..4e8a78432 100644 --- a/tests/Cluckwork.Api.IntegrationTests/HealthCheckCliCommandTests.cs +++ b/tests/Cluckwork.Api.IntegrationTests/HealthCheckCliCommandTests.cs @@ -1,10 +1,10 @@ -namespace Cluckwork.Api.IntegrationTests; - using Cluckwork.Api.Cli; using Microsoft.AspNetCore.Builder; using Microsoft.AspNetCore.Http; using Microsoft.Extensions.Logging; +namespace Cluckwork.Api.IntegrationTests; + // #266 — the `healthcheck` verb's probe logic. No Docker: each test stands up a // tiny REAL Kestrel returning a chosen status, so it exercises a real socket + // real HTTP (not a mocked handler). The mapping guarantee: a 2xx → exit 0, and diff --git a/tests/Cluckwork.Api.IntegrationTests/HstsOverRealTlsTests.cs b/tests/Cluckwork.Api.IntegrationTests/HstsOverRealTlsTests.cs index 29a90e77e..5653ddc5d 100644 --- a/tests/Cluckwork.Api.IntegrationTests/HstsOverRealTlsTests.cs +++ b/tests/Cluckwork.Api.IntegrationTests/HstsOverRealTlsTests.cs @@ -1,5 +1,3 @@ -namespace Cluckwork.Api.IntegrationTests; - using System.Net; using System.Net.Http.Headers; using System.Net.Security; @@ -11,6 +9,8 @@ namespace Cluckwork.Api.IntegrationTests; using Microsoft.AspNetCore.Hosting.Server.Features; using Microsoft.Extensions.DependencyInjection; +namespace Cluckwork.Api.IntegrationTests; + // #344 — HSTS and HTTPS redirection, asserted over a REAL TLS connection. // // Every other assertion about these two middlewares in this suite runs against diff --git a/tests/Cluckwork.Api.IntegrationTests/IdempotencyRecordPurgeSweepTests.cs b/tests/Cluckwork.Api.IntegrationTests/IdempotencyRecordPurgeSweepTests.cs index c8d2e1f4d..d88c52232 100644 --- a/tests/Cluckwork.Api.IntegrationTests/IdempotencyRecordPurgeSweepTests.cs +++ b/tests/Cluckwork.Api.IntegrationTests/IdempotencyRecordPurgeSweepTests.cs @@ -1,5 +1,3 @@ -namespace Cluckwork.Api.IntegrationTests; - using System.Net; using Cluckwork.Api.IntegrationTests.Infrastructure; using Cluckwork.Domain.Accounts; @@ -9,6 +7,8 @@ namespace Cluckwork.Api.IntegrationTests; using Microsoft.EntityFrameworkCore; using Microsoft.Extensions.DependencyInjection; +namespace Cluckwork.Api.IntegrationTests; + // #259 — idempotency_records grows without bound: IdempotencyMiddleware inserts a // claim per idempotent write and marks it Completed with the replay payload, but // nothing ever deletes an old row. IdempotencyRecordPurgeSweep (a DurableJobWorker diff --git a/tests/Cluckwork.Api.IntegrationTests/IdempotencyReplayTests.cs b/tests/Cluckwork.Api.IntegrationTests/IdempotencyReplayTests.cs index 3988139bb..e1ec18d7a 100644 --- a/tests/Cluckwork.Api.IntegrationTests/IdempotencyReplayTests.cs +++ b/tests/Cluckwork.Api.IntegrationTests/IdempotencyReplayTests.cs @@ -1,9 +1,9 @@ -namespace Cluckwork.Api.IntegrationTests; - using System.Net; using Cluckwork.Api.IntegrationTests.Infrastructure; using Microsoft.EntityFrameworkCore; +namespace Cluckwork.Api.IntegrationTests; + // tech spec §11 / functional §23: replaying a write with the same Idempotency-Key must // return the original response and never duplicate the side effect. [Collection(IntegrationCollection.Name)] diff --git a/tests/Cluckwork.Api.IntegrationTests/IdempotencyUserScopeTests.cs b/tests/Cluckwork.Api.IntegrationTests/IdempotencyUserScopeTests.cs index 8e73048e9..f5f742529 100644 --- a/tests/Cluckwork.Api.IntegrationTests/IdempotencyUserScopeTests.cs +++ b/tests/Cluckwork.Api.IntegrationTests/IdempotencyUserScopeTests.cs @@ -1,10 +1,10 @@ -namespace Cluckwork.Api.IntegrationTests; - using System.Net; using System.Net.Http.Json; using Cluckwork.Api.IntegrationTests.Infrastructure; using Cluckwork.Domain.Accounts; +namespace Cluckwork.Api.IntegrationTests; + [Collection(IntegrationCollection.Name)] public sealed class IdempotencyUserScopeTests(CluckworkWebApplicationFactory factory) { diff --git a/tests/Cluckwork.Api.IntegrationTests/Infrastructure/CluckworkWebApplicationFactory.cs b/tests/Cluckwork.Api.IntegrationTests/Infrastructure/CluckworkWebApplicationFactory.cs index 2c83d28b9..36da92fcd 100644 --- a/tests/Cluckwork.Api.IntegrationTests/Infrastructure/CluckworkWebApplicationFactory.cs +++ b/tests/Cluckwork.Api.IntegrationTests/Infrastructure/CluckworkWebApplicationFactory.cs @@ -1,5 +1,3 @@ -namespace Cluckwork.Api.IntegrationTests.Infrastructure; - using System.Diagnostics; using System.Security.Cryptography; using Cluckwork.Infrastructure.Persistence; @@ -8,6 +6,8 @@ namespace Cluckwork.Api.IntegrationTests.Infrastructure; using Microsoft.EntityFrameworkCore; using Microsoft.Extensions.DependencyInjection; +namespace Cluckwork.Api.IntegrationTests.Infrastructure; + // Full-stack integration tests run against a real Postgres container (tech spec §5.4). // SQLite is deliberately NOT used — EF Core SQL semantics differ too much. public class CluckworkWebApplicationFactory : WebApplicationFactory, IAsyncLifetime diff --git a/tests/Cluckwork.Api.IntegrationTests/Infrastructure/DmlOnlyRole.cs b/tests/Cluckwork.Api.IntegrationTests/Infrastructure/DmlOnlyRole.cs index c9f3a4244..7d603dfed 100644 --- a/tests/Cluckwork.Api.IntegrationTests/Infrastructure/DmlOnlyRole.cs +++ b/tests/Cluckwork.Api.IntegrationTests/Infrastructure/DmlOnlyRole.cs @@ -1,8 +1,8 @@ -namespace Cluckwork.Api.IntegrationTests.Infrastructure; - using System.Security.Cryptography; using Npgsql; +namespace Cluckwork.Api.IntegrationTests.Infrastructure; + internal static class DmlOnlyRole { public static async Task CreateConnectionStringAsync(string adminConnectionString) diff --git a/tests/Cluckwork.Api.IntegrationTests/Infrastructure/FakeOtlpCollector.cs b/tests/Cluckwork.Api.IntegrationTests/Infrastructure/FakeOtlpCollector.cs index 8b70ae8dd..0b5559ff7 100644 --- a/tests/Cluckwork.Api.IntegrationTests/Infrastructure/FakeOtlpCollector.cs +++ b/tests/Cluckwork.Api.IntegrationTests/Infrastructure/FakeOtlpCollector.cs @@ -1,10 +1,10 @@ -namespace Cluckwork.Api.IntegrationTests.Infrastructure; - using System.Collections.Concurrent; using System.Net; using System.Net.Sockets; using System.Threading.Channels; +namespace Cluckwork.Api.IntegrationTests.Infrastructure; + internal sealed record CapturedOtlpRequest( string Path, byte[] Body, diff --git a/tests/Cluckwork.Api.IntegrationTests/Infrastructure/FakeOtlpCollectorTests.cs b/tests/Cluckwork.Api.IntegrationTests/Infrastructure/FakeOtlpCollectorTests.cs index 44f50cdaa..84b9853f1 100644 --- a/tests/Cluckwork.Api.IntegrationTests/Infrastructure/FakeOtlpCollectorTests.cs +++ b/tests/Cluckwork.Api.IntegrationTests/Infrastructure/FakeOtlpCollectorTests.cs @@ -1,8 +1,8 @@ -namespace Cluckwork.Api.IntegrationTests.Infrastructure; - using System.Net; using System.Net.Sockets; +namespace Cluckwork.Api.IntegrationTests.Infrastructure; + public sealed class FakeOtlpCollectorTests { [Fact] diff --git a/tests/Cluckwork.Api.IntegrationTests/Infrastructure/FakeRemoteIpStartupFilter.cs b/tests/Cluckwork.Api.IntegrationTests/Infrastructure/FakeRemoteIpStartupFilter.cs index e35d2ccc1..b4aa91cbe 100644 --- a/tests/Cluckwork.Api.IntegrationTests/Infrastructure/FakeRemoteIpStartupFilter.cs +++ b/tests/Cluckwork.Api.IntegrationTests/Infrastructure/FakeRemoteIpStartupFilter.cs @@ -1,9 +1,9 @@ -namespace Cluckwork.Api.IntegrationTests.Infrastructure; - using System.Net; using Microsoft.AspNetCore.Builder; using Microsoft.AspNetCore.Hosting; +namespace Cluckwork.Api.IntegrationTests.Infrastructure; + // The in-process TestServer has no socket peer, so per-IP behavior (rate // limiting, forwarded-header trust) has nothing to key on. This filter sets // Connection.RemoteIpAddress from the X-Test-Remote header before the real diff --git a/tests/Cluckwork.Api.IntegrationTests/Infrastructure/IsolatedLoginBucket.cs b/tests/Cluckwork.Api.IntegrationTests/Infrastructure/IsolatedLoginBucket.cs index 83f5860f2..1b2fb9fc7 100644 --- a/tests/Cluckwork.Api.IntegrationTests/Infrastructure/IsolatedLoginBucket.cs +++ b/tests/Cluckwork.Api.IntegrationTests/Infrastructure/IsolatedLoginBucket.cs @@ -1,8 +1,8 @@ -namespace Cluckwork.Api.IntegrationTests.Infrastructure; - using Microsoft.AspNetCore.Hosting; using Microsoft.AspNetCore.Mvc.Testing; +namespace Cluckwork.Api.IntegrationTests.Infrastructure; + // #840 — the login rate-limit bucket is keyed on the client address ALONE // (RateLimitKey.ForClient, reached from DistributedIpFixedWindowPolicy), and every // test host in this suite is reached over loopback. So every class that exercises diff --git a/tests/Cluckwork.Api.IntegrationTests/Infrastructure/KestrelLogAssertions.cs b/tests/Cluckwork.Api.IntegrationTests/Infrastructure/KestrelLogAssertions.cs index bd3ae702c..723bcc651 100644 --- a/tests/Cluckwork.Api.IntegrationTests/Infrastructure/KestrelLogAssertions.cs +++ b/tests/Cluckwork.Api.IntegrationTests/Infrastructure/KestrelLogAssertions.cs @@ -1,7 +1,7 @@ -namespace Cluckwork.Api.IntegrationTests.Infrastructure; - using Serilog.Events; +namespace Cluckwork.Api.IntegrationTests.Infrastructure; + // Shared by every Kestrel-backed test class that needs to prove a request // completed cleanly server-side even when the client-visible status code // can't show it (#340: the response can commit before a later throw). See diff --git a/tests/Cluckwork.Api.IntegrationTests/Infrastructure/OtlpPayloadAssertions.cs b/tests/Cluckwork.Api.IntegrationTests/Infrastructure/OtlpPayloadAssertions.cs index 9b903f38c..ac15d55a4 100644 --- a/tests/Cluckwork.Api.IntegrationTests/Infrastructure/OtlpPayloadAssertions.cs +++ b/tests/Cluckwork.Api.IntegrationTests/Infrastructure/OtlpPayloadAssertions.cs @@ -1,8 +1,8 @@ -namespace Cluckwork.Api.IntegrationTests.Infrastructure; - using System.Text; using Google.Protobuf; +namespace Cluckwork.Api.IntegrationTests.Infrastructure; + internal static class OtlpPayloadAssertions { private const string ServiceName = "Cluckwork.Api"; diff --git a/tests/Cluckwork.Api.IntegrationTests/Infrastructure/OtlpPayloadAssertionsTests.cs b/tests/Cluckwork.Api.IntegrationTests/Infrastructure/OtlpPayloadAssertionsTests.cs index 471e37af2..94cd0980f 100644 --- a/tests/Cluckwork.Api.IntegrationTests/Infrastructure/OtlpPayloadAssertionsTests.cs +++ b/tests/Cluckwork.Api.IntegrationTests/Infrastructure/OtlpPayloadAssertionsTests.cs @@ -1,7 +1,7 @@ -namespace Cluckwork.Api.IntegrationTests.Infrastructure; - using Google.Protobuf; +namespace Cluckwork.Api.IntegrationTests.Infrastructure; + public sealed class OtlpPayloadAssertionsTests { [Fact] diff --git a/tests/Cluckwork.Api.IntegrationTests/Infrastructure/ReferenceDataComparison.cs b/tests/Cluckwork.Api.IntegrationTests/Infrastructure/ReferenceDataComparison.cs index cfe229aa6..702eb8e6b 100644 --- a/tests/Cluckwork.Api.IntegrationTests/Infrastructure/ReferenceDataComparison.cs +++ b/tests/Cluckwork.Api.IntegrationTests/Infrastructure/ReferenceDataComparison.cs @@ -1,7 +1,7 @@ -namespace Cluckwork.Api.IntegrationTests.Infrastructure; - using Microsoft.EntityFrameworkCore.Metadata; +namespace Cluckwork.Api.IntegrationTests.Infrastructure; + internal static class ReferenceDataComparison { public static void AssertMappedPropertiesEqualByKey( diff --git a/tests/Cluckwork.Api.IntegrationTests/Infrastructure/SeedCommandRunner.cs b/tests/Cluckwork.Api.IntegrationTests/Infrastructure/SeedCommandRunner.cs index 67437db0b..b70a5b5e6 100644 --- a/tests/Cluckwork.Api.IntegrationTests/Infrastructure/SeedCommandRunner.cs +++ b/tests/Cluckwork.Api.IntegrationTests/Infrastructure/SeedCommandRunner.cs @@ -1,7 +1,7 @@ -namespace Cluckwork.Api.IntegrationTests.Infrastructure; - using System.Diagnostics; +namespace Cluckwork.Api.IntegrationTests.Infrastructure; + // Shared subprocess runner for the `seed --profile ` CLI tests // (SeedCommandTests + SimulationSeedCommandTests). Extracted (#279 review) so // the non-trivial pipe-draining/timeout logic lives in exactly one place rather diff --git a/tests/Cluckwork.Api.IntegrationTests/Infrastructure/ServingSubprocess.cs b/tests/Cluckwork.Api.IntegrationTests/Infrastructure/ServingSubprocess.cs index df79d942a..c438bcb06 100644 --- a/tests/Cluckwork.Api.IntegrationTests/Infrastructure/ServingSubprocess.cs +++ b/tests/Cluckwork.Api.IntegrationTests/Infrastructure/ServingSubprocess.cs @@ -1,9 +1,9 @@ -namespace Cluckwork.Api.IntegrationTests.Infrastructure; - using System.Diagnostics; using System.Net; using System.Net.Sockets; +namespace Cluckwork.Api.IntegrationTests.Infrastructure; + // A real Cluckwork.Api.dll child on its own ephemeral loopback port, with both pipes drained for its // whole life (an unread pipe fills its OS buffer and the child blocks on write) and kept, so a child // that dies before readiness can say why. diff --git a/tests/Cluckwork.Api.IntegrationTests/Infrastructure/SharedPostgresDatabase.cs b/tests/Cluckwork.Api.IntegrationTests/Infrastructure/SharedPostgresDatabase.cs index 8d970651b..e2d1cf3f3 100644 --- a/tests/Cluckwork.Api.IntegrationTests/Infrastructure/SharedPostgresDatabase.cs +++ b/tests/Cluckwork.Api.IntegrationTests/Infrastructure/SharedPostgresDatabase.cs @@ -1,5 +1,3 @@ -namespace Cluckwork.Api.IntegrationTests.Infrastructure; - using Cluckwork.Infrastructure.Persistence; using Cluckwork.Infrastructure.Persistence.Interceptors; using Cluckwork.Infrastructure.Providers; @@ -8,6 +6,8 @@ namespace Cluckwork.Api.IntegrationTests.Infrastructure; using Npgsql; using Testcontainers.PostgreSql; +namespace Cluckwork.Api.IntegrationTests.Infrastructure; + internal sealed class SharedPostgresDatabase : IAsyncDisposable { private static readonly Lazy> SharedCluster = new(StartClusterAsync); diff --git a/tests/Cluckwork.Api.IntegrationTests/Infrastructure/TestHarness.cs b/tests/Cluckwork.Api.IntegrationTests/Infrastructure/TestHarness.cs index 4a3784149..66c5876eb 100644 --- a/tests/Cluckwork.Api.IntegrationTests/Infrastructure/TestHarness.cs +++ b/tests/Cluckwork.Api.IntegrationTests/Infrastructure/TestHarness.cs @@ -1,5 +1,3 @@ -namespace Cluckwork.Api.IntegrationTests.Infrastructure; - using System.Collections.Concurrent; using System.Linq; using System.Net.Http.Headers; @@ -14,6 +12,8 @@ namespace Cluckwork.Api.IntegrationTests.Infrastructure; using Microsoft.AspNetCore.Mvc.Testing; using Microsoft.Extensions.DependencyInjection; +namespace Cluckwork.Api.IntegrationTests.Infrastructure; + // Seeding + auth helpers shared by the integration tests. Each helper that touches the // database opens its own DI scope with a resolved TenantContext, mirroring how the // tenant middleware resolves the account per request in production. diff --git a/tests/Cluckwork.Api.IntegrationTests/Infrastructure/TestTlsCertificate.cs b/tests/Cluckwork.Api.IntegrationTests/Infrastructure/TestTlsCertificate.cs index 0bf88d8df..bcceafe1c 100644 --- a/tests/Cluckwork.Api.IntegrationTests/Infrastructure/TestTlsCertificate.cs +++ b/tests/Cluckwork.Api.IntegrationTests/Infrastructure/TestTlsCertificate.cs @@ -1,9 +1,9 @@ -namespace Cluckwork.Api.IntegrationTests.Infrastructure; - using System.Net; using System.Security.Cryptography; using System.Security.Cryptography.X509Certificates; +namespace Cluckwork.Api.IntegrationTests.Infrastructure; + // #344 — a server certificate for the real-TLS Kestrel listener, generated at // test-process startup and never persisted. Same rule as TestJwtKeys: no key // material under source control for a secret scanner to find, and nothing that diff --git a/tests/Cluckwork.Api.IntegrationTests/Infrastructure/TransientFaultInterceptors.cs b/tests/Cluckwork.Api.IntegrationTests/Infrastructure/TransientFaultInterceptors.cs index 7a76ff05b..e46efd86c 100644 --- a/tests/Cluckwork.Api.IntegrationTests/Infrastructure/TransientFaultInterceptors.cs +++ b/tests/Cluckwork.Api.IntegrationTests/Infrastructure/TransientFaultInterceptors.cs @@ -1,9 +1,9 @@ -namespace Cluckwork.Api.IntegrationTests.Infrastructure; - using System.Data.Common; using Microsoft.EntityFrameworkCore.Diagnostics; using Npgsql; +namespace Cluckwork.Api.IntegrationTests.Infrastructure; + // #269 review — deterministic stand-ins for the two failure shapes the retry // boundary has to be reasoned about, neither of which can be produced reliably // by actually killing a Postgres container mid-request: diff --git a/tests/Cluckwork.Api.IntegrationTests/InventoryTests.cs b/tests/Cluckwork.Api.IntegrationTests/InventoryTests.cs index 3243f0c81..1be21deed 100644 --- a/tests/Cluckwork.Api.IntegrationTests/InventoryTests.cs +++ b/tests/Cluckwork.Api.IntegrationTests/InventoryTests.cs @@ -1,9 +1,9 @@ -namespace Cluckwork.Api.IntegrationTests; - using System.Net; using Cluckwork.Api.IntegrationTests.Infrastructure; using Microsoft.EntityFrameworkCore; +namespace Cluckwork.Api.IntegrationTests; + // #66 (PR 1) — inventory foundation: item catalog, receiving stock as lots, // and the append-only movement ledger. Consumption (feed usage) is PR 2. [Collection(IntegrationCollection.Name)] diff --git a/tests/Cluckwork.Api.IntegrationTests/KestrelRequestBodyLimitTests.cs b/tests/Cluckwork.Api.IntegrationTests/KestrelRequestBodyLimitTests.cs index 9f7042c91..10fa3bce8 100644 --- a/tests/Cluckwork.Api.IntegrationTests/KestrelRequestBodyLimitTests.cs +++ b/tests/Cluckwork.Api.IntegrationTests/KestrelRequestBodyLimitTests.cs @@ -1,5 +1,3 @@ -namespace Cluckwork.Api.IntegrationTests; - using System.Net; using System.Net.Http.Headers; using System.Text; @@ -7,6 +5,8 @@ namespace Cluckwork.Api.IntegrationTests; using Cluckwork.Api.IntegrationTests.Infrastructure; using Microsoft.AspNetCore.Http; +namespace Cluckwork.Api.IntegrationTests; + // #342 — follow-up to #340/#341. IHttpMaxRequestBodySizeFeature (the transport- // level cutoff RequestBodyLimit.cs, FarmLogoEndpoints and ClientErrorEndpoints // all set best-effort) is ABSENT under the in-memory TestServer, so the rest of diff --git a/tests/Cluckwork.Api.IntegrationTests/KestrelResponseWriteTests.cs b/tests/Cluckwork.Api.IntegrationTests/KestrelResponseWriteTests.cs index 57b429b0b..2878b7573 100644 --- a/tests/Cluckwork.Api.IntegrationTests/KestrelResponseWriteTests.cs +++ b/tests/Cluckwork.Api.IntegrationTests/KestrelResponseWriteTests.cs @@ -1,5 +1,3 @@ -namespace Cluckwork.Api.IntegrationTests; - using System.Collections.Concurrent; using System.Net; using Cluckwork.Api.IntegrationTests.Infrastructure; @@ -9,6 +7,8 @@ namespace Cluckwork.Api.IntegrationTests; using Serilog.Core; using Serilog.Events; +namespace Cluckwork.Api.IntegrationTests; + // #340 — every write endpoint returning 204 threw under a real server: // // System.InvalidOperationException: Writing to the response body is invalid diff --git a/tests/Cluckwork.Api.IntegrationTests/ListAccountsCommandTests.cs b/tests/Cluckwork.Api.IntegrationTests/ListAccountsCommandTests.cs index 9169e116f..989f48680 100644 --- a/tests/Cluckwork.Api.IntegrationTests/ListAccountsCommandTests.cs +++ b/tests/Cluckwork.Api.IntegrationTests/ListAccountsCommandTests.cs @@ -1,10 +1,10 @@ -namespace Cluckwork.Api.IntegrationTests; - using System.Diagnostics; using Cluckwork.Api.Cli; using Cluckwork.Api.IntegrationTests.Infrastructure; using Microsoft.EntityFrameworkCore; +namespace Cluckwork.Api.IntegrationTests; + // #531 — `list-accounts` is a real CLI dispatch branch, never exercised by // WebApplicationFactory (which passes empty args). This spawns the actual built // Cluckwork.Api.dll as a subprocess — the binary an operator runs — against the diff --git a/tests/Cluckwork.Api.IntegrationTests/ListChronologyTests.cs b/tests/Cluckwork.Api.IntegrationTests/ListChronologyTests.cs index e5d2c74cb..8a594c944 100644 --- a/tests/Cluckwork.Api.IntegrationTests/ListChronologyTests.cs +++ b/tests/Cluckwork.Api.IntegrationTests/ListChronologyTests.cs @@ -1,5 +1,3 @@ -namespace Cluckwork.Api.IntegrationTests; - using Cluckwork.Api.IntegrationTests.Infrastructure; using Cluckwork.Application.Features.Export; using Cluckwork.Application.Features.Sales; @@ -12,6 +10,8 @@ namespace Cluckwork.Api.IntegrationTests; using Cluckwork.Infrastructure.Persistence; using Cluckwork.Infrastructure.Repositories; +namespace Cluckwork.Api.IntegrationTests; + // #819 — these lists lead with a business date and row-creation time. Sequence // completes the insertion order without relying on a random v4 Guid. [Collection(IntegrationCollection.Name)] diff --git a/tests/Cluckwork.Api.IntegrationTests/LogRedactionTests.cs b/tests/Cluckwork.Api.IntegrationTests/LogRedactionTests.cs index 7235597a8..763b570df 100644 --- a/tests/Cluckwork.Api.IntegrationTests/LogRedactionTests.cs +++ b/tests/Cluckwork.Api.IntegrationTests/LogRedactionTests.cs @@ -1,5 +1,3 @@ -namespace Cluckwork.Api.IntegrationTests; - using System.Collections.Concurrent; using System.Security.Cryptography; using Cluckwork.Api.Logging; @@ -7,6 +5,8 @@ namespace Cluckwork.Api.IntegrationTests; using Serilog.Core; using Serilog.Events; +namespace Cluckwork.Api.IntegrationTests; + // #273 — SensitiveDataRedactionEnricher, exercised directly against a tiny // throwaway Serilog pipeline (no HTTP, no Postgres): fast and deterministic, // and precise about exactly what the enricher does to a given property. The diff --git a/tests/Cluckwork.Api.IntegrationTests/LoginCounterKeyProbeTests.cs b/tests/Cluckwork.Api.IntegrationTests/LoginCounterKeyProbeTests.cs index da22b80be..246dd08e9 100644 --- a/tests/Cluckwork.Api.IntegrationTests/LoginCounterKeyProbeTests.cs +++ b/tests/Cluckwork.Api.IntegrationTests/LoginCounterKeyProbeTests.cs @@ -1,5 +1,3 @@ -namespace Cluckwork.Api.IntegrationTests; - using System.Diagnostics; using System.Net; using System.Net.Sockets; @@ -11,6 +9,8 @@ namespace Cluckwork.Api.IntegrationTests; using StackExchange.Redis; using Testcontainers.Redis; +namespace Cluckwork.Api.IntegrationTests; + // #840 — the census reproduced "expected 429, got 401" once in 36 runs and got // 0 failures in 80 instrumented runs. It recorded what the counter was asked to // count and never who asked, so it could not tell a foreign spender from a diff --git a/tests/Cluckwork.Api.IntegrationTests/LoginRequestValidatorTests.cs b/tests/Cluckwork.Api.IntegrationTests/LoginRequestValidatorTests.cs index 384ad26a7..0a68301b8 100644 --- a/tests/Cluckwork.Api.IntegrationTests/LoginRequestValidatorTests.cs +++ b/tests/Cluckwork.Api.IntegrationTests/LoginRequestValidatorTests.cs @@ -1,8 +1,8 @@ -namespace Cluckwork.Api.IntegrationTests; - using Cluckwork.Api.Endpoints.Auth; using Cluckwork.Application.Features.Users; +namespace Cluckwork.Api.IntegrationTests; + // #309 — the login validator is MAX-length only: an oversized email/password is // rejected (so it never reaches the PBKDF2 verify), but an EMPTY credential must // still validate so it flows to LoginAsync and returns the generic 401. This is a diff --git a/tests/Cluckwork.Api.IntegrationTests/LogoutRefreshLineageRaceTests.cs b/tests/Cluckwork.Api.IntegrationTests/LogoutRefreshLineageRaceTests.cs index 7d50d64ef..7a82b82c6 100644 --- a/tests/Cluckwork.Api.IntegrationTests/LogoutRefreshLineageRaceTests.cs +++ b/tests/Cluckwork.Api.IntegrationTests/LogoutRefreshLineageRaceTests.cs @@ -1,5 +1,3 @@ -namespace Cluckwork.Api.IntegrationTests; - using System.Data.Common; using System.Net; using Cluckwork.Api.IntegrationTests.Infrastructure; @@ -10,6 +8,8 @@ namespace Cluckwork.Api.IntegrationTests; using Microsoft.EntityFrameworkCore.Diagnostics; using Microsoft.Extensions.DependencyInjection; +namespace Cluckwork.Api.IntegrationTests; + public sealed class LogoutRefreshLineageRaceFactory : CluckworkWebApplicationFactory { public RefreshRotationBarrierInterceptor RefreshRotation { get; } = new(); diff --git a/tests/Cluckwork.Api.IntegrationTests/MeEndpointsTests.cs b/tests/Cluckwork.Api.IntegrationTests/MeEndpointsTests.cs index 52b48b284..afd2e6e8d 100644 --- a/tests/Cluckwork.Api.IntegrationTests/MeEndpointsTests.cs +++ b/tests/Cluckwork.Api.IntegrationTests/MeEndpointsTests.cs @@ -1,10 +1,10 @@ -namespace Cluckwork.Api.IntegrationTests; - using System.Net; using System.Net.Http.Json; using Cluckwork.Api.IntegrationTests.Infrastructure; using Cluckwork.Domain.Accounts; +namespace Cluckwork.Api.IntegrationTests; + [Collection(IntegrationCollection.Name)] public sealed class MeEndpointsTests(CluckworkWebApplicationFactory factory) { diff --git a/tests/Cluckwork.Api.IntegrationTests/MigrateCommandTests.cs b/tests/Cluckwork.Api.IntegrationTests/MigrateCommandTests.cs index e9be3e5e2..d17c09697 100644 --- a/tests/Cluckwork.Api.IntegrationTests/MigrateCommandTests.cs +++ b/tests/Cluckwork.Api.IntegrationTests/MigrateCommandTests.cs @@ -1,9 +1,9 @@ -namespace Cluckwork.Api.IntegrationTests; - using System.Diagnostics; using Cluckwork.Api.IntegrationTests.Infrastructure; using Npgsql; +namespace Cluckwork.Api.IntegrationTests; + // #263 — `dotnet Cluckwork.Api.dll migrate` is a real CLI dispatch branch in // Program.cs (args[0] == "migrate"), never exercised by WebApplicationFactory // (empty args). It is the pre-deploy-job entrypoint that lets production run diff --git a/tests/Cluckwork.Api.IntegrationTests/MigrateOnStartupDisabledTests.cs b/tests/Cluckwork.Api.IntegrationTests/MigrateOnStartupDisabledTests.cs index e0e0f8691..116c62a63 100644 --- a/tests/Cluckwork.Api.IntegrationTests/MigrateOnStartupDisabledTests.cs +++ b/tests/Cluckwork.Api.IntegrationTests/MigrateOnStartupDisabledTests.cs @@ -1,5 +1,3 @@ -namespace Cluckwork.Api.IntegrationTests; - using System.Net; using Cluckwork.Api.IntegrationTests.Infrastructure; using Cluckwork.Infrastructure.Persistence; @@ -8,6 +6,8 @@ namespace Cluckwork.Api.IntegrationTests; using Microsoft.Extensions.DependencyInjection; using Npgsql; +namespace Cluckwork.Api.IntegrationTests; + // #263 — the PR's CENTRAL guarantee: with Database:MigrateOnStartup=false the // request-serving process never runs schema DDL at boot; a forgotten migrate job // is caught by readiness rather than served against a stale schema. The base diff --git a/tests/Cluckwork.Api.IntegrationTests/MigrationSecurityReviewTests.cs b/tests/Cluckwork.Api.IntegrationTests/MigrationSecurityReviewTests.cs index c128bf5f5..ac9562903 100644 --- a/tests/Cluckwork.Api.IntegrationTests/MigrationSecurityReviewTests.cs +++ b/tests/Cluckwork.Api.IntegrationTests/MigrationSecurityReviewTests.cs @@ -1,5 +1,3 @@ -namespace Cluckwork.Api.IntegrationTests; - using System.Collections; using System.Globalization; using System.Reflection; @@ -9,6 +7,8 @@ namespace Cluckwork.Api.IntegrationTests; using Microsoft.EntityFrameworkCore.Migrations; using Microsoft.EntityFrameworkCore.Migrations.Operations; +namespace Cluckwork.Api.IntegrationTests; + // #283 — "the `SecurityReviewed`-style assertion the issue calls for": no EF // migration may EVER embed a credential (or anything credential-shaped). Part // 1 moves roles/egg grades/the default account/default packed-unit diff --git a/tests/Cluckwork.Api.IntegrationTests/MultiInstanceIdempotencyTests.cs b/tests/Cluckwork.Api.IntegrationTests/MultiInstanceIdempotencyTests.cs index 8eb58bc1e..0894dedba 100644 --- a/tests/Cluckwork.Api.IntegrationTests/MultiInstanceIdempotencyTests.cs +++ b/tests/Cluckwork.Api.IntegrationTests/MultiInstanceIdempotencyTests.cs @@ -1,5 +1,3 @@ -namespace Cluckwork.Api.IntegrationTests; - using System.Diagnostics; using System.Net; using System.Net.Http.Headers; @@ -9,6 +7,8 @@ namespace Cluckwork.Api.IntegrationTests; using Cluckwork.Api.IntegrationTests.Infrastructure; using Npgsql; +namespace Cluckwork.Api.IntegrationTests; + // #307 acceptance criterion: "Two independently hosted API instances sharing // one Postgres database receive the same authenticated write concurrently and // produce exactly one domain mutation and one durable side effect" — and the diff --git a/tests/Cluckwork.Api.IntegrationTests/MultiInstanceRateLimitTests.cs b/tests/Cluckwork.Api.IntegrationTests/MultiInstanceRateLimitTests.cs index 1bfca2977..6909cbe98 100644 --- a/tests/Cluckwork.Api.IntegrationTests/MultiInstanceRateLimitTests.cs +++ b/tests/Cluckwork.Api.IntegrationTests/MultiInstanceRateLimitTests.cs @@ -1,11 +1,11 @@ -namespace Cluckwork.Api.IntegrationTests; - using System.Diagnostics; using System.Net; using System.Net.Http.Json; using Cluckwork.Api.IntegrationTests.Infrastructure; using Testcontainers.Redis; +namespace Cluckwork.Api.IntegrationTests; + // #544 acceptance proof: the IP-keyed auth rate limiters now enforce ONE // COMBINED per-IP budget across replicas via the shared IFixedWindowCounter // (#543), not one per-process budget. The pre-#544 in-process diff --git a/tests/Cluckwork.Api.IntegrationTests/MustChangePasswordGateTests.cs b/tests/Cluckwork.Api.IntegrationTests/MustChangePasswordGateTests.cs index e47cf3126..55d81f033 100644 --- a/tests/Cluckwork.Api.IntegrationTests/MustChangePasswordGateTests.cs +++ b/tests/Cluckwork.Api.IntegrationTests/MustChangePasswordGateTests.cs @@ -1,5 +1,3 @@ -namespace Cluckwork.Api.IntegrationTests; - using System.Net; using System.Net.Http.Headers; using Cluckwork.Api.Endpoints.Auth; @@ -14,6 +12,8 @@ namespace Cluckwork.Api.IntegrationTests; using Microsoft.EntityFrameworkCore; using Microsoft.Extensions.DependencyInjection; +namespace Cluckwork.Api.IntegrationTests; + // #283 — server-side enforcement of the first-run "you must set a new // password" gate (MustChangePasswordMiddleware). This is the API half of the // guarantee: claims.ts's UI gate is voluntary, this is not — a caller that diff --git a/tests/Cluckwork.Api.IntegrationTests/NamedEntityDiscoveryTests.cs b/tests/Cluckwork.Api.IntegrationTests/NamedEntityDiscoveryTests.cs index a7e8bdb8a..f1157b842 100644 --- a/tests/Cluckwork.Api.IntegrationTests/NamedEntityDiscoveryTests.cs +++ b/tests/Cluckwork.Api.IntegrationTests/NamedEntityDiscoveryTests.cs @@ -1,5 +1,3 @@ -namespace Cluckwork.Api.IntegrationTests; - using System.Net; using System.Text.Json; using Cluckwork.Api.Endpoints.Auth; @@ -9,6 +7,8 @@ namespace Cluckwork.Api.IntegrationTests; using Cluckwork.Infrastructure.Persistence; using Microsoft.EntityFrameworkCore; +namespace Cluckwork.Api.IntegrationTests; + // #512 US1 — discovery over the EXISTING list routes: literal case-insensitive // name search, stable `Name, Id` paging, and explicit flock eligibility applied // BEFORE ordering and paging, with the compatibility rules that keep every diff --git a/tests/Cluckwork.Api.IntegrationTests/NamedRowProjectionTests.cs b/tests/Cluckwork.Api.IntegrationTests/NamedRowProjectionTests.cs index e6068f02d..aa3c98597 100644 --- a/tests/Cluckwork.Api.IntegrationTests/NamedRowProjectionTests.cs +++ b/tests/Cluckwork.Api.IntegrationTests/NamedRowProjectionTests.cs @@ -1,5 +1,3 @@ -namespace Cluckwork.Api.IntegrationTests; - using System.Net; using Cluckwork.Api.IntegrationTests.Infrastructure; using Cluckwork.Application.Features.Customers; @@ -18,6 +16,8 @@ namespace Cluckwork.Api.IntegrationTests; using Microsoft.Extensions.DependencyInjection; using Microsoft.EntityFrameworkCore; +namespace Cluckwork.Api.IntegrationTests; + // #512 US4 — a returned ROW names its own flock / customer, so a picker consumer // can render a list without holding a catalogue of every referenced entity. The // fields are additive: `flockName`, `flockStatus`, `customerName` join existing diff --git a/tests/Cluckwork.Api.IntegrationTests/OneShotVerbMinimalConfigTests.cs b/tests/Cluckwork.Api.IntegrationTests/OneShotVerbMinimalConfigTests.cs index 8b46f87f8..b0663d1ad 100644 --- a/tests/Cluckwork.Api.IntegrationTests/OneShotVerbMinimalConfigTests.cs +++ b/tests/Cluckwork.Api.IntegrationTests/OneShotVerbMinimalConfigTests.cs @@ -1,10 +1,10 @@ -namespace Cluckwork.Api.IntegrationTests; - using System.Diagnostics; using System.Reflection; using Cluckwork.Api.Hosting; using Cluckwork.Api.IntegrationTests.Infrastructure; +namespace Cluckwork.Api.IntegrationTests; + // #347 — every one-shot verb must run under a Production environment containing // ONLY the configuration that verb genuinely needs. // diff --git a/tests/Cluckwork.Api.IntegrationTests/OtlpExporterTests.cs b/tests/Cluckwork.Api.IntegrationTests/OtlpExporterTests.cs index bf4164334..0a637a104 100644 --- a/tests/Cluckwork.Api.IntegrationTests/OtlpExporterTests.cs +++ b/tests/Cluckwork.Api.IntegrationTests/OtlpExporterTests.cs @@ -1,5 +1,3 @@ -namespace Cluckwork.Api.IntegrationTests; - using Cluckwork.Api.Configuration; using Cluckwork.Api.Hosting; using Cluckwork.Api.IntegrationTests.Infrastructure; @@ -7,6 +5,8 @@ namespace Cluckwork.Api.IntegrationTests; using Microsoft.Extensions.Configuration; using OpenTelemetry.Exporter; +namespace Cluckwork.Api.IntegrationTests; + public sealed class OtlpConfigurationResolverTests { [Theory] diff --git a/tests/Cluckwork.Api.IntegrationTests/OtlpSecureEndpointGuardTests.cs b/tests/Cluckwork.Api.IntegrationTests/OtlpSecureEndpointGuardTests.cs index 388a9a9ef..e66eba7ba 100644 --- a/tests/Cluckwork.Api.IntegrationTests/OtlpSecureEndpointGuardTests.cs +++ b/tests/Cluckwork.Api.IntegrationTests/OtlpSecureEndpointGuardTests.cs @@ -1,8 +1,8 @@ -namespace Cluckwork.Api.IntegrationTests; - using Cluckwork.Api.IntegrationTests.Infrastructure; using Microsoft.AspNetCore.Hosting; +namespace Cluckwork.Api.IntegrationTests; + // This factory deliberately remains on the canonical disabled profile inherited // from CluckworkWebApplicationFactory. Every case below fails during telemetry // registration, before an enabled exporter host can be created. Enabled boot and diff --git a/tests/Cluckwork.Api.IntegrationTests/OtlpSubprocessExporterTests.cs b/tests/Cluckwork.Api.IntegrationTests/OtlpSubprocessExporterTests.cs index 893c61518..d4b3a3ac5 100644 --- a/tests/Cluckwork.Api.IntegrationTests/OtlpSubprocessExporterTests.cs +++ b/tests/Cluckwork.Api.IntegrationTests/OtlpSubprocessExporterTests.cs @@ -1,5 +1,3 @@ -namespace Cluckwork.Api.IntegrationTests; - using System.Diagnostics; using System.Net; using System.Net.Http.Json; @@ -7,6 +5,8 @@ namespace Cluckwork.Api.IntegrationTests; using Cluckwork.Api.Hosting; using Cluckwork.Api.IntegrationTests.Infrastructure; +namespace Cluckwork.Api.IntegrationTests; + // The OTel SDK reads standard OTLP variables when its exporter options object is // constructed. These cases run each exporter in a real child process so an // ambient process variable cannot leak between xUnit tests or factories. diff --git a/tests/Cluckwork.Api.IntegrationTests/PaymentsTests.cs b/tests/Cluckwork.Api.IntegrationTests/PaymentsTests.cs index 5e8a03edc..801295e03 100644 --- a/tests/Cluckwork.Api.IntegrationTests/PaymentsTests.cs +++ b/tests/Cluckwork.Api.IntegrationTests/PaymentsTests.cs @@ -1,8 +1,8 @@ -namespace Cluckwork.Api.IntegrationTests; - using System.Net; using Cluckwork.Api.IntegrationTests.Infrastructure; +namespace Cluckwork.Api.IntegrationTests; + // #89 — customer payments: order-attached, currency copied from the order, // no-overpay under the order row lock, void-not-delete, and the order-void // guard ("void the payments first"). diff --git a/tests/Cluckwork.Api.IntegrationTests/PostgresConnectionStringTests.cs b/tests/Cluckwork.Api.IntegrationTests/PostgresConnectionStringTests.cs index f419bf70a..ecb720ee2 100644 --- a/tests/Cluckwork.Api.IntegrationTests/PostgresConnectionStringTests.cs +++ b/tests/Cluckwork.Api.IntegrationTests/PostgresConnectionStringTests.cs @@ -1,10 +1,10 @@ -namespace Cluckwork.Api.IntegrationTests; - using Cluckwork.Infrastructure.Providers; using Cluckwork.Infrastructure.Providers.Postgres; using Microsoft.EntityFrameworkCore; using Npgsql; +namespace Cluckwork.Api.IntegrationTests; + // #261/#262 — pure unit coverage of the connection-string normalize+validate step // (no Docker). Mirrors TimeZoneAvailabilityTests: the LOGIC is proven here; the // integration suite proves it is WIRED into boot. NOT part of the "integration" diff --git a/tests/Cluckwork.Api.IntegrationTests/PostgresLeaderLeaseTests.cs b/tests/Cluckwork.Api.IntegrationTests/PostgresLeaderLeaseTests.cs index ec431b74f..bd91ebe4d 100644 --- a/tests/Cluckwork.Api.IntegrationTests/PostgresLeaderLeaseTests.cs +++ b/tests/Cluckwork.Api.IntegrationTests/PostgresLeaderLeaseTests.cs @@ -1,10 +1,10 @@ -namespace Cluckwork.Api.IntegrationTests; - using Cluckwork.Api.IntegrationTests.Infrastructure; using Cluckwork.Infrastructure.Jobs; using Microsoft.Extensions.Logging.Abstractions; using Npgsql; +namespace Cluckwork.Api.IntegrationTests; + // #271 — direct proof of the leader lease's contract: AT MOST ONE ACTIVE LEADER, // with crash recovery and transaction-pooling backend-affinity. Both competing // leases use this class's dedicated database. Advisory locks in other databases diff --git a/tests/Cluckwork.Api.IntegrationTests/ProcessRoleGuardTests.cs b/tests/Cluckwork.Api.IntegrationTests/ProcessRoleGuardTests.cs index 301606ca1..ed7e16f2a 100644 --- a/tests/Cluckwork.Api.IntegrationTests/ProcessRoleGuardTests.cs +++ b/tests/Cluckwork.Api.IntegrationTests/ProcessRoleGuardTests.cs @@ -1,9 +1,9 @@ -namespace Cluckwork.Api.IntegrationTests; - using System.Diagnostics; using Cluckwork.Api.Hosting; using Cluckwork.Api.IntegrationTests.Infrastructure; +namespace Cluckwork.Api.IntegrationTests; + // #347 — a SERVING-process boot guard must never abort a ONE-SHOT verb. // // This is the #331 shape, generalised. #331: the #316 OTLP endpoint validation diff --git a/tests/Cluckwork.Api.IntegrationTests/ProcessRoleRegistryTests.cs b/tests/Cluckwork.Api.IntegrationTests/ProcessRoleRegistryTests.cs index 7828aaa82..77d45a653 100644 --- a/tests/Cluckwork.Api.IntegrationTests/ProcessRoleRegistryTests.cs +++ b/tests/Cluckwork.Api.IntegrationTests/ProcessRoleRegistryTests.cs @@ -1,8 +1,8 @@ -namespace Cluckwork.Api.IntegrationTests; - using Cluckwork.Api.Cli; using Cluckwork.Api.Hosting; +namespace Cluckwork.Api.IntegrationTests; + // #347 — the verb registry ProcessRoles.From reads. Fast, no host, no container. // // This suite is NOT the guarantee: proving that a serving-only guard leaves a diff --git a/tests/Cluckwork.Api.IntegrationTests/ProductAuditPayloadTests.cs b/tests/Cluckwork.Api.IntegrationTests/ProductAuditPayloadTests.cs index 69dee1a9c..c70280380 100644 --- a/tests/Cluckwork.Api.IntegrationTests/ProductAuditPayloadTests.cs +++ b/tests/Cluckwork.Api.IntegrationTests/ProductAuditPayloadTests.cs @@ -1,9 +1,9 @@ -namespace Cluckwork.Api.IntegrationTests; - using System.Net; using System.Text.Json; using Cluckwork.Api.IntegrationTests.Infrastructure; +namespace Cluckwork.Api.IntegrationTests; + // #746 — CreateProductHandler and UpdateProductHandler stored ProductType and // DefaultUnit as bare enums in their audit payloads. AuditWriter serialises // `details` with no JsonStringEnumConverter, so a bare enum stores as its diff --git a/tests/Cluckwork.Api.IntegrationTests/ProductionLogFormatTests.cs b/tests/Cluckwork.Api.IntegrationTests/ProductionLogFormatTests.cs index 5ab01703c..2eaaae9f6 100644 --- a/tests/Cluckwork.Api.IntegrationTests/ProductionLogFormatTests.cs +++ b/tests/Cluckwork.Api.IntegrationTests/ProductionLogFormatTests.cs @@ -1,5 +1,3 @@ -namespace Cluckwork.Api.IntegrationTests; - using System.Diagnostics; using System.Reflection; using System.Text.Json; @@ -9,6 +7,8 @@ namespace Cluckwork.Api.IntegrationTests; using Serilog.Formatting; using Serilog.Parsing; +namespace Cluckwork.Api.IntegrationTests; + // #404 — Production emits compact JSON to stdout so a log collector can index // structured fields instead of grepping prose. Development keeps the human // template. diff --git a/tests/Cluckwork.Api.IntegrationTests/ProvisionAccountCommandTests.cs b/tests/Cluckwork.Api.IntegrationTests/ProvisionAccountCommandTests.cs index 6588bc824..bd8f8ba39 100644 --- a/tests/Cluckwork.Api.IntegrationTests/ProvisionAccountCommandTests.cs +++ b/tests/Cluckwork.Api.IntegrationTests/ProvisionAccountCommandTests.cs @@ -1,5 +1,3 @@ -namespace Cluckwork.Api.IntegrationTests; - using System.Diagnostics; using System.Net; using Cluckwork.Api.IntegrationTests.Infrastructure; @@ -7,6 +5,8 @@ namespace Cluckwork.Api.IntegrationTests; using Microsoft.EntityFrameworkCore; using Microsoft.Extensions.DependencyInjection; +namespace Cluckwork.Api.IntegrationTests; + [Collection(IntegrationCollection.Name)] public sealed class ProvisionAccountCommandTests(CluckworkWebApplicationFactory factory) { diff --git a/tests/Cluckwork.Api.IntegrationTests/QualityEggTests.cs b/tests/Cluckwork.Api.IntegrationTests/QualityEggTests.cs index a9e3d6f59..f0f4a4406 100644 --- a/tests/Cluckwork.Api.IntegrationTests/QualityEggTests.cs +++ b/tests/Cluckwork.Api.IntegrationTests/QualityEggTests.cs @@ -1,10 +1,10 @@ -namespace Cluckwork.Api.IntegrationTests; - using System.Net; using Cluckwork.Api.IntegrationTests.Infrastructure; using Cluckwork.Domain.Eggs; using Microsoft.EntityFrameworkCore; +namespace Cluckwork.Api.IntegrationTests; + // #396 — Cracked and Dirty become saleable stock through their own counters. // // The rule these tests exist to hold: a condition grade is fed by its COUNTER diff --git a/tests/Cluckwork.Api.IntegrationTests/RateLimitKeyTests.cs b/tests/Cluckwork.Api.IntegrationTests/RateLimitKeyTests.cs index 75ee2cdd3..be1faac72 100644 --- a/tests/Cluckwork.Api.IntegrationTests/RateLimitKeyTests.cs +++ b/tests/Cluckwork.Api.IntegrationTests/RateLimitKeyTests.cs @@ -1,8 +1,8 @@ -namespace Cluckwork.Api.IntegrationTests; - using System.Net; using Cluckwork.Infrastructure.RateLimiting; +namespace Cluckwork.Api.IntegrationTests; + // Unit tests for the rate-limit partition-key derivation (#143). The IP is // resolved upstream by the framework ForwardedHeaders middleware; this only // fixes the bucket granularity, and the security-relevant case is that an IPv6 diff --git a/tests/Cluckwork.Api.IntegrationTests/RateLimitingOptionsTests.cs b/tests/Cluckwork.Api.IntegrationTests/RateLimitingOptionsTests.cs index 819c0a0ec..4d24234cd 100644 --- a/tests/Cluckwork.Api.IntegrationTests/RateLimitingOptionsTests.cs +++ b/tests/Cluckwork.Api.IntegrationTests/RateLimitingOptionsTests.cs @@ -1,7 +1,7 @@ -namespace Cluckwork.Api.IntegrationTests; - using Cluckwork.Api.RateLimiting; +namespace Cluckwork.Api.IntegrationTests; + // #143 — bad limiter config must fail at boot (Validate), not throw a 500 from // inside the partition factory on the first login request. public sealed class RateLimitingOptionsTests diff --git a/tests/Cluckwork.Api.IntegrationTests/RateLimitingTests.cs b/tests/Cluckwork.Api.IntegrationTests/RateLimitingTests.cs index b732d521e..f7c0eb499 100644 --- a/tests/Cluckwork.Api.IntegrationTests/RateLimitingTests.cs +++ b/tests/Cluckwork.Api.IntegrationTests/RateLimitingTests.cs @@ -1,5 +1,3 @@ -namespace Cluckwork.Api.IntegrationTests; - using System.Net; using Cluckwork.Api.Endpoints.Auth; using Cluckwork.Api.IntegrationTests.Infrastructure; @@ -9,6 +7,8 @@ namespace Cluckwork.Api.IntegrationTests; using Microsoft.AspNetCore.TestHost; using Microsoft.Extensions.DependencyInjection; +namespace Cluckwork.Api.IntegrationTests; + // #143 — the anonymous auth endpoints are rate limited per client IP, resolved // by the framework ForwardedHeaders middleware. The in-process TestServer has // no socket peer, so this factory injects one via a test header (X-Test-Remote) diff --git a/tests/Cluckwork.Api.IntegrationTests/ReadEndpointTests.cs b/tests/Cluckwork.Api.IntegrationTests/ReadEndpointTests.cs index 98aeacce2..60d5f7693 100644 --- a/tests/Cluckwork.Api.IntegrationTests/ReadEndpointTests.cs +++ b/tests/Cluckwork.Api.IntegrationTests/ReadEndpointTests.cs @@ -1,8 +1,8 @@ -namespace Cluckwork.Api.IntegrationTests; - using System.Net; using Cluckwork.Api.IntegrationTests.Infrastructure; +namespace Cluckwork.Api.IntegrationTests; + // #7 / #9 / #12 — the read tier: daily-entry get/list, stock by grade, sales // order get/list. All tenant-scoped via the global query filter. [Collection(IntegrationCollection.Name)] diff --git a/tests/Cluckwork.Api.IntegrationTests/RecoverAdminCommandTests.cs b/tests/Cluckwork.Api.IntegrationTests/RecoverAdminCommandTests.cs index a28bce4c0..1ff709275 100644 --- a/tests/Cluckwork.Api.IntegrationTests/RecoverAdminCommandTests.cs +++ b/tests/Cluckwork.Api.IntegrationTests/RecoverAdminCommandTests.cs @@ -1,7 +1,4 @@ -namespace Cluckwork.Api.IntegrationTests; - using Cluckwork.Domain.Accounts; - using System.Diagnostics; using Cluckwork.Api.IntegrationTests.Infrastructure; using Cluckwork.Application.Common; @@ -9,6 +6,8 @@ namespace Cluckwork.Api.IntegrationTests; using Microsoft.EntityFrameworkCore; using Microsoft.Extensions.DependencyInjection; +namespace Cluckwork.Api.IntegrationTests; + // #265 — the `recover-admin` break-glass command is a real CLI dispatch branch // in Program.cs (args[0] == "recover-admin"), never exercised by // WebApplicationFactory (which passes empty args). These spawn the actual built diff --git a/tests/Cluckwork.Api.IntegrationTests/RedactingLoggerPipelineTests.cs b/tests/Cluckwork.Api.IntegrationTests/RedactingLoggerPipelineTests.cs index 63e3df50a..a31d3c10a 100644 --- a/tests/Cluckwork.Api.IntegrationTests/RedactingLoggerPipelineTests.cs +++ b/tests/Cluckwork.Api.IntegrationTests/RedactingLoggerPipelineTests.cs @@ -1,5 +1,3 @@ -namespace Cluckwork.Api.IntegrationTests; - using System.Collections.Concurrent; using Cluckwork.Api.Logging; using Microsoft.Extensions.Configuration; @@ -8,6 +6,8 @@ namespace Cluckwork.Api.IntegrationTests; using Serilog.Core; using Serilog.Events; +namespace Cluckwork.Api.IntegrationTests; + // #273 codex review (round 2, P1b) — RedactingLoggerPipeline, exercised as the // real host builds it: a sink declared in `Serilog:WriteTo` (the app's own sink // contract — appsettings.json declares Console exactly this way) and a sink diff --git a/tests/Cluckwork.Api.IntegrationTests/RefreshAccountBindingTests.cs b/tests/Cluckwork.Api.IntegrationTests/RefreshAccountBindingTests.cs index 768a01f9b..2d0355065 100644 --- a/tests/Cluckwork.Api.IntegrationTests/RefreshAccountBindingTests.cs +++ b/tests/Cluckwork.Api.IntegrationTests/RefreshAccountBindingTests.cs @@ -1,5 +1,3 @@ -namespace Cluckwork.Api.IntegrationTests; - using System.Net; using System.Net.Http.Json; using System.Net.Http.Headers; @@ -9,6 +7,8 @@ namespace Cluckwork.Api.IntegrationTests; using Microsoft.EntityFrameworkCore; using Microsoft.Extensions.DependencyInjection; +namespace Cluckwork.Api.IntegrationTests; + // #547 (slice T4) — the refresh endpoint compares the tab's expected farm // (the X-Cluckwork-Account header) against the STORED token's AccountId before // anything rotates. Per-farm cookie names make a normal cross-farm selection diff --git a/tests/Cluckwork.Api.IntegrationTests/RefreshGraceClockRaceTests.cs b/tests/Cluckwork.Api.IntegrationTests/RefreshGraceClockRaceTests.cs index ea4c4c9e4..15de7d60c 100644 --- a/tests/Cluckwork.Api.IntegrationTests/RefreshGraceClockRaceTests.cs +++ b/tests/Cluckwork.Api.IntegrationTests/RefreshGraceClockRaceTests.cs @@ -1,5 +1,3 @@ -namespace Cluckwork.Api.IntegrationTests; - using System.Data.Common; using System.Net; using Cluckwork.Api.IntegrationTests.Infrastructure; @@ -11,6 +9,8 @@ namespace Cluckwork.Api.IntegrationTests; using Microsoft.EntityFrameworkCore.Diagnostics; using Microsoft.Extensions.DependencyInjection; +namespace Cluckwork.Api.IntegrationTests; + public sealed class RefreshGraceClockRaceFactory : CluckworkWebApplicationFactory { public RefreshReadBarrierInterceptor Barrier { get; } = new(); diff --git a/tests/Cluckwork.Api.IntegrationTests/RefreshTokenFlowTests.cs b/tests/Cluckwork.Api.IntegrationTests/RefreshTokenFlowTests.cs index 344ae59b6..bdb4c9bfa 100644 --- a/tests/Cluckwork.Api.IntegrationTests/RefreshTokenFlowTests.cs +++ b/tests/Cluckwork.Api.IntegrationTests/RefreshTokenFlowTests.cs @@ -1,5 +1,3 @@ -namespace Cluckwork.Api.IntegrationTests; - using System.Net; using Cluckwork.Api.Endpoints.Auth; using Cluckwork.Api.IntegrationTests.Infrastructure; @@ -8,6 +6,8 @@ namespace Cluckwork.Api.IntegrationTests; using Microsoft.AspNetCore.Mvc.Testing; using Microsoft.EntityFrameworkCore; +namespace Cluckwork.Api.IntegrationTests; + // tech spec §7.4: refresh tokens are durable and rotating. Refresh issues a new // pair, the old token is single-use, reuse is rejected, and logout revokes. // Since #145 the refresh token travels in an HttpOnly cookie, never the body. diff --git a/tests/Cluckwork.Api.IntegrationTests/RefreshTokenPurgeSweepTests.cs b/tests/Cluckwork.Api.IntegrationTests/RefreshTokenPurgeSweepTests.cs index 6d5d3cf81..e9460e364 100644 --- a/tests/Cluckwork.Api.IntegrationTests/RefreshTokenPurgeSweepTests.cs +++ b/tests/Cluckwork.Api.IntegrationTests/RefreshTokenPurgeSweepTests.cs @@ -1,5 +1,3 @@ -namespace Cluckwork.Api.IntegrationTests; - using System.Net; using Cluckwork.Api.IntegrationTests.Infrastructure; using Cluckwork.Infrastructure.Identity; @@ -9,6 +7,8 @@ namespace Cluckwork.Api.IntegrationTests; using Microsoft.EntityFrameworkCore; using Microsoft.Extensions.DependencyInjection; +namespace Cluckwork.Api.IntegrationTests; + // #270 — refresh_tokens grows without bound: every login/refresh inserts a row // and rotation keeps inserting, but nothing ever deletes an expired/revoked // row. RefreshTokenPurgeSweep (another DurableJobWorker sweep, modeled on diff --git a/tests/Cluckwork.Api.IntegrationTests/ReportConcurrencyCapContractTests.cs b/tests/Cluckwork.Api.IntegrationTests/ReportConcurrencyCapContractTests.cs index 2e6e79943..08486aed4 100644 --- a/tests/Cluckwork.Api.IntegrationTests/ReportConcurrencyCapContractTests.cs +++ b/tests/Cluckwork.Api.IntegrationTests/ReportConcurrencyCapContractTests.cs @@ -1,5 +1,3 @@ -namespace Cluckwork.Api.IntegrationTests; - using Cluckwork.Api.IntegrationTests.SharedState; using Cluckwork.Application.Common; using Cluckwork.Infrastructure.RateLimiting; @@ -8,6 +6,8 @@ namespace Cluckwork.Api.IntegrationTests; using Microsoft.Extensions.Logging.Abstractions; using StackExchange.Redis; +namespace Cluckwork.Api.IntegrationTests; + // #545 — the per-account report concurrency cap on the shared lease backends. // Deterministic (FakeTimeProvider drives the LEASE expiry clock; renewal is // driven directly via RenewOnce because the repo's FakeTimeProvider cannot fire diff --git a/tests/Cluckwork.Api.IntegrationTests/ReportQueryBoundingTests.cs b/tests/Cluckwork.Api.IntegrationTests/ReportQueryBoundingTests.cs index 83dc7d379..340fe0499 100644 --- a/tests/Cluckwork.Api.IntegrationTests/ReportQueryBoundingTests.cs +++ b/tests/Cluckwork.Api.IntegrationTests/ReportQueryBoundingTests.cs @@ -1,5 +1,3 @@ -namespace Cluckwork.Api.IntegrationTests; - using System.Data.Common; using Cluckwork.Api.IntegrationTests.Infrastructure; using Cluckwork.Domain.Flocks; @@ -8,6 +6,8 @@ namespace Cluckwork.Api.IntegrationTests; using Microsoft.EntityFrameworkCore; using Microsoft.EntityFrameworkCore.Diagnostics; +namespace Cluckwork.Api.IntegrationTests; + // #311 — GetProductionAsync's hen-day calculation used to load the account's // ENTIRE bird-movement ledger (db.BirdMovements.GroupBy(...).ToListAsync() // with no date filter) and walk it in memory; as farm history grows this cost diff --git a/tests/Cluckwork.Api.IntegrationTests/ReportsConcurrencyLimitTests.cs b/tests/Cluckwork.Api.IntegrationTests/ReportsConcurrencyLimitTests.cs index bb44916f7..0317bb7a7 100644 --- a/tests/Cluckwork.Api.IntegrationTests/ReportsConcurrencyLimitTests.cs +++ b/tests/Cluckwork.Api.IntegrationTests/ReportsConcurrencyLimitTests.cs @@ -1,5 +1,3 @@ -namespace Cluckwork.Api.IntegrationTests; - using System.Net; using Cluckwork.Api.IntegrationTests.Infrastructure; using Cluckwork.Application.Features.Reports; @@ -9,6 +7,8 @@ namespace Cluckwork.Api.IntegrationTests; using Microsoft.AspNetCore.TestHost; using Microsoft.Extensions.DependencyInjection; +namespace Cluckwork.Api.IntegrationTests; + // #311 — end-to-end proof that ReportConcurrencyLimitFilter is actually wired // onto the reports route group (ReportConcurrencyLimiterTests covers the // limiter's own acquire/reject/release logic in isolation). PermitLimit is diff --git a/tests/Cluckwork.Api.IntegrationTests/ReportsTests.cs b/tests/Cluckwork.Api.IntegrationTests/ReportsTests.cs index 920131e32..578fee592 100644 --- a/tests/Cluckwork.Api.IntegrationTests/ReportsTests.cs +++ b/tests/Cluckwork.Api.IntegrationTests/ReportsTests.cs @@ -1,9 +1,9 @@ -namespace Cluckwork.Api.IntegrationTests; - using System.Net; using Cluckwork.Api.IntegrationTests.Infrastructure; using Microsoft.EntityFrameworkCore; +namespace Cluckwork.Api.IntegrationTests; + // #91 — core reports: production math (hen-days from the bird ledger, official // entries only), money summaries, the role split, and range guards. [Collection(IntegrationCollection.Name)] diff --git a/tests/Cluckwork.Api.IntegrationTests/RequestLoggingTests.cs b/tests/Cluckwork.Api.IntegrationTests/RequestLoggingTests.cs index 06ec4a88b..4c9505b71 100644 --- a/tests/Cluckwork.Api.IntegrationTests/RequestLoggingTests.cs +++ b/tests/Cluckwork.Api.IntegrationTests/RequestLoggingTests.cs @@ -1,5 +1,3 @@ -namespace Cluckwork.Api.IntegrationTests; - using System.Collections.Concurrent; using System.Diagnostics; using Cluckwork.Api.IntegrationTests.Infrastructure; @@ -11,6 +9,8 @@ namespace Cluckwork.Api.IntegrationTests; using Serilog.Core; using Serilog.Events; +namespace Cluckwork.Api.IntegrationTests; + // #398 review (Codex) — a genuine unhandled fault for // Unhandled_exception_logs_one_completion_for_the_real_path_only below. That // test used to provoke malformed JSON at /api/v1/auth/login, but that request diff --git a/tests/Cluckwork.Api.IntegrationTests/ResponseCacheControlTests.cs b/tests/Cluckwork.Api.IntegrationTests/ResponseCacheControlTests.cs index 2224c6fd1..9c71accac 100644 --- a/tests/Cluckwork.Api.IntegrationTests/ResponseCacheControlTests.cs +++ b/tests/Cluckwork.Api.IntegrationTests/ResponseCacheControlTests.cs @@ -1,9 +1,9 @@ -namespace Cluckwork.Api.IntegrationTests; - using System.Net; using System.Net.Http.Headers; using Cluckwork.Api.IntegrationTests.Infrastructure; +namespace Cluckwork.Api.IntegrationTests; + // #312 — origin-side safe cache default. The app previously emitted no // Cache-Control on API responses, so a browser cache, a misconfigured // intermediary, or a future edge rule could retain tenant data. These tests diff --git a/tests/Cluckwork.Api.IntegrationTests/RetryBoundaryTests.cs b/tests/Cluckwork.Api.IntegrationTests/RetryBoundaryTests.cs index d89c3e7c4..0275efb97 100644 --- a/tests/Cluckwork.Api.IntegrationTests/RetryBoundaryTests.cs +++ b/tests/Cluckwork.Api.IntegrationTests/RetryBoundaryTests.cs @@ -1,5 +1,3 @@ -namespace Cluckwork.Api.IntegrationTests; - using System.Net; using Cluckwork.Api.IntegrationTests.Infrastructure; using Cluckwork.Application.Common; @@ -13,6 +11,8 @@ namespace Cluckwork.Api.IntegrationTests; using Microsoft.Extensions.DependencyInjection; using Npgsql; +namespace Cluckwork.Api.IntegrationTests; + // #269 review (codex findings on PR #350) — where the retry boundary is drawn. // // EnableRetryOnFailure makes EF replay a failed unit of work. That is only diff --git a/tests/Cluckwork.Api.IntegrationTests/RoleMatrixTests.cs b/tests/Cluckwork.Api.IntegrationTests/RoleMatrixTests.cs index 804e417b4..93fe8e5a5 100644 --- a/tests/Cluckwork.Api.IntegrationTests/RoleMatrixTests.cs +++ b/tests/Cluckwork.Api.IntegrationTests/RoleMatrixTests.cs @@ -1,11 +1,11 @@ -namespace Cluckwork.Api.IntegrationTests; - using System.Net; using System.Text.Json; using Cluckwork.Api.Endpoints.Auth; using Cluckwork.Api.IntegrationTests.Infrastructure; using Cluckwork.Domain.Accounts; +namespace Cluckwork.Api.IntegrationTests; + // #103 — the role → capability matrix (spec §5.1/§5.3) and worker flock // scoping. The SPA hides controls; these tests prove the API refuses anyway. [Collection(IntegrationCollection.Name)] diff --git a/tests/Cluckwork.Api.IntegrationTests/SaleAllocationPolicyTests.cs b/tests/Cluckwork.Api.IntegrationTests/SaleAllocationPolicyTests.cs index 511e1fbde..8f3acdd11 100644 --- a/tests/Cluckwork.Api.IntegrationTests/SaleAllocationPolicyTests.cs +++ b/tests/Cluckwork.Api.IntegrationTests/SaleAllocationPolicyTests.cs @@ -1,5 +1,3 @@ -namespace Cluckwork.Api.IntegrationTests; - using System.Net; using System.Net.Http.Json; using Cluckwork.Api.Endpoints.Auth; @@ -14,6 +12,8 @@ namespace Cluckwork.Api.IntegrationTests; using Microsoft.EntityFrameworkCore; using Microsoft.Extensions.DependencyInjection; +namespace Cluckwork.Api.IntegrationTests; + // #612 — the confirmation-time policy application: whole-order planning tries // a restricted plain Worker's assigned flocks first under AssignedFlocksOnly, // falls back to the SAME locked farm-wide rows, and picks between the two diff --git a/tests/Cluckwork.Api.IntegrationTests/SalesDiscountCeilingTests.cs b/tests/Cluckwork.Api.IntegrationTests/SalesDiscountCeilingTests.cs index 0f90cdf3a..953b07aa7 100644 --- a/tests/Cluckwork.Api.IntegrationTests/SalesDiscountCeilingTests.cs +++ b/tests/Cluckwork.Api.IntegrationTests/SalesDiscountCeilingTests.cs @@ -1,5 +1,3 @@ -namespace Cluckwork.Api.IntegrationTests; - using System.Net; using System.Net.Http.Json; using Cluckwork.Api.IntegrationTests.Infrastructure; @@ -7,6 +5,8 @@ namespace Cluckwork.Api.IntegrationTests; using Cluckwork.Infrastructure.Persistence; using Microsoft.EntityFrameworkCore; +namespace Cluckwork.Api.IntegrationTests; + // #727 — the per-farm discount ceiling at confirm time. Sales and Worker are // bound by it; Owner and Manager are not. The refusal is a 422 and the order // stays Draft, so the seller can take it to a manager rather than retrying diff --git a/tests/Cluckwork.Api.IntegrationTests/SalesDiscountReasonTests.cs b/tests/Cluckwork.Api.IntegrationTests/SalesDiscountReasonTests.cs index 51530c278..95b64f11f 100644 --- a/tests/Cluckwork.Api.IntegrationTests/SalesDiscountReasonTests.cs +++ b/tests/Cluckwork.Api.IntegrationTests/SalesDiscountReasonTests.cs @@ -1,9 +1,9 @@ -namespace Cluckwork.Api.IntegrationTests; - using System.Net; using Cluckwork.Api.IntegrationTests.Infrastructure; using Microsoft.EntityFrameworkCore; +namespace Cluckwork.Api.IntegrationTests; + // #721 — a discount reason is required at confirm, and only when a line is // priced strictly below the list price snapshotted onto it when it was added. [Collection(IntegrationCollection.Name)] diff --git a/tests/Cluckwork.Api.IntegrationTests/SalesOrderAuditPayloadTests.cs b/tests/Cluckwork.Api.IntegrationTests/SalesOrderAuditPayloadTests.cs index 7a8de4695..c261479a2 100644 --- a/tests/Cluckwork.Api.IntegrationTests/SalesOrderAuditPayloadTests.cs +++ b/tests/Cluckwork.Api.IntegrationTests/SalesOrderAuditPayloadTests.cs @@ -1,5 +1,3 @@ -namespace Cluckwork.Api.IntegrationTests; - using System.Net; using System.Text.Json; using Cluckwork.Api.IntegrationTests.Infrastructure; @@ -8,6 +6,8 @@ namespace Cluckwork.Api.IntegrationTests; using Microsoft.EntityFrameworkCore; using Microsoft.Extensions.DependencyInjection; +namespace Cluckwork.Api.IntegrationTests; + // #722 — the sales-line audit events carry the PRICES, so a discount given in // the past is reconstructible from stored data. #720 put // ListUnitPriceMinorUnits and ListPriceBasis on the line itself; this pins what diff --git a/tests/Cluckwork.Api.IntegrationTests/SalesOrderListQueryTests.cs b/tests/Cluckwork.Api.IntegrationTests/SalesOrderListQueryTests.cs index 57498a997..192da49fd 100644 --- a/tests/Cluckwork.Api.IntegrationTests/SalesOrderListQueryTests.cs +++ b/tests/Cluckwork.Api.IntegrationTests/SalesOrderListQueryTests.cs @@ -1,5 +1,3 @@ -namespace Cluckwork.Api.IntegrationTests; - using System.Text.RegularExpressions; using Cluckwork.Application.Features.Sales; using Cluckwork.Domain.Sales; @@ -7,6 +5,8 @@ namespace Cluckwork.Api.IntegrationTests; using Cluckwork.Infrastructure.Repositories; using Microsoft.EntityFrameworkCore; +namespace Cluckwork.Api.IntegrationTests; + // #769 — the SQL the orders list emits, read directly. Model-only, no database // (AccountIdConcurrencyTokenModelTests precedent): what is pinned here is the // SHAPE of the query, and the behaviour that shape buys is proved separately by diff --git a/tests/Cluckwork.Api.IntegrationTests/SalesProductTests.cs b/tests/Cluckwork.Api.IntegrationTests/SalesProductTests.cs index 10d089133..cd880d907 100644 --- a/tests/Cluckwork.Api.IntegrationTests/SalesProductTests.cs +++ b/tests/Cluckwork.Api.IntegrationTests/SalesProductTests.cs @@ -1,9 +1,9 @@ -namespace Cluckwork.Api.IntegrationTests; - using System.Net; using Cluckwork.Api.IntegrationTests.Infrastructure; using Microsoft.EntityFrameworkCore; +namespace Cluckwork.Api.IntegrationTests; + // #99 — sales lines sell products in packed units. The line snapshots the // grade mapping and the eggs-per-unit factor at creation; allocation runs on // quantity_base (individual eggs). diff --git a/tests/Cluckwork.Api.IntegrationTests/SchemaDocsTests.cs b/tests/Cluckwork.Api.IntegrationTests/SchemaDocsTests.cs index 266a0a906..09cff64ef 100644 --- a/tests/Cluckwork.Api.IntegrationTests/SchemaDocsTests.cs +++ b/tests/Cluckwork.Api.IntegrationTests/SchemaDocsTests.cs @@ -1,5 +1,3 @@ -namespace Cluckwork.Api.IntegrationTests; - using Cluckwork.Api.IntegrationTests.Infrastructure; using System.Diagnostics; using System.Text; @@ -10,6 +8,8 @@ namespace Cluckwork.Api.IntegrationTests; using Cluckwork.Infrastructure.Providers.Postgres; using Microsoft.EntityFrameworkCore; +namespace Cluckwork.Api.IntegrationTests; + // #417 — guards for the generated schema documentation under docs/schema/ // (produced by tools/schema-docs/generate.sh via tbls against an ephemeral // migrated Postgres). The CI byte-diff (`generate.sh --check`) proves the diff --git a/tests/Cluckwork.Api.IntegrationTests/SecretCliLoggingGuardTests.cs b/tests/Cluckwork.Api.IntegrationTests/SecretCliLoggingGuardTests.cs index 65d45d04d..bce13dcf1 100644 --- a/tests/Cluckwork.Api.IntegrationTests/SecretCliLoggingGuardTests.cs +++ b/tests/Cluckwork.Api.IntegrationTests/SecretCliLoggingGuardTests.cs @@ -1,7 +1,7 @@ -namespace Cluckwork.Api.IntegrationTests; - using System.Text.RegularExpressions; +namespace Cluckwork.Api.IntegrationTests; + // #273 codex review (round 5) — BootstrapAdminCommandTests and // RecoverAdminCommandTests prove the "never the logger" invariant by scanning // the SUBPROCESS'S OWN captured stdout for the generated password. Once #349's diff --git a/tests/Cluckwork.Api.IntegrationTests/SecurityEventLoggingTests.cs b/tests/Cluckwork.Api.IntegrationTests/SecurityEventLoggingTests.cs index 7364b24bb..d3978f0b5 100644 --- a/tests/Cluckwork.Api.IntegrationTests/SecurityEventLoggingTests.cs +++ b/tests/Cluckwork.Api.IntegrationTests/SecurityEventLoggingTests.cs @@ -1,5 +1,3 @@ -namespace Cluckwork.Api.IntegrationTests; - using System.Collections.Concurrent; using System.Data.Common; using System.Net; @@ -19,6 +17,8 @@ namespace Cluckwork.Api.IntegrationTests; using Serilog.Core; using Serilog.Events; +namespace Cluckwork.Api.IntegrationTests; + // #273 — the five stable structured security events the amendment to #273 // requires: failed login, account lockout, refresh-token replay detection, // refresh revocation failure, and (in AuthRateLimitLoggingTests.cs) auth diff --git a/tests/Cluckwork.Api.IntegrationTests/SecurityHeadersTests.cs b/tests/Cluckwork.Api.IntegrationTests/SecurityHeadersTests.cs index 9a8a94a8d..6489b0881 100644 --- a/tests/Cluckwork.Api.IntegrationTests/SecurityHeadersTests.cs +++ b/tests/Cluckwork.Api.IntegrationTests/SecurityHeadersTests.cs @@ -1,5 +1,3 @@ -namespace Cluckwork.Api.IntegrationTests; - using System.Collections.Generic; using System.Net; using System.Text.RegularExpressions; @@ -13,6 +11,8 @@ namespace Cluckwork.Api.IntegrationTests; using Microsoft.Extensions.Configuration; using Microsoft.Extensions.DependencyInjection; +namespace Cluckwork.Api.IntegrationTests; + // #144 — every response carries the static security headers (CSP, nosniff, // Referrer-Policy, frame protection), regardless of role, auth, or whether the // route even exists. Uses the shared collection factory (no special config). diff --git a/tests/Cluckwork.Api.IntegrationTests/SeedAndFlockTests.cs b/tests/Cluckwork.Api.IntegrationTests/SeedAndFlockTests.cs index 1e50b42ee..dea72f7cb 100644 --- a/tests/Cluckwork.Api.IntegrationTests/SeedAndFlockTests.cs +++ b/tests/Cluckwork.Api.IntegrationTests/SeedAndFlockTests.cs @@ -1,9 +1,9 @@ -namespace Cluckwork.Api.IntegrationTests; - using System.Net; using Cluckwork.Api.IntegrationTests.Infrastructure; using Cluckwork.Domain.Accounts; +namespace Cluckwork.Api.IntegrationTests; + // #5: the app is usable end-to-end, and flock CRUD is the first setup // surface. Covers a provisioned-admin login + create/list/get/deplete. [Collection(IntegrationCollection.Name)] diff --git a/tests/Cluckwork.Api.IntegrationTests/SeedCommandTests.cs b/tests/Cluckwork.Api.IntegrationTests/SeedCommandTests.cs index d5a09335a..d5dfc5751 100644 --- a/tests/Cluckwork.Api.IntegrationTests/SeedCommandTests.cs +++ b/tests/Cluckwork.Api.IntegrationTests/SeedCommandTests.cs @@ -1,5 +1,3 @@ -namespace Cluckwork.Api.IntegrationTests; - using System.Diagnostics; using Cluckwork.Api.IntegrationTests.Infrastructure; using Cluckwork.Domain.Accounts; @@ -7,6 +5,8 @@ namespace Cluckwork.Api.IntegrationTests; using Microsoft.EntityFrameworkCore; using Microsoft.Extensions.DependencyInjection; +namespace Cluckwork.Api.IntegrationTests; + // #280 — `dotnet Cluckwork.Api.dll seed --profile demo` is a real CLI dispatch // branch in Program.cs (args[0] == "seed"), never exercised by // WebApplicationFactory — the testing host always passes empty args, diff --git a/tests/Cluckwork.Api.IntegrationTests/ServingGuardCoverageTests.cs b/tests/Cluckwork.Api.IntegrationTests/ServingGuardCoverageTests.cs index 1daf755f2..c0571756e 100644 --- a/tests/Cluckwork.Api.IntegrationTests/ServingGuardCoverageTests.cs +++ b/tests/Cluckwork.Api.IntegrationTests/ServingGuardCoverageTests.cs @@ -1,5 +1,3 @@ -namespace Cluckwork.Api.IntegrationTests; - using System.Reflection; using System.Text.RegularExpressions; using Cluckwork.Api.Hosting; @@ -8,6 +6,8 @@ namespace Cluckwork.Api.IntegrationTests; using Microsoft.Extensions.DependencyInjection; using Microsoft.Extensions.Options; +namespace Cluckwork.Api.IntegrationTests; + // #347 review round 3 — makes ProcessRoleGuardTests' table track the source. // // That suite derives one arm per serving-only boot guard, which is only as good diff --git a/tests/Cluckwork.Api.IntegrationTests/ShapeProbe.cs b/tests/Cluckwork.Api.IntegrationTests/ShapeProbe.cs index e0fd90e9f..d0bfca327 100644 --- a/tests/Cluckwork.Api.IntegrationTests/ShapeProbe.cs +++ b/tests/Cluckwork.Api.IntegrationTests/ShapeProbe.cs @@ -1,8 +1,8 @@ -namespace Cluckwork.Api.IntegrationTests; - using System.Data.Common; using Microsoft.EntityFrameworkCore.Diagnostics; +namespace Cluckwork.Api.IntegrationTests; + // #512 US4 — the instrument behind the query-shape guards: a DbCommandInterceptor // that COUNTS the SQL the production reads already carry, and does nothing else. // diff --git a/tests/Cluckwork.Api.IntegrationTests/SharedState/ClaimOnceContractTests.cs b/tests/Cluckwork.Api.IntegrationTests/SharedState/ClaimOnceContractTests.cs index 07815c537..7ae3bbdea 100644 --- a/tests/Cluckwork.Api.IntegrationTests/SharedState/ClaimOnceContractTests.cs +++ b/tests/Cluckwork.Api.IntegrationTests/SharedState/ClaimOnceContractTests.cs @@ -1,7 +1,7 @@ -namespace Cluckwork.Api.IntegrationTests.SharedState; - using Cluckwork.Infrastructure.SharedState; +namespace Cluckwork.Api.IntegrationTests.SharedState; + // #543 — contract: single-use claim with TTL. // // Implementation-under-test: the in-process fallback via a single swappable diff --git a/tests/Cluckwork.Api.IntegrationTests/SharedState/FixedWindowCounterContractTests.cs b/tests/Cluckwork.Api.IntegrationTests/SharedState/FixedWindowCounterContractTests.cs index 168d0886e..3974e3154 100644 --- a/tests/Cluckwork.Api.IntegrationTests/SharedState/FixedWindowCounterContractTests.cs +++ b/tests/Cluckwork.Api.IntegrationTests/SharedState/FixedWindowCounterContractTests.cs @@ -1,7 +1,7 @@ -namespace Cluckwork.Api.IntegrationTests.SharedState; - using Cluckwork.Infrastructure.SharedState; +namespace Cluckwork.Api.IntegrationTests.SharedState; + // #543 — contract: atomic increment within a fixed time window. // // Implementation-under-test: the in-process fallback via a single swappable diff --git a/tests/Cluckwork.Api.IntegrationTests/SharedState/LeaseContractTests.cs b/tests/Cluckwork.Api.IntegrationTests/SharedState/LeaseContractTests.cs index 85df6fab8..8319e9f0a 100644 --- a/tests/Cluckwork.Api.IntegrationTests/SharedState/LeaseContractTests.cs +++ b/tests/Cluckwork.Api.IntegrationTests/SharedState/LeaseContractTests.cs @@ -1,7 +1,7 @@ -namespace Cluckwork.Api.IntegrationTests.SharedState; - using Cluckwork.Infrastructure.SharedState; +namespace Cluckwork.Api.IntegrationTests.SharedState; + // #543 — contract: owned, renewable lease with compare-and-delete release. // // Implementation-under-test: the in-process fallback via a single swappable diff --git a/tests/Cluckwork.Api.IntegrationTests/SharedState/RedisCapabilityIsolationTests.cs b/tests/Cluckwork.Api.IntegrationTests/SharedState/RedisCapabilityIsolationTests.cs index 46b914a7d..ecf296610 100644 --- a/tests/Cluckwork.Api.IntegrationTests/SharedState/RedisCapabilityIsolationTests.cs +++ b/tests/Cluckwork.Api.IntegrationTests/SharedState/RedisCapabilityIsolationTests.cs @@ -1,7 +1,7 @@ -namespace Cluckwork.Api.IntegrationTests.SharedState; - using Cluckwork.Infrastructure.SharedState; +namespace Cluckwork.Api.IntegrationTests.SharedState; + // #543 — claim-once and lease must NOT collide when a caller uses the same // logical key and namespace for both. Before the per-capability infix // ("claim:" / "lease:"), both wrote "{ns}:{key}", so a live lease blocked a diff --git a/tests/Cluckwork.Api.IntegrationTests/SharedState/RedisClaimOnceContractTests.cs b/tests/Cluckwork.Api.IntegrationTests/SharedState/RedisClaimOnceContractTests.cs index 9632a893c..67a501090 100644 --- a/tests/Cluckwork.Api.IntegrationTests/SharedState/RedisClaimOnceContractTests.cs +++ b/tests/Cluckwork.Api.IntegrationTests/SharedState/RedisClaimOnceContractTests.cs @@ -1,7 +1,7 @@ -namespace Cluckwork.Api.IntegrationTests.SharedState; - using Cluckwork.Infrastructure.SharedState; +namespace Cluckwork.Api.IntegrationTests.SharedState; + // #543 — Redis contract: single-use claim with TTL, against a REAL Redis // (Testcontainers) with REAL short TTLs. The impls honour Redis's server // clock, so expiry is observed with a real wait, not a fake clock. diff --git a/tests/Cluckwork.Api.IntegrationTests/SharedState/RedisFixedWindowCounterContractTests.cs b/tests/Cluckwork.Api.IntegrationTests/SharedState/RedisFixedWindowCounterContractTests.cs index ebe3df8ef..c3802658e 100644 --- a/tests/Cluckwork.Api.IntegrationTests/SharedState/RedisFixedWindowCounterContractTests.cs +++ b/tests/Cluckwork.Api.IntegrationTests/SharedState/RedisFixedWindowCounterContractTests.cs @@ -1,7 +1,7 @@ -namespace Cluckwork.Api.IntegrationTests.SharedState; - using Cluckwork.Infrastructure.SharedState; +namespace Cluckwork.Api.IntegrationTests.SharedState; + // #543 — Redis contract: fixed-window counter, against a REAL Redis // (Testcontainers) with a REAL short window. The window is bucketed on // Redis's OWN clock (TIME inside the script), so the rollover is observed diff --git a/tests/Cluckwork.Api.IntegrationTests/SharedState/RedisFixture.cs b/tests/Cluckwork.Api.IntegrationTests/SharedState/RedisFixture.cs index c8dd51434..141ffcf0b 100644 --- a/tests/Cluckwork.Api.IntegrationTests/SharedState/RedisFixture.cs +++ b/tests/Cluckwork.Api.IntegrationTests/SharedState/RedisFixture.cs @@ -1,7 +1,7 @@ -namespace Cluckwork.Api.IntegrationTests.SharedState; - using Testcontainers.Redis; +namespace Cluckwork.Api.IntegrationTests.SharedState; + // #543 — real Redis (Testcontainers) for the shared-state contract suites. // // The Redis impls honour REDIS's server clock, not the injected diff --git a/tests/Cluckwork.Api.IntegrationTests/SharedState/RedisLeaseContractTests.cs b/tests/Cluckwork.Api.IntegrationTests/SharedState/RedisLeaseContractTests.cs index 0d328e787..f30318ee4 100644 --- a/tests/Cluckwork.Api.IntegrationTests/SharedState/RedisLeaseContractTests.cs +++ b/tests/Cluckwork.Api.IntegrationTests/SharedState/RedisLeaseContractTests.cs @@ -1,7 +1,7 @@ -namespace Cluckwork.Api.IntegrationTests.SharedState; - using Cluckwork.Infrastructure.SharedState; +namespace Cluckwork.Api.IntegrationTests.SharedState; + // #543 — Redis contract: owned, renewable lease with compare-and-delete // release, against a REAL Redis (Testcontainers) with REAL short TTLs. public sealed class RedisLeaseContractTests(RedisFixture fixture) : IClassFixture diff --git a/tests/Cluckwork.Api.IntegrationTests/SharedState/RedisReportConcurrencyCapContractTests.cs b/tests/Cluckwork.Api.IntegrationTests/SharedState/RedisReportConcurrencyCapContractTests.cs index 4bb78c4da..bd40b8d33 100644 --- a/tests/Cluckwork.Api.IntegrationTests/SharedState/RedisReportConcurrencyCapContractTests.cs +++ b/tests/Cluckwork.Api.IntegrationTests/SharedState/RedisReportConcurrencyCapContractTests.cs @@ -1,9 +1,9 @@ -namespace Cluckwork.Api.IntegrationTests.SharedState; - using Cluckwork.Infrastructure.RateLimiting; using Cluckwork.Infrastructure.SharedState; using Microsoft.Extensions.Logging.Abstractions; +namespace Cluckwork.Api.IntegrationTests.SharedState; + // #545 — the two-instance guarantee against a REAL shared store (Testcontainers // Redis, mirrors RedisLeaseContractTests): two limiter instances sharing one // Redis enforce ONE combined per-account permit count, not two. The diff --git a/tests/Cluckwork.Api.IntegrationTests/SharedState/ResilientFallbackTests.cs b/tests/Cluckwork.Api.IntegrationTests/SharedState/ResilientFallbackTests.cs index 20e7d2694..3de823272 100644 --- a/tests/Cluckwork.Api.IntegrationTests/SharedState/ResilientFallbackTests.cs +++ b/tests/Cluckwork.Api.IntegrationTests/SharedState/ResilientFallbackTests.cs @@ -1,11 +1,11 @@ -namespace Cluckwork.Api.IntegrationTests.SharedState; - using System.Threading.Tasks; using Cluckwork.Application.Common; using Cluckwork.Infrastructure.SharedState; using Microsoft.Extensions.Logging; using StackExchange.Redis; +namespace Cluckwork.Api.IntegrationTests.SharedState; + // #543 — the resilient decorators' fallback POLICY, unit-tested against // hand-written stubs (no Redis, no Docker, no fake clock): // diff --git a/tests/Cluckwork.Api.IntegrationTests/SharedState/SharedStateNamespaceWiringTests.cs b/tests/Cluckwork.Api.IntegrationTests/SharedState/SharedStateNamespaceWiringTests.cs index ffe8898f7..ee599de64 100644 --- a/tests/Cluckwork.Api.IntegrationTests/SharedState/SharedStateNamespaceWiringTests.cs +++ b/tests/Cluckwork.Api.IntegrationTests/SharedState/SharedStateNamespaceWiringTests.cs @@ -1,11 +1,11 @@ -namespace Cluckwork.Api.IntegrationTests.SharedState; - using Cluckwork.Api.IntegrationTests.Infrastructure; using Cluckwork.Infrastructure.RateLimiting; using Cluckwork.Infrastructure.SharedState; using Microsoft.AspNetCore.Hosting; using Microsoft.Extensions.DependencyInjection; +namespace Cluckwork.Api.IntegrationTests.SharedState; + // #545 — Program must use the same bound SharedStateOptions namespace for both // the auth counter and report cap. Each backing store has its own key shape, so // checking one only proves half the wiring. diff --git a/tests/Cluckwork.Api.IntegrationTests/SharedState/SharedStateRegistrationTests.cs b/tests/Cluckwork.Api.IntegrationTests/SharedState/SharedStateRegistrationTests.cs index e3dfe4cb6..aac24b139 100644 --- a/tests/Cluckwork.Api.IntegrationTests/SharedState/SharedStateRegistrationTests.cs +++ b/tests/Cluckwork.Api.IntegrationTests/SharedState/SharedStateRegistrationTests.cs @@ -1,8 +1,8 @@ -namespace Cluckwork.Api.IntegrationTests.SharedState; - using Cluckwork.Infrastructure.SharedState; using Microsoft.Extensions.DependencyInjection; +namespace Cluckwork.Api.IntegrationTests.SharedState; + public sealed class SharedStateRegistrationTests { private static ServiceProvider Build(string? conn, bool failOnMalformed) diff --git a/tests/Cluckwork.Api.IntegrationTests/SimulationCrossDayRerunTests.cs b/tests/Cluckwork.Api.IntegrationTests/SimulationCrossDayRerunTests.cs index afcc59794..cae08b4c6 100644 --- a/tests/Cluckwork.Api.IntegrationTests/SimulationCrossDayRerunTests.cs +++ b/tests/Cluckwork.Api.IntegrationTests/SimulationCrossDayRerunTests.cs @@ -1,5 +1,3 @@ -namespace Cluckwork.Api.IntegrationTests; - using System.IO; using System.Text.Json; using Cluckwork.Api.IntegrationTests.Infrastructure; @@ -16,6 +14,8 @@ namespace Cluckwork.Api.IntegrationTests; using Microsoft.Extensions.DependencyInjection; using Microsoft.Extensions.DependencyInjection.Extensions; +namespace Cluckwork.Api.IntegrationTests; + // #279 review (codex, BLOCKER + re-check) — idempotency of the simulation seed // under a controllable clock. The seeder writes date-relative natural keys // (daily entries, orders, inventory, recurring drips — all `today.AddDays(-n)`), diff --git a/tests/Cluckwork.Api.IntegrationTests/SimulationDeepSeedDrainTests.cs b/tests/Cluckwork.Api.IntegrationTests/SimulationDeepSeedDrainTests.cs index 9292aec7c..b16824228 100644 --- a/tests/Cluckwork.Api.IntegrationTests/SimulationDeepSeedDrainTests.cs +++ b/tests/Cluckwork.Api.IntegrationTests/SimulationDeepSeedDrainTests.cs @@ -1,5 +1,3 @@ -namespace Cluckwork.Api.IntegrationTests; - using Cluckwork.Api.IntegrationTests.Infrastructure; using Cluckwork.Application.Common; using Cluckwork.Domain.Accounts; @@ -11,6 +9,8 @@ namespace Cluckwork.Api.IntegrationTests; using Microsoft.EntityFrameworkCore; using Microsoft.Extensions.DependencyInjection; +namespace Cluckwork.Api.IntegrationTests; + // #638 — a fixture deep enough that the daily-entry lock sweep CANNOT drain in // one pass. // diff --git a/tests/Cluckwork.Api.IntegrationTests/SimulationOptionsBindingTests.cs b/tests/Cluckwork.Api.IntegrationTests/SimulationOptionsBindingTests.cs index d35686191..d699ceb27 100644 --- a/tests/Cluckwork.Api.IntegrationTests/SimulationOptionsBindingTests.cs +++ b/tests/Cluckwork.Api.IntegrationTests/SimulationOptionsBindingTests.cs @@ -1,8 +1,8 @@ -namespace Cluckwork.Api.IntegrationTests; - using Cluckwork.Infrastructure.Identity; using Microsoft.Extensions.Configuration; +namespace Cluckwork.Api.IntegrationTests; + // #243 load-test simulation seeder. #279: there is deliberately NO Seed:Simulation // gate anymore — the seeder is invoked only by the explicit `seed --profile // simulation` command (that dispatch + its Production guard is the gate). Its diff --git a/tests/Cluckwork.Api.IntegrationTests/SimulationSeedCommandTests.cs b/tests/Cluckwork.Api.IntegrationTests/SimulationSeedCommandTests.cs index 805eb1602..769230a97 100644 --- a/tests/Cluckwork.Api.IntegrationTests/SimulationSeedCommandTests.cs +++ b/tests/Cluckwork.Api.IntegrationTests/SimulationSeedCommandTests.cs @@ -1,5 +1,3 @@ -namespace Cluckwork.Api.IntegrationTests; - using System.Diagnostics; using System.IO; using System.Text.Json; @@ -8,6 +6,8 @@ namespace Cluckwork.Api.IntegrationTests; using Microsoft.EntityFrameworkCore; using Microsoft.Extensions.DependencyInjection; +namespace Cluckwork.Api.IntegrationTests; + // #279 review Fix 5 (codex) — the `simulation` profile of the `seed --profile // ` CLI dispatch, exercised end-to-end as a SUBPROCESS (the real built // Cluckwork.Api.dll, the same binary/entry point an operator runs), exactly as diff --git a/tests/Cluckwork.Api.IntegrationTests/SimulationSeederTests.cs b/tests/Cluckwork.Api.IntegrationTests/SimulationSeederTests.cs index ab2bfbc8c..adbbe698c 100644 --- a/tests/Cluckwork.Api.IntegrationTests/SimulationSeederTests.cs +++ b/tests/Cluckwork.Api.IntegrationTests/SimulationSeederTests.cs @@ -1,5 +1,3 @@ -namespace Cluckwork.Api.IntegrationTests; - using System.IO; using System.Net.Http.Json; using System.Text; @@ -19,6 +17,8 @@ namespace Cluckwork.Api.IntegrationTests; using Microsoft.EntityFrameworkCore; using Microsoft.Extensions.DependencyInjection; +namespace Cluckwork.Api.IntegrationTests; + // #243 — the SimulationDataSeeder that builds the load-test cast (Managers / // Sales / Workers / ReadOnly beyond the reused seeded admin), a minimal // 2-flock topology with exactly one flock-restricted worker, the primary diff --git a/tests/Cluckwork.Api.IntegrationTests/SolutionTestProjectSplitTests.cs b/tests/Cluckwork.Api.IntegrationTests/SolutionTestProjectSplitTests.cs index 7fb426dde..5201965bb 100644 --- a/tests/Cluckwork.Api.IntegrationTests/SolutionTestProjectSplitTests.cs +++ b/tests/Cluckwork.Api.IntegrationTests/SolutionTestProjectSplitTests.cs @@ -1,7 +1,7 @@ -namespace Cluckwork.Api.IntegrationTests; - using System.Text.RegularExpressions; +namespace Cluckwork.Api.IntegrationTests; + // #775 — the four test projects are legs of ci.yml's `tests` matrix. One // `dotnet test Cluckwork.sln` could not leave a project unrun; a matrix CAN, and it fails // SILENTLY — a new project simply never executes while every check stays green. diff --git a/tests/Cluckwork.Api.IntegrationTests/SpaShellRawPathTests.cs b/tests/Cluckwork.Api.IntegrationTests/SpaShellRawPathTests.cs index ddb005d42..b7d7b1372 100644 --- a/tests/Cluckwork.Api.IntegrationTests/SpaShellRawPathTests.cs +++ b/tests/Cluckwork.Api.IntegrationTests/SpaShellRawPathTests.cs @@ -1,5 +1,3 @@ -namespace Cluckwork.Api.IntegrationTests; - using System.Net; using System.Net.Sockets; using System.Text; @@ -9,6 +7,8 @@ namespace Cluckwork.Api.IntegrationTests; using Microsoft.AspNetCore.Hosting.Server.Features; using Microsoft.Extensions.DependencyInjection; +namespace Cluckwork.Api.IntegrationTests; + // #874 review (local Codex pass) — a raw "GET //index.html" request-target. // TestServer's in-memory transport routes every request through System.Uri, // which treats a leading "//" as an RFC 3986 network-path reference (a NEW diff --git a/tests/Cluckwork.Api.IntegrationTests/SpaShellTests.cs b/tests/Cluckwork.Api.IntegrationTests/SpaShellTests.cs index 1f88e2b30..f5f772f9f 100644 --- a/tests/Cluckwork.Api.IntegrationTests/SpaShellTests.cs +++ b/tests/Cluckwork.Api.IntegrationTests/SpaShellTests.cs @@ -1,11 +1,11 @@ -namespace Cluckwork.Api.IntegrationTests; - using System.Net; using System.Text.RegularExpressions; using Cluckwork.Api.Hosting; using Cluckwork.Api.Security; using Microsoft.Extensions.FileProviders; +namespace Cluckwork.Api.IntegrationTests; + // #873 — the SPA's index.html is served as a templated response so the document // and its own Content-Security-Policy header name the SAME style nonce. If they // ever disagree, MUI's Emotion styles are dropped by the browser and nothing diff --git a/tests/Cluckwork.Api.IntegrationTests/StaticAssetCachingTests.cs b/tests/Cluckwork.Api.IntegrationTests/StaticAssetCachingTests.cs index 6067ed41b..d8ba8e631 100644 --- a/tests/Cluckwork.Api.IntegrationTests/StaticAssetCachingTests.cs +++ b/tests/Cluckwork.Api.IntegrationTests/StaticAssetCachingTests.cs @@ -1,10 +1,10 @@ -namespace Cluckwork.Api.IntegrationTests; - using System.Net; using Cluckwork.Api.Hosting; using Cluckwork.Api.IntegrationTests.Infrastructure; using Microsoft.AspNetCore.Hosting; +namespace Cluckwork.Api.IntegrationTests; + // #141 — static-asset cache policy. The suite normally runs with no wwwroot (the // built SPA only exists in the Docker image), so this factory writes a throwaway // web root — a hashed asset under /assets, an index.html, a root favicon — and diff --git a/tests/Cluckwork.Api.IntegrationTests/StealLossConnectionReleaseTests.cs b/tests/Cluckwork.Api.IntegrationTests/StealLossConnectionReleaseTests.cs index 308e21603..5efe335ac 100644 --- a/tests/Cluckwork.Api.IntegrationTests/StealLossConnectionReleaseTests.cs +++ b/tests/Cluckwork.Api.IntegrationTests/StealLossConnectionReleaseTests.cs @@ -1,5 +1,3 @@ -namespace Cluckwork.Api.IntegrationTests; - using System.Diagnostics; using System.Net; using Cluckwork.Api.IntegrationTests.Infrastructure; @@ -10,6 +8,8 @@ namespace Cluckwork.Api.IntegrationTests; using Microsoft.EntityFrameworkCore; using Npgsql; +namespace Cluckwork.Api.IntegrationTests; + // #307 PR review — two defects in the steal-loss branch of IdempotencyMiddleware // (reached after OUR own PUBLISH loses its guard because our lease was stolen // mid-execution): diff --git a/tests/Cluckwork.Api.IntegrationTests/StepUpAuthTests.cs b/tests/Cluckwork.Api.IntegrationTests/StepUpAuthTests.cs index 2d40cbf26..75feea9da 100644 --- a/tests/Cluckwork.Api.IntegrationTests/StepUpAuthTests.cs +++ b/tests/Cluckwork.Api.IntegrationTests/StepUpAuthTests.cs @@ -1,5 +1,3 @@ -namespace Cluckwork.Api.IntegrationTests; - using System.Net; using System.Net.Http.Headers; using Cluckwork.Api.Endpoints.Auth; @@ -18,6 +16,8 @@ namespace Cluckwork.Api.IntegrationTests; using Microsoft.Extensions.DependencyInjection; using Microsoft.Extensions.Options; +namespace Cluckwork.Api.IntegrationTests; + // #308/#360 — step-up authentication for durable user access. A stolen but // still-valid Owner access token must not be enough, on its own, to create any // interactive user, reset any user's password, or change any user's role. diff --git a/tests/Cluckwork.Api.IntegrationTests/StepUpGrantRegistrySharedStoreTests.cs b/tests/Cluckwork.Api.IntegrationTests/StepUpGrantRegistrySharedStoreTests.cs index 6be2f41c8..9e2b7422a 100644 --- a/tests/Cluckwork.Api.IntegrationTests/StepUpGrantRegistrySharedStoreTests.cs +++ b/tests/Cluckwork.Api.IntegrationTests/StepUpGrantRegistrySharedStoreTests.cs @@ -1,5 +1,3 @@ -namespace Cluckwork.Api.IntegrationTests; - using Cluckwork.Api.IntegrationTests.Infrastructure; using Cluckwork.Api.IntegrationTests.SharedState; using Cluckwork.Infrastructure.Identity; @@ -10,6 +8,8 @@ namespace Cluckwork.Api.IntegrationTests; using Microsoft.Extensions.DependencyInjection; using Microsoft.Extensions.Logging.Abstractions; +namespace Cluckwork.Api.IntegrationTests; + // #338 — the point of the shared-store move, at the unit level: ONE Redis // claim store and ONE Postgres shared by TWO independent registry instances // (regA/regB), which is exactly the multi-replica topology the in-memory diff --git a/tests/Cluckwork.Api.IntegrationTests/StepUpGrantRegistryTests.cs b/tests/Cluckwork.Api.IntegrationTests/StepUpGrantRegistryTests.cs index 160d2a538..ecc018277 100644 --- a/tests/Cluckwork.Api.IntegrationTests/StepUpGrantRegistryTests.cs +++ b/tests/Cluckwork.Api.IntegrationTests/StepUpGrantRegistryTests.cs @@ -1,5 +1,3 @@ -namespace Cluckwork.Api.IntegrationTests; - using Cluckwork.Api.IntegrationTests.Infrastructure; using Cluckwork.Api.IntegrationTests.SharedState; using Cluckwork.Infrastructure.Identity; @@ -9,6 +7,8 @@ namespace Cluckwork.Api.IntegrationTests; using Microsoft.EntityFrameworkCore; using Microsoft.Extensions.DependencyInjection; +namespace Cluckwork.Api.IntegrationTests; + // #308 / PR #336 review (3rd round) — the step-up registry's own contract, at // the unit level. #338 (rework) moved both tables out of the process: replay // now lives in IClaimOnceStore (#543) and logout revocation in the durable diff --git a/tests/Cluckwork.Api.IntegrationTests/SubmitDailyEntryTests.cs b/tests/Cluckwork.Api.IntegrationTests/SubmitDailyEntryTests.cs index 4a90c03ee..b33bde98b 100644 --- a/tests/Cluckwork.Api.IntegrationTests/SubmitDailyEntryTests.cs +++ b/tests/Cluckwork.Api.IntegrationTests/SubmitDailyEntryTests.cs @@ -1,5 +1,3 @@ -namespace Cluckwork.Api.IntegrationTests; - using System.Net; using Cluckwork.Api.IntegrationTests.Infrastructure; using Cluckwork.Application.Features.DailyEntries.SubmitDailyEntry; @@ -8,6 +6,8 @@ namespace Cluckwork.Api.IntegrationTests; using Microsoft.EntityFrameworkCore; using Microsoft.Extensions.DependencyInjection; +namespace Cluckwork.Api.IntegrationTests; + // #8 — the production -> stock bridge. Submitting a daily entry generates one // egg lot per grade line; the whole MVP loop hangs off this. [Collection(IntegrationCollection.Name)] diff --git a/tests/Cluckwork.Api.IntegrationTests/TemporaryPasswordTests.cs b/tests/Cluckwork.Api.IntegrationTests/TemporaryPasswordTests.cs index 0ed1bcc99..ec9ebb932 100644 --- a/tests/Cluckwork.Api.IntegrationTests/TemporaryPasswordTests.cs +++ b/tests/Cluckwork.Api.IntegrationTests/TemporaryPasswordTests.cs @@ -1,8 +1,8 @@ -namespace Cluckwork.Api.IntegrationTests; - using System.Linq; using Cluckwork.Infrastructure.Identity; +namespace Cluckwork.Api.IntegrationTests; + // #265 review — the break-glass temp-password generator (internal; visible via // InternalsVisibleTo). Policy compliance is enforced indirectly too (a // non-compliant password fails ResetPasswordAsync and reddens diff --git a/tests/Cluckwork.Api.IntegrationTests/TenantContextSingleAssignmentTests.cs b/tests/Cluckwork.Api.IntegrationTests/TenantContextSingleAssignmentTests.cs index 4180fab92..13b8409f3 100644 --- a/tests/Cluckwork.Api.IntegrationTests/TenantContextSingleAssignmentTests.cs +++ b/tests/Cluckwork.Api.IntegrationTests/TenantContextSingleAssignmentTests.cs @@ -1,7 +1,7 @@ -namespace Cluckwork.Api.IntegrationTests; - using Cluckwork.Infrastructure.Persistence; +namespace Cluckwork.Api.IntegrationTests; + // #546 — TenantContext is single-assignment: one DI scope serves exactly one // account. See TenantContext for why re-pointing a live scope is never // legitimate. diff --git a/tests/Cluckwork.Api.IntegrationTests/TenantIsolationTests.cs b/tests/Cluckwork.Api.IntegrationTests/TenantIsolationTests.cs index 24ca8f20f..37fb9f9e3 100644 --- a/tests/Cluckwork.Api.IntegrationTests/TenantIsolationTests.cs +++ b/tests/Cluckwork.Api.IntegrationTests/TenantIsolationTests.cs @@ -1,10 +1,10 @@ -namespace Cluckwork.Api.IntegrationTests; - using System.Net; using Cluckwork.Api.IntegrationTests.Infrastructure; using Cluckwork.Domain.Eggs; using Microsoft.EntityFrameworkCore; +namespace Cluckwork.Api.IntegrationTests; + // tech spec §4.2 / §11: a token for account A can never read or write account B's data. [Collection(IntegrationCollection.Name)] public sealed class TenantIsolationTests(CluckworkWebApplicationFactory factory) diff --git a/tests/Cluckwork.Api.IntegrationTests/TenantResolutionMiddlewareTests.cs b/tests/Cluckwork.Api.IntegrationTests/TenantResolutionMiddlewareTests.cs index 13c73b1e0..e5a421384 100644 --- a/tests/Cluckwork.Api.IntegrationTests/TenantResolutionMiddlewareTests.cs +++ b/tests/Cluckwork.Api.IntegrationTests/TenantResolutionMiddlewareTests.cs @@ -1,5 +1,3 @@ -namespace Cluckwork.Api.IntegrationTests; - using System.Security.Claims; using Cluckwork.Api.Middleware; using Cluckwork.Domain.Accounts; @@ -12,6 +10,8 @@ namespace Cluckwork.Api.IntegrationTests; using Serilog; using Serilog.Extensions.Hosting; +namespace Cluckwork.Api.IntegrationTests; + public sealed class TenantResolutionMiddlewareTests { [Fact] diff --git a/tests/Cluckwork.Api.IntegrationTests/TenantScopedLockTests.cs b/tests/Cluckwork.Api.IntegrationTests/TenantScopedLockTests.cs index 1d3c4d49e..33d90104a 100644 --- a/tests/Cluckwork.Api.IntegrationTests/TenantScopedLockTests.cs +++ b/tests/Cluckwork.Api.IntegrationTests/TenantScopedLockTests.cs @@ -1,5 +1,3 @@ -namespace Cluckwork.Api.IntegrationTests; - using System.Net; using Cluckwork.Api.IntegrationTests.Infrastructure; using Cluckwork.Domain.Accounts; @@ -7,6 +5,8 @@ namespace Cluckwork.Api.IntegrationTests; using Cluckwork.Infrastructure.Persistence; using Microsoft.EntityFrameworkCore; +namespace Cluckwork.Api.IntegrationTests; + // #313 — SalesOrderRepository.GetByIdLockedAsync and InventoryItemRepository.GetByIdLockedAsync // select by Id alone and only check AccountId AFTER the row loads, because the raw FOR UPDATE // SQL bypasses EF's tenant query filter. A caller authenticated as tenant A but supplying tenant diff --git a/tests/Cluckwork.Api.IntegrationTests/TenantWriteGuardTests.cs b/tests/Cluckwork.Api.IntegrationTests/TenantWriteGuardTests.cs index 912157255..ea6403180 100644 --- a/tests/Cluckwork.Api.IntegrationTests/TenantWriteGuardTests.cs +++ b/tests/Cluckwork.Api.IntegrationTests/TenantWriteGuardTests.cs @@ -1,11 +1,11 @@ -namespace Cluckwork.Api.IntegrationTests; - using Cluckwork.Api.IntegrationTests.Infrastructure; using Cluckwork.Domain.Eggs; using Cluckwork.Infrastructure.Persistence; using Microsoft.EntityFrameworkCore; using Microsoft.Extensions.DependencyInjection; +namespace Cluckwork.Api.IntegrationTests; + // #546 — the write side's chokepoint. Reads are defended by 27 fail-closed // query filters; before this slice writes were defended by convention. // diff --git a/tests/Cluckwork.Api.IntegrationTests/TenantWriteRefusalLoggingTests.cs b/tests/Cluckwork.Api.IntegrationTests/TenantWriteRefusalLoggingTests.cs index d8f5a4a30..619e003a5 100644 --- a/tests/Cluckwork.Api.IntegrationTests/TenantWriteRefusalLoggingTests.cs +++ b/tests/Cluckwork.Api.IntegrationTests/TenantWriteRefusalLoggingTests.cs @@ -1,5 +1,3 @@ -namespace Cluckwork.Api.IntegrationTests; - using Cluckwork.Api.IntegrationTests.Infrastructure; using Cluckwork.Application.Common; using Cluckwork.Domain.Eggs; @@ -12,6 +10,8 @@ namespace Cluckwork.Api.IntegrationTests; using Microsoft.Extensions.Logging; using Serilog.Events; +namespace Cluckwork.Api.IntegrationTests; + // #562 — the database-side refusal is logged as a security event. // // With AccountId a concurrency token, a write aimed at another farm's row diff --git a/tests/Cluckwork.Api.IntegrationTests/TimeZoneAvailabilityTests.cs b/tests/Cluckwork.Api.IntegrationTests/TimeZoneAvailabilityTests.cs index 5543eafe8..5db1bb1eb 100644 --- a/tests/Cluckwork.Api.IntegrationTests/TimeZoneAvailabilityTests.cs +++ b/tests/Cluckwork.Api.IntegrationTests/TimeZoneAvailabilityTests.cs @@ -1,7 +1,7 @@ -namespace Cluckwork.Api.IntegrationTests; - using Cluckwork.Infrastructure.Time; +namespace Cluckwork.Api.IntegrationTests; + // #264 — unit-level coverage of the tz-availability guard (no Docker). Mirrors // RateLimitingOptionsTests: the guard's LOGIC is proven here; SeedTimeZoneTests // proves it is WIRED into boot. diff --git a/tests/Cluckwork.Api.IntegrationTests/TrackedMutationReadTests.cs b/tests/Cluckwork.Api.IntegrationTests/TrackedMutationReadTests.cs index a5240414b..2bb2947ec 100644 --- a/tests/Cluckwork.Api.IntegrationTests/TrackedMutationReadTests.cs +++ b/tests/Cluckwork.Api.IntegrationTests/TrackedMutationReadTests.cs @@ -1,5 +1,3 @@ -namespace Cluckwork.Api.IntegrationTests; - using Cluckwork.Api.IntegrationTests.Infrastructure; using Cluckwork.Application.Features.Flocks; using Cluckwork.Domain.Flocks; @@ -8,6 +6,8 @@ namespace Cluckwork.Api.IntegrationTests; using Microsoft.Extensions.DependencyInjection; using System.Text.RegularExpressions; +namespace Cluckwork.Api.IntegrationTests; + // #561 review — the write guard's Modified/Deleted checks compare AccountId's // ORIGINAL value against the resolved tenant, and that is only meaningful while // the original value is the DATABASE's. diff --git a/tests/Cluckwork.Api.IntegrationTests/TransientDbResilienceTests.cs b/tests/Cluckwork.Api.IntegrationTests/TransientDbResilienceTests.cs index c553b9645..e0229b42f 100644 --- a/tests/Cluckwork.Api.IntegrationTests/TransientDbResilienceTests.cs +++ b/tests/Cluckwork.Api.IntegrationTests/TransientDbResilienceTests.cs @@ -1,5 +1,3 @@ -namespace Cluckwork.Api.IntegrationTests; - using System.Net; using System.Threading; using Cluckwork.Api.IntegrationTests.Infrastructure; @@ -12,6 +10,8 @@ namespace Cluckwork.Api.IntegrationTests; using Microsoft.Extensions.DependencyInjection; using Npgsql; +namespace Cluckwork.Api.IntegrationTests; + // #269 — the request path used to have no resilience to a transient DB // failure: UseNpgsql carried no execution strategy, so a managed-Postgres // failover or a dropped pooled connection threw straight to a 500. These diff --git a/tests/Cluckwork.Api.IntegrationTests/TrustedProxyGuardTests.cs b/tests/Cluckwork.Api.IntegrationTests/TrustedProxyGuardTests.cs index ca28bfabd..23a8ddf96 100644 --- a/tests/Cluckwork.Api.IntegrationTests/TrustedProxyGuardTests.cs +++ b/tests/Cluckwork.Api.IntegrationTests/TrustedProxyGuardTests.cs @@ -1,9 +1,9 @@ -namespace Cluckwork.Api.IntegrationTests; - using System.Net; using Cluckwork.Api.IntegrationTests.Infrastructure; using Microsoft.AspNetCore.Hosting; +namespace Cluckwork.Api.IntegrationTests; + // #260 — behind a reverse proxy the app only honours X-Forwarded-Proto/-For from // networks in RateLimiting:TrustedProxies. If that list is empty in Production, // HSTS (#144) silently goes inert and the per-IP login rate limiter (#143) diff --git a/tests/Cluckwork.Api.IntegrationTests/TwoFarmIsolationMatrixTests.cs b/tests/Cluckwork.Api.IntegrationTests/TwoFarmIsolationMatrixTests.cs index d5e3a9241..e1aad1f3e 100644 --- a/tests/Cluckwork.Api.IntegrationTests/TwoFarmIsolationMatrixTests.cs +++ b/tests/Cluckwork.Api.IntegrationTests/TwoFarmIsolationMatrixTests.cs @@ -1,5 +1,3 @@ -namespace Cluckwork.Api.IntegrationTests; - using System.Net; using Cluckwork.Api.Endpoints.Auth; using Cluckwork.Api.IntegrationTests.Infrastructure; @@ -12,6 +10,8 @@ namespace Cluckwork.Api.IntegrationTests; using Microsoft.EntityFrameworkCore; using Microsoft.Extensions.DependencyInjection; +namespace Cluckwork.Api.IntegrationTests; + // #536 Part 2 — two-farm isolation matrix. Two farms are provisioned THROUGH // AccountProvisioner.ProvisionAsync (not the seeders — #533's parity guard and // this fixture must describe the same farm), both owners log in with the diff --git a/tests/Cluckwork.Api.IntegrationTests/UserLanguageColumnTests.cs b/tests/Cluckwork.Api.IntegrationTests/UserLanguageColumnTests.cs index 89fde9546..810910e78 100644 --- a/tests/Cluckwork.Api.IntegrationTests/UserLanguageColumnTests.cs +++ b/tests/Cluckwork.Api.IntegrationTests/UserLanguageColumnTests.cs @@ -1,8 +1,8 @@ -namespace Cluckwork.Api.IntegrationTests; - using Cluckwork.Api.IntegrationTests.Infrastructure; using Microsoft.EntityFrameworkCore; +namespace Cluckwork.Api.IntegrationTests; + [Collection(IntegrationCollection.Name)] public sealed class UserLanguageColumnTests(CluckworkWebApplicationFactory factory) { diff --git a/tests/Cluckwork.Api.IntegrationTests/UserNameTests.cs b/tests/Cluckwork.Api.IntegrationTests/UserNameTests.cs index d3740ed96..a505c2285 100644 --- a/tests/Cluckwork.Api.IntegrationTests/UserNameTests.cs +++ b/tests/Cluckwork.Api.IntegrationTests/UserNameTests.cs @@ -1,10 +1,10 @@ -namespace Cluckwork.Api.IntegrationTests; - using System.Net; using System.Net.Http.Json; using Cluckwork.Api.Endpoints.Auth; using Cluckwork.Api.IntegrationTests.Infrastructure; +namespace Cluckwork.Api.IntegrationTests; + // #163 — a user's display name can be set at creation and edited afterwards. // The update is Owner-only (covered by AdminGatingTests) and account-scoped. [Collection(IntegrationCollection.Name)] diff --git a/tests/Cluckwork.Api.IntegrationTests/UserPasswordTests.cs b/tests/Cluckwork.Api.IntegrationTests/UserPasswordTests.cs index 2445a30ff..37345227e 100644 --- a/tests/Cluckwork.Api.IntegrationTests/UserPasswordTests.cs +++ b/tests/Cluckwork.Api.IntegrationTests/UserPasswordTests.cs @@ -1,11 +1,11 @@ -namespace Cluckwork.Api.IntegrationTests; - using System.Net; using System.Net.Http.Json; using Cluckwork.Api.Endpoints.Auth; using Cluckwork.Api.IntegrationTests.Infrastructure; using Microsoft.EntityFrameworkCore; +namespace Cluckwork.Api.IntegrationTests; + // #165 — password management. Two halves with different rules: an Owner sets // another user's password without the current one, and any signed-in user // changes their OWN by proving the current one. Both revoke every refresh token diff --git a/tests/Cluckwork.Api.IntegrationTests/UserRoleAccountIdMigrationTests.cs b/tests/Cluckwork.Api.IntegrationTests/UserRoleAccountIdMigrationTests.cs index cd46e13c2..9845a6d1f 100644 --- a/tests/Cluckwork.Api.IntegrationTests/UserRoleAccountIdMigrationTests.cs +++ b/tests/Cluckwork.Api.IntegrationTests/UserRoleAccountIdMigrationTests.cs @@ -1,5 +1,3 @@ -namespace Cluckwork.Api.IntegrationTests; - using Cluckwork.Api.IntegrationTests.Infrastructure; using Cluckwork.Infrastructure.Persistence; using Cluckwork.Infrastructure.Persistence.Interceptors; @@ -10,6 +8,8 @@ namespace Cluckwork.Api.IntegrationTests; using Microsoft.EntityFrameworkCore.Migrations; using Npgsql; +namespace Cluckwork.Api.IntegrationTests; + // #670 — the migration that adds AspNetUserRoles.AccountId runs against a // database that ALREADY holds role rows (every real one). EF's generated // operations alone add the column with DEFAULT '0000…' and then create the diff --git a/tests/Cluckwork.Api.IntegrationTests/UserRoleAccountIdModelTests.cs b/tests/Cluckwork.Api.IntegrationTests/UserRoleAccountIdModelTests.cs index c310ef561..5f66d5b8a 100644 --- a/tests/Cluckwork.Api.IntegrationTests/UserRoleAccountIdModelTests.cs +++ b/tests/Cluckwork.Api.IntegrationTests/UserRoleAccountIdModelTests.cs @@ -1,10 +1,10 @@ -namespace Cluckwork.Api.IntegrationTests; - using Cluckwork.Infrastructure.Identity; using Cluckwork.Infrastructure.Persistence; using Microsoft.AspNetCore.Identity; using Microsoft.EntityFrameworkCore; +namespace Cluckwork.Api.IntegrationTests; + // #670 — pins the seam in AppDbContext.OnModelCreating that gives // IdentityUserRole a tenant column the two existing write-side layers // reach by name. Model-only, no database (AccountIdConcurrencyTokenModelTests diff --git a/tests/Cluckwork.Api.IntegrationTests/UserRoleTenantWriteTests.cs b/tests/Cluckwork.Api.IntegrationTests/UserRoleTenantWriteTests.cs index 974a0d546..e76c14613 100644 --- a/tests/Cluckwork.Api.IntegrationTests/UserRoleTenantWriteTests.cs +++ b/tests/Cluckwork.Api.IntegrationTests/UserRoleTenantWriteTests.cs @@ -1,5 +1,3 @@ -namespace Cluckwork.Api.IntegrationTests; - using Cluckwork.Api.IntegrationTests.Infrastructure; using Cluckwork.Infrastructure.Persistence; using Cluckwork.Infrastructure.Persistence.Interceptors; @@ -8,6 +6,8 @@ namespace Cluckwork.Api.IntegrationTests; using Microsoft.Extensions.DependencyInjection; using Npgsql; +namespace Cluckwork.Api.IntegrationTests; + // #670 — AspNetUserRoles is live RBAC state, and until this slice it had no // tenant column: both write-side layers (TenantStampInterceptor, the #562 // concurrency-token walk) select entities by a property NAMED AccountId, and diff --git a/tests/Cluckwork.Api.IntegrationTests/ValidationResponseTests.cs b/tests/Cluckwork.Api.IntegrationTests/ValidationResponseTests.cs index 74395408e..0feb33fab 100644 --- a/tests/Cluckwork.Api.IntegrationTests/ValidationResponseTests.cs +++ b/tests/Cluckwork.Api.IntegrationTests/ValidationResponseTests.cs @@ -1,5 +1,3 @@ -namespace Cluckwork.Api.IntegrationTests; - using Cluckwork.Api.Hosting; using Cluckwork.Api.Validation; using FluentValidation.Results; @@ -7,6 +5,8 @@ namespace Cluckwork.Api.IntegrationTests; using Microsoft.AspNetCore.Http; using Microsoft.AspNetCore.Http.Metadata; +namespace Cluckwork.Api.IntegrationTests; + // Pure-function tests: no server, no Testcontainers collection. public sealed class ValidationResponseTests { diff --git a/tests/Cluckwork.Api.IntegrationTests/VoidSaleTests.cs b/tests/Cluckwork.Api.IntegrationTests/VoidSaleTests.cs index 1b0624c07..f67869a00 100644 --- a/tests/Cluckwork.Api.IntegrationTests/VoidSaleTests.cs +++ b/tests/Cluckwork.Api.IntegrationTests/VoidSaleTests.cs @@ -1,9 +1,9 @@ -namespace Cluckwork.Api.IntegrationTests; - using System.Net; using Cluckwork.Api.IntegrationTests.Infrastructure; using Microsoft.EntityFrameworkCore; +namespace Cluckwork.Api.IntegrationTests; + // #60 — void a confirmed order: the allocated quantities return to the exact // egg lots they were drawn from (allocation provenance recorded at confirm), // FIFO order is preserved for the next sale, and racing mutations serialize on diff --git a/tests/Cluckwork.Api.IntegrationTests/WaterUsageTests.cs b/tests/Cluckwork.Api.IntegrationTests/WaterUsageTests.cs index 65d215740..7d0baed52 100644 --- a/tests/Cluckwork.Api.IntegrationTests/WaterUsageTests.cs +++ b/tests/Cluckwork.Api.IntegrationTests/WaterUsageTests.cs @@ -1,9 +1,9 @@ -namespace Cluckwork.Api.IntegrationTests; - using System.Net; using Cluckwork.Api.IntegrationTests.Infrastructure; using Microsoft.EntityFrameworkCore; +namespace Cluckwork.Api.IntegrationTests; + // #67 — water usage: direct or meter-derived quantities, editable records // (Version-guarded), same flock lifecycle gate as production/feed. [Collection(IntegrationCollection.Name)] diff --git a/tests/Cluckwork.Api.IntegrationTests/WithdrawalRestrictedLotTests.cs b/tests/Cluckwork.Api.IntegrationTests/WithdrawalRestrictedLotTests.cs index a11eebc6e..5f28c48f4 100644 --- a/tests/Cluckwork.Api.IntegrationTests/WithdrawalRestrictedLotTests.cs +++ b/tests/Cluckwork.Api.IntegrationTests/WithdrawalRestrictedLotTests.cs @@ -1,9 +1,9 @@ -namespace Cluckwork.Api.IntegrationTests; - using System.Net; using Cluckwork.Api.IntegrationTests.Infrastructure; using Microsoft.EntityFrameworkCore; +namespace Cluckwork.Api.IntegrationTests; + // tech spec §11 / functional §10.10, §13.3: a lot under medication withdrawal must be // hard-blocked from sale. With no other stock, confirmation fails and the lot is untouched. [Collection(IntegrationCollection.Name)] diff --git a/tests/Cluckwork.Api.IntegrationTests/WorkerSaleAllocationPolicyMigrationTests.cs b/tests/Cluckwork.Api.IntegrationTests/WorkerSaleAllocationPolicyMigrationTests.cs index 2ba4bf310..090917cac 100644 --- a/tests/Cluckwork.Api.IntegrationTests/WorkerSaleAllocationPolicyMigrationTests.cs +++ b/tests/Cluckwork.Api.IntegrationTests/WorkerSaleAllocationPolicyMigrationTests.cs @@ -1,5 +1,3 @@ -namespace Cluckwork.Api.IntegrationTests; - using Cluckwork.Api.IntegrationTests.Infrastructure; using Cluckwork.Infrastructure.Persistence; using Cluckwork.Infrastructure.Persistence.Interceptors; @@ -9,6 +7,8 @@ namespace Cluckwork.Api.IntegrationTests; using Microsoft.EntityFrameworkCore.Infrastructure; using Microsoft.EntityFrameworkCore.Migrations; +namespace Cluckwork.Api.IntegrationTests; + // #612 — the AddWorkerSaleAllocationPolicy migration. Same throwaway-Postgres, // no-WebApplicationFactory pattern as FarmBannerMigrationDowngradeTests: drives // EF's migrator directly so the default/backfill and the downgrade are diff --git a/tests/Cluckwork.Application.Tests/Accounts/UpdateFarmSettingsValidatorTests.cs b/tests/Cluckwork.Application.Tests/Accounts/UpdateFarmSettingsValidatorTests.cs index fbf42b66e..3ad04ba29 100644 --- a/tests/Cluckwork.Application.Tests/Accounts/UpdateFarmSettingsValidatorTests.cs +++ b/tests/Cluckwork.Application.Tests/Accounts/UpdateFarmSettingsValidatorTests.cs @@ -1,9 +1,9 @@ -namespace Cluckwork.Application.Tests.Accounts; - using System.Globalization; using Cluckwork.Application.Features.Accounts.UpdateFarmSettings; using Cluckwork.Domain.Accounts; +namespace Cluckwork.Application.Tests.Accounts; + // #123 — the write-side gate on the §4.5 fields. The timezone rule carries the // most weight: #35's FarmClock deliberately fails closed on an unusable zone // rather than guessing a date, and this validator is what keeps an unusable diff --git a/tests/Cluckwork.Application.Tests/Architecture/AdapterReachRealTreeTests.cs b/tests/Cluckwork.Application.Tests/Architecture/AdapterReachRealTreeTests.cs index c59056cfb..ce18e23de 100644 --- a/tests/Cluckwork.Application.Tests/Architecture/AdapterReachRealTreeTests.cs +++ b/tests/Cluckwork.Application.Tests/Architecture/AdapterReachRealTreeTests.cs @@ -1,8 +1,8 @@ -namespace Cluckwork.Application.Tests.Architecture; - using Cluckwork.Application.Tests.TenantBypass; using Xunit.Abstractions; +namespace Cluckwork.Application.Tests.Architecture; + public sealed class AdapterReachRealTreeTests(ITestOutputHelper output) { private static AdapterReachReport Scan() => AdapterReachScanner.Scan( diff --git a/tests/Cluckwork.Application.Tests/Architecture/AdapterReachScanner.cs b/tests/Cluckwork.Application.Tests/Architecture/AdapterReachScanner.cs index 1bdfd7dcb..553a9e27e 100644 --- a/tests/Cluckwork.Application.Tests/Architecture/AdapterReachScanner.cs +++ b/tests/Cluckwork.Application.Tests/Architecture/AdapterReachScanner.cs @@ -1,11 +1,11 @@ -namespace Cluckwork.Application.Tests.Architecture; - using System.Text.Json; using Cluckwork.Application.Tests.TenantBypass; using Microsoft.CodeAnalysis; using Microsoft.CodeAnalysis.CSharp; using Microsoft.CodeAnalysis.CSharp.Syntax; +namespace Cluckwork.Application.Tests.Architecture; + public sealed record AdapterReach(string Symbol, string Owner, string Type, string File, int Line); public sealed record AdapterReachReport( diff --git a/tests/Cluckwork.Application.Tests/Architecture/AdapterTierRealTreeTests.cs b/tests/Cluckwork.Application.Tests/Architecture/AdapterTierRealTreeTests.cs index 7439921ac..881cf68fd 100644 --- a/tests/Cluckwork.Application.Tests/Architecture/AdapterTierRealTreeTests.cs +++ b/tests/Cluckwork.Application.Tests/Architecture/AdapterTierRealTreeTests.cs @@ -1,7 +1,7 @@ -namespace Cluckwork.Application.Tests.Architecture; - using Cluckwork.Application.Tests.TenantBypass; +namespace Cluckwork.Application.Tests.Architecture; + public sealed class AdapterTierRealTreeTests { private static string LedgerPath => Path.Combine(AppContext.BaseDirectory, "Architecture", "Data", "module-ledger.json"); diff --git a/tests/Cluckwork.Application.Tests/Architecture/AdapterTierScanner.cs b/tests/Cluckwork.Application.Tests/Architecture/AdapterTierScanner.cs index d87532117..f891eb79d 100644 --- a/tests/Cluckwork.Application.Tests/Architecture/AdapterTierScanner.cs +++ b/tests/Cluckwork.Application.Tests/Architecture/AdapterTierScanner.cs @@ -1,5 +1,3 @@ -namespace Cluckwork.Application.Tests.Architecture; - using System.Text.Encodings.Web; using System.Text.Json; using Cluckwork.Application.Tests.TenantBypass; @@ -7,6 +5,8 @@ namespace Cluckwork.Application.Tests.Architecture; using Microsoft.CodeAnalysis.CSharp; using Microsoft.CodeAnalysis.CSharp.Syntax; +namespace Cluckwork.Application.Tests.Architecture; + public sealed record ToolType(string Name, string File, int Line); public sealed record SurfaceCallSite(string Surface, string File, int Line); diff --git a/tests/Cluckwork.Application.Tests/Architecture/CouplingMatrix.cs b/tests/Cluckwork.Application.Tests/Architecture/CouplingMatrix.cs index 0fa0b33d5..de6ecf8d4 100644 --- a/tests/Cluckwork.Application.Tests/Architecture/CouplingMatrix.cs +++ b/tests/Cluckwork.Application.Tests/Architecture/CouplingMatrix.cs @@ -1,7 +1,7 @@ -namespace Cluckwork.Application.Tests.Architecture; - using System.Text; +namespace Cluckwork.Application.Tests.Architecture; + public static class CouplingMatrix { private const string Header = ""; diff --git a/tests/Cluckwork.Application.Tests/Architecture/CouplingMatrixRealTreeTests.cs b/tests/Cluckwork.Application.Tests/Architecture/CouplingMatrixRealTreeTests.cs index 36f16cb57..23f699b8a 100644 --- a/tests/Cluckwork.Application.Tests/Architecture/CouplingMatrixRealTreeTests.cs +++ b/tests/Cluckwork.Application.Tests/Architecture/CouplingMatrixRealTreeTests.cs @@ -1,9 +1,9 @@ -namespace Cluckwork.Application.Tests.Architecture; - using Cluckwork.Application.Tests.TenantBypass; using Cluckwork.Infrastructure.Persistence; using Microsoft.EntityFrameworkCore; +namespace Cluckwork.Application.Tests.Architecture; + public sealed class CouplingMatrixRealTreeTests { [Fact] diff --git a/tests/Cluckwork.Application.Tests/Architecture/ModuleLedger.cs b/tests/Cluckwork.Application.Tests/Architecture/ModuleLedger.cs index 1c970b9ab..a2929ca2e 100644 --- a/tests/Cluckwork.Application.Tests/Architecture/ModuleLedger.cs +++ b/tests/Cluckwork.Application.Tests/Architecture/ModuleLedger.cs @@ -1,9 +1,10 @@ +using System.Text.Json; +using System.Text.RegularExpressions; + namespace Cluckwork.Application.Tests.Architecture; // #842 — the committed module ledger: owners by namespace, one cell per cross-owner dependency. -using System.Text.Json; -using System.Text.RegularExpressions; public sealed record OwnerDefinition( string Name, diff --git a/tests/Cluckwork.Application.Tests/Architecture/ModuleLedgerRealTreeTests.cs b/tests/Cluckwork.Application.Tests/Architecture/ModuleLedgerRealTreeTests.cs index ae3658584..1f474ce5b 100644 --- a/tests/Cluckwork.Application.Tests/Architecture/ModuleLedgerRealTreeTests.cs +++ b/tests/Cluckwork.Application.Tests/Architecture/ModuleLedgerRealTreeTests.cs @@ -1,8 +1,9 @@ +using Cluckwork.Application.Tests.TenantBypass; + namespace Cluckwork.Application.Tests.Architecture; // #842 — the real-tree gate; the mutation matrix reds here. -using Cluckwork.Application.Tests.TenantBypass; public sealed class ModuleLedgerRealTreeTests { diff --git a/tests/Cluckwork.Application.Tests/Architecture/ModuleLedgerScanner.cs b/tests/Cluckwork.Application.Tests/Architecture/ModuleLedgerScanner.cs index 1bece4ab7..f910eb8f7 100644 --- a/tests/Cluckwork.Application.Tests/Architecture/ModuleLedgerScanner.cs +++ b/tests/Cluckwork.Application.Tests/Architecture/ModuleLedgerScanner.cs @@ -1,7 +1,3 @@ -namespace Cluckwork.Application.Tests.Architecture; - -// #842 (epic #514 slice 1) — the cross-owner edge ratchet over src/, read against Data/module-ledger.json. - using System.Text; using System.Text.Json; using Cluckwork.Application.Tests.TenantBypass; @@ -9,6 +5,11 @@ namespace Cluckwork.Application.Tests.Architecture; using Microsoft.CodeAnalysis.CSharp; using Microsoft.CodeAnalysis.CSharp.Syntax; +namespace Cluckwork.Application.Tests.Architecture; + +// #842 (epic #514 slice 1) — the cross-owner edge ratchet over src/, read against Data/module-ledger.json. + + public sealed record CrossOwnerEdge( string From, string To, diff --git a/tests/Cluckwork.Application.Tests/Architecture/SeamSurfaceRealAssemblyTests.cs b/tests/Cluckwork.Application.Tests/Architecture/SeamSurfaceRealAssemblyTests.cs index e41d77f3b..8afd3e7f7 100644 --- a/tests/Cluckwork.Application.Tests/Architecture/SeamSurfaceRealAssemblyTests.cs +++ b/tests/Cluckwork.Application.Tests/Architecture/SeamSurfaceRealAssemblyTests.cs @@ -1,10 +1,10 @@ // #847 — the real-assembly gate; the mutation matrix reds here. -namespace Cluckwork.Application.Tests.Architecture; - using System.Reflection; using Cluckwork.Application.Common; +namespace Cluckwork.Application.Tests.Architecture; + public sealed class SeamSurfaceRealAssemblyTests { private static Assembly ApplicationAssembly => typeof(IRepository<,>).Assembly; diff --git a/tests/Cluckwork.Application.Tests/Architecture/SeamSurfaceScanner.cs b/tests/Cluckwork.Application.Tests/Architecture/SeamSurfaceScanner.cs index a4f4dbf1b..3f9fafc88 100644 --- a/tests/Cluckwork.Application.Tests/Architecture/SeamSurfaceScanner.cs +++ b/tests/Cluckwork.Application.Tests/Architecture/SeamSurfaceScanner.cs @@ -1,11 +1,11 @@ // #847 (epic #514 slice 5) — no persistence type crosses a module seam. -namespace Cluckwork.Application.Tests.Architecture; - using System.Reflection; using Cluckwork.Domain.Common; using Microsoft.EntityFrameworkCore; +namespace Cluckwork.Application.Tests.Architecture; + public sealed record SeamSurfaceViolation( string Interface, string Member, diff --git a/tests/Cluckwork.Application.Tests/Architecture/TableOwnerRealModelTests.cs b/tests/Cluckwork.Application.Tests/Architecture/TableOwnerRealModelTests.cs index b97d52c1a..428168b97 100644 --- a/tests/Cluckwork.Application.Tests/Architecture/TableOwnerRealModelTests.cs +++ b/tests/Cluckwork.Application.Tests/Architecture/TableOwnerRealModelTests.cs @@ -1,8 +1,8 @@ -namespace Cluckwork.Application.Tests.Architecture; - using Cluckwork.Infrastructure.Persistence; using Microsoft.EntityFrameworkCore; +namespace Cluckwork.Application.Tests.Architecture; + public sealed class TableOwnerRealModelTests { [Fact] diff --git a/tests/Cluckwork.Application.Tests/Architecture/TableOwnerScanner.cs b/tests/Cluckwork.Application.Tests/Architecture/TableOwnerScanner.cs index e52089dd4..0af1d4704 100644 --- a/tests/Cluckwork.Application.Tests/Architecture/TableOwnerScanner.cs +++ b/tests/Cluckwork.Application.Tests/Architecture/TableOwnerScanner.cs @@ -1,9 +1,9 @@ -namespace Cluckwork.Application.Tests.Architecture; - using System.Text.Json; using Microsoft.EntityFrameworkCore; using Microsoft.EntityFrameworkCore.Metadata; +namespace Cluckwork.Application.Tests.Architecture; + public sealed record CrossOwnerForeignKey(string Table, string Name, string From, string To); public sealed record TableOwnerReport( diff --git a/tests/Cluckwork.Application.Tests/Common/AuditVocabularyCoverageTests.cs b/tests/Cluckwork.Application.Tests/Common/AuditVocabularyCoverageTests.cs index 402e27802..ec9af2d56 100644 --- a/tests/Cluckwork.Application.Tests/Common/AuditVocabularyCoverageTests.cs +++ b/tests/Cluckwork.Application.Tests/Common/AuditVocabularyCoverageTests.cs @@ -1,10 +1,10 @@ -namespace Cluckwork.Application.Tests.Common; - using System.Reflection; using System.Text; using System.Text.RegularExpressions; using Cluckwork.Application.Common; +namespace Cluckwork.Application.Tests.Common; + // #258 root-cause fix (symptom fixed by #247): the SPA's audit-log action // filter and entity-type labels are driven by two hand-maintained lists in // web/src/i18n/enums.ts (AUDIT_ACTION_VALUES, ENTITY_TYPE_VALUES). Nothing diff --git a/tests/Cluckwork.Application.Tests/Common/FarmLocalDateRuleTests.cs b/tests/Cluckwork.Application.Tests/Common/FarmLocalDateRuleTests.cs index 28f4d649d..3603cc2d3 100644 --- a/tests/Cluckwork.Application.Tests/Common/FarmLocalDateRuleTests.cs +++ b/tests/Cluckwork.Application.Tests/Common/FarmLocalDateRuleTests.cs @@ -1,10 +1,10 @@ -namespace Cluckwork.Application.Tests.Common; - using Cluckwork.Application.Features.Expenses.AdjustExpense; using Cluckwork.Application.Features.Expenses.CreateExpense; using Cluckwork.Application.Features.Flocks.UpdateFlock; using Cluckwork.Application.Features.Sales.RecordPayment; +namespace Cluckwork.Application.Tests.Common; + // #155 — the four validators the sweep moved onto the farm clock that had no // unit tests of their own. Each one gets the same pair: the farm's today is // accepted, the day after it is not. The dates are measured against a fixed diff --git a/tests/Cluckwork.Application.Tests/Common/FixedFarmClock.cs b/tests/Cluckwork.Application.Tests/Common/FixedFarmClock.cs index 527c8cad8..6ae66392b 100644 --- a/tests/Cluckwork.Application.Tests/Common/FixedFarmClock.cs +++ b/tests/Cluckwork.Application.Tests/Common/FixedFarmClock.cs @@ -1,7 +1,7 @@ -namespace Cluckwork.Application.Tests.Common; - using Cluckwork.Application.Common; +namespace Cluckwork.Application.Tests.Common; + // A frozen farm-local "today" for the date-boundary rules (#35 / #155). Shared // so validator tests pin an explicit date instead of riding on the build // machine's clock — which also makes "today", "tomorrow" and "yesterday" mean diff --git a/tests/Cluckwork.Application.Tests/Customers/CustomerValidatorParityTests.cs b/tests/Cluckwork.Application.Tests/Customers/CustomerValidatorParityTests.cs index 4cf4e327b..e8b3f36ce 100644 --- a/tests/Cluckwork.Application.Tests/Customers/CustomerValidatorParityTests.cs +++ b/tests/Cluckwork.Application.Tests/Customers/CustomerValidatorParityTests.cs @@ -1,10 +1,10 @@ -namespace Cluckwork.Application.Tests.Customers; - using Cluckwork.Application.Features.Customers.CreateCustomer; using Cluckwork.Application.Features.Customers.UpdateCustomer; using Cluckwork.Domain.Sales; using FluentValidation.Results; +namespace Cluckwork.Application.Tests.Customers; + // #625 review round 2/3 — Create and Update accept the same five customer // fields, and the design's own invariant is that the update validator // "mirrors every field" the create validator covers. This walks every diff --git a/tests/Cluckwork.Application.Tests/Customers/UpdateCustomerHandlerTests.cs b/tests/Cluckwork.Application.Tests/Customers/UpdateCustomerHandlerTests.cs index 09932fcc5..455fdf226 100644 --- a/tests/Cluckwork.Application.Tests/Customers/UpdateCustomerHandlerTests.cs +++ b/tests/Cluckwork.Application.Tests/Customers/UpdateCustomerHandlerTests.cs @@ -1,10 +1,10 @@ -namespace Cluckwork.Application.Tests.Customers; - using Cluckwork.Application.Common; using Cluckwork.Application.Features.Customers; using Cluckwork.Application.Features.Customers.UpdateCustomer; using Cluckwork.Domain.Sales; +namespace Cluckwork.Application.Tests.Customers; + public sealed class UpdateCustomerHandlerTests { private sealed class FakeCustomerRepository : ICustomerRepository diff --git a/tests/Cluckwork.Application.Tests/Customers/UpdateCustomerValidatorTests.cs b/tests/Cluckwork.Application.Tests/Customers/UpdateCustomerValidatorTests.cs index d84a9b4f8..6abaacf2c 100644 --- a/tests/Cluckwork.Application.Tests/Customers/UpdateCustomerValidatorTests.cs +++ b/tests/Cluckwork.Application.Tests/Customers/UpdateCustomerValidatorTests.cs @@ -1,8 +1,8 @@ -namespace Cluckwork.Application.Tests.Customers; - using Cluckwork.Application.Features.Customers.UpdateCustomer; using Cluckwork.Domain.Sales; +namespace Cluckwork.Application.Tests.Customers; + public sealed class UpdateCustomerValidatorTests { private readonly UpdateCustomerValidator _validator = new(); diff --git a/tests/Cluckwork.Application.Tests/DailyEntries/RecordDailyEntryValidatorTests.cs b/tests/Cluckwork.Application.Tests/DailyEntries/RecordDailyEntryValidatorTests.cs index 0b69f16f0..bd2980863 100644 --- a/tests/Cluckwork.Application.Tests/DailyEntries/RecordDailyEntryValidatorTests.cs +++ b/tests/Cluckwork.Application.Tests/DailyEntries/RecordDailyEntryValidatorTests.cs @@ -1,8 +1,8 @@ -namespace Cluckwork.Application.Tests.DailyEntries; - using Cluckwork.Application.Features.DailyEntries.RecordDailyEntry; using Cluckwork.Application.Tests.Common; +namespace Cluckwork.Application.Tests.DailyEntries; + public sealed class RecordDailyEntryValidatorTests { // A fixed farm-local today, so the date rule is deterministic instead of diff --git a/tests/Cluckwork.Application.Tests/Documentation/RenameAccountDocsTests.cs b/tests/Cluckwork.Application.Tests/Documentation/RenameAccountDocsTests.cs index 3110fa4af..d51ea0851 100644 --- a/tests/Cluckwork.Application.Tests/Documentation/RenameAccountDocsTests.cs +++ b/tests/Cluckwork.Application.Tests/Documentation/RenameAccountDocsTests.cs @@ -1,10 +1,10 @@ -namespace Cluckwork.Application.Tests.Documentation; - using System.Reflection; using System.Text.RegularExpressions; using Cluckwork.Application.Common; using Cluckwork.Application.Tests.TenantBypass; +namespace Cluckwork.Application.Tests.Documentation; + // #732 — the rename's prose is not enforced by anything else, and review round 2 found // five separate places where it said something the shipped code does not do. Each // assertion below pins one of those corrected VALUES, so reverting any one of them is a diff --git a/tests/Cluckwork.Application.Tests/Documentation/TenancyDocsFreshnessTests.cs b/tests/Cluckwork.Application.Tests/Documentation/TenancyDocsFreshnessTests.cs index 5f6f9a42a..c9bbac08f 100644 --- a/tests/Cluckwork.Application.Tests/Documentation/TenancyDocsFreshnessTests.cs +++ b/tests/Cluckwork.Application.Tests/Documentation/TenancyDocsFreshnessTests.cs @@ -1,8 +1,8 @@ -namespace Cluckwork.Application.Tests.Documentation; - using System.Diagnostics; using System.Text.RegularExpressions; +namespace Cluckwork.Application.Tests.Documentation; + public sealed class TenancyDocsFreshnessTests { private static readonly Regex Stale = new( diff --git a/tests/Cluckwork.Application.Tests/EggGrades/LowStockFloorTests.cs b/tests/Cluckwork.Application.Tests/EggGrades/LowStockFloorTests.cs index 19af89d2e..8aa2bb03e 100644 --- a/tests/Cluckwork.Application.Tests/EggGrades/LowStockFloorTests.cs +++ b/tests/Cluckwork.Application.Tests/EggGrades/LowStockFloorTests.cs @@ -1,5 +1,3 @@ -namespace Cluckwork.Application.Tests.EggGrades; - using Cluckwork.Application.Common; using Cluckwork.Application.Features.EggGrades; using Cluckwork.Application.Features.EggGrades.CreateEggGrade; @@ -7,6 +5,8 @@ namespace Cluckwork.Application.Tests.EggGrades; using Cluckwork.Application.Features.EggLots; using Cluckwork.Domain.Accounts; +namespace Cluckwork.Application.Tests.EggGrades; + // #911 — the two rules the low-stock floor adds: who may move one, and what // "below the floor" measures. public sealed class LowStockFloorTests diff --git a/tests/Cluckwork.Application.Tests/EggLots/RecordEggLotMovementValidatorTests.cs b/tests/Cluckwork.Application.Tests/EggLots/RecordEggLotMovementValidatorTests.cs index 500514ae4..1a4559be5 100644 --- a/tests/Cluckwork.Application.Tests/EggLots/RecordEggLotMovementValidatorTests.cs +++ b/tests/Cluckwork.Application.Tests/EggLots/RecordEggLotMovementValidatorTests.cs @@ -1,7 +1,7 @@ -namespace Cluckwork.Application.Tests.EggLots; - using Cluckwork.Application.Features.EggLots.RecordEggLotMovement; +namespace Cluckwork.Application.Tests.EggLots; + public sealed class RecordEggLotMovementValidatorTests { private readonly RecordEggLotMovementValidator _validator = new(); diff --git a/tests/Cluckwork.Application.Tests/FlockScope/FlockScopeDiscoveryTests.cs b/tests/Cluckwork.Application.Tests/FlockScoping/FlockScopeDiscoveryTests.cs similarity index 99% rename from tests/Cluckwork.Application.Tests/FlockScope/FlockScopeDiscoveryTests.cs rename to tests/Cluckwork.Application.Tests/FlockScoping/FlockScopeDiscoveryTests.cs index 341f71f08..276ddb5be 100644 --- a/tests/Cluckwork.Application.Tests/FlockScope/FlockScopeDiscoveryTests.cs +++ b/tests/Cluckwork.Application.Tests/FlockScoping/FlockScopeDiscoveryTests.cs @@ -1,5 +1,3 @@ -namespace Cluckwork.Application.Tests.FlockScope; - using System.Linq.Expressions; using System.Reflection; using Cluckwork.Domain.Accounts; @@ -8,6 +6,8 @@ namespace Cluckwork.Application.Tests.FlockScope; using Microsoft.EntityFrameworkCore; using Microsoft.EntityFrameworkCore.Metadata; +namespace Cluckwork.Application.Tests.FlockScoping; + // #613 — derive flock-filter coverage from the EF model. A mapped scalar // FlockId is scoped by default; exclusions are deliberate and reviewable. public sealed class FlockScopeDiscoveryTests diff --git a/tests/Cluckwork.Application.Tests/FlockScope/FlockScopeGuardTests.cs b/tests/Cluckwork.Application.Tests/FlockScoping/FlockScopeGuardTests.cs similarity index 94% rename from tests/Cluckwork.Application.Tests/FlockScope/FlockScopeGuardTests.cs rename to tests/Cluckwork.Application.Tests/FlockScoping/FlockScopeGuardTests.cs index fe95f4609..b8a9880e2 100644 --- a/tests/Cluckwork.Application.Tests/FlockScope/FlockScopeGuardTests.cs +++ b/tests/Cluckwork.Application.Tests/FlockScoping/FlockScopeGuardTests.cs @@ -1,11 +1,11 @@ -namespace Cluckwork.Application.Tests.FlockScope; - using Cluckwork.Application.Common; using Cluckwork.Infrastructure.Identity; using Cluckwork.Infrastructure.Persistence; using Cluckwork.Infrastructure.Repositories; using Microsoft.EntityFrameworkCore; +namespace Cluckwork.Application.Tests.FlockScoping; + public sealed class FlockScopeGuardTests { [Fact] diff --git a/tests/Cluckwork.Application.Tests/Flocks/CreateFlockValidatorTests.cs b/tests/Cluckwork.Application.Tests/Flocks/CreateFlockValidatorTests.cs index c40b133c4..9c9a72e22 100644 --- a/tests/Cluckwork.Application.Tests/Flocks/CreateFlockValidatorTests.cs +++ b/tests/Cluckwork.Application.Tests/Flocks/CreateFlockValidatorTests.cs @@ -1,8 +1,8 @@ -namespace Cluckwork.Application.Tests.Flocks; - using Cluckwork.Application.Features.Flocks.CreateFlock; using Cluckwork.Application.Tests.Common; +namespace Cluckwork.Application.Tests.Flocks; + public sealed class CreateFlockValidatorTests { private static readonly DateOnly FarmToday = FixedFarmClock.Today; diff --git a/tests/Cluckwork.Application.Tests/Sales/ConfirmSaleValidatorTests.cs b/tests/Cluckwork.Application.Tests/Sales/ConfirmSaleValidatorTests.cs index dd5895efb..d0326cca4 100644 --- a/tests/Cluckwork.Application.Tests/Sales/ConfirmSaleValidatorTests.cs +++ b/tests/Cluckwork.Application.Tests/Sales/ConfirmSaleValidatorTests.cs @@ -1,8 +1,8 @@ -namespace Cluckwork.Application.Tests.Sales; - using Cluckwork.Application.Features.Sales.ConfirmSale; using Cluckwork.Domain.Sales; +namespace Cluckwork.Application.Tests.Sales; + // #721 — the boundary half of the discount rule. It exists so a malformed // confirm is a 400 before any lock is taken; the rules that decide whether a // reason is REQUIRED live on the aggregate, because the seeders reach Confirm diff --git a/tests/Cluckwork.Application.Tests/Sales/DiscountReasonVocabularyTests.cs b/tests/Cluckwork.Application.Tests/Sales/DiscountReasonVocabularyTests.cs index 1774606da..7be6b7869 100644 --- a/tests/Cluckwork.Application.Tests/Sales/DiscountReasonVocabularyTests.cs +++ b/tests/Cluckwork.Application.Tests/Sales/DiscountReasonVocabularyTests.cs @@ -1,8 +1,8 @@ -namespace Cluckwork.Application.Tests.Sales; - using System.Text.RegularExpressions; using Cluckwork.Domain.Sales; +namespace Cluckwork.Application.Tests.Sales; + // #721 — DiscountReasonCode is mirrored by hand into web/src/i18n/enums.ts's // DISCOUNT_REASON_VALUES, which is what the confirm dialog's picklist renders. // Nothing else couples them: the SPA's own enums.test.ts checks that every diff --git a/tests/Cluckwork.Application.Tests/Sales/SaleAllocationPlannerTests.cs b/tests/Cluckwork.Application.Tests/Sales/SaleAllocationPlannerTests.cs index 46864ceb3..f72569f1f 100644 --- a/tests/Cluckwork.Application.Tests/Sales/SaleAllocationPlannerTests.cs +++ b/tests/Cluckwork.Application.Tests/Sales/SaleAllocationPlannerTests.cs @@ -1,11 +1,11 @@ -namespace Cluckwork.Application.Tests.Sales; - using Cluckwork.Application.Features.Sales.ConfirmSale; using Cluckwork.Domain.Catalog; using Cluckwork.Domain.Common; using Cluckwork.Domain.Eggs; using Cluckwork.Domain.Sales; +namespace Cluckwork.Application.Tests.Sales; + // #612 — the pure whole-order FIFO planner. Never mutates a lot or the order; // ConfirmSaleHandler decides which candidate lot list to plan against and // applies the winning plan for real afterward. diff --git a/tests/Cluckwork.Application.Tests/Sales/TransactionDelegateShapeTests.cs b/tests/Cluckwork.Application.Tests/Sales/TransactionDelegateShapeTests.cs index 69e015831..97166a24c 100644 --- a/tests/Cluckwork.Application.Tests/Sales/TransactionDelegateShapeTests.cs +++ b/tests/Cluckwork.Application.Tests/Sales/TransactionDelegateShapeTests.cs @@ -1,11 +1,11 @@ -namespace Cluckwork.Application.Tests.Sales; - using System.Linq; using Cluckwork.Application.Tests.TenantBypass; using Microsoft.CodeAnalysis; using Microsoft.CodeAnalysis.CSharp; using Microsoft.CodeAnalysis.CSharp.Syntax; +namespace Cluckwork.Application.Tests.Sales; + // #743 — a syntax guard, not a behavioural one. The hazard: a handler that // calls unitOfWork.SaveChangesAsync(...) INSIDE its ExecuteInTransactionAsync // delegate (so an audit row can carry an EF-assigned id — AddOrderItemHandler diff --git a/tests/Cluckwork.Application.Tests/TenantBypass/AllowList.cs b/tests/Cluckwork.Application.Tests/TenantBypass/AllowList.cs index c92964041..4e628440a 100644 --- a/tests/Cluckwork.Application.Tests/TenantBypass/AllowList.cs +++ b/tests/Cluckwork.Application.Tests/TenantBypass/AllowList.cs @@ -1,8 +1,8 @@ -namespace Cluckwork.Application.Tests.TenantBypass; - using System.Text.Json; using System.Text.Json.Serialization; +namespace Cluckwork.Application.Tests.TenantBypass; + // #536 Part 1 — the allow-list. One committed, reviewable line per excused // bypass (design M5/M7): the exemption is a SEPARATE artifact from the code it // excuses, so a bypass and its exemption are never the same keystroke. diff --git a/tests/Cluckwork.Application.Tests/TenantBypass/GuardScanner.cs b/tests/Cluckwork.Application.Tests/TenantBypass/GuardScanner.cs index 9665c626d..b198603e2 100644 --- a/tests/Cluckwork.Application.Tests/TenantBypass/GuardScanner.cs +++ b/tests/Cluckwork.Application.Tests/TenantBypass/GuardScanner.cs @@ -1,9 +1,9 @@ -namespace Cluckwork.Application.Tests.TenantBypass; - using Microsoft.CodeAnalysis; using Microsoft.CodeAnalysis.CSharp; using Microsoft.CodeAnalysis.CSharp.Syntax; +namespace Cluckwork.Application.Tests.TenantBypass; + // #536 Part 1 — the scanner. Walks every .cs under src/ with Roslyn and // reports every tenant-bypass occurrence. A GREEN result from this scanner is // only as trustworthy as its inputs, so the false-green guards are part of the diff --git a/tests/Cluckwork.Application.Tests/TenantBypass/TenantBypassAllowListTests.cs b/tests/Cluckwork.Application.Tests/TenantBypass/TenantBypassAllowListTests.cs index 1ce181a2d..5e48f893a 100644 --- a/tests/Cluckwork.Application.Tests/TenantBypass/TenantBypassAllowListTests.cs +++ b/tests/Cluckwork.Application.Tests/TenantBypass/TenantBypassAllowListTests.cs @@ -1,8 +1,8 @@ -namespace Cluckwork.Application.Tests.TenantBypass; - using System.Text; using System.Text.Json; +namespace Cluckwork.Application.Tests.TenantBypass; + // #536 Part 1 — allow-list semantics. Each behaviour gets its OWN named // assertion against a temp source tree (never the repo), so the mutation // matrix (Task 5) can aim its mutants at exactly these tests, and a real-tree diff --git a/tests/Cluckwork.Application.Tests/TenantBypass/TenantBypassDiscoveryTests.cs b/tests/Cluckwork.Application.Tests/TenantBypass/TenantBypassDiscoveryTests.cs index 4f58db0c0..4b011d437 100644 --- a/tests/Cluckwork.Application.Tests/TenantBypass/TenantBypassDiscoveryTests.cs +++ b/tests/Cluckwork.Application.Tests/TenantBypass/TenantBypassDiscoveryTests.cs @@ -1,10 +1,10 @@ -namespace Cluckwork.Application.Tests.TenantBypass; - using Cluckwork.Domain.Accounts; using Cluckwork.Infrastructure.Identity; using Cluckwork.Infrastructure.Persistence; using Microsoft.EntityFrameworkCore; +namespace Cluckwork.Application.Tests.TenantBypass; + // #536 Part 1 — the discovery floor: the guard's banned surface is DERIVED from // the EF model (walk everything, exclude deliberately — docs/decisions/407-writing-a-guard.md), // never hand-recalled. This test pins the discovered filter-free set so a model diff --git a/tests/Cluckwork.Application.Tests/TenantBypass/TenantBypassRealTreeTests.cs b/tests/Cluckwork.Application.Tests/TenantBypass/TenantBypassRealTreeTests.cs index 271d45258..b5805d6b0 100644 --- a/tests/Cluckwork.Application.Tests/TenantBypass/TenantBypassRealTreeTests.cs +++ b/tests/Cluckwork.Application.Tests/TenantBypass/TenantBypassRealTreeTests.cs @@ -1,9 +1,9 @@ -namespace Cluckwork.Application.Tests.TenantBypass; - using Cluckwork.Infrastructure.Identity; using Cluckwork.Infrastructure.Persistence; using Microsoft.EntityFrameworkCore; +namespace Cluckwork.Application.Tests.TenantBypass; + // #536 Part 1 — the real-tree gate. This is the guard that runs in the // pre-commit hook and CI: it scans the ACTUAL src/ tree, and fails the build // when any bypass is not on the committed allow-list (with a justification), diff --git a/tests/Cluckwork.Application.Tests/TenantBypass/TenantBypassWalkTests.cs b/tests/Cluckwork.Application.Tests/TenantBypass/TenantBypassWalkTests.cs index 07b585310..b5607ea9c 100644 --- a/tests/Cluckwork.Application.Tests/TenantBypass/TenantBypassWalkTests.cs +++ b/tests/Cluckwork.Application.Tests/TenantBypass/TenantBypassWalkTests.cs @@ -1,8 +1,8 @@ -namespace Cluckwork.Application.Tests.TenantBypass; - using Cluckwork.Infrastructure.Persistence; using Microsoft.EntityFrameworkCore; +namespace Cluckwork.Application.Tests.TenantBypass; + // #536 Part 1 — the walk. These tests prove the scanner actually sees the // tree (a zero-occurrence result is a scan failure, not a clean bill — review // M2), and they pin the current occurrence baseline so a future shrink of the diff --git a/tests/Cluckwork.Application.Tests/Validation/PasswordMaxLengthValidatorTests.cs b/tests/Cluckwork.Application.Tests/Validation/PasswordMaxLengthValidatorTests.cs index f10c6156d..dbccdb5b6 100644 --- a/tests/Cluckwork.Application.Tests/Validation/PasswordMaxLengthValidatorTests.cs +++ b/tests/Cluckwork.Application.Tests/Validation/PasswordMaxLengthValidatorTests.cs @@ -1,10 +1,10 @@ -namespace Cluckwork.Application.Tests.Validation; - using Cluckwork.Application.Features.Users; using Cluckwork.Application.Features.Users.ChangeOwnPassword; using Cluckwork.Application.Features.Users.CreateUser; using Cluckwork.Application.Features.Users.SetUserPassword; +namespace Cluckwork.Application.Tests.Validation; + // #309 — every credential validator caps its password field at // PasswordRules.MaxLength so an attacker-controlled oversized password can't be // pushed into the PBKDF2 hasher. A password ONE char over the cap must fail with diff --git a/tests/Cluckwork.Application.Tests/Validation/ValidatorErrorCodeCoverageTests.cs b/tests/Cluckwork.Application.Tests/Validation/ValidatorErrorCodeCoverageTests.cs index 14ff12e59..3124d5dc8 100644 --- a/tests/Cluckwork.Application.Tests/Validation/ValidatorErrorCodeCoverageTests.cs +++ b/tests/Cluckwork.Application.Tests/Validation/ValidatorErrorCodeCoverageTests.cs @@ -1,5 +1,3 @@ -namespace Cluckwork.Application.Tests.Validation; - using System.Reflection; using Cluckwork.Application.Common; using Cluckwork.Application.Features.DailyEntries.RecordDailyEntry; @@ -7,6 +5,8 @@ namespace Cluckwork.Application.Tests.Validation; using FluentValidation; using FluentValidation.Validators; +namespace Cluckwork.Application.Tests.Validation; + // #231 — every validation rule must carry an EXPLICIT error code (one that // contains a '.'), the same discriminator ValidationResponse (#45) uses to tell // an assigned `Feature.Field.Rule` code from a FluentValidation built-in default diff --git a/tests/Cluckwork.Domain.Tests/Accounts/AccountSettingsTests.cs b/tests/Cluckwork.Domain.Tests/Accounts/AccountSettingsTests.cs index ca176ef98..0c329ab03 100644 --- a/tests/Cluckwork.Domain.Tests/Accounts/AccountSettingsTests.cs +++ b/tests/Cluckwork.Domain.Tests/Accounts/AccountSettingsTests.cs @@ -1,10 +1,10 @@ -namespace Cluckwork.Domain.Tests.Accounts; - using Cluckwork.Domain.Accounts; using Cluckwork.Domain.Catalog; using Cluckwork.Domain.Common; using Cluckwork.Domain.Sales; +namespace Cluckwork.Domain.Tests.Accounts; + // #123 — the settings block and the two rules that guard it: §4.6's currency // lock and the derivation that runs when the lock is open. public sealed class AccountSettingsTests diff --git a/tests/Cluckwork.Domain.Tests/Accounts/AccountSlugTests.cs b/tests/Cluckwork.Domain.Tests/Accounts/AccountSlugTests.cs index fd425a83d..76853783a 100644 --- a/tests/Cluckwork.Domain.Tests/Accounts/AccountSlugTests.cs +++ b/tests/Cluckwork.Domain.Tests/Accounts/AccountSlugTests.cs @@ -1,7 +1,7 @@ -namespace Cluckwork.Domain.Tests.Accounts; - using Cluckwork.Domain.Accounts; +namespace Cluckwork.Domain.Tests.Accounts; + // #531 — the farm code and the suspend/reactivate lifecycle. Slug validity is an // INVARIANT (Account.Create throws, like Flock.Create), not a Result failure; // each rejection below is a distinct guard the migration/login work downstream diff --git a/tests/Cluckwork.Domain.Tests/Accounts/CurrencyCatalogTests.cs b/tests/Cluckwork.Domain.Tests/Accounts/CurrencyCatalogTests.cs index 251034167..58d44b315 100644 --- a/tests/Cluckwork.Domain.Tests/Accounts/CurrencyCatalogTests.cs +++ b/tests/Cluckwork.Domain.Tests/Accounts/CurrencyCatalogTests.cs @@ -1,7 +1,7 @@ -namespace Cluckwork.Domain.Tests.Accounts; - using Cluckwork.Domain.Accounts; +namespace Cluckwork.Domain.Tests.Accounts; + // §4.6 currency derivation. The minor unit follows ISO 4217, NOT the locale's // display habit — it decides how a stored integer amount is read back, so a // wrong one misstates every amount on the farm by a factor of 100. diff --git a/tests/Cluckwork.Domain.Tests/Accounts/FarmLogoTests.cs b/tests/Cluckwork.Domain.Tests/Accounts/FarmLogoTests.cs index 65dcf14cd..942d3aa80 100644 --- a/tests/Cluckwork.Domain.Tests/Accounts/FarmLogoTests.cs +++ b/tests/Cluckwork.Domain.Tests/Accounts/FarmLogoTests.cs @@ -1,8 +1,8 @@ -namespace Cluckwork.Domain.Tests.Accounts; - using Cluckwork.Domain.Accounts; using Cluckwork.Domain.Media; +namespace Cluckwork.Domain.Tests.Accounts; + // #179 — the farm banner shares FarmLogo's row (see FarmLogo.cs for why: two // independent branding images, one shared Version token, accepted as a rare // false-conflict rather than a second table). These tests cover what's new — diff --git a/tests/Cluckwork.Domain.Tests/Accounts/RolesTests.cs b/tests/Cluckwork.Domain.Tests/Accounts/RolesTests.cs index 46e74ed4f..2fcc1b2b4 100644 --- a/tests/Cluckwork.Domain.Tests/Accounts/RolesTests.cs +++ b/tests/Cluckwork.Domain.Tests/Accounts/RolesTests.cs @@ -1,7 +1,7 @@ -namespace Cluckwork.Domain.Tests.Accounts; - using Cluckwork.Domain.Accounts; +namespace Cluckwork.Domain.Tests.Accounts; + // #612 — the one effective-role resolver FlockScopeGuard/Middleware and // assignment admission all share, so "which roles are Worker-scoped" has one // answer. Precedence matches AuthPolicies.EffectiveRole (route policies are a diff --git a/tests/Cluckwork.Domain.Tests/Common/MoneyTests.cs b/tests/Cluckwork.Domain.Tests/Common/MoneyTests.cs index acb188e19..263b7efd2 100644 --- a/tests/Cluckwork.Domain.Tests/Common/MoneyTests.cs +++ b/tests/Cluckwork.Domain.Tests/Common/MoneyTests.cs @@ -1,7 +1,7 @@ -namespace Cluckwork.Domain.Tests.Common; - using Cluckwork.Domain.Common; +namespace Cluckwork.Domain.Tests.Common; + public sealed class MoneyTests { [Fact] diff --git a/tests/Cluckwork.Domain.Tests/Eggs/DailyEntryTests.cs b/tests/Cluckwork.Domain.Tests/Eggs/DailyEntryTests.cs index 857873321..79be0ae12 100644 --- a/tests/Cluckwork.Domain.Tests/Eggs/DailyEntryTests.cs +++ b/tests/Cluckwork.Domain.Tests/Eggs/DailyEntryTests.cs @@ -1,7 +1,7 @@ -namespace Cluckwork.Domain.Tests.Eggs; - using Cluckwork.Domain.Eggs; +namespace Cluckwork.Domain.Tests.Eggs; + public sealed class DailyEntryTests { private static DailyEntry MakeDraft() => diff --git a/tests/Cluckwork.Domain.Tests/Eggs/EggGradeDefaultsTests.cs b/tests/Cluckwork.Domain.Tests/Eggs/EggGradeDefaultsTests.cs index 29ebb5624..74c769f0d 100644 --- a/tests/Cluckwork.Domain.Tests/Eggs/EggGradeDefaultsTests.cs +++ b/tests/Cluckwork.Domain.Tests/Eggs/EggGradeDefaultsTests.cs @@ -1,7 +1,7 @@ -namespace Cluckwork.Domain.Tests.Eggs; - using Cluckwork.Domain.Eggs; +namespace Cluckwork.Domain.Tests.Eggs; + public sealed class EggGradeDefaultsTests { [Fact] diff --git a/tests/Cluckwork.Domain.Tests/Eggs/EggGradeTests.cs b/tests/Cluckwork.Domain.Tests/Eggs/EggGradeTests.cs index 158515601..2cf818adb 100644 --- a/tests/Cluckwork.Domain.Tests/Eggs/EggGradeTests.cs +++ b/tests/Cluckwork.Domain.Tests/Eggs/EggGradeTests.cs @@ -1,7 +1,7 @@ -namespace Cluckwork.Domain.Tests.Eggs; - using Cluckwork.Domain.Eggs; +namespace Cluckwork.Domain.Tests.Eggs; + // #396 — a Daily Entry's Cracked and Dirty counters feed a specific grade, and // which grade that is must survive the farm renaming it. `DailyEntryKind` is // that stable binding: an identity the code can resolve, as opposed to matching diff --git a/tests/Cluckwork.Domain.Tests/Eggs/EggLotTests.cs b/tests/Cluckwork.Domain.Tests/Eggs/EggLotTests.cs index 09775e726..4a18645f2 100644 --- a/tests/Cluckwork.Domain.Tests/Eggs/EggLotTests.cs +++ b/tests/Cluckwork.Domain.Tests/Eggs/EggLotTests.cs @@ -1,7 +1,7 @@ -namespace Cluckwork.Domain.Tests.Eggs; - using Cluckwork.Domain.Eggs; +namespace Cluckwork.Domain.Tests.Eggs; + public sealed class EggLotTests { private static EggLot MakeLot(int quantity = 100) => diff --git a/tests/Cluckwork.Domain.Tests/Expenses/ExpenseTests.cs b/tests/Cluckwork.Domain.Tests/Expenses/ExpenseTests.cs index ea5a6bc55..73839e88d 100644 --- a/tests/Cluckwork.Domain.Tests/Expenses/ExpenseTests.cs +++ b/tests/Cluckwork.Domain.Tests/Expenses/ExpenseTests.cs @@ -1,7 +1,7 @@ -namespace Cluckwork.Domain.Tests.Expenses; - using Cluckwork.Domain.Expenses; +namespace Cluckwork.Domain.Tests.Expenses; + public sealed class ExpenseTests { private static readonly DateOnly Today = DateOnly.FromDateTime(DateTime.Today); diff --git a/tests/Cluckwork.Domain.Tests/Flocks/FlockTests.cs b/tests/Cluckwork.Domain.Tests/Flocks/FlockTests.cs index 35e925ab3..1acd0e2b5 100644 --- a/tests/Cluckwork.Domain.Tests/Flocks/FlockTests.cs +++ b/tests/Cluckwork.Domain.Tests/Flocks/FlockTests.cs @@ -1,7 +1,7 @@ -namespace Cluckwork.Domain.Tests.Flocks; - using Cluckwork.Domain.Flocks; +namespace Cluckwork.Domain.Tests.Flocks; + public sealed class FlockTests { private static Flock Make() => Flock.Create( diff --git a/tests/Cluckwork.Domain.Tests/Inventory/InventoryTests.cs b/tests/Cluckwork.Domain.Tests/Inventory/InventoryTests.cs index bba714a0a..1c2402db5 100644 --- a/tests/Cluckwork.Domain.Tests/Inventory/InventoryTests.cs +++ b/tests/Cluckwork.Domain.Tests/Inventory/InventoryTests.cs @@ -1,8 +1,8 @@ -namespace Cluckwork.Domain.Tests.Inventory; - using Cluckwork.Domain.Common; using Cluckwork.Domain.Inventory; +namespace Cluckwork.Domain.Tests.Inventory; + public sealed class InventoryTests { private static readonly Money Cost = new(2500, "USD", 2); diff --git a/tests/Cluckwork.Domain.Tests/Media/ImageSanitizerTests.cs b/tests/Cluckwork.Domain.Tests/Media/ImageSanitizerTests.cs index 82649060a..bf0dec5a7 100644 --- a/tests/Cluckwork.Domain.Tests/Media/ImageSanitizerTests.cs +++ b/tests/Cluckwork.Domain.Tests/Media/ImageSanitizerTests.cs @@ -1,9 +1,9 @@ -namespace Cluckwork.Domain.Tests.Media; - using System.Buffers.Binary; using System.Text; using Cluckwork.Domain.Media; +namespace Cluckwork.Domain.Tests.Media; + // #123 — what a farm logo upload is allowed to be. // // The fixtures are built byte by byte rather than checked in as files, because diff --git a/tests/Cluckwork.Domain.Tests/Sales/CustomerTests.cs b/tests/Cluckwork.Domain.Tests/Sales/CustomerTests.cs index 564d97969..bf7157cbe 100644 --- a/tests/Cluckwork.Domain.Tests/Sales/CustomerTests.cs +++ b/tests/Cluckwork.Domain.Tests/Sales/CustomerTests.cs @@ -1,7 +1,7 @@ -namespace Cluckwork.Domain.Tests.Sales; - using Cluckwork.Domain.Sales; +namespace Cluckwork.Domain.Tests.Sales; + public sealed class CustomerTests { private static Customer Make() => diff --git a/tests/Cluckwork.Domain.Tests/Sales/DiscountCeilingTests.cs b/tests/Cluckwork.Domain.Tests/Sales/DiscountCeilingTests.cs index e5f110d8c..8b7a838ea 100644 --- a/tests/Cluckwork.Domain.Tests/Sales/DiscountCeilingTests.cs +++ b/tests/Cluckwork.Domain.Tests/Sales/DiscountCeilingTests.cs @@ -1,8 +1,8 @@ -namespace Cluckwork.Domain.Tests.Sales; - using System.Globalization; using Cluckwork.Domain.Sales; +namespace Cluckwork.Domain.Tests.Sales; + // #727 — the shared vector set. These exact numbers are the table the SPA's own // TypeScript mirror is held to, so the two implementations cannot disagree // about the boundary; change a row here and the mirror changes with it. diff --git a/tests/Cluckwork.Domain.Tests/Sales/PaymentTests.cs b/tests/Cluckwork.Domain.Tests/Sales/PaymentTests.cs index 34810e618..2bf18ac73 100644 --- a/tests/Cluckwork.Domain.Tests/Sales/PaymentTests.cs +++ b/tests/Cluckwork.Domain.Tests/Sales/PaymentTests.cs @@ -1,7 +1,7 @@ -namespace Cluckwork.Domain.Tests.Sales; - using Cluckwork.Domain.Sales; +namespace Cluckwork.Domain.Tests.Sales; + public sealed class PaymentTests { private static readonly DateOnly Today = DateOnly.FromDateTime(DateTime.Today); diff --git a/tests/Cluckwork.Domain.Tests/Sales/SalesOrderCeilingTests.cs b/tests/Cluckwork.Domain.Tests/Sales/SalesOrderCeilingTests.cs index 7159822f0..d7e05a17b 100644 --- a/tests/Cluckwork.Domain.Tests/Sales/SalesOrderCeilingTests.cs +++ b/tests/Cluckwork.Domain.Tests/Sales/SalesOrderCeilingTests.cs @@ -1,10 +1,10 @@ -namespace Cluckwork.Domain.Tests.Sales; - using System.Reflection; using Cluckwork.Domain.Catalog; using Cluckwork.Domain.Common; using Cluckwork.Domain.Sales; +namespace Cluckwork.Domain.Tests.Sales; + // #727 — the pure aggregate query. Driven entirely through FindCeilingBreach, // the public surface ConfirmSaleHandler actually calls, so the basis routing is // asserted as a caller observes it. diff --git a/tests/Cluckwork.Domain.Tests/Sales/SalesOrderDiscountReasonTests.cs b/tests/Cluckwork.Domain.Tests/Sales/SalesOrderDiscountReasonTests.cs index 6303901ad..b58249ad1 100644 --- a/tests/Cluckwork.Domain.Tests/Sales/SalesOrderDiscountReasonTests.cs +++ b/tests/Cluckwork.Domain.Tests/Sales/SalesOrderDiscountReasonTests.cs @@ -1,9 +1,9 @@ -namespace Cluckwork.Domain.Tests.Sales; - using Cluckwork.Domain.Catalog; using Cluckwork.Domain.Common; using Cluckwork.Domain.Sales; +namespace Cluckwork.Domain.Tests.Sales; + // #721 — the discount-reason rule lives on the aggregate, not in a validator, // because the seeders reach Confirm through the handler and never see one // (#394). These tests cover the ORDER of the checks as well as each one: the diff --git a/tests/Cluckwork.Domain.Tests/Sales/SalesOrderTests.cs b/tests/Cluckwork.Domain.Tests/Sales/SalesOrderTests.cs index fa6af528b..4e653c951 100644 --- a/tests/Cluckwork.Domain.Tests/Sales/SalesOrderTests.cs +++ b/tests/Cluckwork.Domain.Tests/Sales/SalesOrderTests.cs @@ -1,9 +1,9 @@ -namespace Cluckwork.Domain.Tests.Sales; - using Cluckwork.Domain.Common; using Cluckwork.Domain.Catalog; using Cluckwork.Domain.Sales; +namespace Cluckwork.Domain.Tests.Sales; + public sealed class SalesOrderTests { private static SalesOrder MakeDraft() => SalesOrder.Create( diff --git a/tools/style/move-usings-outside.py b/tools/style/move-usings-outside.py new file mode 100644 index 000000000..acb8766af --- /dev/null +++ b/tools/style/move-usings-outside.py @@ -0,0 +1,82 @@ +#!/usr/bin/env python3 +"""One-shot conversion for #985: move `using` directives from inside a +file-scoped namespace to above it, which is the C# default placement. + +Committed so a reviewer can rerun this and diff the result, rather than +reading 590 mechanical file changes by hand. + +A file with usings in both places is not ambiguous: the inside group joins the +outside one, in original order. Skipped deliberately, never guessed at: any +file with no file-scoped namespace, which covers the two multi-namespace guard +fixtures and every EF migration, since those already place usings outside. + +`dotnet format style --diagnostics IDE0065 IDE0161 --severity warn` +does the same job one project at a time and is the supported route for new +code. This exists to make one 590-file diff re-derivable in a single command. + +Usage: python3 tools/style/move-usings-outside.py $(git ls-files '*.cs') +""" +import pathlib +import re +import sys + +FILE_SCOPED = re.compile(r'^namespace [^{]*;\s*$') +USING = re.compile(r'^using [A-Za-z@]') + + +def collapse_seam(lines, at): + """Collapse the run of blanks just after `at` to a single blank line. + + Scoped to the seam the move opens up. A global pass would also delete + pre-existing double blanks elsewhere, which is churn this change has no + business making. + """ + k = at + 1 + while k < len(lines) and not lines[k].strip(): + k += 1 + if k > at + 2: + return lines[:at + 1] + [''] + lines[k:] + return lines + + +def convert(path): + lines = pathlib.Path(path).read_text(encoding='utf-8').split('\n') + ns = next((i for i, l in enumerate(lines) if FILE_SCOPED.match(l)), None) + if ns is None: + return False + inside = [i for i, l in enumerate(lines[ns + 1:], ns + 1) if USING.match(l)] + if not inside: + return False + # A comment touching a using with no blank line between them annotates that + # using; it has to travel with it or it ends up explaining nothing. + for i in list(inside): + j = i - 1 + while j > ns and lines[j].lstrip().startswith('//') and j not in inside: + inside.append(j) + j -= 1 + inside.sort() + outside = [i for i, l in enumerate(lines[:ns]) if USING.match(l)] + moved = [lines[i] for i in inside] + rest = [l for i, l in enumerate(lines) if i not in set(inside)] + if outside: + at = next(i for i, l in enumerate(rest) if FILE_SCOPED.match(l)) + last = max(i for i, l in enumerate(rest) if USING.match(l) and i < at) + rest = rest[:last + 1] + moved + rest[last + 1:] + at = next(i for i, l in enumerate(rest) if FILE_SCOPED.match(l)) + pathlib.Path(path).write_text( + '\n'.join(collapse_seam(rest, at)), encoding='utf-8') + return True + at = next(i for i, l in enumerate(rest) if FILE_SCOPED.match(l)) + head = rest[:at] + while head and not head[-1].strip(): + head.pop() + tail = collapse_seam(rest[at:], 0) + out = head + ([''] if head else []) + moved + [''] + tail + while len(out) > 1 and not out[0].strip(): + out.pop(0) + pathlib.Path(path).write_text('\n'.join(out), encoding='utf-8') + return True + + +if __name__ == '__main__': + print(sum(convert(f) for f in sys.argv[1:]), 'files converted')