Skip to content
Merged
Show file tree
Hide file tree
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
33 changes: 33 additions & 0 deletions behavior-model.json
Original file line number Diff line number Diff line change
Expand Up @@ -2045,6 +2045,24 @@
"unsigned": false,
"untrusted_content": false
},
"RestoreEntry": {
"destructive": false,
"idempotent": true,
"no_redirect": false,
"open_world": false,
"readonly": false,
"retry": {
"backoff": "exponential",
"base_delay_ms": 1000,
"max": 2,
"retry_on": [
429,
503
]
},
"unsigned": false,
"untrusted_content": false
},
"RestoreTopic": {
"destructive": false,
"idempotent": true,
Expand Down Expand Up @@ -2279,6 +2297,21 @@
"unsigned": false,
"untrusted_content": false
},
"UndoTopicSend": {
"destructive": false,
"idempotent": false,
"no_redirect": false,
"open_world": false,
"readonly": false,
"retry": {
"backoff": "exponential",
"base_delay_ms": 1000,
"max": 1,
"retry_on": []
},
"unsigned": false,
"untrusted_content": false
},
"UnfilePostings": {
"destructive": false,
"idempotent": true,
Expand Down
19 changes: 19 additions & 0 deletions conformance/runner/go/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -1506,6 +1506,9 @@ func executeOperation(client *generated.Client, ctx context.Context, tc TestCase
case "RestoreTopic":
topicId := getInt64Param(tc.PathParams, "topicId")
return client.RestoreTopic(ctx, topicId)
case "UndoTopicSend":
topicId := getInt64Param(tc.PathParams, "topicId")
return client.UndoTopicSend(ctx, topicId)
case "MarkTopicHam":
topicId := getInt64Param(tc.PathParams, "topicId")
return client.MarkTopicHam(ctx, topicId)
Expand All @@ -1522,6 +1525,9 @@ func executeOperation(client *generated.Client, ctx context.Context, tc TestCase
case "MarkEntrySpam":
entryId := getInt64Param(tc.PathParams, "entryId")
return client.MarkEntrySpam(ctx, entryId)
case "RestoreEntry":
entryId := getInt64Param(tc.PathParams, "entryId")
return client.RestoreEntry(ctx, entryId)
case "NewEntryForward":
entryId := getInt64Param(tc.PathParams, "entryId")
return client.NewEntryForward(ctx, entryId)
Expand Down Expand Up @@ -1726,6 +1732,19 @@ func executeHEYOperation(client *hey.Client, ctx context.Context, tc TestCase) (
switch tc.Operation {
case "RenameTopic":
return nil, client.Topics().Rename(ctx, getInt64Param(tc.PathParams, "topicId"), getStringParam(tc.RequestBody, "name"))
case "UndoSend":
// The entry HEY called back, as the other runners answer it: null when the redirect
// named none, which Go's wrapper answers as 0.
entryID, err := client.Topics().UndoSend(ctx, getInt64Param(tc.PathParams, "topicId"))
if err != nil {
return nil, err
}
if entryID == 0 {
return map[string]any{"entry_id": nil}, nil
}
return map[string]any{"entry_id": entryID}, nil
case "RestoreEntry":
return nil, client.Entries().Restore(ctx, getInt64Param(tc.PathParams, "entryId"))
case "ListBoxes":
return client.Boxes().List(ctx)
case "GetCollection":
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -405,6 +405,10 @@ private suspend fun executeOperation(client: HeyClient, case: TestCase): Outcome
client.topics.restore(path.int64("topicId"))
Outcome.Unit
}
"UndoTopicSend" -> {
client.topics.undoSend(path.int64("topicId"))
Outcome.Unit
}
"MarkTopicHam" -> {
client.topics.markHam(path.int64("topicId"))
Outcome.Unit
Expand All @@ -426,6 +430,10 @@ private suspend fun executeOperation(client: HeyClient, case: TestCase): Outcome
client.entries.markSpam(path.int64("entryId"))
Outcome.Unit
}
"RestoreEntry" -> {
client.entries.restore(path.int64("entryId"))
Outcome.Unit
}
"NewEntryForward" -> asJson(client.entries.newForward(path.int64("entryId")))

"NewBulkReply" -> asJson(client.bulkReplies.newBulkReply(query.string("posting_ids")))
Expand Down Expand Up @@ -558,7 +566,8 @@ private suspend fun executeHeyOperation(client: HeyClient, case: TestCase): Outc
val body = case.requestBody
return when (case.operation) {
// Generated operations, sent through the client a HEY-layer case configures.
"RenameTopic", "GetCollection" -> executeOperation(client, case)
"RenameTopic", "GetCollection", "RestoreEntry" -> executeOperation(client, case)
"UndoSend" -> asJson(mapOf("entry_id" to client.topics.undoTopicSend(path.int64("topicId"))))
"ListBoxes" -> page(client, client.boxes.list(), case.followsNextPage)
"GetWorkflowStage" -> asJson(client.workflows.stage(path.int64("workflowId"), path.int64("stageId")))
"UpdateCalendarEvent" -> {
Expand Down
22 changes: 21 additions & 1 deletion conformance/runner/rust/src/operations.rs
Original file line number Diff line number Diff line change
Expand Up @@ -746,6 +746,13 @@ async fn execute_operation(client: &Client, case: &TestCase) -> Result<Outcome,
.await?;
Ok(Outcome::Unit)
}
"UndoTopicSend" => {
client
.topics()
.undo_send(int64_param(path, "topicId"))
.await?;
Ok(Outcome::Unit)
}
"MarkTopicHam" => {
client
.topics()
Expand Down Expand Up @@ -779,6 +786,13 @@ async fn execute_operation(client: &Client, case: &TestCase) -> Result<Outcome,
.await?;
Ok(Outcome::Unit)
}
"RestoreEntry" => {
client
.entries()
.restore(int64_param(path, "entryId"))
.await?;
Ok(Outcome::Unit)
}
"NewEntryForward" => json(
client
.entries()
Expand Down Expand Up @@ -1169,7 +1183,13 @@ async fn execute_hey_operation(client: &Client, case: &TestCase) -> Result<Outco

match case.operation.as_str() {
// Generated operations, sent through the client a HEY-layer case configures.
"RenameTopic" | "GetCollection" => execute_operation(client, case).await,
"RenameTopic" | "GetCollection" | "RestoreEntry" => execute_operation(client, case).await,
"UndoSend" => json(serde_json::json!({
"entry_id": client
.topics()
.undo_topic_send(int64_param(path, "topicId"))
.await?,
})),
"ListBoxes" => {
page(
client,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -311,6 +311,9 @@ private func executeOperation(_ client: HeyClient, _ testCase: TestCase) async t
case "RestoreTopic":
try await client.topics.restore(topicId: path.int("topicId"))
return .unit
case "UndoTopicSend":
try await client.topics.undoSend(topicId: path.int("topicId"))
return .unit
case "MarkTopicHam":
try await client.topics.markHam(topicId: path.int("topicId"))
return .unit
Expand All @@ -327,6 +330,9 @@ private func executeOperation(_ client: HeyClient, _ testCase: TestCase) async t
case "MarkEntrySpam":
try await client.entries.markSpam(entryId: path.int("entryId"))
return .unit
case "RestoreEntry":
try await client.entries.restore(entryId: path.int("entryId"))
return .unit
case "NewEntryForward": return try asJSON(try await client.entries.newForward(entryId: path.int("entryId")))

case "NewBulkReply": return try asJSON(try await client.bulkReplies.newBulkReply(postingIds: query.string("posting_ids")))
Expand Down Expand Up @@ -491,7 +497,9 @@ private func executeHeyOperation(_ client: HeyClient, _ testCase: TestCase) asyn
let body = testCase.requestBody
switch testCase.operation {
// Generated operations, sent through the client a HEY-layer case configures.
case "RenameTopic", "GetCollection": return try await executeOperation(client, testCase)
case "RenameTopic", "GetCollection", "RestoreEntry": return try await executeOperation(client, testCase)
case "UndoSend":
return try asJSON(["entry_id": try await client.topics.undoTopicSend(topicId: path.int("topicId"))])
case "ListBoxes": return try await page(client, try await client.boxes.list(), testCase.followsNextPage)
case "GetWorkflowStage":
return try asJSON(try await client.workflows.stage(workflowId: path.int("workflowId"), stageId: path.int("stageId")))
Expand Down
10 changes: 7 additions & 3 deletions conformance/runner/typescript/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,15 @@ server through generated `HeyClient` methods. Install once with `make ts-install
The private runner manifest delegates to the SDK's single frozen toolchain; it has
no separate runtime dependencies. `make conformance-mvp` aggregates Go, Rust and TypeScript.

Current coverage is **222 applicable, 5 explicitly not applicable, 227 total**. The exact
Current coverage is **228 applicable, 9 explicitly not applicable, 237 total**. The exact
file/name/operation/reason exclusions are in `not-applicable.json`: three cover Go's
unmodeled `UpdateCalendarEvent` form convenience, one covers the handwritten view that
Go, Rust, Kotlin and Swift reduce the modeled `GetWorkflowStage` JSON to, and one covers a
write's redirect hop refused 401, since the TypeScript client follows no redirect. The TypeScript
Go, Rust, Kotlin and Swift reduce the modeled `GetWorkflowStage` JSON to, and five cover
redirects, since the TypeScript client follows none: a write's redirect hop refused 401, the
path cases for `UndoTopicSend` and `RestoreEntry`, which HEY answers with a 303 the other
generated clients follow, and the two cases for the hand-written Undo Send that reads the
entry out of that 303. The TypeScript client reports such a 303 as an error with its status;
`typescript/tests/client.test.ts` holds that. The TypeScript
operation returns the stage as HEY answers it, typed by the model.
New unknown operations/assertions/config keys, missing or duplicate fixtures, and
stale/duplicate exclusions fail. No API token is needed or read from the environment.
Expand Down
34 changes: 34 additions & 0 deletions conformance/runner/typescript/fixture-inventory.json
Original file line number Diff line number Diff line change
Expand Up @@ -510,6 +510,10 @@
"name": "RestoreTopic uses /topics/{topicId}/status/active.json path",
"operation": "RestoreTopic"
},
{
"name": "UndoTopicSend uses /topics/{topicId}/undo_send.json path",
"operation": "UndoTopicSend"
},
{
"name": "MarkTopicHam uses /topics/{topicId}/status/ham.json path",
"operation": "MarkTopicHam"
Expand All @@ -530,6 +534,10 @@
"name": "MarkEntrySpam uses /entries/{entryId}/status/spam.json path",
"operation": "MarkEntrySpam"
},
{
"name": "RestoreEntry uses /entries/{entryId}/status/active.json path",
"operation": "RestoreEntry"
},
{
"name": "NewEntryForward uses /entries/{entryId}/forwards/new.json path",
"operation": "NewEntryForward"
Expand Down Expand Up @@ -956,5 +964,31 @@
"name": "Topic rename stops at its two-attempt retry limit",
"operation": "RenameTopic"
}
],
"undo-restore.json": [
{
"name": "Undo Send answers the reply HEY called back and does not follow the redirect",
"operation": "UndoSend"
},
{
"name": "Undo Send answers the message HEY called back on a thread of its own",
"operation": "UndoSend"
},
{
"name": "Undo Send with nothing left to call back is an error with status 400, asked once",
"operation": "UndoSend"
},
{
"name": "Undo Send is not sent again after a 503 under a client allowing retries",
"operation": "UndoSend"
},
{
"name": "UndoTopicSend is not sent again by the generated operation",
"operation": "UndoTopicSend"
},
{
"name": "RestoreEntry is sent again after a 503 and stops at its two attempts",
"operation": "RestoreEntry"
}
]
}
24 changes: 24 additions & 0 deletions conformance/runner/typescript/not-applicable.json
Original file line number Diff line number Diff line change
Expand Up @@ -28,5 +28,29 @@
"name": "A write answered through a redirect whose hop is refused is refreshed but not sent again",
"operation": "CreateDraft",
"reason": "The TypeScript client sends every request with redirect: \"manual\" and follows no hop, so a write's 302 is its answer and there is no hop to be refused."
},
{
"file": "paths.json",
"name": "UndoTopicSend uses /topics/{topicId}/undo_send.json path",
"operation": "UndoTopicSend",
"reason": "HEY answers an undo with a 303 and no body. The TypeScript client sends every request with redirect: \"manual\" and follows no hop, so the 303 arrives as a HeyError whose httpStatus is 303 rather than as a followed read of the thread."
},
{
"file": "paths.json",
"name": "RestoreEntry uses /entries/{entryId}/status/active.json path",
"operation": "RestoreEntry",
"reason": "HEY answers a restore with a 303 and no body. The TypeScript client sends every request with redirect: \"manual\" and follows no hop, so the 303 arrives as a HeyError whose httpStatus is 303 rather than as a followed read of the thread."
},
{
"file": "undo-restore.json",
"name": "Undo Send answers the reply HEY called back and does not follow the redirect",
"operation": "UndoSend",
"reason": "Go, Rust, Kotlin and Swift hand-write a convenience that takes the undo's 303 as its answer and reads the entry out of the Location. The TypeScript surface is generated only: its undoTopicSend surfaces the 303 as a HeyError whose httpStatus is 303, and names no entry."
},
{
"file": "undo-restore.json",
"name": "Undo Send answers the message HEY called back on a thread of its own",
"operation": "UndoSend",
"reason": "Go, Rust, Kotlin and Swift hand-write a convenience that takes the undo's 303 as its answer and reads the entry out of the Location. The TypeScript surface is generated only: its undoTopicSend surfaces the 303 as a HeyError whose httpStatus is 303, and names no entry."
}
]
3 changes: 2 additions & 1 deletion conformance/runner/typescript/runner.ts
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ const inventory: Record<string, { name: string; operation: string }[]> =
);
assert.equal(
exclusions.length,
5,
9,
"Applicability boundary changed; review required",
);
const schemas = spec.components.schemas;
Expand All @@ -61,6 +61,7 @@ const aliases: Record<string, OperationName> = {
UpdateDraft: "UpdateMessage",
SendDraft: "UpdateMessage",
CreateReplyDraft: "CreateReply",
UndoSend: "UndoTopicSend",
};
function resolve(s: any): any {
return s?.$ref ? schemas[s.$ref.split("/").at(-1)] : s;
Expand Down
Loading
Loading