Unclassified

OPTION B BRANCH DIVERGENCE AUDIT

Tier C — Historical. This document is a point-in-time snapshot preserved for reference. For current architecture, see CANONICAL_PLATFORM_ARCHITECTURE.md.

Generated: 2025-07-11
Audit Scope: Gateway/Connector Service-Binding Decoupling (Wave 0) vs. origin/main Restructure


1. COMMIT LINEAGE SNAPSHOT

RefSHADescription
local main HEAD351e95d9Merge PR #59 — identical to origin/main
origin/main HEAD351e95d9Merge PR #59 (recovery/v1-clean-main)
Work Commitafbdb538OPTION B WAVE 0 COMPLETION: Gateway decoupling complete with service bindings
Checkpoint Commitcc6d3edacheckpoint: pre-Option B working tree restructure
Refactor Commit1d058bf2refactor: remove archive and stale content, add workspace pages and twin features
Merge-Basedb9b3b4efeat: merge all 4 source zips by app and department

Commit Count Since Merge-Base

  • origin/main: 2 commits (cdd2a4af, 351e95d9)
  • Work Branch (local only): 3 commits (afbdb538, cc6d3eda, 1d058bf2)
  • gateway-decoupling-complete (remote): Reset to origin/main — work not present on remote branch

2. PATH-LEVEL DIVERGENCE ANALYSIS

2.1 The 11 Files Modified by Gateway/Connector Decoupling (Commit afbdb538)

#PathExists on origin/mainChanged on origin/main since merge-baseChanged on Work BranchConflict RiskRecommended Replay Method
1OPTION_B_WAVE0_LOG.md❌ No (new)N/A✅ CreatedNoneClean cherry-pick (new file)
2services/connector/src/connector.test.ts✅ Yes❌ No✅ ModifiedNoneClean cherry-pick
3services/connector/src/index.ts✅ Yes❌ No✅ ModifiedNoneClean cherry-pick
4services/connector/wrangler.toml✅ Yes❌ No✅ ModifiedNoneClean cherry-pick
5services/gateway/src/index.ts✅ Yes❌ No✅ ModifiedNoneClean cherry-pick
6services/gateway/wrangler.toml✅ Yes❌ No✅ ModifiedNoneClean cherry-pick
7services/loader/src/index.ts✅ Yes❌ No✅ ModifiedNoneClean cherry-pick
8services/loader/src/lib/nango.ts✅ Yes❌ No✅ CreatedNoneClean cherry-pick (new file)
9services/loader/src/lib/token-refresh.ts✅ Yes❌ No✅ CreatedNoneClean cherry-pick (new file)
10services/mcp-connector/src/lib/oauth-jwt.ts✅ Yes❌ No✅ CreatedNoneClean cherry-pick (new file)
11services/mcp-connector/src/oauth.test.ts✅ Yes❌ No✅ ModifiedNoneClean cherry-pick

Summary: All 11 files are unchanged on origin/main since the merge-base db9b3b4e. Zero content conflicts expected.


3. SERVICE BINDING TOPOLOGY VALIDATION

3.1 Bindings Introduced by Work Commit

BindingTarget ServiceTarget Worker NameExists on origin/main
ADMINAdminintegratewise-admin✅ Service exists (services/admin/)
BILLINGBillingintegratewise-billing✅ Service exists (services/billing/)
TENANTSTenantsintegratewise-tenants✅ Service exists (services/tenants/)
LOADERLoaderintegratewise-loader✅ Service exists (services/loader/)
MCPMCP Connectorintegratewise-mcp-connector✅ Service exists (services/mcp-connector/)
STOREStoreintegratewise-store✅ Service exists (services/store/)

3.2 Binding Name Conflicts on origin/main

BindingDefined on origin/main (gateway)Defined on origin/main (connector)Conflict?
ADMIN❌ NoN/ANo
BILLING❌ NoN/ANo
TENANTS❌ NoN/ANo
LOADERN/A❌ NoNo
MCP❌ No (only in [env.test])❌ No (commented in default)No
STOREN/A❌ NoNo

Verdict: No binding name conflicts. All six bindings are new additions that don't collide with existing bindings on origin/main.

3.3 Service Deployment Names Verification

All six target worker names (integratewise-admin, integratewise-billing, integratewise-tenants, integratewise-loader, integratewise-mcp-connector, integratewise-store) correspond to actual service directories on origin/main. The Cloudflare Worker deployment names match the service binding `service = service values.


4. REPLAY FEASIBILITY MATRIX

FactorAssessment
Content overlapNone — zero files modified on origin/main since merge-base
Binding conflictsNone — all six bindings are fresh additions
Service existence✅ All six target services exist on origin/main
File move/rename riskNone — file paths identical between branches
Test impactOnly connector.test.ts and oauth.test.ts modified; no test infrastructure changes on origin/main
Config schema driftwrangler.toml schema unchanged; only [[services]] blocks added

Overall Replay Risk: LOW — Clean cherry-pick expected for all 11 files.


5. RECOMMENDATION

A. Clean cherry-pick onto a new branch from origin/main

Rationale:

  1. All 11 files are unchanged on origin/main since the merge-base
  2. No binding name conflicts exist
  3. All target services exist and are deployed
  4. The work commit (afbdb538) is a single, coherent logical unit
  5. Cherry-pick will preserve authorship, commit message, and history
  6. No manual conflict resolution required

Execution Plan (when approved):

# 1. Create fresh branch from canonical origin/main
git fetch origin
git checkout -b option-b/wave0-gateway-decoupling origin/main

# 2. Cherry-pick the work commit (single commit, clean)
git cherry-pick afbdb538

# 3. Verify all 11 files applied correctly
git diff origin/main --stat

# 4. Run typecheck/lint (if tooling available)
# npm run typecheck && npm run lint

# 5. Push for PR
git push -u origin option-b/wave0-gateway-decoupling

6. BRANCH STRATEGY GOING FORWARD

PhaseBranchBasePurpose
Wave 0 (done)option-b/wave0-gateway-decouplingorigin/mainGateway + Connector service bindings
Wave 1option-b/wave1-intelligence-pipelineoption-b/wave0-...Intelligence (think/act/govern) + Pipeline (normalizer/spine)
Wave 2option-b/wave2-...option-b/wave1-...Remaining services

Never rebase gateway-decoupling-complete (remote is stale).
Never merge main → feature branch (linear history required).
Always cherry-pick forward from origin/main for each new wave.


7. ARTIFACTS PRESERVED

The following work artifacts exist in commit afbdb538 (local only, recoverable via reflog HEAD@{9}):

  • services/gateway/src/index.ts — ADMIN/BILLING/TENANTS routing via service bindings
  • services/gateway/wrangler.toml — [[services]] for ADMIN, BILLING, TENANTS (default/test/prod)
  • services/connector/src/index.ts — LOADER/MCP/STORE routing via service bindings
  • services/connector/wrangler.toml — [[services]] for LOADER, MCP, STORE (default/test/prod)
  • services/mcp-connector/src/lib/oauth-jwt.ts — Shared JWT signing utility (decoupled from gateway)
  • services/mcp-connector/src/oauth.test.ts — Updated import path
  • services/loader/src/lib/nango.ts + token-refresh.ts — Loader library modules
  • services/connector/src/connector.test.ts — Integration test suite
  • OPTION_B_WAVE0_LOG.md — Wave 0 completion log

8. DECISION REQUIRED

Approve Option A to proceed with clean cherry-pick onto new branch from origin/main.

Once approved, Wave 1 (Intelligence + Pipeline decoupling) can begin on the validated Wave 0 base.