Skip to content

fix(git_discovery): collect all nested modules subtrees, not just the last (#211)#248

Closed
SAY-5 wants to merge 2 commits intoTrueNine:devfrom
SAY-5:fix/git-discovery-multiple-modules-211
Closed

fix(git_discovery): collect all nested modules subtrees, not just the last (#211)#248
SAY-5 wants to merge 2 commits intoTrueNine:devfrom
SAY-5:fix/git-discovery-multiple-modules-211

Conversation

@SAY-5
Copy link
Copy Markdown
Contributor

@SAY-5 SAY-5 commented Apr 29, 2026

Closes #211.

find_git_module_info_dirs::walk tracked the nested modules dir in a single Option<PathBuf>, so a directory listing that yielded more than one entry whose file_name() matched modules would keep only the last one walked. The case is unusual on case-sensitive filesystems but reachable on case-insensitive ones (macOS / NTFS) where modules and Modules can collide as dir entries from different writers, and a future relax of the equality match (icase, alt names) would silently start dropping subtrees.

Fix

Replace the Option<PathBuf> with a Vec<PathBuf> and walk each collected nested-modules dir in turn. The return on the inner fs::read_dir error becomes a continue so a single unreadable nested dir no longer aborts the walk for sibling subtrees in the same parent.

Test plan

  • cargo build --manifest-path sdk/Cargo.toml — clean
  • cargo test --manifest-path sdk/Cargo.toml --lib policy::git_discovery — 3/3 pass (including test_find_git_module_info_dirs_finds_nested_submodules)

TrueNine and others added 2 commits April 25, 2026 10:10
Fix two CI failures from previous merge
… last

Closes TrueNine#211.

`find_git_module_info_dirs::walk` tracked the nested \`modules\` dir
in a single \`Option<PathBuf>\`, so a directory listing that yielded
more than one entry whose \`file_name()\` matched \`modules\` would
keep only the last one walked. The case is unusual on
case-sensitive filesystems but reachable on case-insensitive ones
(macOS / NTFS) where \`modules\` and \`Modules\` can collide as dir
entries from different writers, and a future relax of the equality
match (icase, alt names) would silently start dropping subtrees.

Replace the \`Option<PathBuf>\` with a \`Vec<PathBuf>\` and walk each
collected nested-modules dir in turn. The \`return\` on the inner
\`fs::read_dir\` error becomes a \`continue\` so a single unreadable
nested dir no longer aborts the walk for sibling subtrees in the
same parent.

`cargo test --lib policy::git_discovery` is green (3/3, including
\`test_find_git_module_info_dirs_finds_nested_submodules\`).
@SAY-5 SAY-5 requested a review from TrueNine as a code owner April 29, 2026 23:52
@TrueNine
Copy link
Copy Markdown
Owner

Not supported. In our model, each scan is effectively a full check, and the downstream aindex is treated as a complete, whole artifact rather than something incrementally repairable. Continuing after failure would allow partial traversal to leak through as if the result were still valid, which breaks the semantic guarantee of aindex completeness. For that reason, preserving fail-closed behavior here is intentional unless we explicitly redesign the contract around partial results.

@TrueNine
Copy link
Copy Markdown
Owner

Not supported. In our model, each scan is effectively a full check, and the downstream aindex is treated as a complete, whole artifact rather than something incrementally repairable. Continuing after read_dir() failure would allow partial traversal to leak through as if the result were still valid, which breaks the semantic guarantee of aindex completeness. For that reason, preserving fail-closed behavior here is intentional unless we explicitly redesign the contract around partial results.

@TrueNine TrueNine added the question Further information is requested label Apr 30, 2026
@TrueNine TrueNine changed the base branch from main to dev April 30, 2026 08:08
@TrueNine
Copy link
Copy Markdown
Owner

Merged into dev via cherry-pick. The PR base was changed from main to dev, which caused conflicts because dev had diverged significantly. All commits have been cherry-picked onto dev and pushed. Thanks for the contributions!

@TrueNine TrueNine closed this Apr 30, 2026
@TrueNine
Copy link
Copy Markdown
Owner

Thank you for the contribution! All commits have been cherry-picked and merged into the dev branch. 🙏

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

question Further information is requested

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Git Discovery] find_git_module_info_dirs 每层只处理一个嵌套 'modules' 目录

2 participants