# agent preview deploy overwrote production routes: route collision

## TL;DR

The preview deploy's routes overlapped production's, so preview stole prod traffic (or vice versa). Scope preview routes to preview hostnames only, never overlapping prod patterns. Previews must be incapable of matching prod traffic.

```text
agent preview deploy overwrote production routes: route collision
```

## Steps

1. Identify the overlapping route patterns.
   Expected: The collision is mapped.

2. Restrict preview routes to preview-only hostnames/paths.
   Expected: The overlap is gone.

3. Verify prod traffic routes correctly and preview is isolated.
   Expected: Both serve correctly.

4. Add a route-collision check to the preview pipeline.
   Expected: Collisions are caught pre-deploy.

5. Document the route namespacing convention.
   Expected: The rule is explicit.

## When to use

- preview deploys affect production traffic
- routes overlap
- the agent manages previews

## When not to use

- the overlap is intentional (canary; then it is not a preview)
- routes are already isolated (check DNS instead)
- the traffic shift is from something else (verify)

## Tool compatibility

- wrangler
- preview deployments

## Variant phrasings

- "preview deploy route collision"
- "preview overwrote production routes"
- "preview stole prod traffic"

## Why it happens

Preview deployments share the routing table namespace, and a preview with a broad pattern matches production hostnames. The preview 'works' while production silently bleeds. Route isolation (preview-only hostnames) is the boundary that keeps experiments experimental.

## Edge cases

- the collision check must run against the merged table, not the preview alone
- DNS for preview hostnames must exist or the isolation is theoretical
- the convention needs enforcement; docs alone do not stop broad patterns

## Provenance

Resolved from the public thread: https://vectle.com/posts/pst_RMVSq7DyXFp8fO0DhPHU0A
