AutoForge/prompts/Step-03-Report.md

14 KiB

# Step-03 Worker Report

## Status

**COMPLETE** for the Step-03 worker implementation, full Release verification
and native Windows Client smoke. Manual orchestrator review/acceptance remains
pending. Step-04 was not started.

## Objective and scope

Delivered the synthetic diagnostics vertical slice in the existing native
Client: explicit profile/revision/provider/session selection; a provider-neutral
diagnostic contract and encoded request/response path; validated, data-driven
virtual modules; typed deterministic outcomes; session-isolated virtual DTC
state; static synthetic signals; bounded inspectable trace; rendered UI; tests
and documentation.

This implementation does not connect to a real vehicle. Protocol v1 is
AutoForge-specific JSON, not CAN, ISO-TP, UDS, OBD or a manufacturer protocol.
Static signals are fixture state, not vehicle capture, dynamics or prediction.
Virtual DTC clearing is in-memory simulation behavior only. There is no physical
adapter, replay provider, calibration/firmware/programming path, AI, backend,
persistence or additional executable.

## Projects and reference graph

Added exactly two `net10.0` class libraries; the solution contains nine projects
and retains one production executable and two test projects:

| Project | Direct project references |
|---|---|
| AutoForge.Core | None |
| AutoForge.Diagnostics | Core |
| AutoForge.Simulation | Core, Diagnostics |
| AutoForge.Application | Core, Diagnostics |
| AutoForge.Components | None |
| AutoForge.UI | Application, Components, Diagnostics |
| AutoForge.Client | Application, Simulation, UI |
| AutoForge.UnitTests | Application, Components, Core, Diagnostics, Simulation |
| AutoForge.IntegrationTests | Application, Components, Core, Diagnostics, Simulation, UI |

The project-graph integration test checks all nine projects, the exact direct
references, one `AutoForge.Client` executable and the existing framework
targets. Application/UI do not reference Simulation; Core, Diagnostics and
Simulation do not reference Application/UI/Client. Components remains
independent. There are no cycles or production-to-test edges.

`AutoForge.Diagnostics` owns provider/session/transport contracts, typed
operation and provider failures, immutable diagnostic results, logical-clock
and protocol-client interfaces, synthetic protocol-v1 codec/client and bounded
trace. `AutoForge.Simulation` owns the provider factory, validated data-driven
definitions, in-process transport, isolated state and deterministic faults.
Application owns explicit session open/reset/close coordination using
diagnostic interfaces and the existing profile/target services. Client
composes a single `SimulatedDiagnosticTransportFactory` with both source
definitions; its descriptor and operational factory are registered from the
same factory instance.

The state oracle is internal and available only to `AutoForge.IntegrationTests`
through `InternalsVisibleTo`. It is not exposed as an Application/UI service.

## Provider, session and protocol behavior

- Provider identifier/kind: `autoforge.simulation.synthetic` / `Simulation`.
  The provider resolves exact profile/revision and configuration; unknown
  profile, provider, target kind, definition or invalid mapping returns an
  explicit typed error. No first/latest/default/demo fallback exists.
- Target metadata resolution remains a separate metadata-only action. Opening
  a session requires explicit profile ID, exact revision, provider ID and kind.
  Replay and physical operational sessions are unavailable and are never
  substituted with Simulation.
- Session identity binds a deterministic session ID, exact profile/revision,
  vehicle ID, target descriptor and profile-configuration identifier. Each
  session owns its transport, logical clock, trace and virtual DTC state.
  Closing releases the session. Reset closes it and opens a new exact selection
  with configured initial state.
- Protocol v1 requests are UTF-8 JSON with version, session/profile/revision/
  configuration, correlation, target address, service, logical start tick and
  timeout tick. The actual encoded bytes traverse `IDiagnosticTransport`;
  actual reply bytes are envelope-validated and decoded into typed identity,
  DTC-clear/read and static-signal results.
- Received replies validate protocol version, session/configuration, address,
  service and correlation. Identity is compared to the exact selected profile
  snapshot. Unsupported service/version, unknown address, malformed payload,
  identity/correlation mismatch, no response, timeout and cancellation cannot
  produce success-shaped empty data.
- The default definition contains synthetic engine (`0x10`), transmission
  (`0x20`) and cabin/body (`0x30`) modules. Engine supports virtual DTC clear
  and starts with `SYN-P0123`; transmission probe deterministically does not
  respond and its existing DTC state is not cleared by engine operations;
  body clear is an unsupported negative response. The alternate orchard-cart
  inventory exercises an open custom module role.
- Static configured signals include fixed synthetic engine speed (850 rpm),
  voltage (12.6 V), transmission state and body door count. Signal results
  retain module/source, identifier, JSON value, unit, quality, logical time
  and `SYNTHETIC_STATIC` origin. These are not dynamics or live capture.
- Logical time is injectable per session and advances by deterministic
  transport ticks. Latency above the five-tick deadline returns Timeout with no
  response. Fault definitions cover no response, malformed reply, wrong
  correlation, wrong identity, timeout latency and hold-until-cancelled. No
  `Thread.Sleep`, randomness or wall-clock fault selection is used.
- Protocol exchanges are serialized per session. Trace retains at most 200
  ordered records, each with context, logical timing, raw copied request and
  optional copied response, decoded summary and explicit outcome. Oldest
  records are dropped at capacity and the count is exposed. No response payload
  is stored or fabricated for no-response/timeout/cancelled outcomes.

## UI and coupled status surfaces

Added `/diagnostics` in the UI RCL and navigation. The page has a user-triggered
synthetic profile import (no automatic import or selection), exact profile and
revision controls, explicit provider/kind controls, separate open/close/reset,
probe/read/virtual-clear actions gated by actually probed service declarations,
visible typed errors, module identities, DTCs, static signals, raw request/reply
inspection and trace-loss indication. Pending cancellation and session close
discard stale session results.

Client now registers the real Simulation provider. Target-selection metadata
presentation therefore shows the registered synthetic descriptor while still
stating that metadata selection does not open a session. Home text no longer
claims diagnostics are absent. Profile import/export and exact revision
semantics are unchanged.

The changed UI assertions intentionally reflect the new real provider: the
home-page assertion now describes the implemented synthetic workflow, and the
kind-mismatch page test no longer asserts that *all* `data-provider` markup is
absent because registered metadata is now correctly listed. It instead confirms
that no resolved `data-kind` result is rendered; it still asserts the mismatch,
no-fallback error and null selected descriptor. Empty-registry resolver,
unknown-provider, safety and no-fallback tests remain. No acceptance case was
deleted or skipped.

## Tests and verification

The accepted Step-02A regression baseline was 103 unit and 37 integration
tests (140 total). Step-03 retains those suites and adds protocol/trace and
transport/session/fault/UI coverage. Final full-suite results:

| Test project | Discovered | Passed | Failed | Skipped |
|---|---:|---:|---:|---:|
| AutoForge.UnitTests | 108 | 108 | 0 | 0 |
| AutoForge.IntegrationTests | 53 | 53 | 0 | 0 |
| Total | 161 | 161 | 0 | 0 |

Coverage includes request encode/decode and payload snapshots; bounded trace
order/loss and immutable raw bytes; exact/missing/duplicate/mismatched
simulation mappings and invalid services/signals; actual transport discovery,
identity, DTC, static signals and wire errors; virtual clear/readback plus the
independent oracle; other-module/session isolation and reset; unknown
profile/provider/definition/kind and no-fallback; unsupported version/service
and unknown address; no-response, timeout, malformed response, wrong
correlation/identity, cancellation/session close; injected logical-clock
determinism; rendered real-provider positive, timeout and cancelled states;
target/profile/home/not-found UI; and exact nine-project graph.

Commands were run sequentially:

- `dotnet restore .\src\AutoForge.slnx` — exit 0.
- `dotnet build .\src\AutoForge.slnx --configuration Release --no-restore` —
  exit 0; all nine projects, including Client
  `net10.0-windows10.0.26100.0` / `win-x64`; 0 warnings, 0 errors.
- `dotnet test .\src\AutoForge.slnx --configuration Release --no-build` —
  exit 0; 108 unit + 53 integration passed, 0 failed/skipped.

The verified environment was Windows x64, .NET SDK 10.0.402, runtime 10.0.13,
Windows SDK target 10.0.26100.0, MAUI Windows workload manifest 10.0.110 and
WebView2 Runtime 155.0.4283.62. No workload install/restore/update/repair or
package addition was needed.

## Native Client smoke

Launched the actual Windows MAUI executable using:

`dotnet run --project .\src\AutoForge.Client\AutoForge.Client.csproj --configuration Release --framework net10.0-windows10.0.26100.0 --no-build`

For local-only inspection of the actual WebView, the process used
`WEBVIEW2_ADDITIONAL_BROWSER_ARGUMENTS=--remote-debugging-port=9222`; no source,
launch setting or persistent environment configuration was changed. The
WebView2 DevTools endpoint was restricted to loopback and the native process
was stopped after the smoke.

Observed workflow:

1. `/diagnostics` initially showed only the profile placeholder and no session.
   The synthetic truck was imported only after clicking the explicit load
   action; the exact profile/revision/provider/kind were then selected.
2. Opening displayed Simulation provider, session ID, profile/revision and
   configuration ID. Probe found three expected endpoints and two actual
   responders: engine/body were positive; transmission at `0x20` showed
   `NoResponse` with “Configured endpoint did not respond.”
3. Engine identity, initial `SYN-P0123`, static signal identifiers/origin and
   trace were rendered. The trace showed ordered logical ticks/correlations and
   its expandable raw request and raw positive response JSON.
4. Virtual clear showed fresh readback with zero DTCs and explicitly stated
   “No physical write was performed.” Reset created a different session ID;
   rediscovery/read returned the configured initial `SYN-P0123`. Close removed
   the active session view.
5. `/execution-targets` listed and explicitly resolved
   `autoforge.simulation.synthetic (Simulation)` with “No connection or
   operation was performed” and no open session. `/vehicle-profiles` showed
   the explicitly imported revision without auto-selecting it. `/` and an
   unmatched route displayed the home and not-found pages with navigation.

Headless rendered tests additionally verified deterministic timeout and
cancelled trace/error presentation. The native smoke was performed against the
actual MAUI Client, not a browser host, mock provider or test-only host.

## Documentation and files

Added the Diagnostics and Simulation projects plus provider-neutral contracts,
synthetic protocol/client, simulation definitions/transport, application
session service, UI view model/page and unit/integration coverage. Updated
solution and project references, Client composition, route/navigation, home and
target metadata presentation, and project graph assertions.

Documentation updated: `README.md`, `docs/README.md`,
`docs/architecture.md`, `docs/build-and-test.md`. New documents:
`docs/synthetic-diagnostics-v1.md`, `docs/simulation.md` and
`docs/adr-0004-synthetic-diagnostics.md`.

The synthetic wire contract, module/profile binding, service-vs-claim
distinction, state/reset/oracle boundary, deterministic faults/logical time,
trace capacity/loss, native workflow and non-authentic limitations are
documented. Historical reports and strict profile schema documentation remain
unchanged.

## Acceptance criteria

| ID | Status | Evidence |
|---|---|---|
| AC-01 | PASSED | Nine-project graph test, exact references and one executable; Simulation oracle internal to IntegrationTests only. |
| AC-02 | PASSED | Exact profile/revision/provider/kind and session lifecycle integration tests; missing/unknown/mismatched selection failures; native explicit-selection flow; no physical/replay fallback. |
| AC-03 | PASSED | Real encoded requests cross the simulation transport; decoded responders/identity and raw frame/trace assertions; transmission is not falsely reported as a responder. |
| AC-04 | PASSED | DTC read/virtual clear/fresh readback, static signals, independent oracle, unrelated module and session isolation, reset-to-initial-state assertions. |
| AC-05 | PASSED | Deterministic unsupported, unknown address/version, no-response, timeout, malformed, correlation/identity mismatch, cancel and close vectors assert typed outcomes and no false empty success. |
| AC-06 | PASSED | Serialized logical trace, raw payload snapshot tests, exact outcomes, capacity/order/drop accounting and native expandable request/reply trace. |
| AC-07 | PASSED | Real application DI and Simulation composition; rendered positive, unsupported/no-response, timeout and cancelled/error UI; explicit provider metadata remains separate from open session. |
| AC-08 | PASSED | Full nine-project Release build (0 warnings/errors), 108 unit + 53 integration passed and actual native Client workflow/routes completed. |
| AC-09 | PASSED | README/index, architecture, build guide, protocol/simulation guides and focused ADR updated to implemented scope. |
| AC-10 | PASSED | Only Step-03 implementation/docs/tests and `prompts/Step-03-Report.md` changed; assignments, roadmap/state, prior reports and protected instructions preserved; no stage/commit/push/agent/handoff automation. |

## Limitations and handoff

Worker implementation, Release verification and native smoke are complete.
Manual orchestrator review/acceptance remains pending. The protocol is
synthetic-only, the current signal set is static, all data/state is
process/session-local, and no physical/replay/hardware operation is available.
Proceed only to manual review; do not begin Step-04 without an authorized
assignment.