Repository navigation
test(backups): drive backup and a cancellable long operation against a published daemon - #76
Merged
Merged
Conversation
Lift PublishedDaemonFixture out of PublishedInstanceHealthPluginTests so a second published-host test class can boot a daemon without depending on the plugin-load tests. Behaviour is unchanged: the class moves verbatim, taking the StartupTimeout default it already used with it.
…a published daemon Close the recorded SDK-9b/MCP-6 gap without a daemon-side fake operation. The test creates a minimal instance over mcsl.instance.create, seeds its working directory with incompressible bytes, then runs mcsl.backup.create, a restore that is cancelled mid-flight, and a restore that completes. The archived payload is what makes the restore long enough to cancel before its staging swap, so an archive that fails to capture it is asserted rather than silently turning the cancel assertion into a tautology. The fixture gains a plugin opt-out because these are built-in RPCs; skipping the plugin payloads also skips the SDK pack and publish they require.
Spec section 7 says an executor that has committed its side effects keeps its terminal status; the coordinator downgraded it to cancelled at both override sites regardless. Restore made that concrete and destructive: nothing observed the token between extraction finishing and the working directory being swapped and the original tree deleted, so a late cancel reported cancelled over a restore that had already happened. Add an internal commit-point seam the coordinator owns, set it in the restore immediately after its last cooperative check, and let both override sites respect it. The seam is internal on purpose — the packaged Daemon.API surface does not change. Wiring the remaining executors is deliberately out of scope.
Waiting for Running exited at stage Resolving, so the cancel landed during the checksum verify and the per-entry extraction cancel path was never exercised. Wait for Extracting instead, and give the timing-sensitive assertions failure messages that name the cause and dump the observed status/stage trail. Also drop two assertions that could not fail: the archive size guard now also checks the on-disk zip size, and the manual-recovery check moves off the daemon log, where that string never appears, onto the terminal error code. The docs note now lists what the suite covers and what it still does not.
AresConnor
force-pushed
the
feat/published-host-backup-e2e
branch
from
August 1, 2026 08:55
39bdb03 to
80a5586
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Closes the coverage gap carried out of SDK-9b as the first MCP-6 item: the published-host suite now drives
mcsl.backup.*end-to-end against a published daemon and runs, polls, and cancels a real long-running operation. Along the way the adversarial review of this branch surfaced a spec §7 violation in the operation coordinator, fixed here because the e2e's central assertion depends on it.The daemon fix (
fix(operations))Spec §7 ("Result/cancellation race"): a committed executor outcome must not be downgraded to
cancelled. Both coordinator override sites did exactly that downgrade unconditionally. Forbackup.restore.executethis was destructive: no cancellation check existed between extraction finishing and the working-directory swap + retired-tree delete, so a late cancel reportedcancelledover a restore that had fully happened — with the pre-restore tree already deleted.Fix: an internal commit-point seam (
IOperationCommitPoint, daemon-internal on purpose — the packaged Daemon.API surface is byte-identical, ApiTests prove it). The restore performs a finalThrowIfCancellationRequestedand thenMarkCommitted()immediately before the first swap move; both override sites skip the downgrade once committed. After this fix,Cancelled ⇔ the swap never happenedis a real guarantee, and the e2e asserts it.Negative control: reverting one override guard alone makes exactly the
markCommitted: truetheory case fail; restored and re-verified.The remaining executors (
provisioning.execute,backup.create, automation intent) still lack commit points — tracked as #73, deliberately out of scope here.The e2e (
test(backups))One scenario against a published daemon with no plugins: create a minimal MCJava instance (empty
server.jarvia the passthrough installer; the version detector tolerating an unrecognized jar is documented at the call site), seed 256 MiB of incompressible data plus a marker file, then:backup.create→ operation observedRunning, polled toSucceeded;backup.listshows the archive (bothTotalSizeBytesand the on-diskCompressedSizeBytesasserted ≥ seed).restore.plan → confirm (hash echo) → execute; wait until the operation is observed at stageExtracting, thenmcsl.operation.cancel; assertCancelled, the observed stage trail includesExtracting, and the working directory was not swapped.Succeeded; marker restored to its original content.All poll loops carry terminal early-exits and diagnostic trails; the previously vacuous log assertion now checks the terminal snapshot's
ErrorCode. ThePublishedDaemonFixturewas extracted verbatim fromPublishedInstanceHealthPluginTests(verified line-by-line in review) so both test classes share it.Review provenance
Multi-agent adversarial review (3 dimensions → per-finding adversarial verification): 14 confirmed findings, all addressed in the last two commits — including the daemon fix, cancel-phase pinning (the original cancel landed during checksum verify, not extraction), and assertion-strength repairs.
Verification
/m:1: 1375/1375. (The two historically "environmental" symlink failures no longer exist on the dev host — Developer Mode enables unprivilegedDirectory.CreateSymbolicLink; nothing is excused.)git diff --checkclean. Zero changes to the packaged surface;docs/preview2-package-pin.mdgap note updated to state exactly what is and is not covered (noprune, noMaintenance:truebackup of a running instance).