DEV Community

Angela Chukuwike
Angela Chukuwike

Posted on • Edited 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

  • useAccountuseConnection
  • useAccountEffectuseConnectionEffect
  • useSwitchAccountuseSwitchConnection
  • useContractReaduseReadContract
  • useContractWriteuseWriteContract
  • useNetworkuseChains
  • useSwitchNetworkuseSwitchChain
  • useWaitForTransactionuseWaitForTransactionReceipt
  • WagmiConfigWagmiProvider
  • writeContractmutate / mutateAsync
  • wagmi/chainsviem/chains
  • Type renames (UseAccountReturnTypeUseConnectionReturnType)

Inngest v3→v4: Automated Changes

  • createFunction trigger → moved into triggers: []
  • serve() options → moved to constructor
  • serveHostserveOrigin
  • streaming normalization
  • step.invokereferenceFunction()

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 (v1): https://github.com/scaffold-eth/scaffold-eth-2/pull/1277
PR (v2 - 13 files, 73% coverage): 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

PR opened on Documenso; awaiting maintainer review after successful CI and CLA submission.

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

Maintainer Feedback & Real-World Constraints

When testing the codemod on scaffold-eth-2, the maintainers reviewed the pull request and noted that since wagmi is a core dependency, they prefer to run the migration internally.

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

This highlights an important real-world constraint: even when automation is correct, ownership and risk management matter in production systems.

Despite this, the codemod successfully demonstrated:

  • Safe, zero–false-positive transformations
  • Correct handling of real production code
  • Practical applicability to large, actively maintained repositories

The migration approach was validated, while execution remained with the core team.

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)