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
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
| source | object | author | score | comments |
| π§ hn | Show HN: ShadowDiff β Shadow testing and SQL diffing for AI-migrated back endsRetrieved article excerptOpen 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). | vishalraj1 | 1 | 0 |
| π§ echo.github β | The 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) | β | β |
Interpretation history
2026-11-15T07:21:29Z
audience grounding: medium β 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.
Decision trace
- 11-15 18:22attention_candidatecreate
- 11-15 18:21promote_anchororigin walk conf 0.9
- 11-15 18:21groundIf 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-effec
- 11-15 18:21createThe repository describes a concrete tool and its intended capabilities, but the supplied evidence is a lightly engaged Show HN post and does not establish independent use or effectiveness.