Repository navigation
test(#18): orchestrator behavioral tests (step sequencing, failure rollback, lock/session lifecycle) + output-stream fix - #63
Conversation
…SEBRestore/Undo-SEBRestore (step sequencing, failure rollback, lock/session lifecycle) Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
|
Caution Review failedPull request was closed or merged during review 📝 WalkthroughWalkthroughBackup and restore now discard helper-call output so the cmdlets emit only intended results. New Pester suites cover backup, restore, and undo success, failure, option, and rollback paths. ChangesOrchestrator output suppression and test coverage
Estimated code review effort🎯 4 (Complex) | ⏱️ ~60 minutes Possibly related PRs
Poem
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Pull request overview
Adds high-value behavioral coverage for the backup/restore orchestrators (including failure rollback and lifecycle cleanup) and fixes output-stream hygiene so orchestrators reliably return a single result object as documented.
Changes:
- Introduces comprehensive Pester behavioral tests for
Invoke-SEBBackupandInvoke-SEBRestore, asserting step sequencing and failure-path cleanup/rollback behavior. - Expands
Undo-SEBRestorelifecycle tests to cover additional abort paths and notification behavior. - Applies
| Out-Nullat side-effect-only seams (andCopy-SEBThrottled/Compress-SEBArchiveresults) to prevent unintended objects from leaking into orchestrator output streams.
Reviewed changes
Copilot reviewed 5 out of 5 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| Tests/RestoreEngine/Undo-SEBRestore.Tests.ps1 | Adds new undo failure-path and notification/lifecycle assertions. |
| Tests/RestoreEngine/Invoke-SEBRestore.Tests.ps1 | New restore orchestrator behavioral suite (happy path + failure injection + contracts). |
| Tests/BackupEngine/Invoke-SEBBackup.Tests.ps1 | New backup orchestrator behavioral suite, including output-stream contract pinning. |
| Modules/RestoreEngine/Public/Invoke-SEBRestore.ps1 | Discards unused seam outputs to preserve single-object .OUTPUTS contract. |
| Modules/BackupEngine/Public/Invoke-SEBBackup.ps1 | Discards unused seam outputs to prevent output-stream leakage into caller results. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| } | ||
|
|
||
| Mock Get-SEBSharePath -ModuleName RestoreEngine { '\\node01\SEBackup$' } | ||
| Mock Copy-SEBThrottled -ModuleName RestoreEngine {} |
…-failure state; retention/empty-delta/order coverage (review) Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Implements #18 — behavioral orchestrator tests with the infra boundary mocked. 59 new tests; suite 1128 → 1187; build.ps1 BUILD OK.
Coverage before → after
Invoke-SEBBackupInvoke-SEBRestoreUndo-SEBRestoreWhat's tested (the high-value part is failure rollback, not the happy path)
Should -Invoke.finally.-WhatIfperforms no mutating seam calls.finallylock-release, or the output fix each makes a test fail.Source fix (behavior-preserving)
Found a real output-stream-hygiene defect: several data-path seams (
Compress-SEBArchive,Copy-SEBThrottled, side-effect-only remote blocks) had uncaptured[PSCustomObject]results, so$result = Invoke-SEBBackup ...actually returned an array@(compressObj, …, $result)rather than the documented singlePSCustomObject— it only "worked" because the leaked objects lack a.Successmember. Fixed with| Out-Null(5 sites in backup, 6 in restore) + comments; no logic change. Pinned by@($r).Count | Should -Be 1+Should -BeOfType PSCustomObject.No Private seam extraction was needed — every branch was reachable by mocking existing SEB functions. Contract tests stay 496/496 green.
Closes #18.
🤖 Generated with Claude Code
Summary by CodeRabbit