From d2d3ebbf44fbf0362edaf78d991615f564644615 Mon Sep 17 00:00:00 2001 From: jochen Date: Sun, 22 Nov 2026 00:08:50 +0100 Subject: [PATCH] D5: the git seat's tags name their commits, and a holder says away MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit tags answers items {tag, commit}; trees' description says a missing directory answers not-found; the error kind away joins refused, not-found and failed, every answer carrying part and words with it; tag's description names the /v form. The seat's form rises to 2. The builder's, bridge's and indexer's readers take the tag's name from the item. Builds: design 47 H2 §776, §796; H-A-350 DMC-2, DMC-3, H-A-354 --- .../cmd/mesh-delivery-builder/versions.go | 4 +- .../go/seats/git/contract.go | 80 ++++++++- .../go/seats/git/contract_test.go | 6 +- .../seats/git/fixtures/verbs.json | 31 +++- .../seats/git/seat.json | 164 ++++++++++++++++-- .../ts/seats/git/index.d.ts | 71 +++++++- .../internal/bridge/bridge_test.go | 2 +- .../internal/bridge/tags.go | 4 +- .../floor_integration_test.go | 2 +- .../cmd/mesh-delivery-indexer/versions.go | 4 +- 10 files changed, 330 insertions(+), 38 deletions(-) diff --git a/modules/mesh-delivery-builder/cmd/mesh-delivery-builder/versions.go b/modules/mesh-delivery-builder/cmd/mesh-delivery-builder/versions.go index fbd625acb..cf254da22 100644 --- a/modules/mesh-delivery-builder/cmd/mesh-delivery-builder/versions.go +++ b/modules/mesh-delivery-builder/cmd/mesh-delivery-builder/versions.go @@ -160,7 +160,9 @@ func floorVia(call toolCaller, requirements func(context.Context, string) ([]str if a.Error != "" { return nil, fmt.Errorf("the seat git's tags: %s", a.Error) } - out = append(out, a.Tags...) + for _, t := range a.Tags { + out = append(out, t.Tag) + } if !a.More { return out, nil } diff --git a/modules/mesh-delivery-contracts/go/seats/git/contract.go b/modules/mesh-delivery-contracts/go/seats/git/contract.go index 8a0104cd5..1eb6a5164 100644 --- a/modules/mesh-delivery-contracts/go/seats/git/contract.go +++ b/modules/mesh-delivery-contracts/go/seats/git/contract.go @@ -14,13 +14,13 @@ const Seat = "git" // Form is the form of the seat's values, events and answers this contract was generated at (design 47 H2 §780): // a reader of a value of another form says "form N, this reader knows M". -const Form = 1 +const Form = 2 // The forms and the digest of the fields this contract was generated from: the generator's compare fails a definition // whose fields changed while its forms did not (design 47 H2 §780). const ( - generatedForms = "1" - generatedFieldsDigest = "BranchAnswer=3195d124d743 BranchMovedEvent=baaa6fdf37f2 Call=ebef3639e061 CallMember=8d7bf9b9c258 CallsByCallCallValue=05142ac90d52 Change=5a13d1572e59 CommentAnswer=a784c00b0525 ContainsAnswer=0e9dfceb8abc ErrorKind=dd980ce32cee FailedStep=d68341819717 FailedStepsByModuleFingerprintStepValue=0fce6f5d3273 FileAnswer=79d19a058afd ForgeDeleteEvent=35a0828a1238 ForgePullEvent=303345c390d7 ForgeStatusEvent=689488c43094 MemberOutcome=c35056683738 MergeCalled=cb5a36d22c92 MergeCalledEvent=8597a63a790c MergeCalledMembersItem=211bdc9bab48 MergeCalledRefusedItem=bbf9ce4382c8 MergePullAnswer=fb8ef9812f3b Merging=482fbecedd58 NoteAnswer=a784c00b0525 OpenPull=56217c4c348a OpenPullsAnswer=d019b5d2ba56 Pull=6e3fdd146b1c PullAnswer=4c45f0fc3597 PullClosedEvent=c2b7ac1de473 PullMergedEvent=619d9c863307 PullUpdatedEvent=f86ee614998e RepoWritableEvent=1a8c6e6344ba Status=b2980533a044 StatusAnswer=a784c00b0525 StatusesAnswer=591f82f64fec TagAnswer=56641525b79b TagsAnswer=4f579a2d69f2 TreesAnswer=32583cb10fab ViewAnswer=a784c00b0525" + generatedForms = "2" + generatedFieldsDigest = "BranchAnswer=1cc6612a710e BranchMovedEvent=baaa6fdf37f2 Call=ebef3639e061 CallMember=8d7bf9b9c258 CallsByCallCallValue=05142ac90d52 Change=5a13d1572e59 CommentAnswer=74ec3ece9f05 ContainsAnswer=071d0e9742bd ErrorKind=3d26b2c1442a FailedStep=d68341819717 FailedStepsByModuleFingerprintStepValue=0fce6f5d3273 FileAnswer=8fcc52522004 ForgeDeleteEvent=35a0828a1238 ForgePullEvent=303345c390d7 ForgeStatusEvent=689488c43094 MemberOutcome=c35056683738 MergeCalled=cb5a36d22c92 MergeCalledEvent=8597a63a790c MergeCalledMembersItem=211bdc9bab48 MergeCalledRefusedItem=bbf9ce4382c8 MergePullAnswer=4ada4a7040bb Merging=482fbecedd58 NoteAnswer=74ec3ece9f05 OpenPull=56217c4c348a OpenPullsAnswer=a15ee399a171 Pull=6e3fdd146b1c PullAnswer=a8def6c28bf9 PullClosedEvent=c2b7ac1de473 PullMergedEvent=619d9c863307 PullUpdatedEvent=f86ee614998e RepoWritableEvent=1a8c6e6344ba Status=b2980533a044 StatusAnswer=74ec3ece9f05 StatusesAnswer=1c524343c18d Tag=b419017f7885 TagAnswer=8c1fa0ac9f1b TagsAnswer=77e4374f7d62 TreesAnswer=bc1ffccd2716 ViewAnswer=74ec3ece9f05" ) const ( @@ -224,7 +224,7 @@ type Change struct { Removed []string `json:"removed,omitempty"` } -// ErrorKind is which kind of error, set with error alone: refused, the forge or the holder refused and error says why in the forge's own words; not-found, the forge said that what was asked about (a repository, a commit, a pull request, a branch or a tag) does not exist, so a caller never reads it out of error's words; failed, the forge failed or could not be reached, so the act or read could not be performed. +// ErrorKind is which kind of error, set with error alone: refused, the forge or the holder refused and error says why in the forge's own words; not-found, the forge said that what was asked about (a repository, a commit, a pull request, a branch or a tag) does not exist, so a caller never reads it out of error's words; failed, the forge failed or could not be reached, so the act or read could not be performed; away, a part the holder depends on (the forge, its store) is away, with part naming what did not answer and words: a caller reads it as a transport fault and calls again (design 47 H2 §776). type ErrorKind = string // The values of ErrorKind. @@ -232,6 +232,7 @@ const ( ErrorKindRefused = "refused" ErrorKindNotFound = "not-found" ErrorKindFailed = "failed" + ErrorKindAway = "away" ) // FailedStep is a failed required step at a build-input fingerprint, with the commits it was seen at and the run that failed it (design 47 *Judged from its own state, never by a call*); cleared by a later passing rerun of that step whose proved caller is the operator or a healer. @@ -344,6 +345,13 @@ type Status struct { Target string `json:"target,omitempty"` } +// Tag is a tag and the commit it names (design 47 H2 §796). +type Tag struct { + // the commit it names, its full 40-hex sha + Commit string `json:"commit"` + Tag string `json:"tag"` +} + // MergeCalledMembersItem is a type of the contract. type MergeCalledMembersItem struct { // the pull request's base, a watched branch @@ -398,7 +406,11 @@ type PullAnswer struct { // is the form of what this value carries, left out while it is 1 (design 47 H2 §780). Form int64 `json:"form,omitempty"` Merging *Merging `json:"merging,omitempty"` - Pull *Pull `json:"pull,omitempty"` + // with the error kind away, what did not answer (design 47 H2 §776) + Part string `json:"part,omitempty"` + Pull *Pull `json:"pull,omitempty"` + // with the error kind away, the holder's words (design 47 H2 §776) + Words string `json:"words,omitempty"` } // BranchInput is what branch takes. @@ -417,8 +429,12 @@ type BranchAnswer struct { // is the form of what this value carries, left out while it is 1 (design 47 H2 §780). Form int64 `json:"form,omitempty"` // a commit, its full 40-hex sha - Head string `json:"head,omitempty"` + Head string `json:"head,omitempty"` + // with the error kind away, what did not answer (design 47 H2 §776) + Part string `json:"part,omitempty"` Repository string `json:"repository,omitempty"` + // with the error kind away, the holder's words (design 47 H2 §776) + Words string `json:"words,omitempty"` } // OpenPullsInput is what open-pulls takes. @@ -432,8 +448,12 @@ type OpenPullsAnswer struct { ErrorKind ErrorKind `json:"error-kind,omitempty"` // is the form of what this value carries, left out while it is 1 (design 47 H2 §780). Form int64 `json:"form,omitempty"` + // with the error kind away, what did not answer (design 47 H2 §776) + Part string `json:"part,omitempty"` // every open pull request; said empty when none is open, so an answer that lacks it is never read as none Pulls []OpenPull `json:"pulls"` + // with the error kind away, the holder's words (design 47 H2 §776) + Words string `json:"words,omitempty"` } // TagsInput is what tags takes. @@ -459,10 +479,14 @@ type TagsAnswer struct { More bool `json:"more,omitempty"` // the page Page int64 `json:"page,omitempty"` + // with the error kind away, what did not answer (design 47 H2 §776) + Part string `json:"part,omitempty"` // the repository, / Repository string `json:"repository,omitempty"` - // the tags of this page - Tags []string `json:"tags,omitempty"` + // the tags of this page, each with the commit it names (design 47 H2 §796) + Tags []Tag `json:"tags,omitempty"` + // with the error kind away, the holder's words (design 47 H2 §776) + Words string `json:"words,omitempty"` } // TreesInput is what trees takes. @@ -488,12 +512,16 @@ type TreesAnswer struct { Files map[string]map[string]string `json:"files,omitempty"` // is the form of what this value carries, left out while it is 1 (design 47 H2 §780). Form int64 `json:"form,omitempty"` + // with the error kind away, what did not answer (design 47 H2 §776) + Part string `json:"part,omitempty"` // directory to {path: object id} Paths map[string]map[string]string `json:"paths,omitempty"` // the root tree's hash Root string `json:"root,omitempty"` // directory to its tree's hash, the root as the empty name Trees map[string]string `json:"trees,omitempty"` + // with the error kind away, the holder's words (design 47 H2 §776) + Words string `json:"words,omitempty"` } // FileInput is what file takes. @@ -519,12 +547,16 @@ type FileAnswer struct { ErrorKind ErrorKind `json:"error-kind,omitempty"` // is the form of what this value carries, left out while it is 1 (design 47 H2 §780). Form int64 `json:"form,omitempty"` + // with the error kind away, what did not answer (design 47 H2 §776) + Part string `json:"part,omitempty"` // the path Path string `json:"path,omitempty"` // what was read Ref string `json:"ref,omitempty"` // its size in bytes Size int64 `json:"size,omitempty"` + // with the error kind away, the holder's words (design 47 H2 §776) + Words string `json:"words,omitempty"` } // ContainsInput is what contains takes. @@ -552,6 +584,10 @@ type ContainsAnswer struct { Form int64 `json:"form,omitempty"` // the other In string `json:"in,omitempty"` + // with the error kind away, what did not answer (design 47 H2 §776) + Part string `json:"part,omitempty"` + // with the error kind away, the holder's words (design 47 H2 §776) + Words string `json:"words,omitempty"` } // StatusesInput is what statuses takes. @@ -573,8 +609,12 @@ type StatusesAnswer struct { ErrorKind ErrorKind `json:"error-kind,omitempty"` // is the form of what this value carries, left out while it is 1 (design 47 H2 §780). Form int64 `json:"form,omitempty"` + // with the error kind away, what did not answer (design 47 H2 §776) + Part string `json:"part,omitempty"` // the newest of each context Statuses []Status `json:"statuses,omitempty"` + // with the error kind away, the holder's words (design 47 H2 §776) + Words string `json:"words,omitempty"` } // StatusInput is what status takes. @@ -615,8 +655,12 @@ type StatusAnswer struct { Held bool `json:"held,omitempty"` // the act's id, as the caller gave it ID string `json:"id,omitempty"` + // with the error kind away, what did not answer (design 47 H2 §776) + Part string `json:"part,omitempty"` // the forge holds the act now Performed bool `json:"performed,omitempty"` + // with the error kind away, the holder's words (design 47 H2 §776) + Words string `json:"words,omitempty"` } // CommentInput is what comment takes. @@ -642,8 +686,12 @@ type CommentAnswer struct { Held bool `json:"held,omitempty"` // the act's id, as the caller gave it ID string `json:"id,omitempty"` + // with the error kind away, what did not answer (design 47 H2 §776) + Part string `json:"part,omitempty"` // the forge holds the act now Performed bool `json:"performed,omitempty"` + // with the error kind away, the holder's words (design 47 H2 §776) + Words string `json:"words,omitempty"` } // ViewInput is what view takes. @@ -669,8 +717,12 @@ type ViewAnswer struct { Held bool `json:"held,omitempty"` // the act's id, as the caller gave it ID string `json:"id,omitempty"` + // with the error kind away, what did not answer (design 47 H2 §776) + Part string `json:"part,omitempty"` // the forge holds the act now Performed bool `json:"performed,omitempty"` + // with the error kind away, the holder's words (design 47 H2 §776) + Words string `json:"words,omitempty"` } // NoteInput is what note takes. @@ -696,8 +748,12 @@ type NoteAnswer struct { Held bool `json:"held,omitempty"` // the act's id, as the caller gave it ID string `json:"id,omitempty"` + // with the error kind away, what did not answer (design 47 H2 §776) + Part string `json:"part,omitempty"` // the forge holds the act now Performed bool `json:"performed,omitempty"` + // with the error kind away, the holder's words (design 47 H2 §776) + Words string `json:"words,omitempty"` } // MergePullInputPullsItem is a type of the contract. @@ -729,6 +785,10 @@ type MergePullAnswer struct { Form int64 `json:"form,omitempty"` // each member's outcome, in the order named Members []MemberOutcome `json:"members,omitempty"` + // with the error kind away, what did not answer (design 47 H2 §776) + Part string `json:"part,omitempty"` + // with the error kind away, the holder's words (design 47 H2 §776) + Words string `json:"words,omitempty"` } // TagInput is what tag takes. @@ -748,10 +808,14 @@ type TagAnswer struct { ErrorKind ErrorKind `json:"error-kind,omitempty"` // is the form of what this value carries, left out while it is 1 (design 47 H2 §780). Form int64 `json:"form,omitempty"` + // with the error kind away, what did not answer (design 47 H2 §776) + Part string `json:"part,omitempty"` // the forge holds the tag at that commit now Performed bool `json:"performed,omitempty"` // the tag, as asked Tag string `json:"tag,omitempty"` + // with the error kind away, the holder's words (design 47 H2 §776) + Words string `json:"words,omitempty"` } // PullUpdatedEvent is the body of the event pull-updated. diff --git a/modules/mesh-delivery-contracts/go/seats/git/contract_test.go b/modules/mesh-delivery-contracts/go/seats/git/contract_test.go index 26db77113..4cbe9e1e1 100644 --- a/modules/mesh-delivery-contracts/go/seats/git/contract_test.go +++ b/modules/mesh-delivery-contracts/go/seats/git/contract_test.go @@ -61,7 +61,7 @@ func TestFixtures(t *testing.T) { decode: func(b []byte) (any, error) { var v OpenPullsAnswer; err := json.Unmarshal(b, &v); return v, err }, subjectIs: nil}, {name: "tags asks", subject: "", given: "{\"page\":1,\"prefix\":\"go/v\",\"repository\":\"novox/mesh-sdk\"}", wire: "{\"page\":1,\"prefix\":\"go/v\",\"repository\":\"novox/mesh-sdk\"}", decode: func(b []byte) (any, error) { var v TagsInput; err := json.Unmarshal(b, &v); return v, err }, subjectIs: nil}, - {name: "tags answers", subject: "", given: "{\"bound\":50,\"more\":true,\"page\":1,\"repository\":\"novox/mesh-sdk\",\"tags\":[\"go/v0.1.15\",\"go/v0.1.14\"]}", wire: "{\"bound\":50,\"more\":true,\"page\":1,\"repository\":\"novox/mesh-sdk\",\"tags\":[\"go/v0.1.15\",\"go/v0.1.14\"]}", + {name: "tags answers", subject: "", given: "{\"bound\":50,\"more\":true,\"page\":1,\"repository\":\"novox/mesh-sdk\",\"tags\":[{\"commit\":\"bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb\",\"tag\":\"go/v0.1.15\"},{\"commit\":\"cccccccccccccccccccccccccccccccccccccccc\",\"tag\":\"go/v0.1.14\"}]}", wire: "{\"bound\":50,\"more\":true,\"page\":1,\"repository\":\"novox/mesh-sdk\",\"tags\":[{\"commit\":\"bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb\",\"tag\":\"go/v0.1.15\"},{\"commit\":\"cccccccccccccccccccccccccccccccccccccccc\",\"tag\":\"go/v0.1.14\"}]}", decode: func(b []byte) (any, error) { var v TagsAnswer; err := json.Unmarshal(b, &v); return v, err }, subjectIs: nil}, {name: "tags answers an error, never none", subject: "", given: "{\"error\":\"the forge answered 404 for novox/nothing\",\"error-kind\":\"refused\"}", wire: "{\"error\":\"the forge answered 404 for novox/nothing\",\"error-kind\":\"refused\"}", decode: func(b []byte) (any, error) { var v TagsAnswer; err := json.Unmarshal(b, &v); return v, err }, subjectIs: nil}, @@ -139,6 +139,10 @@ func TestFixtures(t *testing.T) { decode: func(b []byte) (any, error) { var v MergePullAnswer; err := json.Unmarshal(b, &v); return v, err }, subjectIs: nil}, {name: "merge-pull answers an error, never none", subject: "", given: "{\"error\":\"the forge answered 502\",\"error-kind\":\"failed\"}", wire: "{\"error\":\"the forge answered 502\",\"error-kind\":\"failed\"}", decode: func(b []byte) (any, error) { var v MergePullAnswer; err := json.Unmarshal(b, &v); return v, err }, subjectIs: nil}, + {name: "trees answers away while the forge's store is away", subject: "", given: "{\"error\":\"away: the forge: its store is unavailable\",\"error-kind\":\"away\",\"part\":\"the forge\",\"words\":\"its store is unavailable\"}", wire: "{\"error\":\"away: the forge: its store is unavailable\",\"error-kind\":\"away\",\"part\":\"the forge\",\"words\":\"its store is unavailable\"}", + decode: func(b []byte) (any, error) { var v TreesAnswer; err := json.Unmarshal(b, &v); return v, err }, subjectIs: nil}, + {name: "trees answers a missing directory as not-found", subject: "", given: "{\"error\":\"modules/gone is not in aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\",\"error-kind\":\"not-found\"}", wire: "{\"error\":\"modules/gone is not in aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\",\"error-kind\":\"not-found\"}", + decode: func(b []byte) (any, error) { var v TreesAnswer; err := json.Unmarshal(b, &v); return v, err }, subjectIs: nil}, } for _, c := range cases { v, err := c.decode([]byte(c.given)) diff --git a/modules/mesh-delivery-contracts/seats/git/fixtures/verbs.json b/modules/mesh-delivery-contracts/seats/git/fixtures/verbs.json index dc73b03fa..85aea8b0e 100644 --- a/modules/mesh-delivery-contracts/seats/git/fixtures/verbs.json +++ b/modules/mesh-delivery-contracts/seats/git/fixtures/verbs.json @@ -131,8 +131,14 @@ "given": { "repository": "novox/mesh-sdk", "tags": [ - "go/v0.1.15", - "go/v0.1.14" + { + "tag": "go/v0.1.15", + "commit": "bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb" + }, + { + "tag": "go/v0.1.14", + "commit": "cccccccccccccccccccccccccccccccccccccccc" + } ], "page": 1, "bound": 50, @@ -511,7 +517,7 @@ { "name": "merge-pull refuses every member when one is refused, naming why", "of": "verb:merge-pull.answer", - "why": "every member is judged before any is merged (design 47 H \u00a7735)", + "why": "every member is judged before any is merged (design 47 H §735)", "given": { "call": "0123456789abcdef", "members": [ @@ -553,5 +559,24 @@ "error": "the forge answered 502", "error-kind": "failed" } + }, + { + "name": "trees answers away while the forge's store is away", + "of": "verb:trees.answer", + "why": "design 47 H2 §776: a holder's word that what it depends on is away, read as a transport fault", + "given": { + "error": "away: the forge: its store is unavailable", + "error-kind": "away", + "part": "the forge", + "words": "its store is unavailable" + } + }, + { + "name": "trees answers a missing directory as not-found", + "of": "verb:trees.answer", + "given": { + "error": "modules/gone is not in aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa", + "error-kind": "not-found" + } } ] diff --git a/modules/mesh-delivery-contracts/seats/git/seat.json b/modules/mesh-delivery-contracts/seats/git/seat.json index db42887fa..b038f4156 100644 --- a/modules/mesh-delivery-contracts/seats/git/seat.json +++ b/modules/mesh-delivery-contracts/seats/git/seat.json @@ -5,7 +5,7 @@ "grain": "whole", "domain": "Delivery", "decision": "novox/hq ADR 0111", - "description": "The forge: every read and act a delivery part makes of the mesh's git repositories, and what the forge says happened (design 47 *The seat git*, ADR 0596 \u00a71, \u00a72). A failed read answers an error, never an empty answer.", + "description": "The forge: every read and act a delivery part makes of the mesh's git repositories, and what the forge says happened (design 47 *The seat git*, ADR 0596 §1, §2). A failed read answers an error, never an empty answer.", "delivers": "git", "verbs": [ { @@ -48,6 +48,14 @@ }, "error-kind": { "$ref": "#/defs/ErrorKind" + }, + "part": { + "type": "string", + "description": "with the error kind away, what did not answer (design 47 H2 §776)" + }, + "words": { + "type": "string", + "description": "with the error kind away, the holder's words (design 47 H2 §776)" } }, "description": "what pull answers; error and error-kind alone when it fails" @@ -96,6 +104,14 @@ }, "error-kind": { "$ref": "#/defs/ErrorKind" + }, + "part": { + "type": "string", + "description": "with the error kind away, what did not answer (design 47 H2 §776)" + }, + "words": { + "type": "string", + "description": "with the error kind away, the holder's words (design 47 H2 §776)" } }, "description": "what branch answers; error and error-kind alone when it fails" @@ -126,6 +142,14 @@ }, "error-kind": { "$ref": "#/defs/ErrorKind" + }, + "part": { + "type": "string", + "description": "with the error kind away, what did not answer (design 47 H2 §776)" + }, + "words": { + "type": "string", + "description": "with the error kind away, the holder's words (design 47 H2 §776)" } }, "description": "what open-pulls answers; pulls always said, empty when none is open; error and error-kind beside an empty pulls when it fails", @@ -171,9 +195,9 @@ "tags": { "type": "array", "items": { - "type": "string" + "$ref": "#/defs/Tag" }, - "description": "the tags of this page" + "description": "the tags of this page, each with the commit it names (design 47 H2 §796)" }, "page": { "type": "integer", @@ -193,6 +217,14 @@ }, "error-kind": { "$ref": "#/defs/ErrorKind" + }, + "part": { + "type": "string", + "description": "with the error kind away, what did not answer (design 47 H2 §776)" + }, + "words": { + "type": "string", + "description": "with the error kind away, the holder's words (design 47 H2 §776)" } }, "description": "what tags answers; error and error-kind alone when it fails" @@ -201,7 +233,7 @@ }, { "name": "trees", - "description": "The trees of one commit: the root tree and the tree of every directory that holds a module.json, by their git hashes; with files, every blob under each named directory; with paths, the object of each named path. A listing the forge cut is refused, never answered in part.", + "description": "The trees of one commit: the root tree and the tree of every directory that holds a module.json, by their git hashes; with files, every blob under each named directory; with paths, the object of each named path. A listing the forge cut is refused, never answered in part. A directory named in files or paths that the commit does not hold answers the error kind not-found (design 47 H2 §796).", "input": { "type": "object", "properties": { @@ -284,6 +316,14 @@ }, "error-kind": { "$ref": "#/defs/ErrorKind" + }, + "part": { + "type": "string", + "description": "with the error kind away, what did not answer (design 47 H2 §776)" + }, + "words": { + "type": "string", + "description": "with the error kind away, the holder's words (design 47 H2 §776)" } }, "description": "what trees answers; error and error-kind alone when it fails" @@ -350,6 +390,14 @@ }, "error-kind": { "$ref": "#/defs/ErrorKind" + }, + "part": { + "type": "string", + "description": "with the error kind away, what did not answer (design 47 H2 §776)" + }, + "words": { + "type": "string", + "description": "with the error kind away, the holder's words (design 47 H2 §776)" } }, "description": "what file answers; error and error-kind alone when it fails" @@ -410,6 +458,14 @@ }, "error-kind": { "$ref": "#/defs/ErrorKind" + }, + "part": { + "type": "string", + "description": "with the error kind away, what did not answer (design 47 H2 §776)" + }, + "words": { + "type": "string", + "description": "with the error kind away, the holder's words (design 47 H2 §776)" } }, "description": "what contains answers; error and error-kind alone when it fails" @@ -464,6 +520,14 @@ }, "error-kind": { "$ref": "#/defs/ErrorKind" + }, + "part": { + "type": "string", + "description": "with the error kind away, what did not answer (design 47 H2 §776)" + }, + "words": { + "type": "string", + "description": "with the error kind away, the holder's words (design 47 H2 §776)" } }, "description": "what statuses answers; error and error-kind alone when it fails" @@ -546,6 +610,14 @@ }, "error-kind": { "$ref": "#/defs/ErrorKind" + }, + "part": { + "type": "string", + "description": "with the error kind away, what did not answer (design 47 H2 §776)" + }, + "words": { + "type": "string", + "description": "with the error kind away, the holder's words (design 47 H2 §776)" } }, "description": "what status answers; error and error-kind alone when it fails" @@ -607,6 +679,14 @@ }, "error-kind": { "$ref": "#/defs/ErrorKind" + }, + "part": { + "type": "string", + "description": "with the error kind away, what did not answer (design 47 H2 §776)" + }, + "words": { + "type": "string", + "description": "with the error kind away, the holder's words (design 47 H2 §776)" } }, "description": "what comment answers; error and error-kind alone when it fails" @@ -668,6 +748,14 @@ }, "error-kind": { "$ref": "#/defs/ErrorKind" + }, + "part": { + "type": "string", + "description": "with the error kind away, what did not answer (design 47 H2 §776)" + }, + "words": { + "type": "string", + "description": "with the error kind away, the holder's words (design 47 H2 §776)" } }, "description": "what view answers; error and error-kind alone when it fails" @@ -730,6 +818,14 @@ }, "error-kind": { "$ref": "#/defs/ErrorKind" + }, + "part": { + "type": "string", + "description": "with the error kind away, what did not answer (design 47 H2 §776)" + }, + "words": { + "type": "string", + "description": "with the error kind away, the holder's words (design 47 H2 §776)" } }, "description": "what note answers; error and error-kind alone when it fails" @@ -738,7 +834,7 @@ }, { "name": "merge-pull", - "description": "Merge one or more pull requests with the forge tools' account, each at the head the caller names: one merge call, a delivery's start and, with two or more members, its group (design 47 H \u00a7734, \u00a7735, \u00a7766; ADR 0682 \u00a71, \u00a72). Every member is judged before any is merged: still the pull request's head, its base a watched branch, no run at the head's build-input fingerprint failed a required step (judged from its own state failed-steps), registrations heard; no branch protection is read. When one member is refused, none is merged. Then it merges them in the order named, writing the call in its state calls before the first merge, and says merge-called once. It answers once, at the call's end, naming the call and each member's outcome; a member already merged is refused already-merged, naming its commit.", + "description": "Merge one or more pull requests with the forge tools' account, each at the head the caller names: one merge call, a delivery's start and, with two or more members, its group (design 47 H §734, §735, §766; ADR 0682 §1, §2). Every member is judged before any is merged: still the pull request's head, its base a watched branch, no run at the head's build-input fingerprint failed a required step (judged from its own state failed-steps), registrations heard; no branch protection is read. When one member is refused, none is merged. Then it merges them in the order named, writing the call in its state calls before the first merge, and says merge-called once. It answers once, at the call's end, naming the call and each member's outcome; a member already merged is refused already-merged, naming its commit.", "input": { "type": "object", "properties": { @@ -805,6 +901,14 @@ }, "error-kind": { "$ref": "#/defs/ErrorKind" + }, + "part": { + "type": "string", + "description": "with the error kind away, what did not answer (design 47 H2 §776)" + }, + "words": { + "type": "string", + "description": "with the error kind away, the holder's words (design 47 H2 §776)" } }, "description": "what merge-pull answers at the call's end; error and error-kind alone when it fails" @@ -815,7 +919,7 @@ { "name": "tag", "class": "act", - "description": "Write the git tag of a released version, go/vMAJOR.MINOR.PATCH, at the commit its build was made from; the builder writes it only on the catalog's version-released (design 47 G section 370). A tag already at that commit is answered performed. An error answer carries error and error-kind.", + "description": "Write the git tag of a released version, /vMAJOR.MINOR.PATCH for a Go package (design 47 H2 §796), at the commit its build was made from; the builder writes it only on the catalog's version-released (design 47 G section 370). A tag already at that commit is answered performed. An error answer carries error and error-kind.", "input": { "type": "object", "properties": { @@ -856,6 +960,14 @@ }, "error-kind": { "$ref": "#/defs/ErrorKind" + }, + "part": { + "type": "string", + "description": "with the error kind away, what did not answer (design 47 H2 §776)" + }, + "words": { + "type": "string", + "description": "with the error kind away, the holder's words (design 47 H2 §776)" } }, "description": "what tag answers; error and error-kind alone when it fails" @@ -1259,7 +1371,7 @@ "name": "calls", "template": "state", "history": 1, - "description": "every merge call, written before its first merge; one whose merge-called is not said is said at the holder's start; deleted past the stream merge-called's age (design 47 H \u00a7766, H-A-47)", + "description": "every merge call, written before its first merge; one whose merge-called is not said is said at the holder's start; deleted past the stream merge-called's age (design 47 H §766, H-A-47)", "key-forms": [ { "key": "call.", @@ -1328,7 +1440,7 @@ "description": "its page on the forge" } }, - "description": "one pull request as the forge holds it; never its description (ADR 0659 \u00a71)", + "description": "one pull request as the forge holds it; never its description (ADR 0659 §1)", "required": [ "repository", "number", @@ -1361,7 +1473,7 @@ "description": "whether the forge's merging account may write the repository: false, its statuses and its merge are refused" } }, - "description": "what the forge would merge now, for an open pull request (issues 1275, 1945; ADR 0441 \u00a71): answered whole or not at all, and a read the forge could not make answers the verb's error, never a guess; absent for a merged or closed one", + "description": "what the forge would merge now, for an open pull request (issues 1275, 1945; ADR 0441 §1): answered whole or not at all, and a read the forge could not make answers the verb's error, never a guess; absent for a merged or closed one", "required": [ "mergeable", "protected", @@ -1471,9 +1583,10 @@ "enum": [ "refused", "not-found", - "failed" + "failed", + "away" ], - "description": "which kind of error, set with error alone: refused, the forge or the holder refused and error says why in the forge's own words; not-found, the forge said that what was asked about (a repository, a commit, a pull request, a branch or a tag) does not exist, so a caller never reads it out of error's words; failed, the forge failed or could not be reached, so the act or read could not be performed" + "description": "which kind of error, set with error alone: refused, the forge or the holder refused and error says why in the forge's own words; not-found, the forge said that what was asked about (a repository, a commit, a pull request, a branch or a tag) does not exist, so a caller never reads it out of error's words; failed, the forge failed or could not be reached, so the act or read could not be performed; away, a part the holder depends on (the forge, its store) is away, with part naming what did not answer and words: a caller reads it as a transport fault and calls again (design 47 H2 §776)" }, "FailedStep": { "type": "object", @@ -1529,7 +1642,7 @@ }, "MemberOutcome": { "type": "object", - "description": "one member of a merge call and where it stands (design 47 H \u00a7766, H-A-22)", + "description": "one member of a merge call and where it stands (design 47 H §766, H-A-22)", "properties": { "repository": { "type": "string" @@ -1564,7 +1677,7 @@ }, "Call": { "type": "object", - "description": "one merge call, written before its first merge and updated as each member merges (design 47 H \u00a7766)", + "description": "one merge call, written before its first merge and updated as each member merges (design 47 H §766)", "properties": { "by": { "type": "string", @@ -1640,12 +1753,30 @@ "head", "state" ] + }, + "Tag": { + "type": "object", + "description": "a tag and the commit it names (design 47 H2 §796)", + "properties": { + "tag": { + "type": "string" + }, + "commit": { + "type": "string", + "description": "the commit it names, its full 40-hex sha", + "pattern": "^[0-9a-f]{40}$" + } + }, + "required": [ + "tag", + "commit" + ] } }, "bodies": { "MergeCalled": { "type": "object", - "description": "a merge call's members merged or refused, said once by the forge module (design 47 H \u00a7736, \u00a7767)", + "description": "a merge call's members merged or refused, said once by the forge module (design 47 H §736, §767)", "properties": { "call": { "type": "string", @@ -1702,7 +1833,7 @@ }, "refused": { "type": "array", - "description": "one per member not merged after every member was judged (design 47 H \u00a7767)", + "description": "one per member not merged after every member was judged (design 47 H §767)", "items": { "type": "object", "properties": { @@ -1732,5 +1863,6 @@ "members" ] } - } + }, + "form": 2 } diff --git a/modules/mesh-delivery-contracts/ts/seats/git/index.d.ts b/modules/mesh-delivery-contracts/ts/seats/git/index.d.ts index aac9a0031..c3d33cfd7 100644 --- a/modules/mesh-delivery-contracts/ts/seats/git/index.d.ts +++ b/modules/mesh-delivery-contracts/ts/seats/git/index.d.ts @@ -116,8 +116,8 @@ export interface Change { "removed"?: string[]; } -/** which kind of error, set with error alone: refused, the forge or the holder refused and error says why in the forge's own words; not-found, the forge said that what was asked about (a repository, a commit, a pull request, a branch or a tag) does not exist, so a caller never reads it out of error's words; failed, the forge failed or could not be reached, so the act or read could not be performed */ -export type ErrorKind = "refused" | "not-found" | "failed"; +/** which kind of error, set with error alone: refused, the forge or the holder refused and error says why in the forge's own words; not-found, the forge said that what was asked about (a repository, a commit, a pull request, a branch or a tag) does not exist, so a caller never reads it out of error's words; failed, the forge failed or could not be reached, so the act or read could not be performed; away, a part the holder depends on (the forge, its store) is away, with part naming what did not answer and words: a caller reads it as a transport fault and calls again (design 47 H2 §776) */ +export type ErrorKind = "refused" | "not-found" | "failed" | "away"; /** a failed required step at a build-input fingerprint, with the commits it was seen at and the run that failed it (design 47 *Judged from its own state, never by a call*); cleared by a later passing rerun of that step whose proved caller is the operator or a healer */ export interface FailedStep { @@ -215,6 +215,13 @@ export interface Status { "target"?: string; } +/** a tag and the commit it names (design 47 H2 §796) */ +export interface Tag { + /** the commit it names, its full 40-hex sha */ + "commit": string; + "tag": string; +} + export interface MergeCalledMembersItem { /** the pull request's base, a watched branch */ "branch": string; @@ -267,7 +274,11 @@ export interface PullAnswer { /** is the form of what this value carries, left out while it is 1 (design 47 H2 §780). */ "form"?: number; "merging"?: Merging; + /** with the error kind away, what did not answer (design 47 H2 §776) */ + "part"?: string; "pull"?: Pull; + /** with the error kind away, the holder's words (design 47 H2 §776) */ + "words"?: string; } /** is what branch takes. */ @@ -287,7 +298,11 @@ export interface BranchAnswer { "form"?: number; /** a commit, its full 40-hex sha */ "head"?: string; + /** with the error kind away, what did not answer (design 47 H2 §776) */ + "part"?: string; "repository"?: string; + /** with the error kind away, the holder's words (design 47 H2 §776) */ + "words"?: string; } /** is what open-pulls takes. */ @@ -301,8 +316,12 @@ export interface OpenPullsAnswer { "error-kind"?: ErrorKind; /** is the form of what this value carries, left out while it is 1 (design 47 H2 §780). */ "form"?: number; + /** with the error kind away, what did not answer (design 47 H2 §776) */ + "part"?: string; /** every open pull request; said empty when none is open, so an answer that lacks it is never read as none */ "pulls": OpenPull[]; + /** with the error kind away, the holder's words (design 47 H2 §776) */ + "words"?: string; } /** is what tags takes. */ @@ -328,10 +347,14 @@ export interface TagsAnswer { "more"?: boolean; /** the page */ "page"?: number; + /** with the error kind away, what did not answer (design 47 H2 §776) */ + "part"?: string; /** the repository, / */ "repository"?: string; - /** the tags of this page */ - "tags"?: string[]; + /** the tags of this page, each with the commit it names (design 47 H2 §796) */ + "tags"?: Tag[]; + /** with the error kind away, the holder's words (design 47 H2 §776) */ + "words"?: string; } /** is what trees takes. */ @@ -357,12 +380,16 @@ export interface TreesAnswer { "files"?: Record>; /** is the form of what this value carries, left out while it is 1 (design 47 H2 §780). */ "form"?: number; + /** with the error kind away, what did not answer (design 47 H2 §776) */ + "part"?: string; /** directory to {path: object id} */ "paths"?: Record>; /** the root tree's hash */ "root"?: string; /** directory to its tree's hash, the root as the empty name */ "trees"?: Record; + /** with the error kind away, the holder's words (design 47 H2 §776) */ + "words"?: string; } /** is what file takes. */ @@ -388,12 +415,16 @@ export interface FileAnswer { "error-kind"?: ErrorKind; /** is the form of what this value carries, left out while it is 1 (design 47 H2 §780). */ "form"?: number; + /** with the error kind away, what did not answer (design 47 H2 §776) */ + "part"?: string; /** the path */ "path"?: string; /** what was read */ "ref"?: string; /** its size in bytes */ "size"?: number; + /** with the error kind away, the holder's words (design 47 H2 §776) */ + "words"?: string; } /** is what contains takes. */ @@ -421,6 +452,10 @@ export interface ContainsAnswer { "form"?: number; /** the other */ "in"?: string; + /** with the error kind away, what did not answer (design 47 H2 §776) */ + "part"?: string; + /** with the error kind away, the holder's words (design 47 H2 §776) */ + "words"?: string; } /** is what statuses takes. */ @@ -442,8 +477,12 @@ export interface StatusesAnswer { "error-kind"?: ErrorKind; /** is the form of what this value carries, left out while it is 1 (design 47 H2 §780). */ "form"?: number; + /** with the error kind away, what did not answer (design 47 H2 §776) */ + "part"?: string; /** the newest of each context */ "statuses"?: Status[]; + /** with the error kind away, the holder's words (design 47 H2 §776) */ + "words"?: string; } /** is what status takes. */ @@ -475,8 +514,12 @@ export interface StatusAnswer { "held"?: boolean; /** the act's id, as the caller gave it */ "id"?: string; + /** with the error kind away, what did not answer (design 47 H2 §776) */ + "part"?: string; /** the forge holds the act now */ "performed"?: boolean; + /** with the error kind away, the holder's words (design 47 H2 §776) */ + "words"?: string; } /** is what comment takes. */ @@ -502,8 +545,12 @@ export interface CommentAnswer { "held"?: boolean; /** the act's id, as the caller gave it */ "id"?: string; + /** with the error kind away, what did not answer (design 47 H2 §776) */ + "part"?: string; /** the forge holds the act now */ "performed"?: boolean; + /** with the error kind away, the holder's words (design 47 H2 §776) */ + "words"?: string; } /** is what view takes. */ @@ -529,8 +576,12 @@ export interface ViewAnswer { "held"?: boolean; /** the act's id, as the caller gave it */ "id"?: string; + /** with the error kind away, what did not answer (design 47 H2 §776) */ + "part"?: string; /** the forge holds the act now */ "performed"?: boolean; + /** with the error kind away, the holder's words (design 47 H2 §776) */ + "words"?: string; } /** is what note takes. */ @@ -556,8 +607,12 @@ export interface NoteAnswer { "held"?: boolean; /** the act's id, as the caller gave it */ "id"?: string; + /** with the error kind away, what did not answer (design 47 H2 §776) */ + "part"?: string; /** the forge holds the act now */ "performed"?: boolean; + /** with the error kind away, the holder's words (design 47 H2 §776) */ + "words"?: string; } export interface MergePullInputPullsItem { @@ -588,6 +643,10 @@ export interface MergePullAnswer { "form"?: number; /** each member's outcome, in the order named */ "members"?: MemberOutcome[]; + /** with the error kind away, what did not answer (design 47 H2 §776) */ + "part"?: string; + /** with the error kind away, the holder's words (design 47 H2 §776) */ + "words"?: string; } /** is what tag takes. */ @@ -607,10 +666,14 @@ export interface TagAnswer { "error-kind"?: ErrorKind; /** is the form of what this value carries, left out while it is 1 (design 47 H2 §780). */ "form"?: number; + /** with the error kind away, what did not answer (design 47 H2 §776) */ + "part"?: string; /** the forge holds the tag at that commit now */ "performed"?: boolean; /** the tag, as asked */ "tag"?: string; + /** with the error kind away, the holder's words (design 47 H2 §776) */ + "words"?: string; } /** is the body of the event pull-updated. */ diff --git a/modules/mesh-delivery-forge-bridge/internal/bridge/bridge_test.go b/modules/mesh-delivery-forge-bridge/internal/bridge/bridge_test.go index 23b12b42b..f0e630d1f 100644 --- a/modules/mesh-delivery-forge-bridge/internal/bridge/bridge_test.go +++ b/modules/mesh-delivery-forge-bridge/internal/bridge/bridge_test.go @@ -19,7 +19,7 @@ func gitFixture(t *testing.T, name, of string) json.RawMessage { func TestBridgeTagsAnswersAPackagesTagsByPrefixPageByPage(t *testing.T) { // DLV-FB1, design 51 *The floor*; design 47 *The seat git* more := gitFixture(t, "tags answers", "verb:tags.answer") // go/v0.1.15, go/v0.1.14, more failed := gitFixture(t, "tags answers an error, never none", "verb:tags.answer") - last := json.RawMessage(`{"repository":"novox/mesh-sdk","tags":["go/v0.1.2","v0.0.1"],"page":2,"bound":50}`) + last := json.RawMessage(`{"repository":"novox/mesh-sdk","tags":[{"tag":"go/v0.1.2","commit":"dddddddddddddddddddddddddddddddddddddddd"},{"tag":"v0.0.1","commit":"eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee"}],"page":2,"bound":50}`) type asked struct { key string in string diff --git a/modules/mesh-delivery-forge-bridge/internal/bridge/tags.go b/modules/mesh-delivery-forge-bridge/internal/bridge/tags.go index 67e4be349..7c1dd9eac 100644 --- a/modules/mesh-delivery-forge-bridge/internal/bridge/tags.go +++ b/modules/mesh-delivery-forge-bridge/internal/bridge/tags.go @@ -45,8 +45,8 @@ func Tags(ctx context.Context, call Caller, repository, prefix string) (TagsAnsw return TagsAnswer{}, fmt.Errorf("the tags of %s (page %d): %w", out.Repository, page, err) } for _, t := range a.Tags { - if strings.HasPrefix(t, prefix) { - out.Tags = append(out.Tags, t) + if strings.HasPrefix(t.Tag, prefix) { + out.Tags = append(out.Tags, t.Tag) } } if !a.More { diff --git a/modules/mesh-delivery-indexer/cmd/mesh-delivery-indexer/floor_integration_test.go b/modules/mesh-delivery-indexer/cmd/mesh-delivery-indexer/floor_integration_test.go index f64f45229..1f84a7417 100644 --- a/modules/mesh-delivery-indexer/cmd/mesh-delivery-indexer/floor_integration_test.go +++ b/modules/mesh-delivery-indexer/cmd/mesh-delivery-indexer/floor_integration_test.go @@ -67,7 +67,7 @@ func TestIndexerFillsTheFloorOfAModuleWithTags(t *testing.T) { var in git.TagsInput _ = json.Unmarshal(m.Data, &in) prefix.Store(in.Prefix) - reply(m, map[string]any{"result": git.TagsAnswer{Repository: in.Repository, Tags: []string{in.Prefix + "0.4.2", in.Prefix + "0.4.10", "unrelated"}}}) + reply(m, map[string]any{"result": git.TagsAnswer{Repository: in.Repository, Tags: []git.Tag{{Tag: in.Prefix + "0.4.2", Commit: strings.Repeat("a", 40)}, {Tag: in.Prefix + "0.4.10", Commit: strings.Repeat("b", 40)}, {Tag: "unrelated", Commit: strings.Repeat("c", 40)}}}}) }) } // the package's name is read from the revision's own files (§676): its go.mod diff --git a/modules/mesh-delivery-indexer/cmd/mesh-delivery-indexer/versions.go b/modules/mesh-delivery-indexer/cmd/mesh-delivery-indexer/versions.go index d726989f0..0e60ef7fd 100644 --- a/modules/mesh-delivery-indexer/cmd/mesh-delivery-indexer/versions.go +++ b/modules/mesh-delivery-indexer/cmd/mesh-delivery-indexer/versions.go @@ -235,7 +235,9 @@ func tagsVia(call toolCaller) index.TagsReader { if err := askGit(call, git.VerbTags, in, &a); err != nil { return nil, err } - out = append(out, a.Tags...) + for _, t := range a.Tags { + out = append(out, t.Tag) + } if !a.More { return out, nil }