fix(minimal): honor -C/--repo-dir in min activate path resolution - #909
Conversation
📝 WalkthroughWalkthrough
ChangesActivate path resolution
Estimated code review effort: 2 (Simple) | ~10 minutes Possibly related issues
Possibly related PRs
Suggested reviewers: Poem
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches📝 Generate docstrings
Comment |
`min activate` silently ignored the global `-C`/`--repo-dir` flag, always uploading from the current working directory instead. The flag worked for local build-system commands (`init`, `add`, `update`) but was a no-op for the daemon-facing `activate`, which resolved only the positional `PATH` argument (default `.`). Make the positional `path` an `Option<String>` so the default is distinguishable from an explicit value. `cmd_activate` now resolves the effective project path as: explicit positional → `-C`/`--repo-dir` → current directory. The bare-`min` dispatch (which previously set `path` from `repo_dir` itself) now passes `None` and lets `cmd_activate` handle the resolution. Closes #873.
fad2777 to
4abaf94
Compare
There was a problem hiding this comment.
🧹 Nitpick comments (1)
crates/minimal/tests/cli.rs (1)
318-347: 🎯 Functional Correctness | 🔵 Trivial | ⚡ Quick winCover explicit-path precedence over
--repo-dir.This validates fallback only. Add a case with distinct positional and
repo_dirdirectories, then assert the positional directory supplies bothproject_pathand uploaded files—the first-priority contract in this PR.🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@crates/minimal/tests/cli.rs` around lines 318 - 347, Extend the CLI test around ActivateArgs and cmd_activate to use distinct positional path and --repo-dir directories, then verify the positional directory takes precedence. Assert the session’s project_path matches the positional directory and that the uploaded/read file comes from that directory, covering both path selection and file contents.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Nitpick comments:
In `@crates/minimal/tests/cli.rs`:
- Around line 318-347: Extend the CLI test around ActivateArgs and cmd_activate
to use distinct positional path and --repo-dir directories, then verify the
positional directory takes precedence. Assert the session’s project_path matches
the positional directory and that the uploaded/read file comes from that
directory, covering both path selection and file contents.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro
Run ID: 6e398cdd-a2eb-44d4-a5c3-a653f0a2f153
📒 Files selected for processing (2)
crates/minimal/src/lib.rscrates/minimal/tests/cli.rs
min activatesilently ignored the global-C/--repo-dirflag, always uploading from the current working directory instead of the specified directory. This caused wrong-directory uploads with no error — in a large repo, triggering multi-gigabyte uploads of the wrong project.Root cause
ActivateArgs.pathhaddefault_value = ".", so clap always filled it.cmd_activatecanonicalizedargs.pathand never consultedglobal.repo_dir. The flag worked for local build-system commands (init,add,update) viabuild_configbut was a no-op for the daemon-facingactivate.Fix
pathfromString(default".") toOption<String>so the default is distinguishable from an explicit value.cmd_activatenow resolves the effective project path: explicit positional →-C/--repo-dir→ current directory.mindispatch to passpath: Nonesincecmd_activatehandles resolution.attachalready usescwd_host_path(global)which honorsrepo_dir;destroy,rename,session policytake session identifiers, not paths.Closes #873.
Note
Fix
min activateto honor-C/--repo-dirwhen no positional path is givenPreviously,
ActivateArgs.pathdefaulted to"."at parse time, so-C/--repo-dirwas ignored during activation when no explicit path was provided. The fix makespathoptional and adds explicit precedence resolution incmd_activate: use the positional path if given, then--repo-dir, then".". A new test in cli.rs verifies the corrected behavior.Macroscope summarized 4abaf94.
Summary by CodeRabbit
Bug Fixes
min activatepath handling when no project path is provided.--repo-diroption is now correctly used as the project directory when applicable.Tests