# Intent.Common.DriftEngine

> Phase 1 of the drift engine ([plan](plan.md)): C# (with Razor components, MVC views and Razor Pages, and XAML views), Java, Python, TypeScript and Protobuf code, the Domain, Services and User Interface designers' structure, scope, and the opt-in "must be modelled" rules.

The drift engine checks that hand-written code still matches the model. Each modelled fact (a class exists, an attribute has this type, a class is abstract) becomes a claim, and the engine reads the code to verify it, contradict it, or say why it can't be verified. It reads code and never writes it.

It replaces Intent.Common.Drift, the recipe-based check of the Guardrails Contracts modules. To move an application across, update Intent.Common.Drift to 2.0: the update installs this module, turns the recipe files into the Drift Scope and Drift Check rows below, and removes the Guardrails Contracts modules, keeping the code they generated. Intent.Common.Drift's README says what the update does and what the first run shows.

## Setting scope

Nothing is checked until the model says what code to read. Apply the **Drift Scope** stereotype to the Codebase Structure designer's Root Folder (or a Folder) and add rows:

| Glob | Scope | Reason |
| --- | --- | --- |
| `src/MyApp.Domain/**` | In | |
| `src/MyApp.Domain/Migrations/**` | Out | Generated by EF Core |
| `src/MyApp.Api/Program.cs` | Context | The composition root: read for what it registers, not modelled |

- **Glob**: one or more globs, one per line, relative to the element's folder, read as File Classification reads them: a line starting with `#` is a comment, a line starting with `!` takes back what the lines above it matched, and the last matching line decides. A leading `/`, braces `{a,b}` and character classes `[ab]` aren't supported: each is a `config/glob` error, as the line matches no file. An Opt-in Rules row's Glob reads the same way.
- **Scope**: In, Out or Context. In is read and checked; Out isn't read. Context is read, so claims verify from it and rules use what it says, but nothing is reported about its own code. Every Out and Context row needs a reason. A C# file's project is found on disk, as MSBuild finds it, even where its `.csproj` is Out: its global usings, root namespace, nullable context and project references decide what the file's names mean.
- **Types**: optional, on an Out row, type names to leave out of otherwise in-scope files.

The deepest element with a matching row decides, and its last matching row wins. `bin`, `obj`, `.git`, `node_modules`, hidden folders, Intent's own folders, NuGet's `packages` folder (known by the `.nupkg` files in it, so a monorepo's `packages` source folder is still read) and the folders a `libman.json` installs client libraries into are always out.

## Code the model doesn't describe

Code the model doesn't mention isn't drift on its own, so by default nothing reports it. A team that wants every in-scope type, member or file described turns on an opt-in rule with the **Drift Check** stereotype on the Root Folder:

| List | Row | What it does |
| --- | --- | --- |
| Opt-in Rules | Rule, Glob, Description | Turns a rule on, optionally narrowed to some files: `optin/unmodelled.file`, `.type`, `.member`, `.interaction`, `.exposed`, `.value`, `.index`, `.endpoint` or `.region`, or a module's own. The Description says what the row's files are (`Domain layer: entities and repositories`), and the list shows it beside the rule, so rows of the same rule over different layers can be told apart; without one, the list shows the first glob. |
| Exceptions | Rule, Match, Reason | Code a rule mustn't report: file globs, type names or `Type.Member`s, one per line, with one reason for them all. An entry that matches nothing is a warning. |
| Severity Overrides | Rule, Severity, Reason | Another severity for the findings whose rule matches (`*` matches anything): `optin/unmodelled.*` as Warning while the model catches up |

- **`unmodelled.file`**: an in-scope file in which no claim located anything.
- **`scope/unread`** (always on, not an opt-in rule): an in-scope file nothing reads, so nothing in it is checked. An `.html` file is read by a framework only where its code names the file or a folder it declares (Angular's `templateUrl`, Jinja's templates folder, the Thymeleaf views a Spring handler renders), never by its extension alone. Build a house rule that reads it, take it out of the Drift Scope with a reason, or add an Exceptions row for `scope/unread` with the file's path or a glob.
- **`unmodelled.type`**: a type under the row's Glob, such as `Data/Model/Entities/**`, that no element describes. The row is the whole setup; a module can narrow it further with a convention's `find`, such as only a base class's subclasses. A C# static class of only extension methods isn't reported, nor is a file holding only such classes: what its methods do is stated where the code calling them is described.
- **`unmodelled.member`**: a public member of a modelled type, of a kind its element type can state (a Class's properties, fields, constructors and methods; a DTO's properties), that the model doesn't state. Overrides of a modelled base, `Equals`/`GetHashCode`/`ToString`, a record's primary constructor, a modelled field's Java accessors, and a property EF doesn't map (`[NotMapped]`, `Ignore`), which no attribute of a persisted class can describe, aren't reported. Nor is what the User Interface designer can't state: a component's injected service (its Uses), a Page property that isn't a route or query parameter (a `[SupplyParameterFromForm]` value), a Store's or View Model's methods, any member of a UI Service, Utility or Behaviour, a second overload of a Page's, Component's or Proxy's method, or a Proxy method that sends no request. In .NET MAUI, a page's property no `[QueryProperty]` binds, a component's no `BindableProperty` backs, and the static `BindableProperty` behind a property, which the property's own Property states, aren't reported either. Every field, property or constructor parameter typed by what a Uses targets is that Uses (a View Model's `UserName` and `Password` of one `ValidatableObject`), and a member typed by its class's own type parameter (`T Value`) isn't asked of an element type its designer gives no type parameters (everything but a Class, Data Contract, DTO, Eventing DTO and Contract). A link states what a screen does, not which of its methods does it, so every method making the call, navigation or dialog a link states is that link's, and none of them is reported.
- **`unmodelled.interaction`**: a call the model's interactions could show that no link describes, such as a query of an entity with no Query Entity Action. Messages the diagram could show are already drift by default (below), so they aren't reported twice.
- **`unmodelled.exposed`**: a type an endpoint takes or returns, or one reached through its type arguments and public properties, that no element describes. The types an endpoint exposes come from a convention's `exposed` find path.
- **`unmodelled.value`**: a value the code states explicitly that the model leaves unset, such as a `ToTable` for a class with no Table Name, a success status for an operation with none, an endpoint's `.WithName(...)` or `ExcludeFromDescription()` with no OpenAPI Settings, or a `[Range]` with no Numeric Limits.
- **`unmodelled.index`**: an EF Core `HasIndex` that no Index describes.
- **`unmodelled.endpoint`**: a Minimal API endpoint, such as `api.MapGet("/catalogtypes", async (...) => ...)`, that no Operation describes. A controller's actions are `unmodelled.member`'s.
- **`unmodelled.region`**: a named placement point of a modelled component that no Region of its element names, such as a Blazor `<SectionOutlet SectionName="page-header-subtitle"/>` in a header bar the model gives only a `page-header-title` Region, or an MVC layout's `RenderSection("scripts")`, or a .NET MAUI Shell's item (`<Tab Route="Profile">`, or one with no Route showing `<ShellContent Route="Login">`), or a Blazor `[Parameter] RenderFragment` (content a parent fills, a Region rather than a Property). A layout's `@Body` or `RenderBody()`, which the code doesn't name, isn't asked for, and nothing is asked for where a component has only one placement point, as the designer adds Regions only where there are several.

Each finding is an error unless an override says otherwise, and a row without a reason, or naming a rule no installed module provides, is a configuration error.

## What it checks

- **Domain**: classes, attributes, associations (navigation properties), operations, constructors, enums and their literals (in the model's order; the code may have more), domain events, value objects, domain services with their operations, data contracts (a class or record) with their attributes, and repositories with their operations, the entity each serves and a class implementing it. A repository, service or domain service is the type of its name, else the interface its language names it (`IOrderData`), and of several the one in the namespace or folder its designer folders name: a Repository `OrderData` in the folder `Shop.Sales.Data` is `Shop.Sales.Data.IOrderData`, even with an `OrderData` class elsewhere. An interface no class implements is implemented at run time by whatever the code gives it to as a type argument: a proxy library's factory (`factory.Create<IOrderQueries>()`), the code's own generic factory or a container registration (`Bind<IOrderQueries>()`). Fetching one from the container (`GetRequiredService<IOrderQueries>()`) doesn't count. Members a class inherits count as its own, and an EF Core shadow property (`Property<int>("BuyerId")`) is an attribute's member. A member typed by its class's type parameter (`T Value`), in any designer, is of that type as written, of the type argument a derived class gives it (`UserName : ValidatableObject<string>` makes it `string`), or, unbound, of `object`.
- **Services**: DTOs with their type parameters, commands, queries, services, service proxies, enums and their literals, and each operation's return type and parameters. An action whose return type doesn't say what it succeeds with (`IActionResult`, Web API 2's `IHttpActionResult`) returns what its success results carry (`Ok(data)`, `Content(HttpStatusCode.OK, data)`, also through `Task.FromResult`), error results aside; a stub that builds none, or a success whose value the code doesn't type, returns what its `[ResponseType]` or `[ProducesResponseType]` declares. A model may instead state the action's own result type (`IActionResult`), which is true of its signature whatever it returns. A Success Response Code is checked against the status each success result builds; an action that returns its data itself (`Task<string>`, `ActionResult<OrderDto>` returning the DTO) is sent with the framework's 200. A field whose Serialization Settings Naming Convention is Custom has its serialized name checked (`[JsonPropertyName]`, `[JsonProperty]`, `[DataMember]`, Java's `@JsonProperty` and `@SerializedName`).
- **Commands and queries**: each one's result and its handler, read from MediatR (the request's `IRequest<T>`, a command with no type being `IRequest` or `IRequest<Unit>`, and a concrete class implementing `IRequestHandler<TRequest, T>`), Mediator (`IRequest`, `ICommand` and `IQuery` with their own handler interfaces) or Wolverine (the `Handle`/`Consume` method its conventions find, whose return type is the result), through the code's own bases over them. The namespace a file imports says whether `IRequest` is MediatR's or Mediator's. A request no framework in the code handles can't be verified rather than reported.
- **Field validations**: a DTO field's Validations stereotype (Intent.Application.FluentValidation's), each property stated only when the model sets it, read from the FluentValidation validator of the field's own type (`CreateCustomerCommandValidator : AbstractValidator<CreateCustomerCommand>`): its `RuleFor(v => v.Field)` chains, a collection's items' rules in `ForEach` or `RuleForEach`. Not Empty is `NotEmpty()`, Min and Max Length `MinimumLength`, `MaximumLength` or `Length`, Min and Max the bound calls (`GreaterThanOrEqualTo`, `InclusiveBetween` and their kin), Equal and Not Equal their values as written, Regular Expression `Matches` given a string or a `Regex` (in place or a field) with its message (`WithMessage`) and timeout (the `Regex`'s `TimeSpan`), Email Address `EmailAddress()`, Predicate a `Must` with that predicate and its message, Must and Has Custom Validation a `Must` or `MustAsync` with its message, Custom a `Custom` or `CustomAsync`, and Cascade Mode `Cascade(...)`. Where the code uses FluentValidation and no validator validates the field's type, the type states none of its fields' validations.
- **Entity Actions**: each Create, Update, Delete and Query Entity Action is checked against the code its source reaches (above, for C# and Java). An aggregate is loaded and changed as a whole, its parts being what it owns through a composite association (the owning end of multiplicity 1): a change made through the entity to a part changes it (`order.Payment.Fail(...)`, `order.OrderItems.Remove(item)`), and a part is loaded with its owner, so setting `customer.Preferences.SpecialOffers` after loading the customer updates its `Preferences`. A part of another aggregate the entity only refers to isn't its own: renaming `order.Buyer` changes the buyer, not the order.
- **Messages**: each Domain Event Origin, Publish Integration Event and Send Integration Command link, whatever the code raises it through (`AddDomainEvent`, an outbox, a bus or a wrapper of its own): the constructor, operation, command handler or event handler hands the message on, one it creates or a value the code types as it (a local an awaited call gives, a property of what a call returns), itself or in a method of its class or of a collaborator it calls. A method of the code that only reads a message it is given processes it in place, and a method that returns the message builds it for its caller; neither raises it. The other direction is checked by default, with no Drift Check row, wherever the diagram could show it: a domain event, integration event or command type in the code must be modelled, and a raise of one needs its link when it's in, or called from, a modelled constructor, operation, command or handler, a method of a modelled class or service, or a handler of a modelled message. A raise from code the diagram can't show, such as a background router, isn't drift. The messages are the modelled ones and any type sharing what they all derive from or implement (`INotification`, an `IntegrationEvent` base). A handler handles a message by implementing the framework's handler of it, by a method that takes it, or, as a queue consumer handed only the raw message does, by a method that deserializes it from the body (an Azure Service Bus processor's `JsonConvert.DeserializeObject<ApplicationPack>(json)`); what a subscription sends or publishes is read from those methods of the handler's own class. A subscriber's own copy of another application's message (the type its handler takes for it) may have only the message's modelled properties, of the same types, an enum read as its name or number; so may its copy of each Eventing DTO the message carries through its fields, and of those they carry in turn (the type of the DTO's name that the copy of its carrier names in a property, `IEnumerable<OrderStockItem> OrderStockItems`). A copy may leave fields out, and the copies are code the model describes, so the opt-in rules don't report them.
- **HTTP**: whether each operation of an HTTP service is an endpoint (one without Http Settings states it isn't, so a controller action or mapped handler for it is drift), routes, verbs, each parameter's source, type, nullability and default, API versions (the service's and each operation's Api Version Settings, and whether the version is in the route), and each operation's security: Secured or Unsecured on the operation, else on its service, with Secured's roles (its Roles or its Security Roles) and policy. Read from ASP.NET Core and ASP.NET Web API 2: attribute routing (`[Route]`, and Web API's `[RoutePrefix]`), Minimal API endpoint mappings (`MapMethods` included, and those in `Program.cs`'s top-level statements, a Service named `Program`'s), lambda handlers included (named by `.WithName`, as their Operation or its OpenAPI OperationId, or matched by verb and route; one that doesn't write its return type returns what its body returns: a success result's payload, a value's type, or an EF Core query's list), and their `MapGroup` prefixes; Web API 2's verb from an unattributed action's name (`GetOrders` is GET), and its route from the conventional `MapHttpRoute` template rather than the controller's `[RoutePrefix]` (an Operation whose empty Route puts it under its service's Route is reported), so a controller with no `[RoutePrefix]` is under that template up to its `{controller}` (`api/{controller}/{id}` puts `DiagnosticsController` under `api/Diagnostics`); an endpoint serving several verbs (several verb attributes, an `[AcceptVerbs]` or a `MapMethods` listing several) serves the modelled one when it is among them, the designer taking one; an OData controller's route from OData's convention, its `MapODataServiceRoute` (or `AddRouteComponents`) prefix and the entity set named after the controller (`odata/RequestPacks`, with `({key})` for an action taking the key), and its verb from its action's name; a parameter's source from `[FromBody]`, `[FromRoute]` and the like, or, without one, where ASP.NET binds it (a name in the route template is the route, a simple type the query string, any other type the body, a class the code registers with the container injected); and `[Authorize]` (or an attribute of the code's own deriving from it, roles given as constants by their value, and policies), `[AllowAnonymous]`, `RequireAuthorization()` and `AllowAnonymous()`, on controllers and gRPC services alike, where `[AllowAnonymous]` anywhere wins; API versions from Asp.Versioning's `[ApiVersion]`, `[MapToApiVersion]` and `HasApiVersion`. Roles or a policy the code doesn't give as a value can't be verified. A file result (`FileStreamHttpResult`) returns a `Stream`. Each operation's OpenAPI Settings OperationId (`{MethodName}` and `{ServiceName}` replaced, as Intent's modules write it) and Ignore, the operation's else its service's, are read as ASP.NET Core's OpenAPI document reads them: the operationId is a Minimal API endpoint's last `.WithName(...)`, else its handler's `[EndpointName]`, unless an OpenAPI callback chained on it sets `OperationId` (`.WithOpenApi(op => ...)`, `.AddOpenApiOperationTransformer(...)`), and a controller action's route name (`[HttpGet("{id}", Name = "GetItem")]`), else its `[EndpointName]`; an endpoint is hidden by `ExcludeFromDescription()` on itself, its group or its router's mapping call, `[ExcludeFromDescription]` on its handler, or the first `[ApiExplorerSettings(IgnoreApi = ...)]` on a controller action, else its controller. An endpoint with no name states no operationId, so `unmodelled.value` reports only a name the code gives. Web API 2 has no OpenAPI of its own, and a library's attribute (`[SwaggerOperation]`) isn't the framework's operationId, so neither can be verified. Read from Spring MVC: a Service is its `@RestController` (`OrdersService` is `OrdersController`), with `@RequestMapping` and `@GetMapping`-style mappings, `@PathVariable`, `@RequestParam`, `@RequestBody` and `@RequestHeader`, a `@ModelAttribute` form object (or an unannotated one) by its name, a `@Nullable` parameter as optional, and `@PreAuthorize`, `@Secured`, `@RolesAllowed` and `@PermitAll`, else Spring Security's central rules (below). Spring MVC's source is its annotation; a parameter left at Default isn't checked. A Service, Domain Service or Repository is the type of its name, else the interface its language names it (`IPricingService`, which `TieredPricingService` implements), and that interface's classes are its code too. A `ResponseEntity<Object>` doesn't say what it returns, so its return type can't be verified.
- **User Interface (the standard designer 2.0.0)**: pages, dialogs, layouts, components and their regions, stores, view models, UI services, utilities, behaviours, proxies, contracts, app events and enums, read from Vue, React and Angular (and Blazor, ASP.NET Core MVC views and .NET MAUI, below). In Angular, a component is a class its `@Component` decorator declares and its template the file its `templateUrl` names, or its inline `template`; pages, layouts and titles come from the router's tables (`provideRouter`, `loadChildren`, redirects, lazy routes through `tsconfig.json` path aliases), a dialog is what CDK's `Dialog` or Material's `MatDialog` opens, and a Show Dialog is also borne out by the dialog's tag in the source's template (`<app-modal [isOpen]="...">`); inputs the router binds (`withComponentInputBinding()`) are route or query parameters, and so is a value a page reads from its `ActivatedRoute` (`paramMap.get('id')`), a `string`, nullable unless every route showing the page has it (a query value always is); an `input<T>()`, `model<T>()` or `signal<T>()` is a `T`, and an optional input or model given no initial value may be `undefined`; `model()` is bindable; Regions are a template's `<ng-content>`s, named by what their `select` names (`[slot=footer]` is `footer`), and its named `<router-outlet>`s, a bare one being the Region no placement point names; a component's members that are no input, output or `model()` are its own state, which `unmodelled.member` doesn't ask for; and calls are followed through the services `inject()` gives. Which route guards secure a page is a house rule's to say, from the guards `AngularRoutes` gives. A view model is the class of its name, and states its Properties only, as the designer says not to model its methods. Each is where its Implementation Path says, else where its designer folders and name put it, and its Owned Files must exist. A store is a Pinia `defineStore`, a Redux Toolkit `createSlice` or a Zustand store (`use{Name}Store`), with its state and actions, or a class holding its state, whose getters (`computed()`, a signal's `asReadonly()`, a get-only accessor) `unmodelled.member` doesn't ask for, as a Store states only its state; a service, utility or proxy is a TypeScript or JavaScript file named for it. A Vue page is a component a vue-router route record mounts, with its route (`/products/:id` is `/products/{id}`), and a layout hosts a `<RouterView>`; Regions are a component's `<slot>`s and named `<RouterView>`s, the default `<slot />` being the Region no slot names; Properties are props or state, Event Emitters emits, operations functions; Composition is the child's tag in the template, and Navigation a `<RouterLink to>` or `router.push` to the target page's route. A React component is a function component (also through `memo` or `forwardRef`) or a class component, in `.tsx`, `.jsx` or `.js`; a page is one a react-router route mounts, as a route object (`createBrowserRouter`, `useRoutes`, with `element`, `Component` or `lazy`) or a `<Route>` element, nested routes joined, and a layout renders an `<Outlet />`. In react-router 5, a route wrapper (a component rendering `<Route {...rest}>`, such as a `PrivateRoute`) mounts a page at each of its paths too, a `<Route component>` with no path in a `<Switch>` is the catch-all page, and the layout is the outermost component a `<Switch>` of routes is rendered in; whether a wrapper secures its page is a house rule's to say; Properties are props or `useState` state, Event Emitters callback props (`on...`, typed as a function, or handed to an event), passing their one argument or, with none, nothing, operations the functions it declares, a route parameter what it reads from `useParams()`, a `string`, a query parameter what it gets from `useSearchParams()`, and a bindable Property one with an `on{Name}Change` callback; its title is a rendered `<title>` or `document.title`; Composition is the child's tag in its JSX, Navigation a `<Link>`, `<NavLink>` or `<Navigate>` `to` (one rendered over a constant array goes to each item's path), a `navigate(...)` or a route `loader`'s `redirect(...)`. A route its file's path gives (Next.js, Remix) isn't read, so a page there has no rule. In both, Uses is a value import, or a value of the used class the code reads (a MobX store a React context gives, `useContext(RootStoreContext).activityStore`, destructured or not), and a Call Service Operation Action a call of the proxy's method, from the caller's code (hooks and handlers included, an action handed to an element's event too) or the code it calls, through a module's default export of proxy objects (`agent.Activities.list()`) as well. A class store's members holding a store it creates or is handed are its Uses, and it is Persisted where its own code reads or writes Web Storage. From a Proxy Operation, the action's backend Operation (or the HTTP Request stereotype) gives the verb and route the operation's `fetch`, axios (an `axios.create()` instance included) or `HttpClient` request must send, read through the code's own request helpers, the base URL dropped; a relative URL is under the path of the base URL its client joins it onto (`axios.defaults.baseURL = 'http://localhost:5000/api/'` puts `get('products')` at `api/products`); under a base URL the code doesn't state (`axios.defaults.baseURL = process.env.REACT_APP_API_URL`), the route verifies where the model's ends with the one requested. ASP.NET Core SignalR's JavaScript client (`intent.signalr`) is read too: a `HubConnection`'s `invoke`, `send` or `stream` of a name calls the hub Operation of that name (without case), and its `on("Name", handler)` is the App Event the hub sends, the handler's parameters its Properties, and the code registering it subscribes to it. A two-way Navigation (its source end navigable) is checked both ways: the target page navigates back to the source as the source navigates to the target. A house designer gets the same reading by claiming these kinds on its own elements, with the same bindings, in a pack that requires `intent.ui`.
- **User Interface (the 1.x designer)**: components, layouts, model definitions and service proxies, read from Blazor. A Component with the Page stereotype is a page (`@page`), with its routes (`/` and parameter names don't matter, so `/orders/{id:int}` is `orders/{id}`) and title (`<PageTitle>`); a Layout derives `LayoutComponentBase`; any other component has neither. A component's Secured or Unsecured stereotype is its `[Authorize]` or `[AllowAnonymous]`, with roles and policy. Its properties and event emitters are `[Parameter]`s (an emitter an `EventCallback<T>`), with `[Query Parameter]` as `[SupplyParameterFromQuery]`, `[Route Parameter]` as a `{Name}` in a route and `[Bindable]` as a `{Name}Changed` callback. Its links: a Composition or a layout's Display Component is a tag of the child in its markup; a Navigation an `href`, form `action` or `NavigateTo` to the page's route, a value in it standing for a route parameter, through the code's own URL helpers; a Show Dialog a `Show` or `Open` of the dialog; and a Call Service Operation Action a call of the operation on the proxy, made by the component or by the code it calls (`CartPage` calls `BasketState`, which calls `BasketService`), including methods it hands on to be called and the constructors of what it creates. A component's `.razor` and `.razor.cs` are one component. With the 2.0.0 designer, Blazor also reads: a Region as a `<SectionOutlet SectionName>` of its name in its component's markup, a layout's `@Body` being the one Region no outlet names (or, of several, the one that places a Page); a component's Uses of a Behaviour as a JS interop import of the behaviour's file (`JS.InvokeAsync<IJSObjectReference>("import", "./Components/Chatbot/Chatbot.razor.js")`), or as the file loaded for the whole application by a `<script src>` (relative to its project's `wwwroot`, or `_content/{Library}/`) whose `querySelector`, `querySelectorAll`, `closest`, `matches`, `getElementById` or `getElementsByClassName` names a class, an id or a `data-` attribute an element of the component's markup carries (a bare tag or an ARIA attribute marks nothing); a Uses from a plain class (a View Model, a Store, a UI Service) or a component's Uses of one as a field, property or constructor parameter of the used element's type or an interface of the code it implements, an object of it the class creates, or a call through a dependency's property typed by it; and a Call Service Operation Action from a component to an operation with Http Settings as a plain `<form method="post" action>` with no `@onsubmit`, posting to the operation's route, the operation taking a POST.
- **User Interface from ASP.NET Core MVC views and Razor Pages** (the standard designer 2.0.0): a view is a layout when a view's or a `_ViewStart.cshtml`'s `Layout` names it, a page when a controller action renders it (`View()`, `View("Name", model)`, through the controller's own methods and extension methods, `this.LoadingPage("Redirect", url)` included) or it is a Razor Page (`@page`), and otherwise a component: a partial, or a view an action renders as a `PartialView`. A dialog can't be told from a view's code. Views are found as MVC finds them: `Views/{Controller}/{Name}`, then `Views/Shared/{Name}` (an `[Area]`'s first); a partial's and layout's from the view's folder, then `Shared` (a Razor Page's from each folder up to `Pages`, then `Pages/Shared`). A page's routes are the URLs of the actions that take a GET and render it, as the conventional routes (`MapDefaultControllerRoute()`, `MapControllerRoute`, ASP.NET MVC's `MapRoute`, each default left out in turn: `HomeController.Index` is `/Home/Index`, `/Home` and `/`) or attribute routes (`[controller]`, `[action]`) serve them, and a Razor Page's its path under `Pages` with its `@page` template; its title is `ViewData["Title"]` or `ViewBag.Title`. A view's security is `None`: its action carries the authorization, and the Services model states it there; a Razor Page's is its `@attribute [Authorize]` or its page model's. Its Regions are the sections it renders (`RenderSection`, `RenderSectionAsync`) and its `RenderBody()`, as Blazor's `@Body` is read, and a Region's Composition of a page is the page shown in that layout, or filling that section. A Composition of a component is a partial it renders (`<partial name>`, `Html.PartialAsync` and the other partial helpers) or a view component (`<vc:cart-summary />`, `Component.InvokeAsync`, the `CartSummary` or `CartSummaryViewComponent` class); a Uses is what it `@inject`s. A Navigation is a link reaching an action that takes a GET and renders the target, or the target Razor Page: `<a href>` (its path matched against the actions' routes), `<a asp-controller asp-action>` (each defaulting to the rendering action's), `asp-route`, `asp-page`, `Html.ActionLink`, `Html.RouteLink`, or an `href` the URL helper gives (`Url.Action`, `Url.Page`, `Url.Content`). A Call Service Operation Action is a form reaching the controller action the operation is (the method the Services model locates, else the one its Service and name give) with its Http Settings Verb: a tag-helper form (posting unless its `method` says otherwise) to `asp-controller`/`asp-action`, the route `asp-route` names (or, with none of that name, the URL the view was shown at), `Html.BeginForm` or `BeginRouteForm` (its `FormMethod`), a plain form (a GET unless `method="post"`) to its `action`, or with no action at all the URL the view was shown at. Tag helpers aren't bound, so `asp-*` attributes are read as written. Not read: areas' routes (`MapAreaControllerRoute`), `asp-route-*` values, `RedirectToAction` as a navigation, a Razor Page's handlers as invocations, and authorization a Razor Pages convention (`AuthorizeFolder`) applies.
- **User Interface from .NET MAUI** (the standard designer 2.0.0): a view is its XAML and its code-behind, one type (below). By the first framework base it derives from, its XAML root included, a `Shell`, `NavigationPage`, `TabbedPage` or `FlyoutPage` is a layout, a `ContentPage` a page, CommunityToolkit.Maui's `Popup` a dialog and a `ContentView` (or any other view) a component; a page modelled as a Dialog can't be verified, as its code doesn't say it is shown modally. A page's routes are the paths of the Shell contents showing it (`/Main/Catalog`) and the routes `Routing.RegisterRoute("Basket", typeof(BasketView))` registers for it; its title is its XAML root's `Title`, else the `Title` its constructor sets; its security is `None`, as MAUI has no authorization of its own. A Property is a query parameter when a `[QueryProperty]` on the page or its binding context binds it (one taking its query through `IQueryAttributable` can't be verified), and bindable when a `BindableProperty` (or CommunityToolkit.Maui's `[BindableProperty]`) backs it; Shell has no route parameters. A Shell's Regions are its items (`FlyoutItem`, `TabBar`, `ShellItem`, `Tab`, or a bare `ShellContent`), each named by its Route, or, with none, by its only content's; a Region's Composition of a page is a `ShellContent` of that item showing it (`ContentTemplate="{DataTemplate views:CatalogView}"`), and its Entry's Label, Icon and Key are that content's `Title`, `Icon` (a resource's key) and `Route`, else those of the tab or item holding it alone. MAUI's Shell has no keyboard shortcut, so an Entry's Shortcut is drift. A view's Composition of a component is an element of it in its XAML, a data template making it (`{DataTemplate views:ProductTemplate}`) or an `{x:Type}` naming it. A Uses is the view's binding context (`BindingContext = viewModel` in its code, or a `<ContentPage.BindingContext>` element; not `x:DataType`, which only types its compiled bindings), an object its XAML creates, or what it holds or creates, as any class's dependency is read. A Navigation is a `Shell.Current.GoToAsync(route)` reaching the page's route, or a call of the code's own method that takes the route and makes one (`_navigationService.NavigateToAsync("Basket")`, found by what it does, whatever it is named), in the view's code or its binding context's, or a `Navigation.PushAsync(new BasketView())`; a Shell also navigates to the pages its contents show. A Persisted Store reads or writes the device's `Preferences` or `SecureStorage` (or an `IPreferences` or `ISecureStorage` it is given). An App Event is the class of its name, with its properties (`ValueChangedMessage<T>`'s `Value` included); an element publishes it with a CommunityToolkit.Mvvm messenger's `Send` of it (created in place or handed on, or `Send<T>()`) and subscribes to it with a `Register<TRecipient, TMessage>` or by being an `IRecipient<T>`, in MAUI, WPF, WinUI, Avalonia or Blazor code alike. A WPF, WinUI or Avalonia view is read as a XAML view, and MAUI's checks don't answer for it.
- **Service proxies**: each operation's request, read from the proxy's own method and the methods of its type it calls: an `HttpClient` verb method (`GetFromJsonAsync`, `PostAsJsonAsync` and the like) or `SendAsync` with an `HttpRequestMessage`, directly or through the application's own request wrapper whose implementation sends the URI it is given (`_requestProvider.PutAsync(uri, ...)`), with its verb, its route (the URI the code builds, without its base address, query string or empty segments; a route parameter matches any value the code computes, and literals compare without case), its API version (`api-version=` in the query, or `AddApiVersion` on the proxy's `AddHttpClient<T>()`; one of the operation's Applicable Versions) and its headers (`Headers.Add`); or a generated gRPC client's call, with its RPC and service. A route a helper computes whole (`$"{UriHelper.CombineUri(...)}?{version}"`) can't be verified. A C# proxy's Base URL is the address its client's registration gives: `AddHttpClient<T>(o => o.BaseAddress = new("..."))` or a chained `ConfigureHttpClient`, for the proxy's class, and `AddGrpcClient<T>(o => o.Address = ...)` for the gRPC client it is given. In the standard designer 2.0.0 these are read from each Proxy Operation's Call Service Operation Action: a backend Operation with Http Settings gives the verb, route and versions, one without them the RPC. A Store's, View Model's or other plain C# class's Call Service Operation Action is a call of the proxy operation anywhere in the class or the code's own methods it reaches.
- **Base types**: a base a house pack says the model implies, such as the SeedWork `Entity` every Class derives, checked against everything the type derives from or implements.
- **Relational databases**: whether anything maps a Table or View class at all (a DbContext's `DbSet`, `Entity<T>` or applied configuration, a mapped entity's navigation to it, or JPA's `@Entity`; a class nothing maps is one finding, its other checks waiting on it), an entity's table, schema, primary key and its value generation, the multiplicity of an association end no navigation property states, and indexes (columns, unique, filter, and the index's own name when Use Default Name is off: an Index element, or the Index stereotypes on its attributes and on the association ends whose foreign key column is in its table, one index per UniqueKey), and its columns' names, types, text types, max lengths, precision, scale, defaults (a SQL expression default as `HasDefaultValueSql`), foreign keys and whether they're required; an attribute isn't ignored (`Ignore`, `[NotMapped]`), and a Value Object attribute is mapped as a value (`OwnsOne`, a complex type, or one column through a value converter's `HasConversion`); and an association's navigability where the model leaves an end unnavigable, and a JPA join column. Read from EF Core's fluent configuration and data annotations (an owned type's from its `OwnsOne` or `OwnsMany` builder, a lambda or a method taking an `OwnedNavigationBuilder<TOwner, T>`, and a composite association configured with `HasMany`/`HasOne` or `OwnsMany`/`OwnsOne` alike, the owned builder's `WithOwner().HasForeignKey(...)` stating its foreign key; Entity Framework 6's too: its `IDbSet`, its `HasRequired`/`HasOptional` relationships, and `[Table]`; a `[Table]` class no DbContext maps is reported, as EF never reads or writes its table), and from JPA's annotations (`@Table` and its indexes and unique constraints, `@Id`, `@Column`, `@GeneratedValue`). A value the model states that the code doesn't state explicitly is drift, even when the framework's convention would give the same result. The exceptions are what the model always marks: a key named `Id` or `<Entity>Id`, and a foreign key EF Core finds by its name (`BuyerId` for a relationship to `Buyer`).
- **Domain constraints**: a Domain attribute's Domain Constraints stereotypes (Intent.Metadata.Domain.Constraints), each stated only when the model sets a value, so an empty Text Limits states nothing: Required, Text Limits (a string's length), Collection Limits (how many items a collection holds), Regular Expression with its Message, Email, Url, Base64 and Numeric Limits with their boundary types. Read from the validation attributes on the attribute's member: .NET's DataAnnotations (`[Required]`, `[MinLength]`, `[MaxLength]`, `[StringLength]`, `[Length]`, `[RegularExpression(..., ErrorMessage = ...)]`, `[EmailAddress]`, `[Url]`, `[Base64String]`, `[Range]` with `MinimumIsExclusive` and `MaximumIsExclusive`), for a type that validates with them, and Java's Bean Validation (`@NotNull`, `@NotBlank`, `@NotEmpty`, `@Size`, `@Pattern`, `@Email`, `@Min`, `@Max`, `@DecimalMin`, `@DecimalMax`, `@Positive` and their kin, and Hibernate Validator's `@URL`, `@Length` and `@Range`), imported from its packages, `@NotEmpty` and `@NotBlank` being a minimum length of 1. A FluentValidation validator of the entity itself (`AbstractValidator<Customer>`) states them too, and EF Core's column length (`HasMaxLength`, or a sized text column type) states a maximum length, which the database enforces on every save. Only the entity's own code is read: a constraint it doesn't state, as in an application that validates its commands rather than its entities, isn't checked, and the Software Factory log lists those, never the report. Where an attribute's Text Constraints MaxLength is set, Intent validates that, so it is the maximum length checked. A non-nullable attribute is implicitly required, so `unmodelled.value` reports a `[Required]` the model leaves unset only on a nullable one. EF Core's reading of the same `[Required]` and `[MaxLength]` as a column's nullability and length is a check of its own.
- **Razor components**: a `.razor` file is read as the C# the Razor compiler generates for it, so a component and its code-behind (`X.razor.cs`) are one type: `@page` routes and `@attribute`s are its attributes, `@inherits` and `@implements` its bases, `@inject` a property, and `@code` its members, with what they call. Its `@using`s and those of the `_Imports.razor` files above it are its imports, and each fact points at the line it is written on. An MVC view or Razor Page (`.cshtml`) is read the same way, as a component named after its file in its project's namespace and folders (`Identity.API.Views.Account.Login`), with its markup, `@inject`s and `@functions`; `_ViewStart.cshtml` and `_ViewImports.cshtml` hold no view, so they are no type and no file, and only `_ViewStart`'s `Layout` is kept for the views below it.
- **XAML**: a `.xaml` file is parsed as the XML it is, never by patterns, whatever framework it is for (.NET MAUI, Xamarin.Forms, WPF, WinUI or Avalonia). One with an `x:Class` is a view, the markup half of the C# class it names: that class's files include it, so whatever locates the class locates its markup, and a code-behind written with no base class (`partial class CatalogView`) derives from its XAML root's type (`<views:ContentPageBase x:Class="...">`), as the XAML compiler's generated half makes it. An application (`App.xaml`, a platform head's `MauiWinUIApplication`), a `ResourceDictionary` or a file with no `x:Class` holds no view, so it is no file, and `unmodelled.file` doesn't ask for it. A file that isn't well-formed XML is reported as one that can't be read.
- **Markup**: a Razor component's markup, a Vue component's template, JSX and a XAML view are read the same way, as each framework's compiler parses them: elements with their attributes, the component a tag names (resolved through the file's imports, as the framework resolves it), directives such as `@onclick`, `@bind-Value`, `:to` and `@click` split into directive, argument and modifiers, and an element's text and an attribute's value as literals with the code in them as holes (`href="/orders/@id"`, `` to={`/orders/${id}`} ``), a XAML attribute a markup extension sets (`{Binding Name}`) being code with no literal. So a check can ask what a page renders, links to or titles itself, in any of them.
- **TypeScript, JavaScript, Vue and React**: `.ts`, `.tsx`, `.js`, `.jsx` and Vue single-file components' scripts are read with TypeScript's own parser, on Intent Architect's own Node.js, so nothing needs installing. Interfaces, type aliases, classes and enums are types; a module's functions and variables, and a `const` holding an object literal, are types too, so a module's API client is checked like a class; a Vue component has its props, emits and `<script setup>` members, and its template is its markup; a React component, several to a file if need be, has its props, state and functions, and its JSX is its markup. Imports, lazy `import()`s included, resolve through relative paths and `tsconfig.json`'s or `jsconfig.json`'s `paths` and `baseUrl`, and a type's nullability, a User Interface Property's Is Nullable included, is checked only under `strict` or `strictNullChecks`. JavaScript states no types, so a type check of it has nothing to compare; a minified `.min.js` isn't read.
- **Protobuf**: `.proto` files (proto2, proto3 and editions) are read with a parser of their own grammar, so no `protoc` is needed. Messages, enums and gRPC services are types; a field is a property with its number, `repeated` a collection and `map<K, V>` a map; an rpc is a method taking its request, with a streamed side as `stream` of its message; options are annotations. A field is nullable when it can be left unset: `optional`, in a `oneof`, or a message, such as `google.protobuf.Int32Value`. A model's field names are written as protoc writes them (`ProductId` is `product_id`), a message is a DTO's class or record, and a DTO with the Proto Message stereotype is the `.proto` message of its name even where a C# type shares it. A Service whose class derives from the base protoc generates for a `.proto` service (`Basket.BasketBase`, itself or through a class of the code's own) implements that service: its Operations must be the service's rpcs, each taking the rpc's request message and returning its response, and the service, its rpcs and its file are code the model describes. Of several `.proto` services of the name, such as a client's copy beside the server's, the one generated into the namespace the class names the base in is it. A Service with no generated base states nothing. Each Operation of a gRPC service is secured as ASP.NET Core secures its method (the Secured and Unsecured stereotypes, roles and policy): `[AllowAnonymous]` and `[Authorize]` on the method or its class, a method that rejects a caller who isn't authenticated with an `RpcException` of `StatusCode.Unauthenticated` (itself or through its class's own helper), `RequireAuthorization` on its `MapGrpcService<T>()`, and the fallback policy.
- **Python**: `.py` files and `.pyi` stubs are read with the engine's own parser (Python 3.13's syntax, `match`, type parameters and f-strings included), so no Python is needed. A file's module name comes from its packages (`__init__.py`) and what the code imports, so a `src/` layout and namespace packages work. Classes are types (a `Protocol` an interface, an `Enum` an enum, a `type` alias a type alias), and a module's functions and variables are a type of their own, as TypeScript's are, named as the module is, without the file's extension (`projects` for `projects.py`, `board` for `board.js`): a modelled element never needs one. A class's annotated attributes and what `__init__` assigns to `self` are its fields, `@property` methods its properties, `__init__` its constructor and `self` no parameter. The profile names a model's members in snake case (`QuantityOnHand` is `quantity_on_hand`). An annotation states nullability as a type checker reads it: `Optional[T]` and `T | None` can be `None`, any other type can't, and `Any` doesn't say. Python has no `new`, so a call to a class the code declares or imports, or to a CapWords name, is a creation; keyword arguments are named. A serialized name is Pydantic's `Field(serialization_alias=...)` or `Field(alias=...)`, marshmallow's `data_key` or msgspec's `field(name=...)`. An `Annotated` alias (`OrderServiceDep = Annotated[OrderService, Depends(...)]`) is the type it stands for wherever it annotates, with its metadata; an unannotated variable has its literal's type (`status_code = 404` is an `int`); `-> None` returns nothing; `setattr(order, name, value)` sets `order`'s attribute; and a dunder (`__repr__`, `__tablename__`) is the language's protocol, which `unmodelled.member` never asks for.
- **FastAPI, SQLAlchemy and Jinja**: a router module (`router = APIRouter(prefix="/orders")`) is a Service's code and its decorated functions are the Operations' endpoints, each route under the prefixes its router and every `include_router` add (the model may put any leading part of that path in the service's Route); a parameter binds from the path, its `Query`/`Form`/`Body`/`Header`/`Cookie` marker, the body for a Pydantic model, else the query, by its marker's `alias`; what FastAPI injects (`Depends`, `Request`, `Response`) isn't a parameter; the status is `status_code`'s, else 200; OpenAPI hides `include_in_schema=False` on a route, router or include; an operation is secured by a `Security(...)` dependency or one on a security scheme, at any depth; and it returns its `response_model`, else its `response_class`, else its annotation, a 204's `Response` being nothing. A SQLAlchemy declarative class (`__tablename__`, or a `DeclarativeBase`) is a persisted class: its table, primary key, `mapped_column` types, lengths and text types, `index=True` and `unique=True`, `ForeignKey`s and `relationship`s, an attribute's type being its `Mapped[T]`'s `T`; a `Session`'s `select(Order)`, `session.get(Order, id)` or `query(Order)` queries it, and a load then a change updates it. A Jinja template is one the Python renders (`TemplateResponse`, `render_template`, `get_template`), and so is every other in the folder that template is in; other HTML isn't read. A template others `{% extends %}` is a Layout, its `{% block %}`s its Regions, filled by the pages extending it; a page's route is that of the GET operation rendering it, its title its `title` block, its links' `url_for(...)` resolved as Starlette does (the app's first route of that name and path parameters), a form calls the operation its action reaches with its method, and a `<script src>` uses the script. A script's `fetch` or HTTP client call straight to an operation's verb and route calls that operation.
- **Nuxt and Nitro**: a Nuxt app is found by its `nuxt.config`, its source folder being `app/` (Nuxt 4) unless it is laid out as Nuxt 3 was or the config sets `srcDir`. What Nuxt's build generates and nobody commits is read from that layout: auto-imports (the source folder's `composables/` and `utils/`, the folders `imports.dirs` adds, `server/utils` on the server, `shared/utils` and `shared/types` on both sides) are imports of the names a file uses, and `~`, `@`, `~~`, `#shared` and `#server` resolve as Nuxt maps them, so Uses, calls and Perform Invocations read through them. Each `.vue` file under `pages/` is a page with the routes its path gives (`[id]`, optional `[[server]]` as the routes with and without it, `[...slug]` as `{*slug}`, `@[account]`), or `definePageMeta`'s `path` and `alias`, named by `definePageMeta`'s `name` or Nuxt's own, so a `{ name }` link or a route helper resolving one (`useRouter().resolve({ name: 'status' })`) navigates to it; `<NuxtPage>` is a router view, `layouts/` holds Layouts, `error.vue` is a Page, and a component's tag is the name Nuxt registers (`<ModalDurationPicker>` for `components/modal/DurationPicker.vue`, `Lazy`-prefixed too). Which route middleware secures a page is a house rule's to say. A Nitro route (`server/api/**`, `server/routes/**`) is a Service's module with its default-exported handler as the Operation `default`: its route from the path, its verb from a `.post.ts`-style suffix (any verb without one), its parameters what it reads with `getRouterParam(s)`, `getQuery`, `getHeader` and `readBody`, and the server utils it calls its invocations.
- **Vite plugins**: a Vite app is found by its `vite.config`, read for the options its plugins are given (literals, and paths built from its own folder), whether or not the Drift Scope puts it in scope. With vue-router's file-based routing (`vue-router/vite`, or `unplugin-vue-router/vite`), each page file in its routes folder (`src/pages` unless `routesFolder` says otherwise) of its `extensions` is a page with the routes its path gives (`[id]`, `[[id]]`, `[id]+`, `[...all]` as `{*all}`, `index`, `(group)`, a dot in a file name as a `/`), or the `path` and `alias` its `definePage` or `<route>` block (JSON5 or YAML) gives, named as theirs or vue-router's own (`/hi/[name]`). With `unplugin-auto-import`, what the folders its `dirs` scan export, and the names its `imports` presets take from the app's own modules, are imports of the names a file its `include` covers uses, in templates too with `vueTemplate: true`. With `unplugin-vue-markdown`, the `.md` files the router routes (its `extensions` name `.md`) or `unplugin-vue-components` registers (its `extensions` name `md`) are Vue components read like `.vue` files: their `<script>` blocks with TypeScript, their Markdown's HTML and components as their template, fenced and inline code being text; other Markdown is documentation, which nothing reads. Vue Macros' `defineModels` declares a bindable prop for each property of its type.
- **TypeScript monorepos**: an import of a workspace package by its name (`@acme/stores`) resolves into the package's folder in scope through its `package.json` `exports` (the `types` condition first), and an import through a barrel (`export * from`, `export { default as X } from './x.vue'`, a renaming `export { A as B }`) is of the file that declares the name, so Uses, Compositions and types read through them. A barrel is never reported by `unmodelled.file`; a module that re-exports a library's API under its own names is a module. A Vue component's props type and a Pinia store's state type are stated through the component's or store's Properties.
- **Spring Security and Thymeleaf**: with no security annotation on a handler or its controller, Spring Security's central rules decide it, as Spring Security does: the first `SecurityFilterChain` whose `securityMatcher` takes the request, then the first `requestMatchers(...)` (or `antMatchers`, `mvcMatchers`, `anyRequest()`) of its `authorizeHttpRequests` (or lambda `authorizeRequests`) matching the handler's verb and path; `permitAll()` is Unsecured, `authenticated()`, `hasRole` and `hasAuthority("ROLE_...")` Secured with their roles. A matcher's paths may be literals, constants, or a local or static array of them. A Thymeleaf template is a `.html` file under `src/main/resources/templates/` once a handler returns its view name (as a string, `ModelAndView`, or a view controller's `setViewName`), a named template decorates or includes it, or, for the rest of that folder, once the code renders any view from it. The User Interface package is the templates folder: a Page, Component or Layout is the template at its folder path and name. A template others `layout:decorate` is a Layout and its `layout:fragment`s its Regions; one that decorates a layout or that a handler renders as its page is a Page, with that handler's GET routes, its `@RequestParam` and `@PathVariable` parameters as Properties, its `<title>`, and the security Spring gives those routes (a page anyone may open states None, the designer having no Unsecured for a page); one others `th:replace` or `th:insert` is a Component. A Composition is a page filling a layout's fragment or an include; a Navigation a link or GET form to a route rendering the page, through a handler's `redirect:`; a call a link, form or htmx request (`hx-post`) with the operation handler's verb and route.
- **Nullability in Java**: Java doesn't say whether a reference is nullable, so it is checked only where the code states it: a primitive isn't, a boxed type or `Optional` is, `@Nullable` and `@NonNull` (and their kin) say so, and a JPA entity's `@Id`, `@Column(nullable)` and `@ManyToOne(optional)` state its columns'.

## Extending it

The engine knows no technology, not even a language. C# (Razor components, MVC views and Razor Pages included), XAML, Java, Python, TypeScript and Protobuf are stock language extensions; what the model states (HTTP, relational, validation constraints) and how a framework's code states it (ASP.NET Core, Spring MVC, FastAPI and Nitro, EF Core, JPA and SQLAlchemy, DataAnnotations, Bean Validation and FluentValidation, Jinja and Thymeleaf templates, Vue, Nuxt, React and Angular) are separate extensions, so another framework, or another language, reads the same claims. A framework's extension reads only when its framework is in the code, so a project without EF Core gets no EF Core answers.

A module extends the engine with a factory extension deriving from `DriftEngineExtensionBase`, entirely in C#, with nothing it can't express:

- **What the model states** (`ClaimSources`): the module says for each element what the code must say. The engine reads the model for it (`ModelContext`): a designer's elements, the elements an association links them to, and their stereotypes. Kinds are defined in code (`Kinds`), and its own designers are named in `Designers`. JSON packs say the same thing as data, as a shortcut.
- **What the code says** (`ClaimReaders`): the engine reads the code for it, so a module brings rules, not a parser. Besides every type and member, it gives each method's calls: what each is called on, its arguments and what the code says they are (`Send(new CreateOrderCommand(...))` sends a `CreateOrderCommand`, also through a local, a field, a cast or what a called method returns, and a message the method a link starts from takes as a parameter and hands to code that sends it), a literal argument's value whatever its quoting (`"Orders"`, the text and holes of `$"orders/{id}"`, `typeof(Order)` or `Order.class`), the type arguments it passes (`AddScoped<IOrders, Orders>()`), what each `new` is given, its initializer included, and which creation a value is, even through a local, each lambda and Program.cs's top-level statements as a unit with its own parameters, calls, assignments and returns, the method it reaches, even on another type, its text and where it is, following calls into the type's own helper methods, a component's markup (`CodeGraph.MarkupOf`), and the string a value builds (`CodeGraph.StringOf`): `GetFromJsonAsync(uri)` after `var uri = $"{baseUrl}items/{id}";` is `api/catalog/items/` with `id` as a hole, through fields, constants, `+`, trims and the code's own helper methods with their arguments bound, in C# and TypeScript. A method passed as a value (`this::audit`, `items.ForEach(Audit)`) counts as a call to it, and so does handing a library an object of the code's own, for the object's explicit implementations of the library's interfaces, which the library calls back (`sync.SyncDirectory(..., this)` runs the class's `IProgress<T>.Report`). When the code doesn't say what an argument is, the check reports it can't verify instead of guessing. A claim reader can word its own finding, with the fix.
- **A language** (`Languages`): one the engine doesn't read, or its own reader for a stock one, which replaces it. Its profile, how it names and wraps the model's members, comes in a pack.
- **Anything else**: comparers, rules over the model and the code together (such as layer imports), and code readers that add to what the engine reads. A rule's finding about a Context file isn't reported.
- **House checks are C#.** A kind a house's own stereotypes state, such as a concurrency token, enum storage, a HiLo sequence, a backing field, a delete behaviour, a file's location, a registration, a validator or an identified command, is read by a claim reader in the house's module; its pack only says what the model states. A module's reader is asked before the stock ones, so it can also take over a stock reading for the claims it reads and leave the rest. A module's rule (`IDriftRule`) with a stock rule's id replaces it, and the Software Factory log says so.
- **Code the model doesn't describe** (`OptInRules`): a rule that only finds such code, by what the claims located (`RuleContext.IsLocated`). The engine does the rest as it does for its own: it runs the rule only when a Drift Check row turns it on, and applies the row's glob, Context, the exceptions and the severity overrides.

For example, eShopCustom's Services module checks that a service operation sends the Integration Command its Perform Invocation link names. The engine gives it the operation's links and the `Send(...)` calls in its code, with what each sends; the module compares the two and words the fix.

A claim reader or rule can give, with a finding the code settles, the model change that settles it (`ClaimReading.Correcting`, `Finding.Corrections`): a link to draw or remove, an element to remove, a stereotype's properties to set, a stale exception to drop. The stock extensions give them for unshown sends and publishes, links the code never bears out, an attribute for a property EF doesn't map, an action's Http Settings and Web API 2's conventional routes. Intent.Common.Drift's move from v1 applies them. They aren't shown in the report.

A claim reader can say where an element's code is when the engine wouldn't find it, such as the private field a house stereotype names, in whatever form its reader keeps it, and the claims waiting on it get that. A claim can wait on any other claim, such as a column on its mapping, so one fault in the code is one finding. A module can also build on the stock EF Core reading rather than reading the configuration again.

When the house's own code changes what a framework's reading should see, a module refines the method instead of reading the claim itself (`Refiners`). The Java eShop parses a query string into an enum with its own `Http.parseEnum(OrderStatus.class, status, "status")` and responds through `Http.created(body)`; its module gives the handler with `status` as an `OrderStatus` and the response holding what `created` is given, and the stock Spring MVC reading compares the parameters and the return type as usual.

## What it reports

Each run adds its drift to the application's drift report (Intent.Common.DriftReporting): a designer's in `Domain (DriftEngine)`, `Services (DriftEngine)` or `User Interface (DriftEngine)`, scope and configuration problems in `Drift Scope (DriftEngine)`. The report holds only drift: an Area appears only when it has a finding. Without a Drift Scope the run only warns.

Each run also links every element to its code for Intent Architect's **View Code** and **Open in IDE**, and for **Changes Review**, which counts a changed line covered by a link as verified. So an element is linked only to the code its checks verified: a class to its declaration without its members, each member to its own declaration, an association to its navigations and the `HasOne(...).WithMany(...)` and `HasForeignKey(...)` that configure it, and an attribute to its EF Core configuration too. No line holding drift, or code the model doesn't describe, such as an unmodelled method inside a modelled class, is linked to anything. An element whose code holds drift is linked to its file instead, so View Code still opens it, with no lines counted as verified. The links are written to `.intent/model-links.json` on every run, which needs Intent Architect 5.4.2 or later.

The Software Factory log says what each run checked: how many claims, against how many files, how many were verified, contradicted or couldn't be verified, and how many elements were linked to their code, so a clean run can be told from one that checked nothing. It also lists the files left out of scope and why, and the nullability claims the code can't state (C# outside a nullable context, an unannotated Java reference, TypeScript without `strict`), with how to make them checkable, the Domain Constraints not checked because their entity's own code doesn't state them, what Intent Architect couldn't load from the model (an Operation returning a generic type it declares itself), with its error, which leaves only that unchecked, and how long the run took: reading the model, each language and code reader, building and reading the claims (with the slowest kinds), the rules and the opt-in rules. None of these are drift, so they never appear in the report.

## Related Modules

- Intent.Common.DriftReporting: the drift report the findings go to.
- Intent.Common.Drift: the recipe-based drift check this engine replaces. Updating it to 2.0 moves an application onto this engine; before that, both can run side by side.
