10 KiB
10 KiB
# Step-03B - Preserve probe evidence when identification is unavailable
## Status
COMPLETE — implementation, documentation, regression coverage, Release build,
complete test suite and required native baseline smoke are verified. Step-03
remains pending manual orchestrator acceptance; Step-04 was not started.
## Root cause and correction
`DiscoverAsync` represented the combined discovery result using the later
identity result. Consequently, a successful validated probe was lost whenever
identity was unavailable or failed, and the responder count described verified
identities rather than endpoints that had actually passed probe validation.
Discovery now keeps the validated `DiagnosticProbeResult` and its immutable
advertised services separate from the optional `DiagnosticOperationResult`
for identity. `DiscoveryEntry` exposes independent probe and identity outcomes,
errors, identity status, and a reason when identity was not attempted.
`DiscoveryResult` exposes expected-endpoint, validated-probe and identified-
module collections/counts independently.
Chosen policy: when a positive probe does not advertise `read.identity`, do not
send an unsupported identity request. Preserve the positive probe and services,
leave identity null/unverified, and report an explicit not-attempted reason.
Failed probes have no services and identity remains not attempted. No identity
or permission is inferred from profile metadata. Read and clear remain gated on
profile-verified runtime identity.
The UI reports the three distinct counts, renders phase-specific outcomes and
reasons, shows retained probe service claims for partial rows, and disables
identity-dependent actions until identity is verified. View-model action guards
remain in place independently of the disabled controls. Each trace record
continues to reflect only its actual exchange.
## Files changed for Step-03B
- `src/AutoForge.Diagnostics/ProviderContracts.cs`
- `src/AutoForge.Diagnostics/SyntheticDiagnosticProtocolClient.cs`
- `src/AutoForge.UI/Features/Vehicles/Diagnostics/DiagnosticPageViewModel.cs`
- `src/AutoForge.UI/Features/Vehicles/Diagnostics/DiagnosticsPage.razor`
- `src/tests/AutoForge.IntegrationTests/DiagnosticSessionCompositionTests.cs`
- `src/tests/AutoForge.IntegrationTests/DiagnosticUiCompositionTests.cs`
- `README.md`
- `docs/synthetic-diagnostics-v1.md`
- `docs/simulation.md`
- `docs/architecture.md`
- `docs/adr-0004-synthetic-diagnostics.md`
- `docs/build-and-test.md`
- `prompts/Step-03B-Report.md` (this report)
No assignment, roadmap or state file was edited in this step.
## Reproduction and tests
Before the fix, the new probe-only regression was executed through the real
Simulation transport and DI composition. It failed as expected: the test
observed `NegativeResponse` for discovery where the validated probe phase
expected `PositiveResponse`. This reproduced the phase conflation at runtime,
not by static inspection.
After correction, the focused real protocol/UI integration selection passed:
35 passed, 0 failed, 0 skipped. The real-path matrix covers:
- Probe-only module: positive probe and service list retained, identity not
attempted, no identity request emitted, and expected/probed/identified counts
asserted.
- Negative, malformed, mismatched and timed-out identity exchanges after a
positive probe: null identity, retained exact service list, separate phase
outcomes and exactly one truthful trace record per exchange, with distinct
correlation identifiers.
- Cancellation while identity is pending: positive probe remains positive,
identity is cancelled, and partial counts/services remain accurate.
- Failed probe vectors: no invented services or identity, explicit
not-attempted identity state, and counts exclude the failed probe.
- Normal identified and configured no-response modules, plus existing
clear/readback/reset/session-isolation and trace behavior.
- Rendered real `/diagnostics` partial state: distinct counts, reason/status,
retained services, no profile-derived identity, and disabled read/clear
buttons. Directly invoking the view-model actions also emits no new exchange
and fails closed.
- Rendered UI cancellation after a positive probe, followed by session close;
no stale discovery row remains after close.
An intermediate focused run exposed an incorrect new test expectation: because
discovery is sequential, cancellation during the first endpoint's identity
exchange leaves only that endpoint's probe completed. The expected partial
counts were corrected to one validated probe and zero identities; the focused
suite then passed.
## Full Release verification
Exact build command:
`dotnet build .\src\AutoForge.slnx --configuration Release --no-restore`
Result: exit code 0; all nine solution projects built; 0 warnings and 0 errors.
The MAUI XAML source-generation informational message was emitted; it was not a
warning or error.
Exact test command:
`dotnet test .\src\AutoForge.slnx --configuration Release --no-build`
Result: exit code 0; `AutoForge.UnitTests`: 111 passed, 0 failed, 0 skipped;
`AutoForge.IntegrationTests`: 72 passed, 0 failed, 0 skipped; 183 total.
This retains the 175 Step-03A cases (111 unit and 64 integration) and adds
eight integration cases for Step-03B.
## Native and rendered evidence
The actual Windows Client was launched with:
`src\AutoForge.Client\bin\Release\net10.0-windows10.0.26100.0\win-x64\AutoForge.Client.exe`
The Client was launched as a native Windows process. To interact only with its
own WebView while leaving the shared desktop undisturbed, it was relaunched with
the process-local `WEBVIEW2_ADDITIONAL_BROWSER_ARGUMENTS=--remote-debugging-port=9333`;
the local WebView target was `https://0.0.0.1/`. The transient debug listener
and Client processes were stopped after the smoke. No project configuration or
dependency was changed for this test.
Observed native baseline sequence:
1. `/diagnostics` initially showed no imported/selected profile or active
session. Clicked **Load synthetic truck example** and verified the profile
became available without auto-selection or session opening.
2. Explicitly selected `autoforge.synthetic.test-truck`, revision `1`,
`autoforge.simulation.synthetic`, and `Simulation`; opened session
`diagnostic-session-000001`. The UI stated that no physical connection was
attempted.
3. Probed modules. The summary showed 3 expected endpoints, 2 validated
positive probes, and 2 profile-verified identities. Engine and cabin/body
had positive probe and identity results. The transmission probe visibly
returned `NoResponse` with `Configured endpoint did not respond.` The raw
trace contained the distinct positive probe/identity records and the
transmission no-response record.
4. Read engine DTCs and static signals. The UI showed `SYN-P0123`,
`synthetic.engine.speed`, and `850`; the trace grew from five discovery
records to seven and included positive `read.dtcs` and `read.signals`
exchanges.
5. Cleared engine virtual DTC state. The UI stated “Fresh readback verified
that no DTCs remain” and “No physical write was performed.” The trace grew
to nine records and showed positive `clear.dtcs` followed by a fresh
positive `read.dtcs` with zero DTCs.
6. Reset opened `diagnostic-session-000002` and cleared prior discovery
presentation. A new probe/read restored and displayed `SYN-P0123`.
Closing removed active-session and discovery rows and showed the expected
isolated-state/trace release status.
7. Existing native routes rendered expected headings: `/execution-targets`
(“Select execution-target metadata”), `/vehicle-profiles` (“Vehicle profile
metadata”), `/` (“AutoForge foundation”), and `/not-a-route` (“Page not
found”).
The Step-03B partial-identity scenario, disabled actions and cancellation/
close behavior are covered by the actual DI transport composition and rendered
Blazor route tests; they are not claimed as native Client coverage. The prior
Step-03A native evidence remains historical and is not substituted for this
Step-03B native requirement.
## Acceptance criteria
| Criterion | Status | Evidence |
|---|---|---|
| AC-01 | PASSED | Real probe-only and identity-failure transport tests assert separate phase results, retained service values and null/unverified identity. |
| AC-02 | PASSED | Result counts and rendered partial row/reason/service/action-gate assertions; direct view-model action guards emit no exchange. |
| AC-03 | PASSED | Probe failure, no-response, identity timeout/malformed/mismatch/cancellation, correlation-specific trace, session lifecycle and rendered close/cancellation coverage. |
| AC-04 | PASSED | Nine-project Release build and all 183 tests pass; prior 175 cases remain. Existing Step-03A verified-clear and wire-validation coverage remains green. |
| AC-05 | PASSED | Actual pre-fix runtime failure, focused and complete verification, and the native Windows operational baseline smoke are recorded above. The partial-identity fault is covered by rendered real-DI tests, not claimed as native coverage. |
| AC-06 | PASSED | README, protocol, Simulation, architecture, ADR-0004 and build/test documentation describe phase/count/action semantics and evidence. |
| AC-07 | PASSED | This report is saved; only scoped code/tests/docs/report work was performed. No Step-04, assignment/roadmap/state edits, staging, commit or push. |
## Preservation, scope and remaining work
The existing dirty worktree includes broader Step-03/Step-03A implementation
and documentation, as well as pre-existing edits to `prompts/ROADMAP.md` and
`prompts/STATE.md`. Those two orchestration files were preserved and not edited.
No new project, package, dependency, workload, host, provider, protocol version
or unrelated feature was added. R-01/R-02/R-03 behavior and tests remain intact.
`git diff --check` reported no whitespace errors; Git emitted only its existing
LF-to-CRLF working-copy advisory for `README.md`.
All Step-03B worker checks are complete. Stop for manual orchestrator review;
do not begin Step-04. No files outside the Step-03B scope were staged or
committed; no push or handoff automation was performed.