@stigmer/server 3.37.1 → 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 (75) hide show
  1. package/README.md +1 -1
  2. package/dist/boot/compose.d.ts.map +1 -1
  3. package/dist/boot/compose.js +4 -1
  4. package/dist/boot/compose.js.map +1 -1
  5. package/dist/boot/config.d.ts +18 -7
  6. package/dist/boot/config.d.ts.map +1 -1
  7. package/dist/boot/config.js +1 -0
  8. package/dist/boot/config.js.map +1 -1
  9. package/dist/domain/iampolicy/grant-path.d.ts +7 -3
  10. package/dist/domain/iampolicy/grant-path.d.ts.map +1 -1
  11. package/dist/domain/iampolicy/grant-path.js +10 -2
  12. package/dist/domain/iampolicy/grant-path.js.map +1 -1
  13. package/dist/domain/mcpserver/complete-oauth-connect.d.ts.map +1 -1
  14. package/dist/domain/mcpserver/complete-oauth-connect.js +10 -4
  15. package/dist/domain/mcpserver/complete-oauth-connect.js.map +1 -1
  16. package/dist/domain/mcpserver/connect.d.ts +2 -1
  17. package/dist/domain/mcpserver/connect.d.ts.map +1 -1
  18. package/dist/domain/mcpserver/connect.js +5 -2
  19. package/dist/domain/mcpserver/connect.js.map +1 -1
  20. package/dist/domain/mcpserver/controller.d.ts.map +1 -1
  21. package/dist/domain/mcpserver/controller.js +7 -3
  22. package/dist/domain/mcpserver/controller.js.map +1 -1
  23. package/dist/domain/mcpserver/get-oauth-grant-status.js +1 -1
  24. package/dist/domain/mcpserver/initiate-oauth-connect.d.ts.map +1 -1
  25. package/dist/domain/mcpserver/initiate-oauth-connect.js +8 -4
  26. package/dist/domain/mcpserver/initiate-oauth-connect.js.map +1 -1
  27. package/dist/domain/mcpserver/start-connect.d.ts +2 -2
  28. package/dist/domain/mcpserver/start-connect.d.ts.map +1 -1
  29. package/dist/domain/mcpserver/start-connect.js +10 -4
  30. package/dist/domain/mcpserver/start-connect.js.map +1 -1
  31. package/dist/domain/organization/controller.d.ts +4 -1
  32. package/dist/domain/organization/controller.d.ts.map +1 -1
  33. package/dist/domain/organization/controller.js +28 -4
  34. package/dist/domain/organization/controller.js.map +1 -1
  35. package/dist/domain/organization/steps.d.ts +22 -0
  36. package/dist/domain/organization/steps.d.ts.map +1 -1
  37. package/dist/domain/organization/steps.js +50 -2
  38. package/dist/domain/organization/steps.js.map +1 -1
  39. package/dist/domain/platform/controller.d.ts +7 -5
  40. package/dist/domain/platform/controller.d.ts.map +1 -1
  41. package/dist/domain/platform/controller.js +4 -2
  42. package/dist/domain/platform/controller.js.map +1 -1
  43. package/dist/extensions/gate-slots.d.ts +14 -1
  44. package/dist/extensions/gate-slots.d.ts.map +1 -1
  45. package/dist/extensions/gate-slots.js +1 -0
  46. package/dist/extensions/gate-slots.js.map +1 -1
  47. package/dist/pipeline/steps/authorization-tuples.d.ts +6 -2
  48. package/dist/pipeline/steps/authorization-tuples.d.ts.map +1 -1
  49. package/dist/pipeline/steps/authorization-tuples.js +6 -2
  50. package/dist/pipeline/steps/authorization-tuples.js.map +1 -1
  51. package/package.json +6 -6
  52. package/src/boot/__tests__/config.test.ts +31 -0
  53. package/src/boot/compose.ts +4 -1
  54. package/src/boot/config.ts +23 -7
  55. package/src/domain/agentexecution/__tests__/store-faults.test.ts +6 -26
  56. package/src/domain/iampolicy/__tests__/grant-path.test.ts +40 -7
  57. package/src/domain/iampolicy/grant-path.ts +19 -5
  58. package/src/domain/mcpserver/__tests__/store-faults.test.ts +333 -0
  59. package/src/domain/mcpserver/complete-oauth-connect.ts +13 -4
  60. package/src/domain/mcpserver/connect.ts +7 -3
  61. package/src/domain/mcpserver/controller.ts +7 -3
  62. package/src/domain/mcpserver/get-oauth-grant-status.ts +1 -1
  63. package/src/domain/mcpserver/initiate-oauth-connect.ts +8 -4
  64. package/src/domain/mcpserver/start-connect.ts +12 -6
  65. package/src/domain/organization/__tests__/organization-delete.test.ts +266 -0
  66. package/src/domain/organization/controller.ts +40 -8
  67. package/src/domain/organization/steps.ts +66 -2
  68. package/src/domain/platform/__tests__/platform.test.ts +55 -3
  69. package/src/domain/platform/controller.ts +11 -7
  70. package/src/domain/workflowexecution/__tests__/store-faults.test.ts +6 -26
  71. package/src/extensions/__tests__/registry.test.ts +3 -0
  72. package/src/extensions/gate-slots.ts +14 -0
  73. package/src/pipeline/__tests__/blind-not-found.test.ts +0 -5
  74. package/src/pipeline/__tests__/support.ts +48 -5
  75. package/src/pipeline/steps/authorization-tuples.ts +6 -2
@@ -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
+ }
@@ -330,8 +330,12 @@ export function newCreateAuthorizationTuplesStep<Desc extends DescMessage>(
330
330
  /**
331
331
  * CleanupIamPolicies — after the store delete in every delete chain.
332
332
  * Best-effort by contract: a driver failure is logged and the delete
333
- * succeeds (Java's DeleteOperationCleanupIamPoliciesStep swallows all —
334
- * the cloud side owns convergence for orphaned grants).
333
+ * succeeds (Java's DeleteOperationCleanupIamPoliciesStep swallows all),
334
+ * because a deleted resource's rows grant nothing once it is gone. The
335
+ * organization is the one kind whose id another caller can take next, so
336
+ * its chain revokes the organization's rows before the row, failing
337
+ * closed (RevokeOrganizationPolicies, domain/organization/steps.ts), and
338
+ * this step is only its backstop there.
335
339
  */
336
340
  export function newCleanupIamPoliciesStep<Desc extends DescMessage>(
337
341
  lifecycle: ResourceAuthorizationLifecycle | undefined,