From 6854b7e9a99b9dfa6fde699fcc81766ab564707d Mon Sep 17 00:00:00 2001 From: Mitesh Ashar Date: Fri, 20 Feb 2026 09:20:48 +0530 Subject: [PATCH] feat(claude-code-settings): improve test coverage Schema: - Add fastMode boolean property (default: false) - Add default: true to sandbox.autoAllowBashIfSandboxed - Enhance spinnerVerbs.mode description with enum explanations - Add 19 missing property descriptions (statusLine, fileSuggestion, sandbox.network, 14 marketplace source type discriminators) Tests: - Add 13 uncovered top-level properties to modern-complete-config.json - Add untested enum values across 6 test files (all 7 enums fully covered) - Add non-default value tests for 9 properties (edge-cases, basic-config) - Add git URL pattern test to marketplace-host-pattern.json - Add defaultMode coverage across permissions test files Negative tests: - Add 4 invalid enum values to invalid-enum-values.json - Add git URL pattern violation to invalid-marketplace-host-pattern.json - Create invalid-mcp-server-name.json for serverName pattern violations Co-Authored-By: Claude Opus 4.6 --- .../invalid-enum-values.json | 8 ++- .../invalid-marketplace-host-pattern.json | 6 +++ .../invalid-mcp-server-name.json | 12 +++++ .../wrong-property-types.json | 1 + src/schemas/json/claude-code-settings.json | 33 ++++++++++-- .../claude-code-settings/basic-config.json | 2 + .../claude-code-settings/complete-config.json | 1 + src/test/claude-code-settings/edge-cases.json | 17 ++++++- .../marketplace-host-pattern.json | 6 +++ .../modern-complete-config.json | 50 +++++++++++++++---- .../permissions-basic.json | 1 + .../claude-code-settings/permissions-mcp.json | 1 + 12 files changed, 120 insertions(+), 18 deletions(-) create mode 100644 src/negative_test/claude-code-settings/invalid-mcp-server-name.json diff --git a/src/negative_test/claude-code-settings/invalid-enum-values.json b/src/negative_test/claude-code-settings/invalid-enum-values.json index 974395f2785..a8ab89e7005 100644 --- a/src/negative_test/claude-code-settings/invalid-enum-values.json +++ b/src/negative_test/claude-code-settings/invalid-enum-values.json @@ -1,10 +1,14 @@ { + "autoUpdatesChannel": "beta", + "effortLevel": "extreme", "forceLoginMethod": "github", "permissions": { - "defaultMode": "invalid-mode" + "defaultMode": "invalid-mode", + "disableBypassPermissionsMode": "enabled" }, "spinnerVerbs": { "mode": "merge", "verbs": ["Analyzing"] - } + }, + "teammateMode": "split" } diff --git a/src/negative_test/claude-code-settings/invalid-marketplace-host-pattern.json b/src/negative_test/claude-code-settings/invalid-marketplace-host-pattern.json index feb9ce9d9f5..4b7efbe2ea5 100644 --- a/src/negative_test/claude-code-settings/invalid-marketplace-host-pattern.json +++ b/src/negative_test/claude-code-settings/invalid-marketplace-host-pattern.json @@ -1,5 +1,11 @@ { "extraKnownMarketplaces": { + "corp-bad-git": { + "source": { + "source": "git", + "url": "https://example.com/no-git-suffix" + } + }, "internal-git": { "source": { "source": "hostPattern" diff --git a/src/negative_test/claude-code-settings/invalid-mcp-server-name.json b/src/negative_test/claude-code-settings/invalid-mcp-server-name.json new file mode 100644 index 00000000000..5fae4c1eda9 --- /dev/null +++ b/src/negative_test/claude-code-settings/invalid-mcp-server-name.json @@ -0,0 +1,12 @@ +{ + "allowedMcpServers": [ + { + "serverName": "invalid server name!" + } + ], + "deniedMcpServers": [ + { + "serverName": "also.invalid.name" + } + ] +} diff --git a/src/negative_test/claude-code-settings/wrong-property-types.json b/src/negative_test/claude-code-settings/wrong-property-types.json index 3a8f687c9da..82e6201b3d1 100644 --- a/src/negative_test/claude-code-settings/wrong-property-types.json +++ b/src/negative_test/claude-code-settings/wrong-property-types.json @@ -1,6 +1,7 @@ { "cleanupPeriodDays": "thirty", "enableAllProjectMcpServers": 1, + "fastMode": "yes", "hooks": { "PreToolUse": [ { diff --git a/src/schemas/json/claude-code-settings.json b/src/schemas/json/claude-code-settings.json index d1f2c405860..fb61601132b 100644 --- a/src/schemas/json/claude-code-settings.json +++ b/src/schemas/json/claude-code-settings.json @@ -322,6 +322,11 @@ "description": "Control Opus 4.6 adaptive reasoning effort. Lower effort is faster and cheaper for straightforward tasks, higher effort provides deeper reasoning. See https://code.claude.com/docs/en/model-config#adjust-effort-level", "default": "high" }, + "fastMode": { + "type": "boolean", + "description": "Enable fast mode for Opus 4.6. Fast mode uses the same model with faster output at higher cost per token. Alternatively, toggle with /fast command. See https://code.claude.com/docs/en/fast-mode", + "default": false + }, "enableAllProjectMcpServers": { "type": "boolean", "description": "Whether to automatically approve all MCP servers in the project. See https://code.claude.com/docs/en/mcp", @@ -580,13 +585,16 @@ "properties": { "type": { "type": "string", + "description": "The type of status line handler; must be set to \"command\" to run a custom shell script that receives JSON session data via stdin.", "const": "command" }, "command": { - "type": "string" + "type": "string", + "description": "A shell command or path to a script that displays session information (context usage, costs, git status, etc.) by reading JSON data from stdin and writing output to stdout. See https://code.claude.com/docs/en/statusline" }, "padding": { - "type": "number" + "type": "number", + "description": "Optional number of extra horizontal spacing characters added to the status line content; defaults to 0." } }, "required": ["type", "command"], @@ -604,6 +612,7 @@ "properties": { "type": { "type": "string", + "description": "The type of file suggestion handler; must be set to \"command\" to execute a custom shell script that generates file suggestions for the @ file picker.", "const": "command" }, "command": { @@ -653,6 +662,7 @@ "properties": { "source": { "type": "string", + "description": "Identifies the marketplace source type", "const": "url" }, "url": { @@ -669,6 +679,7 @@ "properties": { "source": { "type": "string", + "description": "Identifies the marketplace source type", "const": "hostPattern" }, "hostPattern": { @@ -684,6 +695,7 @@ "properties": { "source": { "type": "string", + "description": "Identifies the marketplace source type", "const": "github" }, "repo": { @@ -707,6 +719,7 @@ "properties": { "source": { "type": "string", + "description": "Identifies the marketplace source type", "const": "git" }, "url": { @@ -731,6 +744,7 @@ "properties": { "source": { "type": "string", + "description": "Identifies the marketplace source type", "const": "npm" }, "package": { @@ -746,6 +760,7 @@ "properties": { "source": { "type": "string", + "description": "Identifies the marketplace source type", "const": "file" }, "path": { @@ -761,6 +776,7 @@ "properties": { "source": { "type": "string", + "description": "Identifies the marketplace source type", "const": "directory" }, "path": { @@ -794,6 +810,7 @@ "properties": { "source": { "type": "string", + "description": "Identifies the marketplace source type", "const": "hostPattern" }, "hostPattern": { @@ -809,6 +826,7 @@ "properties": { "source": { "type": "string", + "description": "Identifies the marketplace source type", "const": "github" }, "repo": { @@ -832,6 +850,7 @@ "properties": { "source": { "type": "string", + "description": "Identifies the marketplace source type", "const": "git" }, "url": { @@ -855,6 +874,7 @@ "properties": { "source": { "type": "string", + "description": "Identifies the marketplace source type", "const": "url" }, "url": { @@ -878,6 +898,7 @@ "properties": { "source": { "type": "string", + "description": "Identifies the marketplace source type", "const": "npm" }, "package": { @@ -893,6 +914,7 @@ "properties": { "source": { "type": "string", + "description": "Identifies the marketplace source type", "const": "file" }, "path": { @@ -908,6 +930,7 @@ "properties": { "source": { "type": "string", + "description": "Identifies the marketplace source type", "const": "directory" }, "path": { @@ -976,6 +999,7 @@ "properties": { "network": { "type": "object", + "description": "Configures network isolation settings for the sandboxed bash environment, including domain restrictions, Unix socket access, and custom proxy configuration.", "properties": { "allowUnixSockets": { "type": "array", @@ -1043,7 +1067,8 @@ }, "autoAllowBashIfSandboxed": { "type": "boolean", - "description": "Automatically allow bash commands without prompting when they run in the sandbox. Only applies to commands that will run sandboxed." + "description": "Automatically allow bash commands without prompting when they run in the sandbox. Only applies to commands that will run sandboxed.", + "default": true }, "enableWeakerNestedSandbox": { "type": "boolean", @@ -1067,7 +1092,7 @@ "mode": { "type": "string", "enum": ["append", "replace"], - "description": "How custom verbs should be combined with the default spinner verbs" + "description": "How to combine custom verbs with default spinner verbs: 'append' adds custom verbs to the default list, 'replace' uses only custom verbs" }, "verbs": { "type": "array", diff --git a/src/test/claude-code-settings/basic-config.json b/src/test/claude-code-settings/basic-config.json index fcce47ef083..5eacac91a8f 100644 --- a/src/test/claude-code-settings/basic-config.json +++ b/src/test/claude-code-settings/basic-config.json @@ -1,4 +1,6 @@ { + "effortLevel": "high", "model": "sonnet", + "teammateMode": "auto", "verbose": false } diff --git a/src/test/claude-code-settings/complete-config.json b/src/test/claude-code-settings/complete-config.json index c942ecee28c..d205938b200 100644 --- a/src/test/claude-code-settings/complete-config.json +++ b/src/test/claude-code-settings/complete-config.json @@ -15,6 +15,7 @@ "WebFetch(domain:anthropic.com)" ], "ask": ["Write(//tmp/**)", "WebFetch(domain:trusted.example.com)"], + "defaultMode": "delegate", "deny": [ "Bash(rm:*)", "Bash(curl:*)", diff --git a/src/test/claude-code-settings/edge-cases.json b/src/test/claude-code-settings/edge-cases.json index c3f7f79c585..a672fbdc013 100644 --- a/src/test/claude-code-settings/edge-cases.json +++ b/src/test/claude-code-settings/edge-cases.json @@ -1,9 +1,24 @@ { + "autoUpdatesChannel": "stable", "cleanupPeriodDays": 0, + "effortLevel": "low", "env": {}, + "fastMode": false, + "forceLoginMethod": "claudeai", "permissions": { "allow": [], "ask": [], + "defaultMode": "dontAsk", "deny": [] - } + }, + "prefersReducedMotion": false, + "respectGitignore": true, + "showTurnDuration": true, + "spinnerTipsEnabled": true, + "spinnerVerbs": { + "mode": "append", + "verbs": ["Thinking"] + }, + "teammateMode": "in-process", + "terminalProgressBarEnabled": true } diff --git a/src/test/claude-code-settings/marketplace-host-pattern.json b/src/test/claude-code-settings/marketplace-host-pattern.json index 2ceda674c17..31a7468c288 100644 --- a/src/test/claude-code-settings/marketplace-host-pattern.json +++ b/src/test/claude-code-settings/marketplace-host-pattern.json @@ -1,5 +1,11 @@ { "extraKnownMarketplaces": { + "corp-git-repo": { + "source": { + "source": "git", + "url": "https://git.corp.example/plugins/marketplace.git" + } + }, "internal-git": { "source": { "hostPattern": "git.internal.example.com", diff --git a/src/test/claude-code-settings/modern-complete-config.json b/src/test/claude-code-settings/modern-complete-config.json index d6ccc6cf895..f194d2cf412 100644 --- a/src/test/claude-code-settings/modern-complete-config.json +++ b/src/test/claude-code-settings/modern-complete-config.json @@ -1,18 +1,26 @@ { "$schema": "https://json.schemastore.org/claude-code-settings.json", "allowManagedHooksOnly": false, + "allowManagedPermissionRulesOnly": false, "alwaysThinkingEnabled": false, "apiKeyHelper": "/usr/local/bin/claude-auth-helper", "attribution": { "commit": "Generated with AI\n\nCo-Authored-By: AI ", "pr": "" }, - "autoUpdatesChannel": "stable", + "autoUpdatesChannel": "latest", "availableModels": ["sonnet", "haiku"], + "awsAuthRefresh": "aws sso login --profile myprofile", + "awsCredentialExport": "/bin/generate_aws_grant.sh", "cleanupPeriodDays": 60, + "companyAnnouncements": ["Welcome to the team!"], + "disableAllHooks": false, "disabledMcpjsonServers": ["untrusted-server"], - "effortLevel": "high", + "effortLevel": "medium", "enableAllProjectMcpServers": true, + "enabledPlugins": { + "formatter@anthropic-tools": true + }, "env": { "ANTHROPIC_MODEL": "claude-3-5-sonnet-20241022", "ANTHROPIC_SMALL_FAST_MODEL": "claude-3-5-haiku-20241022", @@ -27,11 +35,13 @@ } } }, + "fastMode": true, "fileSuggestion": { "command": "~/.claude/file-suggestion.sh", "type": "command" }, - "forceLoginMethod": "claudeai", + "forceLoginMethod": "console", + "forceLoginOrgUUID": "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx", "hooks": { "PermissionRequest": [ { @@ -80,6 +90,7 @@ "includeCoAuthoredBy": true, "language": "english", "model": "opus", + "otelHeadersHelper": "/usr/local/bin/otel-headers.sh", "outputStyle": "Explanatory", "permissions": { "additionalDirectories": ["~/Documents/reference", "~/.config/claude-code"], @@ -107,11 +118,20 @@ ] }, "plansDirectory": "./plans", - "prefersReducedMotion": false, - "respectGitignore": true, + "pluginConfigs": { + "formatter@anthropic-tools": { + "mcpServers": { + "formatter": { + "autoFormat": "true" + } + } + } + }, + "prefersReducedMotion": true, + "respectGitignore": false, "sandbox": { "allowUnsandboxedCommands": false, - "autoAllowBashIfSandboxed": true, + "autoAllowBashIfSandboxed": false, "enableWeakerNestedSandbox": false, "enabled": true, "excludedCommands": ["docker", "git"], @@ -125,16 +145,24 @@ "socksProxyPort": 8081 } }, - "showTurnDuration": true, - "spinnerTipsEnabled": true, + "showTurnDuration": false, + "skipWebFetchPreflight": false, + "skippedMarketplaces": ["untrusted-marketplace"], + "skippedPlugins": ["risky-plugin@unknown-marketplace"], + "spinnerTipsEnabled": false, "spinnerTipsOverride": { "excludeDefault": false, "tips": ["Check the style guide", "Run tests before committing"] }, "spinnerVerbs": { - "mode": "append", + "mode": "replace", "verbs": ["Analyzing", "Building"] }, - "teammateMode": "auto", - "terminalProgressBarEnabled": true + "statusLine": { + "command": "~/.claude/statusline.sh", + "padding": 1, + "type": "command" + }, + "teammateMode": "tmux", + "terminalProgressBarEnabled": false } diff --git a/src/test/claude-code-settings/permissions-basic.json b/src/test/claude-code-settings/permissions-basic.json index 297c4fe2071..86e90491136 100644 --- a/src/test/claude-code-settings/permissions-basic.json +++ b/src/test/claude-code-settings/permissions-basic.json @@ -2,6 +2,7 @@ "permissions": { "allow": ["Read(~/.bashrc)", "Bash(pwd:*)"], "ask": ["Write(/tmp/**)"], + "defaultMode": "default", "deny": ["Bash(sudo:*)"] } } diff --git a/src/test/claude-code-settings/permissions-mcp.json b/src/test/claude-code-settings/permissions-mcp.json index f7d38dfd5ed..ad2ecd04106 100644 --- a/src/test/claude-code-settings/permissions-mcp.json +++ b/src/test/claude-code-settings/permissions-mcp.json @@ -6,6 +6,7 @@ "mcp__git(status:*)" ], "ask": ["mcp__filesystem(write:/home/user)"], + "defaultMode": "bypassPermissions", "deny": [] } }