fix(test): wipe mcp_adapters with a tenant-scoped DELETE, not an ALTER (coreci-chat#12)
ci / test-pglite (PGlite, default) (push) Failing after 1m11s
ci / test-postgres (Postgres 16, G-022 RLS) (push) Failing after 1m24s
ci / test-pglite (PGlite, default) (pull_request) Failing after 1m10s
ci / test-postgres (Postgres 16, G-022 RLS) (pull_request) Failing after 1m23s
ci / test-pglite (PGlite, default) (push) Failing after 1m11s
ci / test-postgres (Postgres 16, G-022 RLS) (push) Failing after 1m24s
ci / test-pglite (PGlite, default) (pull_request) Failing after 1m10s
ci / test-postgres (Postgres 16, G-022 RLS) (pull_request) Failing after 1m23s
This commit is contained in:
@@ -135,10 +135,12 @@ beforeAll(async () => {
|
||||
});
|
||||
|
||||
beforeEach(async () => {
|
||||
// Wipe mcp_adapters between tests (disable RLS to mutate, re-enable).
|
||||
await db.query("ALTER TABLE mcp_adapters DISABLE ROW LEVEL SECURITY");
|
||||
await db.query("DELETE FROM mcp_adapters");
|
||||
await db.query("ALTER TABLE mcp_adapters ENABLE ROW LEVEL SECURITY");
|
||||
// Wipe mcp_adapters between tests. The runtime role (coreci_app) owns no
|
||||
// tables, so it cannot ALTER the table's RLS - that is why the old wipe
|
||||
// died with "must be owner of table mcp_adapters" and took all 15 tests
|
||||
// with it (coreci-chat#12). The wipe is a tenant-scoped DELETE inside
|
||||
// withTenant: the app role holds the DELETE privilege and the RLS policy
|
||||
// scopes the rows to the session's tenant.
|
||||
// Reset the stream manager between tests so contexts don't leak.
|
||||
const { streamManager } = await getMcpRuntime();
|
||||
streamManager.reset();
|
||||
|
||||
Reference in New Issue
Block a user