ea31ed657c
Phase 1 of PLAN_REFACTOR.md — all four sub-tasks implemented:
1.1 PipelineLogger (backend/app/core/pipeline_logger.py)
- Structured step_start/step_done/step_error/step_progress API
- Publishes to Python logging AND Redis SSE via log_task_event
- Context manager `pl.step("name")` for auto-timing
1.2 RenderJobDocument (backend/app/domains/rendering/job_document.py)
- Pydantic JSONB schema: state machine + per-step records + timing
- begin_step/finish_step/fail_step/skip_step helpers
- Migration 048: adds render_job_doc JSONB column to order_lines
- OrderLine model updated with render_job_doc field
1.3 TenantContextMiddleware (backend/app/core/middleware.py)
- Decodes JWT, stores tenant_id + role in request.state
- get_db updated to auto-apply RLS SET LOCAL from request.state
- Registered in main.py (runs before every request)
- JWT now embeds tenant_id claim via create_access_token()
- Login endpoint passes tenant_id to token creation
1.4 ProcessStep Registry (backend/app/core/process_steps.py)
- StepName StrEnum with all 20 pipeline step names
- Single source of truth for log prefixes, DB records, UI labels
Also adds db_utils.py with set_tenant_sync() + get_sync_session()
for use inside Celery tasks (bypass-safe RLS helper).
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
40 lines
2.0 KiB
Python
40 lines
2.0 KiB
Python
"""Named pipeline step identifiers.
|
|
|
|
All Celery tasks and render scripts reference these constants so that log
|
|
messages, DB records, and UI labels stay consistent across the codebase.
|
|
"""
|
|
from enum import StrEnum
|
|
|
|
|
|
class StepName(StrEnum):
|
|
# ── STEP file processing ──────────────────────────────────────────
|
|
RESOLVE_STEP_PATH = "resolve_step_path"
|
|
OCC_OBJECT_EXTRACT = "occ_object_extract"
|
|
OCC_GLB_EXPORT = "occ_glb_export"
|
|
GLB_BBOX = "glb_bbox"
|
|
MATERIAL_MAP_RESOLVE = "material_map_resolve"
|
|
AUTO_POPULATE_MATERIALS = "auto_populate_materials"
|
|
|
|
# ── Thumbnail generation ─────────────────────────────────────────
|
|
BLENDER_RENDER = "blender_render"
|
|
THREEJS_RENDER = "threejs_render"
|
|
THUMBNAIL_SAVE = "thumbnail_save"
|
|
|
|
# ── Order line render ─────────────────────────────────────────────
|
|
ORDER_LINE_SETUP = "order_line_setup"
|
|
RESOLVE_TEMPLATE = "resolve_template"
|
|
BLENDER_STILL = "blender_still"
|
|
BLENDER_TURNTABLE = "blender_turntable"
|
|
OUTPUT_SAVE = "output_save"
|
|
|
|
# ── GLB / asset export ────────────────────────────────────────────
|
|
EXPORT_GLB_GEOMETRY = "export_glb_geometry"
|
|
EXPORT_GLB_PRODUCTION = "export_glb_production"
|
|
EXPORT_BLEND = "export_blend"
|
|
|
|
# ── STL cache ────────────────────────────────────────────────────
|
|
STL_CACHE_GENERATE = "stl_cache_generate"
|
|
|
|
# ── Notifications ─────────────────────────────────────────────────
|
|
NOTIFY = "notify"
|