Session Summary · Batch Image Processor

Interview prep, end of session

A snapshot of what was built, what passes, and what's still open on the Anthropic batch-image-processor practice problem. Files are color-coded by role; the review table flags every bug surfaced during the Phase 2 mock interview.

practice solution test tooling

01Files created

practice

image_processor_practice_impl.py

Practice template. No library named, no API cheat sheet — interview-realistic.

Stage 2 working · Stage 1 deferred
solution

image_processor_impl.py

Reference implementation: sequential loop + ProcessPoolExecutor parallel.

Complete
test

image_processor_practice_test.py

30 tests, library-agnostic. Only inspects files on disk — any library works.

All 30 pass against solution

02Test breakdown

30 tests across 4 classes. Each cell is a class; the number is its test count.

8
TestStage1PerTransform
One per op: grayscale, flip h/v, scale ±, blur, rotate 90/180.
7
TestStage1ProcessImages
Cartesian product, sequencing, JPEG mode, mixed exts, empties, nested subdirs.
11
TestStage1EdgeCases
Empty list, scale 1.0, double-flip identity, 45° expansion, kitchen sink, idempotent rerun, RGBA PNG, 1×1, blur radius 0, etc.
4
TestStage2Parallel
Correctness, 24-workitem fan-out, speed sanity, empty inputs.

03How the practice + test files evolved

Practice file

v1
Pillow imports + full API cheat sheet baked in. You flagged: "this gives me all the solution."
v2
Rewrote to "blank editor + Google open in another tab" framing. No library named, no imports, TODOs reframed as design decisions.
v3
You added Pillow imports and implemented apply_transforms, _process_image_worker, and process_images_parallel.

Test file

v1
24 tests, but unit tests were Pillow-specific — assumed your impl took/returned PIL Images.
v2
Refactored to library-agnostic: only checks files on disk. Pillow only used in the harness to create fixtures + read outputs back.
v3
Added 11 edge case tests → 30 total, all passing against the solution.

04Code review findings

From the Phase 2 mock interview review of your process_images_parallel.

# Issue Severity Status
1 with ProcessPoolExecutor as executor: missing () Crash Fixed
2 rotate(angle) without expand=True — fails dimension test Test-fail Open
3 sorted(jobs, key=...) returns new list; result discarded. Want jobs.sort(..., reverse=True) for largest-first Perf nit Open
4 Case-sensitive .endswith(...) misses .JPEG Test-fail Open
5 process_images (sequential) is still raise NotImplementedError Test-fail Deferred
6 type = transform["type"] shadows Python's built-in type Style Open
7 print(...) per output in the parallel map loop Style Open
8 Bare filenames passed to get_output_path — works with this harness, fragile in general Subtle Open

05Current test result on your code

3 / 4
Stage 2 parallel tests passing
The 4th errors only because the speed sanity check calls process_images first.

06Tooling installed this session

python

Pillow

pip install Pillow — used by both your implementation and the test harness (for fixtures + reading outputs).

claude code

html-docs skill

Installed to ~/.claude/skills/html-docs/SKILL.md. Powers this very document.

07Where to pick up next session