100 Commits
Author SHA1 Message Date
HartmutandClaude Sonnet 4.6 271ce510c1 fix: allow external hostname in vite dev server
Add capakraken.hartmut-noerenberg.com to server.allowedHosts so Vite
does not block requests coming through the reverse proxy.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-09-08 15:43:56 +02:00
HartmutandClaude Sonnet 4.6 ed61fd0328 docs: shadow render parity test + learning erfasst
Add integration test utility for pixel-diff comparison of legacy vs
shadow renders (PIL + NumPy, thresholds 0.5% / max_diff=3). Documents
that 3 older shadow runs show visual differences due to template config
changes between shadow execution and legacy re-render — not a code bug.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-07-22 22:35:59 +02:00
HartmutandClaude Sonnet 4.6 34ed511d9d fix: remove stale cinematic legacy-only guard in dispatch_service
The guard forced all cinematic output types to legacy dispatch because
BLENDER_CINEMATIC did not exist in the workflow graph. M1 added that node,
so the guard is now stale — it was preventing cinematic output types from
ever using graph mode even after an admin sets workflow_rollout_mode=graph.

The normal gate path handles it correctly: workflow_rollout_mode=legacy_only
keeps it on legacy, and find_unsupported_graph_nodes preflight catches any
workflow that doesn't actually contain a BLENDER_CINEMATIC node.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-07-22 16:33:40 +02:00
HartmutandClaude Sonnet 4.6 23605783bd feat: multi-GPU queue routing for legacy still renders (M2)
dispatch_order_line_render now routes still renders (non-animation,
non-cinematic) to a secondary GPU queue when MULTI_GPU_LIGHT_RENDER_QUEUE
is configured and that queue has active Celery workers.

- config.py: multi_gpu_light_render_queue setting (default "" = disabled)
- render_order_line.py: implement the routing stub — load output_type via
  selectinload, check render_settings.animation + .cinematic flags, call
  _inspect_active_worker_queues (reused from workflow_graph_runtime) with
  0.5s timeout to check if the light queue is live

No behaviour change when MULTI_GPU_LIGHT_RENDER_QUEUE is not set.
Enable by setting it to "asset_pipeline_light" and adding a
render-worker-light service with concurrency=1 to docker-compose.

docs: learnings erfasst — multi-GPU queue routing M2

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-07-22 15:12:07 +02:00
HartmutandClaude Sonnet 4.6 3401b06b19 feat: BLENDER_CINEMATIC workflow graph node (M1)
Add StepName.BLENDER_CINEMATIC and full graph runtime support so cinematic
output types can be promoted from legacy_only to graph/shadow rollout mode.

- process_steps.py: add BLENDER_CINEMATIC = "blender_cinematic" enum value
- workflow_executor.py: map to render_cinematic_task in STEP_TASK_MAP
- workflow_node_registry.py: node definition with render/scene/camera fields
  (no animation params — cinematic is fixed at 250 frames @ 25fps)
- workflow_graph_runtime.py: _ORDER_LINE_RENDER_STEPS, _CINEMATIC_TASK_KEYS,
  shadow queue routing, predict_render_output_artifact (mp4),
  _build_task_kwargs, _artifact_kind_override_for_step
- tasks.py: _normalize_cinematic_params + render_cinematic_task Celery task
  (calls render_cinematic_to_file, publishes as turntable asset type since mp4)

No DB migration needed: admins can now manually set cinematic output types
to graph rollout mode via the admin panel and assign a workflow definition.

docs: learnings erfasst — BLENDER_CINEMATIC workflow graph node M1

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-07-22 15:09:47 +02:00
HartmutandClaude Sonnet 4.6 10a8bbd977 fix: low audit items — email channel, debug cleanup, roadmap sync, bare except logging
L18: remove comingSoon from email notification channel (SMTP backend already exists).
L19: remove console.debug useEffect from InlineCadViewer.tsx.
L20: sync ROADMAP.md priority status sections (P1/P2/P3/P8) with status snapshot — all Done.
L22: replace 8 bare except blocks in step_processor.py with logger.debug/warning
     so geometry calculation failures are visible in logs instead of silently discarded.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-07-22 14:06:31 +02:00
HartmutandClaude Sonnet 4.6 507858cf31 fix: medium audit items — CORS config, invoice description, path helper, node failure, order prefix
M3: cors_origins setting in config.py (env CORS_ORIGINS); main.py reads from settings.
M4: add build_order_line_step_render_dir() to render_paths.py; tasks.py drops placeholder.mp4 trick.
M5: unknown workflow graph nodes now fail the run (status="failed" + logger.error) instead of silently skipping.
M6: invoice line description is now "{product} — {output_type}" instead of bare UUID; eager-loads relations.
M7: order_number_prefix setting in config.py (env ORDER_NUMBER_PREFIX, default "SA").

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-07-22 13:57:04 +02:00
HartmutandClaude Sonnet 4.6 3c2d0816e5 fix: JWT secret startup guard and order number advisory lock
H1: model_validator in Settings raises ValueError when jwt_secret_key is
    "changeme" and the process is running inside a container — fast-fail
    prevents insecure deployments; local dev outside Docker is unaffected.

H7: generate_order_number now acquires pg_advisory_xact_lock before SELECT MAX,
    matching the same pattern used in generate_invoice_number (billing/service.py).
    Concurrent order creation can no longer race to produce duplicate numbers.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-07-22 13:45:39 +02:00
HartmutandClaude Sonnet 4.6 df304dc021 fix: configurable internal API URL and upload size enforcement
H4: add internal_api_base_url setting to config.py (default http://localhost:8888,
    env-overridable via INTERNAL_API_BASE_URL); replace all 5 hardcoded base_url
    strings in chat_service.py.

H6: add post-read size check in both Excel and STEP upload handlers;
    raises HTTP 413 when content exceeds settings.max_upload_size_mb.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-07-22 13:43:04 +02:00
HartmutandClaude Sonnet 4.6 b69190dd86 fix: billing tenant isolation, invoice status validation, SMTP password masking
H2: list_invoices now passes tenant_id (from current_user) to get_invoices;
    get_invoices applies WHERE tenant_id filter for non-global-admin users;
    get_invoice_endpoint returns 404 when tenant mismatch for non-admins.

H3: InvoiceStatusUpdate.status changed to Literal["draft","sent","paid","cancelled"]
    for schema-level validation; guard also added in update_invoice_status service.

H5: _settings_to_out masks smtp_password as "***" when set, "" when empty;
    update_settings skips writing when value is the "***" sentinel.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-07-22 13:40:59 +02:00
HartmutandClaude Sonnet 4.6 a11d2fb1e7 refactor: extract turntable branch and exhausted-retry handler from render_order_line_task
_render_turntable: Option B — resolved objects as params (render_invocation, step_path,
output_path, template, emit, pl). Session and PipelineLogger stay in the caller so
no second DB connection is opened and log steps roll up to the main task.

_handle_render_task_exhausted: extracted 68-line mark-as-failed block; retry/raise
logic with Celery self.retry stays in render_order_line_task since it needs the
bound-task context.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-07-22 13:11:27 +02:00
Hartmut 1c4ca6998f docs: learnings erfasst — workflow Phase 5/6 fixes 2026-07-22 11:39:12 +02:00
HartmutandClaude Sonnet 4.6 e8b4580608 fix: workflow editor Phase 5/6 sign-off — save guard, conflict detection, dispatch pre-check
- Save button disabled for non-admins (canSave prop threaded through
  WorkflowEditor → WorkflowCanvas → WorkflowCanvasToolbar); tooltip
  explains why when hovered
- Optimistic concurrency: migration 072 adds updated_at to
  workflow_definitions; PUT /workflows/:id returns 409 when client sends
  a stale updated_at; frontend shows a specific reload-prompt toast
- _legacy_dispatch now routes through dispatch_order_line_render instead
  of calling render_order_line_task directly, so cancelled/rejected
  order lines are skipped before queueing

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-07-22 11:39:02 +02:00
HartmutandClaude Sonnet 4.6 53b19f2ba1 fix: workflow blueprints freely editable after creation (preserve_user_graph)
canonicalize_workflow_config was silently rebuilding any workflow with
ui.blueprint or ui.preset == still_graph from the canonical template on
every save, preflight, and read — making blueprint-based workflows
effectively read-only.

Add preserve_user_graph=True flag that skips the rebuild blocks. Only
create_workflow still uses preserve_user_graph=False so blueprints are
correctly expanded at creation time.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-07-22 11:17:32 +02:00
Hartmut 4ea6c4ee9c docs: learnings erfasst — editierbares branding, public settings endpoint 2026-07-22 11:10:22 +02:00
HartmutandClaude Sonnet 4.6 4946cc300a feat: editable branding — app name and subtitle configurable in Admin Settings
Adds app_name and app_subtitle as system settings with a dedicated
Branding tab in the Admin panel. Both values are served via a public
GET /api/admin/branding endpoint (no auth) so the login page can also
show the configured name before the user signs in.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-07-22 11:02:38 +02:00
HartmutandClaude Sonnet 4.6 c262b31bc5 chore: cleanup #6 #8 #9 — delete debug dir, rename glbUrl prop, sync docs
- delete renderproblems_tmp/ (7 debug images + USD test files, orphaned)
- rename ThreeDViewer prop geometryGltfUrl → glbUrl; update CadPreview.tsx
  caller (productionGltfUrl distinction was never needed, only one GLB type)
- plan.md: mark all 4 cinematic tasks [x] (all implemented + seeded in 070)
- 0001-step-to-usd: mark Phase 4 ThreeDViewer acceptance gates [x] (P4 done)

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-07-22 10:22:08 +02:00
HartmutandClaude Sonnet 4.6 c87857f836 feat: turntable + blend export smoke test coverage
- build_graph_turntable_config: accept render_params kwarg so smoke can
  use low settings (512x512, 24 frames) without touching golden case defaults
- add smoke naming + template functions for turntable and blend
- add ensure_workflow_turntable_smoke_resources() — provisions output type
  (mp4/turntable_video) + workflow graph, binds to
  Blender_Studio_Schadowcatcher_Anim template
- add ensure_workflow_blend_smoke_resources() — provisions output type
  (blend/blend_asset) + workflow graph, binds to BlenderStudio template
- add test_workflow_turntable_smoke() — preflight + dispatch + run tracking
- add test_workflow_blend_smoke() — preflight + dispatch + blend node check
- 6 new harness unit tests (17 total, all passing), using real asset:
  cad_file_id 8dd73335 (81113-l_cut.stp, has USD master + GLB)

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-07-22 10:17:47 +02:00
HartmutandClaude Sonnet 4.6 44b52d05cc fix: cinematic output type guard + legacy_only migration
- Migration 070: seeds 'Cinematic Highlight' output type (legacy_only, no
  workflow link) for fresh installs
- Migration 071: patches existing cinematic output types — clears
  workflow_definition_id and forces legacy_only rollout mode. The row
  existed since 2026-03 with shadow mode + a linked workflow def;
  no BLENDER_CINEMATIC graph node exists so shadow execution would fail.
- API guard in output_types POST + PATCH: cinematic output types cannot
  receive a workflow_definition_id (HTTP 400)
- Defense-in-depth in dispatch_service: early legacy exit if
  render_settings.cinematic is true, regardless of rollout mode
- docs: learning erfasst — cinematic rollout mode footgun

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-07-22 10:04:07 +02:00
HartmutandClaude Sonnet 4.6 971074fedd docs: learnings erfasst — cinematic render pipeline fixes 2026-07-21
Drei Bugs aus Cinematic-Render-Session dokumentiert:
- is_cinematic immer False wegen Invocation-Override-Filter
- usd_path.exists() auf str (fehlender str→Path-Cast in turntable/cinematic)
- NameError stdout/stderr in cinematic error path

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-07-22 07:12:30 +02:00
HartmutandClaude Sonnet 4.6 7179023458 chore: extend project Claude permissions for docker, curl and hartomat MCP tools
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-07-21 22:34:21 +02:00
HartmutandClaude Sonnet 4.6 bb2b0f51b5 fix: cinematic render is_cinematic detection and usd_path str/Path handling
Three bugs causing all cinematic renders to silently fall through to the
turntable path and then immediately crash:

1. is_cinematic read from filtered invocation-override dict — 'cinematic' key
   is not in the allowed override key list for turntable_video, so it gets
   stripped. Fixed: read directly from output_type.render_settings.

2. render_turntable_to_file and render_cinematic_to_file both call
   usd_path.exists() but receive a str from the caller. Added the same
   isinstance str→Path conversion that render_still_to_file already had.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-07-21 22:32:16 +02:00
HartmutandClaude Sonnet 4.6 6459b9e62d docs: learnings erfasst - cinematic render NameError, cancel-race, legacy-only pfad
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-07-21 19:10:22 +02:00
HartmutandClaude Sonnet 4.6 d2e4934cca feat: workflow graph system — blocks 1-20 complete checkpoint
Full graph-based workflow execution engine with:
- WorkflowGraphRuntime with two-phase dispatch (collect → fire Celery tasks)
- Node registry with contract validation, socket types, execution kinds
- WorkflowRuntimeServices: preflight, context resolution, shadow-mode A/B
- WorkflowRouter: CRUD + dispatch/preflight/run-history API endpoints
- OutputTypeContracts: workflow binding, rollout-mode resolution
- Admin router: output-type workflow binding endpoints
- Frontend: complete workflow editor with drag-drop canvas, node inspector,
  module bundles, reference bundles, preflight panel, validation banner,
  authoring guidance, blueprint templates, shadow/rollout gate UI
- Tests: comprehensive coverage for all workflow modules
- Docs: NODE_CONTRACT_AUDIT and VALIDATION_ERROR_INVENTORY

All 20 blocks from NEXT_20_BLOCK_BATCH_PLAN completed.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-07-21 19:09:54 +02:00
HartmutandClaude Sonnet 4.6 c51dd8cd67 fix: guard persist_order_line_output against cancelled lines
Completed renders no longer overwrite a cancelled status — a Blender job
that finishes after a cancel is issued is now silently dropped instead of
flipping the line back to completed.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-07-21 19:09:34 +02:00
HartmutandClaude Sonnet 4.6 84f40647b0 fix: resolve NameError masking cinematic render errors and fix frame count
- `render_cinematic_to_file` referenced undefined `stdout`/`stderr` in the
  Blender error path; replaced with `log_lines`/`stderr_lines` so the real
  Blender error is actually stored in render_log instead of a Python NameError
- Progress callback hardcoded 480 frames; now uses the `frame_count` variable
- Updated docstring to reflect actual 250 frames @ 25fps (not 480 @ 24fps)

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-07-21 19:09:28 +02:00
Hartmut 715cef7971 Document block 20 workflow checkpoint 2026-04-18 13:17:07 +02:00
Hartmut 98455ee579 Close workflow smoke template drift 2026-04-18 13:16:54 +02:00
Hartmut 9f1ccec8f0 docs: optimize readme landing layout for gitea 2026-04-12 14:44:13 +02:00
Hartmut 04a08a8bdf docs: refine project presentation and refresh dark screenshots 2026-04-12 12:02:29 +02:00
Hartmut 10fcb2817b docs: add project overview with quickstart and screenshots 2026-04-12 11:56:41 +02:00
Hartmut 3e810c74a3 chore: snapshot workflow migration progress 2026-04-12 11:49:04 +02:00
Hartmut 0cd02513d5 fix: normalize host runtime service endpoints 2026-04-09 19:47:17 +02:00
Hartmut e5c8ac7592 fix: align workflow material resolution with scene manifest 2026-04-09 19:41:13 +02:00
Hartmut d685031c1a fix: stabilize shadow workflow smoke comparison 2026-04-08 22:14:33 +02:00
Hartmut 375339eb74 feat: add canonical still workflow smoke harness 2026-04-08 22:10:01 +02:00
Hartmut dde04fcaa5 feat: unify order-line render invocation paths 2026-04-08 21:57:37 +02:00
Hartmut 042f62fe55 feat: refactor workflow editor authoring surfaces 2026-04-08 21:44:08 +02:00
Hartmut fe46dabfc5 feat: add workflow rollout gate signals 2026-04-08 21:44:02 +02:00
Hartmut 8c9648d5dc feat: make output types workflow-first contracts 2026-04-08 21:43:55 +02:00
Hartmut bd18cccb5e feat: harden workflow graph contracts 2026-04-08 21:32:14 +02:00
Hartmut 22981af1d2 docs: add workflow worker orchestration 2026-04-08 21:14:34 +02:00
Hartmut 7e100ed334 feat: expose graph still workflow in editor 2026-04-08 11:16:47 +02:00
Hartmut ffcaef4659 feat: add workflow output comparison tooling 2026-04-07 11:45:28 +02:00
Hartmut f43f1e7420 feat: add duplicate-safe workflow shadow dispatch 2026-04-07 11:35:32 +02:00
Hartmut 26046fb2d6 feat: expose workflow execution modes in editor 2026-04-07 11:10:58 +02:00
Hartmut f9d4da52b9 feat: add graph workflow fallback and retry metadata 2026-04-07 10:56:45 +02:00
Hartmut c17b7d2e8f feat: execute workflow bridge nodes in graph runtime 2026-04-07 10:42:59 +02:00
Hartmut 6ad34ceed2 feat: add workflow run dispatch foundation 2026-04-07 10:11:46 +02:00
Hartmut ab1b220e79 test: close workflow phase 3 executor coverage 2026-04-07 10:00:38 +02:00
Hartmut 98b3eadcb2 feat: extract workflow notifications phase 3 2026-04-07 09:57:39 +02:00
Hartmut 160c198bb3 feat: extract workflow output save phase 3 2026-04-07 09:50:58 +02:00
Hartmut 9c93ecef49 feat: extract workflow bbox services phase 3 2026-04-07 09:42:06 +02:00
Hartmut 8f8d2e68b7 feat: extract workflow material services phase 3 2026-04-07 09:22:24 +02:00
Hartmut e3cda1c9f7 feat: extract workflow runtime phase 3 foundation 2026-04-07 09:09:40 +02:00
Hartmut 56ee5fc5bf feat: add workflow node registry phase 2 2026-04-07 08:59:27 +02:00
Hartmut 63e35ce807 feat: stabilize workflow phase 1 foundation 2026-04-07 08:48:48 +02:00
Hartmut bc9ab5f864 docs: add workflow migration plan and checkpoint current state 2026-04-07 08:38:16 +02:00
Hartmut 2a00abe91f fix: restore historical order visibility for HartOMat admins 2026-04-06 19:24:09 +02:00
Hartmut f13cb489c1 fix: migrate runtime data to native hartomat storage 2026-04-06 18:09:51 +02:00
Hartmut 8990b80abf fix: restore existing runtime data volumes 2026-04-06 18:01:15 +02:00
Hartmut 448996b546 fix: stabilize HartOMat runtime startup 2026-04-06 13:10:51 +02:00
Hartmut 6f6d6efe74 chore: add HartOMat cleanup helper 2026-04-06 13:00:14 +02:00
Hartmut fcc51b6cb3 chore: smooth local path references 2026-04-06 12:49:36 +02:00
Hartmut b795f0e6d6 refactor: rebrand project to HartOMat 2026-04-06 12:45:47 +02:00
Hartmut fa7093307a chore: snapshot before HartOMat rebrand 2026-04-06 12:41:44 +02:00
HartmutandClaude Opus 4.6 7d27ffc116 fix: remove 2.0 from Hartomatisierung
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-18 14:27:47 +01:00
HartmutandClaude Opus 4.6 30ce747b43 rebrand: Schaeffler Automat → Hart.O.Mat — Hartomatisierung 2.0
- Sidebar: Hart.O.Mat + Hartomatisierung 2.0
- Logo badge: S → H
- Mobile header: Hart.O.Mat
- Page title: Hart.O.Mat — Hartomatisierung 2.0

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-18 14:25:58 +01:00
HartmutandClaude Opus 4.6 9cb947b1cd rename: AI Assistant → HartBOT
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-16 11:13:38 +01:00
HartmutandClaude Opus 4.6 8290e16b2d fix: chat panel doesn't overlap main content, links use client-side nav
Layout: main content gets mr-96 (margin-right) when chat is open,
pushing the page content left so the chat panel sits alongside it
without overlapping. Smooth 300ms transition.

ChatPanel: internal links (/products/..., /orders/...) now use
React Router navigate() instead of target="_blank" — clicking a
product link in the chat navigates without reloading the page,
keeping the chat panel open.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-16 11:10:58 +01:00
HartmutandClaude Opus 4.6 feef2a0827 feat: AI searches product part materials — finds products WITH Durotect
Added product_material filter to find_product_renders:
- Searches cad_part_materials JSONB for materials assigned to CAD parts
- find_product_renders(transparent_only=true, product_material="Durotect")
  → finds 9 products that naturally have Durotect parts with transparent renders

Two material levels explained in system prompt rule 13:
- product_material: materials from STEP/Excel (Durotect_M, Stahl, Bronze)
- material_override: single material forced on ALL parts at render time

AI now searches product_material FIRST when user asks "with Durotect material"

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-16 10:47:01 +01:00
HartmutandClaude Opus 4.6 9c6b210d51 fix: AI agent shows best available render when exact match not found
Rule 13: when searching with multiple criteria (transparent + Durotect),
decompose the search. Show what exists (1220 transparent renders) and
explain what's missing (no Durotect material applied). Never say
"no renders found" when transparent renders DO exist.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-16 10:43:01 +01:00
HartmutandClaude Opus 4.6 54522a63d4 feat: render metadata from render_log for past renderings
find_product_renders now reads actual render metadata from the
render_log JSONB (stored at render time) via COALESCE fallback:
- engine: render_log.engine_used > render_log.engine > output_type setting
- width/height: render_log > output_type.render_settings
- samples: render_log > output_type.render_settings
- render_type: still/turntable/cinematic from render_log.type
- has_template: whether a .blend template was used

All past renderings now have correct metadata without re-processing.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-16 10:35:19 +01:00
HartmutandClaude Opus 4.6 86921bacbd feat: render metadata in find_product_renders — material, format, resolution
find_product_renders now returns full render job metadata:
- material_override (effective: line override > output type override)
- output_format (with render_overrides applied)
- resolution (width x height)
- engine, samples
- order_number + order_id (for linking)
- is_animation flag

New material_override filter: search renders by material name
(e.g. transparent_only=true, material_override="Durotect" finds
renders with Durotect material on transparent background)

AI can now answer: "Show me a transparent Durotect render" by filtering
both transparency AND material in one query.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-16 10:24:02 +01:00
HartmutandClaude Opus 4.6 59f83f10ad fix: AI agent must confirm before ANY write action including overrides
Explicitly listed all write tools that require confirmation:
create_order, dispatch_renders, set_material_override, set_render_overrides

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-16 10:14:48 +01:00
HartmutandClaude Opus 4.6 8897afdebb fix: AI agent must confirm before creating orders or dispatching renders
Split rules into read-only vs write actions:
- READ (search, list, show images, status): execute immediately
- WRITE (create orders, dispatch, set overrides): ALWAYS ask for
  confirmation before executing

Prevents accidental render job creation from casual questions.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-16 10:11:52 +01:00
HartmutandClaude Opus 4.6 20bcdee2a2 feat: AI agent links to products and orders in responses
System prompt rule 12: always format product mentions as
[ProductName](/products/UUID) and orders as [OrderNumber](/orders/UUID).

ReactMarkdown in ChatPanel already renders these as clickable links
with accent color styling, so users can navigate directly from chat.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-16 10:07:44 +01:00
HartmutandClaude Opus 4.6 ef4c8eefc9 feat: AI agent knows material library — list_materials tool with alias search
Added list_materials tool to the chat agent:
- Searches SCHAEFFLER library materials by name, description, or alias
- Returns material name + schaeffler_code + aliases
- Enables: "zeig mir ein Bild mit Durotect-Material" → agent searches
  for "durotect" → finds SCHAEFFLER_020101_Durotect-Blue → uses as
  material_override

System prompt updated with rules 10-11:
- Explains alias → library material mapping
- Always use full SCHAEFFLER name for material_override

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-16 10:05:05 +01:00
HartmutandClaude Opus 4.6 02669c395c fix: cinematic camera accounts for output aspect ratio
For 16:9 (1280x720), vertical FOV is narrower than horizontal —
products could be clipped top/bottom. Now applies an aspect ratio
correction factor to camera distance: wider formats push camera
further back proportionally.

Still render (_blender_camera.py) already handled this via
min(fov_h, fov_v); cinematic now has equivalent correction.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-16 08:15:10 +01:00
HartmutandClaude Opus 4.6 81eb1f9eae fix: cinematic camera distances — no clipping, full product always visible
Redesigned all 3 segments to keep distance > 3× bsphere_radius:
- Segment 1: 3.5× → 3.0× (establishing orbit, 50mm)
- Segment 2: 3.0× → 3.2× (low angle sweep, 50→65mm)
- Segment 3: 3.2× → 4.0× (crane up, 50→40mm)

Removed: detail closeup (was 1.5-1.8×, caused object clipping),
telephoto 85mm (caused extreme close framing), DOF (not needed at safe distance)

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-15 22:21:48 +01:00
HartmutandClaude Opus 4.6 3a815a85c5 fix: Blender 5.0 Action.fcurves API change — safe LINEAR keyframe setting
Blender 5.0 renamed Action.fcurves. Now tries fcurves first, falls
back to channels, and wraps in try/except so the render proceeds
even if LINEAR interpolation can't be set.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-15 22:05:58 +01:00
HartmutandClaude Opus 4.6 c159bff2df fix: clean frames directory before cinematic/turntable re-render
Old frame PNGs from previous render attempts persisted in the frames
directory, causing FFmpeg to stitch the wrong number of frames.
Now rmtree's the directory before creating it fresh.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-15 22:02:20 +01:00
HartmutandClaude Opus 4.6 458c6cd813 refactor: cinematic render — linear keyframes, 3 segments, 250 frames, white bg
Changes per user feedback:
- Keyframe interpolation: BEZIER → LINEAR (all fcurves set to LINEAR)
- Removed segment 4 (closeup) — now 3 segments only
- Frame count: 480 → 250 (10 seconds at 25fps)
- FPS: 24 → 25
- Easing removed — pure linear interpolation between segment params
- White background by default (World node Color = white)
- Transparent bg still available as override

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-15 21:57:42 +01:00
HartmutandClaude Opus 4.6 75ad397c09 fix: unbuffered stdout for live cinematic frame progress
Two fixes for frame progress not appearing in frontend:
1. Added flush=True to all print() calls in cinematic_render.py
2. Set PYTHONUNBUFFERED=1 in subprocess environment

Without these, Python buffers stdout inside Blender, so all frame
progress lines arrive in a batch after the process exits instead
of streaming line-by-line during rendering.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-15 21:53:26 +01:00
HartmutandClaude Opus 4.6 e0714854d2 fix: stream Blender frame output to frontend for cinematic renders
The filter only matched [cinematic_render] tag but Blender outputs its
own "Saved: frame_NNNN.png" lines per frame. Now also matches "Saved:"
lines, extracts the frame number, and formats as:
  [cinematic_render] Frame 84/480 rendered

This shows live frame progress in the LiveRenderLog on the frontend.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-15 21:42:36 +01:00
HartmutandClaude Opus 4.6 caffe7809c feat: live frame progress streaming for cinematic renders
Replaced communicate() (blocking) with selectors-based line-by-line
stdout streaming — same pattern as still render. Each frame now
streams live to the frontend:

  [cinematic_render] Frame 42/480 -- 55.3s elapsed (0.76 fps)

Pipeline: Blender stdout → log_callback → emit() → Redis →
LiveRenderLog poll (2s) → frontend display

Also added log_callback parameter to cinematic render task call.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-15 21:39:41 +01:00
HartmutandClaude Opus 4.6 e26d76154b fix: cinematic render arg order — match turntable positional layout
The service was sending (glb, frames_dir, width, height, engine, samples...)
but the script expected turntable order (glb, frames_dir, frame_count, degrees,
width, height, engine, samples...). Fixed by adding frame_count and degrees
placeholders to match the expected positional layout.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-15 21:32:34 +01:00
HartmutandClaude Opus 4.6 f22b963be9 feat: cinematic highlight render — 20s procedural camera animation
New render type: 4-segment cinematic camera animation (480 frames @ 24fps)
for professional product highlight videos.

Camera sequence:
1. Establishing (5s): slow 45° orbit + push-in, 50mm lens
2. Detail sweep (5s): low-angle close arc, 85mm telephoto, shallow DOF
3. Crane up (5s): rising 30°→60°, 35mm wide reveal, pull-back
4. Hero close (5s): push-in to beauty angle, 65mm, smooth ease-out

Technical:
- cinematic_render.py: procedural camera from bounding sphere, cubic easing,
  per-frame keyframes (location, rotation, focal length, DOF)
- render_cinematic_to_file(): service function (same pattern as turntable)
- Pipeline routing: render_settings.cinematic flag → cinematic path
- Depth of field enabled (f-stop scales with product size)
- use_persistent_data for BVH caching between frames
- Same material/template/USD pipeline as turntable

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-15 21:25:56 +01:00
HartmutandClaude Opus 4.6 c82f2a894d fix: invalidate orders list after deleting an order
The kanban board kept showing deleted orders until manual reload.
Added qc.invalidateQueries for 'orders' and qc.removeQueries for
the deleted order's detail cache on delete success.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-15 20:49:46 +01:00
HartmutandClaude Opus 4.6 6f7c001376 feat: persist chat session across page reloads
Session ID saved to localStorage (schaeffler-chat-session).
On mount, restores the last session and loads messages from DB.
"New Chat" clears the stored session.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-15 20:06:27 +01:00
HartmutandClaude Opus 4.6 0dfadbfd56 fix: make AI agent proactive — never ask for info it can look up
System prompt rewritten with explicit RULES:
- Never ask user for info you can query yourself
- "Any product" / "beliebig" → just pick one, don't ask back
- Execute immediately, no confirmation needed
- Be concise, short answers preferred

find_product_renders tool:
- No longer requires product_name or product_id
- Call with empty params → returns any recent renders
- Enables "show me any render with transparent bg"

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-15 19:56:21 +01:00
HartmutandClaude Opus 4.6 29f7103a8b feat: chat agent can find and show existing product renders
Added find_product_renders tool to the AI agent:
- Searches completed renders by product name/ID
- Returns viewable image URLs (relative paths)
- Supports transparent_only filter
- AI formats results as Markdown images/links in chat

Frontend:
- ChatPanel ReactMarkdown renders <img> and <a> tags
- Images shown inline (max 200px height, rounded, bordered)
- Links open in new tab with accent color

System prompt updated to instruct AI to use Markdown image syntax
when showing renders: ![description](/renders/...)

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-15 19:52:45 +01:00
HartmutandClaude Opus 4.6 531994cccd fix: OCP import for BRepGProp + route metadata task to asset_pipeline
- Fixed: from OCP.BRepGProp import BRepGProp as brepgprop (was lowercase)
- Routed reextract_rich_metadata_task to asset_pipeline queue (render-worker
  has OCC/OCP installed, worker container does not)
- Backfill verified: 45/45 products updated with volume, surface area,
  part count, complexity metrics

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-15 19:50:12 +01:00
HartmutandClaude Opus 4.6 cfccdd5397 feat: rich product metadata extraction from STEP files
Extract volume, surface area, part count, assembly hierarchy, and
complexity from STEP files via OCC B-rep analysis.

Backend:
- extract_rich_metadata() in step_processor.py: computes per-part volume
  (BRepGProp), surface area, triangle/vertex count, assembly depth,
  instance count, complexity score, largest part identification
- cad_metadata JSONB column on Product model (DB migration)
- Auto-populated during STEP processing (non-fatal, 10s timeout)
- Also stored in cad_files.mesh_attributes["rich_metadata"]
- Batch re-extract endpoint: POST /admin/settings/reextract-rich-metadata

AI Agent:
- search_products returns part_count, volume_cm3, complexity, largest_part
- query_database tool description documents cad_metadata schema

Frontend:
- ProductDetail page: CAD Metadata section with stat cards
  (parts, volume, surface area, complexity, triangles, assembly depth)
- Admin System Tools: "Re-extract Rich Metadata" button for backfill

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-15 18:49:50 +01:00
HartmutandClaude Opus 4.6 0ffc86589a fix: chat agent auth, auto-submit/dispatch, no confirmation prompts
- All httpx tool calls use real user_id instead of uuid(int=0) for
  service token — fixes 401 Unauthorized on dispatch/override
- create_order auto-submits and auto-dispatches in one step
- System prompt updated: execute immediately without asking for
  confirmation, respond in user's language
- Product search returns CAD dimensions (dim_x/y/z_mm)
- query_database tool description includes cad_files schema

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-15 15:59:53 +01:00
HartmutandClaude Opus 4.6 f70a09886a feat: expose CAD dimensions (mm) in chat agent tools
- search_products now returns dim_x_mm, dim_y_mm, dim_z_mm from
  cad_files.mesh_attributes->'dimensions_mm'
- query_database tool description updated with cad_files schema
  including mesh_attributes->'dimensions_mm' path
- AI can now answer "what's the biggest product?" using real dimensions

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-15 15:05:37 +01:00
HartmutandClaude Opus 4.6 d37dd073bd feat: chat agent knows current page context (order/product)
Frontend: Layout extracts order/product UUID from URL path and passes
to ChatPanel as contextType/contextId. When on /orders/{uuid}, the
chat knows which order you're viewing.

Backend: System prompt now loads actual entity data for the context:
- Order: order_number, status, line counts (completed/processing/failed)
- Product: name, PIM-ID, category, STEP file status

The AI understands "this order", "current product" etc. Example:
"What's the status of this order?" → agent knows you mean SA-2026-00164

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-15 14:50:03 +01:00
HartmutandClaude Opus 4.6 48b5287baf fix: rollback DB session after failed tool execution in chat agent
When a tool like query_database fails (e.g., bad column name), the
SQLAlchemy session enters a failed transaction state. Subsequent
operations (like saving the assistant response) then also fail with
InFailedSQLTransactionError.

Fix: rollback the session in the except block of _execute_tool().
Also improved query_database tool description with correct column
names (category_key not category) to help the AI write valid SQL.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-15 14:32:33 +01:00
HartmutandClaude Opus 4.6 7b1a5762d9 feat: render Markdown in AI chat responses (bold, lists, code)
Added react-markdown to render assistant messages with proper formatting:
- **bold** text renders as bold
- Bullet/numbered lists render correctly
- Inline code renders with monospace background
- User messages stay as plain text

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-15 14:30:33 +01:00
HartmutandClaude Opus 4.6 88e8ab0792 fix: match ChatResponse field names to API (user_message/assistant_message)
Frontend interface expected 'message' and 'response' but API returns
'user_message' and 'assistant_message'. Field name mismatch caused
undefined access and page crash.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-15 14:28:05 +01:00