1.6.6 hardening follow-up: copy-ctor drift detector + doc fixes + stale test fix
Summary
Three follow-ups from the P0 deep code review (PRs #285-#288), plus a broken-main fix surfaced during review:
-
VariableDtocopy-constructor + reflection-based drift detector — replaces the fragile 14-field manual clone inExecuteStepsPhase.EncryptIfSensitive. Future field additions toVariableDtoare caught by the drift detector at PR review, not silently in production checkpoint round-trips. -
P0-5 doc-code drift fix (no behaviour change) — the comment said "doubles" but the code uses
× 3. The doc also claimed "cumulative ~2.6s" but only ~800ms of backoff actually applies with MaxAttempts=3. Doc now states the exact sequence (200ms → 600ms → terminal-error). -
Stale-test fix from #288 merge-order —
CheckpointPersistRetryTests(added by #288) was branched before #286 merged. The squash-merge produced no conflict because the test file had no overlap with #286's changes, BUT the test'snew ExecuteStepsPhase(...)call was missing theIVariableEncryptionServiceparam. main has been failing to build since #288 merged — this PR is the fix.
Test plan
-
VariableDtoCopyConstructorTests: 5 casesCopyConstructor_NullSource_Throws-
CopyConstructor_PreservesAllPublicProperties— reflection-based drift detector -
CopyConstructor_ScopesIsSharedReference_DocumentedShallowCopyContract— pins the documented shallow-copy contract for Scopes CopyConstructor_SourceMutationAfterClone_DoesNotAffectClone_ForValueTypes-
CopyConstructor_AllowsValueOverrideViaObjectInitializer— confirmsnew VariableDto(v) { Value = ... }works for the encrypt-for-checkpoint use case
-
CheckpointPersistRetryTests6/6 pass after stale-test fix -
Full unit suite: 5129/5129
Why this PR before 1.6.6 release
- main is broken right now (build error from stale test) — nobody can sync
- P0-3's silent-clone fragility is the kind of bug that ships and bites in 6 months
- P0-5's doc-code drift sets a bad precedent (test passed because the doc claim 200ms/600ms cumulative ≥700ms happened to align with
× 3's actual 800ms)
All three are small, focused, and well-tested. Should land before 1.6.6 cut.