Repository navigation
feat(cli): add a global --home store-root flag - #427
Conversation
tx-agent: jcode tx-validated: test tx-scope: cli tx-lane: jcode:session_sunflower_1795863359820_96546bd4d4e73237
Thanks for using CodeAnt! 🎉We're free for open-source projects. if you're enjoying it, help us grow by sharing. Share on X · |
|
Warning Review limit reachedYou've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository. Next included review available in 41 minutes. View limit details
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. |
|
Code Review SummaryStatus: No Issues Found | Recommendation: Merge Overview
Files Reviewed (2 files)
The incremental diff is a pure test reorganization: the Previous Review Summaries (2 snapshots, latest commit c798266)Current summary above is authoritative. Previous snapshots are kept for context only. Previous review (commit c798266)Status: No Issues Found | Recommendation: Merge Overview
Files Reviewed (2 files)
Previous review (commit 3c26c15)Status: 1 Suggestion Found | Recommendation: Merge (address minor test portability) Overview
Issue Details (click to expand)SUGGESTION
Files Reviewed (3 files)
Note: The KCODE_HOME-not-reset test-pollution concern (line 1111) was already raised by CodeAnt; not duplicated here. Reviewed by free · Input: 23.5K · Output: 2K · Cached: 160.2K |
|
|
Runtime verification at d2ecedb (this branch), real binary Rejected (rc=1, before any store work): KCODE_HOME propagation proven by execution: (1) Nuance: the telemetry path still bootstraps generic store state (logs, migrations, prune stamp) in the override home; it writes no telemetry identity. The flag is only excluded from subcommand detection, not from startup bootstrap. Full evidence: Scope unchanged: root cause B and restore-path forwarding of |



User description
Refs #424 — addresses the missing argv-level store override (root cause A). Does not resolve root cause B (success decided at spawn; snapshot cleared before the child proves it resolved its session). Root cause B remains open and needs the restore spawn path to gate snapshot clearing on child liveness/session resolution.
What
--home <PATH>flag (alias--data-dir) to thekcodeCLI insrc/cli/args.rs, registered asglobal = truewithvalue_name = "PATH", so it can be placed before any subcommand and applies to the whole process.apply_homeinsrc/cli/startup.rs: validates that the value exists and is a directory (metadata().is_dir()), rejects files and missing paths withanyhow::bail!, enforcesrequire_kcode_pathso a.jcodehome is rejected, then setsKCODE_HOMEviacrate::env::set_varbefore store resolution. Called asapply_home(args.home.as_deref())?immediately afterArgs::parse().--home/--data-dirintois_telemetry_subcommand_invocation's global-flag skip list so the flag is not mistaken for the telemetry subcommand. This does not suppress generic startup bootstrap:telemetry statuswith an override home still createslogs/,migrations/, andsessions-bak-prune.stampinside that home, while writing no telemetry identity.home_and_data_dir_are_global_and_apply_kcode_homeinsrc/cli/args/tests/startup.rscovering parse of both spellings, rejection of a missing path, rejection of a.jcodedirectory, and successfulKCODE_HOMEpropagation.telemetry_subcommand_skips_startup_telemetrywith cases for--homeand--data-dir=/...forms.Scope
Covered:
kcode --home <PATH>/kcode --data-dir=<PATH>..jcodehomes are rejected in favor of a kcode home.KCODE_HOMEis set before any store resolution inrun().Not covered:
session_launch.rswas not modified (per validation report scope notes), so a child that dies still costs the user the snapshot.hc run --bg --outlive-parentstill does not inherit the client's env, so a real cross-home restore still requires the caller to pass--home/--data-direxplicitly in the child argv. This branch supplies the mechanism; wiring it into restore is separate work.hc run --env(suggested fix TUI: Bottom status line readability degrades in crowded multi-pane layouts #3 in restore: snapshot cleared on spawn, not on resume — child loses store location through hc hook (cross-home restore reports success with 0 windows) #424), which remains absent.--libtests and the workspace CI were validated at d2ecedb.Validation
Validated at commit
d2ecedb259ac1c17eae0b7e1f5958c3077dc1635, repository/Users/kooshapari/CodeProjects/phenotype/repos/KCode-space/fix/wtree, branchfix/restore-home-flag:CI at exact head: 13/13 contexts green;
Aggregate gatedatabase id141011891620. This is the authoritative workspace check; no local workspace check is substituted.cargo test --lib cli::args::tests::startup::home_and_data_dir_are_global_and_apply_kcode_hometest result: ok. 1 passed; 0 failed; 0 ignored; 0 measured; 311 filtered outTMPDIR. This harness'sTMPDIR=~/.jcode/scratchmakestempfile::tempdir()create a path under a.jcodeancestor, whichapply_homecorrectly rejects. With a neutralTMPDIRthe test passes. This is a test-robustness caveat, not anapply_homefailure.cargo test --lib cli::startup::tests::telemetry_subcommand_skips_startup_telemetrytest result: ok. 1 passed; 0 failed; 0 ignored; 0 measured; 311 filtered outcargo fmt --all -- --checkexit 0;git diff --checkexit 0.Gaps found in the diff (honest)
apply_homerejects a file path (Ok(_) => bail!("--home must point to a directory: …")) and missing paths, so the "value not rejected when it is a file" failure mode is handled. No gap there.--data-dirCLI consumer conflicts: grep ofsrc/andcrates/found no other--data-dir/--data_dirargument; only internaldata_dirvariable naming. The alias is safe.--home <resolved>(orhc rungains--env), a non-default store still cannot reach the child through thehc run --bg --outlive-parenthook. This PR should be described as enabling, not completing, restore: snapshot cleared on spawn, not on resume — child loses store location through hc hook (cross-home restore reports success with 0 windows) #424.apply_homeusesstd::path::Path::metadata()which follows symlinks; a symlink to a directory passes validation. Not necessarily wrong, but worth noting if a strict "real directory" check is desired.require_kcode_pathrejects relative paths and jcode-named components, and the value is not canonicalized before being stored inKCODE_HOME.CodeAnt-AI Description
Choose a store directory with
--homeor--data-dirWhat Changed
Impact
✅ Per-invocation store selection✅ Invalid store paths rejected before startup✅ Existing store selection preserved when no override is given💡 Usage Guide
Checking Your Pull Request
Every time you make a pull request, our system automatically looks through it. We check for security issues, mistakes in how you're setting up your infrastructure, and common code problems. We do this to make sure your changes are solid and won't cause any trouble later.
Talking to CodeAnt AI
Got a question or need a hand with something in your pull request? You can easily get in touch with CodeAnt AI right here. Just type the following in a comment on your pull request, and replace "Your question here" with whatever you want to ask:
This lets you have a chat with CodeAnt AI about your pull request, making it easier to understand and improve your code.
Example
Preserve Org Learnings with CodeAnt
You can record team preferences so CodeAnt AI applies them in future reviews. Reply directly to the specific CodeAnt AI suggestion (in the same thread) and replace "Your feedback here" with your input:
This helps CodeAnt AI learn and adapt to your team's coding style and standards.
Example
Retrigger review
Ask CodeAnt AI to review the PR again, by typing:
Check Your Repository Health
To analyze the health of your code repository, visit our dashboard at https://app.codeant.ai. This tool helps you identify potential issues and areas for improvement in your codebase, ensuring your repository maintains high standards of code health.