Generate a Tile, the first render job (#39) #89
No reviewers
Labels
No labels
bug
duplicate
enhancement
help wanted
invalid
needs-info
needs-triage
question
ready-for-agent
ready-for-human
wayfinder:grilling
wayfinder:map
wayfinder:prototype
wayfinder:research
wayfinder:task
wontfix
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
crowmaki/ai-studio!89
Loading…
Reference in a new issue
No description provided.
Delete branch "issue-39-generate-tile"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Closes #39
What
A Tile can be generated with
image.t2i. This is the first job that runs through the app's own render queue.reference_versionis rebuilt soblob_idcan be NULL. A generated version exists from the moment it is queued, with no pixels until its job finishes. It recordsprompt,seed,requested_widthandrequested_height.jobtable, with one row per ComfyUI submission. It haskind(the workflow id), exactly one target FK (reference_version_id,ON DELETE CASCADE, unique),state,position,attempt, our own UUIDprompt_id,graph_blob_id,errorand timestamps.job.graph_blob_idis added toBLOB_REFERENCES.ProjectSession::generate_tile(tile, prompt, seed?)is append-only and not undoable.newest_picks, crop plan) and in TS (currentVersion). CONTEXT.md is updated to match.RenderWorker, one lane, instudio-core):/ws?clientIdand waits for the greeting, then submits/api/promptwith ourprompt_id. A 200 with non-emptynode_errorsis a failure, and so is a 400.progress,execution_errorandexecution_interrupted, and stops atexecuting{node:null}./api/history/{id}, fetches each file from/api/view, and stores it at once.upload_image(multipart; it uses the name ComfyUI returns),queue_prompt,history,view, and a WebSocket event stream (tungstenite)./prompt,/upload/image(renames a taken name),/history/<id>and/view. It plays a scripted event sequence to the client that submitted, saves the output image for eachSaveImage, and records every submitted graph. Scripts:Succeed,NodeErrors,RejectandExecutionError.generate_tile,queueandfollow_queue_progress. The last one sends per-job progress over a channel.changed(new kindqueue).Decisions to check
Migrations now run in WAL mode with foreign keys off.
schema::migrateturns foreign keys off around the transaction and runspragma_foreign_key_checkbefore commit.journal_mode=WALis set before migrating. Both were needed to rebuild a table:DROP TABLEfailed.close()failed with "database table is locked".This applies to every future migration.
A workflow that is not ready fails its job. #24 says such jobs should wait. That waiting state, together with offline re-probing, is in #53's acceptance criteria.
No input uploads yet.
image.t2ihas no image inputs, so the worker does not upload anything yet. The client method and the fake endpoint exist and are tested. Wiring them toLoadImageslots comes with #51.A job goes with its target. Deleting a Tile cascades to its jobs. If undo puts a generated version back, it shows Failed with "its job was removed".
Left for #52/#53:
Tests
crates/fake-comfy/tests/protocol.rs: the event sequence, history and/view, the scripted failures, and upload renaming.crates/studio-core/tests/tile_generation.rscovers:crates/studio-core/tests/render_worker.rs:node_errorson a 200, a 400,execution_error, a workflow that is not ready (never submitted), and an offline ComfyUI.crates/studio-core/tests/migrations.rs: v10 versions and lock picks survive the rebuild, the foreign-key check is clean, and the append-only triggers hold.src-tauri/tests/tile_generation.rs: the adapter round trip against the fake, and a failed job.src/lib/queue/summary.test.tsand the pending-version cases inlock.test.ts.cargo test --workspace --all-features,bun testandsvelte-checkall pass. Clippy only shows the existingHookstype-complexity warning.The UI was checked only by typecheck. It was not checked by hand in the running app.