Skip to content

fix: shared status/sync/manage from contained layout root#353

Merged
avihut merged 1 commit intomasterfrom
fix/shared-fails-in-contained-root
Apr 9, 2026
Merged

fix: shared status/sync/manage from contained layout root#353
avihut merged 1 commit intomasterfrom
fix/shared-fails-in-contained-root

Conversation

@avihut
Copy link
Copy Markdown
Owner

@avihut avihut commented Apr 9, 2026

Summary

  • Fix daft shared status (and sync/manage) failing when run from the container root of a contained layout
  • Fall back to current_dir() when get_current_worktree_path() fails (bare repo has no working tree)
  • Use resolve_config_root() to reliably locate daft.yml before reading shared paths — fixes the case where load_yaml_config_with_fallback skips its project-root fallback when worktree path equals project root
  • Also fixes a latent bug in run_sync/run_manage where resolve_config_root was called but its result wasn't passed to read_shared_paths

Fixes #353

Test plan

  • New regression test: shared/status-from-container-root
  • All existing shared scenario tests pass
  • Clippy clean, fmt clean
  • Manual sandbox test: run daft shared status from contained layout root

🤖 Generated with Claude Code

When running `daft shared status` (or sync/manage) from the container
root of a contained layout, `get_current_worktree_path()` fails because
the container root is a bare repo with no working tree. Fix with two
changes:

1. Fall back to `std::env::current_dir()` when not inside a worktree,
   so the command doesn't error out at the container root.

2. Use `resolve_config_root()` to locate `daft.yml` before passing the
   path to `read_shared_paths()`. The previous code passed the worktree
   path directly, but `load_yaml_config_with_fallback` skips its
   project-root fallback when `project_root == worktree_root` — which
   is exactly the case at the container root. `resolve_config_root` has
   no such guard and reliably finds the config.

Also fixes a latent bug in `run_sync`/`run_manage` where
`resolve_config_root` was called but its result wasn't used for
`read_shared_paths`.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@avihut avihut added this to the Public Launch milestone Apr 9, 2026
@avihut avihut added the fix Bug fix label Apr 9, 2026
@avihut avihut self-assigned this Apr 9, 2026
@avihut avihut merged commit f3a32ce into master Apr 9, 2026
8 checks passed
@avihut avihut deleted the fix/shared-fails-in-contained-root branch April 9, 2026 23:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

fix Bug fix

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant