fix(iios): thread subject on create, graceful open_thread error, isolated test DB

- openThread/createThread accept a generic `subject` (group name) — stored on the
  thread, echoed via listThreads; kernel never interprets it.
- Gateway open_thread now returns an ACK'd { error } on failure instead of throwing
  (which never acked → clients hung on "loading"). Non-member/missing-thread opens
  fail cleanly.
- Tests run against an isolated `iios_test` database (vitest globalSetup creates +
  migrates it; test.env overrides DATABASE_URL) so `pnpm test` can never TRUNCATE the
  dev database again. Verified: full suite green, dev DB row counts unchanged.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
2026-07-06 19:39:19 +05:30
parent 1af10d0f4a
commit c4206f9809
5 changed files with 47 additions and 13 deletions
+7 -3
View File
@@ -15,9 +15,13 @@ export default defineConfig({
},
test: {
include: ['packages/**/src/**/*.{test,spec}.ts', 'test/**/*.{test,spec}.ts'],
// DB-backed specs share one Postgres and TRUNCATE between tests. Run every
// file in a single worker process, sequentially, so there is no cross-file
// race on the shared database.
// DB-backed specs TRUNCATE between tests, so they run against an ISOLATED
// `iios_test` database (created + migrated by the global setup) — never the dev
// DB. This env overrides any DATABASE_URL from the shell.
env: { DATABASE_URL: 'postgresql://iios:iios@localhost:5434/iios_test?schema=public' },
globalSetup: ['./scripts/vitest-global-setup.mjs'],
// Run every file in a single worker process, sequentially, so there is no
// cross-file race on the shared database.
fileParallelism: false,
sequence: { concurrent: false },
pool: 'forks',