Skip to content

fix(video3d): ignore slower first library confirm - #239

Merged
IAnMove merged 1 commit into
developmentfrom
cursor/bc-ca9aeae6-7395-40b8-adc7-fea06afa9424-dd08
Sep 7, 2026
Merged

fix(video3d): ignore slower first library confirm#239
IAnMove merged 1 commit into
developmentfrom
cursor/bc-ca9aeae6-7395-40b8-adc7-fea06afa9424-dd08

Conversation

@cursor

@cursor cursor Bot commented Sep 7, 2026

Copy link
Copy Markdown

Resumen ejecutivo

Esta primera sección está pensada para project managers y revisores no
técnicos. Mantén el detalle técnico completo más abajo.

Qué cambia

Si el usuario confirma una escena de la biblioteca, pagina a otra y confirma esa, ya no puede ganar el fetch más lento de la primera. La confirmación más reciente es la que abre el proyecto.

Para qué sirve

#233/#236 evitan un open tardío después de Cancel, pero no invalidan un open anterior cuando el usuario cambia de página. Paginar limpia el candado opening y deja dos fetches con la misma generación. El primero en terminar llama a importScene y borra el undo.

Impacto para el usuario

Elegir la escena equivocada, pasar de página y abrir la correcta ya no sustituye el proyecto actual por la primera.

Riesgo

  • Bajo
  • Medio
  • Alto

Estado

  • En desarrollo
  • Listo para revisión
  • Bloqueado por CI o revisión
  • Requiere migración o acción manual

Summary

SceneLibraryDialog.openItem captured generationRef without advancing it. The list useEffect clears opening (and selected) on page change, so a second confirm can start while the first fetch is still in flight. Both captures share the same generation/workspace/purpose; commitLibraryChoice then accepts whichever fetch settles first while the dialog is still open. importScene wipes undo.

Trigger: Open scene A → Next page (opening lock cleared) → Open scene B → A's JSON arrives first → current project is replaced with A and B is ignored.

Overview

Each confirm now bumps generation before capture, so a later Open scene invalidates any in-flight open. Pagination buttons bump generation the same way tab changes already do, so browsing away from a pending open does not apply it.

Detailed changes

Backend

Unchanged.

UI and Wizard

  • SceneLibraryDialog.openItem increments generationRef before capturing live state
  • Previous/next page buttons increment generationRef (same pattern as the tab buttons)

Data, provenance and compatibility

No persistence or catalog identity changes.

Files and ownership

  • ui/src/components/Sidebar/SceneLibraryDialog.tsx — generation bumps
  • ui/tests/sceneLibraryDialog.test.tsx — slower first fetch vs later confirm
  • Left untouched: sceneLibraryChoice.ts contract, SceneAnimatorPanel.importScene

Validation

  • Date (UTC): 2026-09-07

  • Base SHA: 661d241c01a74740ae07cab016e503ba7cfbae4a (origin/development)

  • Head SHA: 404ffde0964c19258cf84cfc699e3f474fc6666f

  • Validation scope: focused

  • python scripts/verify_clean_repo.py

  • python -m compileall -q app/services app/launch.py scripts

  • Focused Python tests: N/A (UI-only)

  • cd ui && npm run i18n:check

  • UI tests: npx tsx --tsconfig tsconfig.app.json --import ./tests/setupI18n.ts --test tests/sceneLibraryDialog.test.tsx tests/sceneLibraryChoice.test.mjs5 passed

  • cd ui && npm run lint -- --max-warnings=0 on the touched files — pass

  • cd ui && npm run build

  • git diff --check — clean

  • E2E/smoke checks: N/A (race is covered by the gated-fetch unit test)

Code quality

  • Score: pending CI
  • Complexity trend: pending CI
  • Production LOC trend: pending CI
  • Regression versus main: pending CI
  • Ratchet: pending CI

CI and review

  • CI of this HEAD: pending

  • Independent agent review of this HEAD: pending

  • Human merge click (operational, not code review): pending

  • Reviewed at current HEAD

  • Earlier review; HEAD has changed since (stale)

  • Pending

  • Unavailable

Coste de la tarea

  • Tests simulados: 0 tokens externos
  • Tests reales: N/A
  • Llamadas LLM externas: 0
  • Tokens de prompt: N/A
  • Tokens de respuesta: N/A
  • Tokens totales: N/A
  • Generaciones de imágenes/audio/vídeo: 0
  • Tiempo transcurrido: N/A
  • Proveedores/modelos: N/A

Notes and limitations

The race needs overlapping scene JSON fetches. The unit test gates both responses; no live compositor session was used.

Follow-up work

#235 (remote catalog identity on Tools picks) remains open. #232 (stale compositor layer binds) stays rejected.

Checklist

  • The executive summary is understandable without reading the code.
  • The detailed Summary/Overview has not been removed or shortened.
  • Tests and their actual results are recorded.
  • Generated assets, secrets and local-only files are not committed.
  • Required CI and Cursor/Bugbot review are complete, or the PR is clearly marked as waiting for them.
Open in Web View Automation 

Note

Low Risk
UI-only invalidation logic in the scene library dialog; no auth, persistence, or API contract changes.

Overview
Fixes a race in the 3D scene library where confirming one scene, paging away, and confirming another could still load the first scene if its JSON returned after the second fetch started (pagination clears opening, so both requests could share the same generation).

SceneLibraryDialog now bumps generationRef at the start of each Open scene confirm and on previous/next page clicks (matching tab switches), so commitLibraryChoice drops stale in-flight opens and only the latest choice can call onOpenScene / wipe undo.

Adds a unit test that gates two overlapping scene fetches and asserts the later confirm wins when the slower first response arrives last.

Reviewed by Cursor Bugbot for commit 404ffde. Configure here.

Paging clears the in-flight opening lock without bumping generation, so a later Open scene could lose to the first fetch and replace the current project (wiping undo). Advance generation on each confirm and on page changes.

Co-authored-by: ignaciodelcano+dcl <ignaciodelcano+dcl@gmail.com>
@github-actions

github-actions Bot commented Sep 7, 2026

Copy link
Copy Markdown

PR Review — Loreframe Studio

Risk: low
Scope: 2 file(s); +68/-2; React UI

Automated review from scripts/analyze_pr.py. This is a heuristic pass (no LLM) so humans still own the merge decision.

Findings

  • low — UI changed — rebuild before merge
    Run cd ui && npm run build (CI already does this). Pinokio Update rebuilds for end users; keep ui/dist untracked.

Changed files

  • modified: ui/src/components/Sidebar/SceneLibraryDialog.tsx, ui/tests/sceneLibraryDialog.test.tsx

CONTRIBUTING checklist

  • python scripts/verify_clean_repo.py
  • python -m compileall -q app/services app/launch.py scripts
  • cd ui && npm run build if the UI changed
  • No weights, CivitAI sidecars, or generated guides
  • Stays local-first (no required accounts / telemetry)

Posted by the repo PR review workflow. Re-runs on each push to the PR.

@github-actions

github-actions Bot commented Sep 7, 2026

Copy link
Copy Markdown

Code health

Quality score: 54.6/100

Higher is better. The score is a trend dashboard; the independent ratchet below remains the CI gate.

Component Weight Current Change
Cyclomatic health 45% 54.3 +0.0
File concentration 25% 61.3 +0.0
Oversized-file debt 20% 36.9 +0.0
Modularity 10% 74.9 +0.0

Change vs PR base: +0.0 points.

Metric Value
Production LOC 263,999
Production files 697
Test LOC 92,419
Functions measured 17,025
Functions complexity ≥ 15 833
Maximum complexity 672
Policy code-health-policy-v1
HEAD 6f15c8df01f20cddeaad8d6ba4c23b78295f97d7
Base 661d241c01a74740ae07cab016e503ba7cfbae4a
UI measurement complete

Markdown, JSON catalogs and tests are out of this table. Only app/ runtime + ui/src TS/JS count.

Most complex functions

Complexity Where
672 app/wgp.py:7219 generate_video
381 ui/src/stores/useStore.ts:4053 Async method 'startGeneration'
355 app/_launch_runtime.py:23563 _run_generation
308 app/wgp.py:12359 generate_video_tab
268 ui/src/stores/useStore.ts:8600 Async method 'loadSettingsFromOutput'
258 app/services/director/planners/short_film.py:3433 ShortFilmPlanner._plan_story_driven
258 ui/src/components/Sidebar/SceneAnimatorPanel.tsx:493 Function 'SceneAnimatorPanel'
248 app/services/director_pipeline.py:13607 _run_video_generation
245 app/services/director_pipeline.py:7712 _run_pipeline
244 ui/src/features/agent/agentActions.ts:1145 Function 'parseAction'
226 app/services/director_pipeline.py:6541 update_comic_preview
225 ui/src/features/agent/agentActions.ts:2892 Async function 'executeAgentActions'

Trend vs baseline

Metric Δ
Production LOC +4
Test LOC +62
Functions ≥ 15 +0
Maximum complexity +0

Warnings

  • production LOC increased by +4

Ratchet passed.

@IAnMove
IAnMove marked this pull request as ready for review September 7, 2026 20:20
@IAnMove
IAnMove merged commit f05bb2c into development Sep 7, 2026
9 checks passed
@cursor

cursor Bot commented Sep 7, 2026

Copy link
Copy Markdown
Author

Bugbot couldn't run - usage limit reached

Bugbot is counted against Cursor usage for this user or team, and this run hit a usage or spend limit.

A user or team admin can review and increase usage limits in the Cursor dashboard.

(requestId: serverGenReqId_0838bf2f-6d12-4359-a246-4a54051c5084)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants