AutoForge/prompts/Step-04.md

25 KiB

Step-04 - Deterministic vehicle dynamics and scenario execution

STEP IDENTIFIER

Step-04. Corrected Step-03 and its Step-03A/Step-03B corrections were accepted on 2026-10-28. This is the sole active implementation assignment.

STEP TITLE

Run an explicitly configured synthetic vehicle through coupled engine, transmission and longitudinal dynamics using a fixed virtual clock, with actual dynamic telemetry exposed through the diagnostic path.

OBJECTIVE

Deliver a deterministic, headless-testable dynamics engine and a working native-application slice: explicitly load/select configuration, open a dynamics session, start/pause/resume/stop/reset/step, execute a scenario, inspect diagnostic telemetry and import/export the configuration for reproduction.

Preserve the accepted static synthetic provider and all diagnostics/profile corrections. This is simplified synthetic physics, not a validated real-world prediction, module calibration/programming, AI or physical vehicle integration.

You are the WORKER. Execute only this assignment, verify it, write prompts/Step-04-Report.md, and STOP for manual orchestrator review.

ARCHITECTURAL CONTEXT

Read ROADMAP.md, STATE.md, accepted Step-03, Step-03A, Step-03B and their reports, architecture, simulation, protocol v1 and profile schema v1.

Keep the nine-project .NET 10 modular monolith and sole MAUI Blazor Hybrid Client. Simulation owns physics/clock implementation, not Application/UI. Put only needed platform-neutral run/configuration/control contracts in Core or an appropriate existing shared-contract location. Application coordinates those ports and Diagnostics; it must not reference Simulation implementation. Client composes it. UI calls application features; it does not read the simulation oracle.

No new assembly, executable, backend, mediator, container or cloud dependency is needed. Root project directories remain docs, src, prompts; all projects/ tests stay under src, tests under src/tests. Handoffs remain manual.

CURRENT IMPLEMENTATION STATE

The solution has Core, Application, Diagnostics, Simulation, Components, UI, Client, UnitTests and IntegrationTests. Actual production references:

  • Diagnostics -> Core; Simulation -> Core/Diagnostics.
  • Application -> Core/Diagnostics; UI -> Application/Components/Diagnostics.
  • Client -> Application/UI/Simulation; Components and Core have no AutoForge project dependency. One executable, no cycles.

Accepted features include immutable schema-v1 profiles/provenance/capabilities, explicit target metadata and exact profile/revision selection, real Simulation sessions, strict synthetic protocol v1, module probing/identity/DTC/virtual-clear, static signals, logical diagnostic timing/faults and bounded raw trace.

The provider autoforge.simulation.synthetic is static: configured engine speed is 850 rpm, not dynamics. Preserve it and its wire behavior. Discovery now retains positive probe/service evidence independently of identity success; actions remain identity-gated. Application verified clear requires fresh empty readback.

Important existing surfaces:

  • DiagnosticSessionService.cs opens/resets exact profile/provider sessions. Reset currently preserves those fields; it will also need to preserve the new dynamics configuration binding.
  • ProviderContracts.cs derives ConfigurationIdentifier from profile/revision and exposes diagnostic/control boundaries; profile identity alone is insufficient to identify a dynamics setup.
  • SyntheticDiagnosticProtocolClient.cs strictly accepts v1 static signal origin and request-time semantics.
  • SimulationProvider.cs owns per-session virtual state; the runtime state oracle is internal to tests.

Worker evidence records a complete nine-project Release build with zero warnings/ errors, 111 unit + 72 integration passes (183 total, zero failed/skipped), and native baseline smoke. These are previous worker results, not orchestrator reruns.

Existing verified worker platform: SDK 10.0.402, runtime 10.0.13, Windows Client TFM net10.0-windows10.0.26100.0/win-x64, MAUI Windows manifest 10.0.110, WebView2 155.0.4283.62. Inspect prerequisites read-only if needed. No workload/ system install, update, restore, repair or rollback is authorized.

Recheck Git/instructions and preserve pre-existing dirty implementation and all historical assignments/reports.

REQUIRED IMPLEMENTATION

1. Explicit immutable run/model/scenario configuration

Introduce a small versioned configuration document separate from profile schema v1:

  • Exact profile identifier/revision and relevant module/calibration reference metadata; model/version and configuration identity.
  • Required synthetic model parameters, explicit units and provenance/limitations.
  • Initial conditions, environment/road-load settings, fixed virtual step and driving scenario. No hidden defaults for missing physical inputs.
  • Enough information to reproduce an entire run without AI, network, wall-clock state or previously active UI choices.

Keep shared contracts/invariants platform-neutral; implement engine/clock in Simulation and import/list/select/export use cases in appropriate Application feature slices. An in-memory configuration catalog plus explicit JSON import/ export is sufficient; no user-file storage/database is required.

Reject unsupported format/model versions, missing/duplicate/unknown fields, non-finite numbers, invalid units/ranges, zero/negative mass/radius/ratios, unordered/duplicate curve points and incompatible profile/module references. Document supported numeric/step ranges. Do not silently clamp invalid inputs or fill them with a preset. Named synthetic examples may explicitly supply defaults. Snapshot collections/configuration; caller edits/imports cannot mutate a live run.

Run identity must bind exact profile/configuration/model/initial/environment/ scenario inputs, not merely profile key or process GetHashCode. Use a documented stable versioned identity/fingerprint where needed. Keep operational run/session IDs distinct from the stable reproducibility identity.

Save/export and reload/import must preserve semantic inputs. Unknown real-world facts remain unknown: synthetic model parameters do not promote profile metadata to verified manufacturer data. Idle/shift model settings here are simulation inputs, not edited module calibration, firmware or approved tunes.

2. Separate dynamics from existing static diagnostics

Add a real explicitly selected dynamics provider, for example autoforge.simulation.dynamics, kind Simulation. Preserve the existing static provider/fixtures without silently converting their responses into physics.

Bind a control capability and diagnostic transport to the same run/session. Application uses shared interfaces, never concrete engine fields or a competing global active-run registry. Choose the simplest coherent capability/factory extension; no generic plugin framework or new ports assembly.

  • Exact configuration selection is mandatory for a dynamics session. Missing/ incompatible config, wrong provider/kind or unsupported control capability fails explicitly; no static/dynamic/profile fallback.
  • Update open/reset/session identity/transport/composition/UI surfaces together. Reset must reopen/reset the exact selected configuration and initial state, not whatever config was imported or selected later.
  • Closing/resetting releases the old engine/pacer/pending operations and cannot change another session or leave a stale active controller.
  • Static/replay/physical selections cannot acquire dynamics controls accidentally. Replay and physical operation remain unavailable.
  • A user-triggered example load may prepare profile/config/scenario data but must not auto-select/open/start a run when a page opens.

3. Fixed-step virtual clock and lifecycle

Implement one authority for model time and state advancement. Recommended default step: 0.1 virtual seconds; document and validate the actual supported interval. Compute model time from integer step/tick count, not accumulated wall-clock deltas.

Support start, pause, resume, stop, reset, single/multiple explicit steps and configurable playback/pacing speed. Define valid state transitions and failures:

  • Pause/stop freeze virtual time and all physics. Stop is not engine ignition-off; reset explicitly restores configured initial conditions and counters.
  • Stepping advances exact configured virtual steps in allowed non-running states; it does not silently start a background loop.
  • Pacing changes only scheduling, never the numerical step, physics or scenario inputs. Same virtual steps/inputs produce the same state at every pacing factor.
  • Diagnostic reads, UI renders, trace capacity and wall-clock jitter cannot advance or alter vehicle state. Keep diagnostic delivery ticks separate from model time.
  • Serialize step/control/lifecycle changes; pause/stop/close must complete without a later stale tick or disposed-resource operation. Cancellation is explicit.

A real-time pacer may schedule fixed steps for native interaction. Headless scenario execution must run virtual minutes without sleeping for real minutes. No Thread.Sleep, random sensor generation or LLM-in-the-loop calculations. Introduce no randomness unless genuinely required; no unused seed placeholder.

4. Coupled simplified longitudinal vehicle model

Provide data-driven synthetic parameters for:

  • Engine running/idle control, throttle, RPM, torque/load and fuel use.
  • Forward transmission gears/ratios/final drive, automatic shift schedule and hysteresis; explicit neutral/engagement/slip assumptions.
  • Vehicle mass, wheel radius, longitudinal forces, acceleration/deceleration, braking, rolling/aerodynamic road load and distance.
  • Ambient/initial temperatures and a documented simple coolant/thermal model.

Use SI internally and explicit presentation conversions. Dynamic signals derive from one coupled state; do not generate independent RPM/speed/gear readings. When fully coupled, outside declared shift/slip intervals:

engineRPM = speed_mps / (2 * pi * wheelRadius_m) * 60 * gearRatio * finalDrive

Low-speed idle/launch behavior needs an explicit coupling/slip assumption; do not claim locked coupling while independently clamping RPM to idle. Gear/torque changes must affect wheel force/speed, and shifts must not hunt under steady cruise. Automatic shifting is a model input schedule, not a calibration write.

Advance speed from configured tractive/braking/road forces and mass. Do not set actual speed directly to a scenario target or teleport between states. Fuel/ load/power/temperature calculations must follow the model state and assumptions. Fuel rate/total must stay finite/nonnegative; cumulative consumption is monotonic. Engine-off fuel/RPM and stopped/neutral behavior are explicitly modeled.

Validate impossible initial combinations or derive redundant values from a documented independent state; do not silently repair conflicting inputs. Detect non-finite/out-of-domain evolution as an explicit failed run, not zero telemetry/success fallback. Keep original input snapshots unchanged.

This is a simplified behavioral model, not firmware emulation, manufacturer accuracy, emissions analysis, a safe tune recommendation or real fuel-economy proof.

5. Deterministic scenario and measurable synthetic demonstration

Support a versioned machine-readable finite scenario with explicit start/engine, idle, acceleration/target-speed hold, braking/stop and return-idle phases. Controllers produce bounded throttle/brake/gear inputs using virtual time; they never directly assign vehicle speed. Define failure/time-limit behavior.

Provide a complete documented warmed synthetic baseline using a 650 rpm warm idle target. Under its declared parameters, test:

  1. Stationary warm idle stabilizes within 650 +/- 5 rpm after 10 virtual seconds.
  2. Normal/moderate acceleration reaches 45 MPH (20.1168 m/s) within 60 virtual seconds without a speed jump, with genuine scheduled shifting.
  3. Hold 45 MPH for the full 300 virtual seconds; at least 95% of hold samples are within +/- 1 MPH (0.44704 m/s). Do not shorten or omit failed samples. The warmed cruise must actually enter its defined coupled regime.
  4. Brake to speed <= 0.1 m/s within 60 virtual seconds, without negative-speed overshoot, and return to stationary idle for at least 10 virtual seconds.
  5. Same immutable inputs/step sequence reproduce all sampled model results and lifecycle/scenario outcomes under a documented numerical comparison contract.

Publish the actual chosen model parameters/curves and achievable assumptions. Do not tune test assertions to broad "nonzero" proxies or game the goal by teleporting, always labeling the drivetrain slipping, or filtering bad samples. Manual inputs and scenario control must have a documented single-owner policy.

6. Dynamic telemetry through actual diagnostic communications

The engine updates virtual module state internally; normal Application/UI telemetry still comes through actual encoded diagnostic requests/responses. Expose RPM, speed, gear, throttle/brake/load/torque, fuel rate/total, temperature, distance/acceleration and model time as appropriate to the modeled modules. Preserve source module, units, quality, model/configuration identity and origin.

Existing protocol v1 is explicitly static and strict. Do not relabel dynamic readings SYNTHETIC_STATIC, silently accept new unknown fields or conflate its request ticks with model time. Introduce the smallest explicit versioned/ negotiated dynamic protocol extension, preserving old v1 behavior and its unsupported-version tests. Document exact new fields/origins/time units.

Dynamic replies must bind to the actual selected run/configuration and a consistent model-step snapshot. Preserve diagnostic correlation and distinguish capture/request time from model time. Paused/stepped reads across modules must refer to the same unchanged model step. Running asynchronous samples must expose their actual model time rather than claim simultaneous sampling.

Keep service/payload validation, partial probe/identity states, verified clear, no-response/error/cancellation and bounded trace/loss semantics. Reading signals must not itself tick physics. No UI/AI ground-truth shortcut: internal test oracle access may be deliberately limited to approved test assemblies only.

7. Application/UI integration

Add cohesive Application configuration/run/scenario/control features and a minimal simulation page/workflow in the existing UI:

  • Explicit profile/config/provider selection and separate open/start actions.
  • Config JSON import/export, lifecycle/scenario selection and controls, current virtual time/phase/progress, explicit stop/cancel and pacing selection.
  • A simple source/unit/model-time-aware numeric telemetry table refreshed through diagnostics; no full gauge/dashboard framework (Step-05).
  • Visible configuration/lifecycle/model/protocol failures, including unsupported static-target controls, with no stale active-run success after close/reset.

Reuse shared components and existing navigation/DI. Client changes are composition and platform lifecycle only. Preserve old static diagnostics/profile/target routes. Do not auto-open a run, require AI, create a backend or add a new executable.

FILES OR PROJECTS EXPECTED TO CHANGE

  • Needed Core/shared run/config/control contracts and validation.
  • Simulation model/clock/scenario/controller implementation and explicit dynamics factory/definitions, without UI/Application dependency.
  • Diagnostics/session/configuration/protocol integration required for dynamic snapshots and exact binding, keeping static compatibility.
  • Application configuration/run/control slices and UI feature presentation.
  • Client composition, existing unit/integration tests and related documentation.
  • Create only prompts/Step-04-Report.md under prompts.

No new project is assigned. Do not modify assignments, ROADMAP, STATE, previous reports or protected Copilot instructions, or create override instructions. Do not stage, commit, push, initialize/reset Git or discard unrelated dirty work.

INTERFACE AND DEPENDENCY REQUIREMENTS

Keep the nine-project inward/reference boundaries, one Client/two RCLs and static/ dynamic selection explicit. Runtime sensors are diagnostic data; control/status ports are not public unrestricted engine/module ground truth. Keep test-oracle access internal and document any necessary test-only access change.

Use proper types/units, immutable configuration and explicit failures. Do not introduce generic managers/repositories, mediator boilerplate, arbitrary scripting, magic physical defaults, broad catches or invalid-input success fallbacks. Physical writes, arbitrary hardware frames and calibration/tune editing remain absent.

TESTING REQUIREMENTS

Unit and independent numerical verification

Test actual model/clock/controller/configuration behavior, not just DI:

  • Required/finite/range/unit/curve/identity validation and semantic configuration round-trip; caller mutation and incompatible versions cannot alter a run.
  • Fixed-step lifecycle, pause/stop/reset/step, pacing-independent results, invalid transitions, cancellation/disposal and no background tick after close.
  • Independent wheel/RPM/gear-ratio calculations for coupled states, force/mass/ acceleration checks, braking/drag and meaningful shift/hysteresis behavior.
  • Idle/engine-off/neutral/launch/shift assumptions, finite load/fuel/temperature, monotonic fuel/distance and the complete numeric scenario thresholds above.
  • Repeat equivalent runs and compare full sampled results, not only final speed. No wall-clock sleeps or arbitrary elapsed-time/performance success thresholds.

Do not validate an algorithm by calling the same implementation to compute its expected answer. Use analytical/reference equations and known fixtures; an internal oracle may inspect actual state independently of the diagnostic decoder.

Real Application/diagnostic/UI integration

  1. Import/select exact profile and run config, explicitly open a dynamics session, start/pause/step/run scenario and read computed values through actual frames.
  2. Pause, read repeatedly/across modules and prove no physics/model-time change; verify ratios and shared snapshot identity/time independently.
  3. Import/select another config while a run exists; prove original is immutable and reset preserves the original exact configuration, not latest selection.
  4. Different sessions remain isolated; close/reset/cancel releases resources and suppresses stale tick/telemetry/lifecycle results. Use controlled scheduling.
  5. Wrong/missing profile/config/provider, static controls, malformed/version/ origin/time/binding replies and unsupported targets fail explicitly.
  6. Preserve static v1 diagnostics and R-01/R-02/R-03/R-04, including partial identity/action guards, verified clear, raw trace and strict profile schema.
  7. Render the actual UI with real ports; inspect meaningful control/state/ telemetry/error results. No feature-under-test mock or direct UI engine oracle.

Full build and native evidence

Preserve the 183-case baseline (111 unit/72 integration), mapping any intentional interface/presentation assertion changes. Add substantive new tests; no required skips, removed safety assertions or fake green placeholders.

Run focused tests during implementation, then sequential complete Release verification using the existing runner/SDK:

  • dotnet build .\src\AutoForge.slnx --configuration Release --no-restore
  • dotnet test .\src\AutoForge.slnx --configuration Release --no-build

Restore packages only when needed. The full build includes the actual native Windows Client and all nine projects, not a filtered headless substitute. Record exact commands/targets/versions/results, warnings and per-project counts.

Launch the actual native Client: explicitly load/select a dynamics example, open/start, observe diagnostic dynamic telemetry/model time, pause/step/resume, change pacing, run the scenario (accelerated pacing is allowed), stop/reset and export/reload configuration. Verify reset identity, visible invalid/unsupported case, clean close and old static/profile/target/not-found routes. Distinguish native observations from headless numerical proof; do not claim a visual gauge proves mathematical consistency or repeatability.

Stop only task-owned helper processes and clean exact temporary smoke assets. Report missing prerequisites honestly; no workload install or host substitution.

DOCUMENTATION REQUIREMENTS

Update README/index/architecture/build guide and add only useful actual docs/ADRs:

  • Model equations, units, parameters/curves, numerical integration, coupling/ slip/shift/fuel/thermal assumptions and unsupported fidelity.
  • Fixed clock/lifecycle/scenario/pacing and concurrency/cancellation semantics.
  • Versioned configuration identity/format, exact reset binding and reproduction.
  • Static versus dynamic provider/protocol/origin/model-time compatibility.
  • Actual Application/UI workflow, source/quality/telemetry/oracle boundaries, tests, numeric thresholds/results and native limitations.

Align Step-03/03A/03B acceptance and Step-04 worker status accurately. Preserve historical reports. Simulation estimates are not proven real-world fuel savings, safe calibrations, manufacturer compatibility or programming authorization.

ACCEPTANCE CRITERIA

ID Criterion Required evidence
AC-01 Immutable explicit versioned run/config/scenario inputs bind exact profile/model/initial/environment data, with strict validation and import/export Invalid/round-trip/mutation tests and documented stable identity/format
AC-02 Fixed virtual clock, lifecycle/step/pacing and cancellation/disposal are deterministic and independent of reads/UI/wall jitter Controlled scheduling tests, exact tick/step assertions and no stale work
AC-03 Static provider remains intact; explicit dynamics provider/control capability and reset preserve exact configuration/session isolation Actual factory/session/feature tests, two configurations/sessions and wrong-target failures
AC-04 Coupled engine/transmission/longitudinal/load/fuel/thermal behavior is finite and physically consistent within declared assumptions Independent equations/oracle checks, shift/idle/brake cases and full state comparisons
AC-05 Warm idle, <=60s acceleration to 45 MPH, full 300s hold accuracy, stop/return-idle and reproducibility meet numeric gates above Exact metrics/sample counts/tolerances from automated tests, not visual proxies
AC-06 Dynamic telemetry crosses actual versioned diagnostic path with truthful origin/model time/config binding; static v1 and error/partial/clear guards preserved Wire compatibility/bad-payload tests, paused multi-module snapshot checks and no read-driven physics
AC-07 Real Application/UI provide configuration/lifecycle/scenario/pacing/diagnostic table without oracle shortcut or shell restructuring Source/reference review, rendered tests and native interaction evidence
AC-08 Complete nine-project Release/native build, both suites/baseline regressions and required native workflow succeed Exact commands, warnings, per-project counts, numerical results and native observations
AC-09 README/docs/ADRs accurately describe implementation, equations/contracts/reproduction and limitations Changed document list and implemented/planned/fidelity summary
AC-10 Protected/history/manual workflow preserved; complete report saved and worker stops Preservation/Git/scope review and prompts/Step-04-Report.md

Map every criterion to PASSED, FAILED, NOT EXECUTED or BLOCKED with evidence. COMPLETE requires all required numeric, regression and native checks. Do not begin Step-05; acceptance belongs to the orchestrator.

OUT-OF-SCOPE WORK

Full configurable gauges/dashboard framework, telemetry recording/replay/ comparison, real manufacturer definitions, firmware emulation, calibration/ programming/backups, AI/research/knowledge, physical adapters/vehicles, databases, cloud/containers, additional platforms/hosts/projects and unrelated refactoring. No emissions defeat, anti-theft bypass, mileage falsification or safety disabling.

REPORTING REQUIREMENTS

Create prompts/Step-04-Report.md entirely inside exactly one plain triple-backtick code fence, without language tag or outside content. Use no nested fences. Use the same copy-window format for the final chat report.

Include step/title and COMPLETE/INCOMPLETE/BLOCKED status; implemented functions; files created/modified; actual contracts/reference graph and provider/config/run identity; equations/parameters/units/clock/scenario assumptions; unit/integration coverage and independent numerical evidence; exact build/test commands/results with per-project counts; all scenario metrics/tolerances/sample totals; native versus headless observations; AC-01 through AC-10 mapping; documentation/README updates; limitations/issues; deviations/recommendations; and protected/scope/Git preservation review.

No failed/unexecuted case may be called passed. Save the report and STOP. Do not modify assignments/roadmap/state, create or begin Step-05, invoke agents, automate handoff, stage, commit or push.