{"slug":"architecture/ROUND_EXECUTION_SEQUENCE","title":"IntegrateWise — Round-Executable Action Sequence","section":"architecture","sectionLabel":"Architecture","status":"unclassified","type":"document","path":"architecture/ROUND_EXECUTION_SEQUENCE.mdx","bytes":7142,"description":null,"updated":null,"source":"integratewise/Integratewise-docs-wiki","content":"\n**Start state:** commit `495a0295` on `main`, clean working tree  \n**Canonical distribution:** IW-Spine-Network MCP only; no separate plugin package  \n**Public tool contract:** exactly 19 tools  \n**Execution paths:** Dev Internal → Customer Zero → Product to Users\n\n---\n\n## Round 1 — P0: Contract/Code Conflicts\n\n**Entry criteria:** working tree clean at `495a0295`  \n**Exit criteria:** all P0 #1–7 items verified end-to-end, no stale `IW-Continuity-Bridge` code references remain, tests pass\n\n### Actions\n\n1. **P0 #1** Grep the widest sensible surface for the stale claim “MCP only; no Plugin package” and replace with the canonical phrasing: one MCP artifact in MCP marketplaces/registries, no separate plugin package. Update docs, README, marketplace specs, and any code comments/docs that still publish a Plugin artifact.\n2. **P0 #2** Complete the live MCP identity rename from `IW-Continuity-Bridge` to `IW-Spine-Network MCP` in all runtime metadata, server names, worker names, route identifiers, platform catalog entries, and marketplace metadata. Do not break request-path compatibility unless explicitly required.\n3. **P0 #3** Expand `packages/spine-network/src/index.ts` to the exact 19-tool frozen contract. Preserve the existing Gateway routing pattern and add any missing semantic tools.\n4. **P0 #4** Audit every marketplace profile/app definition that exposes tools. Reduce or align any 9-tool/23-tool profiles to the frozen 19-tool contract.\n5. **P0 #5** Rewrite the stale Spine Network distribution manifest/doc to separate Plugin and MCP artifacts, switch to Clerk/Gateway authentication, make human approval mandatory, and remove any `ready_for_submission` claims.\n6. **P0 #6** Replace or archive the legacy `iw-continuity-bridge` marketplace entry. Do not delete if it is still referenced by runtime tests.\n7. **P0 #7** Correct `marketplace/apps/iw-spine-network.json`: tool count must equal 19, `requiresApproval` must be `true`, metadata must match the canonical name.\n\n### Commit boundary\n\n- Commit message: `chore: complete P0 contract/code alignment to IW-Spine-Network MCP`\n- Must pass: `pnpm run typecheck --filter packages/spine-network`, targeted `mcp-connector` + `gateway` tests\n\n---\n\n## Round 2 — P0: Infrastructure and Authentication\n\n**Entry criteria:** Round 1 committed  \n**Exit criteria:** auth and DNS prerequisites explicit, no unknowns in config/keys, secrets placement verified\n\n### Actions\n\n1. **P0 #8–9** Inventory current DNS and auth domain state. Produce an explicit remediation checklist for `gateway`, `api`, `marketplace`, `workbench`, `status`, and `auth.integratewise.ai`. Do not guess—state exact Cloudflare/Clerk actions required.\n2. **P0 #10** Implement the single shared auth node in code/config: Clerk identity + OAuth + tenant/workspace resolution + marketplace installation identity. Wire Gateway and MCP connector service through it.\n3. **P0 #11** Add an environment/tenancy manifest/checklist that proves Dev Internal / Customer Zero / Customer Production isolation.\n4. **P0 #12** Review Neon migration 035 for correctness against live schema; add a verification query or test that proves table/column presence.\n5. **P0 #13–14** Define strict `connector_bindings` / `connector_schema_bindings`. Audit D1, KV, R2, queues, secrets, audit log, and credential wall bindings; list exactly what is missing.\n\n### Commit boundary\n\n- May require multiple commits if external DNS/Clerk changes are needed\n- Code/config commits must pass targeted typecheck/tests\n\n---\n\n## Round 3 — P1: Build IW-Spine-Network Plugin and MCP\n\n**Entry criteria:** Round 2 committed  \n**Exit criteria:** both artifacts have working skeletons and canonical tooling\n\n### Actions\n\n1. **P1 #15–21** Build the Plugin package:\n   - Package, OAuth, consent, revocation, clean tenant activation flow\n   - Sandboxed embedded UI surface\n   - Widgets for active work, Spine status, entity/work search, capability picker, proposal/evidence, approval confirmation, execution progress, Open Workbench\n2. **P1 #22–28** Build the MCP package:\n   - Publish exact 19 tools from one canonical source\n   - Generate valid versioned `server.json`\n   - Add OAuth scopes, annotations, error/result schemas\n   - Optional MCP App widgets for compatible clients\n   - Open Workbench launch contract\n3. **P1 #29–35** Implement discovery origins:\n   - `host_composed`, `host_delegated`, `iw_direct`\n   - Credential-scraping prevention\n   - Duplicate detection and merge/precedence policy\n   - Partial/degraded/revoked/duplicate state rendering\n\n### Commit boundary\n\n- Commit after each artifact is independently runnable\n\n---\n\n## Round 4 — P1: Frontend and Platform Completion\n\n**Entry criteria:** Round 3 committed  \n**Exit criteria:** frontend uses single API boundary, no direct backend access\n\n### Actions\n\n1. **P1 #36** Audit and enforce `NEXT_PUBLIC_IW_API_URL` as the single frontend API boundary.\n2. **P1 #37** Remove production localhost/direct-service fallbacks from `apps/web`.\n3. **P1 #38** Deploy and verify `/api/v1/workspace/discovery` end-to-end.\n4. **P1 #39** Connect `/api/v1/marketplace/installations/*` to Plugin and MCP activation flows.\n5. **P1 #40** Verify RBAC projections use server-resolved identity.\n6. **P1 #41** Complete browser Workbench launch and Gateway communication.\n7. **P1 #42** Verify frontend never calls DB/provider/Hermes/credentials/MCP Pool directly.\n\n### Commit boundary\n\n- One commit per verified surface\n\n---\n\n## Round 5 — P1: Customer Zero Testing Event\n\n**Entry criteria:** Round 4 deployed to Customer Zero  \n**Exit criteria:** all acceptance tests pass, evidence records produced\n\n### Actions\n\n1. **P1 #43–52** Execute clean-install and clean-connect acceptance tests:\n   - Clean install Plugin into new tenant\n   - Clean connect MCP from compatible client\n   - Exactly 19 public tools\n   - Cross-tenant/cross-environment denial\n   - Host-connected app composition without credential inheritance\n   - Duplicate provider connection handling\n   - Governed action cycle end-to-end\n   - Flow A/B/C/D, idempotency, retries, DLQ, replay, reconciliation, promotion, aging\n   - Observability, audit, revocation, rollback, incident handling\n\n### Commit boundary\n\n- Do not include new features; record acceptance results and any bugfix commits\n\n---\n\n## Round 6 — P2: Publication\n\n**Entry criteria:** Rounds 1–5 complete, acceptance evidence recorded  \n**Exit criteria:** publicly listed/connected, monitoring operational\n\n### Actions\n\n1. **P2 #53–55** Prepare submission assets and submit to Plugin marketplaces/directories and MCP registries/directories.\n2. **P2 #56–58** Build/submit Vercel native package and inbound connector; add any required provider-native packages.\n3. **P2 #59** Activate monitoring, support, versioning, rollback, deprecation operations.\n\n---\n\n## Quick-Reference Order\n\n```\nRound 1: P0 contract/code alignment\nRound 2: P0 infrastructure/auth\nRound 3: P1 Plugin + MCP + discovery\nRound 4: P1 frontend/platform completion\nRound 5: P1 Customer Zero testing\nRound 6: P2 publication\n```\n"}