Migrate remaining legacy tools config tests (#28363)

This commit is contained in:
Kit Langton
2026-05-19 12:06:07 -04:00
committed by GitHub
parent e4eb98b991
commit c449d3dc74
2 changed files with 31 additions and 60 deletions

View File

@@ -1204,67 +1204,37 @@ test("keeps plugin origins aligned with merged plugin list", async () => {
// Legacy tools migration tests // Legacy tools migration tests
test("migrates legacy tools config to permissions - allow", async () => { it.instance("migrates legacy tools config to permissions - allow", () =>
await using tmp = await tmpdir({ Effect.gen(function* () {
init: async (dir) => { const test = yield* TestInstance
await Filesystem.write( yield* writeConfigEffect(test.directory, {
path.join(dir, "opencode.json"), $schema: "https://opencode.ai/config.json",
JSON.stringify({ agent: { test: { tools: { bash: true, read: true } } },
$schema: "https://opencode.ai/config.json", })
agent: {
test: {
tools: {
bash: true,
read: true,
},
},
},
}),
)
},
})
await withTestInstance({
directory: tmp.path,
fn: async (ctx) => {
const config = await load(ctx)
expect(config.agent?.["test"]?.permission).toEqual({
bash: "allow",
read: "allow",
})
},
})
})
test("migrates legacy tools config to permissions - deny", async () => { const config = yield* Config.Service.use((svc) => svc.get())
await using tmp = await tmpdir({ expect(config.agent?.["test"]?.permission).toEqual({
init: async (dir) => { bash: "allow",
await Filesystem.write( read: "allow",
path.join(dir, "opencode.json"), })
JSON.stringify({ }),
$schema: "https://opencode.ai/config.json", )
agent: {
test: { it.instance("migrates legacy tools config to permissions - deny", () =>
tools: { Effect.gen(function* () {
bash: false, const test = yield* TestInstance
webfetch: false, yield* writeConfigEffect(test.directory, {
}, $schema: "https://opencode.ai/config.json",
}, agent: { test: { tools: { bash: false, webfetch: false } } },
}, })
}),
) const config = yield* Config.Service.use((svc) => svc.get())
}, expect(config.agent?.["test"]?.permission).toEqual({
}) bash: "deny",
await withTestInstance({ webfetch: "deny",
directory: tmp.path, })
fn: async (ctx) => { }),
const config = await load(ctx) )
expect(config.agent?.["test"]?.permission).toEqual({
bash: "deny",
webfetch: "deny",
})
},
})
})
it.instance("migrates legacy write tool to edit permission", () => it.instance("migrates legacy write tool to edit permission", () =>
Effect.gen(function* () { Effect.gen(function* () {

View File

@@ -81,6 +81,7 @@ Repeated setup work, long sleeps/timeouts, serial integration tests, filesystem/
| Managed settings config cases can use Effect-aware instance fixtures | Migrated managed override and missing-managed-file cases to `it.instance` | 2.40s | 1.76s | keep | Single baseline before edit; after median from three sequential reruns (1.75, 1.76, 1.80). | | Managed settings config cases can use Effect-aware instance fixtures | Migrated managed override and missing-managed-file cases to `it.instance` | 2.40s | 1.76s | keep | Single baseline before edit; after median from three sequential reruns (1.75, 1.76, 1.80). |
| Local plugin and subagent config fixtures can use Effect-aware instance fixtures | Migrated scoped npm plugin and custom subagent markdown cases to `it.instance` | 2.37s | 1.67s | keep | Single baseline before edit; after median from three sequential reruns (1.66, 1.67, 1.67). | | Local plugin and subagent config fixtures can use Effect-aware instance fixtures | Migrated scoped npm plugin and custom subagent markdown cases to `it.instance` | 2.37s | 1.67s | keep | Single baseline before edit; after median from three sequential reruns (1.66, 1.67, 1.67). |
| MCP merge config cases can use Effect-aware instance fixtures | Migrated three MCP merge/override cases to `it.instance` | 1.98s | 1.95s | keep | Neutral timing within noise; removes manual `tmpdir` + `withTestInstance` setup from isolated filesystem-only config cases. | | MCP merge config cases can use Effect-aware instance fixtures | Migrated three MCP merge/override cases to `it.instance` | 1.98s | 1.95s | keep | Neutral timing within noise; removes manual `tmpdir` + `withTestInstance` setup from isolated filesystem-only config cases. |
| Remaining legacy tools config cases can use Effect-aware instance fixtures | Migrated allow/deny legacy `tools` permission cases to `it.instance` | 2.65s | 1.90s | keep | Single baseline before edit; after median from three sequential reruns (2.58, 1.90, 1.90). |
## Profiling Results ## Profiling Results