@mastra/server-adapters-test-suite 0.1.3-alpha.0 → 0.1.3-alpha.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,35 @@
1
1
  # @mastra/server-adapters-test-suite
2
2
 
3
+ ## 0.1.3-alpha.2
4
+
5
+ ### Patch Changes
6
+
7
+ - Fixed run resume and time-travel conflict responses to include a machine-readable code alongside the existing error message across server adapters. HTTP status remains 409, with a JSON body such as: ([#27706](https://github.com/mastra-ai/mastra/pull/27706))
8
+
9
+ ```json
10
+ {
11
+ "error": "Run conflict",
12
+ "code": "AGENT_RESUME_ALREADY_CLAIMED"
13
+ }
14
+ ```
15
+
16
+ The shared handler exposes these conflict codes: `AGENT_RESUME_ALREADY_CLAIMED`, `WORKFLOW_RESUME_ALREADY_CLAIMED`, `AGENT_RESUME_RUN_NOT_SUSPENDED`, `WORKFLOW_RUN_NOT_SUSPENDED`, `WORKFLOW_TIME_TRAVEL_ALREADY_CLAIMED`, and `WORKFLOW_TIME_TRAVEL_RUN_RUNNING`.
17
+
18
+ - Updated dependencies [[`41b7f34`](https://github.com/mastra-ai/mastra/commit/41b7f3422a97f1385a285002b7e6f898eb5c7b06), [`6033024`](https://github.com/mastra-ai/mastra/commit/6033024193441ee88e24b98e9e59de90a6297e6e), [`179964b`](https://github.com/mastra-ai/mastra/commit/179964b95aacac31763a4a1aa2f2d1c652aa529d), [`ba7b0ea`](https://github.com/mastra-ai/mastra/commit/ba7b0eac045755d39d20dcf3a943ea5f8270b009), [`e8d7f8e`](https://github.com/mastra-ai/mastra/commit/e8d7f8e52da32b05f2e8501c1127128ae1a5d450), [`92034fa`](https://github.com/mastra-ai/mastra/commit/92034fa2a46a4f45af416c3201752342ead71d89)]:
19
+ - @mastra/core@1.79.0-alpha.6
20
+ - @mastra/server@1.79.0-alpha.6
21
+
22
+ ## 0.1.3-alpha.1
23
+
24
+ ### Patch Changes
25
+
26
+ - Updated the shared route tests for the thread query route, which now needs thread row support from storage. ([#27678](https://github.com/mastra-ai/mastra/pull/27678))
27
+
28
+ - Updated dependencies [[`1c9fd9b`](https://github.com/mastra-ai/mastra/commit/1c9fd9bbdd4258c0d86c89cac6ae68c5023a2590), [`934ec13`](https://github.com/mastra-ai/mastra/commit/934ec1315e8ee4b73067864f56a9fcc8105e8512), [`14f17b8`](https://github.com/mastra-ai/mastra/commit/14f17b86e2b162623bb22942c7930c2113a6d8a1), [`915fbe6`](https://github.com/mastra-ai/mastra/commit/915fbe67e974edbeba4dbd3afeaec4d68b34b118), [`44e35e4`](https://github.com/mastra-ai/mastra/commit/44e35e47491ad5fd9f771526d5d8c312644000ec), [`9b546e2`](https://github.com/mastra-ai/mastra/commit/9b546e2b9dba91d51769a73ce1a0b34d775b144a), [`336692a`](https://github.com/mastra-ai/mastra/commit/336692a646e28d24b303eefdb8fdbe64e4b4e801), [`f1c68eb`](https://github.com/mastra-ai/mastra/commit/f1c68eb4ae080d8cbbc694ae580850d8fa94dece), [`97f78c3`](https://github.com/mastra-ai/mastra/commit/97f78c3cf104600887e08e94cc073c973bb53c3b), [`6bfe708`](https://github.com/mastra-ai/mastra/commit/6bfe7087fcc27a08c8cba95a45c5da353188bb9c), [`a3f8ac0`](https://github.com/mastra-ai/mastra/commit/a3f8ac03c7526248e585f3e4e87b349566dd4797), [`26e684b`](https://github.com/mastra-ai/mastra/commit/26e684b1f152d341c2dca01c5347fea7e8762188), [`b77f59c`](https://github.com/mastra-ai/mastra/commit/b77f59cc5407b1158a271d579b55514f2ba79145), [`776bb6e`](https://github.com/mastra-ai/mastra/commit/776bb6e2b3ed9ec32e5430332ee756185fcebb68), [`2d0a3b0`](https://github.com/mastra-ai/mastra/commit/2d0a3b06d0880036c0dbd4b1fcf782d1f5115a56), [`5131dad`](https://github.com/mastra-ai/mastra/commit/5131dadf8c2db8641030111203db6c16fe3240f2), [`58db748`](https://github.com/mastra-ai/mastra/commit/58db74858beae6ff20ff22786c968386b9d3edcc), [`fd98055`](https://github.com/mastra-ai/mastra/commit/fd98055302882876b8dc5ae03649a89a72e2ac6c), [`b2c91db`](https://github.com/mastra-ai/mastra/commit/b2c91dbd2d32e18cd114d87301fc3b8182fddb10), [`c111a5b`](https://github.com/mastra-ai/mastra/commit/c111a5bfa2a7a197f30700ce238c84ee799df140), [`fc96794`](https://github.com/mastra-ai/mastra/commit/fc9679466bede4ca3e014aea48a72fd950a13d2a), [`fc96794`](https://github.com/mastra-ai/mastra/commit/fc9679466bede4ca3e014aea48a72fd950a13d2a), [`44e35e4`](https://github.com/mastra-ai/mastra/commit/44e35e47491ad5fd9f771526d5d8c312644000ec), [`7337dac`](https://github.com/mastra-ai/mastra/commit/7337dac8aad8d70e98a4b0c7caa677c01966b53b), [`f51c0af`](https://github.com/mastra-ai/mastra/commit/f51c0afdd1b181b84e294f8613185494a8aaec3c), [`5f70db1`](https://github.com/mastra-ai/mastra/commit/5f70db1f3b5b38a27438d1c153db352d2bc8de30), [`7afee18`](https://github.com/mastra-ai/mastra/commit/7afee18a3d91ce125f08ffd6e2724695e8a68652), [`ca1b2f2`](https://github.com/mastra-ai/mastra/commit/ca1b2f25d7c69c6e90b719baef32ffb1db6c5681), [`6309939`](https://github.com/mastra-ai/mastra/commit/63099393563cc177960862c9179c4e2420acac5f), [`f6260f8`](https://github.com/mastra-ai/mastra/commit/f6260f8cc50c21a5d78d47fff4e04e55aca57a08), [`b2c91db`](https://github.com/mastra-ai/mastra/commit/b2c91dbd2d32e18cd114d87301fc3b8182fddb10), [`a3be51b`](https://github.com/mastra-ai/mastra/commit/a3be51b1a545b45bfb04377699edecbb8a8d79d6), [`bcfb6af`](https://github.com/mastra-ai/mastra/commit/bcfb6af5a61d79f6902e87d3a8fa70283f48705d), [`368149c`](https://github.com/mastra-ai/mastra/commit/368149c27954f6d578d3561cc1801cb415b78aa7), [`fdf475d`](https://github.com/mastra-ai/mastra/commit/fdf475dbc8974e1ae21966e5e96e316a7beebdf7), [`2725bd7`](https://github.com/mastra-ai/mastra/commit/2725bd73fa27f231e30bce7c6a03c651bc15b408), [`0611d4a`](https://github.com/mastra-ai/mastra/commit/0611d4a060696da5c3c550b07451d870d4af0f58), [`0eb8311`](https://github.com/mastra-ai/mastra/commit/0eb8311f9ecf254c96179e99dc145d6df3cccd07), [`9b546e2`](https://github.com/mastra-ai/mastra/commit/9b546e2b9dba91d51769a73ce1a0b34d775b144a), [`c397dff`](https://github.com/mastra-ai/mastra/commit/c397dff0ee0662b56f348852ad08aff820239d66), [`b2c91db`](https://github.com/mastra-ai/mastra/commit/b2c91dbd2d32e18cd114d87301fc3b8182fddb10), [`b03ee08`](https://github.com/mastra-ai/mastra/commit/b03ee089c70c087cdc9d1d0a85aa749621ad5a3c), [`0f1d83f`](https://github.com/mastra-ai/mastra/commit/0f1d83fed073613869d6283adb198b934ef80093), [`cd864ca`](https://github.com/mastra-ai/mastra/commit/cd864ca5d1fa6cb3477cb8a87b79070febbb3b6b), [`d95a821`](https://github.com/mastra-ai/mastra/commit/d95a821e903f7883b5fadfee5c7f59809d66cfb8), [`d95a821`](https://github.com/mastra-ai/mastra/commit/d95a821e903f7883b5fadfee5c7f59809d66cfb8), [`50b7bfc`](https://github.com/mastra-ai/mastra/commit/50b7bfc5ff19285e065f7202e26b5d6796f660f4), [`b0f7f91`](https://github.com/mastra-ai/mastra/commit/b0f7f91eb667f15e188b861759b4c4a5761ec233), [`958d170`](https://github.com/mastra-ai/mastra/commit/958d170c218a0e050c0c4807a94ce1f67f00e570), [`ba7d4e5`](https://github.com/mastra-ai/mastra/commit/ba7d4e5c9759a164279c7ebdbe2b7a32ae94b4ce), [`8b36444`](https://github.com/mastra-ai/mastra/commit/8b36444dbbc6916d298015c2586fbbde2e9b265f), [`bfd35f6`](https://github.com/mastra-ai/mastra/commit/bfd35f64178f06774c95dabec4a796245cf8a401), [`0b5eaa0`](https://github.com/mastra-ai/mastra/commit/0b5eaa07445a6551481ab6ceadef603b020a099b), [`9620613`](https://github.com/mastra-ai/mastra/commit/96206136bcc184e6238bd6dd5627fe28254eec0b), [`c36b9e7`](https://github.com/mastra-ai/mastra/commit/c36b9e7129b355211ed9e7a3b7df2d7b81c01c05), [`c82558f`](https://github.com/mastra-ai/mastra/commit/c82558f2e5eedb493afff46f940ab7f3c085d57f), [`7a0aea2`](https://github.com/mastra-ai/mastra/commit/7a0aea28af3bcf879a75b5bcdbfc3d471f63c565), [`a0471fe`](https://github.com/mastra-ai/mastra/commit/a0471fefaf92a44b44f5fb23e607fdad087e51f2), [`bde069a`](https://github.com/mastra-ai/mastra/commit/bde069ac2f610abd5a09bcdb511ed04f5f01437e), [`7f4a1ca`](https://github.com/mastra-ai/mastra/commit/7f4a1ca724829e0a732eea6afb285f15908df8e9), [`ae74f81`](https://github.com/mastra-ai/mastra/commit/ae74f812d75034a90d647739062b9c2ca84b4ed6), [`b23b87b`](https://github.com/mastra-ai/mastra/commit/b23b87b8ab849cdc9f58b297d667c0bbaed0b62f), [`c8035a4`](https://github.com/mastra-ai/mastra/commit/c8035a49ae2af692d812dace394ac64635f5fd1d), [`1980959`](https://github.com/mastra-ai/mastra/commit/1980959335396f8ee72558689623abf3e205b31b), [`fa409d4`](https://github.com/mastra-ai/mastra/commit/fa409d430b879e45d433497439c0c11d2a3fafd6), [`78cbed0`](https://github.com/mastra-ai/mastra/commit/78cbed0e0ed27b74d9b3b767566b21d513cddd53), [`f99e0e5`](https://github.com/mastra-ai/mastra/commit/f99e0e5db6012fbdcd8eac8a32d762b2a1d56b5e)]:
29
+ - @mastra/core@1.79.0-alpha.4
30
+ - @mastra/server@1.79.0-alpha.4
31
+ - @mastra/mcp@2.5.0-alpha.1
32
+
3
33
  ## 0.1.3-alpha.0
4
34
 
5
35
  ### Patch Changes
package/dist/index.js CHANGED
@@ -1,3 +1,5 @@
1
+ import { ErrorCategory, ErrorDomain, MastraError } from "@mastra/core/error";
2
+ import { handleError } from "@mastra/server/handlers/error";
1
3
  import { HTTPException, SERVER_ROUTES, WorkflowRegistry, createRoute } from "@mastra/server/server-adapter";
2
4
  import { afterAll, afterEach, beforeAll, beforeEach, describe, expect, it, vi } from "vitest";
3
5
  import * as zod from "zod";
@@ -102,6 +104,7 @@ function generateContextualValue(fieldName) {
102
104
  if (field.includes("message")) return "test-message";
103
105
  if (field === "responseid") return "test-response";
104
106
  if (field.includes("transport")) return "test-transport";
107
+ if (field === "reorderedmodelids") return "id1";
105
108
  if (field.includes("model")) return "openai/gpt-4o";
106
109
  if (field.includes("action")) return "merge-template";
107
110
  if (field.includes("entity")) return "test-entity";
@@ -698,7 +701,16 @@ async function createDefaultTestContext() {
698
701
  const testTool = createTestTool({ id: "test-tool" });
699
702
  const agent = createTestAgent({
700
703
  name: "test-agent",
701
- memory
704
+ memory,
705
+ model: [{
706
+ id: "id1",
707
+ model: "openai/gpt-4o",
708
+ maxRetries: 3
709
+ }, {
710
+ id: "id2",
711
+ model: "openai/gpt-4o-mini",
712
+ maxRetries: 3
713
+ }]
702
714
  });
703
715
  mockAgentMethods(agent);
704
716
  vi.spyOn(Agent.prototype, "generate").mockResolvedValue({
@@ -943,6 +955,7 @@ async function createDefaultTestContext() {
943
955
  "trace-query-discovery",
944
956
  "trace-aggregate",
945
957
  "thread-query",
958
+ "thread-query-rows",
946
959
  "span-query"
947
960
  ]);
948
961
  vi.spyOn(observability, "queryTraces").mockResolvedValue({
@@ -2487,6 +2500,48 @@ function createRouteAdapterTestSuite(config) {
2487
2500
  expect(custom.getHandlerCalls()).toBe(1);
2488
2501
  });
2489
2502
  });
2503
+ describe("Run claim conflict responses (#27638)", () => {
2504
+ it.each([
2505
+ "AGENT_RESUME_ALREADY_CLAIMED",
2506
+ "WORKFLOW_RESUME_ALREADY_CLAIMED",
2507
+ "AGENT_RESUME_RUN_NOT_SUSPENDED",
2508
+ "WORKFLOW_RUN_NOT_SUSPENDED",
2509
+ "WORKFLOW_TIME_TRAVEL_ALREADY_CLAIMED",
2510
+ "WORKFLOW_TIME_TRAVEL_RUN_RUNNING"
2511
+ ])("lets clients identify %s without matching message text", async (code) => {
2512
+ const error = new MastraError({
2513
+ id: code,
2514
+ domain: ErrorDomain.MASTRA_WORKFLOW,
2515
+ category: ErrorCategory.USER
2516
+ }, "Run conflict");
2517
+ const route = {
2518
+ method: "POST",
2519
+ path: "/test/run-claim-conflict",
2520
+ responseType: "json",
2521
+ handler: async () => handleError(error, "Unable to resume")
2522
+ };
2523
+ const mutableServerRoutes = SERVER_ROUTES;
2524
+ const originalLength = mutableServerRoutes.length;
2525
+ mutableServerRoutes.push(route);
2526
+ let conflictApp;
2527
+ try {
2528
+ ({app: conflictApp} = await setupAdapter(context));
2529
+ } finally {
2530
+ mutableServerRoutes.splice(originalLength);
2531
+ }
2532
+ const response = await executeHttpRequest(conflictApp, {
2533
+ method: "POST",
2534
+ path: "/api/test/run-claim-conflict",
2535
+ body: {}
2536
+ });
2537
+ expect(response.status).toBe(409);
2538
+ expect(response.headers["content-type"]).toContain("application/json");
2539
+ expect(response.data).toEqual({
2540
+ error: "Run conflict",
2541
+ code
2542
+ });
2543
+ });
2544
+ });
2490
2545
  describe("Route Prefix", () => {
2491
2546
  it("should register routes at prefixed paths without double /api", async () => {
2492
2547
  const prefixedApp = (await setupAdapter(context, { prefix: "/v2" })).app;