feat(topdata): materialize Git-LFS asset bytes inside Crucible before packing
Adds materializeAssetLFS + hasLFSPointerStubs helpers to top_package.go. Called at the top of packageBuiltTopData so bare CI checkouts never ship ~130-byte LFS pointer stubs. Opt-out via CRUCIBLE_SKIP_LFS env or the new --skip-lfs flag on build-topdata / build-top-package. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -0,0 +1,29 @@
|
||||
package topdata
|
||||
|
||||
import (
|
||||
"os"
|
||||
"path/filepath"
|
||||
"testing"
|
||||
)
|
||||
|
||||
func TestHasLFSPointerStubsDetectsStub(t *testing.T) {
|
||||
root := t.TempDir()
|
||||
if err := os.MkdirAll(filepath.Join(root, "a"), 0o755); err != nil {
|
||||
t.Fatalf("mkdir: %v", err)
|
||||
}
|
||||
stub := "version https://git-lfs.github.com/spec/v1\noid sha256:abc\nsize 12345\n"
|
||||
writeFile(t, filepath.Join(root, "a", "model.mdl"), stub)
|
||||
writeFile(t, filepath.Join(root, "a", "real.txt"), "not a pointer, real bytes here")
|
||||
|
||||
if !hasLFSPointerStubs(root) {
|
||||
t.Fatal("expected stub detection to be true")
|
||||
}
|
||||
}
|
||||
|
||||
func TestHasLFSPointerStubsNoStub(t *testing.T) {
|
||||
root := t.TempDir()
|
||||
writeFile(t, filepath.Join(root, "real.mdl"), "binary-ish content without a pointer header")
|
||||
if hasLFSPointerStubs(root) {
|
||||
t.Fatal("expected no stub detected")
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user