DEV Community

Angela Chukuwike
Angela Chukuwike

Posted on

Automating wagmi v2 v3 and Inngest v3 v4 Migrations with Zero False Positives

The Problem

Upgrading dependencies is one of the most frustrating parts of maintaining modern applications.

A single breaking release can mean:

  • Dozens of files to update
  • Hours of repetitive refactoring
  • Constant fear of introducing subtle bugs

For wagmi v2β†’v3, that means renaming hooks like useAccount, useContractRead, and updating providers across your entire codebase.

For Inngest v3β†’v4, it means restructuring function triggers, moving configuration, and adapting to a new middleware system.

This is slow, error-prone, and hard to get right.


The Solution

I built Boring AI Migration Suite β€” a production-grade codemod system that automates 70–80% of these migrations with zero false positives.

πŸ”— Live demo: https://migrate-wagmi-v3.vercel.app

πŸ”— GitHub: https://github.com/Web3smallie/migrate-wagmi-v3

πŸ‘‰ The goal: eliminate the boring, risky parts of upgrades.


How It Works

The system uses a hybrid approach:

1. Deterministic AST transforms (70–80%)

All safe, mechanical changes are handled automatically.

  • Same input β†’ same output
  • No guessing
  • No hallucinations

2. AI-ready TODO comments (20–30%)

For complex cases, the codemod inserts structured comments:

/* TODO (AI): autoConnect was removed in wagmi v3. 
   Use reconnectOnMount instead if needed.
   See: https://wagmi.sh/react/guides/migrate-from-v2-to-v3 */
Enter fullscreen mode Exit fullscreen mode

These are designed so an AI agent (or developer) can resolve them quickly.


wagmi v2β†’v3: Automated Changes

  • useAccount β†’ useConnection
  • useAccountEffect β†’ useConnectionEffect
  • useSwitchAccount β†’ useSwitchConnection
  • useContractRead β†’ useReadContract
  • useContractWrite β†’ useWriteContract
  • useNetwork β†’ useChains
  • useSwitchNetwork β†’ useSwitchChain
  • useWaitForTransaction β†’ useWaitForTransactionReceipt
  • WagmiConfig β†’ WagmiProvider
  • writeContract β†’ mutate / mutateAsync
  • wagmi/chains β†’ viem/chains
  • Type renames (UseAccountReturnType β†’ UseConnectionReturnType)

Inngest v3β†’v4: Automated Changes

  • createFunction trigger β†’ moved into triggers: []
  • serve() options β†’ moved to constructor
  • serveHost β†’ serveOrigin
  • streaming normalization
  • step.invoke β†’ referenceFunction()

Real World Results

scaffold-eth-2 (10k+ stars) β€” wagmi

npx migrate-wagmi-v3 ./scaffold-eth-2
Enter fullscreen mode Exit fullscreen mode
  • Files affected: 13
  • Patterns detected: 15
  • Automated: 11
  • TODOs: 4
  • Coverage: 73%
  • False positives: 0
  • Time: < 5 seconds

πŸ‘‰ What would normally take 1–2 hours was completed in seconds.

PR: https://github.com/scaffold-eth/scaffold-eth-2/pull/1278


Documenso (10k+ stars) β€” Inngest

npx migrate-wagmi-v3 --inngest ./documenso
Enter fullscreen mode Exit fullscreen mode
  • Files affected: 1
  • Patterns detected: 3
  • Automated: 1
  • TODOs: 2
  • False positives: 0
  • Time: < 3 seconds

PR: https://github.com/documenso/documenso/pull/2736


Key Features

Dry Run (Safe Preview)

npx migrate-wagmi-v3 . --dry-run
Enter fullscreen mode Exit fullscreen mode

Preview all changes without modifying files.


Auto PR Generation

npx migrate-wagmi-v3 --auto-pr https://github.com/owner/repo --token ghp_xxx
Enter fullscreen mode Exit fullscreen mode

Clone β†’ migrate β†’ commit β†’ open PR automatically.


Migration Report

Each run generates a migration-report.md in your project root:

  • Patterns detected
  • Automated changes
  • TODOs
  • Coverage

Why Zero False Positives Matters

False positives are heavily penalized in automated migrations.

This system avoids them by:

  1. Only transforming patterns with 100% certainty
  2. Flagging ambiguous cases instead of guessing
  3. Using multi-pass analysis for safer detection

πŸ‘‰ The result: migrations that are safe by default


Test Suite

wagmi:   10 tests passing  
Inngest: 15 tests passing  
Total:   25/25 passing  
Enter fullscreen mode Exit fullscreen mode

Covers:

  • Happy paths
  • Edge cases
  • Idempotency

Try It

npx migrate-wagmi-v3 ./your-project
Enter fullscreen mode Exit fullscreen mode

Final Thoughts

Software maintenance shouldn’t be this painful.

By combining deterministic codemods with AI-assisted review, we can turn migrations from hours of manual work into a fast, reliable workflow.

πŸ‘‰ This is a step toward making software maintenance… boring.

Top comments (0)