fix(configsvc): deep-copy tool-filter slices in Snapshot.Clone (+ regression guard)#479
Merged
Merged
Conversation
Investigation of the reported 'config-file disabled_tools does not reach runtime' concern found NO reproducible code bug: every boundary (file parse, storage Save/Get/List, and the full path parse->New->LoadConfiguredServers->SaveConfiguration->IsToolConfigDenied) provably preserves enabled_tools/disabled_tools. The original manual observation was a test-environment artifact (reused /tmp data-dir while SaveConfiguration rewrites the config file + hot-reload watcher). The investigation did surface one real latent defect: Snapshot.Clone() deep-copied Args/Headers/Env/OAuth/Isolation but shallow-aliased the spec-049 EnabledTools/DisabledTools slices via 'clonedSrv := *srv'. Not data loss (reads see the aliased value) but an immutability violation: mutating a cloned config's filter would corrupt the shared backing array. - Deep-copy EnabledTools/DisabledTools in Snapshot.Clone - TestSnapshotClone_DeepCopiesToolFilters (aliasing regression) - TestConfigFileToolFilter_ReachesRuntime (permanent full-path guard) - correct the spec-049 quickstart note (no #468 gap exists) Related #468
Deploying mcpproxy-docs with
|
| Latest commit: |
4d9536b
|
| Status: | ✅ Deploy successful! |
| Preview URL: | https://d27fbd61.mcpproxy-docs.pages.dev |
| Branch Preview URL: | https://fix-config-file-disabled-too.mcpproxy-docs.pages.dev |
The first revision string-interpolated t.TempDir() into a JSON literal; on windows-amd64 the backslash path produced invalid JSON, failing the test (caught by the Build Binaries windows job). Marshal the config via encoding/json so the path is escaped on every OS. Related #468
📦 Build ArtifactsWorkflow Run: View Run Available Artifacts
How to DownloadOption 1: GitHub Web UI (easiest)
Option 2: GitHub CLI gh run download 26044970725 --repo smart-mcp-proxy/mcpproxy-go
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Follow-up to the spec-049 review item "config-file disabled_tools→runtime gap".
TL;DR — the reported gap is not a code bug
Systematic debugging (every boundary, deterministic repro) proved config-file
enabled_tools/disabled_toolsdo reachIsToolConfigDeniedthrough the full production path: file parse →LoadFromFile→runtime.New(ConfigService) →LoadConfiguredServers(config→storage) →SaveConfiguration(storage→ConfigService + file rewrite). The original manual observation was a test-environment artifact (reused/tmpdata-dir while mcpproxy's ownSaveConfiguration()rewrites the config file, plus the hot-reload watcher → indeterminate effective config at theechocall).What this PR actually ships
configsvc.Snapshot.Clone()deep-copiedArgs/Headers/Env/OAuth/Isolationbut shallow-aliased the feat(config): layered config tool filter — config_denied over user toggles #468EnabledTools/DisabledToolsslices (clonedSrv := *srv). Not data loss, but an immutability violation — mutating a cloned config's filter corrupts the shared backing array. Now deep-copied.TestSnapshotClone_DeepCopiesToolFilters— aliasing regression.TestConfigFileToolFilter_ReachesRuntime— permanent deterministic guard for the exact concern, exercising the full file→runtime path incl. theSaveConfigurationfile rewrite.quickstart.mdnote that wrongly recorded this as a confirmed feat(config): layered config tool filter — config_denied over user toggles #468 gap.No behavior change to the happy path; no storage/enforcement change.
Related #468