LearnNewsExamplesServices
Frontmatter
id10938
titleG6: Database.spec did-not-run — SQLite.initSchema closed-db reuse under workers:1
stateClosed
labels
bugaitesting
assignees[]
createdAtMay 8, 2026, 12:12 AM
updatedAtMay 12, 2026, 4:09 AM
githubUrlhttps://github.com/neomjs/neo/issues/10938
authorneo-opus-4-7
commentsCount2
parentIssue10924
subIssues[]
subIssuesCompleted0
subIssuesTotal0
blockedBy[]
blocking[]
closedAtMay 11, 2026, 12:18 AM

G6: Database.spec did-not-run — SQLite.initSchema closed-db reuse under workers:1

Closedbugaitesting
neo-opus-4-7
neo-opus-4-7 commented on May 8, 2026, 12:12 AM

Context

Surfaced 2026-05-08 during PR #10933 (Phase 3 unit-row re-add) CI run 25524203756. Originally classified as part of G6 (27 did-not-run) in the #10924 G5 triage matrix. The G6 cohort collapsed from 27 → 1 after G1-G4 skip-guards landed; this is the residual.

Identified by @neo-gpt's epic-resolution review at #10924 comment 4401514682 as the load-bearing did-not-run blocker.

The Problem

test/playwright/unit/ai/graph/Database.spec.mjs (the foreign-key cascade test) is reported as did not run because SQLite.initSchema() throws:

TypeError: Cannot read properties of undefined (reading 'exec')
   at ai/graph/storage/SQLite.mjs:76
   this.db.exec('DROP TABLE IF EXISTS Edges');

this.db is undefined at the time initSchema runs. Under workers:1, a sibling spec runs first and closes/nulls the SQLite singleton's db reference (e.g., FileSystemIngestor.spec.afterAll at line 105-110 explicitly calls db.close() then GraphService.db = null). When Database.spec then tries to initSchema against the same singleton, the db field is gone and the next consumer can't initialize.

The Architectural Reality

  • ai/graph/storage/SQLite.mjs:76initSchema accesses this.db.exec(...) without a defensive open-state check
  • ai/graph/storage/SQLite.mjs:200 — same surface, also flagged via #10934 (FileSystemIngestor removeNodes close-then-reuse)
  • test/playwright/unit/ai/graph/Database.spec.mjs — the consumer that "did not run" because init failed
  • Sibling specs that close the singleton: FileSystemIngestor.spec.afterAll (verified), likely others

This is the SAME root cause as #10934 (FileSystemIngestor) but at a different consumer surface. Both reflect the closed-singleton-then-reuse pattern. Investigation may resolve both with a single SDK-level fix.

The Fix (TBD via investigation)

Two candidate paths (likely shared with #10934):

  1. SDK-level (preferred if scope-shared with #10934): defensive this.db open-state check in SQLite.initSchema (and sibling mutators); self-heal via re-init OR throw a clearer error pointing to the lifecycle violation
  2. Spec-level: refactor sibling afterAll to NOT close shared singletons (use scoped factory pattern instead)

Recommend coordinating with #10934 as a single fix-track unless investigation shows divergent surfaces.

Acceptance Criteria

  • (AC1) Empirically reproduce locally with WORKERS=1 — Database.spec did-not-run after FileSystemIngestor.spec
  • (AC2) Identify all sibling specs that close GraphService.db.storage.db (FileSystemIngestor confirmed; audit others)
  • (AC3) Implement chosen fix path; coordinate with #10934 implementer if shared SDK-level fix
  • (AC4) Verify Database.spec runs deterministically across 5 consecutive npm run test-unit invocations on CI substrate
  • (AC5) did not run count reaches 0 in the unit summary

Out of Scope

  • Migrating SQLite singleton to per-test instances (too aggressive)
  • Cross-spec singleton-lifecycle epic-shaped audit (separate concern; this ticket is targeted)

Avoided Traps

  • Filing as G6 umbrella instead of a single concrete sub-ticket: rejected — the umbrella was 27 did-not-run, now 1 residual; one sub-ticket is the right granularity
  • Bundling with #10934: kept as separate tickets because the consumer surfaces differ (Database.spec init vs FileSystemIngestor remove); fix may converge but tickets stay separate for traceability

Related

  • Surfacing CI run: 25524203756
  • Identified via: @neo-gpt's epic-resolution review (Lane 3 of the Path A 3-lane plan)
  • Sibling root-cause: #10934 (FileSystemIngestor singleton SQLite-close — same closed-singleton-reuse pattern at a different consumer surface)
  • Substrate config: test/playwright/playwright.config.unit.mjs workers: 1 in CI

Origin Session ID: 7e897a0b-33ce-4d6c-b1a9-a1ff93e4e571

Retrieval Hint: query_raw_memories(query="Database.spec SQLite initSchema closed-db reuse workers 1 G6 did-not-run residual #10924 PR 10933")

tobiu referenced in commit 98897fc - "feat(ci): re-add unit suite to matrix post-Bucket-G substrate (#10939) (#10953) on May 8, 2026, 2:43 PM