From a91facf150bbc7bfbeee8f02742c274f62395d11 Mon Sep 17 00:00:00 2001 From: Lewis Date: Tue, 03 Mar 2026 12:53:03 +0000 Subject: [PATCH] lexicons, api/tangled: add repoDid field to all repo-scoped lexicons Signed-off-by: Lewis Lewis: May this revision serve well! --- api/tangled/actorprofile.go | 3 ++- api/tangled/cbor_gen.go | 1049 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++------------------------------------------------------------------------------------------------------------------------------------------------- api/tangled/feedstar.go | 7 ++++--- api/tangled/gitrefUpdate.go | 6 ++++-- api/tangled/repoartifact.go | 3 ++- api/tangled/repocollaborator.go | 5 +++-- api/tangled/repocreate.go | 18 ++++++++++++++---- api/tangled/repoissue.go | 3 ++- api/tangled/repopull.go | 12 +++++++----- api/tangled/tangledpipeline.go | 10 ++++++---- api/tangled/tangledrepo.go | 2 ++ knotmirror/knotstream/slurper.go | 10 +++++++--- lexicons/actor/profile.json | 9 +++++++++ lexicons/feed/star.json | 5 ++++- lexicons/git/refUpdate.json | 8 ++++++-- lexicons/issue/issue.json | 6 +++++- lexicons/pipeline/pipeline.json | 6 +++++- lexicons/pulls/pull.json | 9 ++++++++- lexicons/repo/artifact.json | 5 ++++- lexicons/repo/collaborator.json | 5 ++++- lexicons/repo/create.json | 24 +++++++++++++++++++++++- lexicons/repo/repo.json | 5 +++++ spindle/models/clone_test.go | 24 +++++++++++++----------- spindle/models/pipeline_env_test.go | 12 ++++++------ 24 file(s) changed, 1049 insertion(s)(+), 197 deletion(s)(-) diff --git a/api/tangled/actorprofile.go b/api/tangled/actorprofile.go --- a/api/tangled/actorprofile.go +++ b/api/tangled/actorprofile.go @@ -28,7 +28,8 @@ // location: Free-form location text. Location *string `json:"location,omitempty" cborgen:"location,omitempty"` // pinnedRepositories: Any ATURI, it is up to appviews to validate these fields. - PinnedRepositories []string `json:"pinnedRepositories,omitempty" cborgen:"pinnedRepositories,omitempty"` + PinnedRepositories []string `json:"pinnedRepositories,omitempty" cborgen:"pinnedRepositories,omitempty"` + PinnedRepositoryDids []string `json:"pinnedRepositoryDids,omitempty" cborgen:"pinnedRepositoryDids,omitempty"` // preferredHandle: A handle the user prefers to be displayed as. PreferredHandle *string `json:"preferredHandle,omitempty" cborgen:"preferredHandle,omitempty"` // pronouns: Preferred gender pronouns. diff --git a/api/tangled/cbor_gen.go b/api/tangled/cbor_gen.go --- a/api/tangled/cbor_gen.go +++ b/api/tangled/cbor_gen.go @@ -26,7 +26,7 @@ } cw := cbg.NewCborWriter(w) - fieldCount := 10 + fieldCount := 11 if t.Avatar == nil { fieldCount-- @@ -45,6 +45,10 @@ } if t.PinnedRepositories == nil { + fieldCount-- + } + + if t.PinnedRepositoryDids == nil { fieldCount-- } @@ -353,6 +357,42 @@ } } + + // t.PinnedRepositoryDids ([]string) (slice) + if t.PinnedRepositoryDids != nil { + + if len("pinnedRepositoryDids") > 1000000 { + return xerrors.Errorf("Value in field \"pinnedRepositoryDids\" was too long") + } + + if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len("pinnedRepositoryDids"))); err != nil { + return err + } + if _, err := cw.WriteString(string("pinnedRepositoryDids")); err != nil { + return err + } + + if len(t.PinnedRepositoryDids) > 8192 { + return xerrors.Errorf("Slice value in field t.PinnedRepositoryDids was too long") + } + + if err := cw.WriteMajorTypeHeader(cbg.MajArray, uint64(len(t.PinnedRepositoryDids))); err != nil { + return err + } + for _, v := range t.PinnedRepositoryDids { + if len(v) > 1000000 { + return xerrors.Errorf("Value in field v was too long") + } + + if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len(v))); err != nil { + return err + } + if _, err := cw.WriteString(string(v)); err != nil { + return err + } + + } + } return nil } @@ -381,7 +421,7 @@ n := extra - nameBuf := make([]byte, 18) + nameBuf := make([]byte, 20) for i := uint64(0); i < n; i++ { nameLen, ok, err := cbg.ReadFullStringIntoBuf(cr, nameBuf, 1000000) if err != nil { @@ -650,6 +690,46 @@ } } + // t.PinnedRepositoryDids ([]string) (slice) + case "pinnedRepositoryDids": + + maj, extra, err = cr.ReadHeader() + if err != nil { + return err + } + + if extra > 8192 { + return fmt.Errorf("t.PinnedRepositoryDids: array too large (%d)", extra) + } + + if maj != cbg.MajArray { + return fmt.Errorf("expected cbor array") + } + + if extra > 0 { + t.PinnedRepositoryDids = make([]string, extra) + } + + for i := 0; i < int(extra); i++ { + { + var maj byte + var extra uint64 + var err error + _ = maj + _ = extra + _ = err + + { + sval, err := cbg.ReadStringWithMax(cr, 1000000) + if err != nil { + return err + } + + t.PinnedRepositoryDids[i] = string(sval) + } + + } + } default: // Field doesn't exist on this type, so ignore it @@ -866,8 +946,17 @@ } cw := cbg.NewCborWriter(w) + fieldCount := 4 - if _, err := cw.Write([]byte{163}); err != nil { + if t.Subject == nil { + fieldCount-- + } + + if t.SubjectDid == nil { + fieldCount-- + } + + if _, err := cw.Write(cbg.CborEncodeMajorType(cbg.MajMap, uint64(fieldCount))); err != nil { return err } @@ -891,26 +980,35 @@ } // t.Subject (string) (string) - if len("subject") > 1000000 { - return xerrors.Errorf("Value in field \"subject\" was too long") - } + if t.Subject != nil { - if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len("subject"))); err != nil { - return err - } - if _, err := cw.WriteString(string("subject")); err != nil { - return err - } + if len("subject") > 1000000 { + return xerrors.Errorf("Value in field \"subject\" was too long") + } - if len(t.Subject) > 1000000 { - return xerrors.Errorf("Value in field t.Subject was too long") - } + if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len("subject"))); err != nil { + return err + } + if _, err := cw.WriteString(string("subject")); err != nil { + return err + } - if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len(t.Subject))); err != nil { - return err - } - if _, err := cw.WriteString(string(t.Subject)); err != nil { - return err + if t.Subject == nil { + if _, err := cw.Write(cbg.CborNull); err != nil { + return err + } + } else { + if len(*t.Subject) > 1000000 { + return xerrors.Errorf("Value in field t.Subject was too long") + } + + if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len(*t.Subject))); err != nil { + return err + } + if _, err := cw.WriteString(string(*t.Subject)); err != nil { + return err + } + } } // t.CreatedAt (string) (string) @@ -934,6 +1032,38 @@ } if _, err := cw.WriteString(string(t.CreatedAt)); err != nil { return err + } + + // t.SubjectDid (string) (string) + if t.SubjectDid != nil { + + if len("subjectDid") > 1000000 { + return xerrors.Errorf("Value in field \"subjectDid\" was too long") + } + + if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len("subjectDid"))); err != nil { + return err + } + if _, err := cw.WriteString(string("subjectDid")); err != nil { + return err + } + + if t.SubjectDid == nil { + if _, err := cw.Write(cbg.CborNull); err != nil { + return err + } + } else { + if len(*t.SubjectDid) > 1000000 { + return xerrors.Errorf("Value in field t.SubjectDid was too long") + } + + if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len(*t.SubjectDid))); err != nil { + return err + } + if _, err := cw.WriteString(string(*t.SubjectDid)); err != nil { + return err + } + } } return nil } @@ -963,7 +1093,7 @@ n := extra - nameBuf := make([]byte, 9) + nameBuf := make([]byte, 10) for i := uint64(0); i < n; i++ { nameLen, ok, err := cbg.ReadFullStringIntoBuf(cr, nameBuf, 1000000) if err != nil { @@ -994,12 +1124,22 @@ case "subject": { - sval, err := cbg.ReadStringWithMax(cr, 1000000) + b, err := cr.ReadByte() if err != nil { return err } + if b != cbg.CborNull[0] { + if err := cr.UnreadByte(); err != nil { + return err + } - t.Subject = string(sval) + sval, err := cbg.ReadStringWithMax(cr, 1000000) + if err != nil { + return err + } + + t.Subject = (*string)(&sval) + } } // t.CreatedAt (string) (string) case "createdAt": @@ -1011,6 +1151,27 @@ } t.CreatedAt = string(sval) + } + // t.SubjectDid (string) (string) + case "subjectDid": + + { + b, err := cr.ReadByte() + if err != nil { + return err + } + if b != cbg.CborNull[0] { + if err := cr.UnreadByte(); err != nil { + return err + } + + sval, err := cbg.ReadStringWithMax(cr, 1000000) + if err != nil { + return err + } + + t.SubjectDid = (*string)(&sval) + } } default: @@ -1030,8 +1191,17 @@ } cw := cbg.NewCborWriter(w) + fieldCount := 9 - if _, err := cw.Write([]byte{168}); err != nil { + if t.OwnerDid == nil { + fieldCount-- + } + + if t.RepoDid == nil { + fieldCount-- + } + + if _, err := cw.Write(cbg.CborEncodeMajorType(cbg.MajMap, uint64(fieldCount))); err != nil { return err } @@ -1140,26 +1310,67 @@ } // t.RepoDid (string) (string) - if len("repoDid") > 1000000 { - return xerrors.Errorf("Value in field \"repoDid\" was too long") + if t.RepoDid != nil { + + if len("repoDid") > 1000000 { + return xerrors.Errorf("Value in field \"repoDid\" was too long") + } + + if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len("repoDid"))); err != nil { + return err + } + if _, err := cw.WriteString(string("repoDid")); err != nil { + return err + } + + if t.RepoDid == nil { + if _, err := cw.Write(cbg.CborNull); err != nil { + return err + } + } else { + if len(*t.RepoDid) > 1000000 { + return xerrors.Errorf("Value in field t.RepoDid was too long") + } + + if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len(*t.RepoDid))); err != nil { + return err + } + if _, err := cw.WriteString(string(*t.RepoDid)); err != nil { + return err + } + } } - if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len("repoDid"))); err != nil { - return err - } - if _, err := cw.WriteString(string("repoDid")); err != nil { - return err - } + // t.OwnerDid (string) (string) + if t.OwnerDid != nil { - if len(t.RepoDid) > 1000000 { - return xerrors.Errorf("Value in field t.RepoDid was too long") - } + if len("ownerDid") > 1000000 { + return xerrors.Errorf("Value in field \"ownerDid\" was too long") + } - if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len(t.RepoDid))); err != nil { - return err - } - if _, err := cw.WriteString(string(t.RepoDid)); err != nil { - return err + if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len("ownerDid"))); err != nil { + return err + } + if _, err := cw.WriteString(string("ownerDid")); err != nil { + return err + } + + if t.OwnerDid == nil { + if _, err := cw.Write(cbg.CborNull); err != nil { + return err + } + } else { + if len(*t.OwnerDid) > 1000000 { + return xerrors.Errorf("Value in field t.OwnerDid was too long") + } + + if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len(*t.OwnerDid))); err != nil { + return err + } + if _, err := cw.WriteString(string(*t.OwnerDid)); err != nil { + return err + } + } } // t.RepoName (string) (string) @@ -1319,12 +1530,43 @@ case "repoDid": { - sval, err := cbg.ReadStringWithMax(cr, 1000000) + b, err := cr.ReadByte() if err != nil { return err } + if b != cbg.CborNull[0] { + if err := cr.UnreadByte(); err != nil { + return err + } - t.RepoDid = string(sval) + sval, err := cbg.ReadStringWithMax(cr, 1000000) + if err != nil { + return err + } + + t.RepoDid = (*string)(&sval) + } + } + // t.OwnerDid (string) (string) + case "ownerDid": + + { + b, err := cr.ReadByte() + if err != nil { + return err + } + if b != cbg.CborNull[0] { + if err := cr.UnreadByte(); err != nil { + return err + } + + sval, err := cbg.ReadStringWithMax(cr, 1000000) + if err != nil { + return err + } + + t.OwnerDid = (*string)(&sval) + } } // t.RepoName (string) (string) case "repoName": @@ -5359,8 +5601,17 @@ } cw := cbg.NewCborWriter(w) + fieldCount := 5 - if _, err := cw.Write([]byte{164}); err != nil { + if t.Repo == nil { + fieldCount-- + } + + if t.RepoDid == nil { + fieldCount-- + } + + if _, err := cw.Write(cbg.CborEncodeMajorType(cbg.MajMap, uint64(fieldCount))); err != nil { return err } @@ -5411,26 +5662,67 @@ } // t.Repo (string) (string) - if len("repo") > 1000000 { - return xerrors.Errorf("Value in field \"repo\" was too long") + if t.Repo != nil { + + if len("repo") > 1000000 { + return xerrors.Errorf("Value in field \"repo\" was too long") + } + + if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len("repo"))); err != nil { + return err + } + if _, err := cw.WriteString(string("repo")); err != nil { + return err + } + + if t.Repo == nil { + if _, err := cw.Write(cbg.CborNull); err != nil { + return err + } + } else { + if len(*t.Repo) > 1000000 { + return xerrors.Errorf("Value in field t.Repo was too long") + } + + if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len(*t.Repo))); err != nil { + return err + } + if _, err := cw.WriteString(string(*t.Repo)); err != nil { + return err + } + } } - if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len("repo"))); err != nil { - return err - } - if _, err := cw.WriteString(string("repo")); err != nil { - return err - } + // t.RepoDid (string) (string) + if t.RepoDid != nil { - if len(t.Repo) > 1000000 { - return xerrors.Errorf("Value in field t.Repo was too long") - } + if len("repoDid") > 1000000 { + return xerrors.Errorf("Value in field \"repoDid\" was too long") + } - if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len(t.Repo))); err != nil { - return err - } - if _, err := cw.WriteString(string(t.Repo)); err != nil { - return err + if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len("repoDid"))); err != nil { + return err + } + if _, err := cw.WriteString(string("repoDid")); err != nil { + return err + } + + if t.RepoDid == nil { + if _, err := cw.Write(cbg.CborNull); err != nil { + return err + } + } else { + if len(*t.RepoDid) > 1000000 { + return xerrors.Errorf("Value in field t.RepoDid was too long") + } + + if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len(*t.RepoDid))); err != nil { + return err + } + if _, err := cw.WriteString(string(*t.RepoDid)); err != nil { + return err + } + } } // t.DefaultBranch (string) (string) @@ -5525,12 +5817,43 @@ case "repo": { - sval, err := cbg.ReadStringWithMax(cr, 1000000) + b, err := cr.ReadByte() if err != nil { return err } + if b != cbg.CborNull[0] { + if err := cr.UnreadByte(); err != nil { + return err + } - t.Repo = string(sval) + sval, err := cbg.ReadStringWithMax(cr, 1000000) + if err != nil { + return err + } + + t.Repo = (*string)(&sval) + } + } + // t.RepoDid (string) (string) + case "repoDid": + + { + b, err := cr.ReadByte() + if err != nil { + return err + } + if b != cbg.CborNull[0] { + if err := cr.UnreadByte(); err != nil { + return err + } + + sval, err := cbg.ReadStringWithMax(cr, 1000000) + if err != nil { + return err + } + + t.RepoDid = (*string)(&sval) + } } // t.DefaultBranch (string) (string) case "defaultBranch": @@ -5963,13 +6286,17 @@ } cw := cbg.NewCborWriter(w) - fieldCount := 10 + fieldCount := 11 if t.Description == nil { fieldCount-- } if t.Labels == nil { + fieldCount-- + } + + if t.RepoDid == nil { fieldCount-- } @@ -6159,6 +6486,38 @@ return err } + } + } + + // t.RepoDid (string) (string) + if t.RepoDid != nil { + + if len("repoDid") > 1000000 { + return xerrors.Errorf("Value in field \"repoDid\" was too long") + } + + if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len("repoDid"))); err != nil { + return err + } + if _, err := cw.WriteString(string("repoDid")); err != nil { + return err + } + + if t.RepoDid == nil { + if _, err := cw.Write(cbg.CborNull); err != nil { + return err + } + } else { + if len(*t.RepoDid) > 1000000 { + return xerrors.Errorf("Value in field t.RepoDid was too long") + } + + if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len(*t.RepoDid))); err != nil { + return err + } + if _, err := cw.WriteString(string(*t.RepoDid)); err != nil { + return err + } } } @@ -6458,6 +6817,27 @@ } } + // t.RepoDid (string) (string) + case "repoDid": + + { + b, err := cr.ReadByte() + if err != nil { + return err + } + if b != cbg.CborNull[0] { + if err := cr.UnreadByte(); err != nil { + return err + } + + sval, err := cbg.ReadStringWithMax(cr, 1000000) + if err != nil { + return err + } + + t.RepoDid = (*string)(&sval) + } + } // t.Spindle (string) (string) case "spindle": @@ -6550,7 +6930,15 @@ } cw := cbg.NewCborWriter(w) - fieldCount := 6 + fieldCount := 7 + + if t.Repo == nil { + fieldCount-- + } + + if t.RepoDid == nil { + fieldCount-- + } if t.Tag == nil { fieldCount-- @@ -6612,26 +7000,35 @@ } // t.Repo (string) (string) - if len("repo") > 1000000 { - return xerrors.Errorf("Value in field \"repo\" was too long") - } + if t.Repo != nil { - if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len("repo"))); err != nil { - return err - } - if _, err := cw.WriteString(string("repo")); err != nil { - return err - } + if len("repo") > 1000000 { + return xerrors.Errorf("Value in field \"repo\" was too long") + } - if len(t.Repo) > 1000000 { - return xerrors.Errorf("Value in field t.Repo was too long") - } + if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len("repo"))); err != nil { + return err + } + if _, err := cw.WriteString(string("repo")); err != nil { + return err + } - if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len(t.Repo))); err != nil { - return err - } - if _, err := cw.WriteString(string(t.Repo)); err != nil { - return err + if t.Repo == nil { + if _, err := cw.Write(cbg.CborNull); err != nil { + return err + } + } else { + if len(*t.Repo) > 1000000 { + return xerrors.Errorf("Value in field t.Repo was too long") + } + + if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len(*t.Repo))); err != nil { + return err + } + if _, err := cw.WriteString(string(*t.Repo)); err != nil { + return err + } + } } // t.LexiconTypeID (string) (string) @@ -6651,6 +7048,38 @@ } if _, err := cw.WriteString(string("sh.tangled.repo.artifact")); err != nil { return err + } + + // t.RepoDid (string) (string) + if t.RepoDid != nil { + + if len("repoDid") > 1000000 { + return xerrors.Errorf("Value in field \"repoDid\" was too long") + } + + if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len("repoDid"))); err != nil { + return err + } + if _, err := cw.WriteString(string("repoDid")); err != nil { + return err + } + + if t.RepoDid == nil { + if _, err := cw.Write(cbg.CborNull); err != nil { + return err + } + } else { + if len(*t.RepoDid) > 1000000 { + return xerrors.Errorf("Value in field t.RepoDid was too long") + } + + if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len(*t.RepoDid))); err != nil { + return err + } + if _, err := cw.WriteString(string(*t.RepoDid)); err != nil { + return err + } + } } // t.Artifact (util.LexBlob) (struct) @@ -6773,12 +7202,22 @@ case "repo": { - sval, err := cbg.ReadStringWithMax(cr, 1000000) + b, err := cr.ReadByte() if err != nil { return err } + if b != cbg.CborNull[0] { + if err := cr.UnreadByte(); err != nil { + return err + } - t.Repo = string(sval) + sval, err := cbg.ReadStringWithMax(cr, 1000000) + if err != nil { + return err + } + + t.Repo = (*string)(&sval) + } } // t.LexiconTypeID (string) (string) case "$type": @@ -6790,6 +7229,27 @@ } t.LexiconTypeID = string(sval) + } + // t.RepoDid (string) (string) + case "repoDid": + + { + b, err := cr.ReadByte() + if err != nil { + return err + } + if b != cbg.CborNull[0] { + if err := cr.UnreadByte(); err != nil { + return err + } + + sval, err := cbg.ReadStringWithMax(cr, 1000000) + if err != nil { + return err + } + + t.RepoDid = (*string)(&sval) + } } // t.Artifact (util.LexBlob) (struct) case "artifact": @@ -6840,32 +7300,50 @@ } cw := cbg.NewCborWriter(w) + fieldCount := 5 - if _, err := cw.Write([]byte{164}); err != nil { + if t.Repo == nil { + fieldCount-- + } + + if t.RepoDid == nil { + fieldCount-- + } + + if _, err := cw.Write(cbg.CborEncodeMajorType(cbg.MajMap, uint64(fieldCount))); err != nil { return err } // t.Repo (string) (string) - if len("repo") > 1000000 { - return xerrors.Errorf("Value in field \"repo\" was too long") - } + if t.Repo != nil { - if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len("repo"))); err != nil { - return err - } - if _, err := cw.WriteString(string("repo")); err != nil { - return err - } + if len("repo") > 1000000 { + return xerrors.Errorf("Value in field \"repo\" was too long") + } - if len(t.Repo) > 1000000 { - return xerrors.Errorf("Value in field t.Repo was too long") - } + if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len("repo"))); err != nil { + return err + } + if _, err := cw.WriteString(string("repo")); err != nil { + return err + } - if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len(t.Repo))); err != nil { - return err - } - if _, err := cw.WriteString(string(t.Repo)); err != nil { - return err + if t.Repo == nil { + if _, err := cw.Write(cbg.CborNull); err != nil { + return err + } + } else { + if len(*t.Repo) > 1000000 { + return xerrors.Errorf("Value in field t.Repo was too long") + } + + if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len(*t.Repo))); err != nil { + return err + } + if _, err := cw.WriteString(string(*t.Repo)); err != nil { + return err + } + } } // t.LexiconTypeID (string) (string) @@ -6885,6 +7363,38 @@ } if _, err := cw.WriteString(string("sh.tangled.repo.collaborator")); err != nil { return err + } + + // t.RepoDid (string) (string) + if t.RepoDid != nil { + + if len("repoDid") > 1000000 { + return xerrors.Errorf("Value in field \"repoDid\" was too long") + } + + if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len("repoDid"))); err != nil { + return err + } + if _, err := cw.WriteString(string("repoDid")); err != nil { + return err + } + + if t.RepoDid == nil { + if _, err := cw.Write(cbg.CborNull); err != nil { + return err + } + } else { + if len(*t.RepoDid) > 1000000 { + return xerrors.Errorf("Value in field t.RepoDid was too long") + } + + if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len(*t.RepoDid))); err != nil { + return err + } + if _, err := cw.WriteString(string(*t.RepoDid)); err != nil { + return err + } + } } // t.Subject (string) (string) @@ -6980,12 +7490,22 @@ case "repo": { - sval, err := cbg.ReadStringWithMax(cr, 1000000) + b, err := cr.ReadByte() if err != nil { return err } + if b != cbg.CborNull[0] { + if err := cr.UnreadByte(); err != nil { + return err + } - t.Repo = string(sval) + sval, err := cbg.ReadStringWithMax(cr, 1000000) + if err != nil { + return err + } + + t.Repo = (*string)(&sval) + } } // t.LexiconTypeID (string) (string) case "$type": @@ -6997,6 +7517,27 @@ } t.LexiconTypeID = string(sval) + } + // t.RepoDid (string) (string) + case "repoDid": + + { + b, err := cr.ReadByte() + if err != nil { + return err + } + if b != cbg.CborNull[0] { + if err := cr.UnreadByte(); err != nil { + return err + } + + sval, err := cbg.ReadStringWithMax(cr, 1000000) + if err != nil { + return err + } + + t.RepoDid = (*string)(&sval) + } } // t.Subject (string) (string) case "subject": @@ -7038,7 +7579,7 @@ } cw := cbg.NewCborWriter(w) - fieldCount := 7 + fieldCount := 8 if t.Body == nil { fieldCount-- @@ -7049,6 +7590,14 @@ } if t.References == nil { + fieldCount-- + } + + if t.Repo == nil { + fieldCount-- + } + + if t.RepoDid == nil { fieldCount-- } @@ -7089,26 +7638,35 @@ } // t.Repo (string) (string) - if len("repo") > 1000000 { - return xerrors.Errorf("Value in field \"repo\" was too long") - } + if t.Repo != nil { - if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len("repo"))); err != nil { - return err - } - if _, err := cw.WriteString(string("repo")); err != nil { - return err - } + if len("repo") > 1000000 { + return xerrors.Errorf("Value in field \"repo\" was too long") + } - if len(t.Repo) > 1000000 { - return xerrors.Errorf("Value in field t.Repo was too long") - } + if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len("repo"))); err != nil { + return err + } + if _, err := cw.WriteString(string("repo")); err != nil { + return err + } - if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len(t.Repo))); err != nil { - return err - } - if _, err := cw.WriteString(string(t.Repo)); err != nil { - return err + if t.Repo == nil { + if _, err := cw.Write(cbg.CborNull); err != nil { + return err + } + } else { + if len(*t.Repo) > 1000000 { + return xerrors.Errorf("Value in field t.Repo was too long") + } + + if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len(*t.Repo))); err != nil { + return err + } + if _, err := cw.WriteString(string(*t.Repo)); err != nil { + return err + } + } } // t.LexiconTypeID (string) (string) @@ -7151,6 +7709,38 @@ } if _, err := cw.WriteString(string(t.Title)); err != nil { return err + } + + // t.RepoDid (string) (string) + if t.RepoDid != nil { + + if len("repoDid") > 1000000 { + return xerrors.Errorf("Value in field \"repoDid\" was too long") + } + + if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len("repoDid"))); err != nil { + return err + } + if _, err := cw.WriteString(string("repoDid")); err != nil { + return err + } + + if t.RepoDid == nil { + if _, err := cw.Write(cbg.CborNull); err != nil { + return err + } + } else { + if len(*t.RepoDid) > 1000000 { + return xerrors.Errorf("Value in field t.RepoDid was too long") + } + + if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len(*t.RepoDid))); err != nil { + return err + } + if _, err := cw.WriteString(string(*t.RepoDid)); err != nil { + return err + } + } } // t.Mentions ([]string) (slice) @@ -7316,12 +7906,22 @@ case "repo": { - sval, err := cbg.ReadStringWithMax(cr, 1000000) + b, err := cr.ReadByte() if err != nil { return err } + if b != cbg.CborNull[0] { + if err := cr.UnreadByte(); err != nil { + return err + } - t.Repo = string(sval) + sval, err := cbg.ReadStringWithMax(cr, 1000000) + if err != nil { + return err + } + + t.Repo = (*string)(&sval) + } } // t.LexiconTypeID (string) (string) case "$type": @@ -7344,6 +7944,27 @@ } t.Title = string(sval) + } + // t.RepoDid (string) (string) + case "repoDid": + + { + b, err := cr.ReadByte() + if err != nil { + return err + } + if b != cbg.CborNull[0] { + if err := cr.UnreadByte(); err != nil { + return err + } + + sval, err := cbg.ReadStringWithMax(cr, 1000000) + if err != nil { + return err + } + + t.RepoDid = (*string)(&sval) + } } // t.Mentions ([]string) (slice) case "mentions": @@ -8947,9 +9568,13 @@ } cw := cbg.NewCborWriter(w) - fieldCount := 3 + fieldCount := 4 if t.Repo == nil { + fieldCount-- + } + + if t.RepoDid == nil { fieldCount-- } @@ -9034,6 +9659,38 @@ if _, err := cw.WriteString(string(t.Branch)); err != nil { return err } + + // t.RepoDid (string) (string) + if t.RepoDid != nil { + + if len("repoDid") > 1000000 { + return xerrors.Errorf("Value in field \"repoDid\" was too long") + } + + if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len("repoDid"))); err != nil { + return err + } + if _, err := cw.WriteString(string("repoDid")); err != nil { + return err + } + + if t.RepoDid == nil { + if _, err := cw.Write(cbg.CborNull); err != nil { + return err + } + } else { + if len(*t.RepoDid) > 1000000 { + return xerrors.Errorf("Value in field t.RepoDid was too long") + } + + if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len(*t.RepoDid))); err != nil { + return err + } + if _, err := cw.WriteString(string(*t.RepoDid)); err != nil { + return err + } + } + } return nil } @@ -9062,7 +9719,7 @@ n := extra - nameBuf := make([]byte, 6) + nameBuf := make([]byte, 7) for i := uint64(0); i < n; i++ { nameLen, ok, err := cbg.ReadFullStringIntoBuf(cr, nameBuf, 1000000) if err != nil { @@ -9120,6 +9777,27 @@ } t.Branch = string(sval) + } + // t.RepoDid (string) (string) + case "repoDid": + + { + b, err := cr.ReadByte() + if err != nil { + return err + } + if b != cbg.CborNull[0] { + if err := cr.UnreadByte(); err != nil { + return err + } + + sval, err := cbg.ReadStringWithMax(cr, 1000000) + if err != nil { + return err + } + + t.RepoDid = (*string)(&sval) + } } default: @@ -9303,32 +9981,50 @@ } cw := cbg.NewCborWriter(w) + fieldCount := 3 - if _, err := cw.Write([]byte{162}); err != nil { + if t.Repo == nil { + fieldCount-- + } + + if t.RepoDid == nil { + fieldCount-- + } + + if _, err := cw.Write(cbg.CborEncodeMajorType(cbg.MajMap, uint64(fieldCount))); err != nil { return err } // t.Repo (string) (string) - if len("repo") > 1000000 { - return xerrors.Errorf("Value in field \"repo\" was too long") - } + if t.Repo != nil { - if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len("repo"))); err != nil { - return err - } - if _, err := cw.WriteString(string("repo")); err != nil { - return err - } + if len("repo") > 1000000 { + return xerrors.Errorf("Value in field \"repo\" was too long") + } - if len(t.Repo) > 1000000 { - return xerrors.Errorf("Value in field t.Repo was too long") - } + if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len("repo"))); err != nil { + return err + } + if _, err := cw.WriteString(string("repo")); err != nil { + return err + } - if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len(t.Repo))); err != nil { - return err - } - if _, err := cw.WriteString(string(t.Repo)); err != nil { - return err + if t.Repo == nil { + if _, err := cw.Write(cbg.CborNull); err != nil { + return err + } + } else { + if len(*t.Repo) > 1000000 { + return xerrors.Errorf("Value in field t.Repo was too long") + } + + if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len(*t.Repo))); err != nil { + return err + } + if _, err := cw.WriteString(string(*t.Repo)); err != nil { + return err + } + } } // t.Branch (string) (string) @@ -9352,6 +10048,38 @@ } if _, err := cw.WriteString(string(t.Branch)); err != nil { return err + } + + // t.RepoDid (string) (string) + if t.RepoDid != nil { + + if len("repoDid") > 1000000 { + return xerrors.Errorf("Value in field \"repoDid\" was too long") + } + + if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len("repoDid"))); err != nil { + return err + } + if _, err := cw.WriteString(string("repoDid")); err != nil { + return err + } + + if t.RepoDid == nil { + if _, err := cw.Write(cbg.CborNull); err != nil { + return err + } + } else { + if len(*t.RepoDid) > 1000000 { + return xerrors.Errorf("Value in field t.RepoDid was too long") + } + + if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len(*t.RepoDid))); err != nil { + return err + } + if _, err := cw.WriteString(string(*t.RepoDid)); err != nil { + return err + } + } } return nil } @@ -9381,7 +10109,7 @@ n := extra - nameBuf := make([]byte, 6) + nameBuf := make([]byte, 7) for i := uint64(0); i < n; i++ { nameLen, ok, err := cbg.ReadFullStringIntoBuf(cr, nameBuf, 1000000) if err != nil { @@ -9401,12 +10129,22 @@ case "repo": { - sval, err := cbg.ReadStringWithMax(cr, 1000000) + b, err := cr.ReadByte() if err != nil { return err } + if b != cbg.CborNull[0] { + if err := cr.UnreadByte(); err != nil { + return err + } - t.Repo = string(sval) + sval, err := cbg.ReadStringWithMax(cr, 1000000) + if err != nil { + return err + } + + t.Repo = (*string)(&sval) + } } // t.Branch (string) (string) case "branch": @@ -9418,6 +10156,27 @@ } t.Branch = string(sval) + } + // t.RepoDid (string) (string) + case "repoDid": + + { + b, err := cr.ReadByte() + if err != nil { + return err + } + if b != cbg.CborNull[0] { + if err := cr.UnreadByte(); err != nil { + return err + } + + sval, err := cbg.ReadStringWithMax(cr, 1000000) + if err != nil { + return err + } + + t.RepoDid = (*string)(&sval) + } } default: diff --git a/api/tangled/feedstar.go b/api/tangled/feedstar.go --- a/api/tangled/feedstar.go +++ b/api/tangled/feedstar.go @@ -17,7 +17,8 @@ } // // RECORDTYPE: FeedStar type FeedStar struct { - LexiconTypeID string `json:"$type,const=sh.tangled.feed.star" cborgen:"$type,const=sh.tangled.feed.star"` - CreatedAt string `json:"createdAt" cborgen:"createdAt"` - Subject string `json:"subject" cborgen:"subject"` + LexiconTypeID string `json:"$type,const=sh.tangled.feed.star" cborgen:"$type,const=sh.tangled.feed.star"` + CreatedAt string `json:"createdAt" cborgen:"createdAt"` + Subject *string `json:"subject,omitempty" cborgen:"subject,omitempty"` + SubjectDid *string `json:"subjectDid,omitempty" cborgen:"subjectDid,omitempty"` } diff --git a/api/tangled/gitrefUpdate.go b/api/tangled/gitrefUpdate.go --- a/api/tangled/gitrefUpdate.go +++ b/api/tangled/gitrefUpdate.go @@ -25,10 +25,12 @@ NewSha string `json:"newSha" cborgen:"newSha"` // oldSha: old SHA of this ref OldSha string `json:"oldSha" cborgen:"oldSha"` + // ownerDid: did of the owner of the repo + OwnerDid *string `json:"ownerDid,omitempty" cborgen:"ownerDid,omitempty"` // ref: Ref being updated Ref string `json:"ref" cborgen:"ref"` - // repoDid: did of the owner of the repo - RepoDid string `json:"repoDid" cborgen:"repoDid"` + // repoDid: DID of the repo itself + RepoDid *string `json:"repoDid,omitempty" cborgen:"repoDid,omitempty"` // repoName: name of the repo RepoName string `json:"repoName" cborgen:"repoName"` } diff --git a/api/tangled/repoartifact.go b/api/tangled/repoartifact.go --- a/api/tangled/repoartifact.go +++ b/api/tangled/repoartifact.go @@ -25,7 +25,8 @@ // name: name of the artifact Name string `json:"name" cborgen:"name"` // repo: repo that this artifact is being uploaded to - Repo string `json:"repo" cborgen:"repo"` + Repo *string `json:"repo,omitempty" cborgen:"repo,omitempty"` + RepoDid *string `json:"repoDid,omitempty" cborgen:"repoDid,omitempty"` // tag: hash of the tag object that this artifact is attached to (only annotated tags are supported) Tag util.LexBytes `json:"tag,omitempty" cborgen:"tag,omitempty"` } diff --git a/api/tangled/repocollaborator.go b/api/tangled/repocollaborator.go --- a/api/tangled/repocollaborator.go +++ b/api/tangled/repocollaborator.go @@ -20,6 +20,7 @@ LexiconTypeID string `json:"$type,const=sh.tangled.repo.collaborator" cborgen:"$type,const=sh.tangled.repo.collaborator"` CreatedAt string `json:"createdAt" cborgen:"createdAt"` // repo: repo to add this user to - Repo string `json:"repo" cborgen:"repo"` - Subject string `json:"subject" cborgen:"subject"` + Repo *string `json:"repo,omitempty" cborgen:"repo,omitempty"` + RepoDid *string `json:"repoDid,omitempty" cborgen:"repoDid,omitempty"` + Subject string `json:"subject" cborgen:"subject"` } diff --git a/api/tangled/repocreate.go b/api/tangled/repocreate.go --- a/api/tangled/repocreate.go +++ b/api/tangled/repocreate.go @@ -18,17 +18,27 @@ type RepoCreate_Input struct { // defaultBranch: Default branch to push to DefaultBranch *string `json:"defaultBranch,omitempty" cborgen:"defaultBranch,omitempty"` + // name: Name of the repository + Name string `json:"name" cborgen:"name"` + // repoDid: Optional user-provided did:web to use as the repo identity instead of minting a did:plc. + RepoDid *string `json:"repoDid,omitempty" cborgen:"repoDid,omitempty"` // rkey: Rkey of the repository record Rkey string `json:"rkey" cborgen:"rkey"` // source: A source URL to clone from, populate this when forking or importing a repository. Source *string `json:"source,omitempty" cborgen:"source,omitempty"` } +// RepoCreate_Output is the output of a sh.tangled.repo.create call. +type RepoCreate_Output struct { + RepoDid *string `json:"repoDid,omitempty" cborgen:"repoDid,omitempty"` +} + // RepoCreate calls the XRPC method "sh.tangled.repo.create". -func RepoCreate(ctx context.Context, c util.LexClient, input *RepoCreate_Input) error { - if err := c.LexDo(ctx, util.Procedure, "application/json", "sh.tangled.repo.create", nil, input, nil); err != nil { - return err +func RepoCreate(ctx context.Context, c util.LexClient, input *RepoCreate_Input) (*RepoCreate_Output, error) { + var out RepoCreate_Output + if err := c.LexDo(ctx, util.Procedure, "application/json", "sh.tangled.repo.create", nil, input, &out); err != nil { + return nil, err } - return nil + return &out, nil } diff --git a/api/tangled/repoissue.go b/api/tangled/repoissue.go --- a/api/tangled/repoissue.go +++ b/api/tangled/repoissue.go @@ -22,6 +22,7 @@ CreatedAt string `json:"createdAt" cborgen:"createdAt"` Mentions []string `json:"mentions,omitempty" cborgen:"mentions,omitempty"` References []string `json:"references,omitempty" cborgen:"references,omitempty"` - Repo string `json:"repo" cborgen:"repo"` + Repo *string `json:"repo,omitempty" cborgen:"repo,omitempty"` + RepoDid *string `json:"repoDid,omitempty" cborgen:"repoDid,omitempty"` Title string `json:"title" cborgen:"title"` } diff --git a/api/tangled/repopull.go b/api/tangled/repopull.go --- a/api/tangled/repopull.go +++ b/api/tangled/repopull.go @@ -33,13 +33,15 @@ // RepoPull_Source is a "source" in the sh.tangled.repo.pull schema. type RepoPull_Source struct { - Branch string `json:"branch" cborgen:"branch"` - Repo *string `json:"repo,omitempty" cborgen:"repo,omitempty"` - Sha string `json:"sha" cborgen:"sha"` + Branch string `json:"branch" cborgen:"branch"` + Repo *string `json:"repo,omitempty" cborgen:"repo,omitempty"` + RepoDid *string `json:"repoDid,omitempty" cborgen:"repoDid,omitempty"` + Sha string `json:"sha" cborgen:"sha"` } // RepoPull_Target is a "target" in the sh.tangled.repo.pull schema. type RepoPull_Target struct { - Branch string `json:"branch" cborgen:"branch"` - Repo string `json:"repo" cborgen:"repo"` + Branch string `json:"branch" cborgen:"branch"` + Repo *string `json:"repo,omitempty" cborgen:"repo,omitempty"` + RepoDid *string `json:"repoDid,omitempty" cborgen:"repoDid,omitempty"` } diff --git a/api/tangled/tangledpipeline.go b/api/tangled/tangledpipeline.go --- a/api/tangled/tangledpipeline.go +++ b/api/tangled/tangledpipeline.go @@ -66,10 +66,12 @@ // Pipeline_TriggerRepo is a "triggerRepo" in the sh.tangled.pipeline schema. type Pipeline_TriggerRepo struct { - DefaultBranch string `json:"defaultBranch" cborgen:"defaultBranch"` - Did string `json:"did" cborgen:"did"` - Knot string `json:"knot" cborgen:"knot"` - Repo string `json:"repo" cborgen:"repo"` + DefaultBranch string `json:"defaultBranch" cborgen:"defaultBranch"` + Did string `json:"did" cborgen:"did"` + Knot string `json:"knot" cborgen:"knot"` + Repo *string `json:"repo,omitempty" cborgen:"repo,omitempty"` + // repoDid: DID of the repo itself + RepoDid *string `json:"repoDid,omitempty" cborgen:"repoDid,omitempty"` } // Pipeline_Workflow is a "workflow" in the sh.tangled.pipeline schema. diff --git a/api/tangled/tangledrepo.go b/api/tangled/tangledrepo.go --- a/api/tangled/tangledrepo.go +++ b/api/tangled/tangledrepo.go @@ -26,6 +26,8 @@ Labels []string `json:"labels,omitempty" cborgen:"labels,omitempty"` // name: name of the repo Name string `json:"name" cborgen:"name"` + // repoDid: DID of the repo itself, if assigned + RepoDid *string `json:"repoDid,omitempty" cborgen:"repoDid,omitempty"` // source: source of the repo Source *string `json:"source,omitempty" cborgen:"source,omitempty"` // spindle: CI runner to send jobs to and receive results from diff --git a/knotmirror/knotstream/slurper.go b/knotmirror/knotstream/slurper.go --- a/knotmirror/knotstream/slurper.go +++ b/knotmirror/knotstream/slurper.go @@ -274,9 +274,13 @@ l := s.logger.With("src", source) - curr, err := db.GetRepoByName(ctx, s.db, syntax.DID(evt.Event.RepoDid), evt.Event.RepoName) + repoDid := "" + if evt.Event.RepoDid != nil { + repoDid = *evt.Event.RepoDid + } + curr, err := db.GetRepoByName(ctx, s.db, syntax.DID(repoDid), evt.Event.RepoName) if err != nil { - return fmt.Errorf("failed to get repo '%s': %w", evt.Event.RepoDid+"/"+evt.Event.RepoName, err) + return fmt.Errorf("failed to get repo '%s': %w", repoDid+"/"+evt.Event.RepoName, err) } if curr == nil { // if repo doesn't exist in DB, just ignore the event. That repo is unknown. @@ -286,7 +290,7 @@ // But we want to store that in did/rkey in knot-mirror. // Therefore, we should ignore when the repository is unknown. // Hopefully crawler will sync it later. - l.Warn("skipping event from unknown repo", "did/name", evt.Event.RepoDid+"/"+evt.Event.RepoName) + l.Warn("skipping event from unknown repo", "did/name", repoDid+"/"+evt.Event.RepoName) knotstreamEventsSkipped.Inc() return nil } diff --git a/lexicons/actor/profile.json b/lexicons/actor/profile.json --- a/lexicons/actor/profile.json +++ b/lexicons/actor/profile.json @@ -60,6 +60,15 @@ "maxGraphemes": 40, "maxLength": 400 }, + "pinnedRepositoryDids": { + "type": "array", + "minLength": 0, + "maxLength": 6, + "items": { + "type": "string", + "format": "did" + } + }, "pinnedRepositories": { "type": "array", "description": "Any ATURI, it is up to appviews to validate these fields.", diff --git a/lexicons/feed/star.json b/lexicons/feed/star.json --- a/lexicons/feed/star.json +++ b/lexicons/feed/star.json @@ -10,13 +10,16 @@ "record": { "type": "object", "required": [ - "subject", "createdAt" ], "properties": { "subject": { "type": "string", "format": "at-uri" + }, + "subjectDid": { + "type": "string", + "format": "did" }, "createdAt": { "type": "string", diff --git a/lexicons/git/refUpdate.json b/lexicons/git/refUpdate.json --- a/lexicons/git/refUpdate.json +++ b/lexicons/git/refUpdate.json @@ -11,7 +11,6 @@ "required": [ "ref", "committerDid", - "repoDid", "repoName", "oldSha", "newSha", @@ -29,9 +28,14 @@ "description": "did of the user that pushed this ref", "format": "did" }, - "repoDid": { + "ownerDid": { "type": "string", "description": "did of the owner of the repo", + "format": "did" + }, + "repoDid": { + "type": "string", + "description": "DID of the repo itself", "format": "did" }, "repoName": { diff --git a/lexicons/issue/issue.json b/lexicons/issue/issue.json --- a/lexicons/issue/issue.json +++ b/lexicons/issue/issue.json @@ -9,11 +9,15 @@ "key": "tid", "record": { "type": "object", - "required": ["repo", "title", "createdAt"], + "required": ["title", "createdAt"], "properties": { "repo": { "type": "string", "format": "at-uri" + }, + "repoDid": { + "type": "string", + "format": "did" }, "title": { "type": "string" diff --git a/lexicons/pipeline/pipeline.json b/lexicons/pipeline/pipeline.json --- a/lexicons/pipeline/pipeline.json +++ b/lexicons/pipeline/pipeline.json @@ -66,7 +66,6 @@ "required": [ "knot", "did", - "repo", "defaultBranch" ], "properties": { @@ -75,6 +74,11 @@ }, "did": { "type": "string", + "format": "did" + }, + "repoDid": { + "type": "string", + "description": "DID of the repo itself", "format": "did" }, "repo": { diff --git a/lexicons/pulls/pull.json b/lexicons/pulls/pull.json --- a/lexicons/pulls/pull.json +++ b/lexicons/pulls/pull.json @@ -65,13 +65,16 @@ "target": { "type": "object", "required": [ - "repo", "branch" ], "properties": { "repo": { "type": "string", "format": "at-uri" + }, + "repoDid": { + "type": "string", + "format": "did" }, "branch": { "type": "string" @@ -96,6 +99,10 @@ "repo": { "type": "string", "format": "at-uri" + }, + "repoDid": { + "type": "string", + "format": "did" } } } diff --git a/lexicons/repo/artifact.json b/lexicons/repo/artifact.json --- a/lexicons/repo/artifact.json +++ b/lexicons/repo/artifact.json @@ -11,7 +11,6 @@ "type": "object", "required": [ "name", - "repo", "tag", "createdAt", "artifact" @@ -25,6 +24,10 @@ "type": "string", "format": "at-uri", "description": "repo that this artifact is being uploaded to" + }, + "repoDid": { + "type": "string", + "format": "did" }, "tag": { "type": "bytes", diff --git a/lexicons/repo/collaborator.json b/lexicons/repo/collaborator.json --- a/lexicons/repo/collaborator.json +++ b/lexicons/repo/collaborator.json @@ -11,7 +11,6 @@ "type": "object", "required": [ "subject", - "repo", "createdAt" ], "properties": { @@ -23,6 +22,10 @@ "type": "string", "description": "repo to add this user to", "format": "at-uri" + }, + "repoDid": { + "type": "string", + "format": "did" }, "createdAt": { "type": "string", diff --git a/lexicons/repo/create.json b/lexicons/repo/create.json --- a/lexicons/repo/create.json +++ b/lexicons/repo/create.json @@ -10,12 +10,17 @@ "schema": { "type": "object", "required": [ - "rkey" + "rkey", + "name" ], "properties": { "rkey": { "type": "string", "description": "Rkey of the repository record" + }, + "name": { + "type": "string", + "description": "Name of the repository" }, "defaultBranch": { "type": "string", @@ -24,6 +29,23 @@ "source": { "type": "string", "description": "A source URL to clone from, populate this when forking or importing a repository." + }, + "repoDid": { + "type": "string", + "format": "did", + "description": "Optional user-provided did:web to use as the repo identity instead of minting a did:plc." + } + } + } + }, + "output": { + "encoding": "application/json", + "schema": { + "type": "object", + "properties": { + "repoDid": { + "type": "string", + "format": "did" } } } diff --git a/lexicons/repo/repo.json b/lexicons/repo/repo.json --- a/lexicons/repo/repo.json +++ b/lexicons/repo/repo.json @@ -60,6 +60,11 @@ "format": "at-uri" } }, + "repoDid": { + "type": "string", + "format": "did", + "description": "DID of the repo itself, if assigned" + }, "createdAt": { "type": "string", "format": "datetime" diff --git a/spindle/models/clone_test.go b/spindle/models/clone_test.go --- a/spindle/models/clone_test.go +++ b/spindle/models/clone_test.go @@ -8,6 +8,8 @@ "tangled.org/core/workflow" ) +func sp(s string) *string { return &s } + func TestBuildCloneStep_PushTrigger(t *testing.T) { twf := tangled.Pipeline_Workflow{ Clone: &tangled.Pipeline_CloneOpts{ @@ -26,7 +28,7 @@ Repo: &tangled.Pipeline_TriggerRepo{ Knot: "example.com", Did: "did:plc:user123", - Repo: "my-repo", + Repo: sp("my-repo"), }, } @@ -85,7 +87,7 @@ Repo: &tangled.Pipeline_TriggerRepo{ Knot: "example.com", Did: "did:plc:user123", - Repo: "my-repo", + Repo: sp("my-repo"), }, } @@ -112,7 +114,7 @@ Repo: &tangled.Pipeline_TriggerRepo{ Knot: "example.com", Did: "did:plc:user123", - Repo: "my-repo", + Repo: sp("my-repo"), }, } @@ -143,7 +145,7 @@ Repo: &tangled.Pipeline_TriggerRepo{ Knot: "example.com", Did: "did:plc:user123", - Repo: "my-repo", + Repo: sp("my-repo"), }, } @@ -173,7 +175,7 @@ Repo: &tangled.Pipeline_TriggerRepo{ Knot: "localhost:3000", Did: "did:plc:user123", - Repo: "my-repo", + Repo: sp("my-repo"), }, } @@ -203,7 +205,7 @@ Repo: &tangled.Pipeline_TriggerRepo{ Knot: "example.com", Did: "did:plc:user123", - Repo: "my-repo", + Repo: sp("my-repo"), }, } @@ -234,7 +236,7 @@ Repo: &tangled.Pipeline_TriggerRepo{ Knot: "example.com", Did: "did:plc:user123", - Repo: "my-repo", + Repo: sp("my-repo"), }, } @@ -259,7 +261,7 @@ Repo: &tangled.Pipeline_TriggerRepo{ Knot: "example.com", Did: "did:plc:user123", - Repo: "my-repo", + Repo: sp("my-repo"), }, } @@ -292,7 +294,7 @@ Repo: &tangled.Pipeline_TriggerRepo{ Knot: "example.com", Did: "did:plc:user123", - Repo: "my-repo", + Repo: sp("my-repo"), }, } @@ -321,7 +323,7 @@ Repo: &tangled.Pipeline_TriggerRepo{ Knot: "example.com", Did: "did:plc:user123", - Repo: "my-repo", + Repo: sp("my-repo"), }, } @@ -350,7 +352,7 @@ Repo: &tangled.Pipeline_TriggerRepo{ Knot: "example.com", Did: "did:plc:user123", - Repo: "my-repo", + Repo: sp("my-repo"), }, } diff --git a/spindle/models/pipeline_env_test.go b/spindle/models/pipeline_env_test.go --- a/spindle/models/pipeline_env_test.go +++ b/spindle/models/pipeline_env_test.go @@ -18,7 +18,7 @@ Repo: &tangled.Pipeline_TriggerRepo{ Knot: "example.com", Did: "did:plc:user123", - Repo: "my-repo", + Repo: sp("my-repo"), DefaultBranch: "main", }, } @@ -81,7 +81,7 @@ Repo: &tangled.Pipeline_TriggerRepo{ Knot: "example.com", Did: "did:plc:user123", - Repo: "my-repo", + Repo: sp("my-repo"), }, } id := PipelineId{ @@ -113,7 +113,7 @@ Repo: &tangled.Pipeline_TriggerRepo{ Knot: "example.com", Did: "did:plc:user123", - Repo: "my-repo", + Repo: sp("my-repo"), }, } id := PipelineId{ @@ -168,7 +168,7 @@ Repo: &tangled.Pipeline_TriggerRepo{ Knot: "example.com", Did: "did:plc:user123", - Repo: "my-repo", + Repo: sp("my-repo"), }, } id := PipelineId{ @@ -204,7 +204,7 @@ Repo: &tangled.Pipeline_TriggerRepo{ Knot: "localhost:3000", Did: "did:plc:user123", - Repo: "my-repo", + Repo: sp("my-repo"), }, } id := PipelineId{ @@ -239,7 +239,7 @@ Repo: &tangled.Pipeline_TriggerRepo{ Knot: "example.com", Did: "did:plc:user123", - Repo: "my-repo", + Repo: sp("my-repo"), }, } id := PipelineId{ -- tangled.sh