From 8b6513581c8a53842a2db84556b171fa6cd0a0c3 Mon Sep 17 00:00:00 2001 From: "pulse-triage[bot]" <249995291+pulse-triage[bot]@users.noreply.github.com> Date: Sun, 4 Oct 2026 18:47:43 +0100 Subject: [PATCH] Align Discovery controls with explicit VM cancellation truth Keep the generic catalogue-error fixture distinct from unknown timed-out guest handoff, and require the existing canceled-VM control to expose a safety deferral without dispatch. The new completion/cancellation parent failures and full-source adverse result remain retained; no production behavior changes in this commit. Contract-Neutral: Test-only correction records the existing guest cancellation and ordinary-command error contracts without changing production source, APIs, protocol or time budgets. Change-source: pulse-maintainer --- internal/servicediscovery/deep_scanner_test.go | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/internal/servicediscovery/deep_scanner_test.go b/internal/servicediscovery/deep_scanner_test.go index 4ab6ae1205..7482abd530 100644 --- a/internal/servicediscovery/deep_scanner_test.go +++ b/internal/servicediscovery/deep_scanner_test.go @@ -3,11 +3,13 @@ package servicediscovery import ( "bytes" "context" + "errors" "strings" "sync" "testing" "time" + "github.com/rcourtman/pulse-go-rewrite/internal/agentexec" "github.com/rs/zerolog" "github.com/rs/zerolog/log" ) @@ -80,7 +82,9 @@ func (outputExecutor) IsAgentConnected(string) bool { return true } type errorExecutor struct{} func (errorExecutor) ExecuteCommand(ctx context.Context, agentID string, cmd ExecuteCommandPayload) (*CommandResultPayload, error) { - return nil, context.DeadlineExceeded + // This control covers ordinary catalogue failure, not an uncertain + // timed-out VM handoff (which now stops the scan in its own controls). + return nil, errors.New("fixture command failed") } func (errorExecutor) GetConnectedAgents() []ConnectedAgent { @@ -393,8 +397,8 @@ func TestDeepScanner_ScanCanceledContext(t *testing.T) { ResourceID: "101:web", TargetID: "host1", Hostname: "host1", - }); err != nil { - t.Fatalf("Scan error: %v", err) + }); err == nil || !agentexec.IsGuestExecDeferred(err.Error()) || len(exec.commands) != 0 { + t.Fatalf("canceled VM scan must defer before dispatch: err=%v commands=%v", err, exec.commands) } }