## Implementation Plan **Objective:** Fix the `size` parameter for SVG avatar endpoints so that the returned SVG respects the requested pixel dimensions. ### Changes Required 1. **Modify `generate_avatar_svg()` in `devplacepy/avatar.py`** - Add a `size: int` parameter to the function signature. - Include `width="{size}"` and `height="{size}"` attributes on the root `` element. - Keep `viewBox="0 0 100 100"` unchanged so the interior grid scales proportionally. 2. **Update the SVG route handler** (likely `devplacepy/routers/avatar.py`) - Clamp the `size` parameter to the range `[16, 512]` (matching the devRant PNG endpoint). - Pass `size` to `generate_avatar_svg()`. - Change the cache key from bare `seed` to `f"{seed}:{size}"` for both lookup and storage. - Ensure the `ETag` header already uses `f"{seed}:{size}"` (confirmed correct; may double-check). 3. **Add/update test coverage** - In `tests/api/avatar.py`, after asserting status 200 and content‑type, verify that the response body contains `width="{requested_size}"` and `height="{requested_size}"` when `?size=` is provided. - Add a new test that requests the same `seed` with two distinct `size` values and asserts that the bodies are not identical (or that `ETag` values differ). - Ensure the existing test for `avatar_url()` still passes (it only checks URL generation, not the wire response). 4. **Run project verification commands** - `pip install -e '.[dev]' -q && make test-unit` - `pip install -q ruff && ruff check .` --- ## Definition of Done - [ ] `generate_avatar_svg(seed, size)` is modified to accept `size` and produce an `` with `width=""` and `height=""`. - [ ] The SVG route clamps `size` (16–512) and passes it to `generate_avatar_svg()`. - [ ] Cache key in the SVG route is `"{seed}:{size}"` (not bare `seed`). - [ ] New tests confirm that the SVG response contains the correct `width`/`height` for a given `size`, and that different sizes produce distinct responses. - [ ] All existing tests pass when running `make test-unit`. - [ ] `ruff check .` reports zero errors. - [ ] Manual spot‑check: requesting `/avatars/u/test.svg?size=32` returns SVG with `width="32" height="32"`; same seed with `?size=128` returns SVG with those different dimensions and a different `ETag`.