From 96d4a9fb12afa7eb403a5f63e5433084e9837c6b Mon Sep 17 00:00:00 2001 From: Claude Date: Wed, 18 Nov 2026 18:27:00 +0000 Subject: [PATCH] test(mcpx): probe artifacts.interceptImages and plumbing.indexOnQuery (#8473 chain 33) artifacts.interceptImages: an emitted image block becomes an artifact only while interception is on. plumbing.indexOnQuery: `mcpx log` shows the daemon's start only when it ingests before querying. EffectExemptionPin 119 -> 117. Co-Authored-By: Claude Opus 5.5 --- pkgs/mcpx/internal/e2e/effect_test.go | 48 +++++++++++++++++++ .../e2e/feature_coverage_exemptions.txt | 2 - pkgs/mcpx/internal/settings/effect.go | 6 +-- 3 files changed, 51 insertions(+), 5 deletions(-) diff --git a/pkgs/mcpx/internal/e2e/effect_test.go b/pkgs/mcpx/internal/e2e/effect_test.go index 62862b36fc..6bfc4d312a 100644 --- a/pkgs/mcpx/internal/e2e/effect_test.go +++ b/pkgs/mcpx/internal/e2e/effect_test.go @@ -101,6 +101,8 @@ var implementedEffectProbes = map[string]string{ "protoTasks.maxPerRequestor": "TestProtoTasksMaxPerRequestorCapsUnfinishedTasksFromTheEnvironment", "protoTasks.perMinute": "TestProtoTasksPerMinuteWindowsTaskReadsFromTheEnvironment", "events.history": "TestEventsHistoryBoundsTheReplay", + "artifacts.interceptImages": "TestArtifactsInterceptImagesStoresAnEmittedImage", + "plumbing.indexOnQuery": "TestPlumbingIndexOnQueryIngestsBeforeALogQuery", "plumbing.validatePaths": "TestPlumbingValidatePathsChecksTheLogDirUpFront", "script.language": "TestScriptLanguageRunsPython", "logging.trace": "TestLoggingTraceLogsEachCall", @@ -229,6 +231,8 @@ var effectProbeFuncs = map[string]func(*testing.T){ "TestProtoTasksMaxPerRequestorCapsUnfinishedTasksFromTheEnvironment": TestProtoTasksMaxPerRequestorCapsUnfinishedTasksFromTheEnvironment, "TestProtoTasksPerMinuteWindowsTaskReadsFromTheEnvironment": TestProtoTasksPerMinuteWindowsTaskReadsFromTheEnvironment, "TestEventsHistoryBoundsTheReplay": TestEventsHistoryBoundsTheReplay, + "TestArtifactsInterceptImagesStoresAnEmittedImage": TestArtifactsInterceptImagesStoresAnEmittedImage, + "TestPlumbingIndexOnQueryIngestsBeforeALogQuery": TestPlumbingIndexOnQueryIngestsBeforeALogQuery, "TestPlumbingValidatePathsChecksTheLogDirUpFront": TestPlumbingValidatePathsChecksTheLogDirUpFront, "TestScriptLanguageRunsPython": TestScriptLanguageRunsPython, "TestLoggingTraceLogsEachCall": TestLoggingTraceLogsEachCall, @@ -2380,6 +2384,50 @@ func TestScriptLanguageRunsPython(t *testing.T) { } } +// TestArtifactsInterceptImagesStoresAnEmittedImage is the effect probe for +// artifacts.interceptImages: an image block a script emits is captured as +// an artifact by default, and left alone once interception is off. +func TestArtifactsInterceptImagesStoresAnEmittedImage(t *testing.T) { + const script = `emit({ type: "image", data: "iVBORw0KGgo=", mimeType: "image/png" })` + run := func(env ...string) string { + e := newEnv(t, oneServer) + e.setenv(env...) + out, err := e.try("exec", "--json", script) + if err != nil { + t.Fatalf("exec: %v\n%s", err, out) + } + return out + } + if out := run(); !strings.Contains(out, `"name": "image.png"`) { + t.Errorf("by default an emitted image should become an artifact:\n%s", out) + } + if out := run("MCPX_ARTIFACTS_INTERCEPT_IMAGES=false"); strings.Contains(out, `"name": "image.png"`) { + t.Errorf("with artifacts.interceptImages off the image should not be stored:\n%s", out) + } +} + +// TestPlumbingIndexOnQueryIngestsBeforeALogQuery is the effect probe for +// plumbing.indexOnQuery: `mcpx log` reads the daemon's records by default, +// and answers from the empty index alone once ingest-on-query is off. +func TestPlumbingIndexOnQueryIngestsBeforeALogQuery(t *testing.T) { + query := func(env ...string) string { + e := newEnv(t, oneServer) + e.setenv(append([]string{"MCPX_LOGGING_DIR=" + filepath.Join(t.TempDir(), "logs")}, env...)...) + e.run("ls") + out, se, err := e.split("log") + if err != nil { + t.Fatalf("log: %v\n%s", err, se) + } + return out + } + if out := query(); !strings.Contains(out, "daemon starting") { + t.Errorf("by default `mcpx log` should ingest and show the daemon's start:\n%s", out) + } + if out := query("MCPX_PLUMBING_INDEX_ON_QUERY=false"); strings.Contains(out, "daemon starting") { + t.Errorf("with plumbing.indexOnQuery off nothing should have been ingested:\n%s", out) + } +} + // TestDaemonAddressIsReachableFromTheEnvironment is the effect probe // for daemon.address (#8468 chain 1). The exemption it replaced said // a bind address is a network identity the harness cannot vary diff --git a/pkgs/mcpx/internal/e2e/feature_coverage_exemptions.txt b/pkgs/mcpx/internal/e2e/feature_coverage_exemptions.txt index cb09246a28..f125993ae4 100644 --- a/pkgs/mcpx/internal/e2e/feature_coverage_exemptions.txt +++ b/pkgs/mcpx/internal/e2e/feature_coverage_exemptions.txt @@ -105,7 +105,6 @@ setting prompt.sampleTimeout no integration-test exercise yet; burn-down #8471 ( setting artifacts.chunkBytes no integration-test exercise yet; burn-down #8470 (settings long-tail families); needs an EffectProbes entry + e2e test setting artifacts.gcInterval no integration-test exercise yet; burn-down #8470 (settings long-tail families); needs an EffectProbes entry + e2e test setting artifacts.idleTtl no integration-test exercise yet; burn-down #8470 (settings long-tail families); needs an EffectProbes entry + e2e test -setting artifacts.interceptImages no integration-test exercise yet; burn-down #8470 (settings long-tail families); needs an EffectProbes entry + e2e test setting artifacts.maxAge no integration-test exercise yet; burn-down #8470 (settings long-tail families); needs an EffectProbes entry + e2e test setting artifacts.ttl no integration-test exercise yet; burn-down #8470 (settings long-tail families); needs an EffectProbes entry + e2e test setting autonomy.max no integration-test exercise yet; burn-down #8470 (settings long-tail families); needs an EffectProbes entry + e2e test @@ -123,7 +122,6 @@ setting doctor.timeout no integration-test exercise yet; burn-down #8470 (settin setting events.reconnect no integration-test exercise yet; burn-down #8470 (settings long-tail families); needs an EffectProbes entry + e2e test setting hooks.autonomy no integration-test exercise yet; burn-down #8470 (settings long-tail families); needs an EffectProbes entry + e2e test setting plumbing.allowTsJsOverlap no integration-test exercise yet; burn-down #8470 (settings long-tail families); needs an EffectProbes entry + e2e test -setting plumbing.indexOnQuery no integration-test exercise yet; burn-down #8470 (settings long-tail families); needs an EffectProbes entry + e2e test setting plumbing.launcherPlaceholderRepeat no integration-test exercise yet; burn-down #8470 (settings long-tail families); needs an EffectProbes entry + e2e test setting plumbing.sourceDirAllowed no integration-test exercise yet; burn-down #8470 (settings long-tail families); needs an EffectProbes entry + e2e test setting plumbing.sourceDirRecursive no integration-test exercise yet; burn-down #8470 (settings long-tail families); needs an EffectProbes entry + e2e test diff --git a/pkgs/mcpx/internal/settings/effect.go b/pkgs/mcpx/internal/settings/effect.go index 0b07ae0783..b8f86b72a3 100644 --- a/pkgs/mcpx/internal/settings/effect.go +++ b/pkgs/mcpx/internal/settings/effect.go @@ -101,6 +101,8 @@ var EffectProbes = map[string]string{ "protoTasks.maxPerRequestor": "TestProtoTasksMaxPerRequestorCapsUnfinishedTasksFromTheEnvironment", "protoTasks.perMinute": "TestProtoTasksPerMinuteWindowsTaskReadsFromTheEnvironment", "events.history": "TestEventsHistoryBoundsTheReplay", + "artifacts.interceptImages": "TestArtifactsInterceptImagesStoresAnEmittedImage", + "plumbing.indexOnQuery": "TestPlumbingIndexOnQueryIngestsBeforeALogQuery", "plumbing.validatePaths": "TestPlumbingValidatePathsChecksTheLogDirUpFront", "script.language": "TestScriptLanguageRunsPython", "logging.trace": "TestLoggingTraceLogsEachCall", @@ -185,7 +187,6 @@ var EffectExemptions = map[string]string{ "artifacts.maxAge": "artifact store behaviour: its effect needs artifact-producing calls plus volume or time (ttl, quota, gc) that the fake server's fixtures do not drive", "artifacts.chunkBytes": "artifact store behaviour: its effect needs artifact-producing calls plus volume or time (ttl, quota, gc) that the fake server's fixtures do not drive", "artifacts.gcInterval": "artifact store behaviour: its effect needs artifact-producing calls plus volume or time (ttl, quota, gc) that the fake server's fixtures do not drive", - "artifacts.interceptImages": "artifact store behaviour: its effect needs artifact-producing calls plus volume or time (ttl, quota, gc) that the fake server's fixtures do not drive", "paths.config": "a discovery search path: its effect appears only when fixture content exists solely on that path, which the harness does not plant per-path", "paths.placeholders": "a discovery search path: its effect appears only when fixture content exists solely on that path, which the harness does not plant per-path", "daemon.tsnetUpTimeout": "tsnet bring-up needs a tailnet the harness does not have", @@ -206,7 +207,6 @@ var EffectExemptions = map[string]string{ "plumbing.sourceDirAllowed": "plumbing switch: the branch it guards is read in its own package, but no e2e with/without probe exists yet - plumbing is the ratchet's expected bulk", "plumbing.sourceProbePaths": "plumbing switch: the branch it guards is read in its own package, but no e2e with/without probe exists yet - plumbing is the ratchet's expected bulk", "plumbing.launcherPlaceholderRepeat": "plumbing switch: the branch it guards is read in its own package, but no e2e with/without probe exists yet - plumbing is the ratchet's expected bulk", - "plumbing.indexOnQuery": "plumbing switch: the branch it guards is read in its own package, but no e2e with/without probe exists yet - plumbing is the ratchet's expected bulk", "elicit.disambiguate": "elicitation flow: its effect needs an interactive client answering (or not answering) inside that window; ask fixtures cover the flow, not this bound", "elicit.disambiguateDefault": "elicitation flow: its effect needs an interactive client answering (or not answering) inside that window; ask fixtures cover the flow, not this bound", "elicit.confirmDestructive": "elicitation flow: its effect needs an interactive client answering (or not answering) inside that window; ask fixtures cover the flow, not this bound", @@ -290,7 +290,7 @@ var EffectExemptions = map[string]string{ // EffectExemptionPin is the ratchet: the exemption count at the time // the guard landed. It may only ever be lowered, and only in the PR // that removes an exemption by adding the probe that replaces it. -const EffectExemptionPin = 119 // Shrunk 2026-11-18 (#8473 chain 32): plumbing.validatePaths and script.language gained probes. Earlier shrunk 2026-11-18 (#8473 chain 31): logging.trace and exec.where gained probes. Earlier shrunk 2026-11-18 (#8473 chain 30): paths.adapters and paths.apis gained declaration-file probes. Earlier shrunk 2026-11-18 (#8473 chain 29): script.runtime, runtimeOrder, permissions, profiles and runtimes gained node-backed probes. Earlier shrunk 2026-11-18 (#8473 chain 28): script.before, onSuccess, onError and suffix gained a run-phase probe. Earlier shrunk 2026-11-18 (#8473 chain 27): hooks, hooks.timeout, daemon.ui and daemon.uiDir gained probes. Earlier shrunk 2026-11-18 (#8473 chain 26): logging.level, format, source, dir, include, maxLines, maxBytes and keep gained durable-log probes. Earlier shrunk 2026-11-18 (#8473 chain 25): artifacts.enabled, maxBytes, quota, delivery, inlineMaxBytes and dir gained script-artifact probes. Earlier shrunk 2026-11-18 (#8473 chain 24): preset and serve.mode gained probes. Earlier shrunk 2026-11-18 (#8473 chain 23): presets gained a --preset probe. Earlier shrunk 2026-11-18 (#8473 chain 22): catalog.budget and catalog.bias gained `mcpx catalog` probes. Earlier shrunk 2026-11-18 (#8473 chain 21): catalog.pinnedTools and retention.maxTools gained reactive-session probes. Earlier shrunk 2026-11-18 (#8473 chain 20): diagnose.history and diagnose.preflight gained schema-churn probes. Earlier shrunk 2026-11-18 (#8473 chain 19): events.history gained a trimmed-replay probe. Earlier shrunk 2026-11-18 (#8473 chain 18): protoTasks.maxTTL, maxPerRequestor and perMinute gained task-store probes. Earlier shrunk 2026-11-18 (#8473 chain 17): tasks.ttl and tasks.resultWait gained /v1 task probes. Earlier shrunk 2026-11-18 (#8473 chain 16): recipes.minScore, matchMargin and limit gained recipe probes. Earlier shrunk 2026-11-18 (#8473 chain 15): logstore.queryLimit gained a /v1/log probe. Earlier shrunk 2026-11-18 (#8473 chain 14): completion.perMinute and completion.serverPerMinute gained 429 probes. Earlier shrunk 2026-11-18 (#8473 chain 13): mcp.pageSize and mcp.passthrough gained tools/list probes. Earlier shrunk 2026-11-18 (#8473 chain 12): exec.timeout (now read by local runs), exec.maxOutputBytes and exec.output gained probes. Earlier shrunk 2026-11-18 (#8473 chain 11): spec.first and spec.lenient mapped to their existing revision-policy probes, spec.precedence gained one. Earlier shrunk 2026-11-18 (#8473 chain 10): protoMessages.taskAfter and protoTasks.pollInterval gained task probes. Earlier shrunk 2026-11-18 (#8473 chain 9): protoMessages.listMaxAge and readMaxAge gained cache-hint probes. Earlier shrunk 2026-11-18 (#8473 chain 8): proto.native gained an asked-client probe. Earlier shrunk 2026-11-18 (#8473 chain 7): proto.mcpPath and proto.serveMCP gained mount probes. Earlier shrunk 2026-11-18 (#8473 chain 6): proto.sessionIdle gained a reaped-session probe. Earlier shrunk 2026-11-18 (#8473 chain 5): proto.stateTTL gained a late-resume probe. Earlier shrunk 2026-11-18 (#8473 chain 4): proto.askTimeout gained a held-request probe. Earlier shrunk 2026-11-18 (#8473 chain 3): proto.askTTL gained a /v1/ask deadline probe. Earlier shrunk 2026-11-18 (#8473 chain 2): proto.askRounds gained a two-round MCP e2e probe. Earlier shrunk 2026-11-18 (#8468 chain 2): daemon.autostart gained its probe. Earlier shrunk 2026-11-17: (#8467 settings core-paths burn-down) paths.plugins gained its probe. Earlier shrunk 2026-11-17: (#8469) 14 http.* and transport.* settings gained their probes. Earlier shrunk 2026-11-17: (#8470 burn-down) stats.top gained its probe. Earlier shrunk 2026-11-17 (#8467 settings core-paths burn-down): paths.cache gained its probe. Earlier shrunk 2026-11-17 (#8467 settings core-paths burn-down): paths.scripts gained its probe. Earlier shrunk 2026-11-17 (#8468 chain 1): daemon.address gained its probe. Earlier shrunk 2026-11-17 (#8473 chain 1): proto.askPoll gained its probe. Deliberate +1 (2026-11-14, #1917 remainder shepherd of PR #7818) for script.language: covered by deterministic internal/runner tests (TestEffectiveScriptLanguage, TestExplicitPythonLanguageRunsInlineSnippet); the e2e harness script fixtures are TypeScript-only. Earlier deliberate +3 (2026-11-09, #2716) for proto.elicitationPerMinute, proto.samplingPerMinute and proto.samplingSessionPerMinute: daemon rate limits whose effect needs an over-limit sampling/elicitation flood no e2e fixture drives deterministically; the limiter is covered by internal/mcpclient and internal/daemon ratelimit tests. Earlier deliberate raises: +1 for daemon.roots and +8 for model.*: model settings are covered by internal/model and daemon unit tests; settings-driven e2e probes are not yet present. Deliberate +1 (2026-11-03, #1925 slice 3) for sampling.answerLocally: same model-layer coverage, daemon unit tests in internal/daemon/sampling_local_test.go. Deliberate +1 (2026-11-03, #5242) for plugin.disabledTools: read by the opencode plugin host (JS side); the Go e2e harness does not drive the plugin host, the same basis as every other plugin.* exemption. Deliberate +5 (2026-11-04, #1915 stage 2): import graph, missing, dynamic, cross-project and network policies are covered by deterministic internal/preflight tests, but the e2e harness has no isolated Deno graph fixture yet. Deliberate +2 (2026-11-05, #1911): checker error and unsupported-runtime policies are covered by deterministic internal/preflight stub-runtime tests; the e2e harness has no isolated Deno checker fixture. +const EffectExemptionPin = 117 // Shrunk 2026-11-18 (#8473 chain 33): artifacts.interceptImages and plumbing.indexOnQuery gained probes. Earlier shrunk 2026-11-18 (#8473 chain 32): plumbing.validatePaths and script.language gained probes. Earlier shrunk 2026-11-18 (#8473 chain 31): logging.trace and exec.where gained probes. Earlier shrunk 2026-11-18 (#8473 chain 30): paths.adapters and paths.apis gained declaration-file probes. Earlier shrunk 2026-11-18 (#8473 chain 29): script.runtime, runtimeOrder, permissions, profiles and runtimes gained node-backed probes. Earlier shrunk 2026-11-18 (#8473 chain 28): script.before, onSuccess, onError and suffix gained a run-phase probe. Earlier shrunk 2026-11-18 (#8473 chain 27): hooks, hooks.timeout, daemon.ui and daemon.uiDir gained probes. Earlier shrunk 2026-11-18 (#8473 chain 26): logging.level, format, source, dir, include, maxLines, maxBytes and keep gained durable-log probes. Earlier shrunk 2026-11-18 (#8473 chain 25): artifacts.enabled, maxBytes, quota, delivery, inlineMaxBytes and dir gained script-artifact probes. Earlier shrunk 2026-11-18 (#8473 chain 24): preset and serve.mode gained probes. Earlier shrunk 2026-11-18 (#8473 chain 23): presets gained a --preset probe. Earlier shrunk 2026-11-18 (#8473 chain 22): catalog.budget and catalog.bias gained `mcpx catalog` probes. Earlier shrunk 2026-11-18 (#8473 chain 21): catalog.pinnedTools and retention.maxTools gained reactive-session probes. Earlier shrunk 2026-11-18 (#8473 chain 20): diagnose.history and diagnose.preflight gained schema-churn probes. Earlier shrunk 2026-11-18 (#8473 chain 19): events.history gained a trimmed-replay probe. Earlier shrunk 2026-11-18 (#8473 chain 18): protoTasks.maxTTL, maxPerRequestor and perMinute gained task-store probes. Earlier shrunk 2026-11-18 (#8473 chain 17): tasks.ttl and tasks.resultWait gained /v1 task probes. Earlier shrunk 2026-11-18 (#8473 chain 16): recipes.minScore, matchMargin and limit gained recipe probes. Earlier shrunk 2026-11-18 (#8473 chain 15): logstore.queryLimit gained a /v1/log probe. Earlier shrunk 2026-11-18 (#8473 chain 14): completion.perMinute and completion.serverPerMinute gained 429 probes. Earlier shrunk 2026-11-18 (#8473 chain 13): mcp.pageSize and mcp.passthrough gained tools/list probes. Earlier shrunk 2026-11-18 (#8473 chain 12): exec.timeout (now read by local runs), exec.maxOutputBytes and exec.output gained probes. Earlier shrunk 2026-11-18 (#8473 chain 11): spec.first and spec.lenient mapped to their existing revision-policy probes, spec.precedence gained one. Earlier shrunk 2026-11-18 (#8473 chain 10): protoMessages.taskAfter and protoTasks.pollInterval gained task probes. Earlier shrunk 2026-11-18 (#8473 chain 9): protoMessages.listMaxAge and readMaxAge gained cache-hint probes. Earlier shrunk 2026-11-18 (#8473 chain 8): proto.native gained an asked-client probe. Earlier shrunk 2026-11-18 (#8473 chain 7): proto.mcpPath and proto.serveMCP gained mount probes. Earlier shrunk 2026-11-18 (#8473 chain 6): proto.sessionIdle gained a reaped-session probe. Earlier shrunk 2026-11-18 (#8473 chain 5): proto.stateTTL gained a late-resume probe. Earlier shrunk 2026-11-18 (#8473 chain 4): proto.askTimeout gained a held-request probe. Earlier shrunk 2026-11-18 (#8473 chain 3): proto.askTTL gained a /v1/ask deadline probe. Earlier shrunk 2026-11-18 (#8473 chain 2): proto.askRounds gained a two-round MCP e2e probe. Earlier shrunk 2026-11-18 (#8468 chain 2): daemon.autostart gained its probe. Earlier shrunk 2026-11-17: (#8467 settings core-paths burn-down) paths.plugins gained its probe. Earlier shrunk 2026-11-17: (#8469) 14 http.* and transport.* settings gained their probes. Earlier shrunk 2026-11-17: (#8470 burn-down) stats.top gained its probe. Earlier shrunk 2026-11-17 (#8467 settings core-paths burn-down): paths.cache gained its probe. Earlier shrunk 2026-11-17 (#8467 settings core-paths burn-down): paths.scripts gained its probe. Earlier shrunk 2026-11-17 (#8468 chain 1): daemon.address gained its probe. Earlier shrunk 2026-11-17 (#8473 chain 1): proto.askPoll gained its probe. Deliberate +1 (2026-11-14, #1917 remainder shepherd of PR #7818) for script.language: covered by deterministic internal/runner tests (TestEffectiveScriptLanguage, TestExplicitPythonLanguageRunsInlineSnippet); the e2e harness script fixtures are TypeScript-only. Earlier deliberate +3 (2026-11-09, #2716) for proto.elicitationPerMinute, proto.samplingPerMinute and proto.samplingSessionPerMinute: daemon rate limits whose effect needs an over-limit sampling/elicitation flood no e2e fixture drives deterministically; the limiter is covered by internal/mcpclient and internal/daemon ratelimit tests. Earlier deliberate raises: +1 for daemon.roots and +8 for model.*: model settings are covered by internal/model and daemon unit tests; settings-driven e2e probes are not yet present. Deliberate +1 (2026-11-03, #1925 slice 3) for sampling.answerLocally: same model-layer coverage, daemon unit tests in internal/daemon/sampling_local_test.go. Deliberate +1 (2026-11-03, #5242) for plugin.disabledTools: read by the opencode plugin host (JS side); the Go e2e harness does not drive the plugin host, the same basis as every other plugin.* exemption. Deliberate +5 (2026-11-04, #1915 stage 2): import graph, missing, dynamic, cross-project and network policies are covered by deterministic internal/preflight tests, but the e2e harness has no isolated Deno graph fixture yet. Deliberate +2 (2026-11-05, #1911): checker error and unsupported-runtime policies are covered by deterministic internal/preflight stub-runtime tests; the e2e harness has no isolated Deno checker fixture. // CheckEffectCoverage returns one violation per way the probe and // exemption maps fail to cover reg exactly: a setting with neither,