From ad04339030bbfea4e77139bcfa9a87356c1e0e5b Mon Sep 17 00:00:00 2001 From: Joshua Richter Date: Sun, 30 Aug 2026 14:43:43 -0400 Subject: [PATCH] test(cli): stop the registry plan check depending on the developer's machine MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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) Signed-off-by: Joshua Richter --- tests/test_cli.c | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/tests/test_cli.c b/tests/test_cli.c index b2b543d71..927437802 100644 --- a/tests/test_cli.c +++ b/tests/test_cli.c @@ -6561,8 +6561,19 @@ TEST(cli_agent_client_registry_routes_plan_install_and_uninstall) { char *plan = cbm_build_install_plan_json(tmpdir, binary_path); yyjson_doc *plan_doc = plan ? yyjson_read(plan, strlen(plan), 0) : NULL; yyjson_val *plan_root = plan_doc ? yyjson_doc_get_root(plan_doc) : NULL; + /* Neither of these agents has a plugin directory, so a planned path under + * one would be invented. Name the two directories rather than searching the + * whole plan for "/plugins/": OpenCode does ship a real plugin file, and + * agent detection finds a command in /usr/local/bin or /opt/homebrew/bin + * whatever HOME and PATH say, so a blanket search passes or fails according + * to what the developer happens to have installed. */ + char qoder_plugins[700]; + char pi_plugins[700]; + snprintf(qoder_plugins, sizeof(qoder_plugins), "%s/plugins/", qoder_dir); + snprintf(pi_plugins, sizeof(pi_plugins), "%s/plugins/", pi_dir); bool plan_ok = - plan && !strstr(plan, "/plugins/") && !strstr(plan, "plugin_files") && + plan && !strstr(plan, qoder_plugins) && !strstr(plan, pi_plugins) && + !strstr(plan, "plugin_files") && test_json_string_array_contains(plan_root, "config_files_planned", qoder_settings) && test_json_string_array_contains(plan_root, "config_files_planned", amazon_config) && test_json_string_array_contains(plan_root, "config_files_planned", roo_config) &&