↑↓ to navigate Enter to open "…" all these words ANDOR to combine

Architecture Decision Record

ADR-034: Generic Entity Controllers with a Dynamic Query Contract

Status

Accepted (2026-06-30). Amended (2026-07-23): the filter strategy registry now also covers long/long? via LongFilterStrategy. Amended (2026-07-25): the keyed by-id fast path is named TryGetFastPathIncludes in code; citations rebased. Extended by ADR-099 (2026-08-29, v1.170.0): the write half this record left at create and delete gains a generic update, through an IEntityUpdateCommandApplier the module implements, an UpdateEntityCommand / UpdateEntityHandler pair, an AddEntityCrud registration for all three verbs, and a CrudEntityControllerBase carrying the PUT. The PUT ships on a new derived base rather than on AggregateRootEntityControllerBase, whose generic arity is deliberately unchanged; everything below is untouched. Revised (2026-08-31): the update-applier interface is named IEntityUpdateCommandApplier (Source/Core/MMCA.Common.Application/UseCases/Crud/IEntityUpdateCommandApplier.cs:38); source citations below rebased to their current lines. Revised 2026-09-07 (sort keys, filter keys and lookup name columns resolve against the response contract rather than the entity, navigation depth and lookup rows are capped, and the selector cache is bounded). Revised 2026-10-21: the generic create now builds its Location itself and returns Created rather than CreatedAtRoute, the filter registry also covers the Email value object, and the fail-closed CSV export is recorded among the virtual reads; anchors refreshed. Revised 2026-10-26: anchors refreshed after the create's Location and Created lines and the delete action in AggregateRootEntityControllerBase.cs moved up one line. Revised 2026-10-28: eight filter strategies (seven built-in primitive strategies plus the strongly typed identifier) implement CanParseValue, not six; EmailFilterStrategy takes the default. Revised 2026-11-23: the read base also declares two opt-in GET routes, a keyset cursor page and a changes feed, both virtual and clamped to MaxPageSize; anchors refreshed. Revised 2026-11-30 (v1.324.0): an IN filter with an unparseable item and a request with more than MaxFilters (50) filters are validation errors (400) instead of a silently narrowed or widened result; QueryFilterService.RegisterStrategy and its mutable registry are removed; PagingMath.Clamp returns a PageWindow; a list read with a specification takes the specification's ordering as its default when the request names no sort, and the request's sort and paging win otherwise (the repository side is ADR-055's). System.Linq.Dynamic.Core stays, deliberately. See the Revision (2026-11-30) at the end.

Context

Every module exposes many entities, and most of them need the same read and write surface: list, page, look up for a dropdown, fetch by id, create, delete. Hand writing a controller, a query service, and a filter/sort/paginate implementation per entity is repetitive, drifts in shape from one entity to the next, and is the bulk of the boilerplate a modular monolith accumulates as it grows.

The framework chose the opposite default: a generic resource layer plus an OData-lite dynamic query contract that every entity inherits for free, rather than bespoke per-entity endpoints. A concrete controller is a few lines that close the generic type parameters; the verbs, routes, filtering, sorting, pagination, field projection, and include behavior come from the base. The mechanics are documented in the onboarding chapters; the trade-off this represents (a generic, dynamically queryable contract coupled to the entity model versus narrow bespoke endpoints) was never recorded as a decision.

Decision

Give every entity a generic REST resource surface and a bounded dynamic query contract, supplied by two controller bases over a shared query pipeline.

  1. Generic read controller. EntityControllerBase<TEntity, TEntityDTO, TIdentifierType> (Source/Presentation/MMCA.Common.API/Controllers/EntityControllerBase.cs:33, [ApiController] / [Route("[controller]")] / [ApiVersion("1.0")] at EntityControllerBase.cs:30-32) exposes four core GET routes for any entity (plus a [HttpGet("export")] CSV action at EntityControllerBase.cs:253, between the paged and lookup routes): [HttpGet] list (EntityControllerBase.cs:106), [HttpGet("paged")] (EntityControllerBase.cs:153), [HttpGet("lookup")] for id/name dropdown entries (EntityControllerBase.cs:318), and [HttpGet("{id}")] (EntityControllerBase.cs:357). Two further GET routes are declared on the base but are opt-in through [OptInAction]: [HttpGet("cursor")] (EntityControllerBase.cs:403, gated on SupportsCursorPagingAttribute at :404), a keyset page ordered by the sort column with Id as tie-break, and [HttpGet("changes")] (EntityControllerBase.cs:456, gated on SupportsChangeFeedAttribute at :457), a change feed of upserts and tombstones ordered by (LastModifiedOn, Id). Both clamp the page size to MaxPageSize (:419, :467) and are scoped by GetReadSpecificationAsync; the cursor read takes no filters, field projection or includes and emits no pagination header (remarks at :398-402).

  2. Generic write controller. AggregateRootEntityControllerBase<TEntity, TEntityDTO, TIdentifierType, TCreateRequest> (Source/Presentation/MMCA.Common.API/Controllers/AggregateRootEntityControllerBase.cs:29) inherits all of the above and adds [HttpPost] create (AggregateRootEntityControllerBase.cs:75) and [HttpDelete("{id}")] (AggregateRootEntityControllerBase.cs:106). The create returns 201 through Created(location, created) (AggregateRootEntityControllerBase.cs:97), with the Location resolved before the result is returned: Url.Link(GetByIdRouteName, ...) when the named route resolves (:93, GetByIdRouteName defaulting to Get{EntityName}ById at :57), otherwise the new id appended to the collection path the POST was made to (:95). The create action is decorated with [Idempotent] (AggregateRootEntityControllerBase.cs:76) so a retried POST does not create a duplicate (ADR-017).

  3. Sparse fieldsets via fields. A comma-separated fields query parameter (EntityControllerBase.cs:110, :162, :366) drives a server-side projection: QueryFieldService.ApplyFieldSelection (Source/Core/MMCA.Common.Application/Services/QueryFieldService.cs:290) builds a MemberInit expression that selects only the requested writable properties (QueryFieldService.cs:358) so only those columns leave the database. The compiled projections are cached per field set, capped at MaxCacheEntries 512 (QueryFieldService.cs:39); once the cache is full, a new field set skips the server-side projection (QueryFieldService.cs:310-318) and the response is still trimmed to the requested fields.

  4. Dynamic per-type filtering. The paged route binds Dictionary<string, (string Operator, string Value)> filters through [ModelBinder(typeof(QueryFilterModelBinder))] (EntityControllerBase.cs:165), which parses filters[Property].operator / filters[Property].value query keys (Source/Presentation/MMCA.Common.API/ModelBinders/QueryFilterModelBinder.cs:24). QueryFilterService.ApplyFilters (Source/Core/MMCA.Common.Application/Services/Filtering/QueryFilterService.cs:82, with a second overload at :103) resolves a IFilterStrategy (Source/Core/MMCA.Common.Application/Services/Filtering/IFilterStrategy.cs:6) per property CLR type from a strategy registry (string, bool, int, long, DateTime, decimal, Guid and their nullables, plus the Email value object through EmailFilterStrategy; declared at QueryFilterService.cs:34, entries at :37-50), each strategy declaring its SupportedOperators (IFilterStrategy.cs:24). Extra types register via QueryFilterService.RegisterStrategy (QueryFilterService.cs:66; removed by the Revision (2026-11-30): the built-in map is frozen and no extra type registers); a strongly typed identifier column (ADR-115) needs no registration, because ResolveStrategy (QueryFilterService.cs:413) builds a StronglyTypedIdFilterStrategy on first use (:421) and memoizes it beside the built-ins.

  5. Sort. sortColumn / sortDirection (EntityControllerBase.cs:160-161) feed QueryFieldService.ApplySorting (QueryFieldService.cs:162, second overload at :191), an OrderBy("<col> ascending|descending") over the entity property the DTO name maps to.

  6. Pagination and the X-Pagination header. The paged route clamps the requested page size with Math.Min(pageSize, MaxPageSize) (EntityControllerBase.cs:168), where MaxPageSize resolves IOptions<ApplicationSettings> from the request's services and falls back to 500 (EntityControllerBase.cs:58, resolution at :62, default at Source/Core/MMCA.Common.Application/Settings/ApplicationSettings.cs:17), then clamps the configured value to between 1 and EntityQueryPipeline.MaxUnboundedResultLimit (EntityControllerBase.cs:63), so configuration cannot raise the page size above the pipeline ceiling. It is read per request rather than captured in the constructor so a configuration change takes effect without a restart. The pagination metadata is serialized into the X-Pagination response header by Response.AppendPaginationHeader (EntityControllerBase.cs:187; header name at Source/Presentation/MMCA.Common.API/Pagination/PaginationHeaderExtensions.cs:17).

  7. A last-resort safety ceiling. Independent of the API page-size clamp, EntityQueryPipeline.MaxUnboundedResultLimit = 1000 (Source/Core/MMCA.Common.Application/Services/Query/EntityQueryPipeline.cs:23) caps any unpaginated query with query.Take(MaxUnboundedResultLimit), at three call sites (EntityQueryPipeline.cs:99, :195, :250), and ApplyPaging clamps a paged request to the same limit (EntityQueryPipeline.cs:278-281), so even a direct service caller that omits pagination cannot trigger an unbounded full-table load.

  8. Two include paths. includeFKs / includeChildren (EntityControllerBase.cs:111-112 for the list overload, :158-159 for the paged overload) select navigation loading. EntityQueryPipeline (EntityQueryPipeline.cs:13) runs PATH 1 for source-supported includes via EF Core .Include() translated to SQL (EntityQueryPipeline.cs:129-135) and PATH 2 for unsupported includes via manual INavigationPopulator batch loading after materialization (EntityQueryPipeline.cs:50), the populator strategy of ADR-002.

Rationale

  • Write the resource surface once, inherit it everywhere. The verbs, routes, filter contract, pagination, and header are defined once on the two bases; a concrete controller closes the type parameters and gets a uniform, predictable contract. New entities cost almost nothing and cannot drift in shape.
  • Bounded dynamic querying, not open SQL. Filtering is dynamic over the wire but not unbounded in the engine: each property is filtered only by a registered IFilterStrategy whose SupportedOperators are validated before the database is touched (QueryFilterService.ValidateFilters, QueryFilterService.cs:167 and :183, invoked at Source/Core/MMCA.Common.Application/Services/EntityQueryService.cs:304), and MaxUnboundedResultLimit (EntityQueryPipeline.cs:23) plus the MaxPageSize clamp (EntityControllerBase.cs:168) bound the result size.
  • Composes with manual DTO mapping (ADR-001). Entities are projected to DTOs by an injected IEntityDTOMapper (EntityQueryService.cs:36, property at :91) via DTOMapper.MapToDTOs (EntityQueryService.cs:361); a DTOToEntityPropertyMap (EntityQueryService.cs:101) translates DTO field names to entity property paths for filter and sort, so the wire contract speaks DTO names while the engine speaks entity names.
  • Composes with populators (ADR-002). The unsupported-include path delegates to INavigationPopulator (EntityQueryService.cs:37), the same cross-source batch loader that bridges relationships EF cannot JOIN.

Trade-offs

  • The wire contract tracks the entity model. Filterable, sortable, and projectable surface is the entity's property set. A model change is an API change unless mediated by the DTO and DTOToEntityPropertyMap (EntityQueryService.cs:101), which is the boundary that decouples the two when needed.
  • Dynamic filtering is an injection and over-fetch surface. Arbitrary client-supplied property/operator/value triples are an attack surface; it is bounded by validating properties and operators up front (QueryFilterService.ValidateFilters, QueryFilterService.cs:167), routing each type through its registered IFilterStrategy rather than free-form expression evaluation, and capping rows with MaxUnboundedResultLimit (EntityQueryPipeline.cs:23). Sparse fieldsets reject non-writable properties with InvalidEntityField during field validation (QueryFieldService.cs:576-578), and the projection itself selects only writable properties (QueryFieldService.cs:358).
  • Generic endpoints are less self-documenting than bespoke ones. One generic shape per entity is consistent but conveys less domain intent than a named, purpose-built endpoint; the query contract (filter key syntax, operators) must be learned once rather than read off each endpoint.
  • Opting out means overriding the base. All five default reads (list, paged, CSV export, lookup and by-id: EntityControllerBase.cs:109, :157, :258, :321, :362), the two opt-in reads (cursor and change feed: :408, :461) and the two writes (AggregateRootEntityControllerBase.cs:80, :111) are virtual, so a controller that needs bespoke behavior overrides the specific action rather than abandoning the base, but the default surface is opt-out, not opt-in. The two opt-in reads are the exception: their convention is read off the base action, so an override still needs [SupportsCursorPaging] or [SupportsChangeFeed] on the controller or it is removed as well (OptInActionAttribute.cs:12-13, :29-32; SupportsCursorPagingAttribute.cs:14, SupportsChangeFeedAttribute.cs:14).
  • The CSV export widens the inherited surface, so it fails closed. ExportAsync (EntityControllerBase.cs:258) reads pages of MaxPageSize rows (:278) up to MaxExportRows (default DefaultMaxExportRows 100_000, EntityControllerBase.cs:513; settings default at Source/Core/MMCA.Common.Application/Settings/ApplicationSettings.cs:33), announcing that ceiling in the X-Export-Row-Limit header (ExportRowLimitHeaderName :522, appended at :681). When the controller declares no row scope it refuses with a 403 carrying Export.RowScopeRequired (:274-275, code at :528) unless AllowUnscopedExport (:549, default false) opts in, so a controller that forgot to scope its export serves no rows rather than every row.

Revision (2026-09-07)

The query layer's shape is unchanged. What a caller is allowed to name is not, from the 2026-09-07 security review.

  1. Client keys resolve against the DTO contract (SEC-Common-25 / SEC-ADC-09). QueryFieldContract (MMCA.Common/Source/Core/MMCA.Common.Application/Services/Query/QueryFieldContract.cs:34) holds a response type's public property names, built with For<TContract>() (:56) or narrowed with ForNames (:83), and tested through AllowsClientKey (:103). EntityQueryService.FieldContract defaults to QueryFieldContract.For<TEntityDTO>() (MMCA.Common/Source/Core/MMCA.Common.Application/Services/EntityQueryService.cs:123) and flows through EntityQueryParameters into sorting and filtering. A key the property map does not cover must name a contract field, and a dotted path the server did not author is refused, so a caller can neither order a public page by a column the mapper redacts nor turn a list endpoint into an inference oracle over the object graph. Overriding FieldContract with null restores the old entity-based resolution.
  2. Navigation depth is capped at three segments. QueryFieldContract.MaxNavigationDepth (:42) is enforced by IsWithinNavigationDepth (:115, :130) on any resolved entity path, whoever authored it. A self-referencing segment repeated hundreds of times is otherwise that many LEFT JOINs from one anonymous request (SEC-Store-13).
  3. The lookup read is contract-bound and capped (SEC-Common-24). EntityQueryService.LookupNameContract (:135, defaulting to FieldContract) validates the caller's nameProperty and answers 400 for anything else (:393), and EFReadRepository.GetAllForLookupAsync applies EntityQueryPipeline.MaxUnboundedResultLimit (1000, MMCA.Common/Source/Core/MMCA.Common.Application/Services/Query/EntityQueryPipeline.cs:23) at MMCA.Common/Source/Core/MMCA.Common.Infrastructure/Persistence/Repositories/EFReadRepository.cs:244. The lookup was the one read that never entered the pipeline enforcing that limit.
  4. The selector cache is bounded and canonically keyed (SEC-Store-14). QueryFieldService caps the compiled-selector cache at MaxCacheEntries 512 (MMCA.Common/Source/Core/MMCA.Common.Application/Services/QueryFieldService.cs:39, documented at :323 and :574) and keys on the property's canonical name, so the case permutations of one real column collapse onto a single entry instead of minting an unevictable one each.

Adopting this is a behaviour change. A client key naming a field only the entity carries now answers 400. The fix is to add the field to the DTO, map it in DTOToEntityPropertyMap, or override FieldContract.

ADR-001 (manual DTO mapping: the generic controllers project through IEntityDTOMapper), ADR-002 (navigation populators: the unsupported-include path), ADR-013 (Result pattern at the edge: every action returns through HandleFailure(result.Errors), EntityControllerBase.cs:128), ADR-017 (idempotency: the generic create is [Idempotent], AggregateRootEntityControllerBase.cs:76), ADR-019 (rate limiting: these GET routes are the authenticated read surface the always-on global limiter caps per principal).

Revision (2026-07-24)

Filter and pagination corrections from a code review. The contract shape is unchanged; these close cases where the engine widened a result set instead of narrowing it, or reported a total it did not have.

  1. An unparseable filter value is a 400, not an unfiltered read. Every strategy silently returned the query unchanged when it could not parse a value, and validation never looked at values at all, so ?filter=id:equals:abc returned the whole (capped) result set rather than no matches. That is the wrong direction for a fail-safe default on an endpoint whose filter may be the only scoping. IFilterStrategy.CanParseValue (a default interface member returning true, so custom strategies are unaffected until they opt in) is implemented by the six value-type strategies and checked in ValidateFilters, which now emits Filter.Value.Invalid. Presence operators still ignore the value, IN needs at least one parseable item, and BETWEEN needs exactly two bounds.
  2. A mapped filter is applied, not silently dropped. ApplyFilters and ValidateFilters disagreed on how to resolve a DTOToEntityPropertyMap entry: validation fell back to the mapped entity name while application retried the DTO name. A plain rename entry therefore passed validation and was then skipped, returning an unfiltered result set with a 200. Both now share one resolver, so anything validation accepts is what gets applied.
  3. Pagination edges. The Skip offset was computed with checked 32-bit arithmetic, so a page number near int.MaxValue overflowed into a 500 instead of the empty page it describes; it is now 64-bit and range-checked. An unpaginated read reported the MaxUnboundedResultLimit safety cap as TotalItemCount, telling callers the set was exactly that size; it now issues a count query only when the materialized rows actually reach the cap. PaginationMetadata.PageSize reports the size the pipeline applied rather than the one requested.
  4. The keyed by-id fast path is reachable again. The fast-path predicate treated includeFKs as disqualifying while GetByIdAsync defaults it to true, so every REST by-id read fell through to the dynamic-filter pipeline (a parsed string predicate, TOP 1000, and a client-side FirstOrDefault) where a keyed TOP 1 WHERE Id = @id would do. The flags now disqualify only when the entity actually has navigations to include.

Revision (2026-07-25)

Citation maintenance from an ADR audit. No decision or behavior changed; the source anchors above were rebased to their current declaration and call-site lines.

  1. The fast-path predicate is named TryGetFastPathIncludes. Revision item 4 above referred to it as IsPrimaryKeyOnlyLookup, a symbol that no longer exists in the framework source. The current method (Source/Core/MMCA.Common.Application/Services/EntityQueryService.cs:162, called from the by-id fast path at EntityQueryService.cs:130) both decides whether the request is a plain key lookup and returns the navigations it must eager-load. The described behavior is unchanged: requested include flags no longer disqualify on their own, and only unsupported (cross-source) includes send the read back to the pipeline (EntityQueryService.cs:185-188).

Revision (2026-10-01)

No decision or rationale changed; this records clarifications and refreshed citations from an ADR audit.

  1. MaxPageSize is clamped to the pipeline ceiling. The resolved setting is now Math.Clamp(settings?.MaxPageSize ?? 500, 1, EntityQueryPipeline.MaxUnboundedResultLimit) (Source/Presentation/MMCA.Common.API/Controllers/EntityControllerBase.cs:64), so a configured page size above 1000 or below 1 no longer reaches the pipeline, and ApplyPaging clamps to the same limit (Source/Core/MMCA.Common.Application/Services/Query/EntityQueryPipeline.cs:278-281).
  2. The column-narrowing projection is bounded. Once the field-set projection cache holds MaxCacheEntries 512 entries (Source/Core/MMCA.Common.Application/Services/QueryFieldService.cs:39), a new field set skips server-side projection (QueryFieldService.cs:298-299) rather than growing the cache; the response is still shaped to the requested fields.
  3. Strongly typed identifiers filter without registration. ResolveStrategy builds and memoizes a StronglyTypedIdFilterStrategy for an ADR-115 identifier column (Source/Core/MMCA.Common.Application/Services/Filtering/QueryFilterService.cs:406-416).
  4. Non-writable sparse fields are rejected at validation. InvalidEntityField is raised in ValidateFields (QueryFieldService.cs:517-523); the projection only filters to writable properties (QueryFieldService.cs:337).

Citations in Decision, Rationale, Trade-offs and Related were rebased to their current lines (EntityControllerBase.cs, QueryFieldService.cs, QueryFilterService.cs, EntityQueryPipeline.cs, EntityQueryService.cs). Anchors inside the earlier Revision sections are left as recorded.

Revision (2026-10-06)

No decision, rationale or behavior changed; this pass refreshes citations from an ADR audit.

  1. Anchors recorded in earlier Revision sections have moved. They stay as recorded; the current locations are: the fast-path predicate TryGetFastPathIncludes is declared at Source/Core/MMCA.Common.Application/Services/EntityQueryService.cs:196, called from the by-id fast path at :164, and sends a read with unsupported includes back to the pipeline at :219-222; EFReadRepository.GetAllForLookupAsync applies MaxUnboundedResultLimit at Source/Core/MMCA.Common.Infrastructure/Persistence/Repositories/EFReadRepository.cs:246; the MaxCacheEntries cap is documented at QueryFieldService.cs:328 and :619; the projection-cache skip is at QueryFieldService.cs:302-303, the writable-only projection at :341, and the non-writable InvalidEntityField rejection at :559-561.

Anchors in Decision and Trade-offs were re-verified against current source and rebased (EntityControllerBase.cs, QueryFieldService.cs). Anchors inside the earlier Revision sections are left as recorded.

Revision (2026-10-21)

Re-verified against current source. The two controller bases, the dynamic query contract and the pipeline bounds are unchanged; the create's 201 construction, the filter type list and the read surface moved.

  1. The create resolves its own Location. CreateAsync (Source/Presentation/MMCA.Common.API/Controllers/AggregateRootEntityControllerBase.cs:80) returns Created(location, created) (:98) instead of CreatedAtRoute. The location is Url.Link(GetByIdRouteName, ...) when that route resolves (:94), otherwise the new id appended to the request's collection path (:96), so a derived controller that does not declare the named route no longer turns a saved create into a 500 when the result executes (rationale at :67-74).
  2. The filter registry covers Email. The built-in entries (Source/Core/MMCA.Common.Application/Services/Filtering/QueryFilterService.cs:37-50) now include [typeof(Email)] = new ValueObjects.EmailFilterStrategy() (:50); Decision item 4 lists it.
  3. The CSV export is part of the inherited read surface. ExportAsync (Source/Presentation/MMCA.Common.API/Controllers/EntityControllerBase.cs:257) is a fifth virtual read. It pages at MaxPageSize (:277), stops at MaxExportRows (default 100_000, :472), announces the ceiling in X-Export-Row-Limit (:481, appended at :625) and refuses an unscoped export with a 403 Export.RowScopeRequired (:273-274, :487) unless AllowUnscopedExport (:508) opts in. Trade-offs records it.
  4. Anchors re-verified against current source: AggregateRootEntityControllerBase.cs class :29, [HttpPost] :75, [Idempotent] :76, [HttpDelete("{id}")] :107, DeleteAsync :112; EntityControllerBase.cs reads :110, :158, :257, :320, :361; QueryFilterService.cs registry :34, ApplyFilters :81 and :102, RegisterStrategy :65, ValidateFilters :166 and :182, ResolveStrategy :413, StronglyTypedIdFilterStrategy.TryCreate :421; EntityQueryService.cs ValidateFilters call :304, MapToDTOs :361, and (for revision 2026-09-07 item 3, left as recorded) the LookupNameContract check at :394; EFReadRepository.GetAllForLookupAsync applies MaxUnboundedResultLimit at Source/Core/MMCA.Common.Infrastructure/Persistence/Repositories/EFReadRepository.cs:245, with the other Take at :288.

Revision (2026-10-26)

Re-verified against current source. No decision, rationale or behavior changed: the create still resolves its own Location and returns Created, and the delete is still a virtual write. Only the line anchors in AggregateRootEntityControllerBase.cs moved.

  1. Anchors re-verified against current source: Source/Presentation/MMCA.Common.API/Controllers/AggregateRootEntityControllerBase.cs class :29, GetByIdRouteName :57, rationale remarks :67-74, [HttpPost] :75, [Idempotent] :76, CreateAsync :80, Url.Link :93, collection-path fallback :95, Created(location, created) :97, [HttpDelete("{id}")] :106, DeleteAsync :111 (rebased in Decision item 2 and Trade-offs). Anchors inside the earlier Revision sections are left as recorded; the revision 2026-09-07 item 3 LookupNameContract check stays at the :394 revision 2026-10-21 item 4 gives.

Revision (2026-10-28)

Re-verified against current source. No decision, rationale or behavior changed. The fail-closed value check of revision 2026-07-24 item 1 holds, but its count of implementing strategies is stale; that section is left as recorded and the current set is stated here.

  1. Eight strategies implement CanParseValue, not six. The default interface member returns true (Source/Core/MMCA.Common.Application/Services/Filtering/IFilterStrategy.cs:44). The private helper ValidateValueParseable checks it (Source/Core/MMCA.Common.Application/Services/Filtering/QueryFilterService.cs:318), called from ValidateSingleFilter at QueryFilterService.cs:297 under ValidateFilters (QueryFilterService.cs:182), and the error it adds still names ValidateFilters as its source (QueryFilterService.cs:323). Seven built-in primitive strategies implement it: StringFilterStrategy.cs:26, BoolFilterStrategy.cs:20, IntFilterStrategy.cs:25, LongFilterStrategy.cs:24, DateTimeFilterStrategy.cs:25, DecimalFilterStrategy.cs:24 and GuidFilterStrategy.cs:21 (all under Source/Core/MMCA.Common.Application/Services/Filtering/), plus StronglyTypedIdFilterStrategy.cs:34. EmailFilterStrategy (Source/Core/MMCA.Common.Application/Services/Filtering/ValueObjects/EmailFilterStrategy.cs:27) does not implement it and so takes the default.
  2. Anchors re-verified against current source: IFilterStrategy.CanParseValue default :44, QueryFilterService.cs value check :318 and Email registry entry :50. The by-id fast path anchors recorded in revisions 2026-07-25 and 2026-09-07 stay as recorded; revision 2026-10-06 item 1 already gives their current locations.

Revision (2026-11-23)

Re-verified against current source. The two controller bases, the dynamic query contract, the pipeline bounds and the fail-closed export are unchanged; the read base gained two opt-in routes and the EntityControllerBase.cs, QueryFieldService.cs and QueryFilterService.cs anchors moved.

  1. Two opt-in GET routes sit on the read base. [HttpGet("cursor")] (Source/Presentation/MMCA.Common.API/Controllers/EntityControllerBase.cs:403, GetCursorPageAsync :408) returns a keyset page ordered by the sort column with Id as tie-break, and [HttpGet("changes")] (:456, GetChangesAsync :461) returns a change feed of upserts and tombstones ordered by (LastModifiedOn, Id). Each exists only on a controller carrying its attribute through [OptInAction] (SupportsCursorPagingAttribute :404, SupportsChangeFeedAttribute :457), clamps the page size to MaxPageSize (:419, :467) and is scoped by GetReadSpecificationAsync. Both are virtual. Decision item 1 and Trade-offs record them.
  2. Anchors re-verified against current source: EntityControllerBase.cs attributes :30-32, class :33, MaxPageSize :58, settings read :62, Math.Clamp :63, [HttpGet] :106, list read :109, list fields :110 and include flags :111-112, HandleFailure(result.Errors) :128, [HttpGet("paged")] :153, paged read :157, paged include flags :158-159, sort parameters :160-161, paged fields :162, filter binder :165, Math.Min :168, AppendPaginationHeader :187, [HttpGet("export")] :253, ExportAsync :258, unscoped refusal :274-275, export page size :278, [HttpGet("lookup")] :318, lookup read :321, [HttpGet("{id}")] :357, by-id read :362, by-id fields :366, DefaultMaxExportRows :513, ExportRowLimitHeaderName :522, ExportRowScopeRequiredErrorCode :528, AllowUnscopedExport :549, header append :681; Source/Presentation/MMCA.Common.API/Pagination/PaginationHeaderExtensions.cs:17 (X-Pagination); Source/Core/MMCA.Common.Application/Settings/ApplicationSettings.cs:17 (MaxPageSize 500) and :33 (MaxExportRows 100_000); QueryFieldService.cs MaxCacheEntries :39, ApplySorting :162 and :191, ApplyFieldSelection :290, cache-full skip :310-318, writable-only projection :358, non-writable InvalidEntityField :576-578; QueryFilterService.cs ApplyFilters :82 and :103, RegisterStrategy :66, ValidateFilters :167 and :183, ValidateValueParseable call :298 and declaration :306, Filter.Value.Invalid :322 with source nameof(ValidateFilters) :324, ResolveStrategy :413. Anchors inside the earlier Revision sections are left as recorded.

Revision (2026-11-30)

MMCA.Common v1.324.0 (MMCA.Common/CHANGELOG.md:19, :37). The generic surface and the query contract are unchanged in shape; four places where a malformed or oversized request was silently reinterpreted now answer 400, and the list order follows a specification when the request names none.

  1. IN is strict. An IN value list is valid only when every item parses (MMCA.Common/Source/Core/MMCA.Common.Application/Services/Filtering/FilterValueParser.cs:55-63, EveryItemParses at :78-82); one unparseable item fails validation with Filter.Value.Invalid, the code BETWEEN already used (.../Services/Filtering/QueryFilterService.cs:331-338). Before this release at least one parseable item sufficed (the Revision (2026-10-28) records that rule) and the others were dropped, narrowing the result without telling the caller.
  2. Too many filters is an error, not a truncation. QueryFilterService.MaxFilters is 50 (QueryFilterService.cs:42), and ValidateFilters refuses a larger set as a whole, before any key is resolved, with Filter.TooMany (:196-203; translated at MMCA.Common/Source/Presentation/MMCA.Common.API/Resources/ErrorResources.resx:202 and ErrorResources.es.resx:202). QueryFilterModelBinder.MaxFilters is the same constant (.../MMCA.Common.API/ModelBinders/QueryFilterModelBinder.cs:34), and the binder no longer drops the surplus, which widened the result past what the caller asked for.
  3. The strategy registry is frozen. RegisterStrategy and its process-wide mutable registry are removed (no adopter); the built-in strategies are a FrozenDictionary fixed at type initialization (QueryFilterService.cs:45-62), and strongly typed identifier strategies are still built on first use and memoized, keyed by model CLR types only (:68, resolved at :425).
  4. PagingMath.Clamp returns a PageWindow. PageWindow(PageNumber, PageSize, Skip, Take) (.../Services/Query/PageWindow.cs:23; PagingMath.cs:33) replaces the (Skip, Take) tuple, so the clamped page and size used for the pagination metadata come from the same computation as the skip.
  5. Sort precedence on a list read with a specification: the request wins. The specification's OrderBy becomes EntityQueryParameters.DefaultOrdering (.../Services/Query/EntityQueryParameters.cs:25, set at .../Services/Query/EntityQueryService.cs:329) and applies only when the request sends no sortColumn (.../Services/Query/EntityQueryPipeline.cs:250-261); the request's paging pages the read and the specification's own Skip/Take does not, and TotalCount counts the filtered set before the page is taken (EntityQueryService.cs:321-326). A consumer list endpoint that passes a specification with OrderBy and no sort now returns that order. How the specification reaches the list read at all is ADR-055's Revision (2026-11-30).
  6. System.Linq.Dynamic.Core stays, deliberately (decided 2026-11-30). Replacing it with hand-built expression trees was weighed and deferred: sorting resolves a DTO property through each query service's DTOToEntityPropertyMap and hands the result to Dynamic LINQ (.../Services/Query/QueryFieldService.cs:204-214, parsing config in .../Services/Filtering/DynamicQueryConfig.cs), and consumer maps hold free-form expressions, not only property paths: MMCA.Store maps VariantCount to ProductVariants.Count(), ProductCount to Products.Count() and IsOutOfStock to (AvailableQuantity == 0) (MMCA.Store/Source/Modules/Catalog/MMCA.Store.Catalog.Application/Products/ProductEntityQueryService.cs:34, .../Categories/CategoryEntityQueryService.cs:33, MMCA.Store/Source/Modules/Sales/MMCA.Store.Sales.Application/Inventory/InventoryItemEntityQueryService.cs:35). The package stays referenced (MMCA.Common/Directory.Packages.props:95, MMCA.Common/Source/Core/MMCA.Common.Application/MMCA.Common.Application.csproj:29). Revisit when no consumer map holds an expression, or when the maps move to typed expressions.
  7. Marked in place: the Decision's RegisterStrategy sentence. The dated Revisions keep their wording.