Skip to content

fix(federation): skip federated subrepos on Windows (path normalization)#78

Merged
joy-software merged 1 commit into
developfrom
fix/win-federation-skip
Jun 8, 2026
Merged

fix(federation): skip federated subrepos on Windows (path normalization)#78
joy-software merged 1 commit into
developfrom
fix/win-federation-skip

Conversation

@joy-software

Copy link
Copy Markdown
Contributor

The bug

On Windows, cgh init counts (and cgh index scans) the entire tree including federated subrepos, instead of skipping them. Reported on a landing-zone monorepo with 18 federated service subrepos under edf-sa/ (2232 files, mostly inside the subrepos).

Root cause

is_under_any resolved the subrepo roots (via resolve_children) but left an already-absolute candidate path untouched, then compared with pathlib's case-sensitive relative_to. Windows is case-insensitive and resolve() can change casing / 8.3 short-names, so the prefix never matched -> every subrepo missed the skip list. POSIX was unaffected (resolve of an absolute path is a no-op there), which is why it only showed up on Git Bash / Windows.

Fix

Resolve both sides and compare os.path.normcase'd strings on a path-separator boundary (so /foo/services-bar is not treated as under /foo/services). Both the file census and the real scan route through is_under_any, so this fixes both.

Tests

nested-subrepo match (the edf-sa/services-* layout), sibling-prefix boundary safety, root-itself, plus the existing cases. Server/indexer/cli suites: 155 passed.

is_under_any resolved the subrepo roots but left an already-absolute
candidate path untouched, and compared with pathlib's case-sensitive
relative_to. On Windows the filesystem is case-insensitive and resolve()
can change casing or 8.3 short-names, so every federated subrepo failed to
match and none of its files were skipped: cgh init counted, and cgh index
scanned, the whole tree including federated subdirs.

Now both sides are resolved and os.path.normcase'd, with a separator-boundary
prefix check (so /foo/services-bar is not treated as under /foo/services).
This fixes the file census and the actual parent scan, which both route
through is_under_any. POSIX behavior is unchanged (normcase is identity).

Tests: nested-subrepo match (the landing-zone edf-sa/services-* layout),
sibling-prefix boundary safety, root-itself, on top of the existing cases.
@joy-software joy-software merged commit d02829a into develop Jun 8, 2026
8 checks passed
@joy-software joy-software deleted the fix/win-federation-skip branch June 8, 2026 17:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant