Skip to content

fix(minimal): honor -C/--repo-dir in min activate path resolution - #909

Merged
0chroma merged 1 commit into
mainfrom
0chroma/fix-activate-repo-dir-873
Jul 24, 2026
Merged

fix(minimal): honor -C/--repo-dir in min activate path resolution#909
0chroma merged 1 commit into
mainfrom
0chroma/fix-activate-repo-dir-873

Conversation

@0chroma

@0chroma 0chroma commented Jul 22, 2026

Copy link
Copy Markdown
Contributor

min activate silently ignored the global -C/--repo-dir flag, 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.path had default_value = ".", so clap always filled it. cmd_activate canonicalized args.path and never consulted global.repo_dir. The flag worked for local build-system commands (init, add, update) via build_config but was a no-op for the daemon-facing activate.

Fix

  • Changed path from String (default ".") to Option<String> so the default is distinguishable from an explicit value.
  • cmd_activate now resolves the effective project path: explicit positional → -C/--repo-dir → current directory.
  • Updated the bare-min dispatch to pass path: None since cmd_activate handles resolution.
  • Audited other daemon-facing subcommands: attach already uses cwd_host_path(global) which honors repo_dir; destroy, rename, session policy take session identifiers, not paths.

Closes #873.

Note

Fix min activate to honor -C/--repo-dir when no positional path is given

Previously, ActivateArgs.path defaulted to "." at parse time, so -C/--repo-dir was ignored during activation when no explicit path was provided. The fix makes path optional and adds explicit precedence resolution in cmd_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

    • Improved min activate path handling when no project path is provided.
    • The --repo-dir option is now correctly used as the project directory when applicable.
    • Error messages now reference the resolved project path.
  • Tests

    • Added coverage confirming sessions use the configured repository directory and retain existing project files.

@coderabbitai

coderabbitai Bot commented Jul 22, 2026

Copy link
Copy Markdown

Review Change Stack

📝 Walkthrough

Walkthrough

min activate now accepts an optional project path and resolves omitted paths from --repo-dir, falling back to the current directory. Bare activation defers to this resolution, and integration tests verify repository selection and uploaded files.

Changes

Activate path resolution

Layer / File(s) Summary
Path contract and resolution
crates/minimal/src/lib.rs
ActivateArgs.path is optional; bare activation passes None, and cmd_activate resolves the positional path, --repo-dir, or ".".
Activation path tests
crates/minimal/tests/cli.rs
Existing activation tests use Some(...), and a new test verifies repository-directory selection and project file upload when no positional path is provided.

Estimated code review effort: 2 (Simple) | ~10 minutes

Possibly related issues

  • gominimal/inbox#330 — Covers the fallback from an omitted activation path to global.repo_dir.

Possibly related PRs

Suggested reviewers: evanspearman

Poem

A rabbit hops where paths were spun,
From repo root to session begun.
No path? “I know,” says bun with cheer,
The right small project now appears.
hello.txt rides safely near.

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Linked Issues check ✅ Passed The changes implement the requested path precedence for #873 and include the related daemon-facing audit.
Out of Scope Changes check ✅ Passed The change stays within activate path resolution and its tests; no unrelated scope is apparent from the summaries.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Title check ✅ Passed Clear conventional-commit style title that matches the main change: honoring -C/--repo-dir during min activate path resolution.
Description check ✅ Passed Covers the summary, root cause, fix, and issue closure; only Testing and Checklist sections from the template are missing.
✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch

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

`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.
@0chroma
0chroma force-pushed the 0chroma/fix-activate-repo-dir-873 branch from fad2777 to 4abaf94 Compare July 22, 2026 20:25
@0chroma
0chroma marked this pull request as ready for review July 24, 2026 15:35

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

🧹 Nitpick comments (1)
crates/minimal/tests/cli.rs (1)

318-347: 🎯 Functional Correctness | 🔵 Trivial | ⚡ Quick win

Cover explicit-path precedence over --repo-dir.

This validates fallback only. Add a case with distinct positional and repo_dir directories, then assert the positional directory supplies both project_path and 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

📥 Commits

Reviewing files that changed from the base of the PR and between 159f883 and 4abaf94.

📒 Files selected for processing (2)
  • crates/minimal/src/lib.rs
  • crates/minimal/tests/cli.rs

@0chroma
0chroma merged commit 3a05252 into main Jul 24, 2026
29 checks passed
@0chroma
0chroma deleted the 0chroma/fix-activate-repo-dir-873 branch July 24, 2026 16:49
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.

minimal: min activate ignores -C/--repo-dir and uploads the cwd instead

2 participants