feat(phase4+5): role hierarchy, tenant config, fallback material, dead code removal
Phase 4.1 — Role Hierarchy:
- UserRole enum: add global_admin (platform operator) + tenant_admin
(per-tenant admin); keep legacy 'admin' for backward compat
- Role sets: ADMIN_ROLES, TENANT_ADMIN_ROLES, PM_ROLES, RLS_BYPASS_ROLES
- New auth guards: require_global_admin(), require_tenant_admin_or_above(),
require_pm_or_above(), is_admin(), is_privileged()
- Legacy require_admin / require_admin_or_pm now check both old+new roles
- Migration 049: ADD VALUE global_admin + tenant_admin with AUTOCOMMIT
workaround; backfills admin → global_admin
- Seed: new admin users created with global_admin role
Phase 4.3 — RLS bypass updated for global_admin in get_db + set_tenant_context
Phase 4.4 — Tenant Feature Flags:
- Migration 050: tenant_config JSONB on tenants table
- Tenant model: tenant_config field + get_config() accessor
- Defaults: max_concurrent_renders=3, fallback_material, invoice_prefix etc.
Phase 5.1 — Fallback Material:
- blender_render.py: replace PALETTE_LINEAR/PALETTE_HEX/_assign_palette_material
with _assign_failed_material() → SCHAEFFLER_059999_FailedMaterial (magenta)
- Unmatched parts now logged explicitly before rendering
Phase 5.2 — Remove EEVEE fallback:
- render_blender.py: EEVEE→Cycles silent retry removed; hard failure on EEVEE error
Phase 5.3 — Remove Blender version check:
- render_blender.py: deleted MIN_BLENDER_VERSION = (5, 0, 1) constant
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -14,8 +14,6 @@ from pathlib import Path
|
||||
|
||||
logger = logging.getLogger(__name__)
|
||||
|
||||
MIN_BLENDER_VERSION = (5, 0, 1)
|
||||
|
||||
|
||||
def _glb_from_step(step_path: Path, glb_path: Path, quality: str = "low") -> None:
|
||||
"""Convert STEP → GLB via OCC (export_step_to_gltf.py, no Blender needed).
|
||||
@@ -226,12 +224,8 @@ def render_still(
|
||||
|
||||
log_lines = [l for l in stdout_lines if "[blender_render]" in l]
|
||||
|
||||
# EEVEE fallback to Cycles on non-signal error
|
||||
if returncode > 0 and engine == "eevee":
|
||||
logger.warning("EEVEE failed (exit %d) — retrying with Cycles", returncode)
|
||||
returncode, stdout_lines2, stderr_lines2 = _run("cycles")
|
||||
engine_used = "cycles (eevee fallback)"
|
||||
log_lines.extend(l for l in stdout_lines2 if "[blender_render]" in l)
|
||||
# EEVEE fallback removed (Phase 5.2): EEVEE Next in Blender 5.0+ is stable.
|
||||
# If EEVEE fails, it is a hard failure — no silent retry.
|
||||
|
||||
if returncode != 0:
|
||||
stdout_tail = "\n".join(stdout_lines[-50:]) if stdout_lines else ""
|
||||
|
||||
Reference in New Issue
Block a user