Repository navigation
mcpx: settings effect guard — completeness + surface probes + planted-inert negative test (#1971) - #2670
Conversation
…ative test (#1971) Implements the #1971 collision-15 slice (Approach C applied to settings.Registry()): - internal/settings/effect.go: EffectProbes / EffectExemptions maps + EffectExemptionPin ratchet (180 exemptions at landing; can only shrink, and a shrink requires lowering the pin in the same PR) + CheckEffectCoverage machinery. - internal/settings/effect_test.go: unit-speed completeness test over all 197 registry settings, ratchet test, and a negative test planting an inert setting in the registry.pageSize shape (read, consulted only behind an unreachable branch) that the guard must fail on. - internal/e2e/effect_test.go: probe-declaration sync test (declared probes must exist, implemented probes must be declared) + new surface-grouped probes for paths.configFile, script.captureConsole, script.typecheck, search.limit. Existing probes (pool.*, output.json, script.prefix/env, logging.file, plumbing.strictUnknownKeys, paths.state, registry.pageSize/limit/maxPages/url) are declared and keep passing. - Fix found by the new guard: script.captureConsole was inert on the local run/exec surface - resolveScriptShape read only the --no-capture-console flag while the daemon exec service read the resolved setting. The local shape now honours the setting (either source turning capture off turns it off).
|
Warning Review limit reachedYou've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository. Next included review available in 39 seconds. View limit details
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 339500c465
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| for path, name := range declared { | ||
| if got, ok := implementedEffectProbes[path]; !ok { | ||
| diff = append(diff, path+" is declared in settings.EffectProbes but has no e2e probe") | ||
| } else if got != name { | ||
| diff = append(diff, path+" is declared as "+name+" but implemented as "+got) |
There was a problem hiding this comment.
Verify that declared probe test functions actually exist
If a probe function is deleted or renamed without updating these maps, this check still passes: it only compares two manually maintained string declarations, neither of which references the actual test function. For example, removing TestScriptCaptureConsoleOffDropsConsoleOutput leaves both the completeness check and this synchronization check green while script.captureConsole loses its effect coverage. Resolve the implementation entries to test function references or inspect the package's test declarations so missing probes fail the guard.
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
Fixed. The e2e package now has effectProbeFuncs: a map from each declared probe name to the actual test function as a Go reference, and TestEffectProbeDeclarationsMatchTheProbesThatExist fails unless every implemented probe name is anchored there. Deleting or renaming a probe (e.g. TestScriptCaptureConsoleOffDropsConsoleOutput) now breaks compilation of the e2e test package, so the guard cannot stay green while coverage silently disappears. Verified: go vet ./internal/e2e/ clean, the sync test and the settings TestEffect tests pass on the laptop.
Implements the settings effect guard from #1971 (its owned #181-collision-15 item; triage task 2873 confirmed + split). Queue task 3265.
What landed
Completeness (unit speed) —
pkgs/mcpx/internal/settings/effect.go+effect_test.gosettings.Registry()must have either an effect probe or a reasoned exemption:CheckEffectCoveragefails on a setting with neither, with both, on stale entries, and on an exemption with no reason.EffectExemptionPin: the list can only shrink, and a shrink requires lowering the pin in the same PR so it is recorded deliberately.TestEffectGuardFailsOnAPlantedInertSettingplants a setting in theregistry.pageSizeshape (read, then consulted only behindif limit <= 0while ordinary callers pass a positive limit) — proves the plant is inert, then requires the guard to fail on it. A guard that cannot fail is not a guard.Effect probes (e2e, grouped by surface) —
pkgs/mcpx/internal/e2e/effect_test.gosettings.EffectProbesand the e2e implementations in exact agreement in both directions.pool.max/sharing/scope,output.json,script.prefix,script.env,logging.file,plumbing.strictUnknownKeys,paths.state,registry.pageSize(the motivating instance — probed, not exempted),registry.limit,registry.maxPages,registry.url.paths.configFile(which config loads changes),script.typecheck(on refuses a type error that off runs),search.limit(caps results at 1 vs several),script.captureConsole(below).A real inert setting the guard caught, fixed here —
script.captureConsolewas honoured by the daemon's exec service (routes_exec.goreads the resolved setting) but the local run/exec shape (resolveScriptShape) read only the--no-capture-consoleflag, so the env var / config key / generated flag did nothing for a local run. The shape now honours the resolved setting (!f.noConsole && settings.Bool(...)— either source turning capture off turns it off), and the new probe proves the with/without difference through an ordinary caller.Verification (on the laptop worktree, pre-push)
go test ./internal/settings/ -run 'Effect'— completeness, ratchet, and planted-inert negative all pass.go test ./internal/e2e/ -run 'Effect|PathsConfigFile|ScriptCaptureConsole|ScriptTypecheck|SearchLimit'— all pass.unread_test.go/registry_test.gopass;go test ./internal/cli/passes.Known pre-existing failure (not this PR)
TestEveryDocumentHasAChapterininternal/settingsfails on cleanmain(4b48bf1) too:docs/testing/inventory.mdis not in the compendium manifest. Verified by running it in a pristine worktree of main. It will presumably show in this PR's CI as well; it is unrelated to this change.Refs #1971 (this is the collision-15 slice of it; the issue's other guard items are separate packets).
Need help on this PR? Tag
@codesmith-botwith what you need.