2026-11-26 15:37 UTC

ShadowDiff launches open-source shadow testing for AI-refactored backends

state: seedheat: mediumuncertainty: mediumrelevance: mediumai-code-migration database-testing ai-deploymentvishalraj1

What is this?

ShadowDiff is an MIT-licensed Go project by GitHub user vishalrajofficial, promoted by its author in a Show HN post on Nov. 15, 2026. Its GitHub README describes a proxy-based system for mirroring requests to legacy and refactored services, comparing responses and SQL effects, and optionally generating tests with Gemini and enforcing CI gates. A live demo and deployment examples are advertised. The supplied evidence is the project’s own documentation and an HN listing; it does not independently verify the claimed capabilities, performance, safety, or production readiness. Search results also surface other, apparently distinct projects named ShadowDiff, so attribution by repository matters.

Why it matters

If the advertised workflow works, it could make risky legacy-to-modern migrations easier to validate: teams could test a candidate against realistic traffic and catch behavioral or database-side-effect differences before switching users over. That is a useful deployment-safety layer for AI-assisted coding, but the available evidence establishes a project and its claimsβ€”not mature adoption or demonstrated effectiveness.

Current assessment

New: the author has presented ShadowDiff as an open-source tool for testing AI-refactored backends, with an MIT license stated in the README. The documented design combines traffic mirroring, three-way response comparison to filter nondeterministic differences, SQL-effect checks, Gemini-based test synthesis, a GitHub PR workflow, and a CI quality gate. The README also claims rollback or ephemeral database sandboxing for mutating requests and zero application-latency penalty; these are project claims, not independently substantiated results. It gives a quickstart, demo, and Envoy/Istio deployment examples, but supplied sources do not establish real-world use, security properties, compatibility limits, or whether every feature works as described. The web results include an author-written Dev.to post and multiple similarly named repositories; they do not provide independent validation of this specific repository. Track implementation and evidence of safe operation, especially around production traffic, database isolation, and automated PRs. If validated, the approach could reduce migration risk and help teams gate AI-generated rewrites using observed behavior rather than only hand-written tests.

Measured heat

now 0 pts/hpeak 2 pts/hcomments 0/hpeers p10momentum: steady2 platformsage 272h
points/hour across evidence Β· reading as of 2026-11-27 02:23:58.509736+11:00 Β· deterministic, not a model opinion

How the heat travelled

11-15 07:21 (minted)⭐ origin echo-reconstructedThe Hacker News post links directly to the repository, which presents ShadowDiff as β€œDual-Traffic Shadow Testing Engine for AI-Refactored Le
vishalraj1 (GitHub account vishalrajofficial) on github (echo) Β· attributed from hn.story.50504643 Β· published time unknown
β€”
11-15 06:54first on hacker news Β· published Β· lag ?Show HN: ShadowDiff – Shadow testing and SQL diffing for AI-migrated back ends
vishalraj1
β€”
11-15 06:54amplified on hacker news πŸ‘‘hn.story.50504643
vishalraj1
peak 1 Β· 0 comments Β· 103% of case engagement
11-15 07:20our radar first saw it Β· lag ?discovery anchor: hn.story.50504643β€”
pace: p13 vs 2096 stories at the 168h mark (now 272h old) β€” behind adobe-max-ai-agents-creative-tools-mcp (0.5x)

Evidence (2) β€” ⭐ canonical anchor

sourceobjectauthorscorecomments
🟧 hnShow HN: ShadowDiff – Shadow testing and SQL diffing for AI-migrated back ends
Retrieved article excerpt

Open article Β· Retrieved 2026-11-15T07:21:06.457542+00:00

# πŸŒ— ShadowDiff

### Dual-Traffic Shadow Testing Engine for AI-Refactored Legacy Code

[License: MIT](https://opensource.org/licenses/MIT)
[Go Version](https://golang.org)
[Envoy Proxy](https://www.envoyproxy.io)
[Fly.io](https://fly.io)
[Live Demo](https://shadowdiff-demo.fly.dev/)

> **Eliminating the 5% risk that stops enterprise CTOs from deploying AI-modernized backends to production.**  
> 🌐 **Interactive Live Cloud Sandbox**: [https://shadowdiff-demo.fly.dev](https://shadowdiff-demo.fly.dev/) (Self-driving dual-traffic simulator active)

---

## 🎬 Live Terminal Walkthrough (`vhs`)

[ShadowDiff Terminal Walkthrough](https://github.com/vishalrajofficial/ShadowDiff/blob/main/assets/shadowdiff-demo.gif)

---

## ⚑ The Problem

Enterprises are actively modernizing mission-critical legacy backends (Java 7/8 Spring monoliths, Python 2 Django, PHP 5.6 backends) into modern cloud-native services (Go, TypeScript/Node, FastAPI) using AI code migration engines.

While AI generates ~95% of refactored code accurately, **the remaining 5% of hidden edge cases make production deployment an unacceptable risk**:

- **Subtle Serialization Discrepancies**: Jackson omitting empty lists vs Go serializing `null`, datetime timezone truncations, float precision drift.
- **Implicit Framework Quirks**: Legacy servlet filter quirks, undocumented fallback headers, HTTP 200 responses with embedded error payloads.
- **Database State Regressions**: Silent differences in database transaction boundaries, missing audit writes, or N+1 query loop explosions.

---

## πŸ’‘ The Solution: ShadowDiff

**ShadowDiff** is a high-performance network proxy and analysis engine that duplicates real staging or production HTTP traffic, sending identical payloads to both the legacy service and the AI-refactored service simultaneously.

```
                           [ Live Inbound Traffic ]
                                      β”‚
                                      β–Ό
                       β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
                       β”‚    Envoy Gateway / Mesh     β”‚
                       β”‚  (request_mirror_policies)  β”‚
                       β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
                                      β”‚
                  β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”΄β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
                  β–Ό                                       β–Ό
        β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”                   β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
        β”‚  Legacy Service   β”‚                   β”‚  ShadowDiff Core  β”‚
        β”‚     (Target)      β”‚                   β”‚  (Analysis Engine)β”‚
        β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜                   β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
                  β”‚                                       β”‚
                  β”‚ (Live Response to Client)             β–Ό
                  β”‚                             β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
                  β”‚                             β”‚   AI-Refactored   β”‚
                  β”‚                             β”‚   Candidate (S)   β”‚
                  β”‚                             β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
                  β”‚                                       β”‚
                  β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
                                      β–Ό
                       β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
                       β”‚ 3-Way Diff & SQL Comparator β”‚
                       β”‚ - P1 βŠ• P2 Noise Filter      β”‚
                       β”‚ - SQL Mutation Interceptor  β”‚
                       β”‚ - N+1 Query Loop Detector   β”‚
                       β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
                                      β”‚
                         (Pure Regressions Isolated)
                                      β–Ό
                       β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
                       β”‚ Automated AI Test Generator β”‚
                       β”‚ - Powered by Google Gemini  β”‚
                       β”‚ - Synthesizes Go/Jest Tests β”‚
                       β”‚ - Root Cause Code Fixes     β”‚
                       β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
```

---

## πŸš€ Key Architectural Capabilities

### 1. ⚑ Network-Level Envoy Traffic Mirroring

ShadowDiff integrates directly with **Envoy Proxy** and **Istio Service Mesh** using `request_mirror_policies`. Traffic is cloned asynchronously at line rate in the network layer with **zero application latency penalty**.

### 2. 🎯 3-Way Differential Noise Cancellation (Diffy Model)

Automatically filters out non-deterministic runtime noise (timestamps, UUIDs, session nonces) by evaluating twin baseline instances:
$$\mathcal{N} = P\_1 \oplus P\_2$$
$$\mathcal{D} = (P\_1 \oplus S) \setminus \mathcal{N}$$
Only verified contract regressions reach developer triage.

### 3. πŸ’Ύ Database Mutation & SQL Side-Effect Diffing

Captures and correlates SQL statements executed by both services for each HTTP trace:

- **Missing Writes**: Flags when legacy wrote to `audit_logs` or ledger tables that modern code omitted.
- **Transaction Leaks**: Warns if legacy used `BEGIN...COMMIT` and modern ran autocommit statements.
- **N+1 Query Explosions**: Detects when modern ORMs loop and execute $\ge 3\times$ more queries than legacy.

### 4. πŸ€– Google Gemini Regression Test Synthesis

Every isolated edge case is analyzed by **Google Gemini** (`gemini-2.0-flash`), which writes a turnkey integration test (Go `httptest` or Vitest) and diagnoses the code fix.

### 5. πŸ™ Autonomous Closed-Loop GitHub PR Bot

Eliminates manual triaging by directly integrating with the GitHub API:

- **Automatic Branching**: Spins up `shadowdiff/fix-<trace_id>` from the repository's default branch.
- **Test File Commitment**: Automatically commits the synthesized regression test directly to the repository (e.g. `tests/regression/test_drift_<trace_id>.go`).
- **Rich Pull Request Generation**: Opens a detailed PR with side-by-side JSON diff tables, SQL mutation waterfall analysis, N+1 query warnings, and local verification commands.
- **1-Click Triage in Console**: Developers can inspect the incident in the web console and click **"πŸš€ Open GitHub PR"** to immediately open the PR on GitHub.

### 6. 🚦 CI/CD "Shadow Gating" CLI (`shadowdiff gate`)

A native deployment blocker that evaluates traffic quality during pre-release soak tests or integration pipelines:

- **Automated Evaluation**: Assesses semantic parity, database mutations, and N+1 query loops over a specified evaluation window.
- **Zero False Failure**: Honors Diffy noise cancellation ($\mathcal{N} = P\_1 \oplus P\_2$), only failing on genuine regressions.
- **Pipeline Integration**: Returns standard exit codes (`0` for PASS, `1` for FAIL/violation, `2` for error) with high-impact ANSI colored terminal summaries and optional JSON format.

```
# Evaluate quality gate in your CI/CD pipeline:
shadowdiff gate \
  -dashboard-url=http://localhost:8083 \
  -duration=15s \
  -min-parity=100.0 \
  -min-requests=50 \
  -max-drifts=0 \
  -allow-n-plus-one=false \
  -allow-db-drift=false
```

### 7. πŸ›‘οΈ Ephemeral Copy-on-Write (CoW) Database Sandboxing

Allows safe shadow mirroring of mutating HTTP methods (`POST`, `PUT`, `DELETE`, `PATCH`) with **zero database pollution**:

- **Transactional Savepoint Rollbacks**: Injects boundary headers to ensure shadow writes execute within an isolated savepoint and automatically roll back.
- **Ephemeral Schema Sandboxing**: Dynamically creates disposable schemas per test run and drops them upon completion.
- **Serverless CoW Branching**: Leverages Neon / Supabase serverless branching to clone database state instantly via API for mutating candidate runs.

---

## 🚦 GitHub Actions CI/CD Quality Gating Workflow

Incorporate ShadowDiff directly into your automated deployment pipeline (`.github/workflows/shadowdiff.yml`):

```
name: Dual-Traffic Shadow Gating
on: [pull_request, push]

jobs:
  shadow-gate:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4
      - uses: actions/setup-go@v5
        with:
          go-version: '1.22'

      - name: Build & Start Services
        run: |
          go build -o bin/shadowdiff ./cmd/shadowdiff/main.go
          ./bin/legacy-service -port=:8081 &
          ./bin/refactored-service -port=:8082 &
          ./bin/shadowdiff -proxy-port=:8080 -primary-url=http://localhost:8081 -shadow-url=http://localhost:8082 -sandbox-mode=rollback &
          sleep 2

      - name: Replay Traffic
        run: |
          for i in {1..25}; do
            curl -s "http://localhost:8080/api/users?id=$i" > /dev/null
            curl -s -X POST "http://localhost:8080/api/orders" -d '{"amount":99.50}' > /dev/null
          done

      - name: Run ShadowDiff Quality Gate
        run: |
          ./bin/shadowdiff gate \
            -dashboard-url=http://localhost:8083 \
            -min-parity=100.0 \
            -min-requests=20 \
            -allow-n-plus-one=false \
            -allow-db-drift=false
```

---

## πŸ› οΈ Quickstart with Envoy & Docker Compose

Launch the complete 5-container service mesh testbed (Envoy Gateway + ShadowDiff + Legacy Target + Twin Replica + AI Candidate):

```
# 1. Clone the repository
git clone https://github.com/vishalrajofficial/ShadowDiff.git
cd ShadowDiff

# 2. Launch the Envoy Service Mesh topology
docker compose -f docker-compose.envoy.yml up -d
```

### Send Ingress Traffic Through Envoy (Port 10000):

```
# Send test traffic to the Envoy Gateway (mirrored to ShadowDiff automatically):
curl http://localhost:10000/api/users/1
curl -X POST http://localhost:10000/api/orders
```

Open the telemetry dashboard at **`http://localhost:8083`** to inspect the live 3-way diffs, SQL mutation timeline, and Gemini-generated tests!

---

## ☸️ Kubernetes & Istio Service Mesh Deployment

For production Kubernetes clusters running Istio or native Envoy, deploy the included `EnvoyFilter` to mirror traffic dynamically:

```
kubectl apply -f deploy/k8s/envoy-shadow-sidecar.yaml
```

See [docs/ARCHITECTURE.md](https://github.com/vishalrajofficial/ShadowDiff/blob/main/docs/ARCHITECTURE.md) for full architectural specifications.

---

## πŸ“„ License

This project is licensed under the [MIT License](https://github.com/vishalrajofficial/ShadowDiff/blob/main/LICENSE).
vishalraj110
🟧 echo.github ⭐The Hacker News post links directly to the repository, which presents ShadowDiff as β€œDual-Traffic Shadow Testing Engine for AI-Refactored Levishalraj1 (GitHub account vishalrajofficial)β€”β€”

Interpretation history

Decision trace