Skip to content

Commit 913224b

Browse files
committed
fix tests; drop redundant coder --allowedTools/--disallowedTools calls
- The legacy-shim test set disallowed_tools, which triggered a pre-existing 'coder --disallowedTools' call in setup_claude_configurations. coder is not present in the test container so set -e aborted before the policy file was written. Those calls are redundant now that the legacy shim writes allow/deny via managed-settings.d, so remove them. - claude-no-policy-keys-in-claudejson: configure_standalone_mode guards on CLAUDE_API_KEY in the environment, which coder_env provides in production but not in the test container. Pass coderEnvVars to execModuleScript so the file is created.
1 parent c2ce7f6 commit 913224b

2 files changed

Lines changed: 9 additions & 10 deletions

File tree

registry/coder/modules/claude-code/main.test.ts

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -252,13 +252,16 @@ describe("claude-code", async () => {
252252
});
253253

254254
test("claude-no-policy-keys-in-claudejson", async () => {
255-
const { id } = await setup({
255+
const { id, coderEnvVars } = await setup({
256256
moduleVariables: {
257257
report_tasks: "false",
258258
claude_api_key: "sk-test-standalone",
259259
},
260260
});
261-
await execModuleScript(id);
261+
// configure_standalone_mode reads CLAUDE_API_KEY from the environment;
262+
// in production the coder agent exports coder_env values, in tests we
263+
// pass them explicitly.
264+
await execModuleScript(id, coderEnvVars);
262265

263266
const cfg = await readFileContainer(id, "/home/coder/.claude.json");
264267
expect(cfg).toContain("hasCompletedOnboarding");

registry/coder/modules/claude-code/scripts/install.sh

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -169,14 +169,10 @@ function setup_claude_configurations() {
169169
)
170170
fi
171171

172-
if [ -n "$ARG_ALLOWED_TOOLS" ]; then
173-
coder --allowedTools "$ARG_ALLOWED_TOOLS"
174-
fi
175-
176-
if [ -n "$ARG_DISALLOWED_TOOLS" ]; then
177-
coder --disallowedTools "$ARG_DISALLOWED_TOOLS"
178-
fi
179-
172+
# ARG_ALLOWED_TOOLS / ARG_DISALLOWED_TOOLS are mapped into the
173+
# managed-settings policy file via the legacy_permissions shim in main.tf,
174+
# so the `coder --allowedTools` / `coder --disallowedTools` calls that used
175+
# to live here are no longer needed.
180176
}
181177

182178
function write_managed_settings() {

0 commit comments

Comments
 (0)