# task-2055: InsuRo pipeline_runs Supabase 테이블 생성

## 문제
PL-1~7에서 구현한 파이프라인 상태 관리가 인메모리(_pipeline_runs dict)로 동작 중.
Supabase에 `pipeline_runs` 테이블이 없어서 서버 재시작 시 파이프라인 상태 유실.

## ★ 프로젝트: `/home/jay/projects/InsuRo/`

## 작업 내용

### 1. Supabase migration SQL 작성
`supabase/migrations/` 폴더에 migration 파일 생성:
```sql
CREATE TABLE IF NOT EXISTS pipeline_runs (
  id UUID PRIMARY KEY DEFAULT gen_random_uuid(),
  user_id UUID REFERENCES auth.users(id),
  job_id TEXT UNIQUE NOT NULL,
  status TEXT NOT NULL DEFAULT 'pending',
  stages JSONB DEFAULT '[]'::jsonb,
  result JSONB,
  schema_version TEXT DEFAULT '1.0',
  created_at TIMESTAMPTZ DEFAULT now(),
  updated_at TIMESTAMPTZ DEFAULT now(),
  error_message TEXT
);

-- RLS 정책
ALTER TABLE pipeline_runs ENABLE ROW LEVEL SECURITY;
CREATE POLICY "Users can view own pipeline runs" ON pipeline_runs
  FOR SELECT USING (auth.uid() = user_id);
CREATE POLICY "Service role full access" ON pipeline_runs
  FOR ALL USING (true);

-- 인덱스
CREATE INDEX idx_pipeline_runs_user_id ON pipeline_runs(user_id);
CREATE INDEX idx_pipeline_runs_job_id ON pipeline_runs(job_id);
CREATE INDEX idx_pipeline_runs_status ON pipeline_runs(status);
```

### 2. Supabase CLI로 migration 적용
```bash
cd /home/jay/projects/InsuRo
npx supabase db push
```
또는 Supabase 대시보드 SQL Editor에서 직접 실행.

### 3. server/pipeline.py에서 인메모리 → Supabase 전환 (선택)
- 현재 `_pipeline_runs = {}` 인메모리 사용
- Supabase 테이블이 생기면 `sb.table("pipeline_runs")` 으로 전환 가능
- 단, 인메모리 fallback은 유지 (Supabase 연결 실패 시 대비)

## 완료 시그니처
- [grep] `pipeline_runs` @ `supabase/migrations/` (migration 파일 존재)
- Supabase 대시보드에서 pipeline_runs 테이블 확인 가능

## 검증 시나리오
1. `supabase/migrations/` 에 pipeline_runs migration 파일 존재
2. Supabase에서 `SELECT * FROM pipeline_runs LIMIT 1` 에러 없이 실행
3. `npm run build` → 빌드 성공
4. 기존 pytest PASS

## 레벨
- normal

## 프로젝트
- insuro