Monorepo for Tangled
0

Configure Feed

Select the types of activity you want to include in your feed.

lexicons/pulls: rename PR `round` to `version`

The old `rounds` field is remain required for backwards compatibility

Signed-off-by: Seongmin Lee <git@boltless.me>

Seongmin Lee (Jul 14, 2026, 4:05 AM +0900) 5a79fb45 50f99c60

+323 -14
+268 -1
api/tangled/cbor_gen.go
··· 12416 12416 } 12417 12417 12418 12418 cw := cbg.NewCborWriter(w) 12419 - fieldCount := 10 12419 + fieldCount := 11 12420 12420 12421 12421 if t.Body == nil { 12422 12422 fieldCount-- ··· 12611 12611 } 12612 12612 12613 12613 } 12614 + } 12615 + 12616 + // t.Versions ([]*tangled.RepoPull_Version) (slice) 12617 + if len("versions") > 1000000 { 12618 + return xerrors.Errorf("Value in field \"versions\" was too long") 12619 + } 12620 + 12621 + if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len("versions"))); err != nil { 12622 + return err 12623 + } 12624 + if _, err := cw.WriteString(string("versions")); err != nil { 12625 + return err 12626 + } 12627 + 12628 + if len(t.Versions) > 8192 { 12629 + return xerrors.Errorf("Slice value in field t.Versions was too long") 12630 + } 12631 + 12632 + if err := cw.WriteMajorTypeHeader(cbg.MajArray, uint64(len(t.Versions))); err != nil { 12633 + return err 12634 + } 12635 + for _, v := range t.Versions { 12636 + if err := v.MarshalCBOR(cw); err != nil { 12637 + return err 12638 + } 12639 + 12614 12640 } 12615 12641 12616 12642 // t.CreatedAt (string) (string) ··· 12915 12941 } 12916 12942 12917 12943 t.Mentions[i] = string(sval) 12944 + } 12945 + 12946 + } 12947 + } 12948 + // t.Versions ([]*tangled.RepoPull_Version) (slice) 12949 + case "versions": 12950 + 12951 + maj, extra, err = cr.ReadHeader() 12952 + if err != nil { 12953 + return err 12954 + } 12955 + 12956 + if extra > 8192 { 12957 + return fmt.Errorf("t.Versions: array too large (%d)", extra) 12958 + } 12959 + 12960 + if maj != cbg.MajArray { 12961 + return fmt.Errorf("expected cbor array") 12962 + } 12963 + 12964 + if extra > 0 { 12965 + t.Versions = make([]*RepoPull_Version, extra) 12966 + } 12967 + 12968 + for i := 0; i < int(extra); i++ { 12969 + { 12970 + var maj byte 12971 + var extra uint64 12972 + var err error 12973 + _ = maj 12974 + _ = extra 12975 + _ = err 12976 + 12977 + { 12978 + 12979 + b, err := cr.ReadByte() 12980 + if err != nil { 12981 + return err 12982 + } 12983 + if b != cbg.CborNull[0] { 12984 + if err := cr.UnreadByte(); err != nil { 12985 + return err 12986 + } 12987 + t.Versions[i] = new(RepoPull_Version) 12988 + if err := t.Versions[i].UnmarshalCBOR(cr); err != nil { 12989 + return xerrors.Errorf("unmarshaling t.Versions[i] pointer: %w", err) 12990 + } 12991 + } 12992 + 12918 12993 } 12919 12994 12920 12995 } ··· 13975 14050 } 13976 14051 13977 14052 t.Branch = string(sval) 14053 + } 14054 + 14055 + default: 14056 + // Field doesn't exist on this type, so ignore it 14057 + if err := cbg.ScanForLinks(r, func(cid.Cid) {}); err != nil { 14058 + return err 14059 + } 14060 + } 14061 + } 14062 + 14063 + return nil 14064 + } 14065 + func (t *RepoPull_Version) MarshalCBOR(w io.Writer) error { 14066 + if t == nil { 14067 + _, err := w.Write(cbg.CborNull) 14068 + return err 14069 + } 14070 + 14071 + cw := cbg.NewCborWriter(w) 14072 + fieldCount := 3 14073 + 14074 + if t.Base == nil { 14075 + fieldCount-- 14076 + } 14077 + 14078 + if _, err := cw.Write(cbg.CborEncodeMajorType(cbg.MajMap, uint64(fieldCount))); err != nil { 14079 + return err 14080 + } 14081 + 14082 + // t.Base (string) (string) 14083 + if t.Base != nil { 14084 + 14085 + if len("base") > 1000000 { 14086 + return xerrors.Errorf("Value in field \"base\" was too long") 14087 + } 14088 + 14089 + if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len("base"))); err != nil { 14090 + return err 14091 + } 14092 + if _, err := cw.WriteString(string("base")); err != nil { 14093 + return err 14094 + } 14095 + 14096 + if t.Base == nil { 14097 + if _, err := cw.Write(cbg.CborNull); err != nil { 14098 + return err 14099 + } 14100 + } else { 14101 + if len(*t.Base) > 1000000 { 14102 + return xerrors.Errorf("Value in field t.Base was too long") 14103 + } 14104 + 14105 + if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len(*t.Base))); err != nil { 14106 + return err 14107 + } 14108 + if _, err := cw.WriteString(string(*t.Base)); err != nil { 14109 + return err 14110 + } 14111 + } 14112 + } 14113 + 14114 + // t.Head (string) (string) 14115 + if len("head") > 1000000 { 14116 + return xerrors.Errorf("Value in field \"head\" was too long") 14117 + } 14118 + 14119 + if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len("head"))); err != nil { 14120 + return err 14121 + } 14122 + if _, err := cw.WriteString(string("head")); err != nil { 14123 + return err 14124 + } 14125 + 14126 + if len(t.Head) > 1000000 { 14127 + return xerrors.Errorf("Value in field t.Head was too long") 14128 + } 14129 + 14130 + if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len(t.Head))); err != nil { 14131 + return err 14132 + } 14133 + if _, err := cw.WriteString(string(t.Head)); err != nil { 14134 + return err 14135 + } 14136 + 14137 + // t.CreatedAt (string) (string) 14138 + if len("createdAt") > 1000000 { 14139 + return xerrors.Errorf("Value in field \"createdAt\" was too long") 14140 + } 14141 + 14142 + if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len("createdAt"))); err != nil { 14143 + return err 14144 + } 14145 + if _, err := cw.WriteString(string("createdAt")); err != nil { 14146 + return err 14147 + } 14148 + 14149 + if len(t.CreatedAt) > 1000000 { 14150 + return xerrors.Errorf("Value in field t.CreatedAt was too long") 14151 + } 14152 + 14153 + if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len(t.CreatedAt))); err != nil { 14154 + return err 14155 + } 14156 + if _, err := cw.WriteString(string(t.CreatedAt)); err != nil { 14157 + return err 14158 + } 14159 + return nil 14160 + } 14161 + 14162 + func (t *RepoPull_Version) UnmarshalCBOR(r io.Reader) (err error) { 14163 + *t = RepoPull_Version{} 14164 + 14165 + cr := cbg.NewCborReader(r) 14166 + 14167 + maj, extra, err := cr.ReadHeader() 14168 + if err != nil { 14169 + return err 14170 + } 14171 + defer func() { 14172 + if err == io.EOF { 14173 + err = io.ErrUnexpectedEOF 14174 + } 14175 + }() 14176 + 14177 + if maj != cbg.MajMap { 14178 + return fmt.Errorf("cbor input should be of type map") 14179 + } 14180 + 14181 + if extra > cbg.MaxLength { 14182 + return fmt.Errorf("RepoPull_Version: map struct too large (%d)", extra) 14183 + } 14184 + 14185 + n := extra 14186 + 14187 + nameBuf := make([]byte, 9) 14188 + for i := uint64(0); i < n; i++ { 14189 + nameLen, ok, err := cbg.ReadFullStringIntoBuf(cr, nameBuf, 1000000) 14190 + if err != nil { 14191 + return err 14192 + } 14193 + 14194 + if !ok { 14195 + // Field doesn't exist on this type, so ignore it 14196 + if err := cbg.ScanForLinks(cr, func(cid.Cid) {}); err != nil { 14197 + return err 14198 + } 14199 + continue 14200 + } 14201 + 14202 + switch string(nameBuf[:nameLen]) { 14203 + // t.Base (string) (string) 14204 + case "base": 14205 + 14206 + { 14207 + b, err := cr.ReadByte() 14208 + if err != nil { 14209 + return err 14210 + } 14211 + if b != cbg.CborNull[0] { 14212 + if err := cr.UnreadByte(); err != nil { 14213 + return err 14214 + } 14215 + 14216 + sval, err := cbg.ReadStringWithMax(cr, 1000000) 14217 + if err != nil { 14218 + return err 14219 + } 14220 + 14221 + t.Base = (*string)(&sval) 14222 + } 14223 + } 14224 + // t.Head (string) (string) 14225 + case "head": 14226 + 14227 + { 14228 + sval, err := cbg.ReadStringWithMax(cr, 1000000) 14229 + if err != nil { 14230 + return err 14231 + } 14232 + 14233 + t.Head = string(sval) 14234 + } 14235 + // t.CreatedAt (string) (string) 14236 + case "createdAt": 14237 + 14238 + { 14239 + sval, err := cbg.ReadStringWithMax(cr, 1000000) 14240 + if err != nil { 14241 + return err 14242 + } 14243 + 14244 + t.CreatedAt = string(sval) 13978 14245 } 13979 14246 13980 14247 default:
+22 -11
api/tangled/repopull.go
··· 17 17 } // 18 18 // RECORDTYPE: RepoPull 19 19 type RepoPull struct { 20 - LexiconTypeID string `json:"$type,const=sh.tangled.repo.pull" cborgen:"$type,const=sh.tangled.repo.pull"` 21 - Body *string `json:"body,omitempty" cborgen:"body,omitempty"` 22 - CreatedAt string `json:"createdAt" cborgen:"createdAt"` 23 - DependentOn *string `json:"dependentOn,omitempty" cborgen:"dependentOn,omitempty"` 24 - Mentions []string `json:"mentions,omitempty" cborgen:"mentions,omitempty"` 25 - References []string `json:"references,omitempty" cborgen:"references,omitempty"` 26 - Rounds []*RepoPull_Round `json:"rounds" cborgen:"rounds"` 27 - Source *RepoPull_Source `json:"source,omitempty" cborgen:"source,omitempty"` 28 - Target *RepoPull_Target `json:"target" cborgen:"target"` 29 - Title string `json:"title" cborgen:"title"` 20 + LexiconTypeID string `json:"$type,const=sh.tangled.repo.pull" cborgen:"$type,const=sh.tangled.repo.pull"` 21 + Body *string `json:"body,omitempty" cborgen:"body,omitempty"` 22 + CreatedAt string `json:"createdAt" cborgen:"createdAt"` 23 + DependentOn *string `json:"dependentOn,omitempty" cborgen:"dependentOn,omitempty"` 24 + Mentions []string `json:"mentions,omitempty" cborgen:"mentions,omitempty"` 25 + References []string `json:"references,omitempty" cborgen:"references,omitempty"` 26 + // rounds: DEPRECATED: always empty 27 + Rounds []*RepoPull_Round `json:"rounds" cborgen:"rounds"` 28 + Source *RepoPull_Source `json:"source,omitempty" cborgen:"source,omitempty"` 29 + Target *RepoPull_Target `json:"target" cborgen:"target"` 30 + Title string `json:"title" cborgen:"title"` 31 + Versions []*RepoPull_Version `json:"versions" cborgen:"versions"` 30 32 } 31 33 32 34 // RepoPull_Round is a "round" in the sh.tangled.repo.pull schema. 33 35 // 34 - // revisions of this pull request, newer rounds are appended to this array. appviews may reject records do not treat this field as append-only. the blob format is gzipped text-based git-format-patches. 36 + // DEPRECATED: revisions of this pull request, newer rounds are appended to this array. appviews may reject records do not treat this field as append-only. the blob format is gzipped text-based git-format-patches. 35 37 type RepoPull_Round struct { 36 38 CreatedAt string `json:"createdAt" cborgen:"createdAt"` 37 39 PatchBlob *util.LexBlob `json:"patchBlob" cborgen:"patchBlob"` ··· 48 50 Branch string `json:"branch" cborgen:"branch"` 49 51 Repo string `json:"repo" cborgen:"repo"` 50 52 } 53 + 54 + // RepoPull_Version is a "version" in the sh.tangled.repo.pull schema. 55 + type RepoPull_Version struct { 56 + // base: merge-base commit ID for combined interdiff 57 + Base *string `json:"base,omitempty" cborgen:"base,omitempty"` 58 + CreatedAt string `json:"createdAt" cborgen:"createdAt"` 59 + // head: HEAD commit ID 60 + Head string `json:"head" cborgen:"head"` 61 + }
+1
cmd/cborgen/cborgen.go
··· 67 67 tangled.RepoPull_Source{}, 68 68 tangled.RepoPullStatus{}, 69 69 tangled.RepoPull_Target{}, 70 + tangled.RepoPull_Version{}, 70 71 tangled.Spindle{}, 71 72 tangled.SpindleMember{}, 72 73 tangled.String{},
+32 -2
lexicons/pulls/pull.json
··· 13 13 "target", 14 14 "title", 15 15 "createdAt", 16 - "rounds" 16 + "rounds", 17 + "versions" 17 18 ], 18 19 "properties": { 19 20 "title": { ··· 24 25 }, 25 26 "rounds": { 26 27 "type": "array", 28 + "description": "DEPRECATED: always empty", 27 29 "items": { 28 30 "type": "ref", 29 31 "ref": "#round" 32 + } 33 + }, 34 + "versions": { 35 + "type": "array", 36 + "items": { 37 + "type": "ref", 38 + "ref": "#version" 30 39 } 31 40 }, 32 41 "source": { ··· 99 108 "patchBlob", 100 109 "createdAt" 101 110 ], 102 - "description": "revisions of this pull request, newer rounds are appended to this array. appviews may reject records do not treat this field as append-only. the blob format is gzipped text-based git-format-patches.", 111 + "description": "DEPRECATED: revisions of this pull request, newer rounds are appended to this array. appviews may reject records do not treat this field as append-only. the blob format is gzipped text-based git-format-patches.", 103 112 "properties": { 104 113 "createdAt": { 105 114 "type": "string", ··· 110 119 "accept": [ 111 120 "application/gzip" 112 121 ] 122 + } 123 + } 124 + }, 125 + "version": { 126 + "type": "object", 127 + "required": [ 128 + "head", 129 + "createdAt" 130 + ], 131 + "properties": { 132 + "createdAt": { 133 + "type": "string", 134 + "format": "datetime" 135 + }, 136 + "base": { 137 + "type": "string", 138 + "description": "merge-base commit ID for combined interdiff" 139 + }, 140 + "head": { 141 + "type": "string", 142 + "description": "HEAD commit ID" 113 143 } 114 144 } 115 145 }