Skip to content

Commit ad04339

Browse files
test(cli): stop the registry plan check depending on the developer's machine
The test built a fixture with its own HOME and PATH, then asserted that the whole install plan contained no path with "/plugins/" in it. Agent detection does not stay inside HOME and PATH: cbm_find_cli also looks in /usr/local/bin and, on macOS, /opt/homebrew/bin. A developer with OpenCode installed there has it detected inside the fixture, and OpenCode ships a real plugin file, so the plan legitimately carried a "/plugins/" path and the assertion failed. On a machine without OpenCode the same assertion passed, which is why CI never saw it. Name the two directories the check actually meant — the fixture's Qoder and Pi directories, neither of which has a plugin directory, so a planned path under one would be invented. The check now tests the same thing regardless of what the developer has installed. No production behaviour changed. Searching well-known install directories is deliberate, so that install finds an agent whose command is not on the current PATH. Fixes the failure at tests/test_cli.c:6859. Local cli suite: 293 passed, 0 failed. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com> Signed-off-by: Joshua Richter <jrichter5781@gmail.com>
1 parent c38aa35 commit ad04339

1 file changed

Lines changed: 12 additions & 1 deletion

File tree

tests/test_cli.c

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6561,8 +6561,19 @@ TEST(cli_agent_client_registry_routes_plan_install_and_uninstall) {
65616561
char *plan = cbm_build_install_plan_json(tmpdir, binary_path);
65626562
yyjson_doc *plan_doc = plan ? yyjson_read(plan, strlen(plan), 0) : NULL;
65636563
yyjson_val *plan_root = plan_doc ? yyjson_doc_get_root(plan_doc) : NULL;
6564+
/* Neither of these agents has a plugin directory, so a planned path under
6565+
* one would be invented. Name the two directories rather than searching the
6566+
* whole plan for "/plugins/": OpenCode does ship a real plugin file, and
6567+
* agent detection finds a command in /usr/local/bin or /opt/homebrew/bin
6568+
* whatever HOME and PATH say, so a blanket search passes or fails according
6569+
* to what the developer happens to have installed. */
6570+
char qoder_plugins[700];
6571+
char pi_plugins[700];
6572+
snprintf(qoder_plugins, sizeof(qoder_plugins), "%s/plugins/", qoder_dir);
6573+
snprintf(pi_plugins, sizeof(pi_plugins), "%s/plugins/", pi_dir);
65646574
bool plan_ok =
6565-
plan && !strstr(plan, "/plugins/") && !strstr(plan, "plugin_files") &&
6575+
plan && !strstr(plan, qoder_plugins) && !strstr(plan, pi_plugins) &&
6576+
!strstr(plan, "plugin_files") &&
65666577
test_json_string_array_contains(plan_root, "config_files_planned", qoder_settings) &&
65676578
test_json_string_array_contains(plan_root, "config_files_planned", amazon_config) &&
65686579
test_json_string_array_contains(plan_root, "config_files_planned", roo_config) &&

0 commit comments

Comments
 (0)