feat(kc): checkout packing + ETag caching (Phase 2) #150
Reference in New Issue
Block a user
Delete Branch "feat/kc-checkout-packing"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Implements issue #142 — .kc checkout pipeline that repacks
silo/entries with current DB state before serving downloads.Depends on: #149 (Phase 1 — commit extraction + metadata API)
Checkout pipeline
When a client downloads a
.kcfile viaGET /api/items/{pn}/file/{rev}, the server now:silo/directory (plain.fcstdfiles bypass packing entirely)item_metadata+ revisions for current server statesilo/entries in the ZIP with fresh dataNon-silo entries (Document.xml, thumbnails, .brp files) are copied verbatim with original compression methods and timestamps preserved.
Packed entries (Phase 2)
silo/manifest.jsonitem_metadata+itemstablesilo/metadata.jsonitem_metadata.fields+ tags + lifecyclesilo/history.jsonsilo/dependencies.json[](populated in Phase 3)Approvals, macros, and jobs are omitted — they'll be added in Phase 3-5.
ETag caching
revision_number:metadata.updated_at, truncated to 16 hex charsprivate, must-revalidateLazy packing optimization
Skips the expensive ZIP rewrite when the stored blob is already current:
revision_hashmatches current headmetadata.updated_atis older than the blob's upload timeNew files
internal/kc/pack.go—Pack()andHasSiloDir()functions (pure library, 7 unit tests)internal/api/pack_handlers.go—packKCFile,computeETag,canSkipRepackhelpersModified files
internal/kc/kc.go— AddedHistoryEntryandPackInputtypesinternal/api/handlers.go— RestructuredHandleDownloadFilewith packing + ETag logicCloses #142