feat: [26][27] render pipeline with auto previews #45

Merged
hobbypunk merged 2 commits from feature/26_27_render_pipeline into main 2026-10-31 15:36:17 +00:00
Contributor

Closes #26
Closes #27

Summary

Render pipeline (SolidQueue):

  • RenderJob is the single source of truth: outputs (PNG → image, STL → mesh) live on the job, versions and param sets resolve their newest successful job instead of owning copies
  • Creating a RenderJob queues itself (after_commit on: :create) — callers can never forget the perform_later; after_commit so the worker never races the creation transaction
  • Blueprints::PerformRenderJob materializes the version files, applies param values as -D overrides (bool/numeric to_s, strings quoted) and attaches the outputs
  • Failures are recorded on the job record (status: failed + error_message), no SolidQueue retry for deterministic errors; a successful re-run clears a previous error message
  • render_jobs.user_id nullable for system auto-renders

Auto previews (#27):

  • Every version create enqueues a preview job: PNG (--imgsize 800,600 --autocenter --viewall) + default STL mesh
  • Mesh timeout degrades gracefully to image-only (the mesh is a bonus for the future 3D viewer)
  • Graceful degradation without failing the preview job

OpenSCAD service hardening:

  • Binary configurable via settings.yml (openscad: — absolute path or PATH lookup), fixes GUI-launched IDEs with limited session PATH
  • Process.spawn with per-process env: thread-safe OPENSCADPATH, no global ENV mutation
  • 60s render timeout with kill + reap (OpenScad::TimedOut); 5s for param exports
  • 3MF is deliberately not a render format: single-object 3MF adds nothing over STL — the real value is the multi-object project export (#42)

Notes

  • Naming: Blueprint:: models, Blueprints:: domain operations (actors + jobs), OpenScad the single binary touchpoint
  • Preview PNGs are ~32 KB; WebP conversion and transparent background (vips chroma-key) are parked for #43

Test strategy

  • All job/service tests are stub-based (no OpenSCAD needed in CI); real-binary paths verified locally (Baseplate render, Minkowski timeout kill)
Closes #26 Closes #27 ## Summary **Render pipeline (SolidQueue):** - `RenderJob` is the single source of truth: outputs (PNG → `image`, STL → `mesh`) live on the job, versions and param sets resolve their newest successful job instead of owning copies - Creating a `RenderJob` queues itself (`after_commit on: :create`) — callers can never forget the `perform_later`; after_commit so the worker never races the creation transaction - `Blueprints::PerformRenderJob` materializes the version files, applies param values as `-D` overrides (bool/numeric to_s, strings quoted) and attaches the outputs - Failures are recorded on the job record (`status: failed` + `error_message`), no SolidQueue retry for deterministic errors; a successful re-run clears a previous error message - `render_jobs.user_id` nullable for system auto-renders **Auto previews (#27):** - Every version create enqueues a preview job: PNG (`--imgsize 800,600 --autocenter --viewall`) + default STL mesh - Mesh timeout degrades gracefully to image-only (the mesh is a bonus for the future 3D viewer) - Graceful degradation without failing the preview job **OpenSCAD service hardening:** - Binary configurable via `settings.yml` (`openscad:` — absolute path or PATH lookup), fixes GUI-launched IDEs with limited session PATH - `Process.spawn` with per-process env: thread-safe `OPENSCADPATH`, no global ENV mutation - 60s render timeout with kill + reap (`OpenScad::TimedOut`); 5s for param exports - 3MF is deliberately not a render format: single-object 3MF adds nothing over STL — the real value is the multi-object project export (#42) ## Notes - Naming: `Blueprint::` models, `Blueprints::` domain operations (actors + jobs), `OpenScad` the single binary touchpoint - Preview PNGs are ~32 KB; WebP conversion and transparent background (vips chroma-key) are parked for #43 ## Test strategy - All job/service tests are stub-based (no OpenSCAD needed in CI); real-binary paths verified locally (Baseplate render, Minkowski timeout kill)
[26][27] feat: render pipeline with auto previews
Some checks failed
CI / Quality / Brakeman (pull_request) Successful in 1m28s
CI / Quality / Bundler Audit (pull_request) Successful in 1m30s
CI / Quality / RuboCop (pull_request) Successful in 1m36s
CI / Quality (pull_request) Successful in 0s
CI / Tests / Unit (pull_request) Successful in 2m5s
CI / Tests / System (pull_request) Successful in 2m14s
PR Triage / Triage pull request-1 (pull_request) Successful in 6s
PR Triage / Triage pull request (pull_request) Successful in 0s
CI / Tests / Coverage (pull_request) Failing after 58s
CI / Tests (pull_request) Failing after 0s
CI / Container / Build and push (pull_request) Has been skipped
CI / Container (pull_request) Failing after 0s
CI / Deploy (pull_request) Has been skipped
dd90d29b57
Closes #26
Closes #27

SolidQueue render pipeline driven by RenderJob records: creating a job
queues itself (after_commit), Blueprints::PerformRenderJob materializes
the version files, applies param values as -D overrides and attaches the
outputs to the job (image for PNG, mesh for STL). Auto previews on every
version create render PNG (autocenter/viewall) plus a default STL mesh,
degrading to image-only when the mesh render times out. Failed jobs keep
their error on the record instead of retrying; a successful re-run clears
it. OpenSCAD binary is configurable via settings, runs with per-process
env (thread-safe OPENSCADPATH) and a 60s render timeout with kill+reap.
3MF is deliberately not a render format — it belongs to the project
multi-object export (#42).

---------

Co-Authored-By: opencode (Mistral GLM) <opencode-agent[bot]@hoppe-dev.eu>
forgejo-actions changed title from [26][27] feat: render pipeline with auto previews to feat: [26][27] feat: render pipeline with auto previews 2026-10-31 15:21:38 +00:00
hobbypunk changed title from feat: [26][27] feat: render pipeline with auto previews to feat: [26][27] render pipeline with auto previews 2026-10-31 15:22:24 +00:00
OpenCode changed title from feat: [26][27] render pipeline with auto previews to [26][27] render pipeline with auto previews 2026-10-31 15:23:31 +00:00
forgejo-actions changed title from [26][27] render pipeline with auto previews to feat: [26][27] render pipeline with auto previews 2026-10-31 15:23:38 +00:00

📊 Coverage

Metrik Abdeckung
Zeilen 98.14% (3012/3069)
Branches 83.33% (765/918)
Methoden 98.77% (482/488)

Patch-Coverage: 100.0% (80/80 geänderte Zeilen)

Geänderte Dateien (schwach zuerst)

Datei Patch-Coverage Fehlende Zeilen
app/jobs/blueprints/perform_render_job.rb 100.0% (44/44)
app/services/open_scad.rb 100.0% (11/11)
app/models/blueprint/version.rb 100.0% (10/10)
app/models/blueprint/param_set.rb 100.0% (6/6)
app/models/render_job.rb 100.0% (5/5)
app/jobs/blueprints/prune_param_set_drafts_job.rb 100.0% (4/4)

Schwächste Dateien im Projekt

Datei Abdeckung
app/components/form/select.rb 72.41%
app/components/layout/notification.rb 80.95%
app/components/concerns/actionable.rb 86.67%
app/components/layout/sidebar.rb 89.47%
app/components/concerns/inferrable.rb 90.63%
app/models/concerns/has_uuid_v7.rb 90.91%
app/components/users/avatar.rb 91.23%
app/controllers/settings/security/otps_controller.rb 91.67%
app/components/base.rb 92.16%
app/controllers/settings/security/passkeys_controller.rb 92.31%

🔍 Report im Browser ansehen · 📄 Run-Artifact „coverage-report“

<!-- coverage-report --> ## 📊 Coverage | Metrik | Abdeckung | |---|---| | Zeilen | 98.14% (3012/3069) | | Branches | 83.33% (765/918) | | Methoden | 98.77% (482/488) | **Patch-Coverage**: 100.0% (80/80 geänderte Zeilen) **Geänderte Dateien (schwach zuerst)** | Datei | Patch-Coverage | Fehlende Zeilen | |---|---|---| | app/jobs/blueprints/perform_render_job.rb | 100.0% (44/44) | | | app/services/open_scad.rb | 100.0% (11/11) | | | app/models/blueprint/version.rb | 100.0% (10/10) | | | app/models/blueprint/param_set.rb | 100.0% (6/6) | | | app/models/render_job.rb | 100.0% (5/5) | | | app/jobs/blueprints/prune_param_set_drafts_job.rb | 100.0% (4/4) | | **Schwächste Dateien im Projekt** | Datei | Abdeckung | |---|---| | app/components/form/select.rb | 72.41% | | app/components/layout/notification.rb | 80.95% | | app/components/concerns/actionable.rb | 86.67% | | app/components/layout/sidebar.rb | 89.47% | | app/components/concerns/inferrable.rb | 90.63% | | app/models/concerns/has_uuid_v7.rb | 90.91% | | app/components/users/avatar.rb | 91.23% | | app/controllers/settings/security/otps_controller.rb | 91.67% | | app/components/base.rb | 92.16% | | app/controllers/settings/security/passkeys_controller.rb | 92.31% | [🔍 Report im Browser ansehen](https://pages.hoppe-dev.eu/hobbypunk-blakopi/pr-45/coverage) · [📄 Run-Artifact „coverage-report“](https://code.hoppe-dev.eu/hobbypunk/blakopi/actions/runs/3750/artifacts/coverage-report)
test: cover model accessor and guard branches
All checks were successful
PR Triage / Triage pull request-1 (pull_request) Successful in 1m15s
PR Triage / Triage pull request (pull_request) Successful in 0s
CI / Quality / Bundler Audit (pull_request) Successful in 1m32s
CI / Quality / Brakeman (pull_request) Successful in 1m35s
CI / Quality / RuboCop (pull_request) Successful in 1m36s
CI / Quality (pull_request) Successful in 0s
CI / Tests / Unit (pull_request) Successful in 2m3s
CI / Tests / System (pull_request) Successful in 2m10s
CI / Tests / Coverage (pull_request) Successful in 41s
CI / Tests (pull_request) Successful in 0s
CI / Container / Build and push (pull_request) Successful in 6s
CI / Container (pull_request) Successful in 0s
CI / Deploy (pull_request) Has been skipped
528925b806
The Models branch coverage threshold failed in CI at 74.44%: the new
image/mesh accessors and customizer extraction guards were only ever
executed on their happy paths. Adds tests for the nil-job and
unattached attachment paths, the blank main_file/file-path early
returns, and the in-place re-extraction branches (stubbable, CI-safe).

---------

Co-Authored-By: opencode (Mistral GLM) <opencode-agent[bot]@hoppe-dev.eu>
Sign in to join this conversation.
No description provided.