---
name: Railway Internal Networking Validation
status: closed
created: 2025-10-20T15:30:53Z
updated: 2025-10-20T20:58:45Z
github: https://github.com/BuzzTrail/video-extension/issues/155
depends_on: []
parallel: false
conflicts_with: []
---

# Task: Railway Internal Networking Validation

## Description

Validate that Railway's internal networking (`service.railway.internal`) works reliably for service-to-service HTTP communication. This is a **critical blocker** for the bot-spawner extraction - if internal networking fails, we need to pivot to public URLs with authentication.

Deploy two minimal test services and verify:
1. DNS resolution works (`.railway.internal` names resolve)
2. HTTP requests complete successfully
3. Latency is acceptable (<50ms)
4. Connection is reliable over multiple requests

**This is Phase 0 validation - must pass before building bot-spawner.**

## Acceptance Criteria

- [ ] Two test services deployed to Railway (e.g., `test-service-a`, `test-service-b`)
- [ ] Service A can HTTP GET `http://test-service-b.railway.internal/health`
- [ ] DNS resolution works consistently (10/10 successful lookups)
- [ ] HTTP requests complete with 200 OK status
- [ ] Average latency measured and documented (<50ms target)
- [ ] Test script runs 100 consecutive requests with >95% success rate
- [ ] Documented findings in `.claude/epics/bot-spawner-extraction/phase0-networking-results.md`

## Technical Details

### Implementation Approach

**Service A (Client):**
```typescript
// Minimal Express app
app.get('/test-call', async (req, res) => {
  const start = Date.now();
  const response = await fetch('http://test-service-b.railway.internal:3001/health');
  const latency = Date.now() - start;
  res.json({ status: response.status, latency });
});
```

**Service B (Server):**
```typescript
// Minimal Express app
app.get('/health', (req, res) => {
  res.json({ status: 'healthy', timestamp: new Date().toISOString() });
});
```

**Test Script:**
```bash
# Run 100 requests, measure success rate and latency
for i in {1..100}; do
  curl -s https://test-service-a.railway.app/test-call >> results.json
done
```

### Key Considerations

- Use Railway's internal networking docs: https://docs.railway.com/guides/private-networking
- Services must be in same Railway project for internal networking
- Port must be explicitly exposed (e.g., 3001 for bot-spawner)
- If internal networking fails, document fallback plan (public URLs + API key)

### Files Affected

**New files:**
- `.claude/epics/bot-spawner-extraction/test-services/` (temporary test code)
- `.claude/epics/bot-spawner-extraction/phase0-networking-results.md` (findings)

## Dependencies

**External:**
- [ ] Railway platform supports internal networking
- [ ] Railway project exists or can be created

**Blockers:**
- This task is a blocker for Tasks 003 and 004 (bot-spawner creation)
- If this fails, architecture must change to use public URLs

## Effort Estimate

- **Size:** S (Small)
- **Hours:** 2-4 hours
  - Setup test services: 1 hour
  - Deploy and configure: 0.5 hours
  - Run tests and measure: 1 hour
  - Document findings: 0.5 hours
- **Parallel:** false (blocks other tasks)

## Definition of Done

- [ ] Test services deployed to Railway
- [ ] 100 HTTP requests completed with >95% success
- [ ] Average latency <50ms (or documented if higher)
- [ ] Findings documented with recommendation (proceed or pivot)
- [ ] Test services can be cleaned up after validation
- [ ] GO/NO-GO decision made for bot-spawner extraction

**Success Criteria:** If networking works reliably, proceed with Tasks 003-004. If fails, document alternative architecture.
