D1-first: stop surfacing Neo4j errors/labels + fix Admin /config crash#76
Merged
Conversation
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>
🧪 Comprehensive Test Suite
Full-stack smoke gate runs in the CI workflow. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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.tsxwas 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.neo4jandservices.mcpmade optional inHealthCheckResult.getOverallStatusnow buildscriticalServicesfromgraphqlonly;mcp?.status/neo4j?.statusare read with optional chaining. Ifgraphqlis healthy, overall is healthy even when neo4j is absent.packages/web/src/hooks/useHealthStatus.ts:services.neo4j/services.mcpmade optional; the "unhealthy" polling computation now keys offgraphqlhealth only. A missing neo4j is no longer treated as unhealthy (effect dep updated to match).Admin /config — REAL CRASH FIX
The cloud
/configresponse has noservicesblock, but the code didconfig.services.proxy/web/api/neo4j.*after only checkingconfigwas truthy — throwing aTypeErrorand white-screening/admin.packages/web/src/pages/Admin.tsx: every SystemConfig access hardened toconfig?.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.*(andtls/environment) marked optional so the optional chaining is type-honest; thegetApiUrl/getWebUrl/getProxyUrl/getNeo4jUrl/getMcpUrlhelpers 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 (inDeleteWorkItemModal.tsxandInteractiveGraphVisualization.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.neo4jproperty reads against the/healthand/configJSON remain (that is the actual API field name) — only the user-facing wording was genericized.Workspace.tsxdeliberately not modified.Verification
npx tsc --noEmit -p packages/web/tsconfig.json→ 0 errors (exit 0).🤖 Generated with Claude Code