feat(storage): explode .kc/.fcstd archives for XML-level revision diffing #176
Reference in New Issue
Block a user
Delete Branch "%!s()"
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?
Context
From GAP_ANALYSIS.md Open Question #4: "Exploded FCStd storage for better diffing?"
Decision: Yes. Explode
.kcand.fcstdZIP archives on commit and store the extracted tree alongside the original archive. This enables meaningful XML-level diffs in revision history. Add a retention policy for exploded trees viaconfig.yaml.Current Behavior
Files are stored as opaque blobs in
{root_dir}/{fileKey}. A.kcfile is a ZIP bundle containingDocument.xml,GuiDocument.xml, BREP geometry files, thumbnails, and thesilo/metadata directory. Currently there is no way to see what changed between two revisions at the file content level — only property/metadata diffs are available viaGET /api/items/{pn}/revisions/compare.Proposed Behavior
Storage Layout
When a
.kcor.fcstdfile is uploaded, the server:_exploded/directory:Diff API
Extend the existing revision comparison endpoint:
Response adds a
file_changessection:Retention Policy
Exploded trees can be large. Add configurable retention:
When an exploded tree is cleaned up, only the
_exploded/directory is deleted — the original archive is retained (subject to the separate revision retention policy from #175).Extraction Rules
.kcand.fcstdfiles are exploded (check file extension)Files to Modify
internal/storage/filesystem.go— addExplode(key string) errormethod that extracts ZIP to{key}_exploded/internal/api/handlers.goorinternal/api/file_handlers.go— callExplode()after successful file upload for.kc/.fcstdfilesinternal/api/handlers.go— extendHandleCompareRevisions()to include file-level diffs wheninclude_file_diff=trueinternal/config/config.go— addExplodeArchives,ExplodedRetentionfields toStorageConfigDependencies
Related