Skip to content

Harden Manim quality validation: off-screen layout checks and single-font lint#20

Draft
jmjava wants to merge 1 commit intomainfrom
cursor/validation-lint-hardening-b171
Draft

Harden Manim quality validation: off-screen layout checks and single-font lint#20
jmjava wants to merge 1 commit intomainfrom
cursor/validation-lint-hardening-b171

Conversation

@jmjava
Copy link
Copy Markdown
Owner

@jmjava jmjava commented Apr 14, 2026

Summary

This PR strengthens Manim quality safeguards with extended validation and tests focused on:

  • off-screen / edge clipping and weak positioning
  • readability and contrast clarity
  • single-font-family consistency in scene source
  • font pitfalls (weight=BOLD, positional Text color)

What changed

1) Extended layout/positioning checks (manim_layout.py)

LayoutValidator now performs broader frame sampling and stronger checks:

  • configurable sampling interval across the full video
  • edge safe-zone clipping detection
  • overlap and minimum spacing checks
  • text density checks (max_text_regions)
  • minimum text-height readability checks (min_text_height_px)
  • contrast ratio checks (min_contrast_ratio)

It now degrades gracefully when tesseract is unavailable:

  • returns a passed report with a warning issue (tesseract unavailable; layout checks skipped)

2) Integrated Manim layout into main validator (validate.py)

Validator.validate_segment() now includes:

  • layout_quality check for Manim segments

run_pre_push() treats layout_quality as a hard failure (not soft warning), so off-screen/layout regressions in Manim recordings are blocked.

3) Added static Manim scene lint (manim_scene_lint.py)

New source-level lint checks for animations/scenes.py:

  • require Text.set_default(font=...)
  • enforce expected single font family (manim.font, default Liberation Sans)
  • detect mixed font families across defaults and explicit Text(..., font=...)
  • deny weight=BOLD
  • deny positional Text color arguments (e.g. Text("x", C_BLUE, ...))

Integrated into validate.py as manim_scene_lint for Manim segments.

4) Config and init updates

Config:

  • added manim.font (default Liberation Sans)
  • added validation.layout defaults for sampling/contrast/readability/density
  • added validation.manim_lint defaults

init.py now scaffolds manim.font: Liberation Sans.

5) Demo scene cleanup to one font/no bold

Updated docs/demos/animations/scenes.py:

  • set Text.set_default(font="Liberation Sans")
  • replaced weight=BOLD usage with size/color emphasis
  • removed explicit font="Monospace" overrides to keep a single family
  • changed one check label text to avoid stale wording (no major layout issues)

6) Docs updates

README now documents new validation controls:

  • manim.font
  • validation.layout.*
  • validation.manim_lint.*

docs/demos/docgen.yaml includes manim.font and example layout/lint config.

Tests

Added:

  • tests/test_manim_layout.py (positioning/contrast/readability behavior)
  • tests/test_manim_scene_lint.py (single-font and font pitfall linting)

Verification

  • python3 -m pytest tests -q --ignore=tests/e2e -> 92 passed
  • python3 -m ruff check src tests -> All checks passed

Issue linkage

Addresses #2, #9, #10 and enforceable source-level/font-safety parts of #4.

Open in Web Open in Cursor 

…t lint

Co-authored-by: John Menke <jmjava@gmail.com>
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