After Step 6
This commit is contained in:
parent
6874b9d963
commit
b38b4f753b
12
README.md
12
README.md
|
|
@ -52,8 +52,8 @@ supported vehicle modules.
|
|||
Supported readouts convert only at presentation; SI source values, model
|
||||
calculations, configuration fingerprints and canonical dashboard definitions
|
||||
remain unchanged. See [display units](docs/live-dashboard.md#display-units).
|
||||
Step-06 implementation and worker verification are complete; manual
|
||||
orchestrator review remains pending.
|
||||
Focused correction Step-06A and its worker verification are complete. Step-06
|
||||
remains not accepted pending manual review; Step-07 remains blocked.
|
||||
- UI routes: `/` foundation, `/execution-targets` explicit metadata selection,
|
||||
`/vehicle-profiles` explicit profile import/revision selection/inspection/export,
|
||||
`/diagnostics` static synthetic diagnostics, `/simulation` dynamics, and a
|
||||
|
|
@ -72,9 +72,11 @@ supported vehicle modules.
|
|||
|
||||
### In progress
|
||||
|
||||
Step-06 is complete on worker execution evidence and is awaiting manual
|
||||
orchestrator review. The Step-04 and Step-05 acceptances include their listed
|
||||
corrections.
|
||||
The Step-06 initial review findings for invalid-preference rejection and
|
||||
unavailable/wrong-type readouts are corrected by Step-06A, with worker
|
||||
verification complete. Step-06 is still not accepted pending manual review;
|
||||
Step-07 remains blocked. The Step-04 and Step-05 acceptances include their
|
||||
listed corrections.
|
||||
|
||||
### Planned
|
||||
|
||||
|
|
|
|||
|
|
@ -4,8 +4,9 @@ The implemented scope includes the accepted Step-01/Step-01A foundation,
|
|||
accepted Step-02/Step-02A vehicle-profile metadata, the accepted Step-03
|
||||
synthetic diagnostic vertical slice with its integrity corrections, the accepted
|
||||
Step-04/04A/04B synthetic dynamics work, the accepted Step-05/05A/05B
|
||||
session-owned live dashboard, and the worker-complete Step-06 Imperial-default
|
||||
display-unit preference (pending manual orchestrator review).
|
||||
session-owned live dashboard, and the Step-06 Imperial-default display-unit
|
||||
preference. Its focused Step-06A correction is worker-complete with review
|
||||
pending; Step-06 is not accepted and Step-07 remains blocked.
|
||||
|
||||
- [Architecture](architecture.md): actual nine-project graph, responsibilities,
|
||||
route ownership and provider/reference boundaries.
|
||||
|
|
@ -48,5 +49,6 @@ historical/worker reports for their own execution evidence:
|
|||
[Step-04B corrective worker report](../prompts/Step-04B-Report.md), and
|
||||
[Step-05A corrective worker report](../prompts/Step-05A-Report.md),
|
||||
[Step-05B corrective worker report](../prompts/Step-05B-Report.md), and
|
||||
[Step-06 worker report](../prompts/Step-06-Report.md).
|
||||
[Step-06 worker report](../prompts/Step-06-Report.md),
|
||||
[Step-06A corrective worker report](../prompts/Step-06A-Report.md).
|
||||
Handoffs are manual; acceptance remains the orchestrator's responsibility.
|
||||
|
|
|
|||
|
|
@ -9,9 +9,10 @@ There is no web/server host, WASM host or backend process.
|
|||
|
||||
## Current milestone status
|
||||
|
||||
Steps 04/04A/04B and 05/05A/05B are accepted. Step-06's display-unit
|
||||
implementation and worker verification are complete and awaiting manual
|
||||
orchestrator review; this status does not authorize Step-07.
|
||||
Steps 04/04A/04B and 05/05A/05B are accepted. Step-06's initial review found
|
||||
preference-rejection and unavailable-readout gaps, now corrected by Step-06A.
|
||||
Its worker verification is complete, pending manual review. Step-06 is not
|
||||
accepted and Step-07 remains blocked.
|
||||
|
||||
```mermaid
|
||||
flowchart TD
|
||||
|
|
|
|||
|
|
@ -391,8 +391,9 @@ Current command outcomes and exact complete suite counts are recorded in the
|
|||
[Step-06 worker report](../prompts/Step-06-Report.md). Native persistence and
|
||||
draft-editor observations are reported separately from controlled storage
|
||||
failure/error tests; headless verification does not substitute for the actual
|
||||
Windows Client smoke. Step-07 recording/replay remains unimplemented and
|
||||
blocked pending manual Step-06 review.
|
||||
Windows Client smoke. This section preserves the original Step-06 worker
|
||||
evidence; the subsequent Step-06A correction and current review status are
|
||||
recorded below. Step-07 recording/replay remains unimplemented and blocked.
|
||||
|
||||
The final sequential Release build completed all nine projects, including the
|
||||
Windows Client, with 0 warnings and 0 errors. The full suite passed 178 unit and
|
||||
|
|
@ -427,3 +428,54 @@ saved choice. Existing diagnostics, execution-target, profile, home and
|
|||
not-found routes loaded without an error banner. Only the exact temporary
|
||||
WebView profile was removed; the preference created by this smoke was left at
|
||||
the sensible Imperial/Road default, and no unrelated preferences were changed.
|
||||
|
||||
## Step-06A corrective verification
|
||||
|
||||
The original Step-06 review found invalid-selection initialization/storage
|
||||
mutation and unavailable/wrong-type readout presentation gaps. Step-06A closes
|
||||
those gaps without changing the approved defaults, mappings, editor policy,
|
||||
model/source data or protocol. Step-06 remains **not accepted** pending manual
|
||||
review; Step-07 remains blocked.
|
||||
|
||||
Before the fix, an invalid proposal on a fresh service loaded the saved
|
||||
`metric|road` selection instead of leaving the untouched default; store reads
|
||||
were not zero. The presentation regressions observed `"null"` for a null
|
||||
numeric measurement, echoed `"not a number"` for a string-valued `m/s` signal,
|
||||
and omitted an unconverted notice for unsupported-unit text. After the fix,
|
||||
`PreferenceService_RejectsInvalidChoiceBeforeInitializingOrReadingStore`,
|
||||
`RejectedSelectorEventReconcilesControlAndReadoutAndCanRetry` (both selectors),
|
||||
`DiagnosticRoute_RendersNullWrongTypeUnknownAndUnsupportedStaticV1SignalsTruthfully`,
|
||||
and `FormatSourceValue_PreservesJsonNullAndBooleanLexicalValues` pass as part
|
||||
of the full suite. Real-provider controlled tests cover converted Uncertain,
|
||||
Stale, Stopped and failed-display projections; protocol-v2 validation remains
|
||||
strict.
|
||||
|
||||
The final sequential Release build completed all nine solution projects with
|
||||
0 warnings and 0 errors; the MAUI XAML source-generation notice was
|
||||
informational. The complete suites passed 179 unit and 105 integration tests
|
||||
(284 total; 0 failed, 0 skipped), preserving the 270-case Step-06 baseline and
|
||||
adding 14 corrective cases. Exact final commands:
|
||||
|
||||
- `dotnet build .\src\AutoForge.slnx --configuration Release --no-restore`
|
||||
- `dotnet test .\src\AutoForge.slnx --configuration Release --no-build`
|
||||
|
||||
The rebuilt Windows Client smoke used the task-isolated WebView2 debug port
|
||||
9361 and an isolated `LOCALAPPDATA`/WebView2 profile. First use showed
|
||||
Imperial (US) / Road. A real static v1 session rendered 850 rpm unchanged. A
|
||||
real paused v2 session at step 203 / 20.3 seconds retained exact source
|
||||
20.1168 m/s while native readouts displayed 20.117 m/s, 72.420 km/h, 45.000
|
||||
mph and 66.000 ft/s across all four selections. A native horizontal bar
|
||||
displayed 72 km/h from source 20.1168 m/s over 0–144.84096000000002 km/h with
|
||||
50% geometry. Its open Metric/Road editor draft remained in km/h after the
|
||||
global selection changed to Imperial (US)/Engineering; closing and reopening
|
||||
the app restored the task-isolated Metric/Road preference. Both static and
|
||||
dynamics sessions closed and released their dashboards.
|
||||
|
||||
The native smoke did not inject a platform storage failure or malformed v1
|
||||
values. Those cases are covered by controlled store tests and the real static
|
||||
v1 rendered integration path, respectively. All native preference/profile
|
||||
data was written under the task-owned isolated profile; that exact profile was
|
||||
removed after both Client processes and port 9361 were closed. No unrelated
|
||||
user preference/profile data was changed. See the [Step-06A corrective worker
|
||||
report](../prompts/Step-06A-Report.md) for matrix-level evidence, limitations
|
||||
and preservation review.
|
||||
|
|
|
|||
|
|
@ -48,6 +48,21 @@ overwritten. A selection is published only after a successful write, so a
|
|||
failed save leaves the prior active choice in effect and exposes an error.
|
||||
Portable test compositions use an isolated store; the UI-only fallback is an
|
||||
explicit unavailable store, not an in-memory native substitute.
|
||||
Undefined proposals are rejected before preference initialization or storage
|
||||
access. Both selectors are bound to the committed selection, so a failed save
|
||||
rerenders them to the last active choice; a later successful change clears the
|
||||
error.
|
||||
|
||||
Diagnostics and simulation primary readouts use the same typed presentation
|
||||
boundary. Missing/null/undefined values and `Unknown` quality show `--`; a
|
||||
wrong JSON type for a known numeric unit also shows `--` with an explicit
|
||||
error. The separately labeled source value, exact unit, quality and sample
|
||||
context remain visible (`null` is written explicitly rather than rendered
|
||||
blank). Finite `Uncertain` numbers remain numeric and retain an Uncertain
|
||||
notice/state. Numeric zero and boolean `false` remain distinct real values.
|
||||
Unsupported units retain their exact source value and unit with an explicit
|
||||
unconverted notice, including non-numeric text; they are not treated as a
|
||||
converted measurement.
|
||||
|
||||
Conversion uses the exact source unit and raw numeric sample, before the
|
||||
existing display precision. The supported mappings are:
|
||||
|
|
|
|||
|
|
@ -239,9 +239,14 @@ session-bound v2 source and reports per-response model step/time separately from
|
|||
diagnostic request ticks; polling and rendering do not advance the fixed-step
|
||||
model. Scenario target speeds and decoded numeric telemetry use the shared
|
||||
Imperial (US)/Metric display preference; each decoded row retains its exact
|
||||
source value and unit beside the display projection. Scenario definitions,
|
||||
configuration JSON, SI model state and fingerprints are unchanged. Static trace
|
||||
payloads and configuration interchange are source data, not converted output.
|
||||
source value and unit beside the display projection. Missing/Unknown readings
|
||||
are shown as `--`; invalid types for known numeric units are explicit display
|
||||
errors, while the separate source column retains their raw value. Uncertain
|
||||
quality stays visible, boolean `false` is not treated as missing, and
|
||||
unsupported content remains unchanged with an unconverted notice. Scenario
|
||||
definitions, configuration JSON, SI model state and fingerprints are unchanged.
|
||||
Static trace payloads and configuration interchange are source data, not
|
||||
converted output.
|
||||
See the [live dashboard guide](live-dashboard.md) for mappings, preference
|
||||
persistence/error handling, editor range policy and freshness contract.
|
||||
|
||||
|
|
|
|||
|
|
@ -3,14 +3,15 @@
|
|||
## Status and authority
|
||||
|
||||
- Initialized: 2026-10-28.
|
||||
- Current phase: Step-06 reviewed; preference-rejection and unavailable-readout correction required.
|
||||
- Active assignment: [Step-06A](Step-06A.md), ready for manual worker execution.
|
||||
- Last accepted milestone: Step-05 with Step-05A/Step-05B, accepted 2026-10-29.
|
||||
- Last accepted correction: Step-05B; all Step-05 findings closed.
|
||||
- Outstanding corrections: Step-06 R-01 preference rejection and R-02 unavailable/non-numeric readouts.
|
||||
- Current phase: corrected display units accepted; bounded telemetry recording/archive next.
|
||||
- Active assignment: [Step-07](Step-07.md), ready for manual worker execution.
|
||||
- Last accepted milestone: Step-06 with Step-06A, accepted 2026-10-30.
|
||||
- Last accepted correction: Step-06A; all Step-06 findings closed.
|
||||
- Outstanding corrections: none.
|
||||
- Step-05 status: ACCEPTED after Step-05A/Step-05B, 2026-10-29.
|
||||
- Step-06 status: REQUIRES FOCUSED CORRECTION / NOT ACCEPTED, reviewed 2026-10-30.
|
||||
- Step-07 status: recording/replay moved from former Step-06; BLOCKED until display units are accepted.
|
||||
- Step-06 status: ACCEPTED after Step-06A, 2026-10-30.
|
||||
- Step-07 status: READY FOR WORKER; bounded capture and archive readback, not playback.
|
||||
- Step-08 status: recorded telemetry replay; BLOCKED / NOT ASSIGNED until Step-07 acceptance.
|
||||
- Current state and handoff: [STATE.md](STATE.md).
|
||||
- Authority: the master charter, repository/handoff amendment, and the owner's
|
||||
2026-10-28 architectural realignment. The latest decision cancels the dual-shell
|
||||
|
|
@ -134,10 +135,10 @@ first-use default**, before recording/replay. This is newly approved product
|
|||
scope, not an unmet Step-05/05A criterion. It must not be hidden inside a
|
||||
corrective assignment or used to reject otherwise completed prior work.
|
||||
|
||||
Insert display units as the next major Step-06. Former unassigned Steps 06-20
|
||||
become 07-21, with dependencies updated below. No completed assignment/report
|
||||
or historical decision is renumbered. The corrected Step-05 is now accepted;
|
||||
[Step-06](Step-06.md) supplies the frozen implementation/verification contract.
|
||||
That decision inserted display units as Step-06 and shifted then-unassigned
|
||||
Steps 06-20 to 07-21. The later telemetry split below shifts future envelopes
|
||||
once more; no completed assignment/report or historical decision is renumbered.
|
||||
Corrected [Step-06](Step-06.md) with Step-06A is now accepted.
|
||||
|
||||
Bounded contract carried into the Step-06 assignment:
|
||||
|
||||
|
|
@ -170,6 +171,25 @@ Bounded contract carried into the Step-06 assignment:
|
|||
semantics, repeated-toggle range stability and no additional reads/model steps.
|
||||
No chart, dashboard persistence format, protocol or physics expansion.
|
||||
|
||||
## Prospective telemetry scope split - 2026-10-30
|
||||
|
||||
The former recording/replay envelope would introduce a capture lifetime, archive
|
||||
format/storage and playback clock in one handoff. Apply the existing sizing
|
||||
policy before assignment, not as retrospective corrections:
|
||||
|
||||
- Step-07: bounded session recording, explicit save and strict archive readback.
|
||||
Collect actual diagnostic observations independently of widgets, with visible
|
||||
limits; persist only on explicit save after capture stops.
|
||||
- Step-08: playback/seek/navigation/speed controls over accepted saved captures,
|
||||
driving shared presentation without rerunning physics or querying a live source.
|
||||
- Former unassigned Steps 08-21 become 09-22 below. No completed history changes;
|
||||
letters remain reserved for actual corrections. Replay is deferred, not dropped.
|
||||
|
||||
The first recording slice is intentionally bounded in-memory capture plus
|
||||
explicit persistence, not crash-durable live streaming or unlimited history.
|
||||
Longer-duration/streaming capture remains a future telemetry expansion; it is
|
||||
not claimed by Step-07. The assignment freezes loss/limit/close/I/O outcomes.
|
||||
|
||||
## Architecture baseline
|
||||
|
||||
### Existing accepted foundation, preserved
|
||||
|
|
@ -353,10 +373,10 @@ Step-01, Step-01A, corrected Step-02 and corrected Step-03 remain accepted.
|
|||
Corrected Step-04 is accepted with original and corrective evidence preserved.
|
||||
Step-05 with Step-05A/05B is accepted: the configured static/dynamic workflow,
|
||||
single session owner, independent range/quality, safe gauges, decisive tests and
|
||||
native evidence have been reviewed. Step-06 now implements the shared units
|
||||
feature, but its original preference-rejection and unavailable-readout criteria
|
||||
need Step-06A. That is the only active assignment. Recording/replay remains
|
||||
Step-07 and blocked until corrected units work is accepted.
|
||||
native evidence have been reviewed. Corrected Step-06/06A is accepted: unit
|
||||
defaults/conversions, rejected selections, unavailable readouts and raw/source
|
||||
preservation are closed on inspected evidence. Step-07 recording/archive is the
|
||||
only active assignment. Replay is the following Step-08, not bundled into capture.
|
||||
Dependencies indicate acceptance prerequisites, not permission for automatic
|
||||
handoff. Later assignments refine these scopes using actual implementation
|
||||
evidence; they must not silently discard required capabilities.
|
||||
|
|
@ -376,25 +396,26 @@ evidence; they must not silently discard required capabilities.
|
|||
| 05 | First configurable live dashboard | 04 and corrections accepted; 01A foundation | ACCEPTED 2026-10-29 AFTER 05A/05B | Actual static/dynamic numeric/bar dashboard, validated in-memory configuration, one session owner, truthful states and controlled/native evidence inspected |
|
||||
| 05A | Complete and verify the assigned dashboard contract | 05 review R-01 through R-05 | ACCEPTED 2026-10-29 AFTER 05B | Host/editor/lifetime/failure/rendering/docs/native scope corrected; last range/test obligations closed by 05B |
|
||||
| 05B | Independent range status and decisive dashboard tests | Remaining 05A R-03/testing contract | ACCEPTED 2026-10-29 | Frozen five-case/five-criterion contract satisfied; reported 134 unit/91 integration passes, clean Release/native recheck and actual pre-fix failure |
|
||||
| 06 | Imperial-default metric/imperial display units | 05 and corrections accepted; owner request 2026-10-29 | REQUIRES FOCUSED CORRECTION / NOT ACCEPTED | Shared conversions/default/native persistence and 20-toggle source preservation inspected; rejected preference UI/state and unavailable readout paths remain |
|
||||
| 06A | Preference rejection and unavailable display readouts | 06 review R-01/R-02 | READY FOR WORKER | Reject invalid preferences before initialization; rejected-save selectors match active state; missing/Unknown/non-numeric display handling remains explicit across assigned surfaces |
|
||||
| 07 | Telemetry recording and replay | 06 and corrections accepted | BLOCKED / NOT ASSIGNED | Persist raw messages and decoded signals with source units/time/quality; playback/seek/speed controls feed the same gauges without reconstructing missing data |
|
||||
| 08 | Calibration management and simulated programming | 07 | PLANNED | Versioned definitions/diffs, verified baseline and backup, approved simulated write, readback/unrelated-data checks, audit and supported restore; no physical writes |
|
||||
| 09 | Local AI, knowledge, and validated runbooks | 08 | PLANNED | Replaceable local inference, applicable knowledge retrieval, structured logical runbook, independent validation/approval and simulation-only execution |
|
||||
| 10 | Comparative evaluation and complete synthetic demonstration | 09 | PLANNED | Complete demonstration below plus deterministic fault/regression matrix and independent verification of intended and unintended changes |
|
||||
| 11 | Verified OBDX Pro GT read-only integration | 10 plus documented device research/access | PLANNED / HARDWARE GATE | Source-backed device support matrix, explicit physical target, real read-only identification/diagnostics/telemetry recording where supported; no write path |
|
||||
| 12 | Advanced dashboards, analysis, and comparisons | 10; 11 for real captures | PLANNED | Persist configurable layouts/thresholds, linked charts, raw-data inspection, multi-run/multi-vehicle comparisons with lineage and uncertainty; retain accepted display-unit preference |
|
||||
| 13 | Broader diagnostic protocols and hardware adapters | 11 | PLANNED | Conformance-backed additional CAN/ISO-TP/UDS/KWP2000/J2534 or legacy adapters where verified; same application ports and capability restrictions |
|
||||
| 14 | Curated vehicle knowledge and research workflow | 09; 13 where needed | PLANNED | Sourced profile/module/calibration knowledge, review/promotion workflow, exact applicability, licensing/access controls; research cannot authorize writes |
|
||||
| 15 | Higher-fidelity simulation and virtual module coverage | 10; 14 for verified datasets | PLANNED | Validated model extensions, richer transmissions/environment/module interactions and reproducible fault coverage; published fidelity limits |
|
||||
| 16 | AI evaluation and optional specialization | 09, 10, 14 and adequate datasets | PLANNED | Held-out deterministic runbook evaluations, refusal/uncertainty cases, memory/latency measurements; LoRA/QLoRA only if justified by measured benefit |
|
||||
| 17 | Programming qualification without physical writes | 08, 10, 11, applicable 13/14 evidence | PLANNED | Module-specific safety case, bench plan, voltage/state/identity checks, interruption/recovery tests in simulation, legal authorization and defined go/no-go criteria |
|
||||
| 18 | Explicitly authorized controlled bench programming | 17 and separate user authorization | PLANNED / AUTHORIZATION GATE | Authorized supported bench target only; verified backup completeness, transfer/readback/recovery evidence and audit; no general vehicle-write enablement |
|
||||
| 19 | Approved vehicle/module-specific programming | 18 and separate vehicle-operation authorization | PLANNED / AUTHORIZATION GATE | Explicit per-operation approvals, compatibility/operating-state/power/security checks and proven recovery limits; strict module-specific support matrix |
|
||||
| 20 | Packaging, extensibility, and additional platforms | 06, 10; feature-specific gates remain | PLANNED | Offline-friendly reproducible releases, documented supported hosts, feature manifests/DI, compatibility/migration regression evidence |
|
||||
| 21 | Optional MCP and firmware-emulation research | 09, 14; isolated research approvals | OPTIONAL / PLANNED | Concrete benefit and separate ADR; restricted tools retain validator/approval boundary; emulation limitations and proprietary-data rights documented |
|
||||
| 06 | Imperial-default metric/imperial display units | 05 and corrections accepted; owner request 2026-10-29 | ACCEPTED 2026-10-30 AFTER 06A | Shared persisted Imperial/Road default, exact conversions, source/canonical invariants and corrected rejection/unavailable readouts inspected |
|
||||
| 06A | Preference rejection and unavailable display readouts | 06 review R-01/R-02 | ACCEPTED 2026-10-30 | Frozen seven-case/five-criterion contract satisfied; reported 179 unit/105 integration passes, clean Release/native evidence and honest binding-event versus browser coverage |
|
||||
| 07 | Bounded telemetry recording and archive readback | 06 and corrections accepted | READY FOR WORKER | Actual raw/decoded observations beyond the 200-entry UI trace, one capture owner, explicit limits, source-faithful schema-v1 save/load and typed loss/I/O outcomes |
|
||||
| 08 | Recorded telemetry replay | 07 accepted | BLOCKED / NOT ASSIGNED | Play/pause/stop/restart/seek/navigation/speed feed shared presentation from recorded data, with explicit Replay identity and no live reads or physics rerun |
|
||||
| 09 | Calibration management and simulated programming | 08 | PLANNED | Versioned definitions/diffs, verified baseline and backup, approved simulated write, readback/unrelated-data checks, audit and supported restore; no physical writes |
|
||||
| 10 | Local AI, knowledge, and validated runbooks | 09 | PLANNED | Replaceable local inference, applicable knowledge retrieval, structured logical runbook, independent validation/approval and simulation-only execution |
|
||||
| 11 | Comparative evaluation and complete synthetic demonstration | 10 | PLANNED | Complete demonstration below plus deterministic fault/regression matrix and independent verification of intended and unintended changes |
|
||||
| 12 | Verified OBDX Pro GT read-only integration | 11 plus documented device research/access | PLANNED / HARDWARE GATE | Source-backed device support matrix, explicit physical target, real read-only identification/diagnostics/telemetry recording where supported; no write path |
|
||||
| 13 | Advanced dashboards, analysis, and comparisons | 11; 12 for real captures | PLANNED | Persist configurable layouts/thresholds, linked charts, larger-capture analysis, raw-data inspection and multi-run/multi-vehicle comparisons with lineage/uncertainty |
|
||||
| 14 | Broader diagnostic protocols and hardware adapters | 12 | PLANNED | Conformance-backed additional CAN/ISO-TP/UDS/KWP2000/J2534 or legacy adapters where verified; same application ports and capability restrictions |
|
||||
| 15 | Curated vehicle knowledge and research workflow | 10; 14 where needed | PLANNED | Sourced profile/module/calibration knowledge, review/promotion workflow, exact applicability, licensing/access controls; research cannot authorize writes |
|
||||
| 16 | Higher-fidelity simulation and virtual module coverage | 11; 15 for verified datasets | PLANNED | Validated model extensions, richer transmissions/environment/module interactions and reproducible fault coverage; published fidelity limits |
|
||||
| 17 | AI evaluation and optional specialization | 10, 11, 15 and adequate datasets | PLANNED | Held-out deterministic runbook evaluations, refusal/uncertainty cases, memory/latency measurements; LoRA/QLoRA only if justified by measured benefit |
|
||||
| 18 | Programming qualification without physical writes | 09, 11, 12, applicable 14/15 evidence | PLANNED | Module-specific safety case, bench plan, voltage/state/identity checks, interruption/recovery tests in simulation, legal authorization and defined go/no-go criteria |
|
||||
| 19 | Explicitly authorized controlled bench programming | 18 and separate user authorization | PLANNED / AUTHORIZATION GATE | Authorized supported bench target only; verified backup completeness, transfer/readback/recovery evidence and audit; no general vehicle-write enablement |
|
||||
| 20 | Approved vehicle/module-specific programming | 19 and separate vehicle-operation authorization | PLANNED / AUTHORIZATION GATE | Explicit per-operation approvals, compatibility/operating-state/power/security checks and proven recovery limits; strict module-specific support matrix |
|
||||
| 21 | Packaging, extensibility, and additional platforms | 06, 11; feature-specific gates remain | PLANNED | Offline-friendly reproducible releases, documented supported hosts, feature manifests/DI, compatibility/migration regression evidence |
|
||||
| 22 | Optional MCP and firmware-emulation research | 10, 15; isolated research approvals | OPTIONAL / PLANNED | Concrete benefit and separate ADR; restricted tools retain validator/approval boundary; emulation limitations and proprietary-data rights documented |
|
||||
|
||||
### Scope details for Steps 02-11
|
||||
### Scope details for Steps 02-12
|
||||
|
||||
- **01A accepted prerequisite:** one thin MAUI Client, two RCLs, feature-organized
|
||||
target selection, actual headless rendered tests and worker native build/smoke
|
||||
|
|
@ -451,33 +472,36 @@ evidence; they must not silently discard required capabilities.
|
|||
unavailable/stale/error states, with one source/session-aware acquisition owner.
|
||||
Supply a contract matrix for invalid ranges, missing signals and session
|
||||
replacement before coding. No charts, drag/drop or new clock/protocol/backend.
|
||||
Larger dashboard composition remains Step-12 scope. Client stays thin and no
|
||||
Larger dashboard composition remains Step-13 scope. Client stays thin and no
|
||||
alternate host is introduced. Dashboard configuration is in-memory only for
|
||||
this slice; persistence/schema work is not bundled into the feed state machine.
|
||||
- **06:** newly approved display-only unit preference and conversions, Imperial
|
||||
(US) default with metric toggle, across current human-facing surfaces; source
|
||||
values/configuration remain SI. Follow the dated owner decision above.
|
||||
- **07:** versioned recording format, module/source/units/time/quality metadata,
|
||||
raw plus decoded retention, interrupted/corrupt session handling, replay
|
||||
play/pause/stop/restart/seek/navigation/speed. Acquisition must not depend on
|
||||
visible gauges. Mark captured versus interpolated/reconstructed samples.
|
||||
- **08:** scalar/table definitions with ranges/scaling/units and dependencies;
|
||||
- **07:** bounded diagnostic observation capture independent of widgets and the
|
||||
200-entry UI trace; source-unit raw/decoded retention, explicit stop/limits,
|
||||
schema-v1 local save and strict readback with typed corrupt/I/O outcomes.
|
||||
No playback clock or crash-durable streaming in this first slice.
|
||||
- **08:** replay accepted archives with play/pause/stop/restart/seek/navigation/
|
||||
speed; feed shared gauges without a live source or physics rerun. Keep original
|
||||
capture/source/model time distinct from playback time and label incomplete data.
|
||||
- **09:** scalar/table definitions with ranges/scaling/units and dependencies;
|
||||
original/proposed/tested/approved versions, structured diffs, verified backup
|
||||
completeness, approval binding, audit, readback, unrelated-data preservation,
|
||||
restoration where supported, explicit failure/recovery outcomes.
|
||||
- **09:** local inference provider configuration, structured queries plus optional
|
||||
- **10:** local inference provider configuration, structured queries plus optional
|
||||
semantic retrieval, source-backed applicability checks, versioned runbook schema
|
||||
and restricted tools. Include natural-language diagnostics, driving scenarios,
|
||||
and calibration planning; AI cannot emit arbitrary hardware frames/offset writes.
|
||||
Missing knowledge and disconnected inference produce explicit outcomes without
|
||||
disabling non-AI functionality.
|
||||
- **10:** equivalent baseline/modified scenarios and initial state, independent
|
||||
- **11:** equivalent baseline/modified scenarios and initial state, independent
|
||||
calibration oracle, behavioral/fuel/shift comparisons with confidence labels,
|
||||
fault reports, replay/raw-trace inspection and an auditable verification report.
|
||||
Include timeout, unsupported service, malformed response, wrong identity/version,
|
||||
interruption, corruption/checksum, partial write, reset, incompatible config,
|
||||
DTC and failed-verification cases.
|
||||
- **11:** verify OBDX Pro GT protocols, drivers, OS/architecture constraints,
|
||||
- **12:** verify OBDX Pro GT protocols, drivers, OS/architecture constraints,
|
||||
manufacturer libraries/SDKs, actual J2534 support and C# integration using
|
||||
attributable sources before implementation. Missing device/driver access means
|
||||
real-hardware verification is blocked, not passed by mocks. Restrict services to
|
||||
|
|
@ -486,7 +510,7 @@ evidence; they must not silently discard required capabilities.
|
|||
|
||||
### Longer-term scope preservation
|
||||
|
||||
Steps 12-21 retain richer gauges/clusters/charts and dashboard editing, comparison
|
||||
Steps 13-22 retain richer gauges/clusters/charts and dashboard editing, comparison
|
||||
and analysis, more vehicle/module/protocol coverage, independently validated
|
||||
research, curated datasets, advanced dynamics and transmission modeling, local
|
||||
model evaluation/specialization, authorized programming, and supported release
|
||||
|
|
@ -503,7 +527,7 @@ continue only independent safe work through an explicit new assignment.
|
|||
|
||||
## Required synthetic end-to-end demonstration
|
||||
|
||||
Target acceptance: Step-10. Use the explicitly synthetic AutoForge test truck,
|
||||
Target acceptance: Step-11. Use the explicitly synthetic AutoForge test truck,
|
||||
initial warm idle 650 RPM and proposed warm idle 1,250 RPM. These values and any
|
||||
memory layout are synthetic, not manufacturer calibration data.
|
||||
|
||||
|
|
@ -756,21 +780,34 @@ history, not repeated redesign without evidence.
|
|||
pinned editor evidence and positive native behavior are supported. Withheld
|
||||
acceptance for two consolidated existing-scope findings in
|
||||
[Step-06A](Step-06A.md); no units redesign or recording work is assigned.
|
||||
- Reviewed and accepted Step-06A's guard-before-initialize, framework-bound
|
||||
selector failure/retry, shared typed/quality-aware readouts and raw source
|
||||
formatting, with actual service/readout pre-fix failures and real provider/
|
||||
rendered evidence. Binding callback proof is not claimed as a native storage
|
||||
fault or observed pre-fix browser-DOM failure.
|
||||
- Worker reports complete nine-project Release build zero warnings/errors and
|
||||
179 unit + 105 integration passes (284 total, zero failed/skipped), plus isolated
|
||||
native first-use/four-mode/source/editor/saved-Metric restoration/close smoke.
|
||||
The orchestrator ran no application checks. Corrected Step-06/06A is accepted.
|
||||
- Prepared [Step-07](Step-07.md), splitting bounded recording/archive from
|
||||
subsequent Step-08 playback under the existing prospective sizing policy.
|
||||
Only unassigned future envelopes/dependencies moved; history is preserved.
|
||||
|
||||
### Remaining
|
||||
|
||||
- Worker execution of Step-06A, then one consolidated review against its focused
|
||||
correction matrix, original Step-06 contract and shared quality gate.
|
||||
- Step-07 recording/replay is blocked and not assigned. Display units exist but
|
||||
remain unaccepted; preserve their supported positive behavior and evidence.
|
||||
- Worker execution of Step-07, then one consolidated review against its frozen
|
||||
capture/archive/lifetime/limit matrix and shared quality gate. Correct genuine
|
||||
unmet requirements as Step-07A before preparing playback.
|
||||
- Step-08 replay is blocked and not assigned. Recording/archive is assigned work,
|
||||
not implemented functionality; display units and earlier milestones are accepted.
|
||||
- Profile/module metadata, synthetic virtual-module communication and deterministic
|
||||
dynamics/v2 and corrected dashboard are accepted; later features remain planned.
|
||||
Preserve the complete sequence/safety gates.
|
||||
|
||||
### Known blockers and uncertainties
|
||||
|
||||
Step-06 has two open findings against C-07/C-08/C-09 and the original rejection/
|
||||
all-surfaces requirements:
|
||||
No blocking Step-06 deficiency remains. Its two findings below are historical
|
||||
and closed by accepted Step-06A:
|
||||
|
||||
- R-01: TrySet initializes before validating an undefined proposal, so a rejected
|
||||
call on a fresh service can read persisted data and change active/initialized
|
||||
|
|
@ -783,11 +820,10 @@ all-surfaces requirements:
|
|||
units skip the explicit unconverted notice. Readout callers do not pass source
|
||||
quality to suppress an Unknown current numeric reading.
|
||||
|
||||
These are source-path findings, not orchestrator-executed reproductions. Existing
|
||||
tests initialize before invalid preference calls, mutate preferences directly
|
||||
rather than exercising failed selector events, and cover a Good converted speed
|
||||
gauge rather than the missing/Unknown readout paths. Step-06A must reproduce the
|
||||
applicable failures and close these existing requirements without new features.
|
||||
These were source-path findings, not orchestrator-executed reproductions.
|
||||
Step-06A supplied fresh-invalid store-call assertions, actual framework binding
|
||||
callbacks, real v1 unavailable-value readouts and converted quality/freshness
|
||||
tests. Original positive source/editor/conversion evidence remains preserved.
|
||||
|
||||
No blocking Step-05 deficiency remains. The two Step-05A follow-up findings
|
||||
below are historical and closed by accepted Step-05B:
|
||||
|
|
|
|||
115
prompts/STATE.md
115
prompts/STATE.md
|
|
@ -5,24 +5,25 @@
|
|||
| Field | Value |
|
||||
|---|---|
|
||||
| Updated | 2026-10-30 |
|
||||
| Phase | Step-06 reviewed; focused rejection/readout correction remains |
|
||||
| Active step | Step-06A - Preference rejection and unavailable display readouts |
|
||||
| Assignment | [Step-06A.md](Step-06A.md) |
|
||||
| Phase | Corrected display units accepted; bounded telemetry recording/archive next |
|
||||
| Active step | Step-07 - Bounded telemetry recording and archive readback |
|
||||
| Assignment | [Step-07.md](Step-07.md) |
|
||||
| Assignment status | READY FOR WORKER / AWAITING MANUAL HANDOFF |
|
||||
| Expected worker report | `prompts/Step-06A-Report.md` - not yet created |
|
||||
| Last accepted correction | Step-05B - accepted 2026-10-29 |
|
||||
| Last accepted major milestone | Step-05 with Step-05A/Step-05B - accepted 2026-10-29 |
|
||||
| Outstanding corrections | Step-06 R-01 preference rejection and R-02 unavailable/non-numeric readouts |
|
||||
| Expected worker report | `prompts/Step-07-Report.md` - not yet created |
|
||||
| Last accepted correction | Step-06A - accepted 2026-10-30 |
|
||||
| Last accepted major milestone | Step-06 with Step-06A - accepted 2026-10-30 |
|
||||
| Outstanding corrections | None |
|
||||
| Step-02 status | ACCEPTED after Step-02A |
|
||||
| Step-03 status | ACCEPTED after Step-03A/Step-03B |
|
||||
| Step-04 status | ACCEPTED after Step-04A/Step-04B |
|
||||
| Step-04A review | All original corrective criteria closed with Step-04B |
|
||||
| Step-05 status | ACCEPTED after Step-05A/Step-05B |
|
||||
| Step-05A review | All original corrective criteria closed with Step-05B |
|
||||
| Step-06 status | REQUIRES FOCUSED CORRECTION / NOT ACCEPTED |
|
||||
| Step-07 status | Recording/replay, formerly Step-06; BLOCKED until display-unit work is accepted |
|
||||
| Worker execution | Step-06 returned; Step-06A not invoked |
|
||||
| Immediate next action | User manually directs the worker to execute Step-06A with original Step-06 and shared quality gate |
|
||||
| Step-06 status | ACCEPTED after Step-06A |
|
||||
| Step-07 status | READY FOR WORKER; bounded capture, explicit save and strict readback only |
|
||||
| Step-08 status | Recorded telemetry replay; BLOCKED until Step-07 acceptance |
|
||||
| Worker execution | Step-06A returned and accepted; Step-07 not invoked |
|
||||
| Immediate next action | User manually directs the worker to execute Step-07 and shared quality gate only |
|
||||
| Next orchestrator action | After manual return, inspect the assignment, report, implementation, tests, Git changes, documentation and recorded command evidence |
|
||||
|
||||
## Repository baseline at initialization
|
||||
|
|
@ -761,8 +762,9 @@ not a Step-05A defect. It must be implemented before recording/replay.
|
|||
|
||||
The [dated roadmap contract](ROADMAP.md) inserts the next major Step-06 for
|
||||
display units and shifts only former unassigned Steps 06-20 to 07-21.
|
||||
Recording/replay is now Step-07, not removed or silently bypassed. Completed
|
||||
history and original assignments/reports keep their existing numbering.
|
||||
At that decision the combined recording/replay envelope became Step-07. The
|
||||
prospective split below now separates recording and playback. Completed history
|
||||
and original assignments/reports keep their existing numbering.
|
||||
|
||||
Intended display defaults: mph for normal vehicle speed (ft/s engineering option),
|
||||
ft lengths, lb mass, lb/h fuel mass rate, lbf*ft torque, degF temperature and
|
||||
|
|
@ -780,12 +782,12 @@ current human-facing simulation/diagnostic/dashboard surfaces.
|
|||
Following Step-05B acceptance, [Step-06](Step-06.md) assigned the two unit systems
|
||||
plus Road/Engineering speed presentation, first-use/saved/error behavior, exact
|
||||
conversion vectors and stable source-unit gauge bounds. Its implementation now
|
||||
exists but is unaccepted pending the focused review findings below. The default
|
||||
and unit mappings remain approved; this is not a request to redesign them.
|
||||
exists and is accepted after Step-06A below. The default and unit mappings
|
||||
remain approved and unchanged.
|
||||
|
||||
## Step-06 review and focused correction
|
||||
## Historical Step-06 review and focused correction
|
||||
|
||||
Decision: **REQUIRES FOCUSED CORRECTION / NOT ACCEPTED**, 2026-10-30.
|
||||
Decision at that review: **REQUIRES FOCUSED CORRECTION / NOT ACCEPTED**, 2026-10-30.
|
||||
Reviewed [Step-06](Step-06.md), its [report](Step-06-Report.md), all new conversion/
|
||||
preference/native-store/presentation code, changed shell/host/editor paths,
|
||||
new unit and actual-provider tests, docs, nine-project references and artifacts.
|
||||
|
|
@ -826,8 +828,56 @@ that the orchestrator ran the failing native interaction.
|
|||
|
||||
No application builds/tests/native/workload commands or runtime reproductions
|
||||
were executed by the orchestrator. Preserve [Step-06-Report.md](Step-06-Report.md)
|
||||
unchanged. [Step-06A](Step-06A.md) is limited to these two existing-scope findings
|
||||
and their real regressions; no Step-07 assignment is created.
|
||||
unchanged. At that review Step-06A was limited to those findings and Step-07
|
||||
was withheld. The closing review below accepts the corrected milestone.
|
||||
|
||||
## Step-06A acceptance and corrected Step-06
|
||||
|
||||
Decision: **ACCEPTED**, 2026-10-30. Frozen C-01..C-07 and AC-01..AC-05 are
|
||||
satisfied. Step-06 with Step-06A is accepted; no Step-06B is required.
|
||||
|
||||
Reviewed [Step-06A](Step-06A.md), its [report](Step-06A-Report.md), the actual
|
||||
guard/typed-error and get/set selector changes, shared JSON/scalar/quality
|
||||
projection and callers, all new control/readout/provider/state tests, docs,
|
||||
unchanged nine-project references and existing Release outputs.
|
||||
|
||||
| Criterion | Decision | Evidence |
|
||||
|---|---|---|
|
||||
| AC-01 | ACCEPTED | Invalid proposal is checked before initialization/read/write; exact unchanged state/zero store-call assertions; both actual binding callbacks reject failed saves and recover with aligned controls/cascaded readout |
|
||||
| AC-02 | ACCEPTED | Real static-v1 route and shared helper cover null/wrong type/Unknown/unsupported text/zero/false with exact source context; real-feed converted Uncertain/Stale/Stopped/unavailable projection preserves state/range/time |
|
||||
| AC-03 | ACCEPTED ON WORKER EXECUTION EVIDENCE | Reported complete nine-project Release build zero warnings/errors; 179 unit + 105 integration passes (284 total, zero failed/skipped); isolated rebuilt native default/four-mode/editor/restored-Metric/close smoke |
|
||||
| AC-04 | ACCEPTED | Actual fresh-service and presentation pre-fix failures, honest framework-event versus native fault distinction, source-path self-review and aligned docs/README |
|
||||
| AC-05 | ACCEPTED | Focused source/tests/docs/report scope; original assignments/reports, unit constants, defaults, source contracts, dependencies and manual workflow preserved |
|
||||
|
||||
No separate pre-fix native DOM failure or native storage-fault injection is
|
||||
claimed. The corrected framework-supported binding plus actual callback/render
|
||||
tests establish the assigned reconciliation path. Native positive behavior is
|
||||
reported separately. The 14 added cases comprise one unit and 13 integration;
|
||||
all 270 original cases remain in the 284-case report.
|
||||
|
||||
The orchestrator ran no application builds/tests/native/workload commands and
|
||||
did not execute the reproductions. Source inventory, graph and existing outputs
|
||||
corroborate worker evidence, not independent runtime verification.
|
||||
|
||||
## Prospective telemetry split and Step-07 handoff
|
||||
|
||||
The former combined recording/replay envelope would introduce capture ownership,
|
||||
archive storage and a playback clock in one assignment. Apply the existing
|
||||
bounded-scope policy before execution:
|
||||
|
||||
- Step-07: actual session observation capture with a bounded in-memory owner,
|
||||
explicit stop/limits, source-faithful save and strict archive readback.
|
||||
- Step-08: recorded playback/seek/speed feeding shared presentation, without
|
||||
querying a live source or rerunning physics. Not assigned yet.
|
||||
- Former unassigned Steps 08-21 become 09-22, preserving all later capability/
|
||||
authorization gates and all completed numbering/history.
|
||||
|
||||
[Step-07](Step-07.md) freezes the capture window, loss/close/reentry outcomes,
|
||||
exact count/size limits and strict archive/I/O semantics. No polling of the
|
||||
200-entry UI trace, hidden new acquisition loop or display-unit data rewrite is
|
||||
allowed. Recording remains in memory until explicit save after Stop; no
|
||||
crash-durable/live-streaming or unlimited-duration claim is made.
|
||||
The next review must not demand the deferred Step-08 playback controls.
|
||||
|
||||
## Prerequisites, limitations, and known issues
|
||||
|
||||
|
|
@ -855,24 +905,23 @@ and their real regressions; no Step-07 assignment is created.
|
|||
Step-04B. Step-05's original and follow-up findings are closed. Preserve the 190-/
|
||||
202-/207-case reports and original numerical/native evidence distinctly.
|
||||
- Profile metadata/UI, synthetic diagnostics, deterministic dynamics/v2 and the
|
||||
corrected dashboard are accepted. Display units exist but are unaccepted.
|
||||
Replay, calibration values,
|
||||
corrected dashboard/display units are accepted. Recording/archive, replay, calibration values,
|
||||
persistence, AI and physical hardware operations remain unimplemented.
|
||||
- No application build or test has been executed by the orchestrator.
|
||||
|
||||
## Review and progression gate
|
||||
|
||||
On manual return, evaluate Step-06A and the original Step-06 display-unit contract/shared gate using the
|
||||
On manual return, evaluate Step-07 and its frozen capture/archive contract/shared gate using the
|
||||
assignment, worker report, actual code/tests, dependency graph, Git changes,
|
||||
README/docs, and recorded build/test evidence. Do not accept solely on a success
|
||||
claim; do not claim independent runtime verification.
|
||||
|
||||
- Inspect reject-before-initialize, actual selector rollback after failed saves,
|
||||
shared unavailable/typed/quality handling, and preserved positive units/source/
|
||||
editor behavior. Do not add deferred recording/layout/unit families.
|
||||
- If accepted: close Step-06A, accept corrected Step-06, update roadmap/state, prepare Step-07
|
||||
recording/replay and stop for manual handoff.
|
||||
- If deficient: issue narrowly scoped Step-06B only for a material unmet contract/
|
||||
- Inspect actual observations beyond the bounded trace, immutable source/decoded
|
||||
snapshots, one capture owner, explicit loss/limits, atomic archive save/strict
|
||||
readback and native evidence. Do not add deferred playback/streaming requirements.
|
||||
- If accepted: accept Step-07, update roadmap/state, prepare Step-08 replay
|
||||
and stop for manual handoff.
|
||||
- If deficient: issue narrowly scoped Step-07A only for a material unmet contract/
|
||||
regression, then stop. Planned new features are not corrections.
|
||||
- If blocked: retain the active step, document the prerequisite and required
|
||||
worker evidence; do not advance or mark unexecuted checks as successful.
|
||||
|
|
@ -931,12 +980,16 @@ claim; do not claim independent runtime verification.
|
|||
| 2026-10-30 | Step-06 returned and reviewed | Exact conversion/default/native persistence/editor/source-invariance paths and reported 270-case/clean Release/native evidence inspected |
|
||||
| 2026-10-30 | Step-06 requires focused correction | R-01 fresh-invalid initialization and failed-selector reconciliation; R-02 null/non-numeric/Unknown display bypass; original C-07/C-08/C-09, not new product scope |
|
||||
| 2026-10-30 | Step-06A prepared | Narrow rejection/readout correction with real pre-fix/event/provider tests; preserve approved imperial defaults/mappings, no Step-07 |
|
||||
| 2026-10-30 | Step-06A returned and ACCEPTED | Frozen rejection/readout contract satisfied; actual regressions, binding callbacks, real provider/readout states and reported 284-case/clean Release/isolated native evidence inspected |
|
||||
| 2026-10-30 | Corrected Step-06 ACCEPTED | Original and 06A criteria closed; Imperial default/metric options/source invariants preserved; no 06B |
|
||||
| 2026-10-30 | Telemetry envelope split prospectively | Step-07 bounded recording/archive, Step-08 replay; former unassigned 08-21 become 09-22; no completed history renumbered |
|
||||
| 2026-10-30 | Step-07 prepared | Single capture-owner outcome, strict source-faithful archive/readback and explicit limits; no playback clock, manual handoff pending |
|
||||
|
||||
## Manual handoff instruction
|
||||
|
||||
Provide [Step-06A.md](Step-06A.md), original [Step-06.md](Step-06.md) and the shared
|
||||
Provide [Step-07.md](Step-07.md) and the shared
|
||||
[worker gate](WORKER-QUALITY-GATE.md) to the separate worker and request execution
|
||||
of the focused correction only. The worker must produce `prompts/Step-06A-Report.md`
|
||||
and stop for review. Do not begin Step-07 recording/replay.
|
||||
of that assignment only. The worker must produce `prompts/Step-07-Report.md`
|
||||
and stop for review. Do not begin Step-08 replay.
|
||||
Return manually to the orchestrator for review. Reports, including final chat
|
||||
reports, must follow the single plain triple-backtick copy-window requirement.
|
||||
|
|
|
|||
|
|
@ -0,0 +1,180 @@
|
|||
```
|
||||
# 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.
|
||||
```
|
||||
|
|
@ -0,0 +1,296 @@
|
|||
# Step-07 - Bounded telemetry recording and archive readback
|
||||
|
||||
## STEP IDENTIFIER
|
||||
|
||||
Step-07. Corrected Step-06/06A was accepted on 2026-10-30.
|
||||
This is the sole active implementation assignment. Replay is Step-08 and blocked.
|
||||
|
||||
## STEP TITLE
|
||||
|
||||
Capture real session diagnostic observations independently of widgets, then
|
||||
explicitly save and reopen a source-faithful bounded archive.
|
||||
|
||||
## OBJECTIVE
|
||||
|
||||
One user outcome: record an explicit static/dynamic session's diagnostic activity
|
||||
and verify the saved capture through real local readback.
|
||||
One primary new contract: a bounded session-owned capture window, independent
|
||||
of live widget lifetime and faithful to actual diagnostic observations.
|
||||
|
||||
This is bounded in-memory capture plus save after Stop, not live disk streaming,
|
||||
crash durability, unlimited history or playback. The former recording/replay
|
||||
envelope was split prospectively; do not implement Step-08 controls here.
|
||||
Read [STATE.md](STATE.md), [ROADMAP.md](ROADMAP.md) and
|
||||
[WORKER-QUALITY-GATE.md](WORKER-QUALITY-GATE.md), establish the frozen matrix
|
||||
before coding, self-review after the first green run, write
|
||||
`prompts/Step-07-Report.md`, and STOP.
|
||||
|
||||
## ARCHITECTURAL CONTEXT
|
||||
|
||||
Keep all nine projects and one native Client. Diagnostics may expose a narrowly
|
||||
scoped read-only operation-observation port; Application owns capture/archive
|
||||
use cases and validation; UI owns the reusable recording/inspection controls.
|
||||
Client composes real app-local storage. Components stays generic and independent.
|
||||
|
||||
No new project, dependency, host, general event bus or storage framework.
|
||||
Use built-in .NET JSON/I/O/time primitives and existing helpers. All source/tests
|
||||
remain under `src`, tests under `src/tests`. No root artifacts/test directory,
|
||||
protected-file edit, staging/commit/push or automatic worker handoff.
|
||||
|
||||
## CURRENT IMPLEMENTATION STATE
|
||||
|
||||
Accepted features already provide immutable session identity, actual synthetic
|
||||
protocol v1/v2 results, static/dynamic signals, strict source validation, raw
|
||||
trace snapshots, one dashboard acquisition owner, real shared UI and Imperial/
|
||||
Metric display preferences. Worker baseline: 179 unit + 105 integration passes
|
||||
(284 total, zero failed/skipped), clean full Release build and native evidence.
|
||||
The orchestrator did not execute those commands.
|
||||
|
||||
- [DiagnosticSession](../src/AutoForge.Application/Features/Vehicles/Diagnostics/DiagnosticSessionService.cs)
|
||||
owns source lifetime resources and actual protocol operations.
|
||||
- [ProviderContracts](../src/AutoForge.Diagnostics/ProviderContracts.cs) defines
|
||||
source/signal/trace contracts; its UI trace buffer retains only 200 entries.
|
||||
- [SyntheticDiagnosticProtocolClient](../src/AutoForge.Diagnostics/SyntheticDiagnosticProtocolClient.cs)
|
||||
validates replies/typed results before committing an operation's trace.
|
||||
- Existing diagnostics/simulation hosts and dashboard feed supply explicit
|
||||
sessions; no recording/archive implementation exists yet.
|
||||
|
||||
Inspect Git and prior art before editing. Preserve all accepted behavior, existing
|
||||
dirty work, original assignments/reports and orchestration files.
|
||||
|
||||
## REQUIRED IMPLEMENTATION
|
||||
|
||||
### Frozen contract matrix
|
||||
|
||||
| ID | Input/precondition | Required result |
|
||||
|---|---|---|
|
||||
| C-01 | Start on an open actual session with prior trace history; no new operations | New empty capture with explicit source; prior history is excluded. Start/Stop never discover, poll, step or change the source. Empty stopped capture is valid. |
|
||||
| C-02 | At least 225 real operations occur after Start while UI trace capacity is 200 | All in-window operations appear exactly once in capture order with matching correlation/outcome/raw bytes; UI trace still drops old entries normally. No trace polling or post-hoc dropped-record reconstruction. |
|
||||
| C-03 | Paused v2 source, actual reads, controlled capture time, unit toggles/hide/unmount | Capture elapsed time, diagnostic ticks and model step/time stay distinct; actual source values/units/config/run are retained. Widget/unit changes add no reads, owner or physics steps. Static v1 also works. |
|
||||
| C-04 | Positive, negative, timeout, no response, cancellation and malformed reply | Actual outcome/error and received raw bytes are preserved. No response bytes or decoded successful signals are invented for failed operations. Existing source operation results remain unchanged by recording. |
|
||||
| C-05 | Repeated Start, competing Start/Stop, pending observation during Stop | Same active owner/capture on repeated Start; Stop defines a drainable cutover. Conflicting Start rejects before mutation during drain; no old callback enters a later capture. |
|
||||
| C-06 | Source close/reset/scope disposal; then a new session/capture | Old capture stops/detaches and remains inspectable/saveable with old source context; new capture starts empty. Unsaved data is not silently discarded and old responses never appear as new-source data. |
|
||||
| C-07 | Count/encoded-byte/header/file limits below, including exact boundary and one over | At the limit the valid prefix is retained; exceeding capture capacity explicitly faults/stops with Incomplete/LimitExceeded, never silent truncation/healthy completion. Oversized header/start/load rejects before mutation. |
|
||||
| C-08 | Explicit save of stopped capture, then new process/service/store readback | Real persisted archive returns byte-identical raw payloads and value/type/unit/quality/time/context-identical decoded signals/counts. No reference to the original live session/profile catalog or in-memory object is required. |
|
||||
| C-09 | Invalid/truncated/unsupported/duplicate/unknown/incoherent archive data | Typed visible rejection before replacing a prior loaded capture. Valid intentionally incomplete captures remain visibly incomplete; a truncated file is not accepted as one. |
|
||||
| C-10 | Save collision, cancellation or I/O failure; stale completion after conflicting action | No existing archive overwritten, partial file published, false Saved state or newer capture marked saved. Prior data remains intact; pending commands and cleanup have an explicit safe policy. |
|
||||
| C-11 | Both real host workflows record/stop/save/close/load/inspect | Shared Application capture/storage and actual providers are used. Recording survives gauge invisibility; archived inspection is clearly not live data or playback. |
|
||||
| C-12 | Existing model/wire/UI/unit/source safety and full verification | All 284 cases/invariants preserved with meaningful new coverage, complete nine-project Release build/tests and native capture/save/readback smoke. No replay or hardware capability is introduced. |
|
||||
|
||||
### A. Observe actual operations, not the bounded UI trace
|
||||
|
||||
Add the smallest provider-neutral read-only observation seam at the actual
|
||||
validated operation/trace commitment path. It must include the operation's trace
|
||||
identity/service/outcome/error/raw request/optional response and its actual
|
||||
decoded SignalSnapshot for a positive read.signals result.
|
||||
|
||||
Every in-window trace-producing operation is captured once, including discovery
|
||||
exchanges/manual reads, not only dashboard cycles. No observing the UI buffer by
|
||||
periodic snapshots, hidden acquisition loop, guessed payload decoding or engine
|
||||
oracle. Preserve the existing 200-entry buffer and dropped count independently.
|
||||
|
||||
Decoded signals must be attached to their own operation, not a later "latest"
|
||||
snapshot. A non-positive/non-read.signals operation has no successful signal
|
||||
snapshot. Original v1 nullable/non-numeric/Unknown values are legitimate captured
|
||||
data; v2 keeps its existing strict shape and actual model/config/run metadata.
|
||||
Record exact source units, not converted labels/rounded display strings.
|
||||
|
||||
Publish immutable defensive snapshots with a defined observation order. Define
|
||||
Start/Stop subscription cutover and in-flight draining explicitly; do not reorder
|
||||
by model time, infer simultaneous modules or expose arbitrary command access.
|
||||
Recorder capacity/failure must be visible to its caller without corrupting the
|
||||
diagnostic operation result/trace or blocking cleanup under a shared gate.
|
||||
|
||||
### B. One bounded capture owner per actual session
|
||||
|
||||
Use the existing explicit session, not a new active-vehicle registry/open workflow.
|
||||
Repeated acquisition shares one capture owner or rejects duplicate ownership
|
||||
before mutation; repeated Start on that active owner is idempotent.
|
||||
Use the session lifetime/resource mechanism for close/reset/disposal.
|
||||
|
||||
Capture only the interval after Start commits and before Stop's defined cutover.
|
||||
Stop drains accepted callbacks and freezes an immutable result; it never pauses/
|
||||
steps/resets physics or stops the existing dashboard feed. Close/reset ends the
|
||||
old capture and preserves its frozen data for explicit save/inspection.
|
||||
|
||||
Keep at most one unsaved capture in the owning feature: new capture/replacement
|
||||
requires explicit save or discard of that unsaved result. A new source never
|
||||
inherits old values. Widget hiding/unmounting affects only view subscriptions.
|
||||
Save/load results are capture-ID/generation-bound; reject conflicting pending
|
||||
commands before mutation or serialize them without deadlocking source cleanup.
|
||||
|
||||
Fixed first-slice limits, not new user settings:
|
||||
|
||||
- At most 4,096 observations.
|
||||
- At most 16 MiB total compact UTF-8 encoded observation bytes, measured by the
|
||||
actual archive observation encoding, not an approximate raw-payload count.
|
||||
- At most 1 MiB encoded header; at most 32 MiB complete archive input/output.
|
||||
MiB means 1,048,576 bytes. Bound archive parsing depth at 128.
|
||||
|
||||
Test exact boundaries. A rejected next observation stops/faults capture with a
|
||||
visible limit reason; retain the valid prefix as Incomplete, never pretend it
|
||||
covers later traffic. Allow explicit **Save partial capture**, distinctly labeled.
|
||||
Do not silently drop, overwrite oldest records, claim unknown later loss counts,
|
||||
or make a source request fail merely because recording reached its limit.
|
||||
|
||||
Use a small controllable time seam (existing .NET TimeProvider is sufficient)
|
||||
for nonnegative nondecreasing captureElapsedTicks in TimeSpan ticks since Start.
|
||||
Keep this observational timeline separate from diagnostic/model clocks; paused
|
||||
models may have repeated model time, and real resets must not be "repaired."
|
||||
|
||||
### C. Strict source-faithful archive and actual local persistence
|
||||
|
||||
Define/document schema v1 before implementation. Root fields are exactly
|
||||
schemaVersion, header, observations and completion in camelCase.
|
||||
The header carries capture identity, original session/profile/revision/vehicle/
|
||||
provider/target identity, actual synthetic protocol name/version, optional
|
||||
dynamics config/run identity, source endpoint identities and start UTC metadata.
|
||||
Completion carries stop UTC/reason, complete-versus-incomplete/error state and
|
||||
actual observation count. Unknown nullable metadata is explicit null.
|
||||
|
||||
Each observation has contiguous capture sequence, captureElapsedTicks, its
|
||||
original trace metadata/logical ticks/raw request/nullable response and the
|
||||
associated decoded signals or explicit null. Store raw bytes reversibly (base64)
|
||||
and JSON signal values without coercion/rounding; retain unit/quality/origin and
|
||||
actual per-sample diagnostic/model/config/run context.
|
||||
|
||||
The reader validates required/version/duplicate/unknown schema properties,
|
||||
defined enums, strict types/base64, lengths/counts/order/times, source/context
|
||||
coherence and positive-read/raw/decoded associations before publishing a result.
|
||||
Reuse/extract existing pure validators where useful, not new wire semantics.
|
||||
Schema-object rules do not reject arbitrary properties inside an opaque v1
|
||||
signal's JSON value. Preserve malformed reply bytes for recorded ProtocolError;
|
||||
they are evidence, not a reason to reinterpret the operation as successful.
|
||||
|
||||
Use complete explicit-offset UTC timestamps, not ambient date/time inference.
|
||||
Never backfill identities/units/model time from current profiles/configuration.
|
||||
File readback establishes archive consistency, not manufacturer truth, current
|
||||
vehicle state or cryptographic authenticity.
|
||||
|
||||
Persist only after capture stops, on an explicit Save. Use an Application storage
|
||||
port with a real local filesystem implementation rooted in the app's recordings
|
||||
directory; Client supplies app-local root/composition. Portable tests use actual
|
||||
isolated files through that implementation, not a mock archive store.
|
||||
|
||||
Use generated/validated opaque capture IDs for filenames, never source strings
|
||||
or arbitrary paths. Write a task-owned temporary file, flush/close, then publish
|
||||
without overwriting an existing final archive. On failure/cancel leave prior
|
||||
archives intact and surface typed errors; incomplete temporary files are not
|
||||
catalogued as successful captures. Corrupt matching archives/read failures are
|
||||
visible, not silently skipped as an empty successful list.
|
||||
|
||||
No SQLite/package, file-dialog framework, live streaming or crash-recovery engine
|
||||
is assigned. Capturing data is memory-only until explicit successful save, and
|
||||
the UI/docs must say so. No user-data directory reset or unrelated file cleanup.
|
||||
|
||||
### D. Real reusable UI and inspection
|
||||
|
||||
Compose shared recording controls into the existing static and dynamic workflows
|
||||
without replacing their session/dashboard controls. Provide explicit Start/Stop,
|
||||
counts/bytes/limits/unsaved status, Save (or clearly partial Save), explicit
|
||||
in-memory Discard, saved-capture selection/load and source/raw/decoded inspection.
|
||||
|
||||
Frozen data remains reachable for Save after source close; do not hide the only
|
||||
copy with the live-session panel. Show the archive source, completion/loss reason,
|
||||
count/timing and selected observation's raw/decoded facts. Empty captures have an
|
||||
explicit empty state. A loaded capture must not rebind the live source or appear
|
||||
as live gauges; playback is not implemented here. Keep large payload details
|
||||
on demand rather than rendering all records on every source event.
|
||||
|
||||
Preserve accepted Imperial/Metric preferences; archive/source inspectors expose
|
||||
original units. Captures may contain sensitive vehicle/source data: remain local,
|
||||
with no external upload, AI use, telemetry transmission or new hardware access.
|
||||
|
||||
## FILES OR PROJECTS EXPECTED TO CHANGE
|
||||
|
||||
Minimal Diagnostics observation contracts/client tap, narrow session-lifetime
|
||||
exposure, Application telemetry recording/archive/storage, shared UI controls/
|
||||
inspection, Client storage DI, focused tests and related README/docs.
|
||||
No new project/dependency or Simulation/Core physics/oracle implementation change.
|
||||
Under `prompts`, create only `Step-07-Report.md`.
|
||||
|
||||
## INTERFACE AND DEPENDENCY REQUIREMENTS
|
||||
|
||||
Keep the nine-project graph, one Client, pure Components and Application/UI ->
|
||||
Diagnostics ports. Preserve exact v1/v2 wire/profile/config contracts, partial
|
||||
discovery/verified clear, raw trace semantics, source isolation, model clock and
|
||||
single advancement/acquisition owners. Recording cannot authorize operations.
|
||||
No display-unit values in source archives, broad catches/silent fallbacks, hidden
|
||||
source substitution or success-shaped loss/I/O handling.
|
||||
No workload/system restore/install/update/repair/rollback or destructive Git.
|
||||
Do not edit assignments, ROADMAP, STATE, shared gate, history or protected files.
|
||||
|
||||
## TESTING REQUIREMENTS
|
||||
|
||||
Implement C-01..C-12 with named meaningful assertions:
|
||||
|
||||
- Actual v1/v2 protocol/session and observation/capture integration; verify more
|
||||
than 200 real operations, exact once/order/raw bytes and positive signal binding.
|
||||
- Controlled time, limits and pending callback/Stop/close/reset interleavings;
|
||||
failure-safe finally cleanup; no sleeps/polling as correctness proof. Boundary
|
||||
tests may drive the real capture accumulator through its observation port;
|
||||
do not mock away the recorder.
|
||||
- Actual temporary filesystem save/new-instance readback, strict invalid-archive
|
||||
vectors, collision/write/read/cancel failure and no published partial archive.
|
||||
Compare raw bytes, JSON value kinds/data, all identity/unit/quality/time metadata
|
||||
and complete/incomplete counts, not merely a filename or successful parse.
|
||||
- Real DI/rendered controls in both hosts, unsaved old-source retention, visible
|
||||
limit/I/O errors and no hidden reads/model changes; all source/unit regressions.
|
||||
|
||||
Run focused cases, then sequentially:
|
||||
|
||||
- `dotnet build .\src\AutoForge.slnx --configuration Release --no-restore`
|
||||
- `dotnet test .\src\AutoForge.slnx --configuration Release --no-build`
|
||||
|
||||
Preserve the 284-case baseline (179 unit, 105 integration) plus meaningful new
|
||||
coverage. Map intentional UI assertion changes without deleting safety checks.
|
||||
Build all nine projects/native Client. Install/restore nothing absent a real
|
||||
missing-dependency failure.
|
||||
|
||||
Native smoke: real static and paused dynamic sessions, record actual activity
|
||||
while gauges hide, stop, save, close/reopen app and load/inspect the saved capture;
|
||||
confirm source/raw/decoded context and unchanged model/unit preferences. Check
|
||||
source close/reset leaves a stopped inspectable capture and old routes still
|
||||
work. Native need not force all limit/fault vectors; distinguish controlled proof.
|
||||
Use/clean only exact task-owned test files/profiles, not unrelated saved captures.
|
||||
|
||||
## DOCUMENTATION REQUIREMENTS
|
||||
|
||||
Update README/index/architecture/build guide and a concise archive-v1/recording
|
||||
guide: exact schema/limits/capture cutover, complete/incomplete states, three
|
||||
time concepts, local source-sensitive storage, explicit Save and memory/crash
|
||||
limitations, failure/corrupt-file behavior and actual verification evidence.
|
||||
Step-06/06A is accepted; Step-07 worker status stays pending orchestrator review.
|
||||
Step-08 replay, long streaming, hardware and manufacturer validity are not claimed.
|
||||
|
||||
## ACCEPTANCE CRITERIA
|
||||
|
||||
| ID | Criterion | Evidence |
|
||||
|---|---|---|
|
||||
| AC-01 | C-01..C-04 actual source-faithful observation capture beyond bounded trace, with no hidden acquisition/model effects | Real v1/v2/raw/decoded/outcome/time tests and exact counts |
|
||||
| AC-02 | C-05..C-07 one bounded owner, explicit cutover/loss/limits/close and retained unsaved source | Controlled lifecycle/exact-boundary/state-preservation tests |
|
||||
| AC-03 | C-08..C-10 strict consistent archives and real atomic source-faithful save/readback | New-instance filesystem round trips, invalid data and I/O/collision/cancel assertions |
|
||||
| AC-04 | C-11 actual shared UI/native recording/inspection with honest saved/partial/source labels | Real DI/rendered/provider and native restart/readback evidence |
|
||||
| AC-05 | C-12 all 284 cases/invariants, new coverage, complete nine-project Release/native build and required smoke pass | Exact commands/exits/warnings/per-project counts; native/control distinction |
|
||||
| AC-06 | Frozen matrix/self-review/schema/docs/README match actual behavior and limits | Named executed cases, exact threshold/output shapes and own post-green source-path review |
|
||||
| AC-07 | History/protection/dependencies/manual workflow preserved; complete report saved and worker stops | Preservation review and `prompts/Step-07-Report.md` |
|
||||
|
||||
## OUT-OF-SCOPE WORK
|
||||
|
||||
Playback/seek/speed/replay provider or clock, resimulation, live disk streaming/
|
||||
crash durability/unlimited capture, charts/layout persistence, calibration/AI/
|
||||
hardware, database/new package/project/host and unrelated cleanup.
|
||||
No future assignment, agents, automatic handoff, orchestration/shared-gate edit,
|
||||
stage, commit or push.
|
||||
|
||||
## REPORTING REQUIREMENTS
|
||||
|
||||
Save `prompts/Step-07-Report.md` wholly inside exactly one plain triple-backtick
|
||||
fence, no language tag/outside text/nested fences. Include identifier/title/status,
|
||||
functions/files/interfaces, C-01..C-12/AC-01..AC-07 matrix with named executed
|
||||
evidence, exact archive shapes/limit/lifecycle/I/O results, commands/exits/
|
||||
warnings/per-project counts, native versus controlled coverage, docs/README,
|
||||
own source-path self-review after first green, limitations/deviations/blockers
|
||||
and preservation review. COMPLETE requires all assigned checks; otherwise use
|
||||
INCOMPLETE/BLOCKED with the precise unmet criterion.
|
||||
Save and STOP for manual review. Do not begin Step-08.
|
||||
|
|
@ -25,6 +25,14 @@ public readonly record struct DisplayUnitSelection(
|
|||
new(DisplayUnitSystem.ImperialUS, SpeedDisplayMode.Road);
|
||||
}
|
||||
|
||||
public enum DisplayUnitPreferenceErrorKind
|
||||
{
|
||||
None,
|
||||
InvalidStoredValue,
|
||||
InvalidSelection,
|
||||
StoreUnavailable
|
||||
}
|
||||
|
||||
public sealed record DisplayMeasurement(
|
||||
double? Value,
|
||||
string Unit,
|
||||
|
|
@ -61,6 +69,7 @@ public sealed class DisplayUnitPreferenceService(IDisplayUnitPreferenceStore sto
|
|||
public DisplayUnitSelection Selection { get; private set; } = DisplayUnitSelection.Default;
|
||||
public bool IsPersistedSelection { get; private set; }
|
||||
public string? Error { get; private set; }
|
||||
public DisplayUnitPreferenceErrorKind ErrorKind { get; private set; }
|
||||
public bool IsInitialized => _initialized;
|
||||
public event Action? Changed;
|
||||
|
||||
|
|
@ -80,18 +89,21 @@ public sealed class DisplayUnitPreferenceService(IDisplayUnitPreferenceStore sto
|
|||
Selection = DisplayUnitSelection.Default;
|
||||
IsPersistedSelection = false;
|
||||
Error = null;
|
||||
ErrorKind = DisplayUnitPreferenceErrorKind.None;
|
||||
}
|
||||
else if (TryParse(stored, out var selection))
|
||||
{
|
||||
Selection = selection;
|
||||
IsPersistedSelection = true;
|
||||
Error = null;
|
||||
ErrorKind = DisplayUnitPreferenceErrorKind.None;
|
||||
}
|
||||
else
|
||||
{
|
||||
Selection = DisplayUnitSelection.Default;
|
||||
IsPersistedSelection = false;
|
||||
Error = $"Saved display preference '{stored}' is invalid. Imperial (US) / Road is active as a default and has not been saved.";
|
||||
ErrorKind = DisplayUnitPreferenceErrorKind.InvalidStoredValue;
|
||||
}
|
||||
}
|
||||
catch (Exception exception) when (IsPreferenceStoreFailure(exception))
|
||||
|
|
@ -99,6 +111,7 @@ public sealed class DisplayUnitPreferenceService(IDisplayUnitPreferenceStore sto
|
|||
Selection = DisplayUnitSelection.Default;
|
||||
IsPersistedSelection = false;
|
||||
Error = $"Could not load the saved display preference: {exception.Message} Imperial (US) / Road is active as a default and has not been saved.";
|
||||
ErrorKind = DisplayUnitPreferenceErrorKind.StoreUnavailable;
|
||||
}
|
||||
|
||||
Changed?.Invoke();
|
||||
|
|
@ -106,14 +119,15 @@ public sealed class DisplayUnitPreferenceService(IDisplayUnitPreferenceStore sto
|
|||
|
||||
public bool TrySet(DisplayUnitSelection proposed)
|
||||
{
|
||||
Initialize();
|
||||
if (!IsValid(proposed))
|
||||
{
|
||||
Error = "The selected display unit system or speed mode is undefined; the active preference was not changed.";
|
||||
ErrorKind = DisplayUnitPreferenceErrorKind.InvalidSelection;
|
||||
Changed?.Invoke();
|
||||
return false;
|
||||
}
|
||||
|
||||
Initialize();
|
||||
var serialized = Serialize(proposed);
|
||||
try
|
||||
{
|
||||
|
|
@ -122,6 +136,7 @@ public sealed class DisplayUnitPreferenceService(IDisplayUnitPreferenceStore sto
|
|||
catch (Exception exception) when (IsPreferenceStoreFailure(exception))
|
||||
{
|
||||
Error = $"Could not save the display preference: {exception.Message} The previous selection remains active.";
|
||||
ErrorKind = DisplayUnitPreferenceErrorKind.StoreUnavailable;
|
||||
Changed?.Invoke();
|
||||
return false;
|
||||
}
|
||||
|
|
@ -129,6 +144,7 @@ public sealed class DisplayUnitPreferenceService(IDisplayUnitPreferenceStore sto
|
|||
Selection = proposed;
|
||||
IsPersistedSelection = true;
|
||||
Error = null;
|
||||
ErrorKind = DisplayUnitPreferenceErrorKind.None;
|
||||
Changed?.Invoke();
|
||||
return true;
|
||||
}
|
||||
|
|
@ -305,6 +321,13 @@ public static class DisplayUnitConverter
|
|||
return measurement.Value!.Value.ToString($"F{precision}", CultureInfo.InvariantCulture);
|
||||
}
|
||||
|
||||
public static bool IsKnownNumericUnit(string unit) =>
|
||||
unit is "m/s" or "rpm" or "V" or "ratio" or "count" or "gear" or
|
||||
"m" or "kg" or "kg/s" or "N*m" or "degC" or "m/s^2";
|
||||
|
||||
public static bool IsKnownUnit(string unit) =>
|
||||
IsKnownNumericUnit(unit) || unit == "boolean";
|
||||
|
||||
private static (string Unit, Func<double, double> Forward, Func<double, double> Inverse)? GetProjection(
|
||||
string unit,
|
||||
DisplayUnitSelection selection)
|
||||
|
|
|
|||
|
|
@ -1,5 +1,6 @@
|
|||
using System.Text.Json;
|
||||
using AutoForge.Application.Features.DisplayUnits;
|
||||
using AutoForge.Diagnostics;
|
||||
|
||||
namespace AutoForge.UI.Features.DisplayUnits;
|
||||
|
||||
|
|
@ -7,28 +8,74 @@ public sealed record DisplayUnitText(string Value, string Unit, string? Notice =
|
|||
|
||||
public static class DisplayUnitPresentation
|
||||
{
|
||||
public static string FormatSourceValue(JsonElement sourceValue) =>
|
||||
sourceValue.ValueKind switch
|
||||
{
|
||||
JsonValueKind.Undefined => "undefined",
|
||||
JsonValueKind.Null => "null",
|
||||
JsonValueKind.String => sourceValue.GetString() ?? string.Empty,
|
||||
_ => sourceValue.GetRawText()
|
||||
};
|
||||
|
||||
public static DisplayUnitText Project(
|
||||
JsonElement sourceValue,
|
||||
string sourceUnit,
|
||||
DisplayUnitSelection selection,
|
||||
int precision = 3)
|
||||
{
|
||||
if (sourceValue.ValueKind != JsonValueKind.Number)
|
||||
return Project(sourceValue, sourceUnit, selection, SignalQuality.Good, precision);
|
||||
}
|
||||
|
||||
public static DisplayUnitText Project(
|
||||
JsonElement sourceValue,
|
||||
string sourceUnit,
|
||||
DisplayUnitSelection selection,
|
||||
SignalQuality quality,
|
||||
int precision = 3)
|
||||
{
|
||||
if (quality == SignalQuality.Unknown)
|
||||
{
|
||||
return new DisplayUnitText(sourceValue.ToString(), sourceUnit);
|
||||
return new DisplayUnitText("--", sourceUnit, Notice: "The source quality is Unknown; the current measurement is unavailable.");
|
||||
}
|
||||
|
||||
if (!sourceValue.TryGetDouble(out var number))
|
||||
if (!Enum.IsDefined(quality))
|
||||
{
|
||||
return new DisplayUnitText("--", sourceUnit, Error: "The numeric source value is unavailable.");
|
||||
return new DisplayUnitText("--", sourceUnit, Error: "The source quality is undefined.");
|
||||
}
|
||||
|
||||
var measurement = DisplayUnitConverter.Project(number, sourceUnit, selection);
|
||||
return new DisplayUnitText(
|
||||
DisplayUnitConverter.Format(measurement, precision),
|
||||
measurement.Unit,
|
||||
measurement.Notice,
|
||||
measurement.Error);
|
||||
if (sourceValue.ValueKind is JsonValueKind.Null or JsonValueKind.Undefined)
|
||||
{
|
||||
return new DisplayUnitText("--", sourceUnit, Error: "The source measurement is missing or null.");
|
||||
}
|
||||
|
||||
if (sourceUnit == "boolean")
|
||||
{
|
||||
if (sourceValue.ValueKind is JsonValueKind.True or JsonValueKind.False)
|
||||
{
|
||||
return new DisplayUnitText(sourceValue.GetRawText(), sourceUnit, GetQualityNotice(quality));
|
||||
}
|
||||
|
||||
return new DisplayUnitText("--", sourceUnit, Error: "The boolean source value has the wrong JSON type.");
|
||||
}
|
||||
|
||||
if (!DisplayUnitConverter.IsKnownNumericUnit(sourceUnit))
|
||||
{
|
||||
return new DisplayUnitText(
|
||||
FormatSourceValue(sourceValue),
|
||||
sourceUnit,
|
||||
CombineNotices(
|
||||
$"Unit '{sourceUnit}' is not in the supported display mapping; showing the exact source value and unit.",
|
||||
GetQualityNotice(quality)));
|
||||
}
|
||||
|
||||
if (sourceValue.ValueKind != JsonValueKind.Number ||
|
||||
!sourceValue.TryGetDouble(out var number) ||
|
||||
!double.IsFinite(number))
|
||||
{
|
||||
return new DisplayUnitText("--", sourceUnit, Error: "The numeric source value is missing, non-numeric or non-finite.");
|
||||
}
|
||||
|
||||
return ProjectNumber(number, sourceUnit, selection, quality, precision);
|
||||
}
|
||||
|
||||
public static DisplayUnitText Project(
|
||||
|
|
@ -36,18 +83,94 @@ public static class DisplayUnitPresentation
|
|||
string sourceText,
|
||||
string sourceUnit,
|
||||
DisplayUnitSelection selection,
|
||||
int precision = 3) =>
|
||||
Project(sourceValue, sourceText, sourceUnit, selection, SignalQuality.Good, precision);
|
||||
|
||||
public static DisplayUnitText Project(
|
||||
double? sourceValue,
|
||||
string sourceText,
|
||||
string sourceUnit,
|
||||
DisplayUnitSelection selection,
|
||||
SignalQuality quality,
|
||||
int precision = 3)
|
||||
{
|
||||
if (sourceValue is not { } numericValue)
|
||||
if (quality == SignalQuality.Unknown)
|
||||
{
|
||||
return new DisplayUnitText(sourceText, sourceUnit);
|
||||
return new DisplayUnitText("--", sourceUnit, Notice: "The source quality is Unknown; the current measurement is unavailable.");
|
||||
}
|
||||
|
||||
var measurement = DisplayUnitConverter.Project(numericValue, sourceUnit, selection);
|
||||
if (!Enum.IsDefined(quality))
|
||||
{
|
||||
return new DisplayUnitText("--", sourceUnit, Error: "The source quality is undefined.");
|
||||
}
|
||||
|
||||
if (sourceUnit == "boolean")
|
||||
{
|
||||
if (sourceValue is null && bool.TryParse(sourceText, out var boolean))
|
||||
{
|
||||
return new DisplayUnitText(boolean ? "true" : "false", sourceUnit, GetQualityNotice(quality));
|
||||
}
|
||||
|
||||
return new DisplayUnitText("--", sourceUnit, Error: "The boolean source value is missing or has the wrong type.");
|
||||
}
|
||||
|
||||
if (sourceValue is not { } numericValue)
|
||||
{
|
||||
if (string.IsNullOrEmpty(sourceText) || StringComparer.OrdinalIgnoreCase.Equals(sourceText, "null"))
|
||||
{
|
||||
return new DisplayUnitText("--", sourceUnit, Error: "The source measurement is missing or null.");
|
||||
}
|
||||
|
||||
return DisplayUnitConverter.IsKnownNumericUnit(sourceUnit)
|
||||
? new DisplayUnitText("--", sourceUnit, Error: "The numeric source value is missing, non-numeric or non-finite.")
|
||||
: new DisplayUnitText(
|
||||
sourceText,
|
||||
sourceUnit,
|
||||
CombineNotices(
|
||||
$"Unit '{sourceUnit}' is not in the supported display mapping; showing the exact source value and unit.",
|
||||
GetQualityNotice(quality)));
|
||||
}
|
||||
|
||||
if (!double.IsFinite(numericValue))
|
||||
{
|
||||
return new DisplayUnitText("--", sourceUnit, Error: "The numeric source value is non-finite.");
|
||||
}
|
||||
|
||||
if (!DisplayUnitConverter.IsKnownNumericUnit(sourceUnit))
|
||||
{
|
||||
return new DisplayUnitText(
|
||||
sourceText,
|
||||
sourceUnit,
|
||||
CombineNotices(
|
||||
$"Unit '{sourceUnit}' is not in the supported display mapping; showing the exact source value and unit.",
|
||||
GetQualityNotice(quality)));
|
||||
}
|
||||
|
||||
return ProjectNumber(numericValue, sourceUnit, selection, quality, precision);
|
||||
}
|
||||
|
||||
private static DisplayUnitText ProjectNumber(
|
||||
double value,
|
||||
string sourceUnit,
|
||||
DisplayUnitSelection selection,
|
||||
SignalQuality quality,
|
||||
int precision)
|
||||
{
|
||||
var measurement = DisplayUnitConverter.Project(value, sourceUnit, selection);
|
||||
return new DisplayUnitText(
|
||||
DisplayUnitConverter.Format(measurement, precision),
|
||||
measurement.Unit,
|
||||
measurement.Notice,
|
||||
CombineNotices(measurement.Notice, GetQualityNotice(quality)),
|
||||
measurement.Error);
|
||||
}
|
||||
|
||||
private static string? GetQualityNotice(SignalQuality quality) =>
|
||||
quality == SignalQuality.Uncertain
|
||||
? "The source marked this finite value Uncertain."
|
||||
: null;
|
||||
|
||||
private static string? CombineNotices(string? first, string? second) =>
|
||||
first is null ? second :
|
||||
second is null ? first :
|
||||
$"{first} {second}";
|
||||
}
|
||||
|
|
|
|||
|
|
@ -218,11 +218,15 @@
|
|||
<ul>
|
||||
@foreach (var signal in signals.Signals)
|
||||
{
|
||||
var display = DisplayUnitPresentation.Project(signal.Value, signal.Unit, DisplaySelection);
|
||||
var display = DisplayUnitPresentation.Project(
|
||||
signal.Value,
|
||||
signal.Unit,
|
||||
DisplaySelection,
|
||||
signal.Quality);
|
||||
<li data-signal="@signal.SignalIdentifier">
|
||||
@signal.SignalIdentifier:
|
||||
Display @display.Value @display.Unit (@signal.Quality);
|
||||
source @signal.Value @signal.Unit,
|
||||
source @DisplayUnitPresentation.FormatSourceValue(signal.Value) @signal.Unit,
|
||||
logical tick @signal.LogicalTimeTicks, origin @signal.Origin,
|
||||
source @signal.ModuleIdentifier.
|
||||
@if (display.Notice is not null)
|
||||
|
|
@ -282,7 +286,6 @@
|
|||
</ol>
|
||||
</section>
|
||||
}
|
||||
|
||||
@code {
|
||||
[CascadingParameter]
|
||||
public DisplayUnitSelection DisplaySelection { get; set; } = DisplayUnitSelection.Default;
|
||||
|
|
|
|||
|
|
@ -178,7 +178,8 @@
|
|||
row.NumericValue,
|
||||
row.Value,
|
||||
row.Unit,
|
||||
DisplaySelection);
|
||||
DisplaySelection,
|
||||
row.Quality);
|
||||
<tr data-module="@row.ModuleIdentifier" data-signal="@row.SignalIdentifier">
|
||||
<td>@row.ModuleIdentifier</td>
|
||||
<td>@row.SignalIdentifier</td>
|
||||
|
|
|
|||
|
|
@ -9,6 +9,7 @@ using AutoForge.Core.ExecutionTargets;
|
|||
using AutoForge.Core.Simulation;
|
||||
using AutoForge.Core.Vehicles;
|
||||
using AutoForge.Diagnostics;
|
||||
using AutoForge.UI.Features.DisplayUnits;
|
||||
|
||||
namespace AutoForge.UI.Features.Vehicles.Simulation;
|
||||
|
||||
|
|
@ -342,7 +343,7 @@ public sealed class SimulationPageViewModel(
|
|||
rows.AddRange(snapshot.Signals.Select(signal => new DynamicsTelemetryRow(
|
||||
signal.ModuleIdentifier,
|
||||
signal.SignalIdentifier,
|
||||
signal.Value.ToString(),
|
||||
DisplayUnitPresentation.FormatSourceValue(signal.Value),
|
||||
signal.Unit,
|
||||
signal.Quality,
|
||||
signal.Origin,
|
||||
|
|
|
|||
|
|
@ -14,14 +14,16 @@
|
|||
</nav>
|
||||
<section aria-label="Display units">
|
||||
<label for="display-unit-system">Unit system</label>
|
||||
<select id="display-unit-system" value="@DisplayUnits.Selection.UnitSystem"
|
||||
@onchange="OnUnitSystemChanged">
|
||||
<select id="display-unit-system"
|
||||
@bind:get="DisplayUnits.Selection.UnitSystem"
|
||||
@bind:set="SetUnitSystem">
|
||||
<option value="ImperialUS">Imperial (US)</option>
|
||||
<option value="Metric">Metric</option>
|
||||
</select>
|
||||
<label for="display-speed-mode">Speed presentation</label>
|
||||
<select id="display-speed-mode" value="@DisplayUnits.Selection.SpeedMode"
|
||||
@onchange="OnSpeedModeChanged">
|
||||
<select id="display-speed-mode"
|
||||
@bind:get="DisplayUnits.Selection.SpeedMode"
|
||||
@bind:set="SetSpeedMode">
|
||||
<option value="Road">Road</option>
|
||||
<option value="Engineering">Engineering</option>
|
||||
</select>
|
||||
|
|
@ -67,27 +69,11 @@
|
|||
DisplayUnits.Initialize();
|
||||
}
|
||||
|
||||
private void OnUnitSystemChanged(ChangeEventArgs args)
|
||||
{
|
||||
if (Enum.TryParse<AutoForge.Application.Features.DisplayUnits.DisplayUnitSystem>(
|
||||
args.Value?.ToString(),
|
||||
out var unitSystem) &&
|
||||
Enum.IsDefined(unitSystem))
|
||||
{
|
||||
DisplayUnits.TrySet(DisplayUnits.Selection with { UnitSystem = unitSystem });
|
||||
}
|
||||
}
|
||||
private void SetUnitSystem(AutoForge.Application.Features.DisplayUnits.DisplayUnitSystem value) =>
|
||||
DisplayUnits.TrySet(DisplayUnits.Selection with { UnitSystem = value });
|
||||
|
||||
private void OnSpeedModeChanged(ChangeEventArgs args)
|
||||
{
|
||||
if (Enum.TryParse<AutoForge.Application.Features.DisplayUnits.SpeedDisplayMode>(
|
||||
args.Value?.ToString(),
|
||||
out var speedMode) &&
|
||||
Enum.IsDefined(speedMode))
|
||||
{
|
||||
DisplayUnits.TrySet(DisplayUnits.Selection with { SpeedMode = speedMode });
|
||||
}
|
||||
}
|
||||
private void SetSpeedMode(AutoForge.Application.Features.DisplayUnits.SpeedDisplayMode value) =>
|
||||
DisplayUnits.TrySet(DisplayUnits.Selection with { SpeedMode = value });
|
||||
|
||||
private void OnDisplayUnitsChanged() => _ = InvokeAsync(() =>
|
||||
{
|
||||
|
|
|
|||
|
|
@ -72,6 +72,58 @@ public sealed class DiagnosticUiCompositionTests
|
|||
Assert.Contains("closed; its isolated virtual state and trace are released", diagnostics.StatusMessage);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public async Task DiagnosticRoute_RendersNullWrongTypeUnknownAndUnsupportedStaticV1SignalsTruthfully()
|
||||
{
|
||||
using var nullDocument = System.Text.Json.JsonDocument.Parse("null");
|
||||
using var invalidDocument = System.Text.Json.JsonDocument.Parse("\"fast\"");
|
||||
using var unknownDocument = System.Text.Json.JsonDocument.Parse("72");
|
||||
using var textDocument = System.Text.Json.JsonDocument.Parse("\"ready\"");
|
||||
using var zeroDocument = System.Text.Json.JsonDocument.Parse("0");
|
||||
using var falseDocument = System.Text.Json.JsonDocument.Parse("false");
|
||||
var additionalSignals = new[]
|
||||
{
|
||||
new VirtualSignalDefinition("test.null-speed", nullDocument.RootElement, "m/s"),
|
||||
new VirtualSignalDefinition("test.wrong-speed-type", invalidDocument.RootElement, "m/s"),
|
||||
new VirtualSignalDefinition("test.unknown-quality-speed", unknownDocument.RootElement, "m/s", SignalQuality.Unknown),
|
||||
new VirtualSignalDefinition("test.unsupported-state", textDocument.RootElement, "vendor-state"),
|
||||
new VirtualSignalDefinition("test.zero-speed", zeroDocument.RootElement, "m/s"),
|
||||
new VirtualSignalDefinition("test.boolean-false", falseDocument.RootElement, "boolean")
|
||||
};
|
||||
var definitions = WithSignals(
|
||||
SyntheticDiagnosticExamples.CreateDefinitions(),
|
||||
"module.engine.primary",
|
||||
additionalSignals);
|
||||
using var provider = CreateProvider(
|
||||
"http://localhost/diagnostics",
|
||||
new SimulatedDiagnosticTransportFactory(definitions));
|
||||
provider.GetRequiredService<IVehicleProfileService>().Import(ReadFixture("synthetic-truck-baseline.json"));
|
||||
var diagnostics = provider.GetRequiredService<DiagnosticPageViewModel>();
|
||||
SelectTruck(diagnostics);
|
||||
|
||||
await diagnostics.OpenSessionAsync();
|
||||
await diagnostics.DiscoverAsync();
|
||||
await diagnostics.ReadModuleAsync("module.engine.primary");
|
||||
|
||||
var html = await RenderRoutesAsync(provider);
|
||||
|
||||
Assert.Contains("Display -- m/s (Good)", SignalRow(html, "test.null-speed"));
|
||||
var nullSpeedRow = SignalRow(html, "test.null-speed");
|
||||
Assert.True(nullSpeedRow.Contains("source null m/s", StringComparison.OrdinalIgnoreCase), nullSpeedRow);
|
||||
Assert.Contains("missing or null", SignalRow(html, "test.null-speed"));
|
||||
Assert.Contains("Display -- m/s (Good)", SignalRow(html, "test.wrong-speed-type"));
|
||||
Assert.Contains("source fast m/s", SignalRow(html, "test.wrong-speed-type"));
|
||||
Assert.Contains("non-numeric", SignalRow(html, "test.wrong-speed-type"));
|
||||
Assert.Contains("Display -- m/s (Unknown)", SignalRow(html, "test.unknown-quality-speed"));
|
||||
Assert.Contains("source 72 m/s", SignalRow(html, "test.unknown-quality-speed"));
|
||||
Assert.Contains("source quality is Unknown", SignalRow(html, "test.unknown-quality-speed"));
|
||||
Assert.Contains("Display ready vendor-state (Good)", SignalRow(html, "test.unsupported-state"));
|
||||
Assert.Contains("not in the supported display mapping", SignalRow(html, "test.unsupported-state"));
|
||||
Assert.Contains("Display 0.000 mph (Good)", SignalRow(html, "test.zero-speed"));
|
||||
Assert.Contains("Display false boolean (Good)", SignalRow(html, "test.boolean-false"));
|
||||
Assert.Contains("source false boolean", SignalRow(html, "test.boolean-false"));
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public async Task DiagnosticDashboard_FirstStartAfterManualReadsUsesTheSameSessionsBindings()
|
||||
{
|
||||
|
|
@ -368,6 +420,19 @@ public sealed class DiagnosticUiCompositionTests
|
|||
? module.ImplementedServices.Where(candidate => !StringComparer.Ordinal.Equals(candidate, service)).ToArray()
|
||||
: module.ImplementedServices)))).ToArray());
|
||||
|
||||
private static IReadOnlyList<SimulationDefinition> WithSignals(
|
||||
IReadOnlyList<SimulationDefinition> definitions,
|
||||
string moduleIdentifier,
|
||||
IEnumerable<VirtualSignalDefinition> additionalSignals) =>
|
||||
Array.AsReadOnly(definitions.Select(definition => new SimulationDefinition(
|
||||
definition.ProfileIdentifier,
|
||||
definition.ProfileRevision,
|
||||
definition.Modules.Select(module => CopyModule(
|
||||
module,
|
||||
signals: StringComparer.OrdinalIgnoreCase.Equals(module.ModuleIdentifier, moduleIdentifier)
|
||||
? module.Signals.Concat(additionalSignals).ToArray()
|
||||
: module.Signals)))).ToArray());
|
||||
|
||||
private static IReadOnlyList<SimulationDefinition> WithLatency(
|
||||
IReadOnlyList<SimulationDefinition> definitions,
|
||||
string moduleIdentifier,
|
||||
|
|
@ -385,17 +450,27 @@ public sealed class DiagnosticUiCompositionTests
|
|||
VirtualModuleDefinition module,
|
||||
IReadOnlyDictionary<string, SimulatedFault>? faults = null,
|
||||
long? responseLatencyTicks = null,
|
||||
IEnumerable<string>? services = null) =>
|
||||
IEnumerable<string>? services = null,
|
||||
IEnumerable<VirtualSignalDefinition>? signals = null) =>
|
||||
new(
|
||||
module.ModuleIdentifier,
|
||||
module.Address,
|
||||
module.Identity,
|
||||
services ?? module.ImplementedServices,
|
||||
module.InitialTroubleCodes,
|
||||
module.Signals,
|
||||
signals ?? module.Signals,
|
||||
faults ?? module.Faults,
|
||||
responseLatencyTicks ?? module.ResponseLatencyTicks);
|
||||
|
||||
private static string SignalRow(string html, string signalIdentifier)
|
||||
{
|
||||
var start = html.IndexOf($"data-signal=\"{signalIdentifier}\"", StringComparison.Ordinal);
|
||||
Assert.True(start >= 0, $"Expected rendered signal '{signalIdentifier}'.");
|
||||
var end = html.IndexOf("</li>", start, StringComparison.Ordinal);
|
||||
Assert.True(end > start, $"Expected signal row end for '{signalIdentifier}'.");
|
||||
return html[start..end];
|
||||
}
|
||||
|
||||
private static string ReadFixture(string name) =>
|
||||
File.ReadAllText(Path.Combine(AppContext.BaseDirectory, "Fixtures", name));
|
||||
|
||||
|
|
|
|||
|
|
@ -0,0 +1,277 @@
|
|||
using AutoForge.Application.Features.DisplayUnits;
|
||||
using AutoForge.UI;
|
||||
using AutoForge.UI.Layout;
|
||||
using Microsoft.AspNetCore.Components;
|
||||
using Microsoft.AspNetCore.Components.Routing;
|
||||
using Microsoft.AspNetCore.Components.RenderTree;
|
||||
using Microsoft.AspNetCore.Components.Rendering;
|
||||
using Microsoft.AspNetCore.Components.Web;
|
||||
using Microsoft.Extensions.DependencyInjection;
|
||||
using Microsoft.Extensions.Logging;
|
||||
|
||||
#pragma warning disable BL0006
|
||||
|
||||
namespace AutoForge.IntegrationTests;
|
||||
|
||||
public sealed class DisplayUnitControlTests
|
||||
{
|
||||
[Theory]
|
||||
[InlineData("display-unit-system", "ImperialUS", "Metric", "Road", "72.420 km/h")]
|
||||
[InlineData("display-speed-mode", "Engineering", "Metric", "Road", "72.420 km/h")]
|
||||
public async Task RejectedSelectorEventReconcilesControlAndReadoutAndCanRetry(
|
||||
string selectorId,
|
||||
string proposedValue,
|
||||
string expectedUnitSystem,
|
||||
string expectedSpeedMode,
|
||||
string expectedReadout)
|
||||
{
|
||||
var store = new FaultingPreferenceStore("metric|road");
|
||||
using var services = CreateServices(store);
|
||||
var renderer = new EventTestRenderer(
|
||||
services,
|
||||
services.GetRequiredService<ILoggerFactory>());
|
||||
var componentId = renderer.Attach(new LayoutHost());
|
||||
var body = new RenderFragment(builder =>
|
||||
{
|
||||
builder.OpenComponent<DisplayReadout>(0);
|
||||
builder.CloseComponent();
|
||||
});
|
||||
var parameters = ParameterView.FromDictionary(
|
||||
new Dictionary<string, object?> { [nameof(LayoutComponentBase.Body)] = body });
|
||||
|
||||
await renderer.Dispatcher.InvokeAsync(() => renderer.RenderAsync(componentId, parameters));
|
||||
Assert.Equal("metric|road", store.Value);
|
||||
var initialValue = selectorId == "display-unit-system" ? "Metric" : "Road";
|
||||
Assert.Equal(initialValue, renderer.FindAttribute(componentId, selectorId, "value")?.ToString());
|
||||
|
||||
store.WriteFailure = true;
|
||||
await renderer.Dispatcher.InvokeAsync(() => renderer.FindEventCallback(
|
||||
componentId,
|
||||
selectorId,
|
||||
"onchange").InvokeAsync(new ChangeEventArgs { Value = proposedValue }));
|
||||
|
||||
Assert.Equal(1, store.WriteCount);
|
||||
Assert.Equal("metric|road", store.Value);
|
||||
var preference = services.GetRequiredService<DisplayUnitPreferenceService>();
|
||||
Assert.Equal(DisplayUnitPreferenceErrorKind.StoreUnavailable, preference.ErrorKind);
|
||||
Assert.Equal(new DisplayUnitSelection(DisplayUnitSystem.Metric, SpeedDisplayMode.Road), preference.Selection);
|
||||
Assert.True(preference.IsPersistedSelection);
|
||||
Assert.Contains("Could not save", preference.Error);
|
||||
Assert.Equal(expectedUnitSystem, renderer.FindAttribute(componentId, "display-unit-system", "value")?.ToString());
|
||||
Assert.Equal(expectedSpeedMode, renderer.FindAttribute(componentId, "display-speed-mode", "value")?.ToString());
|
||||
Assert.Contains(expectedReadout, renderer.FindElementText(componentId, "display-readout"));
|
||||
Assert.Equal(1, store.WriteCount);
|
||||
Assert.Equal("metric|road", store.Value);
|
||||
|
||||
store.WriteFailure = false;
|
||||
await renderer.Dispatcher.InvokeAsync(() => renderer.FindEventCallback(
|
||||
componentId,
|
||||
selectorId,
|
||||
"onchange").InvokeAsync(new ChangeEventArgs { Value = proposedValue }));
|
||||
|
||||
var expectedSelection = selectorId == "display-unit-system"
|
||||
? new DisplayUnitSelection(DisplayUnitSystem.ImperialUS, SpeedDisplayMode.Road)
|
||||
: new DisplayUnitSelection(DisplayUnitSystem.Metric, SpeedDisplayMode.Engineering);
|
||||
Assert.Equal(expectedSelection, preference.Selection);
|
||||
Assert.True(preference.IsPersistedSelection);
|
||||
Assert.Equal(DisplayUnitPreferenceErrorKind.None, preference.ErrorKind);
|
||||
Assert.Null(preference.Error);
|
||||
Assert.Equal(proposedValue, renderer.FindAttribute(componentId, selectorId, "value")?.ToString());
|
||||
Assert.Equal(2, store.WriteCount);
|
||||
Assert.Equal(DisplayUnitPreferenceService.Serialize(expectedSelection), store.Value);
|
||||
var expectedSuccessfulReadout = selectorId == "display-unit-system"
|
||||
? "45.000 mph"
|
||||
: "20.117 m/s";
|
||||
Assert.Contains(expectedSuccessfulReadout, renderer.FindElementText(componentId, "display-readout"));
|
||||
}
|
||||
|
||||
private static ServiceProvider CreateServices(FaultingPreferenceStore store)
|
||||
{
|
||||
var services = new ServiceCollection();
|
||||
services.AddLogging();
|
||||
services.AddAutoForgeUi();
|
||||
services.AddSingleton<IDisplayUnitPreferenceStore>(store);
|
||||
services.AddSingleton<NavigationManager>(new TestNavigationManager());
|
||||
services.AddSingleton<INavigationInterception, TestNavigationInterception>();
|
||||
services.AddSingleton<IScrollToLocationHash, TestScrollToLocationHash>();
|
||||
return services.BuildServiceProvider();
|
||||
}
|
||||
|
||||
private sealed class DisplayReadout : ComponentBase
|
||||
{
|
||||
[CascadingParameter]
|
||||
public DisplayUnitSelection Selection { get; set; }
|
||||
|
||||
protected override void BuildRenderTree(RenderTreeBuilder builder)
|
||||
{
|
||||
var measurement = DisplayUnitConverter.Project(20.1168, "m/s", Selection);
|
||||
builder.OpenElement(0, "span");
|
||||
builder.AddAttribute(1, "id", "display-readout");
|
||||
builder.AddContent(2, $"{DisplayUnitConverter.Format(measurement, 3)} {measurement.Unit}");
|
||||
builder.CloseElement();
|
||||
}
|
||||
}
|
||||
|
||||
private sealed class LayoutHost : ComponentBase
|
||||
{
|
||||
[Parameter]
|
||||
public RenderFragment? Body { get; set; }
|
||||
|
||||
protected override void BuildRenderTree(RenderTreeBuilder builder)
|
||||
{
|
||||
builder.OpenComponent<MainLayout>(0);
|
||||
builder.AddAttribute(1, nameof(LayoutComponentBase.Body), Body);
|
||||
builder.CloseComponent();
|
||||
}
|
||||
}
|
||||
|
||||
private sealed class EventTestRenderer(IServiceProvider services, ILoggerFactory loggerFactory)
|
||||
: Renderer(services, loggerFactory)
|
||||
{
|
||||
public override Dispatcher Dispatcher { get; } = Dispatcher.CreateDefault();
|
||||
|
||||
public int Attach(IComponent component) => AssignRootComponentId(component);
|
||||
|
||||
public Task RenderAsync(int componentId, ParameterView parameters) =>
|
||||
RenderRootComponentAsync(componentId, parameters);
|
||||
|
||||
public object? FindAttribute(int componentId, string elementId, string attributeName) =>
|
||||
FindNode(componentId, elementId, attributeName)?.Attribute;
|
||||
|
||||
public EventCallback FindEventCallback(
|
||||
int componentId,
|
||||
string elementId,
|
||||
string attributeName)
|
||||
{
|
||||
var result = FindNode(componentId, elementId, attributeName);
|
||||
return result?.EventCallback is EventCallback callback
|
||||
? callback
|
||||
: throw new InvalidOperationException(
|
||||
$"Event callback '{attributeName}' for '{elementId}' was not rendered; value type {result?.Attribute?.GetType().FullName ?? "<null>"}.");
|
||||
}
|
||||
|
||||
public string FindElementText(int componentId, string elementId) =>
|
||||
FindNode(componentId, elementId, null)?.Text ??
|
||||
throw new InvalidOperationException($"Element '{elementId}' was not rendered.");
|
||||
|
||||
protected override void HandleException(Exception exception) =>
|
||||
throw new InvalidOperationException("The test component renderer failed.", exception);
|
||||
|
||||
protected override Task UpdateDisplayAsync(in RenderBatch renderBatch) => Task.CompletedTask;
|
||||
|
||||
private NodeResult? FindNode(int componentId, string elementId, string? targetAttribute)
|
||||
{
|
||||
var frames = GetCurrentRenderTreeFrames(componentId);
|
||||
for (var index = 0; index < frames.Count; index++)
|
||||
{
|
||||
var frame = frames.Array[index];
|
||||
if (frame.FrameType == RenderTreeFrameType.Component)
|
||||
{
|
||||
var nested = FindNode(frame.ComponentId, elementId, targetAttribute);
|
||||
if (nested is not null)
|
||||
{
|
||||
return nested;
|
||||
}
|
||||
|
||||
continue;
|
||||
}
|
||||
|
||||
if (frame.FrameType != RenderTreeFrameType.Element)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
var subtreeEnd = index + frame.ElementSubtreeLength;
|
||||
var foundId = false;
|
||||
object? attribute = null;
|
||||
object? eventCallback = null;
|
||||
var text = new System.Text.StringBuilder();
|
||||
var attributeIndex = index + 1;
|
||||
while (attributeIndex < subtreeEnd &&
|
||||
frames.Array[attributeIndex].FrameType == RenderTreeFrameType.Attribute)
|
||||
{
|
||||
var attributeFrame = frames.Array[attributeIndex];
|
||||
if (attributeFrame.AttributeName == "id" &&
|
||||
StringComparer.Ordinal.Equals(attributeFrame.AttributeValue?.ToString(), elementId))
|
||||
{
|
||||
foundId = true;
|
||||
}
|
||||
|
||||
if (foundId && attributeFrame.AttributeName == targetAttribute)
|
||||
{
|
||||
attribute = attributeFrame.AttributeValue;
|
||||
eventCallback = attributeFrame.AttributeValue;
|
||||
}
|
||||
|
||||
attributeIndex++;
|
||||
}
|
||||
|
||||
if (foundId)
|
||||
{
|
||||
for (var nestedIndex = attributeIndex; nestedIndex < subtreeEnd; nestedIndex++)
|
||||
{
|
||||
if (frames.Array[nestedIndex].FrameType == RenderTreeFrameType.Text)
|
||||
{
|
||||
text.Append(frames.Array[nestedIndex].TextContent);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (foundId)
|
||||
{
|
||||
return new NodeResult(attribute, eventCallback, text.ToString());
|
||||
}
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
private sealed record NodeResult(object? Attribute, object? EventCallback, string Text);
|
||||
}
|
||||
|
||||
private sealed class FaultingPreferenceStore(string? value) : IDisplayUnitPreferenceStore
|
||||
{
|
||||
public string? Value { get; private set; } = value;
|
||||
public bool WriteFailure { get; set; }
|
||||
public int WriteCount { get; private set; }
|
||||
|
||||
public string? Read() => Value;
|
||||
|
||||
public void Write(string preference)
|
||||
{
|
||||
WriteCount++;
|
||||
if (WriteFailure)
|
||||
{
|
||||
throw new InvalidOperationException("controlled write failure");
|
||||
}
|
||||
|
||||
Value = preference;
|
||||
}
|
||||
}
|
||||
|
||||
private sealed class TestNavigationManager : NavigationManager
|
||||
{
|
||||
public TestNavigationManager()
|
||||
{
|
||||
Initialize("http://localhost/", "http://localhost/");
|
||||
}
|
||||
|
||||
protected override void NavigateToCore(string uri, bool forceLoad)
|
||||
{
|
||||
Uri = ToAbsoluteUri(uri).ToString();
|
||||
NotifyLocationChanged(forceLoad);
|
||||
}
|
||||
}
|
||||
|
||||
private sealed class TestNavigationInterception : INavigationInterception
|
||||
{
|
||||
public Task EnableNavigationInterceptionAsync() => Task.CompletedTask;
|
||||
}
|
||||
|
||||
private sealed class TestScrollToLocationHash : IScrollToLocationHash
|
||||
{
|
||||
public Task RefreshScrollPositionForHash(string locationAbsolute) => Task.CompletedTask;
|
||||
}
|
||||
}
|
||||
|
||||
#pragma warning restore BL0006
|
||||
|
|
@ -0,0 +1,127 @@
|
|||
using System.Text.Json;
|
||||
using AutoForge.Application.Features.DisplayUnits;
|
||||
using AutoForge.Diagnostics;
|
||||
using AutoForge.UI.Features.DisplayUnits;
|
||||
|
||||
namespace AutoForge.IntegrationTests;
|
||||
|
||||
public sealed class DisplayUnitPresentationTests
|
||||
{
|
||||
[Fact]
|
||||
public void FormatSourceValue_PreservesJsonNullAndBooleanLexicalValues()
|
||||
{
|
||||
using var nullDocument = JsonDocument.Parse("null");
|
||||
using var falseDocument = JsonDocument.Parse("false");
|
||||
|
||||
Assert.Equal("null", DisplayUnitPresentation.FormatSourceValue(nullDocument.RootElement));
|
||||
Assert.Equal("false", DisplayUnitPresentation.FormatSourceValue(falseDocument.RootElement));
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void Project_NullKnownNumericMeasurementIsUnavailable()
|
||||
{
|
||||
var result = DisplayUnitPresentation.Project(
|
||||
(double?)null,
|
||||
"null",
|
||||
"m/s",
|
||||
DisplayUnitSelection.Default);
|
||||
|
||||
Assert.Equal("--", result.Value);
|
||||
Assert.NotNull(result.Error);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void Project_NonNumericKnownQuantityIsUnavailableAndNotEchoed()
|
||||
{
|
||||
using var document = JsonDocument.Parse("\"not a number\"");
|
||||
|
||||
var result = DisplayUnitPresentation.Project(
|
||||
document.RootElement,
|
||||
"m/s",
|
||||
DisplayUnitSelection.Default);
|
||||
|
||||
Assert.Equal("--", result.Value);
|
||||
Assert.NotNull(result.Error);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void Project_UnknownUnitTextIsRetainedWithAnExplicitNotice()
|
||||
{
|
||||
using var document = JsonDocument.Parse("\"ready\"");
|
||||
|
||||
var result = DisplayUnitPresentation.Project(
|
||||
document.RootElement,
|
||||
"vendor-state",
|
||||
DisplayUnitSelection.Default);
|
||||
|
||||
Assert.Equal("ready", result.Value);
|
||||
Assert.Equal("vendor-state", result.Unit);
|
||||
Assert.NotNull(result.Notice);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void Project_UnknownQualityDoesNotPresentNumericValueAsCurrent()
|
||||
{
|
||||
using var document = JsonDocument.Parse("72");
|
||||
|
||||
var result = DisplayUnitPresentation.Project(
|
||||
document.RootElement,
|
||||
"m/s",
|
||||
DisplayUnitSelection.Default,
|
||||
SignalQuality.Unknown);
|
||||
|
||||
Assert.Equal("--", result.Value);
|
||||
Assert.Contains("Unknown", result.Notice);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void Project_ValidZeroAndFalseRemainDistinctValues()
|
||||
{
|
||||
using var zeroDocument = JsonDocument.Parse("0");
|
||||
using var falseDocument = JsonDocument.Parse("false");
|
||||
|
||||
var zero = DisplayUnitPresentation.Project(
|
||||
zeroDocument.RootElement,
|
||||
"m/s",
|
||||
DisplayUnitSelection.Default);
|
||||
var boolean = DisplayUnitPresentation.Project(
|
||||
falseDocument.RootElement,
|
||||
"boolean",
|
||||
DisplayUnitSelection.Default);
|
||||
|
||||
Assert.Equal("0.000", zero.Value);
|
||||
Assert.Equal("false", boolean.Value);
|
||||
Assert.Null(zero.Error);
|
||||
Assert.Null(boolean.Error);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void Project_UncertainNumericRetainsValueAndQualityNotice()
|
||||
{
|
||||
using var document = JsonDocument.Parse("0");
|
||||
|
||||
var result = DisplayUnitPresentation.Project(
|
||||
document.RootElement,
|
||||
"m/s",
|
||||
DisplayUnitSelection.Default,
|
||||
SignalQuality.Uncertain);
|
||||
|
||||
Assert.Equal("0.000", result.Value);
|
||||
Assert.Contains("Uncertain", result.Notice);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void Project_UnsupportedNumericPreservesRawTextAndUnitWithNotice()
|
||||
{
|
||||
using var document = JsonDocument.Parse("12.5000");
|
||||
|
||||
var result = DisplayUnitPresentation.Project(
|
||||
document.RootElement,
|
||||
"vendor-count",
|
||||
DisplayUnitSelection.Default);
|
||||
|
||||
Assert.Equal("12.5000", result.Value);
|
||||
Assert.Equal("vendor-count", result.Unit);
|
||||
Assert.NotNull(result.Notice);
|
||||
}
|
||||
}
|
||||
|
|
@ -155,6 +155,86 @@ public sealed class DynamicsWorkflowTests
|
|||
}
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public async Task FailedDisplayPreferenceWritesLeavePausedDynamicsAndFeedUnchanged()
|
||||
{
|
||||
var store = new FaultingDisplayUnitPreferenceStore("metric|road");
|
||||
using var provider = CreateProvider(
|
||||
dashboardScheduler: new NoPollDashboardScheduler(),
|
||||
displayUnitPreferenceStore: store);
|
||||
provider.GetRequiredService<IVehicleProfileService>().Import(ReadFixture("synthetic-truck-baseline.json"));
|
||||
var configurations = provider.GetRequiredService<IDynamicsConfigurationService>();
|
||||
var configuration = configurations.CreateExample("autoforge.synthetic.test-truck", 1);
|
||||
var page = provider.GetRequiredService<SimulationPageViewModel>();
|
||||
page.SelectedProfileIdentifier = configuration.ProfileIdentifier;
|
||||
page.SelectedProfileRevision = configuration.ProfileRevision;
|
||||
page.SelectedProviderIdentifier = DynamicsDiagnosticTransportFactory.ProviderIdentifier;
|
||||
page.SelectedConfigurationIdentifier = configuration.ConfigurationIdentifier;
|
||||
|
||||
await page.OpenSessionAsync();
|
||||
var session = Assert.IsType<DiagnosticSession>(page.ActiveSession);
|
||||
try
|
||||
{
|
||||
await page.StartAsync();
|
||||
await page.PauseAsync();
|
||||
var feed = provider.GetRequiredService<ILiveDashboardFeedFactory>().Create(session);
|
||||
await feed.StartAsync();
|
||||
var speed = Assert.Single(feed.Snapshot.AvailableSignals, signal =>
|
||||
signal.ModuleIdentifier == "module.engine.primary" &&
|
||||
signal.SignalIdentifier == "vehicle.speed" &&
|
||||
signal.Unit == "m/s");
|
||||
feed.ReplaceDefinitions(
|
||||
[
|
||||
new DashboardGaugeDefinition(
|
||||
"display-speed",
|
||||
"Vehicle speed",
|
||||
DashboardGaugeKind.HorizontalBar,
|
||||
speed.ModuleIdentifier,
|
||||
speed.SignalIdentifier,
|
||||
speed.Unit,
|
||||
0,
|
||||
40.2336,
|
||||
2)
|
||||
]);
|
||||
|
||||
var preference = provider.GetRequiredService<DisplayUnitPreferenceService>();
|
||||
preference.Initialize();
|
||||
var beforeSelection = preference.Selection;
|
||||
var beforeStatus = session.DynamicsControl!.Status;
|
||||
var beforeValues = feed.Snapshot.Values.ToArray();
|
||||
var beforeDefinitions = feed.Snapshot.Definitions.ToArray();
|
||||
var beforeTrace = session.Trace.Entries.ToArray();
|
||||
var beforeReadCount = CountSignalReads(session);
|
||||
var beforeConfiguration = configurations.Export(configuration.ConfigurationIdentifier);
|
||||
store.WriteFailure = true;
|
||||
|
||||
Assert.False(preference.TrySet(beforeSelection with { UnitSystem = DisplayUnitSystem.ImperialUS }));
|
||||
Assert.False(preference.TrySet(beforeSelection with { SpeedMode = SpeedDisplayMode.Engineering }));
|
||||
|
||||
Assert.Equal(beforeSelection, preference.Selection);
|
||||
Assert.True(preference.IsPersistedSelection);
|
||||
Assert.Equal(DisplayUnitPreferenceErrorKind.StoreUnavailable, preference.ErrorKind);
|
||||
Assert.Contains("Could not save", preference.Error);
|
||||
Assert.Equal(2, store.WriteCount);
|
||||
Assert.Equal("metric|road", store.Value);
|
||||
Assert.Equal(beforeStatus, session.DynamicsControl.Status);
|
||||
Assert.Equal(beforeValues, feed.Snapshot.Values);
|
||||
Assert.Equal(beforeDefinitions, feed.Snapshot.Definitions);
|
||||
Assert.Equal(beforeTrace, session.Trace.Entries);
|
||||
Assert.Equal(beforeReadCount, CountSignalReads(session));
|
||||
Assert.Equal(beforeConfiguration, configurations.Export(configuration.ConfigurationIdentifier));
|
||||
|
||||
await feed.StopAsync();
|
||||
}
|
||||
finally
|
||||
{
|
||||
if (page.ActiveSession is not null)
|
||||
{
|
||||
await page.CloseSessionAsync();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public async Task RealApplicationAndRenderedRoute_RunAndReadDynamicTelemetryWithoutOracle()
|
||||
{
|
||||
|
|
@ -575,7 +655,8 @@ public sealed class DynamicsWorkflowTests
|
|||
private static ServiceProvider CreateProvider(
|
||||
IDynamicsPacer? pacer = null,
|
||||
BlockingDynamicsOpen? openGate = null,
|
||||
ILiveDashboardPollScheduler? dashboardScheduler = null)
|
||||
ILiveDashboardPollScheduler? dashboardScheduler = null,
|
||||
IDisplayUnitPreferenceStore? displayUnitPreferenceStore = null)
|
||||
{
|
||||
var services = new ServiceCollection();
|
||||
services.AddLogging();
|
||||
|
|
@ -607,7 +688,8 @@ public sealed class DynamicsWorkflowTests
|
|||
}
|
||||
|
||||
services.AddAutoForgeUi();
|
||||
services.AddSingleton<AutoForge.Application.Features.DisplayUnits.IDisplayUnitPreferenceStore, IsolatedDisplayUnitPreferenceStore>();
|
||||
services.AddSingleton(
|
||||
displayUnitPreferenceStore ?? new IsolatedDisplayUnitPreferenceStore());
|
||||
services.AddSingleton<NavigationManager>(new TestNavigationManager("http://localhost/simulation"));
|
||||
services.AddSingleton<INavigationInterception, TestNavigationInterception>();
|
||||
services.AddSingleton<IScrollToLocationHash, TestScrollToLocationHash>();
|
||||
|
|
@ -617,6 +699,26 @@ public sealed class DynamicsWorkflowTests
|
|||
private static int CountSignalReads(DiagnosticSession session) =>
|
||||
session.Trace.Entries.Count(entry => entry.Service == DiagnosticServices.ReadSignals);
|
||||
|
||||
private sealed class FaultingDisplayUnitPreferenceStore(string? value) : IDisplayUnitPreferenceStore
|
||||
{
|
||||
public string? Value { get; private set; } = value;
|
||||
public bool WriteFailure { get; set; }
|
||||
public int WriteCount { get; private set; }
|
||||
|
||||
public string? Read() => Value;
|
||||
|
||||
public void Write(string preference)
|
||||
{
|
||||
WriteCount++;
|
||||
if (WriteFailure)
|
||||
{
|
||||
throw new InvalidOperationException("controlled display-preference write failure");
|
||||
}
|
||||
|
||||
Value = preference;
|
||||
}
|
||||
}
|
||||
|
||||
private sealed class NoPollDashboardScheduler : ILiveDashboardPollScheduler
|
||||
{
|
||||
public Task WaitAsync(TimeSpan interval, CancellationToken cancellationToken) =>
|
||||
|
|
|
|||
|
|
@ -2,6 +2,7 @@ using System.Text.Json;
|
|||
using System.Text;
|
||||
using System.Text.Json.Nodes;
|
||||
using System.Threading.Channels;
|
||||
using AutoForge.Application.Features.DisplayUnits;
|
||||
using AutoForge.Application.Features.Vehicles.Diagnostics;
|
||||
using AutoForge.Application.Features.Vehicles.Profiles;
|
||||
using AutoForge.Application.Features.Vehicles.Simulation;
|
||||
|
|
@ -14,6 +15,7 @@ using AutoForge.UI;
|
|||
using AutoForge.UI.Features.Vehicles.Telemetry.LiveDashboard;
|
||||
using Microsoft.AspNetCore.Components;
|
||||
using Microsoft.AspNetCore.Components.Web;
|
||||
using Microsoft.AspNetCore.Components.Rendering;
|
||||
using Microsoft.Extensions.DependencyInjection;
|
||||
using Microsoft.Extensions.Logging;
|
||||
|
||||
|
|
@ -21,6 +23,166 @@ namespace AutoForge.IntegrationTests;
|
|||
|
||||
public sealed class LiveDashboardAcquisitionTests
|
||||
{
|
||||
[Fact]
|
||||
public async Task DisplayProjectionPreservesConvertedUncertainStaleStoppedAndUnavailableStates()
|
||||
{
|
||||
var scheduler = new ControlledDashboardScheduler();
|
||||
var mode = 0;
|
||||
var simulation = new SimulatedDiagnosticTransportFactory(SyntheticDiagnosticExamples.CreateDefinitions());
|
||||
var rewriting = new RewritingDiagnosticTransportFactory(
|
||||
simulation,
|
||||
async (transport, request, payload, cancellationToken) =>
|
||||
{
|
||||
if (request.Service != DiagnosticServices.ReadSignals ||
|
||||
!StringComparer.OrdinalIgnoreCase.Equals(request.TargetAddress, "10"))
|
||||
{
|
||||
return await transport.SendAsync(payload, cancellationToken);
|
||||
}
|
||||
|
||||
if (mode == 2)
|
||||
{
|
||||
return new TransportReply(
|
||||
TransportOutcome.NoResponse,
|
||||
ReadOnlyMemory<byte>.Empty,
|
||||
0,
|
||||
"controlled signal read failure");
|
||||
}
|
||||
|
||||
var response = await transport.SendAsync(payload, cancellationToken);
|
||||
var envelope = JsonNode.Parse(response.Payload.ToArray())!.AsObject();
|
||||
var speed = envelope["data"]!["signals"]!.AsArray().Single(item =>
|
||||
item!["signalIdentifier"]!.GetValue<string>() == "synthetic.engine.speed")!;
|
||||
speed["unit"] = "m/s";
|
||||
speed["value"] = mode == 3 ? 1e308 : 10;
|
||||
speed["quality"] = mode is 1 or 3 ? "Uncertain" : "Good";
|
||||
return new TransportReply(
|
||||
response.Outcome,
|
||||
Encoding.UTF8.GetBytes(envelope.ToJsonString()),
|
||||
response.ElapsedTicks,
|
||||
response.Detail);
|
||||
});
|
||||
using var provider = CreateProvider(scheduler, rewriting);
|
||||
await using var session = await OpenStaticSessionAsync(provider);
|
||||
var feed = provider.GetRequiredService<ILiveDashboardFeedFactory>().Create(session);
|
||||
await feed.StartAsync();
|
||||
var binding = Assert.Single(feed.Snapshot.AvailableSignals, item =>
|
||||
item.ModuleIdentifier == "module.engine.primary" &&
|
||||
item.SignalIdentifier == "synthetic.engine.speed");
|
||||
Assert.Equal("m/s", binding.Unit);
|
||||
feed.ReplaceDefinitions(
|
||||
[
|
||||
new DashboardGaugeDefinition(
|
||||
"speed",
|
||||
"Speed",
|
||||
DashboardGaugeKind.HorizontalBar,
|
||||
binding.ModuleIdentifier,
|
||||
binding.SignalIdentifier,
|
||||
binding.Unit,
|
||||
0,
|
||||
20,
|
||||
1)
|
||||
]);
|
||||
var initial = Assert.Single(feed.Snapshot.Values);
|
||||
Assert.Equal(DashboardReadingState.Good, initial.State);
|
||||
Assert.Equal(10d, initial.NumericValue);
|
||||
var initialSignal = initial.Signal!;
|
||||
var poll = await scheduler.NextWaitAsync();
|
||||
|
||||
async Task AdvanceAsync(int nextMode)
|
||||
{
|
||||
mode = nextMode;
|
||||
poll.TrySetResult();
|
||||
poll = await scheduler.NextWaitAsync();
|
||||
}
|
||||
|
||||
await AdvanceAsync(1);
|
||||
var uncertain = Assert.Single(feed.Snapshot.Values);
|
||||
Assert.Equal(DashboardReadingState.Uncertain, uncertain.State);
|
||||
Assert.Equal(DashboardReadingState.Good, uncertain.RangeState);
|
||||
Assert.Equal(10d, uncertain.NumericValue);
|
||||
Assert.True(uncertain.Signal!.LogicalTimeTicks > initialSignal.LogicalTimeTicks);
|
||||
Assert.Contains("Uncertain", uncertain.Reason);
|
||||
var metricDisplay = DisplayUnitConverter.Project(
|
||||
uncertain.NumericValue!.Value,
|
||||
uncertain.Definition.Unit,
|
||||
new DisplayUnitSelection(DisplayUnitSystem.Metric, SpeedDisplayMode.Road));
|
||||
Assert.Equal("km/h", metricDisplay.Unit);
|
||||
Assert.Equal(36d, metricDisplay.Value);
|
||||
var uncertainHtml = await RenderDashboardAsync(
|
||||
provider,
|
||||
session,
|
||||
new DisplayUnitSelection(DisplayUnitSystem.Metric, SpeedDisplayMode.Road));
|
||||
var uncertainMarkup = GetGaugeMarkup(uncertainHtml, "speed");
|
||||
Assert.Contains("36.0 km/h", uncertainMarkup);
|
||||
Assert.Contains("data-state=\"uncertain\"", uncertainMarkup);
|
||||
Assert.Contains("Uncertain", uncertainMarkup);
|
||||
|
||||
await AdvanceAsync(2);
|
||||
var stale = Assert.Single(feed.Snapshot.Values);
|
||||
Assert.Equal(DashboardReadingState.Stale, stale.State);
|
||||
Assert.Equal(10d, stale.NumericValue);
|
||||
Assert.Equal(initialSignal.LogicalTimeTicks, stale.Signal!.LogicalTimeTicks);
|
||||
Assert.Contains("controlled signal read failure", stale.Reason);
|
||||
var imperialDisplay = DisplayUnitConverter.Project(
|
||||
stale.NumericValue!.Value,
|
||||
stale.Definition.Unit,
|
||||
DisplayUnitSelection.Default);
|
||||
Assert.Equal("mph", imperialDisplay.Unit);
|
||||
Assert.InRange(Math.Abs(imperialDisplay.Value!.Value - 22.369362920544024), 0, 1e-9);
|
||||
var staleHtml = await RenderDashboardAsync(provider, session, DisplayUnitSelection.Default);
|
||||
var staleMarkup = GetGaugeMarkup(staleHtml, "speed");
|
||||
Assert.Contains("22.4 mph", staleMarkup);
|
||||
Assert.Contains("data-state=\"stale\"", staleMarkup);
|
||||
Assert.Contains("controlled signal read failure", staleMarkup);
|
||||
|
||||
await AdvanceAsync(3);
|
||||
var unavailable = Assert.Single(feed.Snapshot.Values);
|
||||
Assert.Equal(DashboardReadingState.Uncertain, unavailable.State);
|
||||
Assert.Equal(DashboardReadingState.OutOfRangeHigh, unavailable.RangeState);
|
||||
Assert.Equal(1e308, unavailable.NumericValue);
|
||||
var failedProjection = DisplayUnitConverter.Project(
|
||||
unavailable.NumericValue!.Value,
|
||||
unavailable.Definition.Unit,
|
||||
new DisplayUnitSelection(DisplayUnitSystem.Metric, SpeedDisplayMode.Road));
|
||||
Assert.False(failedProjection.IsAvailable);
|
||||
Assert.NotNull(failedProjection.Error);
|
||||
var unavailableHtml = await RenderDashboardAsync(
|
||||
provider,
|
||||
session,
|
||||
new DisplayUnitSelection(DisplayUnitSystem.Metric, SpeedDisplayMode.Road));
|
||||
var unavailableMarkup = GetGaugeMarkup(unavailableHtml, "speed");
|
||||
Assert.Contains("data-state=\"uncertain\"", unavailableMarkup);
|
||||
Assert.Contains("Display conversion unavailable", unavailableMarkup);
|
||||
Assert.DoesNotContain("role=\"meter\"", unavailableMarkup);
|
||||
|
||||
await AdvanceAsync(0);
|
||||
var latest = Assert.Single(feed.Snapshot.Values);
|
||||
Assert.Equal(DashboardReadingState.Good, latest.State);
|
||||
Assert.Equal(10d, latest.NumericValue);
|
||||
var readCount = CountSignalReads(session);
|
||||
var cycle = feed.Snapshot.Cycle;
|
||||
var stoppedProjection = DisplayUnitConverter.Project(
|
||||
latest.NumericValue!.Value,
|
||||
latest.Definition.Unit,
|
||||
DisplayUnitSelection.Default);
|
||||
Assert.Equal("mph", stoppedProjection.Unit);
|
||||
Assert.InRange(Math.Abs(stoppedProjection.Value!.Value - 22.369362920544024), 0, 1e-9);
|
||||
Assert.Equal(readCount, CountSignalReads(session));
|
||||
Assert.Equal(cycle, feed.Snapshot.Cycle);
|
||||
|
||||
await feed.StopAsync();
|
||||
var stopped = Assert.Single(feed.Snapshot.Values);
|
||||
Assert.Equal(DashboardReadingState.Stopped, stopped.State);
|
||||
Assert.Equal(10d, stopped.NumericValue);
|
||||
Assert.Equal(latest.Signal!.LogicalTimeTicks, stopped.Signal!.LogicalTimeTicks);
|
||||
var stoppedHtml = await RenderDashboardAsync(provider, session, DisplayUnitSelection.Default);
|
||||
var stoppedMarkup = GetGaugeMarkup(stoppedHtml, "speed");
|
||||
Assert.Contains("22.4 mph", stoppedMarkup);
|
||||
Assert.Contains("data-state=\"stopped\"", stoppedMarkup);
|
||||
Assert.Contains("Not live: monitoring stopped.", stoppedMarkup);
|
||||
await session.DisposeAsync();
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public async Task StaticSession_FirstStartGroupsReadsAndSharesOneOwner()
|
||||
{
|
||||
|
|
@ -770,6 +932,49 @@ public sealed class LiveDashboardAcquisitionTests
|
|||
return services.BuildServiceProvider(new ServiceProviderOptions { ValidateOnBuild = true });
|
||||
}
|
||||
|
||||
private static async Task<string> RenderDashboardAsync(
|
||||
IServiceProvider services,
|
||||
DiagnosticSession session,
|
||||
DisplayUnitSelection selection)
|
||||
{
|
||||
await using var renderer = new HtmlRenderer(
|
||||
services,
|
||||
services.GetRequiredService<ILoggerFactory>());
|
||||
var component = await renderer.Dispatcher.InvokeAsync(() =>
|
||||
renderer.RenderComponentAsync<DashboardDisplayHost>(
|
||||
ParameterView.FromDictionary(new Dictionary<string, object?>
|
||||
{
|
||||
[nameof(DashboardDisplayHost.Session)] = session,
|
||||
[nameof(DashboardDisplayHost.Selection)] = selection
|
||||
})));
|
||||
return await renderer.Dispatcher.InvokeAsync(component.ToHtmlString);
|
||||
}
|
||||
|
||||
#pragma warning disable BL0006
|
||||
private sealed class DashboardDisplayHost : ComponentBase
|
||||
{
|
||||
[Parameter]
|
||||
public DiagnosticSession Session { get; set; } = null!;
|
||||
|
||||
[Parameter]
|
||||
public DisplayUnitSelection Selection { get; set; }
|
||||
|
||||
protected override void BuildRenderTree(RenderTreeBuilder builder)
|
||||
{
|
||||
builder.OpenComponent<CascadingValue<DisplayUnitSelection>>(0);
|
||||
builder.AddAttribute(1, nameof(CascadingValue<DisplayUnitSelection>.Value), Selection);
|
||||
builder.AddAttribute(2, nameof(CascadingValue<DisplayUnitSelection>.ChildContent), (RenderFragment)(child =>
|
||||
{
|
||||
child.OpenComponent<LiveDashboardPanel>(0);
|
||||
child.AddAttribute(1, nameof(LiveDashboardPanel.Session), Session);
|
||||
child.AddAttribute(2, nameof(LiveDashboardPanel.HeadingId), "display-state-dashboard");
|
||||
child.CloseComponent();
|
||||
}));
|
||||
builder.CloseComponent();
|
||||
}
|
||||
}
|
||||
#pragma warning restore BL0006
|
||||
|
||||
private static async Task<DiagnosticSession> OpenStaticSessionAsync(IServiceProvider provider)
|
||||
{
|
||||
var profile = ImportProfile(provider);
|
||||
|
|
|
|||
|
|
@ -266,16 +266,38 @@ public sealed class DisplayUnitSettingsTests
|
|||
Assert.Equal("metric|road", store.Value);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void PreferenceService_RejectsInvalidChoiceBeforeInitializingOrReadingStore()
|
||||
{
|
||||
var store = new IsolatedPreferenceStore { Value = "metric|road" };
|
||||
var service = new DisplayUnitPreferenceService(store);
|
||||
|
||||
Assert.False(service.TrySet(new DisplayUnitSelection((DisplayUnitSystem)99, SpeedDisplayMode.Road)));
|
||||
|
||||
Assert.Equal(DisplayUnitSelection.Default, service.Selection);
|
||||
Assert.False(service.IsInitialized);
|
||||
Assert.False(service.IsPersistedSelection);
|
||||
Assert.Equal(DisplayUnitPreferenceErrorKind.InvalidSelection, service.ErrorKind);
|
||||
Assert.Contains("undefined", service.Error);
|
||||
Assert.Equal(0, store.ReadCount);
|
||||
Assert.Equal(0, store.WriteCount);
|
||||
}
|
||||
|
||||
private sealed class IsolatedPreferenceStore : IDisplayUnitPreferenceStore
|
||||
{
|
||||
public string? Value { get; set; }
|
||||
public bool ReadFailure { get; set; }
|
||||
public bool WriteFailure { get; set; }
|
||||
public int ReadCount { get; private set; }
|
||||
public int WriteCount { get; private set; }
|
||||
|
||||
public string? Read() => ReadFailure
|
||||
? throw new InvalidOperationException("controlled read failure")
|
||||
: Value;
|
||||
public string? Read()
|
||||
{
|
||||
ReadCount++;
|
||||
return ReadFailure
|
||||
? throw new InvalidOperationException("controlled read failure")
|
||||
: Value;
|
||||
}
|
||||
|
||||
public void Write(string value)
|
||||
{
|
||||
|
|
|
|||
Loading…
Reference in New Issue