Skip to content

Fix release CI ratchet and Bugbot integration findings - #418

Merged
IAnMove merged 3 commits into
developmentfrom
fix/pr354-integration-ci
Sep 14, 2026
Merged

Fix release CI ratchet and Bugbot integration findings#418
IAnMove merged 3 commits into
developmentfrom
fix/pr354-integration-ci

Conversation

@IAnMove

@IAnMove IAnMove commented Sep 14, 2026

Copy link
Copy Markdown
Owner

Resumen ejecutivo

Qué cambia

Corrige los dos hallazgos de Bugbot de #354: las escenas guardadas conservan su workspace en la URL y se retiran notas/parches temporales de integración. Repara los cuatro aumentos de complejidad detectados por CI.

Para qué sirve

El PR de publicación acumulaba 290 commits y aplicaba un presupuesto de cambio individual a toda la integración. Ahora las publicaciones verifican ese mismo presupuesto en cada integración y conservan todos los controles locales sobre el resultado completo frente a main.

Impacto para el usuario

Las escenas vuelven a abrirse desde su carpeta correcta aunque cambie el workspace activo. La publicación puede verificar sus cambios acumulados sin borrar funcionalidades ni ocultar deuda.

Riesgo

  • Medio: cambia la unidad del presupuesto acumulativo exclusivamente para publicaciones verificadas.

Estado

  • CI verde y revisión técnica de política aprobada; pendiente Cursor/Bugbot del nuevo HEAD.

Summary

Follow-up to #354, based on development 65dfca3fb5cf24dfc8ec2af059058e10c75c7a27.

The failing CI run stopped at the code-health ratchet: +30,150 production LOC, +34 complex functions and four per-file complexity regressions relative to main. Python shards and Linux/Windows E2E passed, but the ratchet prevented UI tests/lint/build from running. The 205 new production files account for 28,954 LOC; generated images, catalogs, tests and handoffs were already excluded.

The replacement release gate checks LOC and complex-function-count growth at every exact first-parent transition using the existing budgets. All other rules still compare the final candidate with the exact main base. No baseline, exception file or numeric threshold is changed. Full cumulative deltas and historical local findings remain visible.

Overview

Ordinary feature PRs, forks and ordinary pushes retain the existing ratchet. Release mode requires canonical repository identity, development → main metadata, complete history, contiguous ancestry, an unchanged main/merge-base tree, and an exact candidate/source tree match. It independently reconstructs historical metrics from Git blobs and checks agreement with full endpoint measurements.

The ensuing canonical push to main can use the same verification only for a two-parent merge whose first parent is the push before, whose second-parent tree equals the published tree, and whose second parent belongs to freshly fetched development history. Fast-forward/squash, changed-tree and unrelated-parent cases keep ordinary checks.

Detailed changes

Backend

  • POST /api/v1/scenes resolves its workspace once and includes it in the saved file URL, including requests that use the active workspace implicitly.
  • Removes stale handoffs, PR draft text and unapplied integration patches; keeps reusable speech-cache behavior in the existing documentation.

UI and Wizard

  • Table-driven effect layout defaults replace accumulated conditional branches.
  • Material and particle animation use separate helpers, preserving their formulas and order.
  • Cutout beat grouping is separated from keyframe rebuilding; Series voice fields normalize the optional profile once.
  • File maximum complexity: world 33 → 16, worldRuntime 39 → 24, cutoutDialogue 26 → 22, SeriesVoiceFields 25 → 17.

Data, provenance and compatibility

  • Temporary Git blob measurements are reused by content without excluding intermediate files. NUL-delimited paths include Unicode names even when those files disappear before HEAD.
  • Analyzer, policy, ESLint configuration, lockfile and package manifest fields must remain identical through history; only scripts.test, unused by direct measurement, may differ. Install/lifecycle hooks remain protected inputs.
  • CI uploads checkpoint SHAs, tree IDs, aggregate metrics and verdicts as code-health-integration.json.
  • A failed ratchet still allows independent UI test/lint/build results to be collected after dependencies install. Any failure still fails CI required.

Files and ownership

Backend URL fix and regression test; four UI complexity reductions; existing code-health wrapper plus the release verifier and adversarial tests; CI activation/evidence; documentation and temporary-artifact cleanup. Work is isolated in a fresh worktree.

Validation

  • Date (UTC): 2026-09-14
  • Base SHA: 65dfca3fb5cf24dfc8ec2af059058e10c75c7a27
  • Head SHA: 5a5a069e99f6ccf31916ab110811f4786003edc6.
  • Scope: focused backend/CI tests, full UI suite, build, and real Git-history verification; no model generation.

Passed locally:

  • python -m pytest -q tests/test_validate_local_wrapper.py tests/test_code_health.py tests/test_development_branch_policy.py tests/test_core_runtime.py tests/test_ci_required.py: 117 passed.
  • Focused UI tests (world runtime/effects, cutout dialogue, Series kits): 38 passed.
  • cd ui && npm test: 1,813 passed, 0 skipped.
  • npm run i18n:check, npm run lint -- --max-warnings=0, npm run build, npm run budget: passed; entry JS gzip 191,735 / 327,680 bytes.
  • python scripts/verify_clean_repo.py, python -m compileall -q app/services app/launch.py app/core_runtime.py scripts, python scripts/check_documentation_links.py, git diff --check: passed.
  • Ordinary ratchet against development: passed (+25 LOC, +1 complex function).

Release replay passed at the exact current HEAD against main b2cdd1a56650ff7f5561735a8a31a4d5e4d4a942: 81 verified first-parent transitions (78 existing integrations plus this fix’s three commits). Initial history audit reproduced CI's exact endpoint metrics over the original 78 integrations. Every cumulative budget passed; #349 introduced two local hotspot regressions which this PR repairs at the final tree. Adversarial tests cover missing/gapped history, endpoint mismatch, policy/input drift, intermediate aggregate failures, current hotspots, fork provenance, Unicode paths, and rejected publication merge shapes.

Code quality

Current CI code-health report: score 64.5/100, +0.0 vs development, 317,162 production LOC, 914 complex functions, maximum 674. Ordinary ratchet passed. The separately verified release report retains +30,175 LOC and +35 complex functions vs main and passes all 81 per-integration growth budgets plus every final local limit.

CI and review

  • CI of this HEAD: passed, including both Python shards, UI tests/lint/build, Linux E2E, Windows speech export and CI required.
  • Independent agent review: bounded policy/CI review approved by review_ci_fix for 5a5a069e99f6ccf31916ab110811f4786003edc6; repository provenance, Unicode history paths, install-hook fingerprints and publication merge fixtures were reviewed and fixed. The implementer ran the final 81-transition replay.
  • Automated Independent QA evidence check: skipped; not counted as approval.
  • Cursor/Bugbot: pending current HEAD.
  • Human merge click: pending; this PR performs no merge.

Coste de la tarea

  • Tests simulados: 0 tokens externos.
  • Tests reales: local filesystem/Git history and compilation; no provider calls.
  • Llamadas LLM externas: 0; prompt/completion/total tokens: N/A.
  • Generaciones de imágenes/audio/vídeo: 0.
  • Agent token usage and elapsed time: N/A (not exposed as a reliable task total).

Notes and limitations

The running Pinokio application and installed models were not restarted or changed. No real media generation is claimed. Changing measurement inputs or publishing a main tree that differs from the merge-base requires a separately reviewed path; release verification fails closed. #354 itself will retain its old check results until these changes are integrated and that PR reruns.

Follow-up work

Complete Cursor/Bugbot review, then integrate this fix through the normal development review. Publication of development into main remains a separate merge action.

Checklist

  • Executive summary and detailed behavior included.
  • Actual local tests and limitations recorded.
  • Generated assets, secrets and local-only files excluded.
  • Current CI complete and passing.
  • Cursor/Bugbot review of this HEAD pending; PR opened for review after CI passed.

Note

Medium Risk
Changes CI release policy and scene file URL semantics; incorrect integration detection or workspace handling could block merges or break scene loading across workspaces.

Overview
Adds a release-only code-health gate for verified developmentmain PRs (and matching merge pushes): production LOC and high-complexity function growth must pass the existing budgets at every first-parent integration, while all other ratchet rules still compare the final tree to main. New code_health_integration.py reconstructs metrics from Git blobs, writes code-health-integration.json, and CI passes branch/repo SHAs plus still runs UI test/lint/build after a failed ratchet when deps install.

Backend: POST /api/v1/scenes resolves workspace once (defaulting to active) and returns file URLs with ?workspace=… so scenes load from the correct folder after switching workspace.

UI maintainability: World SFX defaults move to a table; explosion/runtime animation splits into animateMaterials / animateParticles; cutout dialogue beat grouping is extracted; Series voice fields use a single profile object—lowering ESLint complexity on four hotspots.

Housekeeping: Removes tracked agent handoffs, draft PR_BODY.md, and unapplied INTEGRATION*.patch files; extends .gitignore and documents speech-analysis caching in VIDEO3D_SPEECH.md.

Reviewed by Cursor Bugbot for commit 5a5a069. Configure here.

@github-actions

Copy link
Copy Markdown

PR Review — Loreframe Studio

Risk: low
Scope: 21 file(s); +795/-406; GitHub workflows, React UI, docs, repo scripts / CI

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

  • added: scripts/code_health_integration.py
  • modified: .github/workflows/ci.yml, .gitignore, app/core_runtime.py, app/routers/user_diagnostics.py, docs/development/CODE_HEALTH.md, docs/development/VIDEO3D_SPEECH.md, scripts/check_code_health_pr_base.sh, tests/test_code_health.py, tests/test_core_runtime.py, tests/test_development_branch_policy.py, ui/src/features/sceneFx/world.ts, ui/src/features/sceneFx/worldRuntime.ts, ui/src/features/series/SeriesVoiceFields.tsx, ui/src/lib/cutoutDialogue.ts
  • deleted: H07_HANDOFF.md, H17_HANDOFF.md, INTEGRATION.patch, INTEGRATION_LAUNCH_RUNTIME.patch, PR_BODY.md, ui/src/features/diagnostics/INTEGRATION.patch

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

Copy link
Copy Markdown

Code health

Quality score: 64.5/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% 59.6 -0.1
File concentration 25% 74.4 +0.0
Oversized-file debt 20% 50.2 +0.0
Modularity 10% 90.3 +0.0

Change vs PR base: +0.0 points.

Metric Value
Production LOC 317,162
Production files 1,109
Test LOC 131,501
Functions measured 21,879
Functions complexity ≥ 15 914
Maximum complexity 674
Policy code-health-policy-v1
HEAD 3a45cc4c03060e98dfae29d13fe4cc24c2563731
Base 65dfca3fb5cf24dfc8ec2af059058e10c75c7a27
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
674 app/wgp.py:7230 generate_video
382 ui/src/stores/useStore.ts:4129 Async method 'startGeneration'
355 app/_launch_runtime.py:23674 _run_generation
308 app/wgp.py:12372 generate_video_tab
269 ui/src/components/Sidebar/SceneAnimatorPanel.tsx:510 Function 'SceneAnimatorPanel'
264 ui/src/stores/useStore.ts:8684 Async method 'loadSettingsFromOutput'
258 app/services/director/planners/short_film.py:3433 ShortFilmPlanner._plan_story_driven
248 app/services/director_pipeline.py:13616 _run_video_generation
245 app/services/director_pipeline.py:7716 _run_pipeline
233 ui/src/features/agent/agentActions.ts:1155 Function 'parseAction'
226 app/services/director_pipeline.py:6545 update_comic_preview
225 ui/src/features/agent/agentActions.ts:3004 Async function 'executeAgentActions'

Trend vs baseline

Metric Δ
Production LOC +25
Test LOC +277
Functions ≥ 15 +1
Maximum complexity +0

Warnings

  • production LOC increased by +25
  • functions at complexity >= 15 increased by +1

Ratchet passed.

@IAnMove
IAnMove marked this pull request as ready for review September 14, 2026 15:36
@IAnMove
IAnMove merged commit 4bb3c40 into development Sep 14, 2026
14 checks passed
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.

1 participant