chrysopedia/backend/pipeline/quality
jlightner f0d0b8ac1a feat: add pipeline iteration tooling — offline test harness, stage re-runs, chunking inspector
Drops prompt iteration cycles from 20-30 min to under 5 min by enabling
stage-isolated re-runs and offline prompt testing against exported fixtures.

Phase 1: Offline prompt test harness
- export_fixture.py: export stage 5 inputs from DB to reusable JSON fixtures
- test_harness.py: run synthesis offline with any prompt, no Docker needed
- promote subcommand: deploy winning prompts with backup and optional git commit

Phase 2: Classification data persistence
- Dual-write classification to PostgreSQL + Redis (fixes 24hr TTL data loss)
- Clean retrigger now clears Redis cache keys (fixes stale data bug)
- Alembic migration 011: classification_data JSONB column + stage_rerun enum

Phase 3: Stage-isolated re-run
- run_single_stage Celery task with prerequisite validation and prompt overrides
- _load_prompt supports per-video Redis overrides for testing custom prompts
- POST /admin/pipeline/rerun-stage/{video_id}/{stage_name} endpoint
- Frontend: Re-run Stage modal with stage selector and prompt override textarea

Phase 4: Chunking inspector
- GET /admin/pipeline/chunking/{video_id} returns topic boundaries,
  classifications, and synthesis group breakdowns
- Frontend: collapsible Chunking Inspector panel per video

Phase 5: Prompt deployment & stale data cleanup
- GET /admin/pipeline/stale-pages detects pages from older prompts
- POST /admin/pipeline/bulk-resynthesize re-runs a stage on all completed videos
- Frontend: stale pages indicator badge with one-click bulk re-synth

Phase 6: Automated iteration foundation
- Quality CLI --video-id flag auto-exports fixture from DB
- POST /admin/pipeline/optimize-prompt/{stage} dispatches optimization as Celery task

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-02 15:47:46 +00:00
..
fixtures feat: Generalized OptimizationLoop to stages 2-5 with per-stage fixture… 2026-04-01 09:24:42 +00:00
results optimize: Stage 5 synthesis prompt — round 0 winner (0.95→1.0 composite) 2026-04-01 10:15:24 +00:00
__init__.py feat: Created PromptVariantGenerator (LLM-powered prompt mutation) and… 2026-04-01 09:08:01 +00:00
__main__.py feat: add pipeline iteration tooling — offline test harness, stage re-runs, chunking inspector 2026-04-02 15:47:46 +00:00
fitness.py test: Built pipeline.quality package with FitnessRunner (9 tests, 4 cat… 2026-04-01 08:45:05 +00:00
optimizer.py optimize: Stage 5 synthesis prompt — round 0 winner (0.95→1.0 composite) 2026-04-01 10:15:24 +00:00
scorer.py feat: Generalized OptimizationLoop to stages 2-5 with per-stage fixture… 2026-04-01 09:24:42 +00:00
variant_generator.py feat: Added STAGE_CONFIGS registry (stages 2-5) with per-stage rubrics,… 2026-04-01 09:20:24 +00:00
voice_dial.py feat: Added VoiceDial class with 3-band prompt modification and ScoreRu… 2026-04-01 08:57:07 +00:00