AutoForge/docs/architecture.md

9.4 KiB

Implemented architecture

Application shape

AutoForge is an in-process modular monolith with exactly one application executable: the Windows-first MAUI Blazor Hybrid Client. The application uses Razor component libraries for the complete routed UI and generic shared controls. There is no web/server host, WASM host or backend process.

flowchart TD
    Client[AutoForge.Client: MAUI startup, BlazorWebView and DI] --> UI[AutoForge.UI: routes and feature presentation]
    UI --> Components[AutoForge.Components: reusable generic UI]
    UI --> App[AutoForge.Application: cohesive feature slices]
    Client --> App
    App --> Diagnostics[AutoForge.Diagnostics: provider-neutral protocol and contracts]
    App --> Core[AutoForge.Core: platform-neutral models]
    Diagnostics --> Core
    Client --> Simulation[AutoForge.Simulation: synthetic provider and transport]
    Simulation --> Diagnostics
    Simulation --> Core
    UnitTests[AutoForge.UnitTests] --> Components
    UnitTests --> Core
    UnitTests --> App
    UnitTests --> Diagnostics
    UnitTests --> Simulation
    IntegrationTests[AutoForge.IntegrationTests] --> UI
    IntegrationTests --> App
    IntegrationTests --> Core
    IntegrationTests --> Diagnostics
    IntegrationTests --> Simulation

Projects and dependency boundaries

All nine projects are in AutoForge.slnx:

Project Target and responsibility Project references
Core net10.0; platform-neutral target and immutable vehicle-profile/module/capability/provenance invariants None
Diagnostics net10.0; provider/session/transport contracts, synthetic protocol v1 codec/client, typed operation results and bounded trace Core
Simulation net10.0; validated data-driven virtual modules, isolated state, provider factory and deterministic in-process transport Core, Diagnostics
Application net10.0; target/profile/diagnostic-session feature slices Core, Diagnostics
Components net10.0 RCL; generic StatusNotice with accessible tone and safe text rendering None
UI net10.0 RCL; all application routes, navigation, layout and presentation Application, Components, Diagnostics
Client net10.0-windows10.0.26100.0; only MAUI Blazor Hybrid application executable Application, Simulation, UI
UnitTests net10.0; Core/Application/contracts, protocol and reusable component tests Application, Components, Core, Diagnostics, Simulation
IntegrationTests net10.0; real DI, fixtures, provider transport/session and rendered UI/project-graph tests Application, Components, Core, Diagnostics, Simulation, UI

Components has no AutoForge project dependency. UI never references Client or Simulation. Application never references Simulation, UI, Components or Client. Core, Diagnostics and Simulation do not reference Application/UI/Client. Simulation's internal test oracle is available only to the integration-test assembly; it is not part of the production diagnostics or UI contract. There are no cycles or production-to-test edges. Tests render UI directly and never reference or launch Client.

The Client composes one SimulatedDiagnosticTransportFactory with both truck and orchard definitions. AddAutoForgeDiagnostics registers that factory's target descriptor and operational transport from the same registration data. Target metadata resolution remains a separate, metadata-only action. The profile catalog is process-local; importing does not select a revision or open a session. Replay and physical kinds have no operational implementation and are never substituted with Simulation.

UI ownership and real routes

All Razor routes and layouts are owned by the UI RCL; Routes scans the UI assembly, not the native Client assembly.

Route UI owner Implemented behavior
/ Features/Foundation/Home.razor Describes the synthetic diagnostic workflow and distinguishes it from dynamics and physical operations
/execution-targets Features/ExecutionTargets/SelectExecutionTarget/ExecutionTargetSelectionPage.razor Explicitly resolves registered provider metadata only; does not open a session
/vehicle-profiles Features/Vehicles/Profiles/VehicleProfilesPage.razor Explicit schema-v1 import, exact revision selection, metadata/provenance inspection and read-only export
/diagnostics Features/Vehicles/Diagnostics/DiagnosticsPage.razor Explicit saved profile/revision/provider/kind selection, session lifecycle, separate expected/probed/identified counts, retained partial probe services, identity-gated DTC/static signal operations, clear acknowledgement plus fresh-empty-readback verification, and raw/decoded trace
Any unmatched route Features/Foundation/NotFoundPage.razor via UI Routes.razor Explicit not-found page and supported navigation

The generic StatusNotice provides accessible status/error feedback. The diagnostics page loads its source-controlled synthetic profile example only after the user clicks its import action; it does not select the new profile. Every operational action requires an explicitly opened Simulation session. The page labels values as static synthetic snapshots and exposes transport outcomes instead of treating timeouts/no-responses as empty data. Discovery preserves a validated positive probe independently from optional profile-verified identity. Partial rows state the identity phase and reason; advertised services alone never enable identity-dependent read/clear actions.

The feature-local target-selection view model adapts explicit input to the existing Application resolver. The same target resolver is populated from the diagnostic factories' descriptors, so /execution-targets shows the actual provider metadata without implying connection. Diagnostic sessions bind the exact profile revision, vehicle, target and deterministic profile-configuration identifier. Closing releases per-session state; resetting closes and opens a new session at the definition's configured initial state.

The Application session use case keeps low-level clear.dtcs acknowledgement distinct from verified clear. It performs a fresh read and only marks the operation verified when the valid returned DTC list is empty. Failed or nonempty readback remains a visible failure/uncertainty; valid remaining codes are retained in the UI.

Application and capability boundaries

The accepted target-selection use case remains grouped under Application/Features/ExecutionTargets/SelectExecutionTarget/. It snapshots registrations, rejects duplicate IDs using ordinal case-insensitive comparison, resolves only exact requested metadata and preserves typed no-fallback failures.

The vehicle profile slice remains under Application/Features/Vehicles/Profiles/. Core owns immutable profile identity/revision, vehicle facts, arbitrary module roles, capability states and provenance context. Application owns strict schema-v1 JSON interchange and an in-memory catalog with exact (profileIdentifier, revision) selection. Existing schema-v1 profile JSON is unchanged.

AutoForge.Diagnostics defines provider-neutral endpoint, transport, session, protocol-client, logical-clock, operation-result and trace contracts. Its synthetic protocol v1 encodes each request and decodes each actual response through the transport interface. AutoForge.Simulation supplies the only operational implementation in this milestone. Module IDs, endpoint addresses, identities, supported synthetic services, initial DTC state, static signals and deterministic faults come from validated source-controlled definitions, not hard-coded application roles or profile capability claims. Details and honest limitations are in the protocol guide and simulation guide.

Honest limitations and safety boundaries

Implemented diagnostics are synthetic, in-process and Simulation-only. They prove the encoded request/response path and deterministic module behavior, not vehicle compatibility, access, authenticity, real capture or permission. Telemetry is a static synthetic state snapshot, not vehicle dynamics. Virtual DTC clear mutates only the selected in-memory virtual module/session and has no physical write path. Acknowledgement alone is not evidence that virtual state changed. No real vehicle, physical adapter, replay provider, programming, calibration values, backups, AI, persistence or cloud service is implemented. A SUPPORTED declaration, VERIFIED provenance label, physical metadata kind or calibration reference does not implement or authorize an operation.

The original ADR-0001 preserves valid foundation decisions but marks its dual-shell/deferred-host decision superseded. ADR-0002 is the current host and feature-slice decision. ADR-0004 records the Step-03 provider/protocol boundary. Worker completion remains distinct from manual orchestrator acceptance.