AutoForge/prompts/Step-09.md

258 lines
17 KiB
Markdown

# Step-09 - Synthetic calibration authoring and immutable proposals
## STEP IDENTIFIER
Step-09. Step-08 was accepted on 2026-10-30 with no corrective assignment.
This is the sole active implementation assignment. Step-10 programming is blocked.
## STEP TITLE
Author validated synthetic scalar/table proposals with immutable source-bound
versions and exact diffs, without changing a model, module or source configuration.
## OBJECTIVE
One user outcome: select an existing immutable synthetic dynamics configuration,
inspect its authoring baseline, edit supported values and compare saved proposals.
One primary new contract: source-bound, validate-before-commit version authoring.
This is process-memory authoring only. No device read, verified backup, approval,
programming, model application or calibration file format is assigned.
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-09-Report.md`, and STOP.
## ARCHITECTURAL CONTEXT
Keep all nine projects and one Client. Core may own small immutable calibration
definition/value/applicability contracts; Application owns source selection,
validation/history/diff use cases through existing configuration/profile services;
UI owns a routed editor. Generic Components remains independent.
No new dependency/project/host, general tuning framework, protocol, schema or
Simulation implementation/oracle change. All source/tests stay under `src`,
tests under `src/tests`.
Use the existing
[DynamicsConfigurationService](../src/AutoForge.Application/Features/Vehicles/Simulation/DynamicsConfigurationService.cs)
for exact configuration selection, and actual
[DynamicsConfiguration](../src/AutoForge.Core/Simulation/DynamicsConfiguration.cs)
metadata/parameters. Do not open a DiagnosticSession, infer live ECU values or
guess a module from its role. This authoring template is explicitly synthetic.
## CURRENT IMPLEMENTATION STATE
Accepted features supply immutable profiles/configuration fingerprints, coupled
dynamics, actual static/dynamic diagnostics, recording/archive, offline replay,
shared gauges and remembered unit preferences.
Worker baseline: clean full Release build; 179 unit + 171 integration passes
(350 total, zero failed/skipped) and native replay evidence. The orchestrator
did not run those checks. No calibration authoring implementation exists.
The warm example has IdleSpeedRpm=650, MaximumEngineSpeedRpm=5000,
WarmIdleTargetRpm=650 and torque pairs:
(650,240), (1000,300), (2000,360), (3200,350), (4200,300), (5000,180)
in rpm and N*m. These are configuration facts, not a readback or verified
vehicle calibration. Preserve all original source/configuration values.
Inspect Git/prior art and preserve dirty work and historical assignments/reports.
## REQUIRED IMPLEMENTATION
### Frozen contract matrix
| ID | Input/precondition | Required result |
|---|---|---|
| C-01 | Explicit saved warm configuration and its actual EngineModuleIdentifier | One immutable synthetic baseline bound to exact config/profile revision/module/model/definition; 650 rpm and six actual source torque rows; no role/default/live fallback |
| C-02 | Change only warm-idle target 650 -> 1250 rpm | New Proposed revision with exact parent/head; one scalar diff before=650, after=1250, delta=600; baseline/config/source remain unchanged |
| C-03 | Also edit torque at 2000 rpm from 360 -> 350 N*m | Exactly two diff entries versus baseline: scalar and that axis-keyed value (delta=-10); unchanged cells/axes omitted; compare versus preceding revision shows only the new table edit |
| C-04 | Non-finite/out-of-range scalar/cell, wrong unit/key/axis/count, malformed definition or source mismatch | Typed visible rejection before history/head/source/version mutation; no clipping, axis sorting, silent unknown field or partial save |
| C-05 | Exact allowed bounds; no-change save; changed-back proposal | Bounds inclusive; identical head content returns same revision without consuming capacity; changing back after a different proposal creates a new immutable Proposed revision whose baseline diff is empty |
| C-06 | Two requests based on the same head, sequential or controlled concurrent commits | At most one changed proposal commits; stale expected head/source token rejects atomically. No lost update, automatic merge or branched history |
| C-07 | Mutate caller arrays/lists after creation/save, or inspect old revision after later edits | All definition/baseline/proposal/diff snapshots stay immutable and defensively copied; exact before/after values and parent lineage retained |
| C-08 | Different config/profile revision/module/model/definition selected or invalid reference | No cross-source compare/save/rebind. Prior workspace stays intact on rejection; replacing a workspace requires explicit action and cannot silently discard its proposals |
| C-09 | Metric/Imperial switch or editor rerender with unsaved torque input | Display conversion/draft input unit is explicit and pinned; canonical N*m/axis/bounds/history unchanged by toggle or unedited Save; convert edited value once before validation |
| C-10 | First/latest/history/diff UI and invalid command | Real Application path, exact selected versions/source, visible validation; Baseline/Proposed only, never Tested/Approved/Applied/verified-backup claims |
| C-11 | 32 saved revisions including baseline, then changed/identical save | Exact limit enforced; changed 33rd rejects without mutation, identical no-op still returns head. No disk/history eviction or unbounded hidden workspace accumulation |
| C-12 | Authoring while a real live source/replay exists; full verification | Zero new transport/model/store-save/approval calls; source configuration export/fingerprint/recordings/replay state unchanged, 350 baseline cases and full nine-project Release/native UI pass |
### A. Small explicit definition and applicability
Support one versioned synthetic engine-authoring definition, not arbitrary
firmware layouts. Its exact applicability includes profile identifier/revision,
explicit configuration fingerprint, EngineModuleIdentifier, ModelIdentifier/
ModelVersion and definition identifier/revision. Resolve the real module through
the selected profile; preserve optional hardware/software/firmware/calibration
metadata as supplied, not proof or automatically filled applicability.
Use existing identifier comparison policies for profile/module identity; config
fingerprints, parameter/table IDs, source units and model/definition identity
compare exactly. Unknown/mismatched references reject visibly before creation.
No manufacturer address/offset, VIN autodetection or role-based module inference.
Required logical values:
- `engine.warm-idle-target`: finite scalar, source unit rpm, inclusive range
[selected Model.IdleSpeedRpm, selected Model.MaximumEngineSpeedRpm].
- `engine.torque-curve`: fixed ordered rpm axis copied exactly from the selected
Model.EngineTorqueCurve, with editable finite N*m cell values in [1,1000].
Support 2..32 rows; axis points remain finite, strictly increasing and within
[0, MaximumEngineSpeedRpm]. No insertion/deletion/reordering/interpolation.
These authoring bounds are synthetic policy, not manufacturer-safe limits.
If an otherwise valid configuration is outside this template (e.g. too many
rows or a torque value outside [1,1000]), reject it explicitly; never truncate/
normalize it or pretend all possible configurations are supported.
Use identity value scaling only (1/offset 0); raw binary encoding is not assigned.
Required scalar/table keys, shape, axes, units and exact counts are validated
as a whole, not only individual editor cells.
### B. Immutable baseline, proposals and exact structured diff
Create a baseline from the selected immutable configuration on explicit action.
Its label is "Synthetic configuration-derived baseline", not original ECU backup.
Copy all definition/source/value collections. Baseline is revision 1/read-only;
every valid changed save creates a new Proposed revision with a unique identity,
monotonic revision number and exact parent/head identity.
Only save against the current head of the same workspace/source/definition.
Take the expected head as an explicit command precondition and validate every
input before committing any version/counter/head change. Reject stale commands,
including two real competing saves; no merge/branch/latest-source fallback.
No-change saves are idempotent and do not consume history.
Keep one bounded authoring workspace with at most 32 saved revisions including
baseline. Replacement requires an explicit UI action confirming the old in-memory
history/draft will be discarded; invalid replacement preserves it. A history
inspection choice does not silently change the current editable head.
No persistence/import/export format or multiple-workspace repository is assigned.
Clearly disclose that process restart loses this in-memory authoring work.
Diff any two explicitly selected revisions of the same applicability/definition.
Return only changed scalar/cells in deterministic parameter/axis order, with
logical ID, exact axis coordinate for table cells, original source unit, before,
after and signed delta. Compare canonical doubles, not rounded display text;
do not hide small changes behind a UI tolerance. A changed-back proposal is still
a proposal, not a restored device, approved rollback or verified original.
No automatic Tested/Approved/Applied status, write command, backup claim, model
configuration replacement, physics step or active-source mutation.
Future programming must independently verify a real simulated target and bind
its approval/backup contract; authoring validation alone grants no authority.
### C. Real UI and existing unit preferences
Add `/calibration` (or an equally clear documented route) and shared navigation.
Select exact saved configuration; allow use of the existing explicit warm-example
creation workflow, not hidden seeded workspaces. Show full binding/provenance,
baseline/scalar/table, editable latest proposal, history and version-pair diffs.
Use ordinary numeric/table controls; no map visualizer or layout designer.
Keep definition/axes/source units read-only. Validate visible parse errors and
the complete candidate through the real Application service; rejected saves
preserve the current head/history/source. Identify the expected head explicitly
so another editor cannot overwrite unnoticed. Unsaved fields must not mutate
saved versions by binding through shared references.
Use the accepted shared unit converter for torque N*m/lbf*ft display and inputs;
rpm stays rpm. Pin an active draft's input selection until Save/Cancel, preserve
original canonical values on unedited Save and apply precision for display only.
Show canonical source units/bounds alongside synthetic constraints and labels.
Global unit changes/renders do not save proposals or alter source/application
state. Keep safe text, accessible labels, visible errors and the old routes.
Feature draft state must survive its rerenders; source/workspace replacement is
explicit. No new generic navigation-guard or settings framework is required.
## FILES OR PROJECTS EXPECTED TO CHANGE
Focused Core calibration contracts if justified, Application authoring/validation/
version/diff and registration, UI route/editor/navigation, tests and related
README/docs. Client DI only if needed. No Simulation/Diagnostics model/protocol
or archive/replay behavior change, new project/dependency or binary fixture.
Under `prompts`, create only `Step-09-Report.md`.
## INTERFACE AND DEPENDENCY REQUIREMENTS
Preserve nine projects/references, one Client, generic Components, current exact
profile/config/source/unit semantics, recording/replay bytes and clock ownership.
No hardware/model write, unchecked binary offset, profile capability promotion,
fallback source, oracle shortcut, broad catch or success-shaped invalid input.
Do not fix the separately disclosed recording refresh/navigation issue here.
No dependency/system/workload install/update/repair/rollback, staging/commit/push
or destructive Git. Preserve protected/history/orchestration files and dirty work.
## TESTING REQUIREMENTS
Map C-01..C-12 to meaningful named tests before handoff:
- Real profile/configuration-service baseline and exact example values; scalar/
table proposal/diff vectors, same-content no-op, changed-back and comparisons
with exact versions/source/units/axes. Do not test just JSON/string equality.
- Independent invalid vectors for scalar/cell NaN/infinities/bounds, axis/shape/
key/unit/source identity, stale head, wrong configuration/model/definition;
assert prior head/history/source snapshots remain exactly unchanged.
- Defensive-copy tests, deterministic competing-head saves and exact 32/33
revision boundary. Use controlled barriers rather than sleeps or stress races.
- Real DI/rendered editor commands, invalid input, history/diff selection,
source replacement confirmation, pinned torque-unit draft and canonical
equality across repeated preference changes and unedited saves.
- Actual live source/replay coexistence with counted diagnostic/model/store
boundaries; authoring must add zero calls and leave config export/fingerprint/
recordings/replay state unchanged. Do not mock away the authoring service.
Run focused cases, then sequentially:
- `dotnet build .\src\AutoForge.slnx --configuration Release --no-restore`
- `dotnet test .\src\AutoForge.slnx --configuration Release --no-build`
Preserve 350 baseline cases (179 unit, 171 integration) plus meaningful new
coverage. Map intentional UI-only assertion changes without deleting safety/
error/source checks. Build all nine projects/native Client. Install/restore
nothing absent a genuine chosen-command missing dependency.
Native smoke: explicitly create/select real warm configuration, open authoring
baseline, save 650->1250 proposal and one torque-cell change, inspect exact
version-pair diff, reject invalid edit/stale source, toggle units with a draft
open, verify original configuration/live diagnostic values were not applied,
then navigate/reopen existing routes. No real device or programming operation.
Distinguish native observations from controlled stale/concurrent/limit proof.
Clean only exact task-owned test artifacts; do not reset user data/preferences.
## DOCUMENTATION REQUIREMENTS
Update README/index/architecture/build guide and calibration authoring guide:
synthetic applicability/ranges/template limits, exact version/head/diff semantics,
in-memory lifetime, display versus canonical values, and no backup/test/approval/
apply/real-vehicle claims. Step-08 is accepted; Step-09 worker status stays
pending orchestrator review. Step-10 simulated programming is separate and
unimplemented; physical writes retain their later authorization gates.
## ACCEPTANCE CRITERIA
| ID | Criterion | Evidence |
|---|---|---|
| AC-01 | C-01/C-04/C-08 explicit supported definition/source applicability and atomic rejection | Real configuration/profile/model references and independent negative vectors |
| AC-02 | C-02/C-03/C-05..C-07/C-11 immutable linear proposals, exact diffs/no-op/stale-head/limits | Exact independent scalar/table/parent results, defensive copies and controlled commits |
| AC-03 | C-09/C-10 real editor/history/diff uses canonical units and truthful authoring-only status | Actual rendered actions, parse/validation failures, source confirmation and pinned-draft/unit tests |
| AC-04 | C-12 no authoring side effects; 350 regressions/new coverage, full Release/native build and required smoke pass | Counted real coexistence, unchanged source/config/archive/replay and exact worker commands/results |
| AC-05 | Matrix/self-review/docs/README describe actual output/state/limits, with history/protection/manual workflow preserved | Own post-green source-path review, named executed evidence and `prompts/Step-09-Report.md` |
## OUT-OF-SCOPE WORK
Programming/readback/restore/verified backup, Tested/Approved status/workflow,
model application, calibration file persistence/import/export, multidimensional/
editable-axis maps, arbitrary scaling/firmware memory, AI/hardware, new project/
package/host and unrelated cleanup. No future assignment, agents, automatic
handoff, orchestration/shared-gate edit, stage, commit or push.
## REPORTING REQUIREMENTS
Save `prompts/Step-09-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-05 matrix with named executed
evidence, exact baseline/proposal/diff/negative/head/limit results and zero-write
proof, commands/exits/warnings/per-project counts, native versus controlled
coverage, docs/README, own post-green source-path self-review, limitations/
deviations/blockers and preservation review.
COMPLETE requires all assigned checks; otherwise report INCOMPLETE/BLOCKED with
the precise unmet criterion. Save and STOP; do not begin Step-10.