@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.
- package/README.md +1 -1
- package/dist/boot/compose.js +1 -1
- package/dist/boot/compose.js.map +1 -1
- package/dist/boot/config.d.ts +18 -7
- package/dist/boot/config.d.ts.map +1 -1
- package/dist/boot/config.js +1 -0
- package/dist/boot/config.js.map +1 -1
- package/dist/domain/mcpserver/complete-oauth-connect.d.ts.map +1 -1
- package/dist/domain/mcpserver/complete-oauth-connect.js +10 -4
- package/dist/domain/mcpserver/complete-oauth-connect.js.map +1 -1
- package/dist/domain/mcpserver/connect.d.ts +2 -1
- package/dist/domain/mcpserver/connect.d.ts.map +1 -1
- package/dist/domain/mcpserver/connect.js +5 -2
- package/dist/domain/mcpserver/connect.js.map +1 -1
- package/dist/domain/mcpserver/controller.d.ts.map +1 -1
- package/dist/domain/mcpserver/controller.js +7 -3
- package/dist/domain/mcpserver/controller.js.map +1 -1
- package/dist/domain/mcpserver/get-oauth-grant-status.js +1 -1
- package/dist/domain/mcpserver/initiate-oauth-connect.d.ts.map +1 -1
- package/dist/domain/mcpserver/initiate-oauth-connect.js +8 -4
- package/dist/domain/mcpserver/initiate-oauth-connect.js.map +1 -1
- package/dist/domain/mcpserver/start-connect.d.ts +2 -2
- package/dist/domain/mcpserver/start-connect.d.ts.map +1 -1
- package/dist/domain/mcpserver/start-connect.js +10 -4
- package/dist/domain/mcpserver/start-connect.js.map +1 -1
- package/dist/domain/platform/controller.d.ts +7 -5
- package/dist/domain/platform/controller.d.ts.map +1 -1
- package/dist/domain/platform/controller.js +4 -2
- package/dist/domain/platform/controller.js.map +1 -1
- package/package.json +6 -6
- package/src/boot/__tests__/config.test.ts +31 -0
- package/src/boot/compose.ts +1 -1
- package/src/boot/config.ts +23 -7
- package/src/domain/agentexecution/__tests__/store-faults.test.ts +6 -26
- package/src/domain/mcpserver/__tests__/store-faults.test.ts +333 -0
- package/src/domain/mcpserver/complete-oauth-connect.ts +13 -4
- package/src/domain/mcpserver/connect.ts +7 -3
- package/src/domain/mcpserver/controller.ts +7 -3
- package/src/domain/mcpserver/get-oauth-grant-status.ts +1 -1
- package/src/domain/mcpserver/initiate-oauth-connect.ts +8 -4
- package/src/domain/mcpserver/start-connect.ts +12 -6
- package/src/domain/platform/__tests__/platform.test.ts +55 -3
- package/src/domain/platform/controller.ts +11 -7
- package/src/domain/workflowexecution/__tests__/store-faults.test.ts +6 -26
- package/src/pipeline/__tests__/blind-not-found.test.ts +0 -5
- 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 {
|
|
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
|
|
3
|
-
*
|
|
4
|
-
*
|
|
5
|
-
*
|
|
6
|
-
*
|
|
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
|
+
}
|