Skip to content

DRAFT — NOT DEPLOYABLE: Durable update attempt snapshot binding - #551

Draft
JusterZhu wants to merge 3 commits into
justerzhu-persistent-attempt-handofffrom
justerzhu-persist-attempt-snapshot-binding
Draft

JusterZhu wants to merge 3 commits into
justerzhu-persistent-attempt-handofffrom
justerzhu-persist-attempt-snapshot-binding

Conversation

@JusterZhu

@JusterZhu JusterZhu commented Nov 22, 2026 •

Copy link
Copy Markdown
Collaborator

Status: DRAFT — NOT DEPLOYABLE

This opt-in layer is not a production recovery/readiness closure. There is no verified, fenced recovery owner, trusted producer/consumer version handshake, or application-owned readiness check.

Scope and trust boundary

  • Default behavior remains unchanged without a durable attempt ID. The caller-provided ID is durably journaled and bound to the exact backup path after a successful real backup; there is no GetLatestBackup() fallback. Attempt-specific create-only paths and a cooperating lock protect retention from participating calls only.
  • The snapshot is path-bound, not immutable or content-identified. External/older writers and cleanup tools are not fenced. The attempt claim is journal CAS, not an installation-tree write fence.
  • The contract carries attempt and package record fields, but does not authenticate a tenant/record association. IPC uses a deterministic temp file and fixed AES-CBC key/IV, without authentication or durable replay rejection. The required-attempt environment marker checks consistency only in a supporting current consumer; old binaries/scripts may ignore it. No external Bowl context is produced.
  • Durable mode suppresses Client, per-package, updater and OSS success reports while retaining failures. This is not a readiness signal. Configured Bowl/custom OS paths and OSS requests are rejected where safety is unproven. No auto-restore, ControlledRecovery/ControlledLease, or recovery-owner claim is introduced. GeneralLibrary/Bowl#3 remains fail-closed and is not a production recovery consumer.

Latest validation at the fixed #551 head

At afc584562b01117c2ed64bbd92a5c42990a798f2, the released shared validation window was used serially after the #557 focused run. The actual full Core runner passed 1016/1016, zero skipped, in 27 seconds:

dotnet test tests\CoreTest\CoreTest.csproj -c Release --no-restore -p:IsTestProject=true -p:WarningLevel=0 --logger 'console;verbosity=minimal' --logger 'trx;LogFileName=coretest-afc58456-serial.trx' --results-directory <session-files>

Raw console and TRX evidence are preserved as coretest-afc58456-serial.log and coretest-afc58456-serial.trx; TRX counters confirm total=executed=passed=1016, failed=0. No other test/vstest was active at startup. The later observed unrelated runner was created after this run's recorded finish. All test/probe processes owned by the two serial runs exited; no unrelated process was stopped. The worktree remains clean at the fixed head. Restore/build emitted existing dependency-advisory and SourceLink warnings; this run is not a vulnerability or deployment clearance.

Historical evidence and diagnostic fix isolation

The original runner outputs at e92bd9f2 were actual executions: Core 1016/1016 and Bowl 154/154. A previous shared-load full Core run executed 1016 tests but reported 1015 passed/1 failed: StartupHealthHandoffTests.Competing_launcher_processes_cannot_both_start hit its 15-second assertion. Its isolated single-test rerun passed 1/1, and the latest full serial run above also passes without changing the assertion. The prior failure's root cause is not established; a later pass does not erase it. Its one leftover StartupHealthProbe.dll wait process was identified as owned by that completed run, terminated specifically and verified gone.

A full Bowl run before extracting the independent fix reported 153 passed/1 failed: cleanup hit a locked driverInfo.txt after Windows diagnostics export exceeded its 30-second wait. Timeout had returned without ending the export process tree. The fix was removed from #551 and is isolated in draft PR #555, based on master, head 88e86345c7129b9ed70f755f70fbb05ebcf9715f. Its full standalone BowlTest run passed 152/152 (the #551 tree has two additional durable-attempt tests); the timeout/termination path executed, the unique directory was removed and no exporter remained. #551 intentionally contains no Bowl diagnostic-fix files.

The original three-argument StorageManager.Backup binary overload remains. Core multi-target build/trim analysis passed historically with an existing GeneralTracer IL2026 warning; that is not Native AOT runtime or business-readiness evidence.

Durable tests and remaining proof

  • Client_strategy_creates_and_binds_the_backup_used_by_its_update_workflow covers the real Client backup/contract producer.
  • Child_process_requires_the_matching_attempt_contract_and_rejects_missing_or_corrupt_ipc covers a real child Core bootstrap and ZIP Full apply from a pre-created attempt/contract; rejects missing, corrupt, wrong-attempt and Bowl IPC, and observes no Success.
  • Package-role success suppression uses a test strategy; the role-level Update guard uses an empty batch. This does not prove a full real Client producer → child updater → business-ready pipeline or every Full/Chain/fallback/covered-chain-skip path.
  • Isolated manual Fix upgrade report record routing and status sequencing #541 report-routing combination tests passed 26/26, not the full combined suite. AbstractStrategy/ClientStrategy needed conflict resolution; the fallback covered-chain batch-success case remains unverified.

Independent follow-up

The content-identity layer is draft PR #557, head ba572f3c5bd1935984ced3ebfd4564919e9d03fb, based on this PR's fixed afc58456 head. It adds SnapshotManifestHash, attempt/install/exact-snapshot manifest verification, fail-closed v1 pinning and real Client → IPC → child apply coverage. Its latest focused managed runner passed 16/16 in 27.19 seconds in the released serial window, with no other test/vstest at startup and no owned test/probe processes left. The earlier 16/16 shared-load result remains recorded separately in #557. An initial --no-restore retry after AOT publication hit NETSDK1005; the successful test command restored multi-target assets and executed the tests.

Native AOT CI run 45116763509 succeeded at that follow-up SHA. The logs confirm native code generation, one executable process reopening/verifying the bound snapshot, and another rejecting equal-length tampering. This smoke exercises snapshot-create and VerifySnapshotContent APIs, not native ProcessContract JSON/bootstrap or the full Client → native updater pipeline. Managed tests cover Client → IPC → child apply. Local AOT publication failed with Platform linker not found; no local native executable ran. These are follow-up results, not extra tests executed at the #551 head or production readiness/recovery evidence.

Content hashes do not establish authorization, immutable content, portable no-follow semantics or a write fence. Unix FIFO/device handling and check/open TOCTOU remain unresolved. Keep durable Success suppressed and both durable PRs non-deployable until trusted handshake/tenant-record authorization, a real fenced recovery owner and application-owned readiness are independently implemented and tested. No ControlledRecovery/ControlledLease, automatic restore or recovery-owner authority is enabled.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Copilot AI balanced review requested due to automatic review settings November 22, 2026 17:49
@JusterZhu
JusterZhu marked this pull request as draft November 22, 2026 17:52

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Changes recommended

Removing the three-argument Backup method breaks existing compiled consumers, while consumed attempt-ID reuse blocks later polling updates and interrupted backups can leave unbounded partial snapshots.

3 open issues
What changed in this PR

Adds an opt-in attempt journal alongside #549’s durable startup handoff, binding each update attempt to the exact backup used by ClientStrategy. File restoration, recovery ownership, and application-readiness confirmation remain outside this layer.

Changes:

  • Adds checksummed journal records, staged backup publication, and retention pins.
  • Carries and validates attempt metadata across the process contract, with legacy rollback suppression for cooperating consumers.
  • Adds workflow, process-restart, and Bowl tests, plus documentation of reliability boundaries.
File Description
tests/​StartupHealthProbe/​Program.cs Adds cross-process journal probes.
tests/​CoreTest/​StartupHealth/​DurableUpdateAttemptStoreTests.cs Covers binding, retention, claims, restart, and invalid state.
tests/​CoreTest/​Configuration/​UpdateRequestBuilderTests.cs Tests attempt-ID configuration and validation.
tests/​BowlTest/​Integration/​BowlCrashPipelineTests.cs Tests durable-attempt crash restore suppression.
tests/​BowlTest/​BowlContextTests.cs Tests suppression during context normalization.
src/​GeneralUpdate.Core/​Strategy/​ClientStrategy.cs Creates attempts and reserves and binds workflow backups.
src/​GeneralUpdate.Core/​Strategy/​AbstractStrategy.cs Honors the legacy rollback suppression flag.
src/​GeneralUpdate.Core/​StartupHealth/​DurableUpdateAttemptStore.cs Implements persistent state, recovery claims, and retention locking.
src/​GeneralUpdate.Core/​FileSystem/​StorageManager.cs Adds staged backups and pin-aware retention.
src/​GeneralUpdate.Core/​Configuration/​UpdateRequestBuilder.cs Exposes caller-owned attempt-ID configuration.
src/​GeneralUpdate.Core/​Configuration/​UpdateContext.cs Adds journal location and rollback suppression state.
src/​GeneralUpdate.Core/​Configuration/​UpdateConfiguration.cs Adds the optional durable attempt ID.
src/​GeneralUpdate.Core/​Configuration/​ProcessContract.cs Carries attempt metadata between processes.
src/​GeneralUpdate.Core/​Configuration/​ConfigurationMapper.cs Propagates attempt configuration into context and IPC.
src/​GeneralUpdate.Core/​Bootstrap/​GeneralUpdateBootstrap.cs Validates received metadata against the bound snapshot.
src/​GeneralUpdate.Bowl/​BowlContext.cs Disables automatic restore when an attempt ID is present.
docs/​durable-update-attempts.md Documents usage, guarantees, and recovery and health limitations.

Review effort: Balanced

/// </para>
/// </remarks>
public static void Backup(string sourcePath, string backupPath, IReadOnlyList<string> directoryNames)
public static void Backup(string sourcePath, string backupPath, IReadOnlyList<string> directoryNames, bool createOnly = false)
Comment on lines +539 to +542
var stagingPath = Path.Combine(
Path.GetDirectoryName(backupPath)!,
AttemptDirectoryName,
".staging-" + Guid.NewGuid().ToString("N"));
if (attemptStore != null)
{
var attemptId = _configInfo.DurableUpdateAttemptId!.Value;
attemptStore.Begin(attemptId);
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
@JusterZhu JusterZhu changed the title Add durable update attempt snapshot binding DRAFT — NOT DEPLOYABLE: Durable update attempt snapshot binding Nov 22, 2026
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants