refactor: isolate caption render planning - #5
Open
anaschatz wants to merge 1 commit into
Open
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
Per-frame caption cue selection, cue normalization, typography defaults, and Budget Friendly kinetic calculations were embedded in the 7.5k-line
clipper.py, making these deterministic rules difficult to characterize independently.Scope
caption_render_planning.py._CaptionRenderer, drawing,_editorial_kinetic_state,caption_index,_render_elapsed, and all existing patch points inclipper.py.Explicit non-goals: no cue grouping/timing changes; no font, layout, safe-box, coordinate, pixel, Pillow/OpenCV, FFmpeg, cache, provider, API, migration, infrastructure, or video-output changes.
Architecture
The new module imports only
typing; it has no environment, filesystem, logging, subprocess, NumPy, OpenCV, Pillow, orclipper.pydependency.Provenance and size
33338d72cfa5de94370c0f2609fadf35f8057ae8f300a78f30df6170b3d86505e5ffd6f1f26da72dclipper.py: 7,590 -> 7,468 LOC (-122)The small positive total provides explicit immutable result contracts and a separately testable pure boundary while shrinking the monolithic facade.
Characterization-first evidence
Full regression results
npm run lint: passnpm run build: passnpm test: 1,683 pass / 7 skip / 0 fail37ef626b9901ad2eeb1056d47954d88cdf2ede6430cc80e449bd5f9c7a91f9c9, unchangedd62ce934e038d9026263ce2be7efa5f0c6e3ffac8a583d7b23b609540a5f4fe9, unchangedLimitations
The full browser suite needs normal host browser permissions; sandboxed Chrome exited with
EPERM, while the same locked suite passed with browser permissions.npm auditreports five moderate transitive findings and no high/critical issue; dependency upgrades are outside this refactor.Next slice
Characterize and isolate caption cue grouping/timing planning only, without combining font resolution, drawing, or render behavior changes.