Skip to content
Merged
Show file tree
Hide file tree
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
37 changes: 37 additions & 0 deletions pkgs/mcpx/internal/e2e/effect_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,7 @@ var implementedEffectProbes = map[string]string{
"stats.top": "TestStatsTopLimitsTheRowsTheStatsAPIReports",
"proto.askPoll": "TestAskPollCeilingIsReachableFromTheEnvironment",
"daemon.address": "TestDaemonAddressIsReachableFromTheEnvironment",
"daemon.autostart": "TestDaemonAutostartIsReachableFromTheEnvironment",
"http.bodyLimit": "TestHTTPBodyLimitsRejectOversizedBodies",
"http.callBodyLimit": "TestHTTPBodyLimitsRejectOversizedBodies",
"http.controlBodyLimit": "TestHTTPBodyLimitsRejectOversizedBodies",
Expand Down Expand Up @@ -118,6 +119,7 @@ var effectProbeFuncs = map[string]func(*testing.T){
"TestStatsTopLimitsTheRowsTheStatsAPIReports": TestStatsTopLimitsTheRowsTheStatsAPIReports,
"TestAskPollCeilingIsReachableFromTheEnvironment": TestAskPollCeilingIsReachableFromTheEnvironment,
"TestDaemonAddressIsReachableFromTheEnvironment": TestDaemonAddressIsReachableFromTheEnvironment,
"TestDaemonAutostartIsReachableFromTheEnvironment": TestDaemonAutostartIsReachableFromTheEnvironment,
"TestHTTPBodyLimitsRejectOversizedBodies": TestHTTPBodyLimitsRejectOversizedBodies,
"TestHTTPEventStreamSettingsChangeTheStream": TestHTTPEventStreamSettingsChangeTheStream,
"TestHTTPReadHeaderTimeoutClosesSlowClients": TestHTTPReadHeaderTimeoutClosesSlowClients,
Expand Down Expand Up @@ -350,3 +352,38 @@ func TestDaemonAddressIsReachableFromTheEnvironment(t *testing.T) {
t.Fatalf("oracle: the widened endpoint answered %d, want 200", resp.StatusCode)
}
}

// TestDaemonAutostartIsReachableFromTheEnvironment is the effect probe
// for daemon.autostart (#8468 chain 2). The exemption it replaced said
// daemon lifecycle cannot be varied deterministically; it can: with no
// daemon running, the same command either starts one and leaves its
// socket behind, or refuses and names the disabled rung.
//
// Oracle: the CLI's own no-daemon diagnosis. With autostart off, `ls`
// fails and names "disabled by daemon.autostart" and no socket
// appears; at the default, `ls` succeeds and leaves a socket.
func TestDaemonAutostartIsReachableFromTheEnvironment(t *testing.T) {
socketsIn := func(e *env) []string {
socks, _ := filepath.Glob(filepath.Join(e.dir, "state", "*.sock"))

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Resolve the actual daemon socket instead of globbing state

When the temporary directory is long, such as with macOS's default TMPDIR or a Nix sandbox, daemon.socketPath relocates sockets outside the state directory once their preferred path exceeds 100 bytes (internal/daemon/paths.go). Consequently, on.run("ls") successfully starts a daemon, but this glob returns nothing and the new probe fails despite correct behavior. The existing harness already handles this relocation by consulting daemon info records during cleanup. Resolve the recorded socket here rather than assuming it remains under state.

Useful? React with 👍 / 👎.

return socks
}

off := newEnv(t, oneServer)
off.setenv("MCPX_DAEMON_AUTOSTART=false")
out, err := off.try("ls")
if err == nil {
t.Fatalf("oracle: with daemon.autostart=false and no daemon, ls should fail; got:\n%s", out)
}
if !strings.Contains(out, "disabled by daemon.autostart") {
t.Fatalf("oracle: the refusal should name the disabled autostart rung, got:\n%s", out)
}
if socks := socketsIn(off); len(socks) > 0 {
t.Fatalf("oracle: no daemon socket should appear with autostart off: %v", socks)
}

on := newEnv(t, oneServer)
on.run("ls")
if socks := socketsIn(on); len(socks) == 0 {
t.Fatalf("oracle: with the default daemon.autostart, ls should start a daemon and leave its socket")
}
}
1 change: 0 additions & 1 deletion pkgs/mcpx/internal/e2e/feature_coverage_exemptions.txt
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@ cli reload no integration-test exercise yet; burn-down #8461 (cli daemon group)
cli stdio-proxy no integration-test exercise yet; burn-down #8461 (cli daemon group)
cli supervise no integration-test exercise yet; burn-down #8461 (cli daemon group)
cli upgrade no integration-test exercise yet; burn-down #8461 (cli daemon group)
setting daemon.autostart no integration-test exercise yet; burn-down #8468 (settings daemon family); needs an EffectProbes entry + e2e test
setting daemon.endpoint no integration-test exercise yet; burn-down #8468 (settings daemon family); needs an EffectProbes entry + e2e test
setting daemon.idleExit no integration-test exercise yet; burn-down #8468 (settings daemon family); needs an EffectProbes entry + e2e test
setting daemon.inline no integration-test exercise yet; burn-down #8468 (settings daemon family); needs an EffectProbes entry + e2e test
Expand Down
4 changes: 2 additions & 2 deletions pkgs/mcpx/internal/settings/effect.go
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,7 @@ var EffectProbes = map[string]string{
"proxy.timeout": "TestProxyUpstreamTimeoutIsReachableFromTheEnvironment",
"proto.askPoll": "TestAskPollCeilingIsReachableFromTheEnvironment",
"daemon.address": "TestDaemonAddressIsReachableFromTheEnvironment",
"daemon.autostart": "TestDaemonAutostartIsReachableFromTheEnvironment",
"http.bodyLimit": "TestHTTPBodyLimitsRejectOversizedBodies",
"http.callBodyLimit": "TestHTTPBodyLimitsRejectOversizedBodies",
"http.controlBodyLimit": "TestHTTPBodyLimitsRejectOversizedBodies",
Expand Down Expand Up @@ -152,7 +153,6 @@ var EffectExemptions = map[string]string{
"daemon.ui": "daemon lifecycle, binding, or timing: its effect is a bound, an interval, or a network identity the isolated harness cannot vary deterministically",
"daemon.uiDir": "daemon lifecycle, binding, or timing: its effect is a bound, an interval, or a network identity the isolated harness cannot vary deterministically",
"daemon.inline": "daemon lifecycle, binding, or timing: its effect is a bound, an interval, or a network identity the isolated harness cannot vary deterministically",
"daemon.autostart": "daemon lifecycle, binding, or timing: its effect is a bound, an interval, or a network identity the isolated harness cannot vary deterministically",
"daemon.roots": "configured upstream roots only affect an upstream roots/list request; the e2e harness does not yet issue that server request, while daemon hook and mcpclient unit tests cover settings conversion and the response path",
"hooks": "hook execution: its effect needs a hook configured for a specific event and an event that fires it; the harness has no per-event hook fixture",
"hooks.timeout": "hook execution: its effect needs a hook configured for a specific event and an event that fires it; the harness has no per-event hook fixture",
Expand Down Expand Up @@ -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 = 194 // 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 = 193 // 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,
Expand Down