Unclassified

Frontend → Operational Spine → Canonical Spine Mapping

Date: 2026-07-31
Purpose: Every unmapped and unwired path becomes visible.
Basis: Three parallel deep audits of frontend fetches, Gateway routes, and service store access.


1. The Three Layers

┌─────────────────────────────────────────────────────────────┐
│  FRONTEND (apps/web)                                        │
│  apiFetch() → NEXT_PUBLIC_IW_API_URL → Gateway              │
│  GatewayHttpClient → NEXT_PUBLIC_API_BASE_URL → Gateway     │
│  spineClient (Supabase-like) → gateway-adapter → Gateway    │
├─────────────────────────────────────────────────────────────┤
│  GATEWAY (services/gateway)                                 │
│  51-entry ROUTES table → service bindings (Fetcher)         │
│  Direct D1/KV reads for workspace discovery, entities       │
├─────────────────────────────────────────────────────────────┤
│  SERVICES                                                   │
│  spine · pipeline · knowledge · intelligence · mcp-connector │
│  continuity · workflow · hermes · mcp-pool · webhook-ingress│
├─────────────────────────────────────────────────────────────┤
│  STORES                                                     │
│  D1 (Operational) · Neon (Canonical) · KV · R2 · Queues · DO│
└─────────────────────────────────────────────────────────────┘

2. Frontend → Gateway (Complete Route Map)

2.1 API Client → Gateway Routes

Frontend ClientURL PathGateway RouteTarget ServiceStatus
apiFetch()/api/v1/workspace/discoveryHandled directlyGateway + Spine✅ WIRED
apiFetch()/api/v1/workspace/connectors/api/v1/workspace/*BFF (workflow)✅ WIRED
apiFetch()/api/v1/workspace/connectors/catalog/api/v1/workspace/*BFF✅ WIRED
apiFetch()/api/v1/workspace/connectors/nango-session/api/v1/workspace/*BFF✅ WIRED
apiFetch()/api/v1/workspace/profile/api/v1/workspace/*BFF✅ WIRED
apiFetch()/api/v1/workspace/spine-config/api/v1/workspace/*BFF✅ WIRED
apiFetch()/api/v1/workspace/tenant-products/api/v1/workspace/*BFF✅ WIRED
apiFetch()/api/v1/workspace/user-roles/api/v1/workspace/*BFF✅ WIRED
apiFetch()/api/v1/workspace/register-connector/api/v1/workspace/*BFF✅ WIRED
apiFetch()/api/v1/workspace/initialize-spine/api/v1/workspace/*BFF✅ WIRED
apiFetch()/api/v1/workspace/projection/{dept}/api/v1/workspace/*BFF✅ WIRED
apiFetch()/api/v1/workspace/entities/api/v1/workspace/*BFF✅ WIRED
apiFetch()/api/v1/workspace/metadata/api/v1/workspace/*BFF✅ WIRED
apiFetch()/api/v1/workspace/csm/*/api/v1/workspace/*BFF✅ WIRED
apiFetch()/api/v1/workspace/domain/*/api/v1/workspace/*BFF✅ WIRED
apiFetch()/api/v1/pipeline/entities/api/v1/pipelinePIPELINE✅ WIRED
apiFetch()/api/v1/pipeline/spine/*/api/v1/pipelinePIPELINE✅ WIRED
apiFetch()/api/v1/pipeline/ingest/csv/api/v1/pipelinePIPELINE✅ WIRED
apiFetch()/api/v1/pipeline/sync-checkpoints/api/v1/pipelinePIPELINE✅ WIRED
apiFetch()/api/v1/pipeline/quarantine/api/v1/pipelinePIPELINE✅ WIRED
apiFetch()/api/v1/pipeline/schema-registry/api/v1/pipelinePIPELINE✅ WIRED
apiFetch()/api/v1/intelligence/signals/api/v1/intelligenceINTELLIGENCE✅ WIRED
apiFetch()/api/v1/knowledge/memories/api/v1/knowledgeKNOWLEDGE✅ WIRED
apiFetch()/api/v1/knowledge/continuity-objects/api/v1/knowledgeKNOWLEDGE✅ WIRED
apiFetch()/api/v1/governance/proposals/api/v1/cognitive/governINTELLIGENCE✅ WIRED
apiFetch()/api/v1/connectors/api/v1/connectorsCONNECTOR✅ WIRED
apiFetch()/api/v1/integrations/*(in-gateway handler)Gateway internal✅ WIRED
apiFetch()/api/v1/billing/subscription/api/v1/billingINTERNAL_BILLING✅ WIRED
apiFetch()/api/v1/billing/entitlements/*/api/v1/billingINTERNAL_BILLING✅ WIRED
apiFetch()/api/v1/subscriptions(in-gateway handler)Gateway internal✅ WIRED
apiFetch()/api/v1/spine-network/*/api/v1/spine-networkMCP_CONNECTOR✅ WIRED
apiFetch()/api/v1/marketplace/installations/*/api/v1/marketplace/installationsMARKETPLACE_INSTALLATION✅ WIRED
apiFetch()/api/marketplace/activate(Next.js API route)Frontend internal⚠️ LOCAL
AuthManager/api/v1/auth/login/api/v1/authINTERNAL_AUTH✅ WIRED
AuthManager/api/v1/auth/signup/api/v1/authINTERNAL_AUTH✅ WIRED
AuthManager/oauth/token/oauthINTERNAL_AUTH✅ WIRED
BillingClient/api/v1/billing/*/api/v1/billingINTERNAL_BILLING✅ WIRED
SSEClient/ws, /sse, /stream/ws, /sse, /streamBFF✅ WIRED

2.2 Frontend → Gateway: GAPS

GapDetailSeverity
No /api/v1/workspace/discovery in ROUTES tableHandled by special-case if at line 2314, NOT in the ROUTES array⚠️ Architectural — works but inconsistent
/api/marketplace/activateNext.js API route, not gateway-routed⚠️ Local only, not production-ready
Two API base URLsNEXT_PUBLIC_IW_API_URL vs NEXT_PUBLIC_API_BASE_URL — different clients use different bases⚠️ Configuration drift risk
Direct Spabase URLNEXT_PUBLIC_SPINE_URL still referenced in spine client❌ Legacy — should be removed
Descope fallbackNEXT_PUBLIC_DESCOPE_PROJECT_ID still active alongside Clerk⚠️ Dual auth path (D11)

3. Gateway → Service Routing (Complete)

3.1 ROUTES Table (51 entries)

Route PrefixTarget BindingWorker NameD1/KV Direct AccessStatus
/api/v1/authINTERNAL_AUTH(in-gateway)—✅
/api/v1/projectionsINTERNAL_PROJECTIONS(in-gateway)—✅
/api/v1/capabilities/statusINTERNAL_CAPABILITY_STATUS(in-gateway)—✅
/api/v1/billingINTERNAL_BILLING(in-gateway)—✅
/api/v1/tenantsINTERNAL_TENANTS(in-gateway)—✅
/api/v1/supportINTERNAL_SUPPORT(in-gateway)—✅
/api/v1/analyticsBFFintegratewise-workflowD1 (analytics)✅
/api/v1/agentsINTELLIGENCEintegratewise-intelligenceD1 + Neon✅
/api/v1/workspaceBFFintegratewise-workflowD1 (spine-cache)✅
/api/v1/spine-networkMCP_CONNECTORintegratewise-mcp-connectorD1 + Neon✅
/api/v1/connectorsCONNECTORintegratewise-connectorD1✅
/api/v1/connectorCONNECTORintegratewise-connectorD1✅
/api/v1/loaderCONNECTORintegratewise-connectorD1✅
/api/v1/pipelinePIPELINEintegratewise-pipelineD1 + KV + Queues✅
/api/v1/spineSPINEintegratewise-spineD1 + Neon✅
/api/v1/mcp-poolMCP_POOLintegratewise-mcp-pool—✅
/api/v1/intelligenceINTELLIGENCEintegratewise-intelligenceD1 + Neon✅
/api/v1/cognitive/spinePIPELINEintegratewise-pipelineD1✅
/api/v1/cognitive/entity360PIPELINEintegratewise-pipelineD1✅
/api/v1/entity360PIPELINEintegratewise-pipelineD1✅
/api/v1/identityPIPELINEintegratewise-pipelineD1✅
/api/v1/cognitive/evidenceBFFintegratewise-workflowD1✅
/api/v1/cognitive/memoriesKNOWLEDGEintegratewise-knowledgeD1 + R2 + Vectorize✅
/api/v1/cognitive/signalsINTELLIGENCEintegratewise-intelligenceD1✅
/api/v1/cognitive/thinkINTELLIGENCEintegratewise-intelligenceD1 + Neon✅
/api/v1/cognitive/actINTELLIGENCEintegratewise-intelligenceD1 + Neon✅
/api/v1/cognitive/governINTELLIGENCEintegratewise-intelligenceD1 + Neon✅
/api/v1/cognitive/context-to-truthINTELLIGENCEintegratewise-intelligenceD1 + Neon✅
/api/v1/cognitive/hitlBFFintegratewise-workflowD1✅
/api/v1/brainstormINTELLIGENCEintegratewise-intelligenceD1✅
/api/v1/knowledgeKNOWLEDGEintegratewise-knowledgeD1 + R2 + Vectorize✅
/api/v1/cognitive/twinAGENT_RUNTIMEiw-agent-runtimeDurable Objects✅
/api/v1/cognitive/brainAGENT_RUNTIMEiw-agent-runtimeDurable Objects✅
/api/v1/execution-packagesAGENT_RUNTIMEiw-agent-runtimeDurable Objects✅
/api/v1/cognitive/insightsINTELLIGENCEintegratewise-intelligenceD1✅
/api/v1/cognitive/auditBFFintegratewise-workflowD1✅
/api/v1/cognitive/agentsINTELLIGENCEintegratewise-intelligenceD1✅
/api/v1/cognitive/memoryKNOWLEDGEintegratewise-knowledgeD1✅
/api/v1/cognitive/truthKNOWLEDGEintegratewise-knowledgeD1 + Neon✅
/api/v1/cognitive/projectsKNOWLEDGEintegratewise-knowledgeD1✅
/api/v1/cognitive/statusKNOWLEDGEintegratewise-knowledgeD1✅
/ws, /sse, /streamBFFintegratewise-workflow—✅
/adminINTERNAL_ADMIN(in-gateway)—✅
/oauthINTERNAL_AUTH(in-gateway)—✅
/webhooks/slack-workflowWEBHOOK_INGRESSintegratewise-webhook-ingress—✅
/webhooks/slack/interactivityWEBHOOK_INGRESSintegratewise-webhook-ingress—✅
/webhooks/billingINTERNAL_BILLING(in-gateway)—✅
/webhooksWEBHOOK_INGRESSintegratewise-webhook-ingress—✅
/apiHUB_CONTROLLERhub-controller-apiD1⚠️ UNAUTHENTICATED

3.2 Gateway → Service: GAPS

GapDetailSeverity
/api catch-all to HUB_CONTROLLERUnauthenticated entry point (S1)❌ SECURITY
/api/v1/spine not in CORE_SERVICESSpine is bound but not in release path❌ DEPLOYMENT
15 dangling bindingsService names don't match wrangler name =❌ BROKEN
5 test/prod binding leaksHUB_CONTROLLER and MCP_POOL share targets❌ ISOLATION
hermes unreachableStage 11 of runtime sequence, zero inbound bindings❌ ARCHITECTURE
marketplace-installation zero inboundNew service, binding added but not in ROUTES⚠️ WIRED VIA SPECIAL CASE

4. Service → Store Mapping (Operational D1 vs Canonical Neon)

4.1 Store Inventory

StoreTechnologyPurposeOwner
Operational SpineD1 (integratewise-spine-staging/prod)Connections, connectors, sync jobs, webhooks, schemas, capabilities, timelineSpine service
Spine CacheD1 (integratewise-spine-cache)Shared operational cache across all servicesMultiple services
Canonical SpineNeon (FORTRESS_DATABASE_URL)Canonical entities, relationships, lineage, promotion, auditPipeline (sole writer)
AnalyticsD1 (integratewise-analytics)Conversion events, performance metrics, daily aggregatesWorkflow
KnowledgeD1 + R2 + VectorizeDocument chunks, embeddings, memories, searchKnowledge
IntelligenceD1 + Neon + Supabase RESTGovernance policies, actions, signals, agent decisionsIntelligence
Agent RuntimeDurable ObjectsTwin conversations, agent working memoryiw-agent-runtime
SessionsKV (SESSIONS)User sessionsGateway
Rate LimitsKV (RATE_LIMITS)API rate limitingGateway
Connector StatusKV (CONNECTOR_STATUS)Connector healthGateway
OAUTH StateKV (OAUTH_STATE_KV)OAuth flow stateGateway

4.2 Service → Store: COMPLETE MAP

SPINE (Operational + Canonical reads)

StoreTableR/WStatus
D1 (Operational)connections, connectors, sync-jobs, webhooks, schemas, capabilities, timeline-eventsR/W✅
Neon (Canonical)product.workbench_overview, product.workbench_definitionsR✅
Neonspine.activitiesR/W✅
Neonspine.current_entitiesR✅
Neonknowledge.documentsR✅ (cross-schema)
Neoncontinuity.memoriesR✅ (cross-schema)
Neonspine_connector_catalogR⚠️ placeholder
Neonspine_connector_installationsR⚠️ placeholder
Neongovernance_proposalsR⚠️ placeholder
Neonmarketplace_packagesR⚠️ placeholder
Neonmarketplace_installationsR⚠️ placeholder

PIPELINE (Canonical writer)

StoreTableR/WStatus
D1 (CANONICAL_SPINE_DB)spine_entities, spine_timeline, spine_relationshipsR/W❌ PLACEHOLDER DB ID
D1 (CACHE_DB)entity_cache, signal_cache, cross_data, decide_data, governance_data, merge_candidates, entity_signatures, agent_memory, signals, approval_queue, audit_log, spine_schema_registry, spine_vault, entitiesR/W❌ NO DB BINDING
Neonentities, entity_merges, normalization_errorsR✅ (via Supabase REST)
KVentity:{tid}:{source}:{id}, agent:memory:*R/W✅
Queuepipeline-process, knowledge-ingest, accelerator-trigger, intelligence-events, ops-dlq, signals, memory-promoteProduce/Consume✅

KNOWLEDGE

StoreTableR/WStatus
D1document_chunks, search_history, consolidated_memories, embeddings, ai_sessions, ai_session_memories, ai_conversations, ai_messages, ai_memories, org_memory, personal_memory, conversational_memory, triage_results, tenant_spine_configR/W✅
R2file blobsR/W✅
Vectorizevector indexR/W✅
Queueknowledge-ingest, memory-consolidation-tasksConsume/Produce✅
DOMemoryConsolidatorR/W✅

INTELLIGENCE

StoreTableR/WStatus
D1cross_data, governance_data, continuity_loop, agent_decisions, audit_logs, dlq_entries, conversational_memory, personal_memory, signal_rules, situations, action_proposals, decision_memory, decision_patterns, source_reliability, trust_scores, autonomy_overrides, ai_session_memories, document_chunks, ai_sessions, session_entity_links, evidence_refs, signals, spine_metrics, events, artifact_links, emails, drive_files, brainstorm_sessions, brainstorm_insightsR/W✅
Neongovernance_policies, actionsR/W✅
Supabase RESTtenant_spine_config, audit_log, ai_config, decision_memory, rule_effectiveness, drift_eventsR/W✅
R2memory contentR/W✅
Vectorizesemantic indexR/W✅
Queuepipeline-process, intelligence-act, ops-dlq, signals, memory-promoteProduce/Consume✅
DOHandoffTimeoutDO, TriageWorkflow, BulkCleanupSwarmR/W✅

MCP-CONNECTOR

StoreTableR/WStatus
D1users, tenant_spine_config, agent_registry, connector_catalog, context_boundaries, context_exchange_log, active_work_context, agent_communication_log, handoff_packages, handoff_state_log, proposals, oauth_refresh_tokens, oauth_clients, spine_entities, signals, kb_artifacts, kb_topic_policies, spine_events, ai_sessions, ai_session_memories, session_entity_linksR/W✅
KVMCP_IDEMPOTENCYR/W✅
Queueknowledge-ingest, pipeline-processProduce✅
Neonauth/v1/jwksR✅

5. THE CRITICAL GAP: Operational → Canonical Tunnel

5.1 What's Wired

Frontend → Gateway → Pipeline → D1 (Operational) → ✅ WIRED
Frontend → Gateway → Spine → D1 (Operational) → ✅ WIRED
Frontend → Gateway → Spine → Neon (Canonical reads) → ✅ WIRED
Frontend → Gateway → Knowledge → D1 + R2 + Vectorize → ✅ WIRED
Frontend → Gateway → Intelligence → D1 + Neon → ✅ WIRED

5.2 What's BROKEN

Pipeline → CANONICAL_SPINE_DB (Neon) → ❌ PLACEHOLDER DB ID
Pipeline → D1 (entity_cache, etc.) → ❌ NO DB BINDING
Gateway → 15 dangling service bindings → ❌ BROKEN
Gateway → hermes (stage 11) → ❌ UNREACHABLE
Gateway → /api (HUB_CONTROLLER) → ❌ UNAUTHENTICATED

5.3 The Canonical Write Path (S0)

INTENDED:
Pipeline promotion → CANONICAL_SPINE_DB (Neon) → canonical entities
                    ↓
              Transactional outbox
                    ↓
              Async projections → Brain, Search, Vector, Workbench

ACTUAL:
Pipeline promotion → CANONICAL_SPINE_DB → ❌ PLACEHOLDER DB ID
                    ↓
              console.warn (silent failure)
                    ↓
              return { success: true } → ❌ LIES TO CALLER

This is S0. The highest-value single change in the entire system.


6. Unmapped Paths (Frontend calls that have no backend)

Frontend CallGateway RouteBackendStatus
/api/v1/workspace/connectors→ BFF (workflow)Workflow reads D1✅ But workflow not in CORE_SERVICES
/api/v1/workspace/projection/{dept}→ BFFWorkflow reads D1✅ But projection logic unclear
/api/v1/workspace/entities→ BFFWorkflow reads D1✅ But entity source unclear
/api/v1/workspace/metadata→ BFFWorkflow reads D1✅ But metadata freshness unclear
/api/v1/governance/proposals→ INTELLIGENCEIntelligence reads D1 + Neon✅ But governance gate not proven
/api/v1/spine-network/*→ MCP_CONNECTORMCP Connector reads D1 + Neon✅ 19 tools implemented
/api/v1/marketplace/installations/*→ MARKETPLACE_INSTALLATIONNew service, D1✅ But binding not in ROUTES
/api/marketplace/activate→ Next.js API routeFrontend local⚠️ Not production

7. Unwired Paths (Backend exists but frontend doesn't call)

Backend EndpointServicePurposeStatus
/api/v1/cognitive/thinkINTELLIGENCETwin reasoning❌ No frontend consumer
/api/v1/cognitive/actINTELLIGENCEAction execution❌ No frontend consumer
/api/v1/cognitive/governINTELLIGENCEGovernance decisions❌ No frontend consumer
/api/v1/cognitive/twinAGENT_RUNTIMETwin runtime❌ No frontend consumer
/api/v1/cognitive/brainAGENT_RUNTIMEBrain reasoning❌ No frontend consumer
/api/v1/brainstormINTELLIGENCEBrainstorm sessions❌ No frontend consumer
/api/v1/cognitive/insightsINTELLIGENCEAI insights❌ No frontend consumer
/api/v1/cognitive/agentsINTELLIGENCEAgent management❌ No frontend consumer
/api/v1/execution-packagesAGENT_RUNTIMEExecution packages❌ No frontend consumer
/api/v1/mcp-poolMCP_POOLCapability routing❌ No frontend consumer
/api/v1/spine/*SPINESpine CRUD⚠️ Only via spineClient adapter

8. Priority Fix Order

#FixImpactEffort
1S0: Make canonical write hard-failSilent data loss → visible errorSmall
2Wire CANONICAL_SPINE_DB to real NeonCanonical writes actually persistMedium
3Add DB binding to Pipeline wrangler.toml14 D1 tables become accessibleSmall
4Repair 15 dangling bindingsServices become reachableSmall
5Close HUB_CONTROLLER bypassSecurity hole closedSmall
6Wire hermes or formally retire itStage 11 of runtime sequenceDecision needed
7Add spine to CORE_SERVICESSpine included in release pathSmall
8Frontend: consume workspace/discoveryFirst canonical read provenMedium
9Frontend: wire think/act/governTwin and governance become usableLarge
10Remove Descope fallbackSingle auth pathSmall

Generated from: Three parallel deep audits (frontend, gateway, stores)
Files produced: apps/web/FRONTEND_DATA_FETCH_MAP.md, docs/STORE_ACCESS_MAP.md, this document