From 514fa7f6306abc89a9e587080ee46577e39e0d6c Mon Sep 17 00:00:00 2001 From: nelind Date: Fri, 30 May 2025 00:03:34 +0200 Subject: [PATCH] lexicons: pulls: remove pull id from the pull record and instead generate ids purely appview side Change-Id: ymqnurtlxropqyxqoqyltmznsvlnxsyo Signed-off-by: nelind --- api/tangled/cbor_gen.go | 50 +--------------------------------------- api/tangled/repopull.go | 1 - appview/db/pulls.go | 1 - appview/pulls/pulls.go | 2 -- lexicons/pulls/pull.json | 4 ---- 5 files changed, 1 insertion(+), 57 deletions(-) diff --git a/api/tangled/cbor_gen.go b/api/tangled/cbor_gen.go index 987bdbb..06a2657 100644 --- a/api/tangled/cbor_gen.go +++ b/api/tangled/cbor_gen.go @@ -6946,7 +6946,7 @@ func (t *RepoPull) MarshalCBOR(w io.Writer) error { } cw := cbg.NewCborWriter(w) - fieldCount := 9 + fieldCount := 8 if t.Body == nil { fieldCount-- @@ -7057,28 +7057,6 @@ func (t *RepoPull) MarshalCBOR(w io.Writer) error { return err } - // t.PullId (int64) (int64) - if len("pullId") > 1000000 { - return xerrors.Errorf("Value in field \"pullId\" was too long") - } - - if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len("pullId"))); err != nil { - return err - } - if _, err := cw.WriteString(string("pullId")); err != nil { - return err - } - - if t.PullId >= 0 { - if err := cw.WriteMajorTypeHeader(cbg.MajUnsignedInt, uint64(t.PullId)); err != nil { - return err - } - } else { - if err := cw.WriteMajorTypeHeader(cbg.MajNegativeInt, uint64(-t.PullId-1)); err != nil { - return err - } - } - // t.Source (tangled.RepoPull_Source) (struct) if t.Source != nil { @@ -7264,32 +7242,6 @@ func (t *RepoPull) UnmarshalCBOR(r io.Reader) (err error) { t.Title = string(sval) } - // t.PullId (int64) (int64) - case "pullId": - { - maj, extra, err := cr.ReadHeader() - if err != nil { - return err - } - var extraI int64 - switch maj { - case cbg.MajUnsignedInt: - extraI = int64(extra) - if extraI < 0 { - return fmt.Errorf("int64 positive overflow") - } - case cbg.MajNegativeInt: - extraI = int64(extra) - if extraI < 0 { - return fmt.Errorf("int64 negative overflow") - } - extraI = -1 - extraI - default: - return fmt.Errorf("wrong type for int64 field: %d", maj) - } - - t.PullId = int64(extraI) - } // t.Source (tangled.RepoPull_Source) (struct) case "source": diff --git a/api/tangled/repopull.go b/api/tangled/repopull.go index e5ad781..dbed245 100644 --- a/api/tangled/repopull.go +++ b/api/tangled/repopull.go @@ -21,7 +21,6 @@ type RepoPull struct { Body *string `json:"body,omitempty" cborgen:"body,omitempty"` CreatedAt string `json:"createdAt" cborgen:"createdAt"` Patch string `json:"patch" cborgen:"patch"` - PullId int64 `json:"pullId" cborgen:"pullId"` Source *RepoPull_Source `json:"source,omitempty" cborgen:"source,omitempty"` TargetBranch string `json:"targetBranch" cborgen:"targetBranch"` TargetRepo string `json:"targetRepo" cborgen:"targetRepo"` diff --git a/appview/db/pulls.go b/appview/db/pulls.go index e993791..69d8edf 100644 --- a/appview/db/pulls.go +++ b/appview/db/pulls.go @@ -94,7 +94,6 @@ func (p Pull) AsRecord() tangled.RepoPull { Title: p.Title, Body: &p.Body, CreatedAt: p.Created.Format(time.RFC3339), - PullId: int64(p.PullId), TargetRepo: p.RepoAt.String(), TargetBranch: p.TargetBranch, Patch: p.LatestPatch(), diff --git a/appview/pulls/pulls.go b/appview/pulls/pulls.go index e57057f..fc36ada 100644 --- a/appview/pulls/pulls.go +++ b/appview/pulls/pulls.go @@ -1091,7 +1091,6 @@ func (s *Pulls) createPullRequest( Record: &lexutil.LexiconTypeDecoder{ Val: &tangled.RepoPull{ Title: title, - PullId: int64(pullId), TargetRepo: string(f.RepoAt), TargetBranch: targetBranch, Patch: patch, @@ -1653,7 +1652,6 @@ func (s *Pulls) resubmitPullHelper( Record: &lexutil.LexiconTypeDecoder{ Val: &tangled.RepoPull{ Title: pull.Title, - PullId: int64(pull.PullId), TargetRepo: string(f.RepoAt), TargetBranch: pull.TargetBranch, Patch: patch, // new patch diff --git a/lexicons/pulls/pull.json b/lexicons/pulls/pull.json index 77f36aa..597f147 100644 --- a/lexicons/pulls/pull.json +++ b/lexicons/pulls/pull.json @@ -12,7 +12,6 @@ "required": [ "targetRepo", "targetBranch", - "pullId", "title", "patch", "createdAt" @@ -25,9 +24,6 @@ "targetBranch": { "type": "string" }, - "pullId": { - "type": "integer" - }, "title": { "type": "string" }, -- 2.50.0