# S03: Preset System + Engine Docker Packaging

**Goal:** Implement preset system (sign, patch, stencil, detailed, custom) as JSON config files and package engine as standalone Docker container with healthcheck.
**Demo:** After this: GET /engine/presets returns all presets; each preset produces distinct output from same input; engine runs in Docker

## Tasks
- [x] **T01: Implemented 5 preset configs (sign, patch, stencil, detailed, custom), preset loader with param resolution, GET /engine/presets endpoint, and wired preset selection into /engine/trace pipeline** — 1. Create engine/presets/ directory
2. Define 5 preset JSON files: sign.json, patch.json, stencil.json, detailed.json, custom.json
3. Each preset specifies: preprocessing params, vectorization mode + params, postprocessing params
4. Create engine/presets/loader.py to load presets from directory
5. Implement GET /engine/presets endpoint returning all presets
6. Wire preset selection into /engine/trace — preset params as defaults, params field overrides
7. Test: same image with different presets produces different output
  - Estimate: 45min
  - Files: engine/presets/sign.json, engine/presets/patch.json, engine/presets/stencil.json, engine/presets/detailed.json, engine/presets/custom.json, engine/presets/loader.py, engine/api/routes.py
  - Verify: cd engine && python -m pytest tests/ -v -k preset
- [x] **T02: Created multi-stage Dockerfile.engine with healthcheck endpoint; container builds, starts, and responds healthy on /engine/health** — 1. Create docker/Dockerfile.engine (multi-stage build)
2. Install system deps: libopencv, potrace libs
3. Install Python deps from pyproject.toml
4. Add healthcheck endpoint: GET /engine/health → {status: 'ok'}
5. Configure Dockerfile HEALTHCHECK instruction
6. Build and test container starts
7. Verify API responds from inside container
8. Ensure no App dependencies in engine image
  - Estimate: 30min
  - Files: docker/Dockerfile.engine, engine/api/routes.py
  - Verify: cd /vmPool/r/repos/xpltdco/kerf && docker build -f docker/Dockerfile.engine -t kerf-engine:dev . && docker run --rm -d --name kerf-engine-test -p 8100:8000 kerf-engine:dev && sleep 5 && curl -s http://localhost:8100/engine/health && docker stop kerf-engine-test
