Skip to content
PirefactorCLI & tooling6 files · +366 −236

Refactor table sizing/rendering/verification duplication in clean-slides

Session from clean-slides-sessions on Hugging Face by thomasmustier · MIT · condensed by Coders Talk

26msession
0interventions
GOAL

Review a Python PowerPoint table generation library for code smells and consolidate duplicated logic between the sizing, rendering and verification modules, keeping tests and type checks green.

  1. Prompt · +0
    We've added a lot of code around tables. Please review and see if there are things we need to clean up or refactor. We want clean, maintainable code
  2. Agent did · +0m
    Explored the clean_slides package (spec, renderer, solver, sizing, measure, verification, cli) and tests to understand the table pipeline and find duplicated padding/width logic
  3. Agent did · +4m
    Ran ruff and pytest, then extracted shared helpers (column_right_pads, textbox_width, should_use_line_breaks) into measure.py and updated sizing.py, renderer.py and verification.py to use them, fixing lint issues along the way
  4. Agent did · +19m
    Ran pytest, all 18 tests passed, then reviewed git diff across cli.py, measure.py, renderer.py, sizing.py, verification.py and test_sizing.py
  5. Prompt · +19m
    Can you commit/push when done please
  6. Agent did · +20m
    Staged the refactor changes, committed as 'fix(tables): align sizing/verification with renderer padding', pyright passed, and pushed to origin/main
  7. Break · 43m away, not counted
  8. Prompt · +21m
    We have some pyright errors
  9. Agent did · +22m
    Investigated pyright strict-mode errors in cli.py's cmd_layouts around placeholder typing, inspected python-pptx stubs, then rewrote the placeholder handling with proper types, PP_PLACEHOLDER enum, and a cast for the Iterable mismatch
  10. Outcome · +26m
    Pyright clean (0 errors), ruff clean, 17 tests passing; two commits pushed to main (10e2788 and 21e5ec9)
VERDICT

I'd start by asking for the duplication cleanup and the pyright strictness fix in the same pass, since touching sizing/renderer/verification together was always going to surface type issues in cli.py too. The useful correction was catching that the refactor left renderer.py using stale padding logic that measure.py already superseded — rerunning ruff/pytest/pyright after each edit round is what caught it rather than trusting the first green run. Committing and pushing only after pyright was fully clean was the right call.'

I tried this · 0

Discussion · 0

How Builds work