166 lines
14 KiB
Markdown
166 lines
14 KiB
Markdown
```
|
|
# Step-06 - Imperial-default display units
|
|
|
|
Status: COMPLETE on worker implementation and verification evidence; pending
|
|
manual orchestrator review. Step-07 was not started.
|
|
|
|
## Summary
|
|
|
|
Added one shared Imperial (US)/Metric and Road/Engineering selection, with
|
|
Imperial (US) / Road as the first-use default. The native Client persists this
|
|
small selection through MAUI Preferences. The pure conversion boundary projects
|
|
finite source numerics into supported display units without mutating source
|
|
signals, SI model state, configuration JSON/fingerprints, exact dashboard
|
|
bindings/bounds, source quality/range/time, or acquisition ownership.
|
|
|
|
The shared shell exposes accessible controls and truthful first-use/restored/
|
|
error state before a vehicle session opens. Diagnostics, simulation scenario
|
|
targets, simulation telemetry and live dashboard readings use the same
|
|
conversion logic. Dashboard edit bounds are displayed in a draft-pinned unit
|
|
and converted to source units only for changed inputs. Unknown units are
|
|
preserved with an explicit unconverted notice; conversion/storage failures are
|
|
visible and do not fabricate data or publish a failed selection.
|
|
|
|
## Implemented code and documentation
|
|
|
|
- `src/AutoForge.Application/Features/DisplayUnits/DisplayUnitSettings.cs`
|
|
defines the immutable selection, exact mapping/inverse/bounds conversions,
|
|
preference port/service, validation and visible storage-failure behavior.
|
|
- `src/AutoForge.Client/DisplayUnits/MauiDisplayUnitPreferenceStore.cs` adapts
|
|
the application port to MAUI `Preferences`; `MauiProgram.cs` registers it
|
|
before UI composition.
|
|
- `src/AutoForge.UI/Features/DisplayUnits/DisplayUnitPresentation.cs` converts
|
|
JSON/dynamics numeric values from their raw numeric representation before
|
|
formatting. `MainLayout.razor` owns the shared controls, status/error and
|
|
cascading selection.
|
|
- `LiveDashboardPanel.razor` projects values/ranges without changing canonical
|
|
definitions, preserves source reading state on projection failure, pins
|
|
editor selection, converts edited bounds once, retains exact unedited bounds,
|
|
and exposes explicit reset/cancel/error context.
|
|
- `DiagnosticsPage.razor`, `SimulationPage.razor` and
|
|
`SimulationPageViewModel.cs` retain raw/source columns and add display-only
|
|
projections for assigned human-readable measurements.
|
|
- `src/tests/AutoForge.UnitTests/DisplayUnitSettingsTests.cs` adds pure mapping,
|
|
inverse, bounds, overflow, unknown/pass-through, rounding and preference-store
|
|
cases. `src/tests/AutoForge.IntegrationTests/IsolatedDisplayUnitPreferenceStore.cs`
|
|
supplies explicit portable test persistence. Integration composition uses
|
|
that store rather than the unavailable UI fallback.
|
|
- Related composition tests and `DynamicsWorkflowTests.cs` cover real providers,
|
|
shared rendering, paused-session toggles and source/wire invariants.
|
|
- Updated `README.md`, `docs/README.md`, `docs/architecture.md`,
|
|
`docs/build-and-test.md`, `docs/live-dashboard.md` and `docs/simulation.md`.
|
|
Step-05/05A/05B are identified as accepted; Step-06 is worker-complete and
|
|
pending manual review. Step-07 remains blocked.
|
|
|
|
No project, package, host, project reference, protocol, schema, physics,
|
|
configuration fingerprint, history file or automation was added or changed.
|
|
No commit/stage/push was performed.
|
|
|
|
## Contract matrix and named evidence
|
|
|
|
| ID | Result | Executed evidence |
|
|
|---|---|---|
|
|
| C-01 | PASSED | `PreferenceService_UsesImperialRoadDefaultAndRestoresPersistedChoice` and native first-use shell: selectors were present before a session, the missing-key state identified Imperial (US) / Road as the first-use default, and no ambient culture/region was used. |
|
|
| C-02 | PASSED | `Project_KnownMappingsMatchIndependentVectors` and `ConvertToSource_RoundTripsSupportedVectorsWithinTolerance`: exact independent vectors and inverse conversions, absolute target tolerance 1e-9. Covered 20.1168 m/s -> 45 mph / 66 ft/s / 72.42048 km/h; 0.3048 m -> 1 ft; 0.45359237 kg -> 1 lb; (0.45359237/3600) kg/s -> 1 lb/h; 1.3558179483314004 N*m -> 1 lbf*ft; 0/100/-40 degC -> 32/212/-40 degF; and 0.3048 m/s^2 -> 1 ft/s^2. |
|
|
| C-03 | PASSED | `SpeedBoundsAndValueProjectionPreserveCanonicalGeometry` asserts all four raw projections and 0..40.2336 m/s bounds yield 50% geometry. Native real dynamic v2 sample was exactly 20.1168 m/s; observed display/range pairs were 45 mph / 0..90 mph, 66 ft/s / 0..132 ft/s, 72 km/h / 0..144.84096 km/h at the gauge's configured precision 0, and 20 m/s / 0..40.2336 m/s. All showed 50% meter geometry and unchanged source range/value. Exact unrounded 72.42048 km/h is independently asserted by the pure vector test. |
|
|
| C-04 | PASSED | `DisplayUnitTogglesOnPausedDynamicsFeedRerenderWithoutSourceOrModelMutation` performs 20 shared-preference toggles/rerenders on an actual paused dynamics session. It compares definitions, feed source context/values/states/range/time, immutable dynamics status, exported configuration, trace entries and byte-for-byte request/response payloads; actual `ReadSignals` trace count does not increase. |
|
|
| C-05 | PASSED | `Bounds_ConvertOffsetsAndRoundTripWithoutRoundingCanonicalValues` asserts 32..212 degF -> 0..100 degC, and `InvalidDefinitionReplacementIsAtomicAndEnforcesZeroToEightLimit` preserves feed state on rejected definitions. Native editor saved 0..90 mph as 0..40.2336 m/s; rejected 200..100 with visible alert and unchanged gauge; an unedited Save retained prior canonical bounds exactly. |
|
|
| C-06 | PASSED | Native editor opened on a real dynamic gauge with 10..110 mph typed, then global units changed to Metric/Road. Labels and values remained mph / 10..110 until save; saved source bounds were 4.470400000000001..49.174400000000006 m/s. The rendered draft-context message identified captured Imperial/Road units. Cancel and unedited Save were also exercised. |
|
|
| C-07 | PASSED | Existing real-feed coverage in `LiveDashboardAcquisitionTests` and `DynamicsWorkflowTests` verifies Pending/Good/Stale/Stopped, source quality/range/time and actual source context. Projection failures now keep `gauge.State` and separately show an alert/unavailable display; no conversion changes quality or clamps the value. |
|
|
| C-08 | PASSED | `Project_PreservesAssignedPassThroughUnits`, `Project_PassesThroughKnownUnitsAndExplicitlyLabelsUnknownUnits`, `Project_RejectsNonFiniteInputAndOverflowWithoutFabricatedValue` and `UnknownBoundsRemainSourceUnitsAndInvalidSelectionRejects` cover exact unchanged units, unsupported pass-through/notice, invalid enums, infinities, conversion overflow and finite ordered bounds. Native invalid edited bounds displayed an alert without changing the prior definition. |
|
|
| C-09 | PASSED | `PreferenceService_CorruptStoredChoiceShowsDefaultAndDoesNotOverwrite`, `PreferenceService_ReadFailureIsVisibleAndExplicitSelectionCanRecover`, and `PreferenceService_InvalidChoiceAndFailedWritePreserveActiveSelection` use controlled read/corrupt/write failures on the real service/port, including write atomicity. Native MAUI adapter started with no saved key; after explicit selection, closing/reopening the rebuilt Client restored saved Imperial (US) / Road. |
|
|
| C-10 | PASSED | The dynamics route test asserts displayed Imperial values and retained source `degC`, `kg/s`, `m/s`; configuration export is byte/string-identical across selection changes. The 20-toggle integration test compares copied raw trace request/response byte arrays. Native telemetry retained source 20.1168 m/s and 88.82446676508809 degC while showing display values; exported configuration remained 2,789 characters with SI target 20.1168 and no mph/km/h text. |
|
|
| C-11 | PASSED | `Project_ConvertsBeforeDisplayRounding` verifies raw 0.4 m/s -> approximately 0.894774516821761 mph within 1e-9 before precision-zero formatting to `1`, not `0`. |
|
|
| C-12 | PASSED | `StaticProviderCannotOpenDynamicsControls`, `StaticSession_FirstStartGroupsReadsAndSharesOneOwner`, `RealApplicationAndRenderedRoute_RunAndReadDynamicTelemetryWithoutOracle`, and the paused dynamics toggle test exercise real static v1/dynamic v2 composition. Native Client smoke configured a static rpm gauge and a dynamic speed bar, exercised existing routes, reset and close. |
|
|
|
|
## Acceptance criteria
|
|
|
|
| ID | Result | Evidence |
|
|
|---|---|---|
|
|
| AC-01 | PASSED | C-01/C-09 tests above plus real MAUI Preferences save/restart evidence. |
|
|
| AC-02 | PASSED | C-02/C-03/C-08/C-11 vector, inverse, precision, bounds, invalid and native rendered evidence above. |
|
|
| AC-03 | PASSED | C-04..C-07 real-feed source/state/wire invariants and native pinned editor, invalid save, unedited save and reset evidence above. |
|
|
| AC-04 | PASSED | Diagnostics, simulation scenario/telemetry, shared dashboard, raw/source inspectors, configuration JSON and native static/dynamic paths all use or preserve the assigned source/display boundary. |
|
|
| AC-05 | PASSED | Final nine-project Release build and all 270 preserved/added tests passed. Rebuilt native Client smoke covered static/dynamic gauges, four speed modes, draft/save/failure, restart, reset/close and legacy routes. |
|
|
| AC-06 | PASSED | Frozen matrix and exact named evidence are recorded here. Self-review and documentation changes are below. |
|
|
| AC-07 | PASSED | No protected/history/orchestration files, dependencies, stage/commit/push, agent or future-step work. Only this assignment report was added under `prompts`. |
|
|
|
|
## Commands and outcomes
|
|
|
|
Focused unit selection:
|
|
|
|
- `dotnet test .\src\tests\AutoForge.UnitTests\AutoForge.UnitTests.csproj --configuration Release --no-restore --filter FullyQualifiedName~DisplayUnitSettingsTests` — exit 0; 44 passed, 0 failed/skipped.
|
|
|
|
Focused real-provider/rendered integration selection:
|
|
|
|
- `dotnet test .\src\tests\AutoForge.IntegrationTests\AutoForge.IntegrationTests.csproj --configuration Release --no-restore --filter "FullyQualifiedName~DisplayUnitTogglesOnPausedDynamicsFeedRerenderWithoutSourceOrModelMutation|FullyQualifiedName~RealApplicationAndRenderedRoute_RunAndReadDynamicTelemetryWithoutOracle|FullyQualifiedName~StaticSession_FirstStartGroupsReadsAndSharesOneOwner"` — exit 0; 3 passed, 0 failed/skipped.
|
|
- After adding byte-for-byte trace-payload assertions, the focused `DisplayUnitTogglesOnPausedDynamicsFeedRerenderWithoutSourceOrModelMutation` selection — exit 0; 1 passed, 0 failed/skipped.
|
|
|
|
Required final sequential full checks:
|
|
|
|
- `dotnet build .\src\AutoForge.slnx --configuration Release --no-restore` — exit 0; all nine solution projects including the Windows Client; 0 warnings, 0 errors. MAUI XAML source-generation emitted its standard informational notice.
|
|
- `dotnet test .\src\AutoForge.slnx --configuration Release --no-build` — exit 0; AutoForge.UnitTests 178 passed; AutoForge.IntegrationTests 92 passed; 270 total, 0 failed, 0 skipped. The accepted Step-05B baseline was 134 unit + 91 integration = 225; all cases remain, with 44 new unit and one new integration case.
|
|
|
|
An intermediate attempt to run focused unit and integration test builds in
|
|
parallel contended on the shared Application output. That invocation was not
|
|
counted as passing evidence; the standalone focused integration rerun and the
|
|
required final sequential build/test commands above all completed successfully.
|
|
|
|
## Native Client smoke versus controlled evidence
|
|
|
|
Native evidence used the actual rebuilt executable at
|
|
`src\AutoForge.Client\bin\Release\net10.0-windows10.0.26100.0\win-x64\AutoForge.Client.exe`,
|
|
task-local WebView2 debug port 9361 and an isolated temporary WebView profile.
|
|
The initial app showed the explicit first-use/default status before any session.
|
|
The static synthetic session rendered 850 rpm unchanged through preference
|
|
changes. The dynamic synthetic session was paused at step 203 / 20.3 s; protocol
|
|
v2 telemetry showed source 20.1168 m/s beside Imperial display, and source
|
|
temperature/fuel/torque units beside their converted display values. The native
|
|
dashboard/editor results and route checks are mapped in C-03..C-06 and C-10/C-12.
|
|
|
|
Native persistence was checked by closing process 44360 and reopening process
|
|
48432 against the same temporary WebView profile. The stored Imperial/Road
|
|
selection appeared as saved after restart. The exact temporary WebView profile,
|
|
the only task-created profile folder, was removed. Because the preference key
|
|
was absent on first launch, the smoke's explicit save created the app's
|
|
`imperial-us|road` value; that sensible task-owned preference value is left in
|
|
place. No existing preference or unrelated user data was wiped or replaced.
|
|
Both native processes and listener port 9361 were closed.
|
|
|
|
Storage read/write failure, corrupt values, undefined enum values and conversion
|
|
overflow are controlled tests using the real preference/conversion services
|
|
and explicit isolated/faulting stores. They are not represented as native
|
|
platform-failure observations. No platform storage fault injection was added to
|
|
the Client. Native gauge precision was 0 for the exact speed demonstration, so
|
|
the UI showed the rounded 72 km/h; the raw 72.42048 km/h mapping and tolerance
|
|
are independently asserted before display rounding in unit tests.
|
|
|
|
## Source-path self-review and preservation
|
|
|
|
After the first green focused run, I walked the store->service->shell/cascade,
|
|
raw source->pure conversion->each readout, and gauge edit->validate->replace
|
|
paths. This review found that an unavailable display projection could replace
|
|
the underlying dashboard source state with Error. The panel was corrected to
|
|
retain the original source state and show a distinct display-unavailable alert;
|
|
the conversion error remains explicit, the value is `--`, and geometry is not
|
|
fabricated. Repeated focused and full checks then passed. The review also
|
|
distinguished first-use default from a persisted default so native smoke can
|
|
truthfully report restoration.
|
|
|
|
The native adapter is registered before `AddAutoForgeUi`; the UI fallback is
|
|
explicitly unavailable and reports storage failure, not memory-backed success.
|
|
Selection enum validation occurs before writes; writes precede publication.
|
|
Mappings use exact unit strings and raw numeric values. Source unit binding,
|
|
quality/range, diagnostic/model time, configuration identity/fingerprint,
|
|
exported SI JSON, raw trace bytes, one feed owner and paused model state remain
|
|
unchanged. Unedited gauge bounds use the original canonical values; conversion
|
|
and ordered finite-span validation happen before definition replacement.
|
|
|
|
`git diff --check` passed. No dependency manifest, package, project, Core,
|
|
Diagnostics, Simulation, Components, `prompts/STATE.md`, `prompts/ROADMAP.md`,
|
|
historical report or protected instruction was changed. The repository began
|
|
clean; all remaining modifications are Step-06 implementation/tests/docs and
|
|
this required report. No stage, commit, push, restore/install or Step-07 work
|
|
was performed.
|
|
```
|