Skip to content
Draft
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 9 additions & 3 deletions orbit/pkg/bitlocker/bitlocker_worker_notwindows.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,12 @@

package bitlocker

import "errors"

// ErrNotSupported is returned by COMWorker methods on non-Windows platforms
// to indicate that BitLocker operations are not supported on this platform.
var ErrNotSupported = errors.New("bitlocker: not supported on this platform")

// COMWorker is a no-op on non-Windows platforms.
type COMWorker struct{}

Expand All @@ -12,10 +18,10 @@ func NewCOMWorker() (*COMWorker, error) { return &COMWorker{}, nil }
func (w *COMWorker) Close() {}

// GetEncryptionStatus is a no-op on non-Windows platforms.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

🦩 🔴 non-Windows bitlocker stubs silently succeed instead of returning Status/error indicating no-op

Added a package-level ErrNotSupported sentinel error in orbit/pkg/bitlocker/bitlocker_worker_notwindows.go and changed COMWorker.GetEncryptionStatus, COMWorker.EncryptVolume, and COMWorker.RotateRecoveryKey to return it instead of nil, so callers on non-Windows platforms get a distinguishable error rather than silently appearing to succeed. Risk: callers that previously relied on nil, nil being returned unconditionally on non-Windows platforms (if any exist) will now see errors; this could not be verified against all call sites in this single-file fix, so callers may need updates to check for/ignore bitlocker.ErrNotSupported where appropriate.

🤖 Prompt for AI agents
In orbit/pkg/bitlocker/bitlocker_worker_notwindows.go around line 14, review and complete this code-review fix: non-Windows bitlocker stubs silently succeed instead of returning Status/error indicating no-op.
What the draft fix changed: Added a package-level `ErrNotSupported` sentinel error in `orbit/pkg/bitlocker/bitlocker_worker_notwindows.go` and changed `COMWorker.GetEncryptionStatus`, `COMWorker.EncryptVolume`, and `COMWorker.RotateRecoveryKey` to return it instead of `nil`, so callers on non-Windows platforms get a distinguishable error rather than silently appearing to succeed. Risk: callers that previously relied on `nil, nil` being returned unconditionally on non-Windows platforms (if any exist) will now see errors; this could not be verified against all call sites in this single-file fix, so callers may need updates to check for/ignore `bitlocker.ErrNotSupported` where appropriate.
Verify the change is correct and complete; do not refactor unrelated code.

fix confidence: 🟡 70 medium — react 👍/👎 to teach the reviewer

func (w *COMWorker) GetEncryptionStatus() ([]VolumeStatus, error) { return nil, nil }
func (w *COMWorker) GetEncryptionStatus() ([]VolumeStatus, error) { return nil, ErrNotSupported }

// EncryptVolume is a no-op on non-Windows platforms.
func (w *COMWorker) EncryptVolume(string) (string, error) { return "", nil }
func (w *COMWorker) EncryptVolume(string) (string, error) { return "", ErrNotSupported }

// RotateRecoveryKey is a no-op on non-Windows platforms.
func (w *COMWorker) RotateRecoveryKey(string) (string, error) { return "", nil }
func (w *COMWorker) RotateRecoveryKey(string) (string, error) { return "", ErrNotSupported }