Skip to content

Split Story Lab tabs and show code-health tables on PRs - #97

Merged
IAnMove merged 2 commits into
mainfrom
chore/code-health-report-and-split
Sep 2, 2026
Merged

Split Story Lab tabs and show code-health tables on PRs#97
IAnMove merged 2 commits into
mainfrom
chore/code-health-report-and-split

Conversation

@IAnMove

@IAnMove IAnMove commented Sep 2, 2026

Copy link
Copy Markdown
Owner

Why

#94 failed the code-health ratchet because #91 landed after the #92 baseline: CI treated StoryProductionsMusicPanel (complexity 101) and the other extracted tabs as new files over the 25 limit. That is not a Character Kits docs problem, and a baseline-only PR would have hidden the real split.

Doing the split now is compatible with Codex/#95: this PR does not touch _launch_runtime.py or useStore.ts.

What

  • Split Compact, Music, Trailer and Productions into smaller panels (same JSX and i18n keys, no new literals in parents).
  • Refresh scripts/code_health_baseline.json after the split.
  • Markdown, JSON catalogs and tests were already out of the product scan; that is now explicit and tested.
  • CI prints a GitHub table in the job summary and upserts a PR comment (<!-- code-health-report -->).
  • Token heuristic no longer matches task-generation-... (false positive on feat(provenance): trace Studio generations from Wizard to asset #95). Real sk-... / ghp_ / hf_ tokens still flag.

Remaining Story Lab hotspots after the split (now in the baseline, not new-file failures): Film card 44, trailer clip 42, MusicCueCard 38, music models 32.

Checks

  • UI lint on the extracted files, tsc -p tsconfig.app.json --noEmit
  • UI tests (500 pass, including the Story Lab extract tests)
  • Python: test_story_lab_audio_ui, test_story_lab_trailer_ui, test_model_selection_persistence, test_code_health, test_analyze_pr
  • python scripts/code_health.py --check --markdown

Note

Low Risk
Refactor-only Story Lab UI with no auth or data-path changes; CI and ratchet tooling changes are additive aside from baseline and scope exclusions.

Overview
Story Lab oversized tabs are broken into dedicated components (compact prep, music, trailer, productions) so behavior and i18n stay the same while each file sits under the complexity ratchet. Parent tabs mostly compose the new modules; check-i18n-catalogs.mjs and Story Lab source tests now cover the full stories/ tree instead of a fixed file list.

Code health gains --markdown and --publish-pr-comment: CI on ui-check writes the ratchet table to the job summary and upserts a single PR comment (<!-- code-health-report -->), with pull-requests: write and GH_TOKEN. Production scope no longer counts tracked .md/.json (documented and tested). code_health_baseline.json is refreshed for the split.

PR analysis tightens the token-shaped-secret regex so strings like task-generation-job-studio-… are not flagged; real sk-/ghp_/hf_ patterns still match.

Reviewed by Cursor Bugbot for commit 0feb124. Configure here.

@github-actions

github-actions Bot commented Sep 2, 2026

Copy link
Copy Markdown

PR Review — Loreframe Studio

Risk: medium
Scope: 38 file(s); +1992/-1470; 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

  • medium — Large pull request
    1992 additions / 1470 deletions. Reviewers will have an easier time with smaller, focused PRs.
  • 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: ui/src/features/stories/CompactBeatEditor.tsx, ui/src/features/stories/CompactCastArticle.tsx, ui/src/features/stories/CompactPrepStatus.tsx, ui/src/features/stories/CompactSequenceArticle.tsx, ui/src/features/stories/CompactSubjectEditor.tsx, ui/src/features/stories/CompactWorldArticle.tsx, ui/src/features/stories/ManualSongPanel.tsx, ui/src/features/stories/MusicCueCard.tsx, ui/src/features/stories/StoryComicProductionCard.tsx, ui/src/features/stories/StoryFilmProductionCard.tsx, ui/src/features/stories/StoryMusicHeader.tsx, ui/src/features/stories/StoryMusicProductionGuide.tsx, ui/src/features/stories/StoryMusicProductionLaunch.tsx, ui/src/features/stories/StoryMusicProductionLegacyDrawer.tsx, ui/src/features/stories/StoryMusicProductionModels.tsx, ui/src/features/stories/StoryMusicProductionSong.tsx, ui/src/features/stories/StoryMusicSettingsBar.tsx, ui/src/features/stories/StoryProductionIssuesBanner.tsx, ui/src/features/stories/StoryTrailerClipProduction.tsx, ui/src/features/stories/StoryTrailerNarrativeForm.tsx
    … and 1 more
  • modified: .github/workflows/ci.yml, docs/development/CODE_HEALTH.md, scripts/analyze_pr.py, scripts/code_health.py, scripts/code_health_baseline.json, tests/test_analyze_pr.py, tests/test_code_health.py, tests/test_model_selection_persistence.py, tests/test_story_lab_audio_ui.py, tests/test_story_lab_trailer_ui.py, ui/scripts/check-i18n-catalogs.mjs, ui/src/features/stories/CompactVideoWorkspace.tsx, ui/src/features/stories/StoryMusicTab.tsx, ui/src/features/stories/StoryProductionsMusicPanel.tsx, ui/src/features/stories/StoryProductionsTab.tsx, ui/src/features/stories/StoryTrailerTab.tsx, ui/tests/storyLabResponsive.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 2, 2026

Copy link
Copy Markdown

Code health

Metric Value
Production LOC 233,665
Production files 488
Test LOC 63,814
Functions measured 14,617
Functions complexity ≥ 15 774
Maximum complexity 667

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

Most complex functions

Complexity Where
667 app/wgp.py:7157 generate_video
373 ui/src/stores/useStore.ts:4525 Async method 'startGeneration'
356 app/_launch_runtime.py:23676 _run_generation
308 app/wgp.py:12274 generate_video_tab
272 ui/src/components/Sidebar/SceneAnimatorPanel.tsx:469 Function 'SceneAnimatorPanel'
266 ui/src/stores/useStore.ts:9647 Async method 'loadSettingsFromOutput'
258 app/services/director/planners/short_film.py:3433 ShortFilmPlanner._plan_story_driven
254 app/services/director_pipeline.py:13539 _run_video_generation
245 app/services/director_pipeline.py:7663 _run_pipeline
241 ui/src/features/agent/agentActions.ts:1077 Function 'parseAction'
227 ui/src/features/agent/agentActions.ts:2672 Async function 'executeAgentActions'
226 app/services/director_pipeline.py:6492 update_comic_preview

Trend vs baseline

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

Ratchet passed.

Comment thread scripts/code_health.py
@IAnMove

IAnMove commented Sep 2, 2026

Copy link
Copy Markdown
Owner Author

bugbot run

@cursor cursor Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

✅ Bugbot reviewed your changes and found no new issues!

1 issue from previous review remains unresolved.

Fix All in Cursor

Comment @cursor review or bugbot run to trigger another review on this PR

Reviewed by Cursor Bugbot for commit a277588. Configure here.

Extract Music, Trailer, Productions and Compact workspace into
composable panels so the files that CI treated as new 100-complexity
hotspots are no longer single functions. Refresh the code-health
baseline after that split.

CI now prints a GitHub table in the job summary and upserts the same
table as a PR comment. Markdown, JSON catalogs and tests stay out of
the product complexity scan. The token heuristic no longer matches
`task-generation-...` ids (false positive on #95).
`--markdown` without `--check` was printing **Ratchet passed.** because an
empty warning list is not None. Status is now tied to a baseline comparison.

Also rewrite the baseline after the extracted files are tracked so CI does
not warn about the split's own new files.
@IAnMove
IAnMove force-pushed the chore/code-health-report-and-split branch from a277588 to 0feb124 Compare September 2, 2026 16:32
@IAnMove

IAnMove commented Sep 2, 2026

Copy link
Copy Markdown
Owner Author

cursor review

@cursor cursor Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

✅ Bugbot reviewed your changes and found no new issues!

Comment @cursor review or bugbot run to trigger another review on this PR

Reviewed by Cursor Bugbot for commit 0feb124. Configure here.

@IAnMove
IAnMove merged commit 9d88f5d into main Sep 2, 2026
5 checks passed
@IAnMove
IAnMove deleted the chore/code-health-report-and-split branch September 5, 2026 11:53
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