Skip to content

refactor: use config from meta_core, CloneQueue from meta_git_lib - #14

Merged
mateodelnorte merged 4 commits into
mainfrom
refactor/move-config-to-meta-core
Feb 14, 2026
Merged

mateodelnorte merged 4 commits into
mainfrom
refactor/move-config-to-meta-core

Conversation

@mateodelnorte

@mateodelnorte mateodelnorte commented Feb 13, 2026 •

Copy link
Copy Markdown
Contributor

Summary

  • Import config from meta_core instead of meta_cli across all modules
  • Use CloneQueue/CloneTask from meta_git_lib instead of local module
  • Rename clone_queue.rs to clone_worker.rs (keeps only the worker thread pool logic)
  • Add meta_core dependency

Merge order

Merge after: gitkb/meta_core#3 and gitkb/meta_git_lib#2

Test plan

  • cargo build --workspace passes
  • cargo test --workspace passes
  • bats tests/git.bats — 51/51 pass

🤖 Generated with Claude Code

Summary by CodeRabbit

  • New Features

    • Added --meta-depth flag for the meta git clone command to control nested meta repository discovery depth; help text updated.
  • Chores

    • CI cloning made branch-aware: tries branch-specific clones first, then falls back to full clones for robustness.
  • Chores

    • Internal config handling unified across commands (no user-facing behavior changes).

Import config from meta_core instead of meta_cli across all modules.
Move CloneQueue/CloneTask to meta_git_lib, keeping only the worker
thread pool (clone_worker.rs) in this crate.

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

coderabbitai Bot commented Feb 13, 2026 •

Copy link
Copy Markdown

Walkthrough

Switches config usage from meta_cli::config to meta_core::config, replaces local clone queue/task types with meta_git_lib::clone_queue types, adjusts clone worker lifecycle to avoid a race, renames clone_queue module to clone_worker, and makes CI clone steps branch-aware with a fallback.

Changes

Cohort / File(s) Summary
Dependency
Cargo.toml
Added meta_core path dependency (../meta_core).
CI / Workflows
.github/workflows/auto-format.yml, .github/workflows/ci.yml
Consolidated per-repo clones into a loop that tries a branch-specific clone (-b "$BRANCH") and falls back to plain clone; added BRANCH handling and explicit clone success/failure logic.
Module & Help
src/lib.rs
Renamed module from clone_queue → clone_worker; added --meta-depth help text; tests updated to use meta_core::config::parse_meta_config.
Clone API & Workers
src/clone_worker.rs, src/clone.rs, src/update.rs
Replaced local CloneQueue/CloneTask definitions with imports from meta_git_lib::clone_queue; moved clone_with_queue import to crate::clone_worker; adjusted worker active-count increments/decrements and use of queue.git_depth() accessor.
Config API Migration
src/commit.rs, src/helpers.rs, src/ssh.rs, src/commands/worktree/create.rs, src/commands/worktree/prune.rs
Replaced meta_cli::config usages with meta_core::config equivalents (discovery, parsing, types and call sites).

Sequence Diagram(s)

mermaid
sequenceDiagram
participant CLI
participant CloneManager as CloneManager (crate::clone_worker)
participant Queue as CloneQueue (meta_git_lib::clone_queue)
participant Git as Git/Repo
CLI->>CloneManager: start clone_with_queue(...)
CloneManager->>Queue: increment active
CloneManager->>Queue: pop_task()
alt task available
Queue-->>CloneManager: CloneTask
CloneManager->>Git: clone/fetch (use queue.git_depth())
Git-->>CloneManager: result (success/failure)
CloneManager->>Queue: mark task done / enqueue nested repos
CloneManager->>Queue: decrement active if finishing
else no task
CloneManager->>Queue: decrement active
CloneManager->>Queue: is_finished?
alt finished
CloneManager->>CLI: exit worker
else not finished
CloneManager->>Queue: wait / retry
end
end

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

Poem

🐰 I hopped through crates and swapped a queue or two,

Workers count first, then fetch what they must do,
Branchy clones jump first and tumble if they fail,
Meta config moved homes down a simpler trail,
I nibble a carrot and hum a tiny review tune.

🚥 Pre-merge checks | ✅ 4
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately summarizes the main refactoring changes: moving config imports from meta_cli to meta_core and CloneQueue from local to meta_git_lib, which aligns with the primary objective of the PR.
Docstring Coverage ✅ Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%.
Merge Conflict Detection ✅ Passed ✅ No merge conflicts detected when merging into main

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

✨ Finishing touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch refactor/move-config-to-meta-core

No actionable comments were generated in the recent review. 🎉


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

@mateodelnorte

Copy link
Copy Markdown
Contributor Author

@coderabbitai review

@coderabbitai

coderabbitai Bot commented Feb 13, 2026

Copy link
Copy Markdown
✅ Actions performed

Review triggered.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

@coderabbitai coderabbitai 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.

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (3)
src/commit.rs (1)

49-53: ⚠️ Potential issue | 🔴 Critical

Pipeline failure: Type inference issue requires explicit annotation.

The CI reports a type inference error at this location. The dirs collection type cannot be inferred, likely due to changes in the parse_meta_config return type from meta_core.

🐛 Proposed fix: Add explicit type annotation
         let (projects, _) = config::parse_meta_config(&meta_path)?;

-        let mut dirs = vec![".".to_string()];
+        let mut dirs: Vec<String> = vec![".".to_string()];
         dirs.extend(projects.iter().map(|p| p.path.clone()));
         dirs
src/clone_worker.rs (1)

28-34: ⚠️ Potential issue | 🟡 Minor

Pipeline failure: Type annotations needed.

The CI reports type annotation errors. These are likely caused by the missing CloneQueue type from meta_git_lib::clone_queue. Once the upstream dependency is available, the compiler should be able to infer types. If errors persist after merge, explicit type annotations may be needed.

src/ssh.rs (1)

83-88: ⚠️ Potential issue | 🔴 Critical

Fix type mismatch: Convert &str to String for RemoteMismatch.expected field.

The expected_url variable after destructuring &project.repo is of type &str, but the RemoteMismatch.expected field requires String. Calling .clone() on &str returns &str, not String.

Proposed fix
         if !meta_git_lib::urls_match(&actual_url, expected_url) {
             mismatches.push(RemoteMismatch {
                 name: project.name.clone(),
-                expected: expected_url.clone(),
+                expected: expected_url.to_string(),
             });
         }

When coordinated changes span multiple repos, CI needs to clone
dependency repos from the same branch (not just main) to pick up
changes that haven't merged yet. Add smart branch cloning that tries
the PR branch name first before falling back to main.

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

@coderabbitai coderabbitai 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.

Actionable comments posted: 2

🤖 Fix all issues with AI agents
In @.github/workflows/auto-format.yml:
- Around line 36-40: The loop that clones repos (uses BRANCH and repo) currently
silences failures and continues if both git clone attempts fail; update the
for-loop after the two clone attempts to check the exit status and, on failure,
print a clear error mentioning the repo and BRANCH and exit non‑zero (fail fast)
so subsequent steps don't run with missing repositories.

In @.github/workflows/ci.yml:
- Around line 29-33: The current git clone in the loop discards stderr and
silently falls back when cloning with BRANCH fails, so change the clone logic in
the for loop to detect the first failure and emit a clear log message before
attempting the fallback; specifically, replace the "git clone --depth 1 -b
\"$BRANCH\" ... 2>/dev/null || git clone --depth 1 ..." pattern with a
conditional or short-circuit that captures the failure (e.g., run the first
clone without redirecting stderr or test its exit status), and on non-zero exit
print a message like "Branch clone for $repo with branch $BRANCH failed, falling
back to default branch" before running the second "git clone --depth 1" so CI
logs show when the fallback occurred.

Comment thread .github/workflows/auto-format.yml Outdated
Comment thread .github/workflows/ci.yml Outdated
- Move github.head_ref from inline shell interpolation to env: section
  to prevent command injection from malicious branch names
- Add clone failure handling (fail fast with ::error:: annotation)
- Add branch logging so CI shows which branch was used for each dep

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@mateodelnorte
mateodelnorte merged commit a316c0d into main Feb 14, 2026
7 checks passed
@mateodelnorte
mateodelnorte deleted the refactor/move-config-to-meta-core branch February 14, 2026 03:19
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