fix(render+studio): dev mock worker (unstick the queue) + lock predefined layers

Render — "stuck in Queued" fix:
- Jobs were created Queued and only a Windows AE node could claim them, so in the
  dev stack (no node) they queued forever.
- New devworker package: in-process mock worker drives Queued jobs through the steps
  with progress + live preview frames → Done. Enabled via RENDER_DEV_WORKER (default
  true in compose; set false in prod where real nodes claim jobs).
- db: DevClaimNextQueued (atomic oldest-queued → Preparing) + UpdateJobStepProgress
- Verified live: a stuck job advanced Preparing→Done in ~10s with frontend polling.

Studio — predefined template structure:
- Projects are always copied from a template; structure is fixed. Users customise
  existing layers, they don't add new ones.
- New studio-config flag ALLOW_ADD_LAYERS (false): StudioToolbar (add text/image/
  video/shape) returns null; SceneEditSidebar "add text layer" button hidden.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
soroush.asadi
2026-06-05 22:10:05 +03:30
parent 81912cac66
commit 43d0e10543
7 changed files with 233 additions and 11 deletions
+9
View File
@@ -7,6 +7,7 @@ import (
"os"
"github.com/flatrender/render-svc/internal/db"
"github.com/flatrender/render-svc/internal/devworker"
"github.com/flatrender/render-svc/internal/handlers"
"github.com/flatrender/render-svc/internal/identityclient"
"github.com/flatrender/render-svc/internal/middleware"
@@ -39,6 +40,7 @@ func main() {
identityURL := getEnv("IDENTITY_URL", "")
serviceToken := getEnv("SERVICE_TOKEN", "internal-service-secret")
port := getEnv("PORT", "8080")
devWorker := getEnv("RENDER_DEV_WORKER", "false") == "true"
// ── Database ──────────────────────────────────────────────────────────────
pool, err := pgxpool.New(context.Background(), dbURL)
@@ -72,6 +74,13 @@ func main() {
scanH := handlers.NewScanHandler(store, mc, minioTemplatesBucket)
internalH := handlers.NewInternalHandler(store, notifyClient, mc, minioTemplatesBucket, minioBucket)
// ── Dev mock worker (no AE node needed) ────────────────────────────────────
// Drives Queued jobs to Done with progress + preview frames so the render flow
// is exercisable in development. Production keeps this OFF and uses real nodes.
if devWorker {
go devworker.New(store).Run(context.Background())
}
// ── Router ────────────────────────────────────────────────────────────────
r := gin.Default()