Skip to content

fix(workspace): require exact workdir match in saved_workspace_match_depth#185

Merged
donbeave merged 1 commit into
mainfrom
fix/workspace-match-depth-exact-workdir
Apr 26, 2026
Merged

fix(workspace): require exact workdir match in saved_workspace_match_depth#185
donbeave merged 1 commit into
mainfrom
fix/workspace-match-depth-exact-workdir

Conversation

@donbeave

Copy link
Copy Markdown
Member

Summary

  • saved_workspace_match_depth previously matched any cwd that was a subdirectory of the workspace workdir. A workspace with a broad workdir (e.g. /Users/me/Projects) would capture every unrelated directory beneath it.
  • This caused jackin console to pre-select the wrong workspace and jackin load / jackin hardline to resolve the wrong workspace when run from an unrelated project directory.
  • Fix: the workdir leg now requires an exact match (cwd == workdir). Mount sources retain prefix matching so subdirectories of mounted host paths continue to be covered. One function, consistent semantics across TUI and CLI.

Test plan

  • cargo test — 961 tests pass
  • New test saved_workspace_match_depth_rejects_workdir_prefix_only_match: confirms a workspace with a broad workdir is not matched when cwd is an unrelated sibling directory not covered by any mount source (mount src is created on disk so the test proves the exact-match logic, not a silent canonicalize failure)
  • New test saved_workspace_match_depth_matches_exact_workdir: exact workdir still matches
  • New test saved_workspace_match_depth_matches_nested_path_under_mount_src: mount-source prefix match still works
  • New tests in context.rs mirror the above at the find_saved_workspace_for_cwd integration layer

🤖 Generated with Claude Code

…depth

Previously the workdir leg of saved_workspace_match_depth matched any cwd
that was a subdirectory of the configured workdir. A workspace with a broad
workdir (e.g. /Users/me/Projects) therefore captured every directory
beneath it, causing the TUI to pre-select the wrong workspace and jackin
load / jackin hardline to resolve the wrong workspace when run from an
unrelated project directory.

Change the workdir check to require an exact match (cwd == workdir).
Mount sources retain prefix matching so that subdirectories of a mounted
host path continue to be covered. This is the single unified function used
by both the TUI pre-selection and the CLI context resolvers.

Co-authored-by: Claude <noreply@anthropic.com>
Signed-off-by: Alexey Zhokhov <alexey@zhokhov.com>
@donbeave donbeave merged commit f4fbcb5 into main Apr 26, 2026
6 checks passed
@donbeave donbeave deleted the fix/workspace-match-depth-exact-workdir branch April 26, 2026 17:10
donbeave added a commit that referenced this pull request Apr 26, 2026
Brings in main's fix(workspace) #185, fix(launch) #184, and a large
documentation roadmap addition (#183 + several smaller PRs covering
codebase readability, project structure gates, etc.).

Adds the `isolation` field to MountConfig literals introduced by main
in test fixtures inside `src/app/context.rs` and `src/workspace/resolve.rs`
(2 + 3 sites, all `MountIsolation::Shared` since they're not testing
isolation behavior). These literals predate this branch's
`isolation`-field addition; main couldn't anticipate the new required
field, so the merge picks them up unmodified and we backfill the field
here.

No conflicts in the merge itself.

Co-authored-by: Claude <noreply@anthropic.com>
Signed-off-by: Alexey Zhokhov <alexey@zhokhov.com>
donbeave added a commit that referenced this pull request May 6, 2026
…depth (#185)

Previously the workdir leg of saved_workspace_match_depth matched any cwd
that was a subdirectory of the configured workdir. A workspace with a broad
workdir (e.g. /Users/me/Projects) therefore captured every directory
beneath it, causing the TUI to pre-select the wrong workspace and jackin
load / jackin hardline to resolve the wrong workspace when run from an
unrelated project directory.

Change the workdir check to require an exact match (cwd == workdir).
Mount sources retain prefix matching so that subdirectories of a mounted
host path continue to be covered. This is the single unified function used
by both the TUI pre-selection and the CLI context resolvers.

Signed-off-by: Alexey Zhokhov <alexey@zhokhov.com>
Co-authored-by: Claude <noreply@anthropic.com>
donbeave added a commit that referenced this pull request May 7, 2026
…depth (#185)

Previously the workdir leg of saved_workspace_match_depth matched any cwd
that was a subdirectory of the configured workdir. A workspace with a broad
workdir (e.g. /Users/me/Projects) therefore captured every directory
beneath it, causing the TUI to pre-select the wrong workspace and jackin
load / jackin hardline to resolve the wrong workspace when run from an
unrelated project directory.

Change the workdir check to require an exact match (cwd == workdir).
Mount sources retain prefix matching so that subdirectories of a mounted
host path continue to be covered. This is the single unified function used
by both the TUI pre-selection and the CLI context resolvers.

Co-authored-by: Claude <noreply@anthropic.com>
Signed-off-by: Alexey Zhokhov <alexey@zhokhov.com>
Co-authored-by: Codex <codex@openai.com>
donbeave added a commit that referenced this pull request May 7, 2026
…depth (#185)

Previously the workdir leg of saved_workspace_match_depth matched any cwd
that was a subdirectory of the configured workdir. A workspace with a broad
workdir (e.g. /Users/me/Projects) therefore captured every directory
beneath it, causing the TUI to pre-select the wrong workspace and jackin
load / jackin hardline to resolve the wrong workspace when run from an
unrelated project directory.

Change the workdir check to require an exact match (cwd == workdir).
Mount sources retain prefix matching so that subdirectories of a mounted
host path continue to be covered. This is the single unified function used
by both the TUI pre-selection and the CLI context resolvers.

Signed-off-by: Alexey Zhokhov <alexey@zhokhov.com>
Co-authored-by: Claude <noreply@anthropic.com>
donbeave added a commit that referenced this pull request May 7, 2026
…depth (#185)

Previously the workdir leg of saved_workspace_match_depth matched any cwd
that was a subdirectory of the configured workdir. A workspace with a broad
workdir (e.g. /Users/me/Projects) therefore captured every directory
beneath it, causing the TUI to pre-select the wrong workspace and jackin
load / jackin hardline to resolve the wrong workspace when run from an
unrelated project directory.

Change the workdir check to require an exact match (cwd == workdir).
Mount sources retain prefix matching so that subdirectories of a mounted
host path continue to be covered. This is the single unified function used
by both the TUI pre-selection and the CLI context resolvers.

Signed-off-by: Alexey Zhokhov <alexey@zhokhov.com>
Co-authored-by: Claude <noreply@anthropic.com>
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