Drop ALS fallbacks from containsPath and workspace routing (#25374)

This commit is contained in:
Kit Langton 2026-05-01 23:06:22 -04:00 committed by GitHub
commit 1571933096
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
4 changed files with 20 additions and 31 deletions

View file

@ -128,8 +128,8 @@ describe("Instance.containsPath", () => {
await Instance.provide({
directory: tmp.path,
fn: () => {
expect(Instance.containsPath(path.join(tmp.path, "foo.txt"))).toBe(true)
expect(Instance.containsPath(path.join(tmp.path, "src", "file.ts"))).toBe(true)
expect(Instance.containsPath(path.join(tmp.path, "foo.txt"), Instance.current)).toBe(true)
expect(Instance.containsPath(path.join(tmp.path, "src", "file.ts"), Instance.current)).toBe(true)
},
})
})
@ -143,11 +143,11 @@ describe("Instance.containsPath", () => {
directory: subdir,
fn: () => {
// .opencode at worktree root, but we're running from packages/lib
expect(Instance.containsPath(path.join(tmp.path, ".opencode", "state"))).toBe(true)
expect(Instance.containsPath(path.join(tmp.path, ".opencode", "state"), Instance.current)).toBe(true)
// sibling package should also be accessible
expect(Instance.containsPath(path.join(tmp.path, "packages", "other", "file.ts"))).toBe(true)
expect(Instance.containsPath(path.join(tmp.path, "packages", "other", "file.ts"), Instance.current)).toBe(true)
// worktree root itself
expect(Instance.containsPath(tmp.path)).toBe(true)
expect(Instance.containsPath(tmp.path, Instance.current)).toBe(true)
},
})
})
@ -158,8 +158,8 @@ describe("Instance.containsPath", () => {
await Instance.provide({
directory: tmp.path,
fn: () => {
expect(Instance.containsPath("/etc/passwd")).toBe(false)
expect(Instance.containsPath("/tmp/other-project")).toBe(false)
expect(Instance.containsPath("/etc/passwd", Instance.current)).toBe(false)
expect(Instance.containsPath("/tmp/other-project", Instance.current)).toBe(false)
},
})
})
@ -170,7 +170,7 @@ describe("Instance.containsPath", () => {
await Instance.provide({
directory: tmp.path,
fn: () => {
expect(Instance.containsPath(path.join(tmp.path, "..", "escape.txt"))).toBe(false)
expect(Instance.containsPath(path.join(tmp.path, "..", "escape.txt"), Instance.current)).toBe(false)
},
})
})
@ -182,8 +182,8 @@ describe("Instance.containsPath", () => {
directory: tmp.path,
fn: () => {
expect(Instance.directory).toBe(Instance.worktree)
expect(Instance.containsPath(path.join(tmp.path, "file.txt"))).toBe(true)
expect(Instance.containsPath("/etc/passwd")).toBe(false)
expect(Instance.containsPath(path.join(tmp.path, "file.txt"), Instance.current)).toBe(true)
expect(Instance.containsPath("/etc/passwd", Instance.current)).toBe(false)
},
})
})
@ -195,9 +195,9 @@ describe("Instance.containsPath", () => {
directory: tmp.path,
fn: () => {
// worktree is "/" for non-git projects, but containsPath should NOT allow all paths
expect(Instance.containsPath(path.join(tmp.path, "file.txt"))).toBe(true)
expect(Instance.containsPath("/etc/passwd")).toBe(false)
expect(Instance.containsPath("/tmp/other")).toBe(false)
expect(Instance.containsPath(path.join(tmp.path, "file.txt"), Instance.current)).toBe(true)
expect(Instance.containsPath("/etc/passwd", Instance.current)).toBe(false)
expect(Instance.containsPath("/tmp/other", Instance.current)).toBe(false)
},
})
})