test: remove shared-DB and timer flakiness - #338
Conversation
There was a problem hiding this comment.
2 issues found across 1 file (changes from recent commits).
Prompt for AI agents (unresolved issues)
Check if these issues are valid — if so, understand the root cause of each and fix them. If appropriate, use sub-agents to investigate and fix each issue separately.
<file name="packages/plugin/package.json">
<violation number="1" location="packages/plugin/package.json:42">
P2: The PR's stated first goal is "Enable Bun test-file isolation for plugin tests," but this change removes the `--isolate` flag that was added earlier in this PR, leaving the test command with no isolation flag (only `--timeout 30000`). If Bun does not isolate test files into separate processes by default, the shared-state/shared-DB flakiness the PR exists to fix is not actually removed. Either restore `--isolate` (combined with the timeout) or confirm in the PR description that Bun isolates files by default and that isolation is intentionally dropped.</violation>
<violation number="2" location="packages/plugin/package.json:42">
P3: The new `--timeout 30000` raises the global per-test timeout from Bun's 5000ms default to 30s for every test file, which contradicts the PR's stated verification that "no global timeouts increased" and masks genuinely hanging tests in CI for 30s each. Set only the specific tests that actually need the longer budget instead of raising the global default, or document which tests justify 30s.</violation>
</file>
Reply with feedback, questions, or to request a fix.
Re-trigger cubic
| "check:tui-compiled": "bun run build:tui && git diff --exit-code -- src/tui-compiled && test -z \"$(git status --porcelain -- src/tui-compiled)\"", | ||
| "typecheck": "tsc -p ../retina-local-fs/tsconfig.build.json && tsc --noEmit && tsc -p tsconfig.scripts.json", | ||
| "test": "bun test", | ||
| "test": "bun test --timeout 30000", |
There was a problem hiding this comment.
P2: The PR's stated first goal is "Enable Bun test-file isolation for plugin tests," but this change removes the --isolate flag that was added earlier in this PR, leaving the test command with no isolation flag (only --timeout 30000). If Bun does not isolate test files into separate processes by default, the shared-state/shared-DB flakiness the PR exists to fix is not actually removed. Either restore --isolate (combined with the timeout) or confirm in the PR description that Bun isolates files by default and that isolation is intentionally dropped.
Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. At packages/plugin/package.json, line 42:
<comment>The PR's stated first goal is "Enable Bun test-file isolation for plugin tests," but this change removes the `--isolate` flag that was added earlier in this PR, leaving the test command with no isolation flag (only `--timeout 30000`). If Bun does not isolate test files into separate processes by default, the shared-state/shared-DB flakiness the PR exists to fix is not actually removed. Either restore `--isolate` (combined with the timeout) or confirm in the PR description that Bun isolates files by default and that isolation is intentionally dropped.</comment>
<file context>
@@ -39,7 +39,7 @@
"check:tui-compiled": "bun run build:tui && git diff --exit-code -- src/tui-compiled && test -z \"$(git status --porcelain -- src/tui-compiled)\"",
"typecheck": "tsc -p ../retina-local-fs/tsconfig.build.json && tsc --noEmit && tsc -p tsconfig.scripts.json",
- "test": "bun test --isolate",
+ "test": "bun test --timeout 30000",
"lint": "biome check .",
"lint:fix": "biome check --write .",
</file context>
| "test": "bun test --timeout 30000", | |
| "test": "bun test --isolate --timeout 30000", |
| "check:tui-compiled": "bun run build:tui && git diff --exit-code -- src/tui-compiled && test -z \"$(git status --porcelain -- src/tui-compiled)\"", | ||
| "typecheck": "tsc -p ../retina-local-fs/tsconfig.build.json && tsc --noEmit && tsc -p tsconfig.scripts.json", | ||
| "test": "bun test", | ||
| "test": "bun test --timeout 30000", |
There was a problem hiding this comment.
P3: The new --timeout 30000 raises the global per-test timeout from Bun's 5000ms default to 30s for every test file, which contradicts the PR's stated verification that "no global timeouts increased" and masks genuinely hanging tests in CI for 30s each. Set only the specific tests that actually need the longer budget instead of raising the global default, or document which tests justify 30s.
Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. At packages/plugin/package.json, line 42:
<comment>The new `--timeout 30000` raises the global per-test timeout from Bun's 5000ms default to 30s for every test file, which contradicts the PR's stated verification that "no global timeouts increased" and masks genuinely hanging tests in CI for 30s each. Set only the specific tests that actually need the longer budget instead of raising the global default, or document which tests justify 30s.</comment>
<file context>
@@ -39,7 +39,7 @@
"check:tui-compiled": "bun run build:tui && git diff --exit-code -- src/tui-compiled && test -z \"$(git status --porcelain -- src/tui-compiled)\"",
"typecheck": "tsc -p ../retina-local-fs/tsconfig.build.json && tsc --noEmit && tsc -p tsconfig.scripts.json",
- "test": "bun test --isolate",
+ "test": "bun test --timeout 30000",
"lint": "biome check .",
"lint:fix": "biome check --write .",
</file context>
| "test": "bun test --timeout 30000", | |
| "test": "bun test" |
|
Thank you, Cole — filed before our independent #330/#333 changes landed, and your read of the timing signature was useful, especially the #312 point that Bun's 5s test timeout and SQLite's 5s busy_timeout hide lock errors behind the same wall-clock cutoff. In parallel, master landed different implementations: #330 now exercises the corpus-eviction invariant with an injectable small cap instead of 2,005 disk-backed inserts, and #333 waits for the observable rebuild state instead of a fixed sleep — so we don't want to merge a second implementation of those two. Two pieces of this PR are independently useful and we're extracting them with credit: |
…irst Extracted from PR #338 (Cole Leavitt). Bun's default 5s test timeout and SQLite's production 5s busy_timeout currently hide a real lock wait behind the same wall-clock cutoff, so a shared-DB contention surfaces as an unattributable Bun timeout instead of a visible SQLITE_BUSY error. Raising the test timeout to 30s lets the lock error report first. This is observability work for #312, NOT a fix: it does not isolate per-file databases or change the test busy_timeout, so the shared context.db contention remains open. Co-Authored-By: Cole Leavitt <cole@unwrap.rs> Co-Authored-By: Alfonso <alfonso@cortexkit.io>
Extracted from PR #338 (Cole Leavitt). @opentui/core/testing subclasses a core export during module initialization; importing the TUI runtime specifiers in parallel could expose that TDZ. Warm core first so Bun cannot race the subclass against its base. Co-Authored-By: Cole Leavitt <cole@unwrap.rs> Co-Authored-By: Alfonso <alfonso@cortexkit.io>
…th Cole Leavitt (empty-task-output visibility, fallback-chain timer retention, 30s test-timeout lock observability, opentui TDZ warmup) Co-Authored-By: Alfonso <alfonso@cortexkit.io>
Summary
@opentui/corebefore parallel runtime-specifier imports to remove theTreeSitterClientTDZ race exposed by CIAddresses #312 (improves lock-failure observability; per-file DB isolation remains open)
Fixes #330
Fixes #333
Verification
bun run lintbun run typecheckAssertions are unchanged; no SQLite timeout was hidden or extended.
Greptile Summary
The PR reduces SQLite and scheduler test flakiness without changing production database timeout behavior.
Confidence Score: 5/5
The PR appears safe to merge.
No blocking failure remains.
Important Files Changed
Sequence Diagram
sequenceDiagram participant Test participant BootQuiet as Boot-quiet scheduler participant Lock as Session lock participant Index as Message index Test->>BootQuiet: schedule reconciliation Test->>BootQuiet: schedule clear and reindex Test->>BootQuiet: advance fake clock BootQuiet->>Lock: queue reconciliation BootQuiet->>Lock: queue clear and reindex Lock->>Index: reconcile existing messages Lock->>Index: clear indexed session Lock->>Index: rebuild from surviving messages Index-->>Test: resolve completion promisesReviews (3): Last reviewed commit: "test(tui): stabilize runtime import orde..." | Re-trigger Greptile
Context used: