effectify Plugin service internals (#19365)

This commit is contained in:
Kit Langton 2026-03-27 11:20:11 -04:00 • committed by GitHub
commit e528ed5d86
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -64,12 +64,11 @@ describe("plugin.config-hook-error-isolation", () => {
test("config hooks are individually error-isolated in the layer factory", async () => {
const src = await Bun.file(file).text()
// The config hook try/catch lives in the InstanceState factory (layer definition),
// not in init() which now just delegates to the Effect service.
// Each hook's config call is wrapped in Effect.tryPromise with error logging + Effect.ignore
expect(src).toContain("plugin config hook failed")
const pattern =
/for\s*\(const hook of hooks\)\s*\{[\s\S]*?try\s*\{[\s\S]*?\.config\?\.\([\s\S]*?\}\s*catch\s*\(err\)\s*\{[\s\S]*?plugin config hook failed[\s\S]*?\}/
/for\s*\(const hook of hooks\)\s*\{[\s\S]*?Effect\.tryPromise[\s\S]*?\.config\?\.\([\s\S]*?plugin config hook failed[\s\S]*?Effect\.ignore/
expect(pattern.test(src)).toBe(true)
})
})