From ee843f253d0b1a2b9e1d098f8cea2bd5e24e5770 Mon Sep 17 00:00:00 2001 From: Aly Raffauf Date: Fri, 28 Aug 2026 22:00:54 +0000 Subject: [PATCH] tangledlex: remove deprecated comment records --- atproto/auth.go | 2 -- atproto/auth_scope_test.go | 12 ++++++++++++ internal/tangledlex/cbor_gen.go | 775 ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- internal/tangledlex/issuecomment.go | 23 ----------------------- internal/tangledlex/pullcomment.go | 22 ---------------------- internal/tangledlex/schemas.txt | 2 -- internal/tangledlex/validate.go | 47 ----------------------------------------------- internal/tangledlex/validate_test.go | 34 +++++----------------------------- internal/tangledlex/cborgen/main.go | 2 -- internal/tangledlex/schemas/issue/comment.json | 47 ----------------------------------------------- internal/tangledlex/schemas/pulls/comment.json | 43 ------------------------------------------- 11 file(s) changed, 17 insertion(s)(+), 992 deletion(s)(-) diff --git a/atproto/auth.go b/atproto/auth.go --- a/atproto/auth.go +++ b/atproto/auth.go @@ -46,10 +46,8 @@ "repo:sh.tangled.repo.artifact", "repo:sh.tangled.repo.collaborator", "repo:sh.tangled.repo.issue", - "repo:sh.tangled.repo.issue.comment", "repo:sh.tangled.repo.issue.state", "repo:sh.tangled.repo.pull", - "repo:sh.tangled.repo.pull.comment", "repo:sh.tangled.repo.pull.status", "repo:sh.tangled.spindle", "repo:sh.tangled.spindle.member", diff --git a/atproto/auth_scope_test.go b/atproto/auth_scope_test.go --- a/atproto/auth_scope_test.go +++ b/atproto/auth_scope_test.go @@ -14,6 +14,18 @@ t.Fatal("DefaultScopes does not include repo:sh.tangled.feed.comment") } +func TestDefaultScopesExcludeDeprecatedCommentCollections(t *testing.T) { + deprecatedScopes := map[string]bool{ + "repo:sh.tangled.repo.issue.comment": true, + "repo:sh.tangled.repo.pull.comment": true, + } + for _, scope := range DefaultScopes { + if deprecatedScopes[scope] { + t.Fatalf("DefaultScopes includes deprecated scope %q", scope) + } + } +} + func TestAuthManagerOAuthSessionHasScope(t *testing.T) { store := testKeyringStore(newFakeKeyring()) manager := newAuthManagerForTest("http://127.0.0.1:8095/callback", store) diff --git a/internal/tangledlex/cbor_gen.go b/internal/tangledlex/cbor_gen.go --- a/internal/tangledlex/cbor_gen.go +++ b/internal/tangledlex/cbor_gen.go @@ -1889,422 +1889,6 @@ return nil } -func (t *RepoIssueComment) MarshalCBOR(w io.Writer) error { - if t == nil { - _, err := w.Write(cbg.CborNull) - return err - } - - cw := cbg.NewCborWriter(w) - fieldCount := 7 - - if t.Mentions == nil { - fieldCount-- - } - - if t.References == nil { - fieldCount-- - } - - if t.ReplyTo == nil { - fieldCount-- - } - - if _, err := cw.Write(cbg.CborEncodeMajorType(cbg.MajMap, uint64(fieldCount))); err != nil { - return err - } - - // t.Body (string) (string) - if len("body") > 1000000 { - return xerrors.Errorf("Value in field \"body\" was too long") - } - - if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len("body"))); err != nil { - return err - } - if _, err := cw.WriteString(string("body")); err != nil { - return err - } - - if len(t.Body) > 1000000 { - return xerrors.Errorf("Value in field t.Body was too long") - } - - if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len(t.Body))); err != nil { - return err - } - if _, err := cw.WriteString(string(t.Body)); err != nil { - return err - } - - // t.LexiconTypeID (string) (string) - if len("$type") > 1000000 { - return xerrors.Errorf("Value in field \"$type\" was too long") - } - - if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len("$type"))); err != nil { - return err - } - if _, err := cw.WriteString(string("$type")); err != nil { - return err - } - - if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len("sh.tangled.repo.issue.comment"))); err != nil { - return err - } - if _, err := cw.WriteString(string("sh.tangled.repo.issue.comment")); err != nil { - return err - } - - // t.Issue (string) (string) - if len("issue") > 1000000 { - return xerrors.Errorf("Value in field \"issue\" was too long") - } - - if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len("issue"))); err != nil { - return err - } - if _, err := cw.WriteString(string("issue")); err != nil { - return err - } - - if len(t.Issue) > 1000000 { - return xerrors.Errorf("Value in field t.Issue was too long") - } - - if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len(t.Issue))); err != nil { - return err - } - if _, err := cw.WriteString(string(t.Issue)); err != nil { - return err - } - - // t.ReplyTo (string) (string) - if t.ReplyTo != nil { - - if len("replyTo") > 1000000 { - return xerrors.Errorf("Value in field \"replyTo\" was too long") - } - - if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len("replyTo"))); err != nil { - return err - } - if _, err := cw.WriteString(string("replyTo")); err != nil { - return err - } - - if t.ReplyTo == nil { - if _, err := cw.Write(cbg.CborNull); err != nil { - return err - } - } else { - if len(*t.ReplyTo) > 1000000 { - return xerrors.Errorf("Value in field t.ReplyTo was too long") - } - - if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len(*t.ReplyTo))); err != nil { - return err - } - if _, err := cw.WriteString(string(*t.ReplyTo)); err != nil { - return err - } - } - } - - // t.Mentions ([]string) (slice) - if t.Mentions != nil { - - if len("mentions") > 1000000 { - return xerrors.Errorf("Value in field \"mentions\" was too long") - } - - if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len("mentions"))); err != nil { - return err - } - if _, err := cw.WriteString(string("mentions")); err != nil { - return err - } - - if len(t.Mentions) > 8192 { - return xerrors.Errorf("Slice value in field t.Mentions was too long") - } - - if err := cw.WriteMajorTypeHeader(cbg.MajArray, uint64(len(t.Mentions))); err != nil { - return err - } - for _, v := range t.Mentions { - 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 - } - - } - } - - // t.CreatedAt (string) (string) - if len("createdAt") > 1000000 { - return xerrors.Errorf("Value in field \"createdAt\" was too long") - } - - if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len("createdAt"))); err != nil { - return err - } - if _, err := cw.WriteString(string("createdAt")); err != nil { - return err - } - - if len(t.CreatedAt) > 1000000 { - return xerrors.Errorf("Value in field t.CreatedAt was too long") - } - - if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len(t.CreatedAt))); err != nil { - return err - } - if _, err := cw.WriteString(string(t.CreatedAt)); err != nil { - return err - } - - // t.References ([]string) (slice) - if t.References != nil { - - if len("references") > 1000000 { - return xerrors.Errorf("Value in field \"references\" was too long") - } - - if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len("references"))); err != nil { - return err - } - if _, err := cw.WriteString(string("references")); err != nil { - return err - } - - if len(t.References) > 8192 { - return xerrors.Errorf("Slice value in field t.References was too long") - } - - if err := cw.WriteMajorTypeHeader(cbg.MajArray, uint64(len(t.References))); err != nil { - return err - } - for _, v := range t.References { - 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 -} - -func (t *RepoIssueComment) UnmarshalCBOR(r io.Reader) (err error) { - *t = RepoIssueComment{} - - cr := cbg.NewCborReader(r) - - maj, extra, err := cr.ReadHeader() - if err != nil { - return err - } - defer func() { - if err == io.EOF { - err = io.ErrUnexpectedEOF - } - }() - - if maj != cbg.MajMap { - return fmt.Errorf("cbor input should be of type map") - } - - if extra > cbg.MaxLength { - return fmt.Errorf("RepoIssueComment: map struct too large (%d)", extra) - } - - n := extra - - nameBuf := make([]byte, 10) - for i := uint64(0); i < n; i++ { - nameLen, ok, err := cbg.ReadFullStringIntoBuf(cr, nameBuf, 1000000) - if err != nil { - return err - } - - if !ok { - // Field doesn't exist on this type, so ignore it - if err := cbg.ScanForLinks(cr, func(cid.Cid) {}); err != nil { - return err - } - continue - } - - switch string(nameBuf[:nameLen]) { - // t.Body (string) (string) - case "body": - - { - sval, err := cbg.ReadStringWithMax(cr, 1000000) - if err != nil { - return err - } - - t.Body = string(sval) - } - // t.LexiconTypeID (string) (string) - case "$type": - - { - sval, err := cbg.ReadStringWithMax(cr, 1000000) - if err != nil { - return err - } - - t.LexiconTypeID = string(sval) - } - // t.Issue (string) (string) - case "issue": - - { - sval, err := cbg.ReadStringWithMax(cr, 1000000) - if err != nil { - return err - } - - t.Issue = string(sval) - } - // t.ReplyTo (string) (string) - case "replyTo": - - { - 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.ReplyTo = (*string)(&sval) - } - } - // t.Mentions ([]string) (slice) - case "mentions": - - maj, extra, err = cr.ReadHeader() - if err != nil { - return err - } - - if extra > 8192 { - return fmt.Errorf("t.Mentions: array too large (%d)", extra) - } - - if maj != cbg.MajArray { - return fmt.Errorf("expected cbor array") - } - - if extra > 0 { - t.Mentions = 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.Mentions[i] = string(sval) - } - - } - } - // t.CreatedAt (string) (string) - case "createdAt": - - { - sval, err := cbg.ReadStringWithMax(cr, 1000000) - if err != nil { - return err - } - - t.CreatedAt = string(sval) - } - // t.References ([]string) (slice) - case "references": - - maj, extra, err = cr.ReadHeader() - if err != nil { - return err - } - - if extra > 8192 { - return fmt.Errorf("t.References: array too large (%d)", extra) - } - - if maj != cbg.MajArray { - return fmt.Errorf("expected cbor array") - } - - if extra > 0 { - t.References = 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.References[i] = string(sval) - } - - } - } - - default: - // Field doesn't exist on this type, so ignore it - if err := cbg.ScanForLinks(r, func(cid.Cid) {}); err != nil { - return err - } - } - } - - return nil -} func (t *RepoIssueState) MarshalCBOR(w io.Writer) error { if t == nil { _, err := w.Write(cbg.CborNull) @@ -3083,365 +2667,6 @@ } t.DependentOn = (*string)(&sval) - } - } - - default: - // Field doesn't exist on this type, so ignore it - if err := cbg.ScanForLinks(r, func(cid.Cid) {}); err != nil { - return err - } - } - } - - return nil -} -func (t *RepoPullComment) MarshalCBOR(w io.Writer) error { - if t == nil { - _, err := w.Write(cbg.CborNull) - return err - } - - cw := cbg.NewCborWriter(w) - fieldCount := 6 - - if t.Mentions == nil { - fieldCount-- - } - - if t.References == nil { - fieldCount-- - } - - if _, err := cw.Write(cbg.CborEncodeMajorType(cbg.MajMap, uint64(fieldCount))); err != nil { - return err - } - - // t.Body (string) (string) - if len("body") > 1000000 { - return xerrors.Errorf("Value in field \"body\" was too long") - } - - if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len("body"))); err != nil { - return err - } - if _, err := cw.WriteString(string("body")); err != nil { - return err - } - - if len(t.Body) > 1000000 { - return xerrors.Errorf("Value in field t.Body was too long") - } - - if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len(t.Body))); err != nil { - return err - } - if _, err := cw.WriteString(string(t.Body)); err != nil { - return err - } - - // t.Pull (string) (string) - if len("pull") > 1000000 { - return xerrors.Errorf("Value in field \"pull\" was too long") - } - - if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len("pull"))); err != nil { - return err - } - if _, err := cw.WriteString(string("pull")); err != nil { - return err - } - - if len(t.Pull) > 1000000 { - return xerrors.Errorf("Value in field t.Pull was too long") - } - - if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len(t.Pull))); err != nil { - return err - } - if _, err := cw.WriteString(string(t.Pull)); err != nil { - return err - } - - // t.LexiconTypeID (string) (string) - if len("$type") > 1000000 { - return xerrors.Errorf("Value in field \"$type\" was too long") - } - - if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len("$type"))); err != nil { - return err - } - if _, err := cw.WriteString(string("$type")); err != nil { - return err - } - - if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len("sh.tangled.repo.pull.comment"))); err != nil { - return err - } - if _, err := cw.WriteString(string("sh.tangled.repo.pull.comment")); err != nil { - return err - } - - // t.Mentions ([]string) (slice) - if t.Mentions != nil { - - if len("mentions") > 1000000 { - return xerrors.Errorf("Value in field \"mentions\" was too long") - } - - if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len("mentions"))); err != nil { - return err - } - if _, err := cw.WriteString(string("mentions")); err != nil { - return err - } - - if len(t.Mentions) > 8192 { - return xerrors.Errorf("Slice value in field t.Mentions was too long") - } - - if err := cw.WriteMajorTypeHeader(cbg.MajArray, uint64(len(t.Mentions))); err != nil { - return err - } - for _, v := range t.Mentions { - 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 - } - - } - } - - // t.CreatedAt (string) (string) - if len("createdAt") > 1000000 { - return xerrors.Errorf("Value in field \"createdAt\" was too long") - } - - if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len("createdAt"))); err != nil { - return err - } - if _, err := cw.WriteString(string("createdAt")); err != nil { - return err - } - - if len(t.CreatedAt) > 1000000 { - return xerrors.Errorf("Value in field t.CreatedAt was too long") - } - - if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len(t.CreatedAt))); err != nil { - return err - } - if _, err := cw.WriteString(string(t.CreatedAt)); err != nil { - return err - } - - // t.References ([]string) (slice) - if t.References != nil { - - if len("references") > 1000000 { - return xerrors.Errorf("Value in field \"references\" was too long") - } - - if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len("references"))); err != nil { - return err - } - if _, err := cw.WriteString(string("references")); err != nil { - return err - } - - if len(t.References) > 8192 { - return xerrors.Errorf("Slice value in field t.References was too long") - } - - if err := cw.WriteMajorTypeHeader(cbg.MajArray, uint64(len(t.References))); err != nil { - return err - } - for _, v := range t.References { - 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 -} - -func (t *RepoPullComment) UnmarshalCBOR(r io.Reader) (err error) { - *t = RepoPullComment{} - - cr := cbg.NewCborReader(r) - - maj, extra, err := cr.ReadHeader() - if err != nil { - return err - } - defer func() { - if err == io.EOF { - err = io.ErrUnexpectedEOF - } - }() - - if maj != cbg.MajMap { - return fmt.Errorf("cbor input should be of type map") - } - - if extra > cbg.MaxLength { - return fmt.Errorf("RepoPullComment: map struct too large (%d)", extra) - } - - n := extra - - nameBuf := make([]byte, 10) - for i := uint64(0); i < n; i++ { - nameLen, ok, err := cbg.ReadFullStringIntoBuf(cr, nameBuf, 1000000) - if err != nil { - return err - } - - if !ok { - // Field doesn't exist on this type, so ignore it - if err := cbg.ScanForLinks(cr, func(cid.Cid) {}); err != nil { - return err - } - continue - } - - switch string(nameBuf[:nameLen]) { - // t.Body (string) (string) - case "body": - - { - sval, err := cbg.ReadStringWithMax(cr, 1000000) - if err != nil { - return err - } - - t.Body = string(sval) - } - // t.Pull (string) (string) - case "pull": - - { - sval, err := cbg.ReadStringWithMax(cr, 1000000) - if err != nil { - return err - } - - t.Pull = string(sval) - } - // t.LexiconTypeID (string) (string) - case "$type": - - { - sval, err := cbg.ReadStringWithMax(cr, 1000000) - if err != nil { - return err - } - - t.LexiconTypeID = string(sval) - } - // t.Mentions ([]string) (slice) - case "mentions": - - maj, extra, err = cr.ReadHeader() - if err != nil { - return err - } - - if extra > 8192 { - return fmt.Errorf("t.Mentions: array too large (%d)", extra) - } - - if maj != cbg.MajArray { - return fmt.Errorf("expected cbor array") - } - - if extra > 0 { - t.Mentions = 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.Mentions[i] = string(sval) - } - - } - } - // t.CreatedAt (string) (string) - case "createdAt": - - { - sval, err := cbg.ReadStringWithMax(cr, 1000000) - if err != nil { - return err - } - - t.CreatedAt = string(sval) - } - // t.References ([]string) (slice) - case "references": - - maj, extra, err = cr.ReadHeader() - if err != nil { - return err - } - - if extra > 8192 { - return fmt.Errorf("t.References: array too large (%d)", extra) - } - - if maj != cbg.MajArray { - return fmt.Errorf("expected cbor array") - } - - if extra > 0 { - t.References = 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.References[i] = string(sval) - } - } } diff --git a/internal/tangledlex/issuecomment.go b/internal/tangledlex/issuecomment.go deleted file mode 100644 --- a/internal/tangledlex/issuecomment.go +++ /dev/null @@ -1,23 +0,0 @@ -// Code generated by cmd/lexgen (see Makefile's lexgen); DO NOT EDIT. - -// Lexicon schema: sh.tangled.repo.issue.comment - -package tangledlex - -import ( - lexutil "github.com/bluesky-social/indigo/lex/util" -) - -func init() { - lexutil.RegisterType("sh.tangled.repo.issue.comment", &RepoIssueComment{}) -} - -type RepoIssueComment struct { - LexiconTypeID string `json:"$type" cborgen:"$type,const=sh.tangled.repo.issue.comment"` - Body string `json:"body" cborgen:"body"` - CreatedAt string `json:"createdAt" cborgen:"createdAt"` - Issue string `json:"issue" cborgen:"issue"` - Mentions []string `json:"mentions,omitempty" cborgen:"mentions,omitempty"` - References []string `json:"references,omitempty" cborgen:"references,omitempty"` - ReplyTo *string `json:"replyTo,omitempty" cborgen:"replyTo,omitempty"` -} diff --git a/internal/tangledlex/pullcomment.go b/internal/tangledlex/pullcomment.go deleted file mode 100644 --- a/internal/tangledlex/pullcomment.go +++ /dev/null @@ -1,22 +0,0 @@ -// Code generated by cmd/lexgen (see Makefile's lexgen); DO NOT EDIT. - -// Lexicon schema: sh.tangled.repo.pull.comment - -package tangledlex - -import ( - lexutil "github.com/bluesky-social/indigo/lex/util" -) - -func init() { - lexutil.RegisterType("sh.tangled.repo.pull.comment", &RepoPullComment{}) -} - -type RepoPullComment struct { - LexiconTypeID string `json:"$type" cborgen:"$type,const=sh.tangled.repo.pull.comment"` - Body string `json:"body" cborgen:"body"` - CreatedAt string `json:"createdAt" cborgen:"createdAt"` - Mentions []string `json:"mentions,omitempty" cborgen:"mentions,omitempty"` - Pull string `json:"pull" cborgen:"pull"` - References []string `json:"references,omitempty" cborgen:"references,omitempty"` -} diff --git a/internal/tangledlex/schemas.txt b/internal/tangledlex/schemas.txt --- a/internal/tangledlex/schemas.txt +++ b/internal/tangledlex/schemas.txt @@ -1,10 +1,8 @@ -issue/comment.json issue/issue.json issue/state.json feed/comment.json markup/markdown.json publicKey.json -pulls/comment.json pulls/pull.json pulls/state.json repo/getRepo.json diff --git a/internal/tangledlex/validate.go b/internal/tangledlex/validate.go --- a/internal/tangledlex/validate.go +++ b/internal/tangledlex/validate.go @@ -20,16 +20,12 @@ return validateRepo(collection, value) case RepoIssue: return validateIssue(collection, value) - case RepoIssueComment: - return validateIssueComment(collection, value) case FeedComment: return validateFeedComment(collection, value) case RepoIssueState: return validateIssueState(collection, value) case RepoPull: return validatePull(collection, value) - case RepoPullComment: - return validatePullComment(collection, value) case RepoPullStatus: return validatePullStatus(collection, value) case PublicKey: @@ -104,30 +100,6 @@ } if err := required("title", record.Title); err != nil { return err - } - if err := validateMentions(record.Mentions); err != nil { - return err - } - if err := validateReferences(record.References); err != nil { - return err - } - return datetimeField(record.CreatedAt) -} - -func validateIssueComment(collection string, record RepoIssueComment) error { - if err := validateType(collection, record.LexiconTypeID, "sh.tangled.repo.issue.comment"); err != nil { - return err - } - if err := atURI(record.Issue); err != nil { - return fieldError("issue", err) - } - if err := required("body", record.Body); err != nil { - return err - } - if record.ReplyTo != nil { - if err := atURI(*record.ReplyTo); err != nil { - return fieldError("replyTo", err) - } } if err := validateMentions(record.Mentions); err != nil { return err @@ -246,25 +218,6 @@ if err := atURI(*record.DependentOn); err != nil { return fieldError("dependentOn", err) } - } - if err := validateMentions(record.Mentions); err != nil { - return err - } - if err := validateReferences(record.References); err != nil { - return err - } - return datetimeField(record.CreatedAt) -} - -func validatePullComment(collection string, record RepoPullComment) error { - if err := validateType(collection, record.LexiconTypeID, "sh.tangled.repo.pull.comment"); err != nil { - return err - } - if err := atURI(record.Pull); err != nil { - return fieldError("pull", err) - } - if err := required("body", record.Body); err != nil { - return err } if err := validateMentions(record.Mentions); err != nil { return err diff --git a/internal/tangledlex/validate_test.go b/internal/tangledlex/validate_test.go --- a/internal/tangledlex/validate_test.go +++ b/internal/tangledlex/validate_test.go @@ -48,11 +48,9 @@ }{ {"repo", "sh.tangled.repo", Repo{LexiconTypeID: "sh.tangled.repo", CreatedAt: testTime}, "knot"}, {"issue", "sh.tangled.repo.issue", RepoIssue{LexiconTypeID: "sh.tangled.repo.issue", Title: "title", CreatedAt: testTime}, "repo"}, - {"issue comment", "sh.tangled.repo.issue.comment", RepoIssueComment{LexiconTypeID: "sh.tangled.repo.issue.comment", Body: "body", CreatedAt: testTime}, "issue"}, {"feed comment", "sh.tangled.feed.comment", FeedComment{LexiconTypeID: "sh.tangled.feed.comment", Body: &FeedComment_Body{MarkupMarkdown: &MarkupMarkdown{Text: "body"}}, CreatedAt: testTime}, "subject"}, {"issue state", "sh.tangled.repo.issue.state", RepoIssueState{LexiconTypeID: "sh.tangled.repo.issue.state", Issue: testATURI, State: "invalid", CreatedAt: testTime}, "state"}, {"pull", "sh.tangled.repo.pull", RepoPull{LexiconTypeID: "sh.tangled.repo.pull", Title: "title", CreatedAt: testTime}, "target"}, - {"pull comment", "sh.tangled.repo.pull.comment", RepoPullComment{LexiconTypeID: "sh.tangled.repo.pull.comment", Body: "body", CreatedAt: testTime}, "pull"}, {"pull status", "sh.tangled.repo.pull.status", RepoPullStatus{LexiconTypeID: "sh.tangled.repo.pull.status", Pull: testATURI, Status: "invalid", CreatedAt: testTime}, "status"}, {"public key", "sh.tangled.publicKey", PublicKey{LexiconTypeID: "sh.tangled.publicKey", Name: "key", CreatedAt: testTime}, "key"}, {"string", "sh.tangled.string", String{LexiconTypeID: "sh.tangled.string", Contents: "text", CreatedAt: testTime}, "filename"}, @@ -106,16 +104,6 @@ return record }, contains: "mentions", - }, - { - name: "issue comment reply", - collection: "sh.tangled.repo.issue.comment", - record: func() any { - record := validRecords()["sh.tangled.repo.issue.comment"].(RepoIssueComment) - record.ReplyTo = stringPointer("not-an-at-uri") - return record - }, - contains: "replyTo", }, { name: "feed comment subject URI", @@ -199,16 +187,6 @@ }, contains: "dependentOn", }, - { - name: "pull comment reference", - collection: "sh.tangled.repo.pull.comment", - record: func() any { - record := validRecords()["sh.tangled.repo.pull.comment"].(RepoPullComment) - record.References = []string{"not-an-at-uri"} - return record - }, - contains: "references", - }, } for _, test := range tests { @@ -223,9 +201,8 @@ func validRecords() map[string]any { return map[string]any{ - "sh.tangled.repo": Repo{LexiconTypeID: "sh.tangled.repo", Knot: "knot.example", CreatedAt: testTime}, - "sh.tangled.repo.issue": RepoIssue{LexiconTypeID: "sh.tangled.repo.issue", Repo: testDID, Title: "title", CreatedAt: testTime}, - "sh.tangled.repo.issue.comment": RepoIssueComment{LexiconTypeID: "sh.tangled.repo.issue.comment", Issue: testATURI, Body: "body", CreatedAt: testTime}, + "sh.tangled.repo": Repo{LexiconTypeID: "sh.tangled.repo", Knot: "knot.example", CreatedAt: testTime}, + "sh.tangled.repo.issue": RepoIssue{LexiconTypeID: "sh.tangled.repo.issue", Repo: testDID, Title: "title", CreatedAt: testTime}, "sh.tangled.feed.comment": FeedComment{ LexiconTypeID: "sh.tangled.feed.comment", Subject: &comatproto.RepoStrongRef{Uri: testATURI, Cid: testCID}, @@ -243,10 +220,9 @@ PatchBlob: &lexutil.LexBlob{Ref: lexutil.LexLink(cid.MustParse("bafybeigdyrzt5m6b5nkn55vsgzzfw5cfs2tidw6zqugycdkyybf2z7kz4q")), MimeType: "application/gzip"}, }}, }, - "sh.tangled.repo.pull.comment": RepoPullComment{LexiconTypeID: "sh.tangled.repo.pull.comment", Pull: testATURI, Body: "body", CreatedAt: testTime}, - "sh.tangled.repo.pull.status": RepoPullStatus{LexiconTypeID: "sh.tangled.repo.pull.status", Pull: testATURI, Status: "sh.tangled.repo.pull.status.open", CreatedAt: testTime}, - "sh.tangled.publicKey": PublicKey{LexiconTypeID: "sh.tangled.publicKey", Key: "ssh-ed25519 AAAA", Name: "key", CreatedAt: testTime}, - "sh.tangled.string": String{LexiconTypeID: "sh.tangled.string", Filename: "note.md", Description: "note", Contents: "text", CreatedAt: testTime}, + "sh.tangled.repo.pull.status": RepoPullStatus{LexiconTypeID: "sh.tangled.repo.pull.status", Pull: testATURI, Status: "sh.tangled.repo.pull.status.open", CreatedAt: testTime}, + "sh.tangled.publicKey": PublicKey{LexiconTypeID: "sh.tangled.publicKey", Key: "ssh-ed25519 AAAA", Name: "key", CreatedAt: testTime}, + "sh.tangled.string": String{LexiconTypeID: "sh.tangled.string", Filename: "note.md", Description: "note", Contents: "text", CreatedAt: testTime}, } } diff --git a/internal/tangledlex/cborgen/main.go b/internal/tangledlex/cborgen/main.go --- a/internal/tangledlex/cborgen/main.go +++ b/internal/tangledlex/cborgen/main.go @@ -15,10 +15,8 @@ lex.PublicKey{}, lex.Repo{}, lex.RepoIssue{}, - lex.RepoIssueComment{}, lex.RepoIssueState{}, lex.RepoPull{}, - lex.RepoPullComment{}, lex.RepoPull_Round{}, lex.RepoPull_Source{}, lex.RepoPullStatus{}, diff --git a/internal/tangledlex/schemas/issue/comment.json b/internal/tangledlex/schemas/issue/comment.json deleted file mode 100644 --- a/internal/tangledlex/schemas/issue/comment.json +++ /dev/null @@ -1,47 +0,0 @@ -{ - "lexicon": 1, - "id": "sh.tangled.repo.issue.comment", - "needsCbor": true, - "needsType": true, - "defs": { - "main": { - "type": "record", - "key": "tid", - "record": { - "type": "object", - "required": ["issue", "body", "createdAt"], - "properties": { - "issue": { - "type": "string", - "format": "at-uri" - }, - "body": { - "type": "string" - }, - "createdAt": { - "type": "string", - "format": "datetime" - }, - "replyTo": { - "type": "string", - "format": "at-uri" - }, - "mentions": { - "type": "array", - "items": { - "type": "string", - "format": "did" - } - }, - "references": { - "type": "array", - "items": { - "type": "string", - "format": "at-uri" - } - } - } - } - } - } -} diff --git a/internal/tangledlex/schemas/pulls/comment.json b/internal/tangledlex/schemas/pulls/comment.json deleted file mode 100644 --- a/internal/tangledlex/schemas/pulls/comment.json +++ /dev/null @@ -1,43 +0,0 @@ -{ - "lexicon": 1, - "id": "sh.tangled.repo.pull.comment", - "needsCbor": true, - "needsType": true, - "defs": { - "main": { - "type": "record", - "key": "tid", - "record": { - "type": "object", - "required": ["pull", "body", "createdAt"], - "properties": { - "pull": { - "type": "string", - "format": "at-uri" - }, - "body": { - "type": "string" - }, - "createdAt": { - "type": "string", - "format": "datetime" - }, - "mentions": { - "type": "array", - "items": { - "type": "string", - "format": "did" - } - }, - "references": { - "type": "array", - "items": { - "type": "string", - "format": "at-uri" - } - } - } - } - } - } -} -- tangled.sh