Artifact 42d2f783c8ce96cd0494f8df354b1aa6b3ec81500b165d7ed9e8d739e38cb5cd:
- File
internal/content/cone_reference_facts_test.go
— part of check-in
[63e0b940eb]
at
2026-10-21 00:05:34
on branch feat/submanifest-reader
— feat(sync): prototype internal prepared sparse serving lifecycle
Separate immutable cone-independent raw facts from request-local classification. Validate the observer connection, database generation and post-preparation file identity under a bound transaction. Unsupported, stale and mutating requests use dense fallback without cold cone discovery while preserving sparse-origin refusal.
Exercise real clone and pull over excluded candidates, same-request writes, observer lifecycle and durable cluster advertisements across restart. Classification and inventory remain whole-store work; this does not close sparse per-round resource bounds or expose a public lifecycle API. (user: [email protected], size: 1574) [annotate] [blame] [check-ins using] [more...]
package content import ( "context" "testing" "time" "github.com/danmestas/go-libfossil/internal/blob" "github.com/danmestas/go-libfossil/internal/deck" ) func TestConeReferenceFactsClassifyWithoutConeKey(t *testing.T) { d := setupTestDB(t) inside, inUUID, err := blob.Store(d, []byte("inside")) if err != nil { t.Fatal(err) } outside, outUUID, err := blob.Store(d, []byte("outside")) if err != nil { t.Fatal(err) } data, err := (&deck.Deck{C: "facts", D: time.Now().UTC(), U: deck.User("u"), F: []deck.FileCard{{Name: "src/a", UUID: inUUID}, {Name: "zzz/a", UUID: outUUID}}}).Marshal() if err != nil { t.Fatal(err) } if _, _, err := blob.Store(d, data); err != nil { t.Fatal(err) } facts, err := LoadConeReferenceFacts(context.Background(), d) if err != nil { t.Fatal(err) } left, err := facts.Classify(context.Background(), mustCone(t, []string{"src"}, nil)) if err != nil { t.Fatal(err) } right, err := facts.Classify(context.Background(), mustCone(t, []string{"zzz"}, nil)) if err != nil { t.Fatal(err) } if left.Outside(inside) || !left.Outside(outside) || !right.Outside(inside) || right.Outside(outside) { t.Fatal("request-local classifications share mutable policy state") } if _, err := d.Exec("UPDATE blob SET content=NULL,size=-1 WHERE rid=?", inside); err != nil { t.Fatal(err) } again, err := facts.Classify(context.Background(), mustCone(t, []string{"src"}, nil)) if err != nil || again.Outside(inside) || !again.Outside(outside) { t.Fatalf("immutable facts changed after database mutation: %v", err) } }