21 KiB
21 KiB
# Step-09 - Synthetic calibration authoring and immutable proposals
## Status
COMPLETE. The bounded authoring implementation, all frozen contracts,
post-green self-review, focused tests, nine-project Release build, complete
regressions and required native authoring smoke passed.
Step-09 remains pending manual orchestrator review; this report does not grant
acceptance. Accepted Step-08 and the existing 350-case baseline are preserved.
Step-10 programming was not started. No agents, automatic handoff, staging,
commit or push occurred.
## Functions, files and interfaces
- [SyntheticEngineCalibration.cs](../src/AutoForge.Core/Calibration/SyntheticEngineCalibration.cs):
small immutable applicability, scalar/fixed-axis definition and value
contracts, typed CalibrationAuthoringException/CalibrationFailure, defensive
collection copying and complete supported-template/candidate validation.
Identity scaling is exactly 1/offset 0; no firmware encoding is supplied.
- [CalibrationAuthoringService.cs](../src/AutoForge.Application/Features/Vehicles/Calibration/CalibrationAuthoringService.cs):
CreateBaseline, ReplaceBaseline, Save, Compare and immutable Snapshot.
The service reads only the existing IDynamicsConfigurationService and
IVehicleProfileService. Registration retains one singleton workspace with
at most 32 saved revisions. Each immutable version carries its own
workspace/source identity, revision, kind, exact parent and copied values.
Diffs carry explicit source/version identities and exact changed entries.
No live/model/archive-save/approval/programming port exists in this slice.
- [CalibrationPage.razor](../src/AutoForge.UI/Features/Vehicles/Calibration/CalibrationPage.razor):
/calibration, exact configuration selection, explicit baseline/replacement,
copied expected-head draft, scalar/fixed-axis table editor, pinned torque
units, read-only version inspection, exact version-pair diffs and visible
parse/validation/stale-source/head errors.
- [AddAutoForgeUi.cs](../src/AutoForge.UI/Features/Foundation/AddAutoForgeUi.cs),
[MainLayout.razor](../src/AutoForge.UI/Layout/MainLayout.razor) and
[Home.razor](../src/AutoForge.UI/Features/Foundation/Home.razor):
minimal service composition and shared navigation.
New executable evidence is the CalibrationAuthoringTests partial class in:
- [CalibrationAuthoringTests.cs](../src/tests/AutoForge.IntegrationTests/CalibrationAuthoringTests.cs)
- [CalibrationAuthoringUiTests.cs](../src/tests/AutoForge.IntegrationTests/CalibrationAuthoringUiTests.cs)
- [CalibrationAuthoringCoexistenceTests.cs](../src/tests/AutoForge.IntegrationTests/CalibrationAuthoringCoexistenceTests.cs)
The initial C-01..C-12 source/value/head/limit/defensive-copy/rendered/isolation
contracts were written before production implementation. Post-green review
added exact row boundaries, full profile-revision replacement, case-sensitive
source-token vectors, multi-cell/reverse diffs and malformed table metadata.
## Frozen C-01..C-12 contract matrix
All rows below are PASSED. Named methods were executed, not proposed.
| ID | Named evidence and exact result |
|---|---|
| C-01 | ExplicitBaseline_UsesExactConfigurationAndActualModuleWithoutRoleFallback. The real profile/configuration services yield one explicit immutable baseline at 650 rpm and torque rows (650,240), (1000,300), (2000,360), (3200,350), (4200,300), (5000,180). Applicability binds exact config/profile revision/module/model/definition. Optional firmware remains null. A valid configuration explicitly referencing module.cabin.body resolves that real module and its metadata, not the engine role. There is no implicit workspace on route entry. |
| C-02 | ScalarThenTableProposals_HaveExactLinearParentsAndStructuredDiffs; native workflow. Saving 650->1250 produces unique Proposed revision 2, parent=baseline/head revision 1, and exactly one scalar diff: before=650, after=1250, delta=600 rpm. Baseline and original Model.WarmIdleTargetRpm remain exactly 650. Every version retains workspace/source tokens. |
| C-03 | ScalarThenTableProposals_HaveExactLinearParentsAndStructuredDiffs; MultiCellAndReverseDiffs_AreExactDeterministicAxisOrderedSnapshots; native baseline/preceding diff. Editing only the 2000-rpm cell 360->350 produces revision 3 with exact revision-2 parent, exactly two baseline diff entries (table delta -10 N*m; scalar +600 rpm), and exactly one preceding-revision diff. Unchanged cells and axes are omitted. Parameter order is ordinal logical ID, then numeric axis order. Reverse diffs swap exact before/after and signs. |
| C-04 | InvalidScalar_RejectsBeforeHeadHistorySourceOrCapacityMutation (NaN, both infinities, 649.999, 5000.001); InvalidTorqueCell_RejectsTheEntireCandidateIncludingValidScalarEdit (NaN, both infinities, 0.999, 1000.001); WrongCandidateShapeUnitsKeysAndAxes_RejectWithoutNormalization (13 independent shape/key/unit/axis/count vectors); MalformedDefinitionAndUnloadedCommands_RejectTypedWithoutFabricatedWorkspace; InvalidTableDefinitionMetadata_IsRejectedWithoutAHealthyDefault; SourceTokenMismatch_RejectsWithoutCrossSourceFallback. All return typed visible failures before any snapshot/head/history/source mutation. No clipping, sorting, normalization, omitted-cell save or unknown-key fallback occurs. |
| C-05 | NoOpBoundsChangedBackAndTinyDiff_AreExactNotRoundedOrClipped. The initial identical save returns the very same baseline revision and keeps count 1. Exact lower/upper values 650/5000 rpm and 1/1000 N*m are accepted. A changed-back save creates a new Proposed revision with exact previous parent and empty baseline diff. double.BitIncrement(650) remains an explicit nonzero exact diff, not rounded away. |
| C-06 | StaleSequentialAndBarrierControlledConcurrentHeads_CommitAtMostOneProposal; TwoActualEditorsAndSourceReplacement_RejectStaleOrUnconfirmedLossWithoutMutation. Two actual Save calls released through a two-participant barrier with the same expected head yield exactly one changed proposal and one StaleHead rejection, count 2 and one exact parent chain. Sequential stale changed and unchanged requests also reject. Two real rendered editors preserve the loser draft/error without lost update or implicit rebase. |
| C-07 | DefinitionCandidateHistoryAndDiff_DefensivelyCopyCallerCollections. Mutating source axis/cell arrays, scalar lists and table lists after candidate creation cannot alter baseline/proposal/definition values. Older version and diff values stay 650/1250/+600 after later saves. Definition axes, history and diff entries reject IList mutation. Each version's source/workspace/parent identity remains immutable. |
| C-08 | IdentityComparisonsAndExplicitReplacement_PreservePriorHistoryOnAnyRejection; SourceTokenMismatch_RejectsWithoutCrossSourceFallback (configuration/profile revision/module/model/definition and exact-case variants); FullProfileRevisionChangeAndInvalidEmptyRequests_PreserveTheExactCurrentWorkspace; UnsupportedButValidDynamicsConfiguration_RejectsTemplateBeforeReplacement; real rendered replacement tests. Different or replaced source/head/version IDs cannot cross-save or compare. Invalid/unconfirmed/stale replacement preserves the prior exact snapshot. Confirmed replacement creates a fresh workspace with one baseline; old version IDs reject. Profile/module case variants follow accepted identity policy, while config/model/definition identifiers remain exact. A real profile revision-2 source stays separate from revision 1. |
| C-09 | TorqueDraft_IsPinnedAndUneditedSavePreservesExactCanonicalDoublesAcrossToggles; RealEditor_SaveDiffHistoryAndInvalidInput_UseExactVersionsNotSharedDraftReferences; native draft checks. Unsaved torque strings remain pinned to captured units across global switches/rerenders. Edited torque is converted once and asserted against the exact independent N*m/lbf*ft factor result; unedited values retain canonical doubles without conversion drift. Eight repeated unit/no-op-save cycles keep the identical head and exact cells. Native Metric 345 N*m remained 345 after Imperial switch; untouched Imperial-to-Metric save retained exact 350 N*m and revision 3. |
| C-10 | RealEditor_SaveDiffHistoryAndInvalidInput_UseExactVersionsNotSharedDraftReferences; TwoActualEditorsAndSourceReplacement_RejectStaleOrUnconfirmedLossWithoutMutation; native UI. Real DI/rendered events exercise exact source selection, baseline, parent/head saves, history-only inspection, explicit version-pair diff and typed parse/validation errors. Inspecting baseline does not change the editable revision-3 head. Status is Baseline/Proposed authoring only, never granted Tested/Approved/Applied/verified-backup authority. |
| C-11 | HistoryLimit_IsExactly32IncludingBaselineAndNoOpStillSucceedsAtCapacity. Revisions 2..32 commit with unique IDs and exact monotonic parents. The identical full head is returned without consuming capacity; changed revision 33 rejects HistoryLimit with the same snapshot/revision/count 32. One workspace is retained; replacement resets the service-held history explicitly, not by eviction or hidden accumulation. |
| C-12 | AuthoringWithActualLiveSourceRecordingAndReplay_AddsZeroTransportModelOrStoreSaveCalls. Real live dynamics, saved recording/strict file-store archive and validated replay coexist during baseline/proposals/diff/unit operations. Transport-call delta=0, model-control-call delta=0, archive-Save-call delta=0; no approval/programming boundary exists to invoke. Original profile/config export/fingerprint, live trace/status, recording serialization/raw file bytes and the exact replay snapshot remain unchanged. All 350 baseline tests pass. Final nine-project Release/native checks are below. |
## Acceptance criteria
| ID | Result | Evidence |
|---|---|---|
| AC-01 | PASSED | C-01/C-04/C-08 real exact configuration/profile/module selection, bounded supported definition, unknown/mismatched references and atomic template/value/source rejection. |
| AC-02 | PASSED | C-02/C-03/C-05..C-07/C-11 exact immutable versions/parents/diffs, no-op and changed-back semantics, defensive copies, deterministic competing-head commits and 32/33 limit. |
| AC-03 | PASSED | C-09/C-10 actual rendered commands/history/diff/source confirmation, pinned draft units and exact canonical equality; native editor labels remain authoring-only. |
| AC-04 | PASSED | C-12 counted real-source/replay/recording coexistence; 405 final passes, all nine projects/native Release build with zero warnings/errors, and required native authoring checks. |
| AC-05 | PASSED | Executable matrix, own post-green source-path review, directly related docs/README, preserved protected/history/dependency/manual workflow and this single fenced report. |
## Commands and outcomes
SDK: dotnet --version -> 10.0.403 under the unchanged global.json policy.
The existing tests use xUnit v2/VSTest. No SDK/package/workload/tool
installation, update, repair or restore occurred.
The final commands ran sequentially after the review additions:
| Exact command | Exit | Result |
|---|---:|---|
| dotnet test .\src\tests\AutoForge.IntegrationTests\AutoForge.IntegrationTests.csproj --configuration Release --no-restore --filter "FullyQualifiedName~CalibrationAuthoringTests" | 0 | 55 authoring cases passed, zero failed/skipped. |
| dotnet build .\src\AutoForge.slnx --configuration Release --no-restore | 0 | All nine projects/native Client passed; 0 warnings, 0 errors. MAUI XAML source-generation output was informational. |
| dotnet test .\src\AutoForge.slnx --configuration Release --no-build | 0 | 179 unit + 226 integration = 405 passed, zero failed/skipped. |
| git --no-pager diff --check | 0 | No whitespace errors. Existing Git LF-to-CRLF notices for README/build guide were informational. |
| git --no-pager diff --exit-code -- prompts global.json Directory.Build.props Directory.Packages.props NuGet.Config src\AutoForge.Simulation src\AutoForge.Diagnostics src\AutoForge.Application\Features\Vehicles\Telemetry | 0 | Existing orchestration/history/dependency and Simulation/Diagnostics/recording/replay implementations unchanged before adding this report. |
Per-project Release build: AutoForge.Core, AutoForge.Diagnostics,
AutoForge.Simulation, AutoForge.Application, AutoForge.Components,
AutoForge.UI, AutoForge.Client, AutoForge.UnitTests and
AutoForge.IntegrationTests all PASSED. Eight projects remain portable net10.0;
Client remains net10.0-windows10.0.26100.0 / win-x64.
The accepted 350 baseline cases remain 179 unit + 171 integration. This step
adds 55 integration cases and deletes or weakens no baseline test.
Important exact boundaries: 32 saved revisions including baseline; 2..32 fixed
torque rows; finite inclusive model-derived scalar range; finite [1,1000] N*m
cells; identity scaling 1/offset 0. No authoring disk persistence exists.
Existing archive/gauge/replay limits and clock ownership are unchanged.
Iteration evidence:
- The initial focused command failed compilation because a concurrency test
used blocking Task.WaitAll/Result, rejected by xUnit1031 under warnings-as-
errors. It was corrected to async Task.WhenAll/WaitAsync; the barrier still
establishes simultaneous real commit attempts without sleeps/stress timing.
- The first executable focused run passed 47 cases with zero failures.
Post-green additions expanded this to 50, then final 55 cases.
- The reviewed full build/test run passed 400 cases; the final run passed 405.
There were no unresolved behavioral or build failures. Compilation failure
is not claimed as a pre-fix behavioral reproduction; authoring did not
exist before this assignment.
## Native versus controlled evidence
The real Release Windows Client was launched with a task-owned WebView2 profile
and local DevTools port 9379. A temporary Node/built-in WebSocket helper
operated the actual native WebView controls. There was no second web host,
dependency or production debug feature.
Native actions and actual results:
1. Through the existing simulation route, explicitly imported the synthetic
profile, selected its exact revision and created the warm configuration.
No session was opened by authoring. Its original export and fingerprint
were retained for exact comparison:
sha256:v1:e8991ae139b54959ec53a4fe64b08dc9bfc03feb533496cf741f2c9f3a2342da.
2. Selected that exact configuration on /calibration and created the
Synthetic configuration-derived baseline: 650 rpm plus the six original
torque rows. Saved 1250 rpm as Proposed revision 2 and the 2000-rpm
torque edit 350 N*m as Proposed revision 3.
3. Native baseline diff contained exactly the scalar 650->1250, delta +600 rpm
and table cell 360->350, delta -10 N*m. Comparing revision 2 to 3 contained
only the table cell. Baseline history inspection left the editable head
at revision 3. First-run baseline/version IDs were:
5306f3d1604d4708a204d78d53e5c745 (baseline),
bda2b90206dc42ff91ac6b35fe7d552b (revision 2),
35600482db3f418ca6d8bc93c6b783f1 (revision 3).
4. Native scalar 600 and torque 1001 saves were rejected visibly with the
same revision/count/head. An unselected/different source rejected with
the exact source-mismatch error; unconfirmed replacement rejected with
the explicit confirmation error and retained history.
5. Typed unsaved 345 while the draft was Metric/N*m, then changed global
units to Imperial. The input stayed 345 and the draft explicitly stayed
Metric/N*m. Cancel loaded a new Imperial draft showing source 350 N*m as
258.14675224704285 lbf*ft. Switching globally back to Metric and saving
untouched returned the identical revision-3 head and exact 350 N*m, with
no new history entry.
6. Returned to /simulation, selected/exported the original configuration:
its entire export was exactly unchanged, warm idle remained 650 rpm and
2000-rpm torque remained 360 N*m. An explicit subsequent dynamics session
stepped to 7 / 0.7 seconds and read actual diagnostic-frame engine speed
631.80416 rpm / Good / SYNTHETIC_DYNAMIC, not the 1250 proposal. This is
an observed unchanged-source model result, not a claim that the proposal
was tested/applied or that the model was at exact idle.
7. Closed that actual session. Reopened authoring with the same saved
revision-3 history. Confirmed explicit replacement discarded an unsaved
1500-rpm draft/history and created a new baseline with 650 rpm and torque
360 at 2000 rpm. Profile/simulation/replay routes and authoring re-entry
worked; replay remained explicitly Unloaded.
8. After the final 405-pass build, restarted the actual Client. Authoring had
no workspace and no saved configuration, confirming process-memory
lifetime rather than hidden persistence. Explicitly recreated the warm
source and repeated baseline, 1250-rpm proposal, 350-N*m cell proposal
and exact two-entry diff on the final binary. Final head was revision 3,
ID 62431277f0624fc8ba25ef4a02fcb602 in workspace
fe2a12d0aa0b47c6bbadf63961fc74b7. No native error overlay appeared.
Native observations verify the real configuration/Application/UI/editor and
normal unit/history/diff/navigation workflow. Exact concurrent/stale-head,
history-capacity, malformed-definition and source-isolation proofs are
controlled real-service tests, not attributed to human-speed native timing.
No real device, backup, approval, programming or physics application is claimed.
Cleanup PASSED: both task-owned native Client sessions completed. Only their
specific PIDs (38528 and 1512) were terminated. The task-only WebView profile
and helper were removed, no task WebView processes remained and port 9379 had
no listener. The actual app-local recording directory was inspected and
remained empty; no native recording file was created/removed by authoring.
Profiles/configurations/proposals used for native smoke were process-memory
only. Existing/default WebView data and unrelated app files/preferences were
not reset. Original Metric/Road preference values were restored and observed.
## Own post-green source-path self-review
Reviewed actual producers/consumers through exact configuration selection and
profile/module validation -> supported immutable definition/baseline ->
complete candidate -> expected workspace/source/head checks -> linear commit ->
structured diff -> routed copied draft/units/history UI.
Public entry points reviewed: CreateBaseline, ReplaceBaseline, Save, Compare,
Snapshot, template construction/Validate, and route create/replace/save/cancel/
inspect/compare plus render/unit/lifetime callbacks. Normal, invalid, boundary,
same-content, changed-back, stale/concurrent, cross-source and replacement paths
were walked against the frozen matrix.
Validation precedes every history/head/version commitment. No-change requests
still require the current source/head. Version creation/capacity mutation occurs
only after complete validation. One lock serializes real commits without an
await-held gate or external asynchronous owner. Definition/value collections
are read-only and defensively copied. Units/rerenders do not save or rebind
drafts. History inspection does not change editable head. No source mutation
or live/store/model/approval dependency is introduced.
Review improvements completed inside this step:
- Made every standalone immutable revision explicitly carry its own copied
workspace/source identity, not only inherit context through its container.
- Strengthened edited-unit assertions to exact independent factor results,
not a tolerance that could hide canonical conversion differences.
- Added 2/32 row-boundary assertions, real profile revision-2 replacement,
exact-case source/model/definition rejection, malformed table metadata
and multi-cell/reverse exact diff ordering/sign assertions.
- Improved diff parameter labeling without changing canonical results.
Affected focused checks, all nine projects and complete regressions were rerun
after review additions; the final binary was then checked natively again.
No known unresolved defect in the assigned exit contract remains.
## Documentation, scope and preservation
Updated [README.md](../README.md),
[documentation index](../docs/README.md),
[architecture](../docs/architecture.md),
[build/test guide](../docs/build-and-test.md) and the directly related status/
isolation note in [replay contracts](../docs/telemetry-replay.md). Added
[calibration authoring guide](../docs/calibration-authoring.md).
They document exact applicability/template bounds, source/head/version/diff
rules, one-workspace/32-revision lifetime, pinned versus canonical units,
no backup/test/approval/apply claims, accepted Step-08 and Step-09 pending
manual review. Step-10 programming stays separate/unimplemented.
The worktree began clean on main at 866831f and HEAD is unchanged. Existing
prompts/history/roadmap/state/assignment/shared quality gate were not edited;
this is the only new prompts file. No protected instruction file was created
or modified. The index is empty. No staging/commit/push, dependency/project/
host/schema/protocol changes or agent/automatic orchestration occurred.
All nine project references are unchanged. Core only gained the approved
calibration contracts; Simulation/Diagnostics implementations/oracles,
recording/replay behavior and source configurations remain unchanged.
Source/tests stay under src and src/tests; technical documentation stays
under docs. The separately disclosed recording refresh/navigation issue was
not changed or worked into this authoring assignment.
Remaining unassigned capabilities are programming/readback/restore/verified
backup, Tested/Approved workflow, model application, calibration-file
persistence/import/export, editable-axis/multidimensional maps, arbitrary
firmware scaling/memory, AI and hardware operations. No future step is
authorized by this report.
STOP.