Skip to content

Local code intelligence for developers and AI agents. Connect code, docs and infrastructure in a persistent graph, with CBM Lens, MCP tools, agent integrations and change-aware test selection.

fix(pkgmap): make repo-wide manifest walk POSIX-only (Windows hang)

Martin Vogelbcf73b29e81a
diff --git a/src/pipeline/pass_pkgmap.c b/src/pipeline/pass_pkgmap.c
index 225c06d36..bfa77e824 100644
--- a/src/pipeline/pass_pkgmap.c
+++ b/src/pipeline/pass_pkgmap.c
@@ -774,7 +774,12 @@ static bool is_pkgmap_manifest_basename(const char *basename) {
* needs to read them to resolve workspace imports. Skips directories
* matched by the shared cbm_should_skip_dir helper so we don't walk
* node_modules, .git, build, etc. Returns the number of manifests
- * parsed, accumulated across the whole walk. */
+ * parsed, accumulated across the whole walk.
+ *
+ * POSIX-only: lstat + S_ISLNK skipping avoids following symlink cycles.
+ * The Windows port (junction-safe descent) is a follow-up; cbm_pkgmap_scan_repo
+ * is a no-op on Windows so this is never reached there. */
+#ifndef _WIN32
static int pkgmap_walk_dir(const char *abs_dir, const char *rel_dir, cbm_pkg_entries_t *entries) {
DIR *dir = opendir(abs_dir);
if (!dir) {
@@ -836,6 +841,7 @@ static int pkgmap_walk_dir(const char *abs_dir, const char *rel_dir, cbm_pkg_ent
closedir(dir);
return parsed;
}
+#endif /* !_WIN32 */
/* Scan a repository for package manifest files via the filesystem
* walker above. Always-available companion to the parallel path's
@@ -846,9 +852,21 @@ int cbm_pkgmap_scan_repo(const char *repo_path, cbm_pkg_entries_t *entries) {
if (!repo_path || !entries) {
return 0;
}
+#ifdef _WIN32
+ /* The repo-wide manifest walk is POSIX-only for now: on Windows the
+ * recursive descent has hung in CI (no lstat/reparse-point skipping, so
+ * directory junctions can be followed into cycles). Fall back to the
+ * files[]-based pkgmap (baseline behavior) until the walk is made
+ * junction-safe on Windows. Workspace-import resolution from ignored
+ * manifests (package.json) is therefore Linux/macOS-only for now. */
+ (void)entries;
+ cbm_log_info("pkgmap.scan_repo", "skipped", "win32");
+ return 0;
+#else
int parsed = pkgmap_walk_dir(repo_path, "", entries);
cbm_log_info("pkgmap.scan_repo", "manifests", pkgmap_itoa(parsed));
return parsed;
+#endif
}
/* Build pkgmap for sequential path (reads manifest files directly) */