Skip to content

Commit c3c5271

Browse files
committed
test: give the index policy fixture distinct repo and cache roots
index_policy_mcp_rejects_forged_override_and_preserves_serving_index called th_mktempdir twice and kept both returned pointers, but th_mktempdir returns a shared static buffer. After the second call `repo` and `cache` were the same string (the cache directory), so the first index_repository request targeted the cache root and was refused by the workspace guard: /tmp/cbm_index_policy_mcp_cache_LjrHdR: path is a volume root or holds the codebase-memory cache; it cannot be indexed. That guard is intentional (fork commit 19f5bdf, "fix workspace cache root authorization"), which landed on main after the last green full Jenkins run (DeusData#88 at 214b87b). The failure therefore pre-exists on main cf63fe6 and surfaced in release-tooling build DeusData#89; it is not caused by the upstream 13M-1 merge. Copy each path into its own buffer so the fixture's repository and cache are separate sibling directories. Product behaviour is unchanged. Root cause found by a Codex gpt-6-luna agent; verified by rerunning the index_policy and index_supervisor suites.
1 parent 3cbefe2 commit c3c5271

1 file changed

Lines changed: 10 additions & 4 deletions

File tree

‎tests/test_index_policy.c‎

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -287,10 +287,16 @@ TEST(index_policy_worker_rejects_missing_parent_policy) {
287287
}
288288

289289
TEST(index_policy_mcp_rejects_forged_override_and_preserves_serving_index) {
290-
char *repo = th_mktempdir("cbm_index_policy_mcp_repo");
291-
char *cache = th_mktempdir("cbm_index_policy_mcp_cache");
292-
ASSERT_NOT_NULL(repo);
293-
ASSERT_NOT_NULL(cache);
290+
char repo_path[1024];
291+
char *created = th_mktempdir("cbm_index_policy_mcp_repo");
292+
ASSERT_NOT_NULL(created);
293+
(void)snprintf(repo_path, sizeof(repo_path), "%s", created);
294+
created = th_mktempdir("cbm_index_policy_mcp_cache");
295+
ASSERT_NOT_NULL(created);
296+
char cache_path[1024];
297+
(void)snprintf(cache_path, sizeof(cache_path), "%s", created);
298+
const char *repo = repo_path;
299+
const char *cache = cache_path;
294300
ASSERT_EQ(th_write_file(TH_PATH(repo, "first.c"), "int first(void) { return 1; }\n"), 0);
295301

296302
const char *saved_cache = getenv("CBM_CACHE_DIR");

0 commit comments

Comments
 (0)