{"slug":"architecture/ROUND_2_CONNECTOR_BINDINGS_AUDIT","title":"Round 2 — Connector Bindings and Storage Audit","section":"architecture","sectionLabel":"Architecture","status":"unclassified","type":"document","path":"architecture/ROUND_2_CONNECTOR_BINDINGS_AUDIT.mdx","bytes":9884,"description":null,"updated":null,"source":"integratewise/Integratewise-docs-wiki","content":"\n**Date:** 2026-07-29  \n**Status:** Code-level bindings exist; Cloudflare binding provisioning needed\n\n---\n\n## Gateway Bindings\n\n**File:** `services/gateway/src/index.ts` → `Env` interface\n\n| Binding             | Type                   | Required    | Provisioned | Notes                        |\n| ------------------- | ---------------------- | ----------- | ----------- | ---------------------------- |\n| `DB`                | D1Database             | ✅ Required | ⚠️ Unknown  | Auth + tenant resolution     |\n| `CONNECTOR`         | Fetcher                | ✅ Required | ⚠️ Unknown  | Downstream connector service |\n| `MCP_CONNECTOR`     | Fetcher                | ✅ Required | ⚠️ Unknown  | 19-tool MCP boundary         |\n| `PIPELINE`          | Fetcher                | ✅ Required | ⚠️ Unknown  | Pipeline service             |\n| `INTELLIGENCE`      | Fetcher                | ✅ Required | ⚠️ Unknown  | Intelligence service         |\n| `KNOWLEDGE`         | Fetcher                | ✅ Required | ⚠️ Unknown  | Knowledge service            |\n| `BFF`               | Fetcher                | ✅ Required | ⚠️ Unknown  | Backend-for-frontend         |\n| `AGENT_RUNTIME`     | Fetcher                | ✅ Required | ⚠️ Unknown  | Agent runtime                |\n| `SPINE`             | Fetcher                | ⚠️ Optional | ⚠️ Unknown  | Neon Workbench boundary      |\n| `MCP_POOL`          | Fetcher                | ⚠️ Optional | ⚠️ Unknown  | MCP pool (internal)          |\n| `WEBHOOK_INGRESS`   | Fetcher                | ⚠️ Optional | ⚠️ Unknown  | Webhook ingestion            |\n| `HUB_CONTROLLER`    | Fetcher                | ✅ Required | ⚠️ Unknown  | Hub controller               |\n| `ADMIN`             | Fetcher                | ✅ Required | ⚠️ Unknown  | Admin service                |\n| `BILLING`           | Fetcher                | ✅ Required | ⚠️ Unknown  | Billing service              |\n| `TENANTS`           | Fetcher                | ✅ Required | ⚠️ Unknown  | Tenants service              |\n| `FOLDER_WATCHER`    | Fetcher                | ⚠️ Optional | ⚠️ Unknown  | Folder watcher               |\n| `RATE_LIMITS`       | KVNamespace            | ✅ Required | ⚠️ Unknown  | Rate limiting                |\n| `SESSIONS`          | KVNamespace            | ✅ Required | ⚠️ Unknown  | Session storage              |\n| `CONNECTOR_STATUS`  | KVNamespace            | ⚠️ Optional | ⚠️ Unknown  | Connector status cache       |\n| `SIGNAL_CACHE`      | KVNamespace            | ⚠️ Optional | ⚠️ Unknown  | Signal cache                 |\n| `METRICS`           | KVNamespace            | ⚠️ Optional | ⚠️ Unknown  | Metrics cache                |\n| `OAUTH_STATE_KV`    | KVNamespace            | ⚠️ Optional | ⚠️ Unknown  | OAuth state                  |\n| `TENANT0_ENDPOINTS` | DurableObjectNamespace | ⚠️ Optional | ⚠️ Unknown  | Tenant endpoints             |\n\n---\n\n## MCP Connector Bindings\n\n**File:** `services/mcp-connector/src/index.ts`\n\n| Binding                         | Type        | Required    | Notes                  |\n| ------------------------------- | ----------- | ----------- | ---------------------- |\n| `DB`                            | D1Database  | ✅ Required | OAuth clients, tokens  |\n| `SESSIONS`                      | KVNamespace | ✅ Required | Session storage        |\n| `GATEWAY_CONNECTOR_AUTH_SECRET` | Secret      | ✅ Required | Gateway→Connector auth |\n\n---\n\n## Connector Service Bindings\n\n**File:** `services/connector/src/index.ts`\n\n| Binding            | Type        | Required    | Notes                |\n| ------------------ | ----------- | ----------- | -------------------- |\n| `PIPELINE_QUEUE`   | Queue       | ✅ Required | Pipeline processing  |\n| `KNOWLEDGE_QUEUE`  | Queue       | ✅ Required | Knowledge processing |\n| `MCP_IDEMPOTENCY`  | KVNamespace | ✅ Required | Idempotency checks   |\n| `CONNECTOR_STATUS` | KVNamespace | ✅ Required | Status cache         |\n| `EDGE_DB`          | D1Database  | ✅ Required | Edge database        |\n| `FILES`            | R2Bucket    | ✅ Required | File storage         |\n\n---\n\n## Connector Sync Bindings\n\n**File:** `services/connector-sync/src/index.ts`\n\n| Binding            | Type                   | Required    | Notes               |\n| ------------------ | ---------------------- | ----------- | ------------------- |\n| `SYNC_QUEUE`       | Queue                  | ✅ Required | Sync job processing |\n| `CONNECTOR_STATUS` | KVNamespace            | ✅ Required | Status cache        |\n| `DB`               | D1Database             | ✅ Required | Sync state          |\n| `SYNC_SCHEDULER`   | DurableObjectNamespace | ⚠️ Optional | Sync scheduling     |\n\n---\n\n## Continuity Service Bindings\n\n**File:** `services/continuity/src/index.ts`\n\n| Binding       | Type       | Required    | Notes            |\n| ------------- | ---------- | ----------- | ---------------- |\n| `TASKS_QUEUE` | Queue      | ⚠️ Optional | Task processing  |\n| `DB`          | D1Database | ✅ Required | Continuity state |\n\n---\n\n## Billing Service Bindings\n\n**File:** `services/billing/src/index.ts`\n\n| Binding          | Type        | Required    | Notes          |\n| ---------------- | ----------- | ----------- | -------------- |\n| `DB`             | D1Database  | ✅ Required | Billing state  |\n| `WEBHOOK_REPLAY` | KVNamespace | ⚠️ Optional | Webhook replay |\n\n---\n\n## Storage Summary\n\n| Storage Type               | Count | Services Using                                                                         |\n| -------------------------- | ----- | -------------------------------------------------------------------------------------- |\n| **D1Database**             | 7+    | Gateway, MCP Connector, Connector, Connector Sync, Continuity, Billing, Agent Registry |\n| **KVNamespace**            | 8+    | Gateway (6), MCP Connector (1), Connector (2), Billing (1)                             |\n| **Queue**                  | 4+    | Connector (2), Connector Sync (1), Continuity (1)                                      |\n| **R2Bucket**               | 1     | Connector (FILES)                                                                      |\n| **DurableObjectNamespace** | 2+    | Gateway (TENANT0), Connector Sync (SYNC_SCHEDULER)                                     |\n| **Vectorize**              | 0     | Not yet used                                                                           |\n\n---\n\n## What's Missing (Cloudflare Provisioning)\n\n### Required for Customer Zero\n\n| Binding          | Action                                                                                            | Priority |\n| ---------------- | ------------------------------------------------------------------------------------------------- | -------- |\n| D1 Database      | Create `integratewise-prod` D1 database                                                           | P0       |\n| KV Namespaces    | Create `RATE_LIMITS`, `SESSIONS`, `CONNECTOR_STATUS`, `SIGNAL_CACHE`, `METRICS`, `OAUTH_STATE_KV` | P0       |\n| Queues           | Create `pipeline-process`, `intelligence-events`, `connector-sync`, `knowledge-queue`             | P0       |\n| R2 Bucket        | Create `integratewise-files` bucket                                                               | P0       |\n| Service Bindings | Bind all downstream Workers to Gateway                                                            | P0       |\n| Durable Objects  | Enable `TENANT0_ENDPOINTS`, `SYNC_SCHEDULER`                                                      | P1       |\n\n### Required for External Product\n\n| Binding                   | Action                                              | Priority |\n| ------------------------- | --------------------------------------------------- | -------- |\n| RLS Policies              | Apply migration 042 `tenant_rls` policies to D1     | P0       |\n| Tenant Secret Namespacing | Configure `TENANT_<slug>_*` secrets in Secret Store | P0       |\n| Shared D1                 | Verify all queries include `tenant_id` filter       | P0       |\n\n### Not Yet Needed\n\n| Binding       | Status   | When                                |\n| ------------- | -------- | ----------------------------------- |\n| Vectorize     | Not used | When semantic search is implemented |\n| AI Gateway    | Not used | When AI routing is implemented      |\n| Additional R2 | Not used | When file storage scales            |\n\n---\n\n## Binding Provisioning Checklist\n\n```bash\n# 1. Create D1 database\nwrangler d1 create integratewise-prod\n\n# 2. Create KV namespaces\nwrangler kv namespace create RATE_LIMITS\nwrangler kv namespace create SESSIONS\nwrangler kv namespace create CONNECTOR_STATUS\nwrangler kv namespace create SIGNAL_CACHE\nwrangler kv namespace create METRICS\nwrangler kv namespace create OAUTH_STATE_KV\n\n# 3. Create Queues\nwrangler queues create pipeline-process\nwrangler queues create intelligence-events\nwrangler queues create connector-sync\nwrangler queues create knowledge-queue\n\n# 4. Create R2 bucket\nwrangler r2 bucket create integratewise-files\n\n# 5. Apply migrations to D1\nwrangler d1 execute integratewise-prod --file migrations/035_canonical_spine_schema_fortress.sql\nwrangler d1 execute integratewise-prod --file migrations/042_real_tenant_rls_and_runtime_scope.sql\n\n# 6. Bind services in wrangler.toml\n# (Add binding declarations to each service's wrangler.toml)\n```\n\n---\n\n## Verification\n\nAfter provisioning:\n\n```bash\n# Verify D1\nwrangler d1 execute integratewise-prod --command \"SELECT count(*) FROM information_schema.tables;\"\n\n# Verify KV\nwrangler kv namespace list\n\n# Verify Queues\nwrangler queues list\n\n# Verify R2\nwrangler r2 bucket list\n```\n"}