Skip to content

D1-first: stop surfacing Neo4j errors/labels + fix Admin /config crash#76

Merged
mvalancy merged 1 commit into
developfrom
fix/d1-first-no-neo4j
Jun 16, 2026
Merged

D1-first: stop surfacing Neo4j errors/labels + fix Admin /config crash#76
mvalancy merged 1 commit into
developfrom
fix/d1-first-no-neo4j

Conversation

@mvalancy

Copy link
Copy Markdown
Member

Goal

Make the SPA D1-first / backend-agnostic so it never shows Neo4j-specific labels or errors, and never crashes, when Neo4j isn't the backend (e.g. cloud D1). Workspace.tsx was intentionally left untouched (owner is editing it separately).

Changes

Health hooks — missing graph store no longer means unhealthy

  • packages/web/src/hooks/useHealthCheck.ts: services.neo4j and services.mcp made optional in HealthCheckResult. getOverallStatus now builds criticalServices from graphql only; mcp?.status / neo4j?.status are read with optional chaining. If graphql is healthy, overall is healthy even when neo4j is absent.
  • packages/web/src/hooks/useHealthStatus.ts: services.neo4j / services.mcp made optional; the "unhealthy" polling computation now keys off graphql health only. A missing neo4j is no longer treated as unhealthy (effect dep updated to match).

Admin /config — REAL CRASH FIX

The cloud /config response has no services block, but the code did config.services.proxy/web/api/neo4j.* after only checking config was truthy — throwing a TypeError and white-screening /admin.

  • packages/web/src/pages/Admin.tsx: every SystemConfig access hardened to config?.services?.X?.Y ?? <fallback>. Renamed the dedicated "Neo4j" SVG node and the "Neo4j:port" traffic-flow edge/labels to a generic "Graph DB". The debug-console "Neo4j status" line renamed to "Graph store status".
  • packages/web/src/hooks/useSystemConfig.ts: SystemConfig.services.* (and tls/environment) marked optional so the optional chaining is type-honest; the getApiUrl/getWebUrl/getProxyUrl/getNeo4jUrl/getMcpUrl helpers hardened to null-safe.

Provider-neutral wording

  • packages/web/src/pages/Backend.tsx: the hard-coded "Neo4j Graph Database" service row, its descriptions, the architecture-diagram label, and the summary card are now provider-neutral ("Graph store" / "Graph database"). Lookups updated to the new service name.
  • packages/web/src/components/InteractiveGraphVisualization.tsx: the two error-mapper strings ("ensure Neo4j is running" / "Verify Neo4j database is running") now say "ensure/verify the graph backend is reachable". No other logic changed.

Notes / intentionally retained

  • message.includes('Neo4j') substring matches (in DeleteWorkItemModal.tsx and InteractiveGraphVisualization.tsx) are error-detection logic against the server's error text, not user-facing labels. The user-facing messages are already provider-neutral, so detection was kept to preserve behavior.
  • services.neo4j property reads against the /health and /config JSON remain (that is the actual API field name) — only the user-facing wording was genericized.
  • Workspace.tsx deliberately not modified.

Verification

npx tsc --noEmit -p packages/web/tsconfig.json0 errors (exit 0).

🤖 Generated with Claude Code

Make the SPA backend-agnostic so it never shows Neo4j-specific labels/errors
or crashes when Neo4j is not the backend (e.g. cloud D1).

- useHealthCheck: make services.neo4j and services.mcp optional; base
  criticalServices on graphql only; guard mcp?/neo4j? status with optional
  chaining. A missing graph store no longer forces unhealthy/degraded.
- useHealthStatus: make services.neo4j/mcp optional; base the unhealthy
  polling computation on graphql health only (missing neo4j != unhealthy).
- Backend page: genericize the hard-coded "Neo4j Graph Database" service
  row, descriptions, architecture-diagram label, and summary card to
  provider-neutral wording ("Graph store" / "Graph database").
- Admin page: FIX REAL CRASH — the cloud /config response has no services
  block, so config.services.* threw a TypeError and white-screened /admin.
  Harden every access to config?.services?.X?.Y ?? fallback, also in the
  useSystemConfig getters and interface. Rename the "Neo4j" SVG node and
  traffic-flow edge/labels to a generic "Graph DB".
- InteractiveGraphVisualization: genericize the two error-mapper strings
  ("ensure Neo4j is running" / "Verify Neo4j database is running") to
  "ensure/verify the graph backend is reachable".

Workspace.tsx left untouched per request (edited separately).

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 7573e90 into develop Jun 16, 2026
16 checks passed
@mvalancy mvalancy deleted the fix/d1-first-no-neo4j branch June 16, 2026 15:58
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