12 KiB
12 KiB
# Step-06A - Preference Rejection and Unavailable Readouts
Status: COMPLETE on worker implementation and verification evidence; pending
manual orchestrator review. Step-06 remains NOT ACCEPTED. Step-07 was not
started.
## Summary
Corrected the two focused Step-06 review findings without changing the approved
Imperial (US) / Road default, conversion mappings, editor policy, model state,
source contracts or protocol behavior.
- Preference proposals are validated before initialization or store access.
Invalid enum values produce a typed `InvalidSelection` error and leave the
active selection, initialized state, persisted-state flag and store untouched.
- The shell uses Blazor `@bind:get` / `@bind:set` selectors. Failed preference
writes retain the prior active selection and reconcile both rendered controls
and cascaded readouts; a later successful retry saves and publishes once.
- Diagnostics and simulation use the shared typed/quality-aware presentation
boundary. Missing/null/undefined and Unknown values show `--`; invalid types
for known numeric units are explicit errors; valid zero and boolean false stay
real values; Uncertain remains visibly Uncertain; unsupported unit content is
preserved with an unconverted notice. Separately labeled source context
remains inspectable, including literal JSON `null`.
- Simulation telemetry passes source quality through the same projection.
Existing dashboard state, source sample, range and freshness are preserved
when display conversion fails.
No project, package, dependency, host, protocol, schema, physics or configuration
fingerprint was changed. No stage, commit or push was performed.
## R-01 / R-02 evidence
Before the fix, the invalid-proposal regression on a fresh service with stored
`metric|road` failed: the invalid proposal loaded the stored Metric choice
instead of leaving the untouched default, and store access was not zero. Before
the presentation fix, the regressions observed `"null"` for a null `m/s`
measurement, `"not a number"` echoed as a numeric `m/s` readout, and no
unconverted notice for unsupported-unit text.
After the fix, `PreferenceService_RejectsInvalidChoiceBeforeInitializingOrReadingStore`
asserts the typed rejection, default/unchanged state, `IsInitialized == false`,
`IsPersistedSelection == false`, zero reads and zero writes. The two
`RejectedSelectorEventReconcilesControlAndReadoutAndCanRetry` theory cases
invoke the actual `MainLayout` selector binding callbacks through a component
renderer with a controlled failing store; they assert both controls and the
cascaded readout remain Metric/Road after failed unit-system and speed-mode
writes. Successful retries persist exactly once per retry, update the selection
and readout, and clear the error. This is framework binding/render
reconciliation evidence, not a claim that a native platform storage fault was
injected. No separate pre-fix native browser-DOM rollback failure was observed.
`DiagnosticRoute_RendersNullWrongTypeUnknownAndUnsupportedStaticV1SignalsTruthfully`
uses the real static-v1 route and checks null, wrong-type numeric, Unknown
quality with numeric source, unsupported-unit text, numeric zero and boolean
false while retaining source unit, quality and logical sample context.
`DisplayUnitPresentationTests` covers null, wrong type, Unknown, Uncertain,
zero, false, unsupported numeric/text and exact JSON null/boolean source text.
`DisplayProjectionPreservesConvertedUncertainStaleStoppedAndUnavailableStates`
drives a real static-provider feed through Uncertain, failed-read/Stale,
overflow/unavailable display conversion, recovery and Stopped. Rendered state,
reason, source context and range are preserved; an unavailable display
conversion does not fabricate a meter. Existing paused-model and read-count
assertions continue to protect source/acquisition invariants.
## Corrective matrix
| ID | Result | Actual evidence |
|---|---|---|
| C-01 | PASSED | Pre-fix fresh-service failure reproduced. `PreferenceService_RejectsInvalidChoiceBeforeInitializingOrReadingStore` now proves typed invalid-selection rejection before initialization/read/write, with default selection and persisted-state flag unchanged and 0 store calls. |
| C-02 | PASSED | Both actual shared-selector binding callback cases fail writes through a controlled store. `RejectedSelectorEventReconcilesControlAndReadoutAndCanRetry` proves the system and speed controls, active preference and shared Metric/Road readout remain aligned. `FailedDisplayPreferenceWritesLeavePausedDynamicsAndFeedUnchanged` proves failed saves do not mutate paused model status, feed readings/definitions, trace, signal-read count or exported configuration. |
| C-03 | PASSED | The same binding callback cases recover the store, retry the valid selection, save once for the retry, update the chosen control and readout, and clear the typed error. |
| C-04 | PASSED | A real rendered static-v1 route shows `--` for null and Unknown numeric input. Literal `null`, raw numeric source, unit, quality, logical time and origin remain visible in the source context. |
| C-05 | PASSED | Wrong-type known numeric input is `--` with an explicit error and raw source text retained. Numeric zero and boolean false remain distinct values. Unsupported numeric and text preserve source value/unit and display an unconverted notice. Strict protocol-v2 validation was not loosened. |
| C-06 | PASSED | The real-feed `DisplayProjectionPreservesConvertedUncertainStaleStoppedAndUnavailableStates` test verifies converted Uncertain/Stale/Stopped behavior and failed display conversion without a fabricated meter or quality substitution. Source sample/time/range and no-extra-read/step invariants remain checked. |
| C-07 | PASSED | The original 270 Step-06 cases and positive native behavior are preserved. Final Release suite is 179 unit + 105 integration = 284 passing (14 corrective cases added); native smoke rechecked selectors, static/dynamic readouts, editor, persistence and close. Recording/replay remains unimplemented. |
## Acceptance criteria
| ID | Result | Evidence |
|---|---|---|
| AC-01 | PASSED | R-01/C-01..C-03 service and binding-event coverage above, including actual callback failure/retry and source/model invariance. |
| AC-02 | PASSED | R-02/C-04..C-06 shared-helper, rendered real static-v1 and real-feed quality/freshness coverage above. |
| AC-03 | PASSED | The 270-case baseline remains green; final nine-project Release build and complete test suite pass; rebuilt native Client smoke confirms the positive baseline. |
| AC-04 | PASSED | Named pre/post regressions, docs/README updates, and post-green self-review of validation order, binding reconciliation, typed/quality branches, raw source formatting, and unchanged conversion/source contracts are recorded here and in the related guides. |
| AC-05 | PASSED | Protected orchestration/history files, dependencies and manual workflow were preserved. This report is saved; Step-07, staging, commit and push were not started. |
## Files and interfaces changed
- `src/AutoForge.Application/Features/DisplayUnits/DisplayUnitSettings.cs`:
typed preference error kind, pre-initialization enum guard and known-unit
predicates.
- `src/AutoForge.UI/Layout/MainLayout.razor`:
framework binding reconciliation for both shared selectors.
- `src/AutoForge.UI/Features/DisplayUnits/DisplayUnitPresentation.cs`:
source-value formatting and shared typed, quality-aware projections.
- `src/AutoForge.UI/Features/Vehicles/Diagnostics/DiagnosticsPage.razor`,
`src/AutoForge.UI/Features/Vehicles/Simulation/SimulationPage.razor` and
`src/AutoForge.UI/Features/Vehicles/Simulation/SimulationPageViewModel.cs`:
source quality and raw source values flow through the assigned readouts.
- Tests: `DisplayUnitSettingsTests.cs`, new
`DisplayUnitControlTests.cs` and `DisplayUnitPresentationTests.cs`,
`DiagnosticUiCompositionTests.cs`, `LiveDashboardAcquisitionTests.cs` and
`DynamicsWorkflowTests.cs`.
- Documentation: `README.md`, `docs/README.md`, `docs/architecture.md`,
`docs/build-and-test.md`, `docs/live-dashboard.md` and `docs/simulation.md`.
The original Step-06 report and its positive evidence remain historical and
unchanged.
## Verification commands and results
The solution uses VSTest/xUnit with .NET SDK 10.0.402. The required full
commands were run sequentially after the final code/test edits:
- `dotnet build .\src\AutoForge.slnx --configuration Release --no-restore`
— exit 0; all nine projects, including the Windows Client, built; 0 warnings,
0 errors. The MAUI XAML source-generation notice was informational.
- `dotnet test .\src\AutoForge.slnx --configuration Release --no-build`
— exit 0; 179 unit and 105 integration tests passed, 0 failed and 0 skipped.
This preserves the 178-unit/92-integration Step-06 baseline and adds 1 unit and
13 integration corrective cases. Named added cases are given in the matrix
above. `git diff --check` completed with no whitespace errors; Git emitted only
its existing LF-to-CRLF working-copy normalization notices for edited Markdown.
## Native Windows Client smoke
The exact rebuilt Windows executable was run with task-local environment
isolation: `LOCALAPPDATA` pointed at
`%TEMP%\AutoForge-Step06A-WebView2\LocalAppData`,
`WEBVIEW2_USER_DATA_FOLDER` at
`%TEMP%\AutoForge-Step06A-WebView2\WebView2`, and
`WEBVIEW2_ADDITIONAL_BROWSER_ARGUMENTS` set the loopback DevTools port to 9361.
The isolated environment prevented reads/writes to the user's normal app
preferences and WebView profile.
- Fresh isolated launch showed Imperial (US) / Road before any session.
- A real static-v1 session was opened through explicit profile/provider
selection, discovered and read; `synthetic.engine.speed` remained 850 rpm.
The session was closed and its dashboard released.
- A real dynamics-v2 session was paused at step 203 / 20.3 s with exact source
speed 20.1168 m/s. Native telemetry readouts showed 20.117 m/s for Metric /
Engineering, 72.420 km/h for Metric / Road, 45.000 mph for Imperial / Road
and 66.000 ft/s for Imperial / Engineering. The same source value, Good
quality, model step/time, configuration fingerprint and run identity remained
inspectable.
- A native horizontal speed bar displayed 72 km/h from source 20.1168 m/s with
0..144.84096000000002 km/h bounds (canonical source bounds 0..40.2336 m/s)
and 50% geometry. Its open Metric/Road editor draft retained km/h values and
labels after the global preference changed to Imperial (US)/Engineering.
- The dynamics session was closed. The preference was set to Metric/Road, the
app closed and relaunched with the same isolated storage, and Metric/Road
restored as saved. The exact task-owned profile was then removed; both
Client processes and loopback port 9361 were closed.
Native storage failure injection and malformed v1 payload injection were not
performed. They are established by the controlled store/event tests and the
real static-v1 rendered integration path, respectively; they are not reported
as native observations. No unrelated preferences or profiles were changed.
## Self-review and preservation
After the first green full build/test, the changed source paths were re-read.
Invalid enum validation precedes `Initialize()` and store I/O; valid writes
remain persistence-before-publication. Both selectors derive their values from
the committed service selection. The shared readout checks Unknown/missing/
null/wrong type before conversion, preserves finite zero/false, adds quality
context, and formats unsupported source values without inventing conversion.
Diagnostics and simulation retain a separate source value/unit; dashboard
source quality/state/range/sample are not mutated by display projection.
Conversion factors, default, canonical bounds, strict v2 contract and model
inputs remain unchanged.
`prompts/STATE.md`, `prompts/ROADMAP.md`, `prompts/Step-06-Report.md`,
`prompts/WORKER-QUALITY-GATE.md`, assignments, package manifests and project
references were not edited. No dependency restore/install, stage, commit, push
or automatic handoff occurred. The worker stops here for manual review; do not
start Step-07.