From 96c3687e3b384397c219259b4265fa99d8c3dbf2 Mon Sep 17 00:00:00 2001 From: Muse Sweep Date: Sun, 18 Oct 2026 20:07:11 -0500 Subject: [PATCH] test(mcpx): pin EnsureDaemon remote-cancelled context in this copy Port TestEnsureDaemonRemoteCancelledContext from dezren39/nix's mcpx copy: a cancelled context against a remote endpoint must report context.Canceled, not the generic 'no mcpx daemon at ...' error. Refs https://github.com/dezren39/nix/issues/437 --- pkgs/mcpx/internal/cli/ensuredaemon_test.go | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/pkgs/mcpx/internal/cli/ensuredaemon_test.go b/pkgs/mcpx/internal/cli/ensuredaemon_test.go index 43abd37f57..8c98e758cd 100644 --- a/pkgs/mcpx/internal/cli/ensuredaemon_test.go +++ b/pkgs/mcpx/internal/cli/ensuredaemon_test.go @@ -92,3 +92,14 @@ func TestEnsureDaemonNeverReadyStillTimesOut(t *testing.T) { t.Fatal("the fake daemon was never spawned") } } + +// A cancelled context against a remote endpoint reports the cancellation, +// not the generic "no daemon there" error. +func TestEnsureDaemonRemoteCancelledContext(t *testing.T) { + c := NewClientAt(daemon.Paths{}, "", "http://127.0.0.1:1") + ctx, cancel := context.WithCancel(context.Background()) + cancel() + if err := c.EnsureDaemon(ctx); !errors.Is(err, context.Canceled) { + t.Fatalf("EnsureDaemon(remote, cancelled ctx) = %v, want context.Canceled", err) + } +}