fix(handoff): 修复搬运默认上限及云端接收目录挂载
build / build (push) Successful in 1m29s

This commit is contained in:
姚章浩
2026-10-30 22:37:18 +08:00
parent 657fd251fb
commit 52c0186172
6 changed files with 51 additions and 3 deletions
+34
View File
@@ -0,0 +1,34 @@
package libraryhandoff
import (
"context"
"testing"
"time"
)
func TestDefaultLimitsAllowRealBundleRoundTrip(t *testing.T) {
root, archive := newArchive(t)
id := seal(t, archive)
f := newFixture(t, root)
f.cfg.MaxBundleBytes = 0
f.cfg.OpTimeout = 0
h, err := New(f.cfg, time.Now)
if err != nil {
t.Fatal(err)
}
want := Identity{SnapshotID: id, Scope: "internal", TenantID: fixtureTenant, KnowledgeBaseID: fixtureKB}
if _, err := h.Push(context.Background(), want); err != nil {
t.Fatalf("omitted limits must allow a real bundle: %v", err)
}
fresh, _ := newArchive(t)
cfg := withLocalArchive(t, f, fresh)
cfg.MaxBundleBytes = 0
cfg.OpTimeout = 0
down, err := New(cfg, time.Now)
if err != nil {
t.Fatal(err)
}
if _, err := down.Fetch(context.Background(), id); err != nil {
t.Fatalf("omitted limits must allow verified fetch: %v", err)
}
}
+1 -1
View File
@@ -71,7 +71,7 @@ const (
TransportLocal = "local"
)
func (c Config) validate() error {
func (c *Config) validate() error {
missing := make([]string, 0, 6)
if c.Transport == TransportLocal {
// fixture 通道没有 ssh,但必须有显式隔离根:否则"本地目录"会被当成云端。