|
13 | 13 | #include "../src/foundation/compat_thread.h" |
14 | 14 | #include "test_framework.h" |
15 | 15 | #include "test_helpers.h" |
| 16 | +#include <cli/agent_profiles.h> |
16 | 17 | #include <cli/cli.h> |
17 | 18 | #include <cli/progress_sink.h> |
18 | 19 | #include <daemon/bootstrap.h> |
@@ -4894,11 +4895,15 @@ TEST(cli_durable_profiles_follow_current_vendor_paths) { |
4894 | 4895 | files_ok = files_ok && test_file_contains_all(path, claude_terms, 7U); |
4895 | 4896 |
|
4896 | 4897 | snprintf(path, sizeof(path), "%s/agents/codebase-memory.toml", codex_home); |
4897 | | - const char *const codex_terms[] = { |
4898 | | - "name = \"codebase-memory\"", "description = ", |
4899 | | - "developer_instructions = ", "sandbox_mode = \"read-only\"", |
4900 | | - "[mcp_servers.codebase-memory-mcp]", "check_index_coverage"}; |
4901 | | - files_ok = files_ok && test_file_contains_all(path, codex_terms, 6U); |
| 4898 | + const char *const codex_terms[] = {"name = \"codebase-memory\"", |
| 4899 | + "description = ", |
| 4900 | + "developer_instructions = ", |
| 4901 | + "sandbox_mode = \"read-only\"", |
| 4902 | + "[mcp_servers.codebase-memory-mcp]", |
| 4903 | + "command = \"/opt/codebase-memory-mcp\"", |
| 4904 | + "args = [\"--tool-profile=analysis\"]", |
| 4905 | + "check_index_coverage"}; |
| 4906 | + files_ok = files_ok && test_file_contains_all(path, codex_terms, 8U); |
4902 | 4907 | char *profile = read_test_file_alloc(path); |
4903 | 4908 | files_ok = files_ok && profile && !strstr(profile, "model =") && |
4904 | 4909 | !strstr(profile, "index_repository") && !strstr(profile, "delete_project") && |
@@ -5371,25 +5376,45 @@ TEST(cli_tiered_codex_profiles_migrate_preserve_and_uninstall) { |
5371 | 5376 | "name = \"codebase-memory-scout\"\nuser_note = \"preserve scout\"\n"; |
5372 | 5377 | write_test_file(verify_path, legacy_verify); |
5373 | 5378 | write_test_file(scout_path, foreign_scout); |
5374 | | - |
5375 | | - char *plan = cbm_build_install_plan_json(tmpdir, "/opt/codebase-memory-mcp"); |
| 5379 | + char *rc1_auditor = cbm_render_graph_profile_codex_rc1(CBM_GRAPH_TIER_AUDIT); |
| 5380 | + if (!rc1_auditor) |
| 5381 | + FAIL("rc.1 auditor rendering must be available"); |
| 5382 | + write_test_file(auditor_path, rc1_auditor); |
| 5383 | + free(rc1_auditor); |
| 5384 | + |
| 5385 | + /* Uninstall renders expected content with the installed binary path, so |
| 5386 | + * install with that same path to exercise exact-content removal. */ |
| 5387 | + char installed_binary[640]; |
| 5388 | + char expected_command[768]; |
| 5389 | +#ifdef _WIN32 |
| 5390 | + snprintf(installed_binary, sizeof(installed_binary), "%s/.local/bin/codebase-memory-mcp.exe", |
| 5391 | + tmpdir); |
| 5392 | +#else |
| 5393 | + snprintf(installed_binary, sizeof(installed_binary), "%s/.local/bin/codebase-memory-mcp", |
| 5394 | + tmpdir); |
| 5395 | +#endif |
| 5396 | + snprintf(expected_command, sizeof(expected_command), "command = \"%s\"", installed_binary); |
| 5397 | + char *plan = cbm_build_install_plan_json(tmpdir, installed_binary); |
5376 | 5398 | bool plan_ok = |
5377 | 5399 | plan && strstr(plan, scout_path) && strstr(plan, verify_path) && strstr(plan, auditor_path); |
5378 | 5400 | free(plan); |
5379 | 5401 |
|
5380 | | - int install_rc = cbm_install_agent_configs(tmpdir, "/opt/codebase-memory-mcp", false, false); |
| 5402 | + int install_rc = cbm_install_agent_configs(tmpdir, installed_binary, false, false); |
5381 | 5403 | char *scout = read_test_file_alloc(scout_path); |
5382 | 5404 | char *verify = read_test_file_alloc(verify_path); |
5383 | 5405 | char *auditor = read_test_file_alloc(auditor_path); |
5384 | | - bool installed = install_rc != 0 && scout && strcmp(scout, foreign_scout) == 0 && verify && |
5385 | | - strcmp(verify, legacy_verify) != 0 && strstr(verify, "Tier 2") && |
5386 | | - strstr(verify, "name = \"codebase-memory\"") && |
5387 | | - strstr(verify, "check_index_coverage") && auditor && |
5388 | | - strstr(auditor, "Tier 3") && strstr(auditor, "check_index_coverage") && |
5389 | | - !strstr(verify, "index_repository") && !strstr(verify, "delete_project") && |
5390 | | - !strstr(verify, "manage_adr") && !strstr(verify, "ingest_traces") && |
5391 | | - !strstr(auditor, "index_repository") && !strstr(auditor, "delete_project") && |
5392 | | - !strstr(auditor, "manage_adr") && !strstr(auditor, "ingest_traces"); |
| 5406 | + bool installed = |
| 5407 | + install_rc != 0 && scout && strcmp(scout, foreign_scout) == 0 && verify && |
| 5408 | + strcmp(verify, legacy_verify) != 0 && strstr(verify, "Tier 2") && |
| 5409 | + strstr(verify, "name = \"codebase-memory\"") && strstr(verify, expected_command) && |
| 5410 | + strstr(verify, "args = [\"--tool-profile=analysis\"]") && |
| 5411 | + strstr(verify, "check_index_coverage") && auditor && strstr(auditor, expected_command) && |
| 5412 | + strstr(auditor, "args = [\"--tool-profile=analysis\"]") && strstr(auditor, "Tier 3") && |
| 5413 | + strstr(auditor, "check_index_coverage") && !strstr(verify, "index_repository") && |
| 5414 | + !strstr(verify, "delete_project") && !strstr(verify, "manage_adr") && |
| 5415 | + !strstr(verify, "ingest_traces") && !strstr(auditor, "index_repository") && |
| 5416 | + !strstr(auditor, "delete_project") && !strstr(auditor, "manage_adr") && |
| 5417 | + !strstr(auditor, "ingest_traces"); |
5393 | 5418 | free(scout); |
5394 | 5419 | free(verify); |
5395 | 5420 | free(auditor); |
|
0 commit comments