contracts-every-ask-offered: the seat operator-channel loses held-back and ask-again
Builds: design 47 H §764 (The operator channel's limit), H-A-57
This commit is contained in:
@@ -15,12 +15,11 @@ import (
|
||||
const Seat = "operator-channel"
|
||||
|
||||
const (
|
||||
VerbOpen = "open"
|
||||
VerbHistory = "history"
|
||||
VerbNotify = "notify"
|
||||
VerbTell = "tell"
|
||||
VerbAsks = "asks"
|
||||
VerbAskAgain = "ask-again"
|
||||
VerbOpen = "open"
|
||||
VerbHistory = "history"
|
||||
VerbNotify = "notify"
|
||||
VerbTell = "tell"
|
||||
VerbAsks = "asks"
|
||||
)
|
||||
|
||||
const (
|
||||
@@ -35,7 +34,7 @@ const (
|
||||
|
||||
// Verbs is every verb the seat serves, in its definition's order: a new copy each call.
|
||||
func Verbs() []string {
|
||||
return []string{VerbOpen, VerbHistory, VerbNotify, VerbTell, VerbAsks, VerbAskAgain}
|
||||
return []string{VerbOpen, VerbHistory, VerbNotify, VerbTell, VerbAsks}
|
||||
}
|
||||
|
||||
// Events is every event published on the seat's subject: a new copy each call.
|
||||
@@ -436,17 +435,15 @@ type AsksInput struct {
|
||||
Key string `json:"key,omitempty"`
|
||||
// only the asks opened at or after this time, RFC 3339
|
||||
Since string `json:"since,omitempty"`
|
||||
// open (open, held and held-back), ended or all; none is open when no key or since is given, else all
|
||||
// open (open and held), ended or all; none is open when no key or since is given, else all
|
||||
State string `json:"state,omitempty"`
|
||||
}
|
||||
|
||||
// AsksAnswerAsksItem is a type of the contract.
|
||||
type AsksAnswerAsksItem struct {
|
||||
// when the ask was held back, RFC 3339; present while its state is held-back
|
||||
HeldSince string `json:"held-since,omitempty"`
|
||||
// <asker>.<id>
|
||||
Key string `json:"key"`
|
||||
// how the ask stands: open, held (no ready channel), held-back (kept open behind the asker's newer asks, ADR 0666 §12), or how it ended (answered, expired, cancelled)
|
||||
// how the ask stands: open, held (no ready channel), or how it ended (answered, expired, cancelled)
|
||||
State string `json:"state"`
|
||||
}
|
||||
|
||||
@@ -460,19 +457,6 @@ type AsksAnswer struct {
|
||||
Matched int64 `json:"matched,omitempty"`
|
||||
}
|
||||
|
||||
// AskAgainInput is what ask-again takes.
|
||||
type AskAgainInput struct {
|
||||
// <asker>.<id> of the held-back ask
|
||||
Key string `json:"key"`
|
||||
}
|
||||
|
||||
// AskAgainAnswer is what ask-again answers.
|
||||
type AskAgainAnswer struct {
|
||||
// why it was not offered; set alone
|
||||
Error string `json:"error,omitempty"`
|
||||
State string `json:"state,omitempty"`
|
||||
}
|
||||
|
||||
// AskAccept is the body of ask.
|
||||
type AskAccept = Ask
|
||||
|
||||
@@ -532,15 +516,13 @@ type AsksByAskerIDValue struct {
|
||||
Expires string `json:"expires"`
|
||||
// its headline
|
||||
Headline string `json:"headline"`
|
||||
// when the ask was held back, RFC 3339; present while its state is held-back
|
||||
HeldSince string `json:"held-since,omitempty"`
|
||||
// <asker>.<id>
|
||||
Key string `json:"key"`
|
||||
// the channels it was offered on
|
||||
OfferedOn []string `json:"offered_on,omitempty"`
|
||||
// when it was opened, RFC 3339
|
||||
Opened string `json:"opened"`
|
||||
// how it stands: open, held-back (kept open behind the asker's newer asks, ADR 0666 §12), chosen, expired, cancelled, replaced or refused
|
||||
// how it stands: open, chosen, expired, cancelled, replaced or refused
|
||||
State string `json:"state"`
|
||||
Warrant *Warrant `json:"warrant,omitempty"`
|
||||
}
|
||||
|
||||
@@ -35,8 +35,6 @@ func TestFixtures(t *testing.T) {
|
||||
decode: func(b []byte) (any, error) { var v AsksByAskerIDValue; err := json.Unmarshal(b, &v); return v, err }, subjectIs: nil},
|
||||
{name: "an ask its asker took back (captured)", subject: "", given: "{\"answer\":\"cancelled: its asker took it back\",\"asker\":\"mesh-delivery-teller\",\"asker_told\":true,\"expires\":\"2026-11-06T10:04:01Z\",\"headline\":\"Check failed - merge into main\",\"key\":\"mesh-delivery-teller.merge-feat_registry_milestone-3a038b9f8b4d-4-4da6ee3cd9d5\",\"offered_on\":[\"telegram\"],\"opened\":\"2026-11-05T10:14:04Z\",\"state\":\"cancelled\"}", wire: "{\"answer\":\"cancelled: its asker took it back\",\"asker\":\"mesh-delivery-teller\",\"asker_told\":true,\"expires\":\"2026-11-06T10:04:01Z\",\"headline\":\"Check failed - merge into main\",\"key\":\"mesh-delivery-teller.merge-feat_registry_milestone-3a038b9f8b4d-4-4da6ee3cd9d5\",\"offered_on\":[\"telegram\"],\"opened\":\"2026-11-05T10:14:04Z\",\"state\":\"cancelled\"}",
|
||||
decode: func(b []byte) (any, error) { var v AsksByAskerIDValue; err := json.Unmarshal(b, &v); return v, err }, subjectIs: nil},
|
||||
{name: "a fourth ask, the asker's oldest held back behind newer ones", subject: "", given: "{\"asker\":\"mesh-delivery-teller\",\"expires\":\"2026-11-11T10:00:00Z\",\"headline\":\"Check failed - merge into main\",\"held-since\":\"2026-11-10T10:30:00Z\",\"key\":\"mesh-delivery-teller.b-1\",\"opened\":\"2026-11-10T10:00:00Z\",\"state\":\"held-back\"}", wire: "{\"asker\":\"mesh-delivery-teller\",\"expires\":\"2026-11-11T10:00:00Z\",\"headline\":\"Check failed - merge into main\",\"held-since\":\"2026-11-10T10:30:00Z\",\"key\":\"mesh-delivery-teller.b-1\",\"opened\":\"2026-11-10T10:00:00Z\",\"state\":\"held-back\"}",
|
||||
decode: func(b []byte) (any, error) { var v AsksByAskerIDValue; err := json.Unmarshal(b, &v); return v, err }, subjectIs: nil},
|
||||
{name: "an ask the router refused at take-in, closed (design 47 G 570)", subject: "", given: "{\"answer\":\"refused: its expiry passes the bound of its highest option level\",\"asker\":\"nats\",\"asker_told\":true,\"at\":\"2026-11-11T10:00:01Z\",\"expires\":\"2026-11-12T10:00:00Z\",\"headline\":\"Recreate a bus entry\",\"key\":\"nats.r-1\",\"opened\":\"2026-11-11T10:00:00Z\",\"state\":\"refused\"}", wire: "{\"answer\":\"refused: its expiry passes the bound of its highest option level\",\"asker\":\"nats\",\"asker_told\":true,\"at\":\"2026-11-11T10:00:01Z\",\"expires\":\"2026-11-12T10:00:00Z\",\"headline\":\"Recreate a bus entry\",\"key\":\"nats.r-1\",\"opened\":\"2026-11-11T10:00:00Z\",\"state\":\"refused\"}",
|
||||
decode: func(b []byte) (any, error) { var v AsksByAskerIDValue; err := json.Unmarshal(b, &v); return v, err }, subjectIs: nil},
|
||||
{name: "an ask chosen, with its warrant in the router's record (design 47 G 700, A-91)", subject: "", given: "{\"asker\":\"mesh-delivery-pipeline\",\"expires\":\"2026-11-12T10:00:00Z\",\"headline\":\"Deliver a module?\",\"key\":\"mesh-delivery-pipeline.approval-1\",\"opened\":\"2026-11-11T10:00:00Z\",\"state\":\"chosen\",\"warrant\":{\"about\":\"mod.main\",\"ask\":\"approval-1\",\"ask-digest\":\"sha256:eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee\",\"asker\":\"mesh-delivery-pipeline\",\"at\":\"2026-11-11T10:05:00Z\",\"option\":\"approve\",\"outcome\":\"chosen\"}}", wire: "{\"asker\":\"mesh-delivery-pipeline\",\"expires\":\"2026-11-12T10:00:00Z\",\"headline\":\"Deliver a module?\",\"key\":\"mesh-delivery-pipeline.approval-1\",\"opened\":\"2026-11-11T10:00:00Z\",\"state\":\"chosen\",\"warrant\":{\"about\":\"mod.main\",\"ask\":\"approval-1\",\"ask-digest\":\"sha256:eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee\",\"asker\":\"mesh-delivery-pipeline\",\"at\":\"2026-11-11T10:05:00Z\",\"option\":\"approve\",\"outcome\":\"chosen\"}}",
|
||||
|
||||
@@ -33,19 +33,6 @@
|
||||
"state": "cancelled"
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "a fourth ask, the asker's oldest held back behind newer ones",
|
||||
"of": "state:asks/<asker>.<id>",
|
||||
"given": {
|
||||
"asker": "mesh-delivery-teller",
|
||||
"expires": "2026-11-11T10:00:00Z",
|
||||
"headline": "Check failed - merge into main",
|
||||
"held-since": "2026-11-10T10:30:00Z",
|
||||
"key": "mesh-delivery-teller.b-1",
|
||||
"opened": "2026-11-10T10:00:00Z",
|
||||
"state": "held-back"
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "an ask the router refused at take-in, closed (design 47 G 570)",
|
||||
"of": "state:asks/<asker>.<id>",
|
||||
|
||||
@@ -130,7 +130,7 @@
|
||||
},
|
||||
"state": {
|
||||
"type": "string",
|
||||
"description": "open (open, held and held-back), ended or all; none is open when no key or since is given, else all"
|
||||
"description": "open (open and held), ended or all; none is open when no key or since is given, else all"
|
||||
},
|
||||
"since": {
|
||||
"type": "string",
|
||||
@@ -158,11 +158,7 @@
|
||||
},
|
||||
"state": {
|
||||
"type": "string",
|
||||
"description": "how the ask stands: open, held (no ready channel), held-back (kept open behind the asker's newer asks, ADR 0666 §12), or how it ended (answered, expired, cancelled)"
|
||||
},
|
||||
"held-since": {
|
||||
"type": "string",
|
||||
"description": "when the ask was held back, RFC 3339; present while its state is held-back"
|
||||
"description": "how the ask stands: open, held (no ready channel), or how it ended (answered, expired, cancelled)"
|
||||
}
|
||||
},
|
||||
"required": [
|
||||
@@ -184,37 +180,6 @@
|
||||
"asks"
|
||||
]
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "ask-again",
|
||||
"description": "Offer a held-back ask now, on a channel that is ready: the asker's ask kept open behind its newer asks (design 47 G 83, 394).",
|
||||
"class": "act",
|
||||
"input": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"key": {
|
||||
"type": "string",
|
||||
"description": "<asker>.<id> of the held-back ask"
|
||||
}
|
||||
},
|
||||
"required": [
|
||||
"key"
|
||||
],
|
||||
"additionalProperties": false
|
||||
},
|
||||
"answer": {
|
||||
"type": "object",
|
||||
"description": "where the ask stands after it was offered",
|
||||
"properties": {
|
||||
"state": {
|
||||
"type": "string"
|
||||
},
|
||||
"error": {
|
||||
"type": "string",
|
||||
"description": "why it was not offered; set alone"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
],
|
||||
"accepts": [
|
||||
@@ -287,7 +252,7 @@
|
||||
},
|
||||
"state": {
|
||||
"type": "string",
|
||||
"description": "how it stands: open, held-back (kept open behind the asker's newer asks, ADR 0666 §12), chosen, expired, cancelled, replaced or refused"
|
||||
"description": "how it stands: open, chosen, expired, cancelled, replaced or refused"
|
||||
},
|
||||
"opened": {
|
||||
"type": "string",
|
||||
@@ -308,10 +273,6 @@
|
||||
"type": "boolean",
|
||||
"description": "its asker has been told how it ended"
|
||||
},
|
||||
"held-since": {
|
||||
"type": "string",
|
||||
"description": "when the ask was held back, RFC 3339; present while its state is held-back"
|
||||
},
|
||||
"warrant": {
|
||||
"$ref": "#/defs/Warrant"
|
||||
},
|
||||
|
||||
@@ -10,7 +10,6 @@ export declare const verbs: {
|
||||
readonly notify: "notify";
|
||||
readonly tell: "tell";
|
||||
readonly asks: "asks";
|
||||
readonly askAgain: "ask-again";
|
||||
};
|
||||
|
||||
export declare const accepts: {
|
||||
@@ -346,16 +345,14 @@ export interface AsksInput {
|
||||
"key"?: string;
|
||||
/** only the asks opened at or after this time, RFC 3339 */
|
||||
"since"?: string;
|
||||
/** open (open, held and held-back), ended or all; none is open when no key or since is given, else all */
|
||||
/** open (open and held), ended or all; none is open when no key or since is given, else all */
|
||||
"state"?: string;
|
||||
}
|
||||
|
||||
export interface AsksAnswerAsksItem {
|
||||
/** when the ask was held back, RFC 3339; present while its state is held-back */
|
||||
"held-since"?: string;
|
||||
/** <asker>.<id> */
|
||||
"key": string;
|
||||
/** how the ask stands: open, held (no ready channel), held-back (kept open behind the asker's newer asks, ADR 0666 §12), or how it ended (answered, expired, cancelled) */
|
||||
/** how the ask stands: open, held (no ready channel), or how it ended (answered, expired, cancelled) */
|
||||
"state": string;
|
||||
}
|
||||
|
||||
@@ -369,19 +366,6 @@ export interface AsksAnswer {
|
||||
"matched"?: number;
|
||||
}
|
||||
|
||||
/** is what ask-again takes. */
|
||||
export interface AskAgainInput {
|
||||
/** <asker>.<id> of the held-back ask */
|
||||
"key": string;
|
||||
}
|
||||
|
||||
/** is what ask-again answers. */
|
||||
export interface AskAgainAnswer {
|
||||
/** why it was not offered; set alone */
|
||||
"error"?: string;
|
||||
"state"?: string;
|
||||
}
|
||||
|
||||
/** is the body of ask. */
|
||||
export type AskAccept = Ask;
|
||||
|
||||
@@ -432,15 +416,13 @@ export interface AsksByAskerIDValue {
|
||||
"expires": string;
|
||||
/** its headline */
|
||||
"headline": string;
|
||||
/** when the ask was held back, RFC 3339; present while its state is held-back */
|
||||
"held-since"?: string;
|
||||
/** <asker>.<id> */
|
||||
"key": string;
|
||||
/** the channels it was offered on */
|
||||
"offered_on"?: string[];
|
||||
/** when it was opened, RFC 3339 */
|
||||
"opened": string;
|
||||
/** how it stands: open, held-back (kept open behind the asker's newer asks, ADR 0666 §12), chosen, expired, cancelled, replaced or refused */
|
||||
/** how it stands: open, chosen, expired, cancelled, replaced or refused */
|
||||
"state": string;
|
||||
"warrant"?: Warrant;
|
||||
}
|
||||
|
||||
@@ -10,7 +10,6 @@ export const verbs = {
|
||||
notify: "notify",
|
||||
tell: "tell",
|
||||
asks: "asks",
|
||||
askAgain: "ask-again",
|
||||
};
|
||||
|
||||
export const accepts = {
|
||||
|
||||
Reference in New Issue
Block a user