@stigmer/server 3.38.0 → 3.38.1

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.
Files changed (46) hide show
  1. package/README.md +1 -1
  2. package/dist/boot/compose.js +1 -1
  3. package/dist/boot/compose.js.map +1 -1
  4. package/dist/boot/config.d.ts +18 -7
  5. package/dist/boot/config.d.ts.map +1 -1
  6. package/dist/boot/config.js +1 -0
  7. package/dist/boot/config.js.map +1 -1
  8. package/dist/domain/mcpserver/complete-oauth-connect.d.ts.map +1 -1
  9. package/dist/domain/mcpserver/complete-oauth-connect.js +10 -4
  10. package/dist/domain/mcpserver/complete-oauth-connect.js.map +1 -1
  11. package/dist/domain/mcpserver/connect.d.ts +2 -1
  12. package/dist/domain/mcpserver/connect.d.ts.map +1 -1
  13. package/dist/domain/mcpserver/connect.js +5 -2
  14. package/dist/domain/mcpserver/connect.js.map +1 -1
  15. package/dist/domain/mcpserver/controller.d.ts.map +1 -1
  16. package/dist/domain/mcpserver/controller.js +7 -3
  17. package/dist/domain/mcpserver/controller.js.map +1 -1
  18. package/dist/domain/mcpserver/get-oauth-grant-status.js +1 -1
  19. package/dist/domain/mcpserver/initiate-oauth-connect.d.ts.map +1 -1
  20. package/dist/domain/mcpserver/initiate-oauth-connect.js +8 -4
  21. package/dist/domain/mcpserver/initiate-oauth-connect.js.map +1 -1
  22. package/dist/domain/mcpserver/start-connect.d.ts +2 -2
  23. package/dist/domain/mcpserver/start-connect.d.ts.map +1 -1
  24. package/dist/domain/mcpserver/start-connect.js +10 -4
  25. package/dist/domain/mcpserver/start-connect.js.map +1 -1
  26. package/dist/domain/platform/controller.d.ts +7 -5
  27. package/dist/domain/platform/controller.d.ts.map +1 -1
  28. package/dist/domain/platform/controller.js +4 -2
  29. package/dist/domain/platform/controller.js.map +1 -1
  30. package/package.json +6 -6
  31. package/src/boot/__tests__/config.test.ts +31 -0
  32. package/src/boot/compose.ts +1 -1
  33. package/src/boot/config.ts +23 -7
  34. package/src/domain/agentexecution/__tests__/store-faults.test.ts +6 -26
  35. package/src/domain/mcpserver/__tests__/store-faults.test.ts +333 -0
  36. package/src/domain/mcpserver/complete-oauth-connect.ts +13 -4
  37. package/src/domain/mcpserver/connect.ts +7 -3
  38. package/src/domain/mcpserver/controller.ts +7 -3
  39. package/src/domain/mcpserver/get-oauth-grant-status.ts +1 -1
  40. package/src/domain/mcpserver/initiate-oauth-connect.ts +8 -4
  41. package/src/domain/mcpserver/start-connect.ts +12 -6
  42. package/src/domain/platform/__tests__/platform.test.ts +55 -3
  43. package/src/domain/platform/controller.ts +11 -7
  44. package/src/domain/workflowexecution/__tests__/store-faults.test.ts +6 -26
  45. package/src/pipeline/__tests__/blind-not-found.test.ts +0 -5
  46. package/src/pipeline/__tests__/support.ts +48 -5
@@ -45,7 +45,12 @@ import { ApiResourceKind } from "@stigmer/protos/ai/stigmer/commons/apiresource/
45
45
 
46
46
  import { createLogger } from "../../../boot/logger.js";
47
47
  import { callerIdentityKey } from "../../../pipeline/interceptors/auth.js";
48
- import { testCallerIdentity } from "../../../pipeline/__tests__/support.js";
48
+ import {
49
+ errorOf,
50
+ failingStore,
51
+ testCallerIdentity,
52
+ untouchable,
53
+ } from "../../../pipeline/__tests__/support.js";
49
54
  import { RequestContext } from "../../../pipeline/request-context.js";
50
55
  import { newPermissiveSingleTeamAuthorizer } from "../../../pipeline/steps/authorize.js";
51
56
  import { ResourceNotFoundError } from "../../../store/interface.js";
@@ -80,35 +85,10 @@ const WORKFLOW_ID = "wfl_storefault";
80
85
  const EXECUTION_FAULT_COPY = "failed to load workflow execution";
81
86
  const WORKFLOW_FAULT_COPY = "failed to load workflow";
82
87
 
83
- /** A dependency the call must never reach once its load has failed. */
84
- function untouchable<T extends object>(name: string): T {
85
- return new Proxy({} as T, {
86
- get(_target, prop) {
87
- throw new Error(`${name}.${String(prop)} reached after a failed load`);
88
- },
89
- });
90
- }
91
-
92
- /** A store whose every read fails with the given error. */
93
- function failingStore(error: Error): Store {
94
- return {
95
- getResource: () => Promise.reject(error),
96
- } as unknown as Store;
97
- }
98
-
99
88
  const MISSING = (): Error =>
100
89
  new ResourceNotFoundError(`workflow_execution/${EXECUTION_ID}`);
101
90
  const LOCKED = (): Error => new Error("SQLITE_BUSY: database is locked");
102
91
 
103
- async function errorOf(call: () => Promise<unknown>): Promise<ConnectError> {
104
- const error = await call().then(
105
- () => undefined,
106
- (e: unknown) => e,
107
- );
108
- expect(error, "the call must fail").toBeInstanceOf(ConnectError);
109
- return error as ConnectError;
110
- }
111
-
112
92
  function handlerContext(): HandlerContext {
113
93
  const values = createContextValues();
114
94
  values.set(callerIdentityKey, testCallerIdentity());
@@ -44,11 +44,6 @@ const PENDING: ReadonlyMap<string, number> = new Map([
44
44
  ["domain/artifact/controller.ts", 1],
45
45
  ["domain/environment/controller.ts", 1],
46
46
  ["domain/environment/steps.ts", 1],
47
- ["domain/mcpserver/complete-oauth-connect.ts", 1],
48
- ["domain/mcpserver/connect.ts", 1],
49
- ["domain/mcpserver/controller.ts", 1],
50
- ["domain/mcpserver/initiate-oauth-connect.ts", 1],
51
- ["domain/mcpserver/start-connect.ts", 2],
52
47
  ["domain/plugin/controller.ts", 1],
53
48
  ["domain/skill/controller.ts", 1],
54
49
  ["domain/workflow/controller.ts", 1],
@@ -1,16 +1,31 @@
1
1
  /**
2
- * Shared test identity for RequestContext construction (O2, ruling Q3):
3
- * the identity parameter is required, so every test constructs one
4
- * explicitly — never a hidden default that could mask a missed threading
5
- * site in production code. Overrides let adversarial tests pin specific
6
- * caller classes.
2
+ * Shared test fixtures for the pipeline and the domains.
3
+ *
4
+ * The caller identity for RequestContext construction: the identity
5
+ * parameter is required, so every test constructs one explicitly — never a
6
+ * hidden default that could mask a missed threading site in production
7
+ * code. Overrides let adversarial tests pin specific caller classes.
8
+ *
9
+ * The run-gate authorizer, which isolates the AuthorizeRunTarget splice from
10
+ * every other authorization site on a chain.
11
+ *
12
+ * The store-fault helpers the per-domain `store-faults` tests share: a store
13
+ * whose reads fail with a chosen error, a dependency that must never be
14
+ * reached once a load has failed, and the ConnectError a failing call
15
+ * rejects with. Together they pin the error contract's store-fault rule
16
+ * (`src/pipeline/errors.ts`): a typed not-found answers NotFound, any other
17
+ * store failure a sanitized Internal.
7
18
  */
19
+ import { ConnectError } from "@connectrpc/connect";
20
+ import { expect } from "vitest";
21
+
8
22
  import type {
9
23
  Authorizer,
10
24
  AuthzCheck,
11
25
  AuthzDecision,
12
26
  } from "../../extensions/authorizer.js";
13
27
  import type { CallerIdentity } from "../../extensions/identity.js";
28
+ import type { Store } from "../../store/interface.js";
14
29
  import { isRunGateCheck } from "../steps/authorize-run-target.js";
15
30
 
16
31
  export function testCallerIdentity(
@@ -52,3 +67,31 @@ export function runGateOnlyAuthorizer(decide: () => AuthzDecision): {
52
67
  },
53
68
  };
54
69
  }
70
+
71
+ /** A dependency the call must never reach once its load has failed. */
72
+ export function untouchable<T extends object>(name: string): T {
73
+ return new Proxy({} as T, {
74
+ get(_target, prop) {
75
+ throw new Error(`${name}.${String(prop)} reached after a failed load`);
76
+ },
77
+ });
78
+ }
79
+
80
+ /** A store whose every read fails with the given error. */
81
+ export function failingStore(error: Error): Store {
82
+ return {
83
+ getResource: () => Promise.reject(error),
84
+ } as unknown as Store;
85
+ }
86
+
87
+ /** The ConnectError `call` rejects with; fails the test if it resolves. */
88
+ export async function errorOf(
89
+ call: () => Promise<unknown>,
90
+ ): Promise<ConnectError> {
91
+ const error = await call().then(
92
+ () => undefined,
93
+ (e: unknown) => e,
94
+ );
95
+ expect(error, "the call must fail").toBeInstanceOf(ConnectError);
96
+ return error as ConnectError;
97
+ }