Implements issue #142 — .kc checkout pipeline that repacks silo/ entries with current DB state before serving downloads. When a client downloads a .kc file via GET /api/items/{pn}/file/{rev}, the server now: 1. Reads the file from storage into memory 2. Checks for silo/ directory (plain .fcstd files bypass packing) 3. Repacks silo/ entries with current item_metadata + revision history 4. Streams the repacked ZIP to the client New files: - internal/kc/pack.go: Pack() replaces silo/ entries in ZIP, preserving all non-silo entries (FreeCAD files, thumbnails) with original compression and timestamps. HasSiloDir() for lightweight detection. - internal/api/pack_handlers.go: packKCFile server helper, computeETag, canSkipRepack lazy optimization. ETag caching: - ETag computed from revision_number + metadata.updated_at - If-None-Match support returns 304 Not Modified before reading storage - Cache-Control: private, must-revalidate Lazy packing optimization: - Skips repack if revision_hash matches and metadata unchanged since upload Phase 2 packs: manifest.json, metadata.json, history.json, dependencies.json (empty []). Approvals, macros, jobs deferred to Phase 3-5. Closes #142
6.5 KiB
6.5 KiB