Skip to content

Self-heal the dev DB around heavy test suites#51

Merged
mvalancy merged 1 commit into
developfrom
feat/test-db-self-healing
Jun 14, 2026
Merged

Self-heal the dev DB around heavy test suites#51
mvalancy merged 1 commit into
developfrom
feat/test-db-self-healing

Conversation

@mvalancy

Copy link
Copy Markdown
Member

Why

Large scale-sweep / visual-vlm runs seed real graphs through the API. When a run is killed mid-flight (timeout, Ctrl-C), its per-test cleanup never executes and the dev DB is left with orphan WorkItems and drifted seed-graph positions. That pollution made THE GATE's grow-flow test flake (a force-click landing on an overlapping node) until a manual npm run db:seed. "We need clean systems."

What

The heavy suites now self-heal:

  • Sentinel tagging — every test-seeded graph name starts with [E2E] (TEST_GRAPH_PREFIX), so it's unmistakably identifiable and can never match a real/seed graph.
  • tests/helpers/dbHealing.tssweepTestData() — Cypher over bolt, batched, fully graceful (logs and returns if Neo4j is unreachable; never fails the run). Removes:
    • sentinel/legacy test-named graphs + their WorkItems and Edge nodes,
    • orphan WorkItems (no BELONGS_TO) — what a half-finished delete leaves,
    • orphan Edge nodes (missing a source/target) — the data-integrity incident class.
      It never touches seed/demo graphs (Welcome, Cycle 2, Aquarium, …).
  • Wired into both suites' beforeAll (heal leftovers from a prior killed run) and afterAll (clean up this run) — so the DB self-heals even after an interruption.

Verified

  • Injected a [E2E] graph + orphan node + orphan edge → sweep removed exactly those; seed data (44 items) untouched.
  • A scale run leaves 0 test graphs / 0 orphan nodes / 0 orphan edges.
  • THE GATE stays 5/5 green.

No CI impact (these projects aren't invoked in CI; healing is graceful and only runs for the heavy local suites).

🤖 Generated with Claude Code

Large scale-sweep / VLM runs seed real graphs; an interrupted run (timeout,
Ctrl-C) skips its per-test cleanup and leaves orphan WorkItems + drifted seed
positions behind. That pollution made THE GATE's grow-flow flake (force-click
landing on an overlapping node) until a manual re-seed.

Now the heavy suites self-heal:
- All test-seeded graphs are tagged with a sentinel name prefix ("[E2E]")
  so they're unmistakably identifiable (never matches a real/seed graph).
- tests/helpers/dbHealing.ts sweepTestData() (Cypher over bolt, batched,
  fully graceful if Neo4j is down) removes: sentinel/legacy test-named graphs
  + their WorkItems/Edge nodes, orphan WorkItems (no BELONGS_TO), and orphan
  Edge nodes (missing source/target — the data-integrity incident class).
  It never touches seed/demo graphs.
- scale-sweep.spec.ts and visual-vlm.spec.ts call it in beforeAll (heal
  leftovers from a prior killed run) and afterAll (clean up this run even if a
  per-run delete was skipped).

Verified: injected a test graph + orphan node + orphan edge → sweep removed
exactly those, seed data (44 items) untouched; a scale run leaves 0 test
graphs / 0 orphans; THE GATE stays 5/5 green.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@github-actions

Copy link
Copy Markdown

🧪 Comprehensive Test Suite

  • Unit suites (Node 18.x & 20.x) — core, web, server, mcp-server: ✅ passed
  • Installer & deploy config: ✅ passed

Full-stack smoke gate runs in the CI workflow.

@mvalancy mvalancy merged commit 5dbe765 into develop Jun 14, 2026
16 checks passed
@mvalancy mvalancy deleted the feat/test-db-self-healing branch June 14, 2026 03:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant