Artifact dda4085b1dbeac5f1eb74e418e3c0167934957f4a75c98dd8cbe3151f9bfcc54:
- File
conformance/horizon_seedrefuse_zit_test.go
— part of check-in
[cfa0577b2a]
at
2026-10-24 06:49:28
on branch main
— test(conformance): re-pin the horizon draft to the zit 0.7.1 text
Pin draft-fossil-horizon-00 at zit 236b7b4285 (artifact 130b85e386), which adds named horizons (§6.2.7), the origin's own seed label and the refusal of a pushed seed on expanded content (§5.2.2, §5.2.3, §5.7), and the seed's horizon-seed binding card with the clone's checks on it.
Re-read horizon.tsv against the new text: the seed-label, push-check and named-horizon rows follow its wording; the client rows of named horizons move from §6.3 to §6.2.7 (HZ-6.2-19 to HZ-6.2-21); the store-local judging of a late seed and the binding-card shape refusal get rows of their own (HZ-5.2-9, HZ-5.2-10). The binding card, its no-derive rule, the clone's binding and D-floor checks and the separate seed-signing namespace (HZ-5.2-8, HZ-5.2-11 to HZ-5.2-13) are not built and show as gaps. (user: [email protected], size: 3298) [annotate] [blame] [check-ins using] [more...]
package conformance import ( "context" "net/http/httptest" "os" "path/filepath" "strings" "testing" "time" libfossil "github.com/danmestas/go-libfossil/internal/fsltype" "github.com/danmestas/go-libfossil/internal/manifest" "github.com/danmestas/go-libfossil/internal/repo" "github.com/danmestas/go-libfossil/internal/sync" "github.com/danmestas/go-libfossil/internal/tag" "github.com/danmestas/go-libfossil/simio" ) // TestZitHorizonSeedRefuseInterop pushes, from zit, a control artifact // bearing go-libfossil's seed label to a go-libfossil origin, which refuses // the whole push with the seed-refused error card (horizon §5.2.3). zit // 0.7.0 keeps the seed it holds out of every push, so the // artifact reaches zit as ordinary content: a go-libfossil clone of the // origin writes it, and zit clones that clone. The reverse direction, a // zit origin refusing its own label, waits for zit 0.7.1. func TestZitHorizonSeedRefuseInterop(t *testing.T) { bin := zitHorizonBinary(t) origin, err := repo.Create(filepath.Join(t.TempDir(), "origin.fossil"), "u", simio.CryptoRand{}, "") if err != nil { t.Fatal(err) } defer origin.Close() if _, err := origin.DB().Exec("UPDATE user SET cap='gio' WHERE login='nobody'"); err != nil { t.Fatal(err) } when := time.Date(2026, 10, 1, 0, 0, 0, 0, time.UTC) if _, _, err := manifest.Checkin(origin, manifest.CheckinOpts{Files: []manifest.File{{Name: "c1", Content: []byte("c1\n")}}, Comment: "c1", User: "u", Time: when}); err != nil { t.Fatal(err) } server := httptest.NewServer(&hzRecorder{r: origin}) defer server.Close() dir := t.TempDir() home := filepath.Join(dir, "home") if err := os.Mkdir(home, 0o755); err != nil { t.Fatal(err) } mid, _, err := sync.Clone(context.Background(), filepath.Join(dir, "mid.fossil"), &sync.HTTPTransport{URL: server.URL}, sync.CloneOpts{}) if err != nil { t.Fatal(err) } defer mid.Close() if _, err := mid.DB().Exec("UPDATE user SET cap='gio' WHERE login='nobody'"); err != nil { t.Fatal(err) } var c1 libfossil.FslID if err := mid.DB().QueryRow("SELECT objid FROM event WHERE type='ci'").Scan(&c1); err != nil { t.Fatal(err) } labelled, err := tag.AddTag(mid, tag.TagOpts{TargetRID: c1, TagName: "seedtest", TagType: tag.TagSingleton, Value: "a", User: seedLoginGo, Time: when.Add(time.Hour)}) if err != nil { t.Fatal(err) } var labelledUUID string if err := mid.DB().QueryRow("SELECT uuid FROM blob WHERE rid=?", labelled).Scan(&labelledUUID); err != nil { t.Fatal(err) } midServer := httptest.NewServer(&hzRecorder{r: mid}) defer midServer.Close() zd := filepath.Join(dir, "zdense") zitRun(t, bin, home, dir, "clone", midServer.URL, zd, "--no-open", "--once") out, err := zitCommand(bin, home, zd, "push", server.URL) if err == nil || !strings.Contains(out, "seed refused: a seed is private to the clone that holds it; it is never pushed") { t.Fatalf("zit's push of a go-libfossil-labelled control artifact: %v\n%s", err, out) } // The igot round left a phantom for it, which the origin asked for. var held bool if err := origin.DB().QueryRow("SELECT EXISTS(SELECT 1 FROM blob WHERE uuid=? AND size>=0)", labelledUUID).Scan(&held); err != nil { t.Fatal(err) } if held { t.Fatal("the origin stored the refused artifact") } }