Skip to content

Conversation

@anxolin
Copy link
Contributor

@anxolin anxolin commented Dec 23, 2025

Summary

fix sdk tools

After SDK changes to add adapters for web3 libraries, https://sdk-tools.cow.fi became broken:

Before:
image

After
image

Test

Test https://sdk-tools-git-fix-sdk-tools-cowswap-dev.vercel.app doesn't get that error

Summary by CodeRabbit

  • Chores
    • Initialize a global SDK adapter at application startup to ensure the SDK is ready before UI rendering.
    • Update TypeScript build settings to stop generating declaration files and disable composite project mode, altering build outputs.
    • Add deployment configuration to serve the app as a single-page application and specify build/output steps.

✏️ Tip: You can customize this high-level summary in your review settings.

@vercel
Copy link

vercel bot commented Dec 23, 2025

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Review Updated (UTC)
cowfi Ready Ready Preview Dec 23, 2025 2:29pm
explorer-dev Ready Ready Preview Dec 23, 2025 2:29pm
sdk-tools Error Error Dec 23, 2025 2:29pm
swap-dev Ready Ready Preview Dec 23, 2025 2:29pm
widget-configurator Ready Ready Preview Dec 23, 2025 2:29pm
1 Skipped Deployment
Project Deployment Review Updated (UTC)
cosmos Ignored Ignored Dec 23, 2025 2:29pm

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Dec 23, 2025

Walkthrough

Adds module-level initialization that constructs and registers a global CoW SDK adapter (EthersV5Adapter using MAINNET RPC) before React rendering, removes composite/declaration from the app TypeScript config, and adds a Vercel deployment config with a SPA rewrite and build/install/output commands.

Changes

Cohort / File(s) Summary
CoW SDK Adapter Initialization
apps/sdk-tools/src/main.tsx
Adds imports (getRpcProvider, setGlobalAdapter, SupportedChainId, EthersV5Adapter); creates an EthersV5Adapter with the MAINNET RPC provider at module load and calls setGlobalAdapter() before React renders.
TypeScript build config
apps/sdk-tools/tsconfig.app.json
Removes composite: true and declaration: true from compilerOptions, disabling composite project mode and declaration file output for this app.
Vercel deployment config
apps/sdk-tools/vercel.json
Adds Vercel config: SPA rewrite to index.html, buildCommand (cd ../../ && yarn build:sdk-tools), installCommand (cd ../../ && yarn run install:ci), and outputDirectory (../../build/sdk-tools).

Sequence Diagram(s)

mermaid
sequenceDiagram
autonumber
participant Module as main.tsx (module load)
participant RPC as RPC Provider
participant Adapter as EthersV5Adapter
participant Global as Global SDK State
participant React as React App (Root)

Note over Module,RPC: Module-level init runs before app render
Module->>RPC: getRpcProvider(SupportedChainId.MAINNET)
RPC-->>Module: rpcProvider
Module->>Adapter: new EthersV5Adapter(rpcProvider, chainId)
Adapter-->>Module: adapterInstance
Module->>Global: setGlobalAdapter(adapterInstance)
Global-->>Module: adapter registered
Note over Global,React: Global adapter now available to app
Module->>React: import/execute Root render
React-->>Global: read global adapter (on use)

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Suggested reviewers

  • alfetopito
  • shoom3301

Poem

🐰 I hopped in early, set the chain,
MAINNET whispers through my vein,
An adapter snug, then off they run,
Root greets code — the job is done,
✨🥕

Pre-merge checks and finishing touches

❌ Failed checks (1 inconclusive)
Check name Status Explanation Resolution
Description check ❓ Inconclusive The description includes a summary with context and screenshots showing the issue, but the testing section is incomplete and lacks detailed verification steps. Expand the testing section with specific, numbered steps to verify the fix and define what QA should check (e.g., verify no error appears, confirm adapter initializes correctly).
✅ Passed checks (2 passed)
Check name Status Explanation
Title check ✅ Passed The title accurately describes the main change: adding a global adapter initialization to fix the sdk-tools application.
Docstring Coverage ✅ Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%.
✨ Finishing touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch fix-sdk-tools

📜 Recent review details

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 44e25b4 and 0975d42.

📒 Files selected for processing (1)
  • apps/sdk-tools/vercel.json
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (2)
  • GitHub Check: Setup
  • GitHub Check: Cypress
🔇 Additional comments (2)
apps/sdk-tools/vercel.json (2)

2-7: LGTM! Standard SPA routing configuration.

The rewrites configuration correctly routes all paths to index.html, which is the standard pattern for single-page applications deployed on Vercel.


8-10: Build configuration looks correct for the monorepo structure.

The build, install, and output directory configurations properly navigate to the monorepo root and use appropriate commands. The working test deployment at the provided URL confirms these paths and commands are correct.


Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

📜 Review details

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 738fa0e and 44e25b4.

📒 Files selected for processing (1)
  • apps/sdk-tools/tsconfig.app.json
🧰 Additional context used
🧠 Learnings (1)
📓 Common learnings
Learnt from: alfetopito
Repo: cowprotocol/cowswap PR: 6234
File: libs/tokens/src/index.ts:1-4
Timestamp: 2025-09-11T08:25:51.460Z
Learning: In the cowprotocol/cowswap project, there is currently no SSR (Server-Side Rendering) support, so localStorage access at module import time does not cause SSR-related issues.
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (2)
  • GitHub Check: Setup
  • GitHub Check: Cypress

Comment on lines 3 to 6
"compilerOptions": {
"outDir": "../../dist/out-tsc",
"types": ["node", "vite/client"],
"composite": true,
"declaration": true
"types": ["node", "vite/client"]
},
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🔴 Critical

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
# Description: Check for tsconfig files that might reference sdk-tools as a composite project

echo "=== Searching for project references to sdk-tools ==="
rg -n --type=json '"references"' -A 10 | grep -i 'sdk-tools' || echo "No references found to sdk-tools"

echo ""
echo "=== Checking for composite project configurations ==="
fd tsconfig.json --exec rg -l '"composite".*true' {} \;

echo ""
echo "=== Searching for imports from sdk-tools app (unusual for apps) ==="
rg -n "from ['\"].*sdk-tools" --type=ts --type=tsx -g '!apps/sdk-tools/**' || echo "No imports from sdk-tools found"

echo ""
echo "=== Checking the full tsconfig.app.json content ==="
cat apps/sdk-tools/tsconfig.app.json

echo ""
echo "=== Checking tsconfig.json (base config) ==="
cat apps/sdk-tools/tsconfig.json 2>/dev/null || echo "No base tsconfig.json found in apps/sdk-tools"

echo ""
echo "=== Checking if apps/sdk-tools is referenced in root tsconfig ==="
rg -n '"references"' -A 50 tsconfig.json | head -60

Repository: cowprotocol/cowswap

Length of output: 1969


🏁 Script executed:

#!/bin/bash
echo "=== Checking tsconfig.spec.json ==="
cat apps/sdk-tools/tsconfig.spec.json

echo ""
echo "=== Verifying: are composite and declaration in any of the sdk-tools tsconfig files? ==="
grep -r "composite\|declaration" apps/sdk-tools/tsconfig*.json || echo "Not found in any tsconfig files"

echo ""
echo "=== Documentation check: does TypeScript require composite for referenced projects? ==="
echo "TypeScript's project references feature (using 'references' in tsconfig) requires all referenced projects to have 'composite: true'"
echo "Without it, TypeScript compilation will fail with an error like 'Project cannot be built because of the above errors.'"

Repository: cowprotocol/cowswap

Length of output: 1310


Critical: composite: true must be restored to tsconfig.app.json to prevent TypeScript build failure.

The removal of composite: true breaks the project reference chain in apps/sdk-tools/tsconfig.json, which declares references to both tsconfig.app.json and tsconfig.spec.json. TypeScript requires all referenced projects to have composite: true enabled. Currently, only tsconfig.spec.json has this setting, but tsconfig.app.json is missing it. This will cause TypeScript compilation to fail with "Project cannot be built because of the above errors."

Restore "composite": true to the compilerOptions in tsconfig.app.json.

🤖 Prompt for AI Agents
In apps/sdk-tools/tsconfig.app.json around lines 3 to 6, the compilerOptions
block is missing "composite": true which breaks the TypeScript project reference
chain; add "composite": true into the compilerOptions object (alongside outDir
and types) so tsconfig.app.json is a composite project and the references
declared in apps/sdk-tools/tsconfig.json can be built successfully.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants