From ba1ee0e46ac44f6583cc3da3c9c7504c4db6ec28 Mon Sep 17 00:00:00 2001 From: Jeremy Gooch Date: Wed, 14 Oct 2026 10:34:53 -0500 Subject: [PATCH] CSTM-572: Dropping the guardrail size for ui-plugins to defer upload limits to backend --- cmd/ui_plugins/upload_bundle.go | 17 ----------------- cmd/ui_plugins/upload_bundle_test.go | 19 ------------------- 2 files changed, 36 deletions(-) diff --git a/cmd/ui_plugins/upload_bundle.go b/cmd/ui_plugins/upload_bundle.go index 697c3413..2ff283a9 100644 --- a/cmd/ui_plugins/upload_bundle.go +++ b/cmd/ui_plugins/upload_bundle.go @@ -3,7 +3,6 @@ package ui_plugins import ( "bytes" "encoding/json" - "errors" "fmt" "io" "io/fs" @@ -15,9 +14,6 @@ import ( "strings" ) -// 100MB CLI guardrail; backend enforces the real limit -const maxBundleBytes = 100 << 20 - // uploadFile is a single compiled asset to include in an asset bundle // upload. type uploadFile struct { @@ -75,8 +71,6 @@ func collectUploadFiles(root string) ([]uploadFile, error) { return nil, fmt.Errorf("output path %s is not a directory", root) } - var totalSize int64 - var errBundleTooLarge = errors.New("bundle exceeds upload guardrail") var files []uploadFile err = filepath.WalkDir(root, func(path string, d fs.DirEntry, walkErr error) error { if walkErr != nil { @@ -93,20 +87,9 @@ func collectUploadFiles(root string) ([]uploadFile, error) { if err != nil { return err } - info, err := d.Info() - if err != nil { - return err - } - totalSize += info.Size() - if totalSize > maxBundleBytes { - return errBundleTooLarge - } files = append(files, uploadFile{relPath: filepath.ToSlash(rel), absPath: path}) return nil }) - if errors.Is(err, errBundleTooLarge) { - return nil, fmt.Errorf("output directory %s exceeds the %d MB upload guardrail", root, maxBundleBytes>>20) - } if err != nil { return nil, fmt.Errorf("failed to read output directory %s: %w", root, err) } diff --git a/cmd/ui_plugins/upload_bundle_test.go b/cmd/ui_plugins/upload_bundle_test.go index 8d84c433..13fbd63a 100644 --- a/cmd/ui_plugins/upload_bundle_test.go +++ b/cmd/ui_plugins/upload_bundle_test.go @@ -90,25 +90,6 @@ func TestCollectUploadFiles(t *testing.T) { t.Fatalf("dotfiles should be skipped, got: %v", got) } }) - - t.Run("exceeds size guardrail", func(t *testing.T) { - dir := t.TempDir() - f, err := os.Create(filepath.Join(dir, "big.js")) - if err != nil { - t.Fatal(err) - } - // Sparse file: sets the reported size without writing the bytes. - if err := f.Truncate(maxBundleBytes + 1); err != nil { - f.Close() - t.Fatal(err) - } - f.Close() - - _, err = collectUploadFiles(dir) - if err == nil || !strings.Contains(err.Error(), "guardrail") { - t.Fatalf("expected size-guardrail error, got: %v", err) - } - }) } func TestContentTypeForPath(t *testing.T) {