D6: the delivery seat's deliveries filters before it sizes
deliveries filters by repository, module, outcome and since while it reads, pages by the cursor next and answers its deliveries with capped and total. The seat's form rises to 2. Builds: design 47 H2 §779, §811
This commit is contained in:
@@ -14,13 +14,13 @@ const Seat = "mesh-delivery"
|
||||
|
||||
// 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 = "DeliveriesAnswer=7538f2f5e68e Fill=80f442916429 FillingEvent=5bd4df78ed84 FullEvent=5bd4df78ed84 HeadsByRepositoryBranchValue=b32fd594ee25 Owed=005330be954f OwedByRepositoryNumberHeadActValue=f16ff5733d62 OwedEvent=86af3b56de28 RecordEndedEvent=566edb8684e5 RecordEndedEventAwayItem=44ad7d26bd16 RecordOpenedEvent=9cf9afaa25b4 RecoveryAnswer=8c705e17cdf8 RecoveryMergedEvent=014d4d00d2e5 RoomEvent=5bd4df78ed84 ShowAnswer=7538f2f5e68e SourceAnswer=6ae84f05f10d SourceByBranchValue=31aa822718c0 SourceHead=e722e2d9492f SourceMovedEvent=5231909928e9 SourceMovedEventHeadsItem=774b4bf88ba4 StalledAnswer=7538f2f5e68e"
|
||||
generatedForms = "2"
|
||||
generatedFieldsDigest = "DeliveriesAnswer=d6ae3ca4e5da Fill=80f442916429 FillingEvent=5bd4df78ed84 FullEvent=5bd4df78ed84 HeadsByRepositoryBranchValue=b32fd594ee25 Owed=005330be954f OwedByRepositoryNumberHeadActValue=f16ff5733d62 OwedEvent=86af3b56de28 RecordEndedEvent=566edb8684e5 RecordEndedEventAwayItem=44ad7d26bd16 RecordOpenedEvent=9cf9afaa25b4 RecoveryAnswer=8c705e17cdf8 RecoveryMergedEvent=014d4d00d2e5 RoomEvent=5bd4df78ed84 ShowAnswer=7538f2f5e68e SourceAnswer=6ae84f05f10d SourceByBranchValue=31aa822718c0 SourceHead=e722e2d9492f SourceMovedEvent=5231909928e9 SourceMovedEventHeadsItem=774b4bf88ba4 StalledAnswer=7538f2f5e68e"
|
||||
)
|
||||
|
||||
const (
|
||||
@@ -280,8 +280,16 @@ type DeliveriesInput struct {
|
||||
All string `json:"all,omitempty"`
|
||||
// a group's id (its branch name)
|
||||
Group string `json:"group,omitempty"`
|
||||
// only the deliveries that move this module, applied while reading (design 47 H2 §811)
|
||||
Module string `json:"module,omitempty"`
|
||||
// the cursor the previous page answered, opaque; absent for the first page (design 47 H2 §779)
|
||||
Next string `json:"next,omitempty"`
|
||||
// only the deliveries that ended with this outcome, applied while reading (design 47 H2 §811)
|
||||
Outcome string `json:"outcome,omitempty"`
|
||||
// owner/repository
|
||||
Repository string `json:"repository,omitempty"`
|
||||
// only the deliveries opened at or after this time, applied while reading (design 47 H2 §811)
|
||||
Since *time.Time `json:"since,omitempty"`
|
||||
// one state, e.g. delivering or held
|
||||
State string `json:"state,omitempty"`
|
||||
}
|
||||
@@ -293,7 +301,18 @@ const (
|
||||
)
|
||||
|
||||
// DeliveriesAnswer is what deliveries answers.
|
||||
type DeliveriesAnswer = map[string]any
|
||||
type DeliveriesAnswer struct {
|
||||
// yes when the answer stopped at 768 KB; the rest is read from next (design 47 H2 §811)
|
||||
Capped bool `json:"capped,omitempty"`
|
||||
// this page's deliveries, the open ones first, then the newest
|
||||
Deliveries []map[string]any `json:"deliveries"`
|
||||
// is the form of what this value carries, left out while it is 1 (design 47 H2 §780).
|
||||
Form int64 `json:"form,omitempty"`
|
||||
// the cursor of the next page, opaque; empty at the end (design 47 H2 §779)
|
||||
Next string `json:"next,omitempty"`
|
||||
// how many deliveries the filters hold in all (design 47 H2 §811)
|
||||
Total int64 `json:"total,omitempty"`
|
||||
}
|
||||
|
||||
// ShowInput is what show takes.
|
||||
type ShowInput struct {
|
||||
|
||||
@@ -63,6 +63,10 @@ func TestFixtures(t *testing.T) {
|
||||
decode: func(b []byte) (any, error) { var v RecoveryInput; err := json.Unmarshal(b, &v); return v, err }, subjectIs: nil},
|
||||
{name: "recovery answers the caller the runtime proved", subject: "", given: "{\"by\":\"alice\",\"commit\":\"0123456789abcdef0123456789abcdef01234567\",\"recovery\":true,\"repository\":\"novox/mesh-sdk\"}", wire: "{\"by\":\"alice\",\"commit\":\"0123456789abcdef0123456789abcdef01234567\",\"recovery\":true,\"repository\":\"novox/mesh-sdk\"}",
|
||||
decode: func(b []byte) (any, error) { var v RecoveryAnswer; err := json.Unmarshal(b, &v); return v, err }, subjectIs: nil},
|
||||
{name: "deliveries asks one repository's of one module since a time, from a cursor", subject: "", given: "{\"module\":\"nats\",\"next\":\"c-77\",\"outcome\":\"delivered\",\"repository\":\"novox/mesh-catalog\",\"since\":\"2026-11-20T00:00:00Z\"}", wire: "{\"module\":\"nats\",\"next\":\"c-77\",\"outcome\":\"delivered\",\"repository\":\"novox/mesh-catalog\",\"since\":\"2026-11-20T00:00:00Z\"}",
|
||||
decode: func(b []byte) (any, error) { var v DeliveriesInput; err := json.Unmarshal(b, &v); return v, err }, subjectIs: nil},
|
||||
{name: "deliveries answers a capped page with the next cursor", subject: "", given: "{\"capped\":true,\"deliveries\":[{\"id\":\"novox/mesh-catalog@0123456789abcdef0123456789abcdef01234567\",\"state\":\"delivered\"}],\"next\":\"c-78\",\"total\":412}", wire: "{\"capped\":true,\"deliveries\":[{\"id\":\"novox/mesh-catalog@0123456789abcdef0123456789abcdef01234567\",\"state\":\"delivered\"}],\"next\":\"c-78\",\"total\":412}",
|
||||
decode: func(b []byte) (any, error) { var v DeliveriesAnswer; err := json.Unmarshal(b, &v); return v, err }, subjectIs: nil},
|
||||
}
|
||||
for _, c := range cases {
|
||||
v, err := c.decode([]byte(c.given))
|
||||
|
||||
@@ -62,5 +62,31 @@
|
||||
"recovery": true,
|
||||
"by": "alice"
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "deliveries asks one repository's of one module since a time, from a cursor",
|
||||
"of": "verb:deliveries.input",
|
||||
"given": {
|
||||
"repository": "novox/mesh-catalog",
|
||||
"module": "nats",
|
||||
"outcome": "delivered",
|
||||
"since": "2026-11-20T00:00:00Z",
|
||||
"next": "c-77"
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "deliveries answers a capped page with the next cursor",
|
||||
"of": "verb:deliveries.answer",
|
||||
"given": {
|
||||
"deliveries": [
|
||||
{
|
||||
"id": "novox/mesh-catalog@0123456789abcdef0123456789abcdef01234567",
|
||||
"state": "delivered"
|
||||
}
|
||||
],
|
||||
"capped": true,
|
||||
"total": 412,
|
||||
"next": "c-78"
|
||||
}
|
||||
}
|
||||
]
|
||||
|
||||
@@ -9,7 +9,7 @@
|
||||
"verbs": [
|
||||
{
|
||||
"name": "deliveries",
|
||||
"description": "Every delivery not final, and those that ended in the last day, one line each: its id (owner/repository@commit), its state, its group, what it waits for and since when. Narrowed by state, repository or group.",
|
||||
"description": "Every delivery not final, and those that ended in the last day, one line each: its id (owner/repository@commit), its state, its group, what it waits for and since when. Narrowed by state, repository or group. Filtered by repository, module, outcome and since while it reads, at most 768 KB a page, capped saying the rest is read from the cursor next (design 47 H2 §811).",
|
||||
"input": {
|
||||
"properties": {
|
||||
"all": {
|
||||
@@ -31,13 +31,55 @@
|
||||
"state": {
|
||||
"description": "one state, e.g. delivering or held",
|
||||
"type": "string"
|
||||
},
|
||||
"module": {
|
||||
"type": "string",
|
||||
"description": "only the deliveries that move this module, applied while reading (design 47 H2 §811)"
|
||||
},
|
||||
"outcome": {
|
||||
"type": "string",
|
||||
"description": "only the deliveries that ended with this outcome, applied while reading (design 47 H2 §811)"
|
||||
},
|
||||
"since": {
|
||||
"type": "string",
|
||||
"format": "date-time",
|
||||
"description": "only the deliveries opened at or after this time, applied while reading (design 47 H2 §811)"
|
||||
},
|
||||
"next": {
|
||||
"type": "string",
|
||||
"description": "the cursor the previous page answered, opaque; absent for the first page (design 47 H2 §779)"
|
||||
}
|
||||
},
|
||||
"type": "object"
|
||||
},
|
||||
"answer": {
|
||||
"type": "object",
|
||||
"description": "what deliveries answers, as its description says"
|
||||
"description": "what deliveries answers, as its description says",
|
||||
"properties": {
|
||||
"deliveries": {
|
||||
"type": "array",
|
||||
"items": {
|
||||
"type": "object",
|
||||
"description": "one delivery's record, as the gate keeps it"
|
||||
},
|
||||
"description": "this page's deliveries, the open ones first, then the newest"
|
||||
},
|
||||
"capped": {
|
||||
"type": "boolean",
|
||||
"description": "yes when the answer stopped at 768 KB; the rest is read from next (design 47 H2 §811)"
|
||||
},
|
||||
"total": {
|
||||
"type": "integer",
|
||||
"description": "how many deliveries the filters hold in all (design 47 H2 §811)"
|
||||
},
|
||||
"next": {
|
||||
"type": "string",
|
||||
"description": "the cursor of the next page, opaque; empty at the end (design 47 H2 §779)"
|
||||
}
|
||||
},
|
||||
"required": [
|
||||
"deliveries"
|
||||
]
|
||||
},
|
||||
"class": "read"
|
||||
},
|
||||
@@ -196,7 +238,7 @@
|
||||
"name": "record-opened",
|
||||
"body": {
|
||||
"type": "object",
|
||||
"description": "a delivery record opened for one source revision of a merge call (design 47 H \u00a7737)",
|
||||
"description": "a delivery record opened for one source revision of a merge call (design 47 H §737)",
|
||||
"properties": {
|
||||
"record": {
|
||||
"type": "string",
|
||||
@@ -319,7 +361,7 @@
|
||||
"subject": "source-moved.<branch>.<source>",
|
||||
"body": {
|
||||
"type": "object",
|
||||
"description": "a source revision of a watched branch, named once per merge call (design 47 H \u00a7737)",
|
||||
"description": "a source revision of a watched branch, named once per merge call (design 47 H §737)",
|
||||
"properties": {
|
||||
"v": {
|
||||
"type": "integer"
|
||||
@@ -337,7 +379,7 @@
|
||||
},
|
||||
"start": {
|
||||
"type": "boolean",
|
||||
"description": "true only for a branch's first revision (design 47 H \u00a7768)"
|
||||
"description": "true only for a branch's first revision (design 47 H §768)"
|
||||
},
|
||||
"heads": {
|
||||
"type": "array",
|
||||
@@ -448,7 +490,7 @@
|
||||
},
|
||||
"call": {
|
||||
"type": "string",
|
||||
"description": "the merge call that moved it; a call the newest revision already carries writes nothing (design 47 H \u00a7737, H-A-33)"
|
||||
"description": "the merge call that moved it; a call the newest revision already carries writes nothing (design 47 H §737, H-A-33)"
|
||||
}
|
||||
},
|
||||
"required": [
|
||||
@@ -512,7 +554,7 @@
|
||||
"name": "heads",
|
||||
"template": "state",
|
||||
"history": 1,
|
||||
"description": "each head the forge bridge's head-moved said that source.<branch> does not name for that repository; deleted when source.<branch> names it (design 47 H \u00a7740)",
|
||||
"description": "each head the forge bridge's head-moved said that source.<branch> does not name for that repository; deleted when source.<branch> names it (design 47 H §740)",
|
||||
"key-forms": [
|
||||
{
|
||||
"key": "<repository>.<branch>",
|
||||
@@ -672,5 +714,6 @@
|
||||
"head"
|
||||
]
|
||||
}
|
||||
}
|
||||
},
|
||||
"form": 2
|
||||
}
|
||||
|
||||
@@ -138,14 +138,33 @@ export interface DeliveriesInput {
|
||||
"all"?: "true" | "false";
|
||||
/** a group's id (its branch name) */
|
||||
"group"?: string;
|
||||
/** only the deliveries that move this module, applied while reading (design 47 H2 §811) */
|
||||
"module"?: string;
|
||||
/** the cursor the previous page answered, opaque; absent for the first page (design 47 H2 §779) */
|
||||
"next"?: string;
|
||||
/** only the deliveries that ended with this outcome, applied while reading (design 47 H2 §811) */
|
||||
"outcome"?: string;
|
||||
/** owner/repository */
|
||||
"repository"?: string;
|
||||
/** only the deliveries opened at or after this time, applied while reading (design 47 H2 §811) */
|
||||
"since"?: string;
|
||||
/** one state, e.g. delivering or held */
|
||||
"state"?: string;
|
||||
}
|
||||
|
||||
/** is what deliveries answers. */
|
||||
export type DeliveriesAnswer = Record<string, unknown>;
|
||||
export interface DeliveriesAnswer {
|
||||
/** yes when the answer stopped at 768 KB; the rest is read from next (design 47 H2 §811) */
|
||||
"capped"?: boolean;
|
||||
/** this page's deliveries, the open ones first, then the newest */
|
||||
"deliveries": Record<string, unknown>[];
|
||||
/** is the form of what this value carries, left out while it is 1 (design 47 H2 §780). */
|
||||
"form"?: number;
|
||||
/** the cursor of the next page, opaque; empty at the end (design 47 H2 §779) */
|
||||
"next"?: string;
|
||||
/** how many deliveries the filters hold in all (design 47 H2 §811) */
|
||||
"total"?: number;
|
||||
}
|
||||
|
||||
/** is what show takes. */
|
||||
export interface ShowInput {
|
||||
|
||||
Reference in New Issue
Block a user