Skip to content

fix: address 9 code-review findings#25

Merged
marsmike merged 1 commit into
mainfrom
fix/review-findings
May 22, 2026
Merged

fix: address 9 code-review findings#25
marsmike merged 1 commit into
mainfrom
fix/review-findings

Conversation

@marsmike
Copy link
Copy Markdown
Owner

Summary

Nine bugs found during a recall-mode code review, fixed across both packages.

Critical (data loss / crash)

  • pptx_decompile.pypic_idx_ref counter lambda was recreated inside the per-shape loop, giving every picture on a slide pic_idx=1 and overwriting the same asset filename; counter list is now created once per slide
  • image_preflight.py_extract_dominant_colors divided by total_pixels without guarding against zero; 0×N images now return early with []
  • deck/orchestrate.pyentry["content"] was passed as ctx to interpolate_nodes without a None-check; a YAML slide with content: ~ crashed the build

High (feature broken / silent wrong result)

  • verify/cache.pysave() wrote directly via write_text, leaving a truncated .verify_cache.json on SIGINT; now uses temp-file + Path.replace for atomic write
  • verify/autofix.py_find_smaller_layout / _find_larger_layout resolved core layout paths via __file__.parents[2].parent, which is wrong in any pip-installed deployment; now uses feinschliff.layout_discovery.find_layout
  • verify/static.py_flatten_content_keys only emitted str leaves; int/float/bool slot values were silently dropped, causing false EMPTY_PLACEHOLDER warnings for numeric content

Low (edge cases / poor error messages)

  • brand_discovery.py$image_provider dict was stored without checking for the kind key; callers do cfg["kind"] directly, so a misconfigured brand would crash with a KeyError instead of a clear message
  • dsl/tokens.py — bare json.loads() in the brand-inheritance merge loop had no error handling; now wraps with a ValueError naming the brand directory
  • dsl/expander.pyvirtual_w/virtual_h used or w/or h fallback; an explicit integer 0 was silently replaced by the slot dimension

Test plan

  • uv run pytest feinschliff/tests/ feinschliff-builder/tests/ -x -q — 727 pass, 1 pre-existing skip (npx not installed), no regressions
  • Decompile a PPTX with 2+ images on one slide and verify both get distinct filenames
  • Run feinschliff-builder verify on a deck, send SIGINT mid-run, restart — cache should be intact

🤖 Generated with Claude Code

…builder

- decompile/pptx_decompile: move pic counter list outside shape loop so
  multiple pictures on a slide get distinct indices instead of all being 1
- io/image_preflight: guard _extract_dominant_colors against zero-pixel
  images to prevent ZeroDivisionError
- verify/cache: write cache via temp-file + rename for atomic persistence;
  a SIGINT mid-write no longer corrupts .verify_cache.json
- verify/autofix: replace __file__.parents path hack for layout lookup with
  feinschliff.layout_discovery.find_layout, which works in installed mode
- verify/static: _flatten_content_keys now emits non-string leaf values
  (int, float, bool) as str so numeric slots are visible to static checks
- deck/orchestrate: guard entry["content"] with `or {}` so a YAML slide
  with content: ~ does not crash interpolate_nodes with ctx=None
- brand_discovery: require "kind" key to be present in $image_provider
  dict before storing, preventing a KeyError in callers
- dsl/tokens: wrap bare json.loads in merge loop with a ValueError that
  names the brand directory, replacing an opaque JSONDecodeError
- dsl/expander: use `is not None` for virtual_w/virtual_h fallback so an
  explicit integer 0 is not silently replaced by the slot dimension

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Signed-off-by: Mike Mueller <mike@objektarium.de>
@marsmike marsmike merged commit 5244fa8 into main May 22, 2026
3 checks passed
@marsmike marsmike deleted the fix/review-findings branch May 22, 2026 08:20
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