Skip to content

feat(config): add find_root_meta_dir() for ancestor discovery - #5

Merged
mateodelnorte merged 3 commits into
mainfrom
feat/project-list-root-walk
Feb 21, 2026
Merged

mateodelnorte merged 3 commits into
mainfrom
feat/project-list-root-walk

Conversation

@mateodelnorte

@mateodelnorte mateodelnorte commented Feb 21, 2026 •

Copy link
Copy Markdown
Contributor

Summary

  • Adds find_root_meta_dir() that walks up through parent .meta configs to find the topmost meta directory in the hierarchy
  • Used by meta project list --recursive (in meta_project_cli) to start from the root ancestor instead of the nearest meta-repo
  • 3 unit tests covering single-level, two-level, and three-level hierarchies

Test plan

  • cargo test -p meta_core -- find_root_meta_dir — 3/3 passing
  • cargo test --workspace — 652 tests, 0 failures

🤖 Generated with Claude Code

Summary by CodeRabbit

  • New Features

    • Enhanced meta directory handling with support for hierarchical configuration structures, enabling the system to correctly identify and navigate nested .meta configurations from child to root level.
  • Tests

    • Added comprehensive unit tests validating single, two, and three-level directory hierarchy scenarios.

Walks up through parent .meta configs to find the topmost meta directory
in the hierarchy. Used by `meta project list --recursive` to start from
the root ancestor instead of the nearest meta-repo.

Implements [[tasks/meta-65]]

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@coderabbitai

coderabbitai Bot commented Feb 21, 2026 •

Copy link
Copy Markdown

No actionable comments were generated in the recent review. 🎉


Walkthrough

A new public utility function find_root_meta_dir is added to src/config.rs that traverses upward from a given .meta directory to locate the topmost parent .meta configuration by repeatedly invoking find_parent_meta_config. Comprehensive unit tests verify correct behavior across single, two-level, and three-level hierarchies.

Changes

Cohort / File(s) Summary
Root Meta Directory Traversal
src/config.rs
Added public function find_root_meta_dir that iteratively finds the topmost parent .meta configuration directory. Includes unit tests for single-level, two-level, and three-level hierarchies, plus root detection verification. Existing logic remains unchanged.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Possibly related PRs

Poem

🐰 Hop hop, up we go,
Through parent configs, row by row,
Until the root declares its claim,
Where hierarchy finds its name. ✨

🚥 Pre-merge checks | ✅ 3
✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title 'feat(config): add find_root_meta_dir() for ancestor discovery' accurately and clearly summarizes the main change: adding a new function for discovering ancestor meta directories.
Docstring Coverage ✅ Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
  • 📝 Generate docstrings (stacked PR)
  • 📝 Generate docstrings (commit on current branch)
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch feat/project-list-root-walk

Comment @coderabbitai help to get the list of available commands and usage tips.

@greptile-apps

greptile-apps Bot commented Feb 21, 2026

Copy link
Copy Markdown

Greptile Summary

Adds find_root_meta_dir() to walk up the directory hierarchy and find the topmost meta-repo ancestor. This enables meta project list --recursive to start from the root instead of the nearest meta-repo.

Changes:

  • New public function find_root_meta_dir() that repeatedly calls find_parent_meta_config() until no more parents are found
  • Comprehensive test coverage with 3 unit tests (no parent, two-level, three-level hierarchies)
  • All 652 workspace tests pass according to PR description

Notes:

  • The function uses a defensive .unwrap_or(Path::new(".")) fallback that may be unnecessary but doesn't cause issues
  • Implementation correctly handles the case where meta_dir is already the root (returns unchanged)

Confidence Score: 4/5

  • Safe to merge with minimal risk
  • Well-tested new function with clear use case. Implementation is straightforward and builds on existing helper functions. Minor style consideration around error handling doesn't affect correctness.
  • No files require special attention

Important Files Changed

Filename Overview
src/config.rs Added find_root_meta_dir() function with comprehensive test coverage (3 tests); implementation looks solid with minor consideration for edge case handling

Last reviewed commit: f12f19b

@greptile-apps greptile-apps Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

1 file reviewed, 1 comment

Edit Code Review Agent Settings | Greptile

Comment thread src/config.rs Outdated
parent() on a file path should always succeed, so use expect() to
surface unexpected errors instead of silently falling back to ".".

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@mateodelnorte

Copy link
Copy Markdown
Contributor Author

Addressed review feedback: replaced .unwrap_or(Path::new(".")) with .expect("config file path should always have a parent directory") — since parent() on a file path returned by find_parent_meta_config should always succeed. Fixed in 9af9d83.

@mateodelnorte
mateodelnorte merged commit 415ab98 into main Feb 21, 2026
7 checks passed
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