@adonis-agora/durable 0.49.0 → 0.50.0
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 +261 -0
- package/README.md +53 -22
- package/dist/assets/spa/assets/index-DupjrK7N.js +16 -0
- package/dist/assets/spa/assets/index-DupjrK7N.js.map +1 -0
- package/dist/assets/spa/index.html +1 -1
- package/dist/commands/durable_worker.d.ts.map +1 -1
- package/dist/commands/durable_worker.js +9 -8
- package/dist/commands/durable_worker.js.map +1 -1
- package/dist/configure.d.ts.map +1 -1
- package/dist/configure.js +1 -0
- package/dist/configure.js.map +1 -1
- package/dist/providers/dashboard_provider.d.ts +2 -0
- package/dist/providers/dashboard_provider.d.ts.map +1 -1
- package/dist/providers/dashboard_provider.js +50 -6
- package/dist/providers/dashboard_provider.js.map +1 -1
- package/dist/providers/durable_provider.d.ts.map +1 -1
- package/dist/providers/durable_provider.js +143 -34
- package/dist/providers/durable_provider.js.map +1 -1
- package/dist/src/admission-redis/redis-admission-backend.d.ts.map +1 -1
- package/dist/src/admission-redis/redis-admission-backend.js +3 -1
- package/dist/src/admission-redis/redis-admission-backend.js.map +1 -1
- package/dist/src/ambient-step.d.ts +24 -0
- package/dist/src/ambient-step.d.ts.map +1 -0
- package/dist/src/ambient-step.js +42 -0
- package/dist/src/ambient-step.js.map +1 -0
- package/dist/src/base-workflow.d.ts +10 -1
- package/dist/src/base-workflow.d.ts.map +1 -1
- package/dist/src/base-workflow.js.map +1 -1
- package/dist/src/codec-state-store.d.ts +28 -2
- package/dist/src/codec-state-store.d.ts.map +1 -1
- package/dist/src/codec-state-store.js +61 -3
- package/dist/src/codec-state-store.js.map +1 -1
- package/dist/src/commands/worker.d.ts +4 -1
- package/dist/src/commands/worker.d.ts.map +1 -1
- package/dist/src/commands/worker.js +27 -3
- package/dist/src/commands/worker.js.map +1 -1
- package/dist/src/config_types.d.ts +6 -0
- package/dist/src/config_types.d.ts.map +1 -1
- package/dist/src/control-plane-redis/redis-control-plane.d.ts.map +1 -1
- package/dist/src/control-plane-redis/redis-control-plane.js +22 -6
- package/dist/src/control-plane-redis/redis-control-plane.js.map +1 -1
- package/dist/src/control-planes/factory.d.ts +6 -0
- package/dist/src/control-planes/factory.d.ts.map +1 -1
- package/dist/src/control-planes/factory.js +1 -0
- package/dist/src/control-planes/factory.js.map +1 -1
- package/dist/src/dashboard/gateway-adapter.d.ts +15 -5
- package/dist/src/dashboard/gateway-adapter.d.ts.map +1 -1
- package/dist/src/dashboard/gateway-adapter.js +71 -7
- package/dist/src/dashboard/gateway-adapter.js.map +1 -1
- package/dist/src/dashboard/handlers.d.ts +53 -1
- package/dist/src/dashboard/handlers.d.ts.map +1 -1
- package/dist/src/dashboard/handlers.js +200 -20
- package/dist/src/dashboard/handlers.js.map +1 -1
- package/dist/src/dashboard/index.d.ts +2 -2
- package/dist/src/dashboard/index.d.ts.map +1 -1
- package/dist/src/dashboard/index.js +2 -2
- package/dist/src/dashboard/index.js.map +1 -1
- package/dist/src/dashboard/openapi.d.ts.map +1 -1
- package/dist/src/dashboard/openapi.js +71 -1
- package/dist/src/dashboard/openapi.js.map +1 -1
- package/dist/src/define_config.d.ts +122 -8
- package/dist/src/define_config.d.ts.map +1 -1
- package/dist/src/define_config.js.map +1 -1
- package/dist/src/diagnostics-bridge.d.ts +16 -3
- package/dist/src/diagnostics-bridge.d.ts.map +1 -1
- package/dist/src/diagnostics-bridge.js +9 -3
- package/dist/src/diagnostics-bridge.js.map +1 -1
- package/dist/src/discovery-roots.d.ts +92 -0
- package/dist/src/discovery-roots.d.ts.map +1 -0
- package/dist/src/discovery-roots.js +150 -0
- package/dist/src/discovery-roots.js.map +1 -0
- package/dist/src/engine.d.ts +418 -20
- package/dist/src/engine.d.ts.map +1 -1
- package/dist/src/engine.js +1523 -159
- package/dist/src/engine.js.map +1 -1
- package/dist/src/entities.d.ts +36 -1
- package/dist/src/entities.d.ts.map +1 -1
- package/dist/src/entities.js +65 -4
- package/dist/src/entities.js.map +1 -1
- package/dist/src/errors.d.ts +36 -0
- package/dist/src/errors.d.ts.map +1 -1
- package/dist/src/errors.js +44 -0
- package/dist/src/errors.js.map +1 -1
- package/dist/src/event-trigger-bridge.d.ts +8 -0
- package/dist/src/event-trigger-bridge.d.ts.map +1 -1
- package/dist/src/event-trigger-bridge.js +24 -3
- package/dist/src/event-trigger-bridge.js.map +1 -1
- package/dist/src/handshake/announced.d.ts +27 -0
- package/dist/src/handshake/announced.d.ts.map +1 -1
- package/dist/src/handshake/announced.js +62 -0
- package/dist/src/handshake/announced.js.map +1 -1
- package/dist/src/handshake/directory.d.ts +92 -0
- package/dist/src/handshake/directory.d.ts.map +1 -0
- package/dist/src/handshake/directory.js +139 -0
- package/dist/src/handshake/directory.js.map +1 -0
- package/dist/src/hooks/barrel-sources.d.ts +28 -0
- package/dist/src/hooks/barrel-sources.d.ts.map +1 -0
- package/dist/src/hooks/barrel-sources.js +92 -0
- package/dist/src/hooks/barrel-sources.js.map +1 -0
- package/dist/src/hooks/steps.d.ts +12 -3
- package/dist/src/hooks/steps.d.ts.map +1 -1
- package/dist/src/hooks/steps.js +7 -11
- package/dist/src/hooks/steps.js.map +1 -1
- package/dist/src/hooks/workflows.d.ts +12 -3
- package/dist/src/hooks/workflows.d.ts.map +1 -1
- package/dist/src/hooks/workflows.js +7 -13
- package/dist/src/hooks/workflows.js.map +1 -1
- package/dist/src/index.d.ts +12 -3
- package/dist/src/index.d.ts.map +1 -1
- package/dist/src/index.js +12 -3
- package/dist/src/index.js.map +1 -1
- package/dist/src/interfaces.d.ts +309 -21
- package/dist/src/interfaces.d.ts.map +1 -1
- package/dist/src/interfaces.js +10 -0
- package/dist/src/interfaces.js.map +1 -1
- package/dist/src/metrics.d.ts.map +1 -1
- package/dist/src/metrics.js +5 -0
- package/dist/src/metrics.js.map +1 -1
- package/dist/src/namespaces.d.ts +17 -0
- package/dist/src/namespaces.d.ts.map +1 -0
- package/dist/src/namespaces.js +24 -0
- package/dist/src/namespaces.js.map +1 -0
- package/dist/src/otel/durable-metrics.d.ts.map +1 -1
- package/dist/src/otel/durable-metrics.js +5 -0
- package/dist/src/otel/durable-metrics.js.map +1 -1
- package/dist/src/otel/durable-otel.d.ts.map +1 -1
- package/dist/src/otel/durable-otel.js +5 -0
- package/dist/src/otel/durable-otel.js.map +1 -1
- package/dist/src/pollers.d.ts +10 -1
- package/dist/src/pollers.d.ts.map +1 -1
- package/dist/src/pollers.js +15 -5
- package/dist/src/pollers.js.map +1 -1
- package/dist/src/protocol.d.ts +12 -0
- package/dist/src/protocol.d.ts.map +1 -1
- package/dist/src/protocol.js +27 -1
- package/dist/src/protocol.js.map +1 -1
- package/dist/src/remote-event.d.ts +6 -0
- package/dist/src/remote-event.d.ts.map +1 -0
- package/dist/src/remote-event.js +19 -0
- package/dist/src/remote-event.js.map +1 -0
- package/dist/src/remote-workflow-executor.d.ts +34 -12
- package/dist/src/remote-workflow-executor.d.ts.map +1 -1
- package/dist/src/remote-workflow-executor.js +42 -40
- package/dist/src/remote-workflow-executor.js.map +1 -1
- package/dist/src/run-detail-summary.d.ts +90 -3
- package/dist/src/run-detail-summary.d.ts.map +1 -1
- package/dist/src/run-detail-summary.js +360 -2
- package/dist/src/run-detail-summary.js.map +1 -1
- package/dist/src/run-facets.d.ts +48 -0
- package/dist/src/run-facets.d.ts.map +1 -0
- package/dist/src/run-facets.js +100 -0
- package/dist/src/run-facets.js.map +1 -0
- package/dist/src/run-gateway/interface.d.ts +27 -1
- package/dist/src/run-gateway/interface.d.ts.map +1 -1
- package/dist/src/run-gateway/proxy-run-gateway.d.ts +32 -4
- package/dist/src/run-gateway/proxy-run-gateway.d.ts.map +1 -1
- package/dist/src/run-gateway/proxy-run-gateway.js +101 -5
- package/dist/src/run-gateway/proxy-run-gateway.js.map +1 -1
- package/dist/src/run-gateway/run-request-responder.d.ts +18 -5
- package/dist/src/run-gateway/run-request-responder.d.ts.map +1 -1
- package/dist/src/run-gateway/run-request-responder.js +155 -32
- package/dist/src/run-gateway/run-request-responder.js.map +1 -1
- package/dist/src/run-gateway/store-run-gateway.d.ts +23 -1
- package/dist/src/run-gateway/store-run-gateway.d.ts.map +1 -1
- package/dist/src/run-gateway/store-run-gateway.js +38 -0
- package/dist/src/run-gateway/store-run-gateway.js.map +1 -1
- package/dist/src/search-attributes-schema.d.ts +44 -0
- package/dist/src/search-attributes-schema.d.ts.map +1 -0
- package/dist/src/search-attributes-schema.js +51 -0
- package/dist/src/search-attributes-schema.js.map +1 -0
- package/dist/src/singleton-admission.d.ts +75 -0
- package/dist/src/singleton-admission.d.ts.map +1 -0
- package/dist/src/singleton-admission.js +156 -0
- package/dist/src/singleton-admission.js.map +1 -0
- package/dist/src/singleton-gate.d.ts +23 -8
- package/dist/src/singleton-gate.d.ts.map +1 -1
- package/dist/src/singleton-gate.js +59 -12
- package/dist/src/singleton-gate.js.map +1 -1
- package/dist/src/standard-schema.d.ts +83 -0
- package/dist/src/standard-schema.d.ts.map +1 -0
- package/dist/src/standard-schema.js +31 -0
- package/dist/src/standard-schema.js.map +1 -0
- package/dist/src/step-discovery.d.ts +21 -11
- package/dist/src/step-discovery.d.ts.map +1 -1
- package/dist/src/step-discovery.js +86 -45
- package/dist/src/step-discovery.js.map +1 -1
- package/dist/src/step-ref.d.ts +38 -12
- package/dist/src/step-ref.d.ts.map +1 -1
- package/dist/src/step-ref.js +5 -13
- package/dist/src/step-ref.js.map +1 -1
- package/dist/src/stores/factory.d.ts +6 -0
- package/dist/src/stores/factory.d.ts.map +1 -1
- package/dist/src/stores/factory.js +4 -1
- package/dist/src/stores/factory.js.map +1 -1
- package/dist/src/stores/lucid-helpers.d.ts +2 -0
- package/dist/src/stores/lucid-helpers.d.ts.map +1 -1
- package/dist/src/stores/lucid-helpers.js +7 -0
- package/dist/src/stores/lucid-helpers.js.map +1 -1
- package/dist/src/stores/lucid-mappers.d.ts +25 -0
- package/dist/src/stores/lucid-mappers.d.ts.map +1 -1
- package/dist/src/stores/lucid-mappers.js +81 -18
- package/dist/src/stores/lucid-mappers.js.map +1 -1
- package/dist/src/stores/lucid-schema.d.ts +59 -1
- package/dist/src/stores/lucid-schema.d.ts.map +1 -1
- package/dist/src/stores/lucid-schema.js +271 -25
- package/dist/src/stores/lucid-schema.js.map +1 -1
- package/dist/src/stores/lucid.d.ts +61 -2
- package/dist/src/stores/lucid.d.ts.map +1 -1
- package/dist/src/stores/lucid.js +346 -41
- package/dist/src/stores/lucid.js.map +1 -1
- package/dist/src/telescope/dashboard.d.ts.map +1 -1
- package/dist/src/telescope/dashboard.js +30 -1
- package/dist/src/telescope/dashboard.js.map +1 -1
- package/dist/src/telescope/data-providers.d.ts +19 -1
- package/dist/src/telescope/data-providers.d.ts.map +1 -1
- package/dist/src/telescope/data-providers.js +119 -3
- package/dist/src/telescope/data-providers.js.map +1 -1
- package/dist/src/telescope/extension.d.ts.map +1 -1
- package/dist/src/telescope/extension.js +2 -1
- package/dist/src/telescope/extension.js.map +1 -1
- package/dist/src/telescope/index.d.ts +1 -1
- package/dist/src/telescope/index.d.ts.map +1 -1
- package/dist/src/telescope/index.js +1 -1
- package/dist/src/telescope/index.js.map +1 -1
- package/dist/src/testing/in-memory-state-store.d.ts +44 -15
- package/dist/src/testing/in-memory-state-store.d.ts.map +1 -1
- package/dist/src/testing/in-memory-state-store.js +204 -41
- package/dist/src/testing/in-memory-state-store.js.map +1 -1
- package/dist/src/testing-kit/checkpoint-aggregation-contract.d.ts +16 -0
- package/dist/src/testing-kit/checkpoint-aggregation-contract.d.ts.map +1 -0
- package/dist/src/testing-kit/checkpoint-aggregation-contract.js +228 -0
- package/dist/src/testing-kit/checkpoint-aggregation-contract.js.map +1 -0
- package/dist/src/testing-kit/state-store-conformance.d.ts.map +1 -1
- package/dist/src/testing-kit/state-store-conformance.js +355 -3
- package/dist/src/testing-kit/state-store-conformance.js.map +1 -1
- package/dist/src/transport-pool.d.ts +15 -1
- package/dist/src/transport-pool.d.ts.map +1 -1
- package/dist/src/transport-pool.js +50 -4
- package/dist/src/transport-pool.js.map +1 -1
- package/dist/src/transports/adaptive-concurrency.d.ts +168 -0
- package/dist/src/transports/adaptive-concurrency.d.ts.map +1 -0
- package/dist/src/transports/adaptive-concurrency.js +353 -0
- package/dist/src/transports/adaptive-concurrency.js.map +1 -0
- package/dist/src/transports/bullmq/adaptive-concurrency.d.ts +1 -143
- package/dist/src/transports/bullmq/adaptive-concurrency.d.ts.map +1 -1
- package/dist/src/transports/bullmq/adaptive-concurrency.js +3 -311
- package/dist/src/transports/bullmq/adaptive-concurrency.js.map +1 -1
- package/dist/src/transports/bullmq/bullmq-transport.d.ts +49 -1
- package/dist/src/transports/bullmq/bullmq-transport.d.ts.map +1 -1
- package/dist/src/transports/bullmq/bullmq-transport.js +330 -38
- package/dist/src/transports/bullmq/bullmq-transport.js.map +1 -1
- package/dist/src/transports/bullmq/deps.d.ts +18 -2
- package/dist/src/transports/bullmq/deps.d.ts.map +1 -1
- package/dist/src/transports/bullmq/deps.js +44 -2
- package/dist/src/transports/bullmq/deps.js.map +1 -1
- package/dist/src/transports/db-helpers.d.ts +39 -0
- package/dist/src/transports/db-helpers.d.ts.map +1 -1
- package/dist/src/transports/db-helpers.js +73 -0
- package/dist/src/transports/db-helpers.js.map +1 -1
- package/dist/src/transports/db-remote.d.ts +53 -0
- package/dist/src/transports/db-remote.d.ts.map +1 -0
- package/dist/src/transports/db-remote.js +147 -0
- package/dist/src/transports/db-remote.js.map +1 -0
- package/dist/src/transports/db-schema.d.ts +44 -1
- package/dist/src/transports/db-schema.d.ts.map +1 -1
- package/dist/src/transports/db-schema.js +227 -88
- package/dist/src/transports/db-schema.js.map +1 -1
- package/dist/src/transports/db.d.ts +189 -6
- package/dist/src/transports/db.d.ts.map +1 -1
- package/dist/src/transports/db.js +1291 -137
- package/dist/src/transports/db.js.map +1 -1
- package/dist/src/transports/event-emitter.d.ts +8 -0
- package/dist/src/transports/event-emitter.d.ts.map +1 -1
- package/dist/src/transports/event-emitter.js +36 -3
- package/dist/src/transports/event-emitter.js.map +1 -1
- package/dist/src/transports/factory.d.ts +110 -5
- package/dist/src/transports/factory.d.ts.map +1 -1
- package/dist/src/transports/factory.js +56 -9
- package/dist/src/transports/factory.js.map +1 -1
- package/dist/src/transports/queue-mock-adapter.d.ts +7 -2
- package/dist/src/transports/queue-mock-adapter.d.ts.map +1 -1
- package/dist/src/transports/queue-mock-adapter.js +18 -2
- package/dist/src/transports/queue-mock-adapter.js.map +1 -1
- package/dist/src/transports/queue-remote.d.ts +146 -0
- package/dist/src/transports/queue-remote.d.ts.map +1 -0
- package/dist/src/transports/queue-remote.js +398 -0
- package/dist/src/transports/queue-remote.js.map +1 -0
- package/dist/src/transports/queue.d.ts +159 -6
- package/dist/src/transports/queue.d.ts.map +1 -1
- package/dist/src/transports/queue.js +747 -37
- package/dist/src/transports/queue.js.map +1 -1
- package/dist/src/transports/task-failure.d.ts +31 -0
- package/dist/src/transports/task-failure.d.ts.map +1 -0
- package/dist/src/transports/task-failure.js +50 -0
- package/dist/src/transports/task-failure.js.map +1 -0
- package/dist/src/workflow-als.d.ts +1 -1
- package/dist/src/workflow-als.d.ts.map +1 -1
- package/dist/src/workflow-ctx.d.ts +10 -0
- package/dist/src/workflow-ctx.d.ts.map +1 -1
- package/dist/src/workflow-ctx.js +97 -15
- package/dist/src/workflow-ctx.js.map +1 -1
- package/dist/src/workflow-discovery.d.ts +32 -41
- package/dist/src/workflow-discovery.d.ts.map +1 -1
- package/dist/src/workflow-discovery.js +65 -88
- package/dist/src/workflow-discovery.js.map +1 -1
- package/dist/src/workflow-ref.d.ts +24 -0
- package/dist/src/workflow-ref.d.ts.map +1 -1
- package/dist/src/workflow-ref.js.map +1 -1
- package/dist/stubs/config/durable.stub +6 -0
- package/dist/stubs/config/durable_dashboard.stub +7 -3
- package/dist/stubs/database/migrations/create_durable_tables.stub +2 -1
- package/dist/stubs/database/migrations/create_durable_transport_messages.stub +43 -0
- package/dist/stubs/database/migrations/create_durable_transport_tables.stub +12 -9
- package/dist/stubs/database/migrations/create_durable_transport_worker_keys.stub +1 -1
- package/dist/stubs/make/workflow/main.stub +1 -1
- package/package.json +6 -4
- package/skills/durable-cluster/SKILL.md +80 -11
- package/skills/durable-determinism/SKILL.md +11 -5
- package/skills/durable-reliability/SKILL.md +77 -37
- package/skills/durable-setup/SKILL.md +51 -22
- package/skills/durable-transports-stores/SKILL.md +130 -19
- package/skills/durable-workflows/SKILL.md +71 -18
- package/dist/assets/spa/assets/index-DdB9zxuX.js +0 -16
- package/dist/assets/spa/assets/index-DdB9zxuX.js.map +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"interface.d.ts","sourceRoot":"","sources":["../../../src/run-gateway/interface.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,cAAc,CAAC;AACjD,OAAO,KAAK,EACV,WAAW,EACX,WAAW,EACX,QAAQ,EACR,SAAS,EACT,gBAAgB,EAChB,cAAc,EACd,WAAW,EACZ,MAAM,kBAAkB,CAAC;AAC1B,OAAO,KAAK,EAAE,OAAO,EAAE,YAAY,EAAE,SAAS,EAAE,gBAAgB,EAAE,MAAM,0BAA0B,CAAC;AACnG,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAC;AAEtD;;;;;;;GAOG;AACH,MAAM,WAAW,eAAe;IAC9B,IAAI,EAAE,eAAe,GAAG,YAAY,GAAG,QAAQ,CAAC;IAChD,+EAA+E;IAC/E,MAAM,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;CAC7B;AAED;;;;;GAKG;AACH,MAAM,WAAW,eAAgB,SAAQ,YAAY;IACnD,oFAAoF;IACpF,KAAK,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;CAC5B;AAED;;;;;;;;;;;;;GAaG;AACH,MAAM,WAAW,UAAU;IACzB,6FAA6F;IAC7F,QAAQ,IAAI,eAAe,CAAC;IAE5B,gEAAgE;IAChE,MAAM,CAAC,KAAK,EAAE,MAAM,G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, WorkflowRun } from '../interfaces.js';
|
|
2
|
-
import type
|
|
1
|
+
import type { EngineEvent, GroupHealth, RunFacetQuery, RunFacetRow, RunQuery, RunReply, RunRequest, RunResult, RunValueAxis, RunValueFacetOptions, RunValueFacetRow, RunWaiting, SearchAttributes, StartRunMessage, StepCheckpoint, TenantEvent, WorkflowRun } from '../interfaces.js';
|
|
2
|
+
import { type FanPage, type FanPageQuery, type RunDetail, type RunDetailOptions } from '../run-detail-summary.js';
|
|
3
3
|
import type { WorkflowRef } from '../workflow-ref.js';
|
|
4
4
|
import type { DurableTopology, RunGateway, StartRunOptions } from './interface.js';
|
|
5
5
|
/**
|
|
@@ -34,14 +34,20 @@ export interface ProxyRunGatewayOptions {
|
|
|
34
34
|
/** Round-trip timeout (ms) for a proxied read/control/start. Default 10_000. Spec §8: on timeout the
|
|
35
35
|
* proxy fails fast with a clear error rather than hanging a request forever. */
|
|
36
36
|
requestTimeoutMs?: number | undefined;
|
|
37
|
+
/**
|
|
38
|
+
* How long (ms) the proxy remembers that the control plane does not know a verb (an older release,
|
|
39
|
+
* mid rolling upgrade) and serves it from older verbs instead of asking again. Default 60_000.
|
|
40
|
+
*/
|
|
41
|
+
capabilityTtlMs?: number | undefined;
|
|
37
42
|
}
|
|
38
43
|
/**
|
|
39
44
|
* Tenant-side {@link RunGateway} — a store-less pod's read/control/start surface, implemented ENTIRELY
|
|
40
45
|
* over the wire. It owns NO store (structural isolation, spec §5): every verb round-trips to the
|
|
41
46
|
* control plane's `RunRequestResponder` and back.
|
|
42
47
|
*
|
|
43
|
-
* - read/control (`getRun`/`listRuns`/`getCheckpoints`/`
|
|
44
|
-
* `
|
|
48
|
+
* - read/control (`getRun`/`listRuns`/`getCheckpoints`/`getRunChildren`/`getRunDetail`/
|
|
49
|
+
* `getFanMembers`/`getSearchAttributes`/`runFacets`/`runValueFacets`/`waitingFor`/`workerHealth`/
|
|
50
|
+
* `signal`/`cancel`/`retry`/`continue`/`retryWithInput`/`redispatchPending`) → publish a {@link RunRequest} correlated by a minted `requestId`,
|
|
45
51
|
* await the {@link RunReply} within `requestTimeoutMs`;
|
|
46
52
|
* - `start` → publish a {@link StartRunMessage} (its own channel, byte-compatible with aviary), then
|
|
47
53
|
* await the reply the responder correlates by the minted `runId`;
|
|
@@ -62,7 +68,13 @@ export declare class ProxyRunGateway implements RunGateway {
|
|
|
62
68
|
listRuns(query: RunQuery): Promise<WorkflowRun[]>;
|
|
63
69
|
getCheckpoints(runId: string): Promise<StepCheckpoint[]>;
|
|
64
70
|
getRunChildren(runId: string): Promise<string[]>;
|
|
71
|
+
/**
|
|
72
|
+
* The detail in one round-trip. A control plane older than the verb (before 0.49) rejects it as
|
|
73
|
+
* unknown; the proxy then builds the same detail here from `getRun` + `getCheckpoints` (+
|
|
74
|
+
* `getRunChildren`), each still ownership-checked by the responder, and summarizes it locally.
|
|
75
|
+
*/
|
|
65
76
|
getRunDetail(runId: string, options?: RunDetailOptions): Promise<RunDetail | null>;
|
|
77
|
+
/** One page of a fan, paged here from the full timeline when the control plane predates the verb. */
|
|
66
78
|
getFanMembers(runId: string, group: string, query: FanPageQuery): Promise<FanPage | null>;
|
|
67
79
|
getSearchAttributes(runId: string): Promise<SearchAttributes | undefined>;
|
|
68
80
|
/** Round-trips to the operator, which scopes the result to this tenant's own `@<partition>` groups. */
|
|
@@ -81,6 +93,22 @@ export declare class ProxyRunGateway implements RunGateway {
|
|
|
81
93
|
redispatchPending(runId: string): Promise<(RunResult & {
|
|
82
94
|
redispatched: number;
|
|
83
95
|
}) | null>;
|
|
96
|
+
retry(runId: string): Promise<RunResult | null>;
|
|
97
|
+
continue(runId: string): Promise<RunResult | null>;
|
|
98
|
+
retryWithInput(runId: string, input: unknown): Promise<{
|
|
99
|
+
runId: string;
|
|
100
|
+
} | null>;
|
|
101
|
+
/**
|
|
102
|
+
* Scoped by the control plane to this tenant's own runs (the query's namespace is replaced). A
|
|
103
|
+
* control plane older than the verb rejects it as unknown; the proxy then counts the same cells
|
|
104
|
+
* from `runValueFacets` (the status axis per origin), or — on one older still — from a `listRuns`
|
|
105
|
+
* of the tenant's matching runs. Each answer is scoped by the control plane like the verb itself.
|
|
106
|
+
*/
|
|
107
|
+
runFacets(query: RunFacetQuery): Promise<RunFacetRow[]>;
|
|
108
|
+
/** Scoped by the control plane to this tenant's own runs (the query's namespace is replaced). */
|
|
109
|
+
runValueFacets(axis: RunValueAxis, query: RunFacetQuery, opts?: RunValueFacetOptions): Promise<RunValueFacetRow[]>;
|
|
110
|
+
/** Only this tenant's own runs come back; another tenant's ids are silently absent. */
|
|
111
|
+
waitingFor(runIds: string[]): Promise<Record<string, RunWaiting>>;
|
|
84
112
|
/** Live-tail ONE run by bridging onto this tenant's event channel and filtering by `runId`. */
|
|
85
113
|
subscribe(runId: string, onEvent: (event: EngineEvent) => void): () => void;
|
|
86
114
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"proxy-run-gateway.d.ts","sourceRoot":"","sources":["../../../src/run-gateway/proxy-run-gateway.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"proxy-run-gateway.d.ts","sourceRoot":"","sources":["../../../src/run-gateway/proxy-run-gateway.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EACV,WAAW,EACX,WAAW,EACX,aAAa,EACb,WAAW,EACX,QAAQ,EACR,QAAQ,EACR,UAAU,EAEV,SAAS,EACT,YAAY,EACZ,oBAAoB,EACpB,gBAAgB,EAChB,UAAU,EACV,gBAAgB,EAChB,eAAe,EACf,cAAc,EACd,WAAW,EACX,WAAW,EACZ,MAAM,kBAAkB,CAAC;AAC1B,OAAO,EACL,KAAK,OAAO,EACZ,KAAK,YAAY,EAGjB,KAAK,SAAS,EACd,KAAK,gBAAgB,EAEtB,MAAM,0BAA0B,CAAC;AAElC,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAC;AACtD,OAAO,KAAK,EAAE,eAAe,EAAE,UAAU,EAAE,eAAe,EAAE,MAAM,gBA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AE,GAAG,IAAI,CAAC,CAE/E;IAED;;;;;OAKG;IACH,SAAS,CAAC,KAAK,EAAE,aAAa,GAAG,OAAO,CAAC,WAAW,EAAE,CAAC,CAetD;IAED,iGAAiG;IACjG,cAAc,CACZ,IAAI,EAAE,YAAY,EAClB,KAAK,EAAE,aAAa,EACpB,IAAI,CAAC,EAAE,oBAAoB,GAC1B,OAAO,CAAC,gBAAgB,EAAE,CAAC,CAM7B;IAED,uFAAuF;IACvF,UAAU,CAAC,MAAM,EAAE,MAAM,EAAE,GAAG,OAAO,CAAC,MAAM,CAAC,MAAM,EAAE,UAAU,CAAC,CAAC,CAGhE;IAED,+FAA+F;IAC/F,SAAS,CAAC,KAAK,EAAE,MAAM,EAAE,OAAO,EAAE,CAAC,KAAK,EAAE,WAAW,KAAK,IAAI,GAAG,MAAM,IAAI,CAI1E;CACF"}
|
|
@@ -1,10 +1,21 @@
|
|
|
1
|
+
import { childIdsOf } from '../fan-join.js';
|
|
2
|
+
import { loadFanMembers, loadRunDetail, } from '../run-detail-summary.js';
|
|
3
|
+
import { runFacetsOf } from '../run-facets.js';
|
|
4
|
+
import { UNSUPPORTED_RUN_REQUEST } from './run-request-responder.js';
|
|
5
|
+
/** The control plane answered a verb it does not know: it runs an older release than this tenant. */
|
|
6
|
+
class UnsupportedRunRequestError extends Error {
|
|
7
|
+
code = UNSUPPORTED_RUN_REQUEST;
|
|
8
|
+
}
|
|
9
|
+
/** The message a responder before 0.50 rejected an unknown verb with (it sent no `code`). */
|
|
10
|
+
const LEGACY_UNKNOWN_VERB = /^unknown run-request verb: /;
|
|
1
11
|
/**
|
|
2
12
|
* Tenant-side {@link RunGateway} — a store-less pod's read/control/start surface, implemented ENTIRELY
|
|
3
13
|
* over the wire. It owns NO store (structural isolation, spec §5): every verb round-trips to the
|
|
4
14
|
* control plane's `RunRequestResponder` and back.
|
|
5
15
|
*
|
|
6
|
-
* - read/control (`getRun`/`listRuns`/`getCheckpoints`/`
|
|
7
|
-
* `
|
|
16
|
+
* - read/control (`getRun`/`listRuns`/`getCheckpoints`/`getRunChildren`/`getRunDetail`/
|
|
17
|
+
* `getFanMembers`/`getSearchAttributes`/`runFacets`/`runValueFacets`/`waitingFor`/`workerHealth`/
|
|
18
|
+
* `signal`/`cancel`/`retry`/`continue`/`retryWithInput`/`redispatchPending`) → publish a {@link RunRequest} correlated by a minted `requestId`,
|
|
8
19
|
* await the {@link RunReply} within `requestTimeoutMs`;
|
|
9
20
|
* - `start` → publish a {@link StartRunMessage} (its own channel, byte-compatible with aviary), then
|
|
10
21
|
* await the reply the responder correlates by the minted `runId`;
|
|
@@ -23,6 +34,13 @@ export class ProxyRunGateway {
|
|
|
23
34
|
#wireTenant;
|
|
24
35
|
#timeoutMs;
|
|
25
36
|
#pending = new Map();
|
|
37
|
+
#capabilityTtlMs;
|
|
38
|
+
/**
|
|
39
|
+
* Verb → when to ask the control plane for it again, after it answered that it does not know it.
|
|
40
|
+
* During a rolling upgrade the control plane is several pods of mixed versions behind one queue and
|
|
41
|
+
* a reply does not say which pod sent it, so the whole control plane counts as old until then.
|
|
42
|
+
*/
|
|
43
|
+
#unsupportedUntil = new Map();
|
|
26
44
|
constructor(transport, options) {
|
|
27
45
|
this.#transport = transport;
|
|
28
46
|
this.#partition = options.partition;
|
|
@@ -30,6 +48,7 @@ export class ProxyRunGateway {
|
|
|
30
48
|
// no token, the raw partition does (prefix-isolation-only, aviary-compatible).
|
|
31
49
|
this.#wireTenant = options.token ?? options.partition;
|
|
32
50
|
this.#timeoutMs = options.requestTimeoutMs ?? 10_000;
|
|
51
|
+
this.#capabilityTtlMs = options.capabilityTtlMs ?? 60_000;
|
|
33
52
|
// One reply subscription for the whole gateway; every RunReply is matched to its pending call by id.
|
|
34
53
|
this.#transport.onRunReply((reply) => this.#handleReply(reply));
|
|
35
54
|
}
|
|
@@ -42,6 +61,11 @@ export class ProxyRunGateway {
|
|
|
42
61
|
if (reply.result.ok) {
|
|
43
62
|
pending.resolve(reply.result.data);
|
|
44
63
|
}
|
|
64
|
+
else if (reply.result.error.code === UNSUPPORTED_RUN_REQUEST ||
|
|
65
|
+
(reply.result.error.code === undefined &&
|
|
66
|
+
LEGACY_UNKNOWN_VERB.test(reply.result.error.message))) {
|
|
67
|
+
pending.reject(new UnsupportedRunRequestError(reply.result.error.message));
|
|
68
|
+
}
|
|
45
69
|
else {
|
|
46
70
|
const err = new Error(reply.result.error.message);
|
|
47
71
|
if (reply.result.error.code !== undefined)
|
|
@@ -90,13 +114,55 @@ export class ProxyRunGateway {
|
|
|
90
114
|
getRunChildren(runId) {
|
|
91
115
|
return this.#request({ kind: 'getRunChildren', runId });
|
|
92
116
|
}
|
|
117
|
+
/**
|
|
118
|
+
* The detail in one round-trip. A control plane older than the verb (before 0.49) rejects it as
|
|
119
|
+
* unknown; the proxy then builds the same detail here from `getRun` + `getCheckpoints` (+
|
|
120
|
+
* `getRunChildren`), each still ownership-checked by the responder, and summarizes it locally.
|
|
121
|
+
*/
|
|
93
122
|
getRunDetail(runId, options) {
|
|
94
|
-
return this.#request(options === undefined
|
|
123
|
+
return this.#withFallback('getRunDetail', () => this.#request(options === undefined
|
|
95
124
|
? { kind: 'getRunDetail', runId }
|
|
96
|
-
: { kind: 'getRunDetail', runId, options });
|
|
125
|
+
: { kind: 'getRunDetail', runId, options }), () => loadRunDetail(this.#legacyDetailSource(), runId, options));
|
|
97
126
|
}
|
|
127
|
+
/** One page of a fan, paged here from the full timeline when the control plane predates the verb. */
|
|
98
128
|
getFanMembers(runId, group, query) {
|
|
99
|
-
return this.#request({ kind: 'getFanMembers', runId, group, query });
|
|
129
|
+
return this.#withFallback('getFanMembers', () => this.#request({ kind: 'getFanMembers', runId, group, query }), () => loadFanMembers(this.#legacyDetailSource(), runId, group, query));
|
|
130
|
+
}
|
|
131
|
+
/**
|
|
132
|
+
* Ask the control plane for `kind`, or serve `fallback` when it answers that it does not know the
|
|
133
|
+
* verb (remembered for `capabilityTtlMs`, so a fleet mid-upgrade costs one extra round-trip a
|
|
134
|
+
* minute rather than one per call). Any other failure propagates.
|
|
135
|
+
*/
|
|
136
|
+
async #withFallback(kind, ask, fallback) {
|
|
137
|
+
if (!this.#knownUnsupported(kind)) {
|
|
138
|
+
try {
|
|
139
|
+
return await ask();
|
|
140
|
+
}
|
|
141
|
+
catch (err) {
|
|
142
|
+
if (!(err instanceof UnsupportedRunRequestError))
|
|
143
|
+
throw err;
|
|
144
|
+
this.#unsupportedUntil.set(kind, Date.now() + this.#capabilityTtlMs);
|
|
145
|
+
}
|
|
146
|
+
}
|
|
147
|
+
return fallback();
|
|
148
|
+
}
|
|
149
|
+
#knownUnsupported(kind) {
|
|
150
|
+
const until = this.#unsupportedUntil.get(kind);
|
|
151
|
+
if (until === undefined)
|
|
152
|
+
return false;
|
|
153
|
+
if (Date.now() < until)
|
|
154
|
+
return true;
|
|
155
|
+
this.#unsupportedUntil.delete(kind);
|
|
156
|
+
return false;
|
|
157
|
+
}
|
|
158
|
+
/** The verbs every control plane answers, as a {@link RunDetailSource}. Children fall back to the
|
|
159
|
+
* timeline's child edges if even `getRunChildren` is unknown. */
|
|
160
|
+
#legacyDetailSource() {
|
|
161
|
+
return {
|
|
162
|
+
getRun: (runId) => this.getRun(runId),
|
|
163
|
+
listCheckpoints: (runId) => this.getCheckpoints(runId),
|
|
164
|
+
getRunChildren: (runId) => this.#withFallback('getRunChildren', () => this.getRunChildren(runId), async () => [...new Set(childIdsOf(await this.getCheckpoints(runId)))]),
|
|
165
|
+
};
|
|
100
166
|
}
|
|
101
167
|
getSearchAttributes(runId) {
|
|
102
168
|
return this.#request({ kind: 'getSearchAttributes', runId });
|
|
@@ -139,6 +205,36 @@ export class ProxyRunGateway {
|
|
|
139
205
|
runId,
|
|
140
206
|
});
|
|
141
207
|
}
|
|
208
|
+
retry(runId) {
|
|
209
|
+
return this.#request({ kind: 'retry', runId });
|
|
210
|
+
}
|
|
211
|
+
continue(runId) {
|
|
212
|
+
return this.#request({ kind: 'continue', runId });
|
|
213
|
+
}
|
|
214
|
+
retryWithInput(runId, input) {
|
|
215
|
+
return this.#request({ kind: 'retryWithInput', runId, input });
|
|
216
|
+
}
|
|
217
|
+
/**
|
|
218
|
+
* Scoped by the control plane to this tenant's own runs (the query's namespace is replaced). A
|
|
219
|
+
* control plane older than the verb rejects it as unknown; the proxy then counts the same cells
|
|
220
|
+
* from `runValueFacets` (the status axis per origin), or — on one older still — from a `listRuns`
|
|
221
|
+
* of the tenant's matching runs. Each answer is scoped by the control plane like the verb itself.
|
|
222
|
+
*/
|
|
223
|
+
runFacets(query) {
|
|
224
|
+
return this.#withFallback('runFacets', () => this.#request({ kind: 'runFacets', query }), () => this.#withFallback('runValueFacets', () => runFacetsOf({ runValueFacets: (axis, q, opts) => this.runValueFacets(axis, q, opts) }, query), () => runFacetsOf({ listRuns: (q) => this.listRuns(q) }, query)));
|
|
225
|
+
}
|
|
226
|
+
/** Scoped by the control plane to this tenant's own runs (the query's namespace is replaced). */
|
|
227
|
+
runValueFacets(axis, query, opts) {
|
|
228
|
+
return this.#request(opts === undefined
|
|
229
|
+
? { kind: 'runValueFacets', axis, query }
|
|
230
|
+
: { kind: 'runValueFacets', axis, query, opts });
|
|
231
|
+
}
|
|
232
|
+
/** Only this tenant's own runs come back; another tenant's ids are silently absent. */
|
|
233
|
+
waitingFor(runIds) {
|
|
234
|
+
if (runIds.length === 0)
|
|
235
|
+
return Promise.resolve({});
|
|
236
|
+
return this.#request({ kind: 'waitingFor', runIds });
|
|
237
|
+
}
|
|
142
238
|
/** Live-tail ONE run by bridging onto this tenant's event channel and filtering by `runId`. */
|
|
143
239
|
subscribe(runId, onEvent) {
|
|
144
240
|
return this.#transport.onTenantEvent(this.#partition, (evt) => {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"proxy-run-gateway.js","sourceRoot":"","sources":["../../../src/run-gateway/proxy-run-gateway.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"proxy-run-gateway.js","sourceRoot":"","sources":["../../../src/run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AAK,CAAC,KAAK,KAAK,KAAK;gBAAE,OAAO,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC;QACpD,CAAC,CAAC,CAAC;IACL,CAAC;CACF"}
|
|
@@ -13,6 +13,13 @@ export interface ResponderTransport {
|
|
|
13
13
|
publishRunReply(reply: RunReply): Promise<void>;
|
|
14
14
|
publishTenantEvent(evt: TenantEvent): Promise<void>;
|
|
15
15
|
}
|
|
16
|
+
/**
|
|
17
|
+
* The error `code` a responder answers a verb it does not know with, so a newer tenant can tell
|
|
18
|
+
* "this control plane is older than me" from a real failure and fall back at once instead of
|
|
19
|
+
* waiting out its timeout. Responders before 0.50 answered with an error message
|
|
20
|
+
* (`unknown run-request verb: <kind>`) and no code; `ProxyRunGateway` recognizes both.
|
|
21
|
+
*/
|
|
22
|
+
export declare const UNSUPPORTED_RUN_REQUEST = "unsupported-request";
|
|
16
23
|
/** Options for {@link RunRequestResponder}. */
|
|
17
24
|
export interface RunRequestResponderOptions {
|
|
18
25
|
/**
|
|
@@ -40,16 +47,22 @@ export interface RunRequestResponderOptions {
|
|
|
40
47
|
* 1. **Authenticate + derive tenant.** With a {@link RunRequestResponderOptions.verifyTenant}, the
|
|
41
48
|
* signed token (carried in the wire `tenant` field) is verified and the real tenant is DERIVED from
|
|
42
49
|
* it; the body's claim is ignored. An invalid token short-circuits to an `unauthorized` reply.
|
|
43
|
-
* 2. **`listRuns`
|
|
44
|
-
* never merely validated, so a tenant cannot enumerate
|
|
50
|
+
* 2. **`listRuns`, `runFacets` and `runValueFacets` are namespace-forced** to the derived tenant —
|
|
51
|
+
* the client's `namespace` is discarded, never merely validated, so a tenant cannot enumerate (or
|
|
52
|
+
* count, or read the tag vocabulary of) another's runs. **`waitingFor`** answers only the ids the
|
|
53
|
+
* tenant owns.
|
|
45
54
|
* 3. **`workerHealth` is group-scoped** to the tenant's own `@<tenant>` queues.
|
|
46
55
|
* 4. **Every runId-bearing verb** (`getRun`/`getCheckpoints`/`getRunDetail`/`getFanMembers`/
|
|
47
|
-
* `getSearchAttributes`/`signal`/`cancel`/`redispatch`)
|
|
48
|
-
* timeline — and rejects with `cross-tenant` when `run.namespace` isn't the derived tenant —
|
|
56
|
+
* `getSearchAttributes`/`signal`/`cancel`/`redispatch`/`retry`/`continue`/`retryWithInput`)
|
|
57
|
+
* loads the run alone FIRST — never its timeline — and rejects with `cross-tenant` when `run.namespace` isn't the derived tenant —
|
|
49
58
|
* anti-IDOR, so a tenant can never read OR act on another tenant's run.
|
|
50
59
|
* 5. **`start` forces the run's namespace** to the derived tenant, so a started run is owned by, and
|
|
51
60
|
* later only reachable by, that tenant.
|
|
52
|
-
* 6. **Unknown verbs are rejected** rather than silently ignored
|
|
61
|
+
* 6. **Unknown verbs are rejected** rather than silently ignored, with the
|
|
62
|
+
* {@link UNSUPPORTED_RUN_REQUEST} code and before the gateway is touched.
|
|
63
|
+
*
|
|
64
|
+
* Every request gets a reply: a gateway (or verifier) that throws becomes an error reply, because a
|
|
65
|
+
* request left unanswered makes the tenant wait out its whole timeout.
|
|
53
66
|
*
|
|
54
67
|
* Do not weaken any of these — they are the isolation guarantee of the store-less cluster.
|
|
55
68
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"run-request-responder.d.ts","sourceRoot":"","sources":["../../../src/run-gateway/run-request-responder.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAC;AACzD,OAAO,KAAK,EACV,WAAW,EACX,QAAQ,EAER,UAAU,
|
|
1
|
+
{"version":3,"file":"run-request-responder.d.ts","sourceRoot":"","sources":["../../../src/run-gateway/run-request-responder.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAC;AACzD,OAAO,KAAK,EACV,WAAW,EACX,QAAQ,EAER,UAAU,EAGV,eAAe,EACf,WAAW,EAEZ,MAAM,kBAAkB,CAAC;AAG1B,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,gBAAgB,CAAC;AAEjD;;;;;GAKG;AACH,MAAM,WAAW,kBAAkB;IACjC,YAAY,CAAC,OAAO,EAAE,CAAC,GAAG,EAAE,UAAU,KAAK,OAAO,CAAC,IAAI,CAAC,GAAG,IAAI,CAAC;IAChE,UAAU,CAAC,OAAO,EAAE,CAAC,GAAG,EAAE,eAAe,KAAK,OAAO,CAAC,IAAI,CAAC,GAAG,IAAI,CAAC;IACnE,eAAe,CAAC,KAAK,EAAE,QAAQ,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IAChD,kBAAkB,CAAC,GAAG,EAAE,WAAW,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;CACrD;AAED;;;;;GAKG;AACH,eAAO,MAAM,uBAAuB,wBAAwB,CAAC;AA6B7D,+CAA+C;AAC/C,MAAM,WAAW,0BAA0B;IACzC;;;;;OAKG;IACH,YAAY,CAAC,EAAE,cAAc,GAAG,SAAS,CAAC;IAC1C;;;;;OAKG;IACH,qBAAqB,CAAC,EAAE,CAAC,CAAC,QAAQ,EAAE,CAAC,KAAK,EAAE,WAAW,KAAK,IAAI,KAAK,MAAM,IAAI,CAAC,GAAG,SAAS,CAAC;CAC9F;AASD;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4BG;AACH,qBAAa,mBAAmB;;IAc9B,YACE,SAAS,EAAE,kBAAkB,EAC7B,OAAO,EAAE,UAAU,EACnB,OAAO,GAAE,0BAA+B,EAkBzC;IAED;;;;OAIG;IACH,KAAK,IAAI,IAAI,CA8BZ;IAED,mGAAmG;IACnG,IAAI,IAAI,IAAI,CAIX;CAyPF"}
|
|
@@ -1,4 +1,32 @@
|
|
|
1
1
|
import { loadFanMembers, loadRunDetail } from '../run-detail-summary.js';
|
|
2
|
+
import { runFacetsOf } from '../run-facets.js';
|
|
3
|
+
/**
|
|
4
|
+
* The error `code` a responder answers a verb it does not know with, so a newer tenant can tell
|
|
5
|
+
* "this control plane is older than me" from a real failure and fall back at once instead of
|
|
6
|
+
* waiting out its timeout. Responders before 0.50 answered with an error message
|
|
7
|
+
* (`unknown run-request verb: <kind>`) and no code; `ProxyRunGateway` recognizes both.
|
|
8
|
+
*/
|
|
9
|
+
export const UNSUPPORTED_RUN_REQUEST = 'unsupported-request';
|
|
10
|
+
/** Every verb this responder answers. Checked before the gateway is touched. */
|
|
11
|
+
const KNOWN_KINDS = new Set([
|
|
12
|
+
'getRun',
|
|
13
|
+
'listRuns',
|
|
14
|
+
'getCheckpoints',
|
|
15
|
+
'getSearchAttributes',
|
|
16
|
+
'getRunChildren',
|
|
17
|
+
'getRunDetail',
|
|
18
|
+
'getFanMembers',
|
|
19
|
+
'workerHealth',
|
|
20
|
+
'signal',
|
|
21
|
+
'cancel',
|
|
22
|
+
'redispatch',
|
|
23
|
+
'runFacets',
|
|
24
|
+
'runValueFacets',
|
|
25
|
+
'retry',
|
|
26
|
+
'continue',
|
|
27
|
+
'retryWithInput',
|
|
28
|
+
'waitingFor',
|
|
29
|
+
]);
|
|
2
30
|
/** `EngineEvent` types that END a run's lifecycle — no further event for that `runId` follows, so it is
|
|
3
31
|
* the safe point to drop the run from the namespace cache. Cancellation + dead-lettering are both
|
|
4
32
|
* emitted as `run.failed`; `run.suspended` is NOT terminal (a suspended run resumes). */
|
|
@@ -15,16 +43,22 @@ function isTerminalRunEvent(event) {
|
|
|
15
43
|
* 1. **Authenticate + derive tenant.** With a {@link RunRequestResponderOptions.verifyTenant}, the
|
|
16
44
|
* signed token (carried in the wire `tenant` field) is verified and the real tenant is DERIVED from
|
|
17
45
|
* it; the body's claim is ignored. An invalid token short-circuits to an `unauthorized` reply.
|
|
18
|
-
* 2. **`listRuns`
|
|
19
|
-
* never merely validated, so a tenant cannot enumerate
|
|
46
|
+
* 2. **`listRuns`, `runFacets` and `runValueFacets` are namespace-forced** to the derived tenant —
|
|
47
|
+
* the client's `namespace` is discarded, never merely validated, so a tenant cannot enumerate (or
|
|
48
|
+
* count, or read the tag vocabulary of) another's runs. **`waitingFor`** answers only the ids the
|
|
49
|
+
* tenant owns.
|
|
20
50
|
* 3. **`workerHealth` is group-scoped** to the tenant's own `@<tenant>` queues.
|
|
21
51
|
* 4. **Every runId-bearing verb** (`getRun`/`getCheckpoints`/`getRunDetail`/`getFanMembers`/
|
|
22
|
-
* `getSearchAttributes`/`signal`/`cancel`/`redispatch`)
|
|
23
|
-
* timeline — and rejects with `cross-tenant` when `run.namespace` isn't the derived tenant —
|
|
52
|
+
* `getSearchAttributes`/`signal`/`cancel`/`redispatch`/`retry`/`continue`/`retryWithInput`)
|
|
53
|
+
* loads the run alone FIRST — never its timeline — and rejects with `cross-tenant` when `run.namespace` isn't the derived tenant —
|
|
24
54
|
* anti-IDOR, so a tenant can never read OR act on another tenant's run.
|
|
25
55
|
* 5. **`start` forces the run's namespace** to the derived tenant, so a started run is owned by, and
|
|
26
56
|
* later only reachable by, that tenant.
|
|
27
|
-
* 6. **Unknown verbs are rejected** rather than silently ignored
|
|
57
|
+
* 6. **Unknown verbs are rejected** rather than silently ignored, with the
|
|
58
|
+
* {@link UNSUPPORTED_RUN_REQUEST} code and before the gateway is touched.
|
|
59
|
+
*
|
|
60
|
+
* Every request gets a reply: a gateway (or verifier) that throws becomes an error reply, because a
|
|
61
|
+
* request left unanswered makes the tenant wait out its whole timeout.
|
|
28
62
|
*
|
|
29
63
|
* Do not weaken any of these — they are the isolation guarantee of the store-less cluster.
|
|
30
64
|
*/
|
|
@@ -61,17 +95,35 @@ export class RunRequestResponder {
|
|
|
61
95
|
*/
|
|
62
96
|
start() {
|
|
63
97
|
this.#transport.onRunRequest(async (msg) => {
|
|
64
|
-
|
|
65
|
-
|
|
98
|
+
let answer;
|
|
99
|
+
try {
|
|
100
|
+
answer = await this.#handleRequest(msg);
|
|
101
|
+
}
|
|
102
|
+
catch (err) {
|
|
103
|
+
// Without a reply the tenant waits out its whole timeout for an answer that never comes.
|
|
104
|
+
answer = reply(msg.requestId, { ok: false, error: { message: errorMessage(err) } });
|
|
105
|
+
}
|
|
106
|
+
await this.#transport.publishRunReply(answer);
|
|
66
107
|
});
|
|
67
108
|
this.#transport.onStartRun(async (msg) => {
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
await this.#
|
|
109
|
+
let answer;
|
|
110
|
+
try {
|
|
111
|
+
answer = await this.#handleStart(msg);
|
|
112
|
+
}
|
|
113
|
+
catch (err) {
|
|
114
|
+
answer =
|
|
115
|
+
msg.runId === undefined
|
|
116
|
+
? undefined
|
|
117
|
+
: reply(msg.runId, { ok: false, error: { message: errorMessage(err) } });
|
|
118
|
+
}
|
|
119
|
+
if (answer)
|
|
120
|
+
await this.#transport.publishRunReply(answer);
|
|
71
121
|
});
|
|
72
122
|
if (this.#subscribeEngineEvents) {
|
|
73
123
|
this.#unsubscribeEvents = this.#subscribeEngineEvents((event) => {
|
|
74
|
-
|
|
124
|
+
// Best-effort, like the publish itself: a failing run lookup (the store briefly down) must
|
|
125
|
+
// not surface as an unhandled rejection from an event listener.
|
|
126
|
+
void this.#republish(event).catch(() => undefined);
|
|
75
127
|
});
|
|
76
128
|
}
|
|
77
129
|
}
|
|
@@ -93,45 +145,104 @@ export class RunRequestResponder {
|
|
|
93
145
|
});
|
|
94
146
|
}
|
|
95
147
|
const { body } = msg;
|
|
148
|
+
if (!KNOWN_KINDS.has(body.kind)) {
|
|
149
|
+
return reply(msg.requestId, {
|
|
150
|
+
ok: false,
|
|
151
|
+
error: {
|
|
152
|
+
message: `the control plane does not support the ${String(body.kind)} run request`,
|
|
153
|
+
code: UNSUPPORTED_RUN_REQUEST,
|
|
154
|
+
},
|
|
155
|
+
});
|
|
156
|
+
}
|
|
157
|
+
try {
|
|
158
|
+
return reply(msg.requestId, { ok: true, data: await this.#answer(body, tenant) });
|
|
159
|
+
}
|
|
160
|
+
catch (err) {
|
|
161
|
+
if (err instanceof CrossTenantError) {
|
|
162
|
+
return reply(msg.requestId, {
|
|
163
|
+
ok: false,
|
|
164
|
+
error: { message: 'run belongs to another tenant', code: 'cross-tenant' },
|
|
165
|
+
});
|
|
166
|
+
}
|
|
167
|
+
if (err instanceof GatewayLacksVerbError) {
|
|
168
|
+
return reply(msg.requestId, {
|
|
169
|
+
ok: false,
|
|
170
|
+
error: { message: err.message, code: UNSUPPORTED_RUN_REQUEST },
|
|
171
|
+
});
|
|
172
|
+
}
|
|
173
|
+
return reply(msg.requestId, { ok: false, error: { message: errorMessage(err) } });
|
|
174
|
+
}
|
|
175
|
+
}
|
|
176
|
+
/** Answer a known verb for the verified `tenant`. A run of another tenant throws
|
|
177
|
+
* {@link CrossTenantError} before the verb runs. */
|
|
178
|
+
async #answer(body, tenant) {
|
|
96
179
|
if (body.kind === 'listRuns') {
|
|
97
180
|
// Force the namespace to the verified tenant — the client value is DISCARDED, never validated, so
|
|
98
181
|
// a tenant can't widen its own query into another's namespace.
|
|
99
|
-
|
|
100
|
-
return reply(msg.requestId, { ok: true, data });
|
|
182
|
+
return this.#gateway.listRuns({ ...body.query, namespace: tenant });
|
|
101
183
|
}
|
|
102
184
|
if (body.kind === 'workerHealth') {
|
|
103
185
|
// Not runId-bearing. Scope by the group-name convention instead: a tenant's queues are suffixed
|
|
104
186
|
// `<name>@<tenant>`, so keep only groups ending in `@<tenant>` — the operator's own bare groups
|
|
105
187
|
// and every other tenant's are dropped.
|
|
106
188
|
const all = await this.#gateway.workerHealth();
|
|
107
|
-
|
|
108
|
-
return reply(msg.requestId, { ok: true, data });
|
|
189
|
+
return all.filter((h) => h.group.endsWith(`@${tenant}`));
|
|
109
190
|
}
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
});
|
|
191
|
+
if (body.kind === 'runFacets') {
|
|
192
|
+
// Forced to the tenant exactly like `listRuns`: the counts label the tenant's own list.
|
|
193
|
+
const scoped = { ...body.query, namespace: tenant };
|
|
194
|
+
if (this.#gateway.runFacets)
|
|
195
|
+
return this.#gateway.runFacets(scoped);
|
|
196
|
+
const facets = this.#gateway.runValueFacets;
|
|
197
|
+
if (!facets)
|
|
198
|
+
throw new GatewayLacksVerbError(body.kind);
|
|
199
|
+
return runFacetsOf({ runValueFacets: (axis, q, opts) => facets.call(this.#gateway, axis, q, opts) }, scoped);
|
|
119
200
|
}
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
201
|
+
if (body.kind === 'runValueFacets') {
|
|
202
|
+
// Forced too: enumerating values over other tenants' runs would leak their tag and attribute
|
|
203
|
+
// vocabulary, and offer picks this tenant's list can never match.
|
|
204
|
+
if (!this.#gateway.runValueFacets)
|
|
205
|
+
throw new GatewayLacksVerbError(body.kind);
|
|
206
|
+
return this.#gateway.runValueFacets(body.axis, { ...body.query, namespace: tenant }, body.opts);
|
|
123
207
|
}
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
208
|
+
if (body.kind === 'waitingFor') {
|
|
209
|
+
// Bulk and caller-chosen ids, which could probe another tenant's runs: keep only the matches
|
|
210
|
+
// the tenant owns, checked per MATCHED entry (bounded by how many ids are actually waiting).
|
|
211
|
+
if (!this.#gateway.waitingFor)
|
|
212
|
+
throw new GatewayLacksVerbError(body.kind);
|
|
213
|
+
const all = await this.#gateway.waitingFor(body.runIds);
|
|
214
|
+
const owned = {};
|
|
215
|
+
await Promise.all(Object.entries(all).map(async ([runId, waiting]) => {
|
|
216
|
+
const owner = await this.#gateway.getRun(runId);
|
|
217
|
+
if (owner && owner.namespace === tenant)
|
|
218
|
+
owned[runId] = waiting;
|
|
219
|
+
}));
|
|
220
|
+
return owned;
|
|
129
221
|
}
|
|
222
|
+
// Every remaining verb is runId-bearing. Load the run FIRST — before calling the verb — so a
|
|
223
|
+
// cross-tenant request never reaches the gateway's mutating methods (signal/cancel/redispatch/
|
|
224
|
+
// retry/continue/retryWithInput) or leaks another tenant's run via a read (getRun/getCheckpoints/getSearchAttributes).
|
|
225
|
+
const run = await this.#gateway.getRun(body.runId);
|
|
226
|
+
if (run && run.namespace !== tenant)
|
|
227
|
+
throw new CrossTenantError();
|
|
228
|
+
return this.#callVerb(body, run);
|
|
130
229
|
}
|
|
131
230
|
/** Dispatch a runId-bearing verb. `run` is the already-loaded run (ownership-checked by the caller) —
|
|
132
231
|
* reused for `getRun` so it isn't fetched twice. An unknown verb is rejected, never silently dropped. */
|
|
133
232
|
#callVerb(body, run) {
|
|
134
233
|
switch (body.kind) {
|
|
234
|
+
case 'retry':
|
|
235
|
+
if (!this.#gateway.retry)
|
|
236
|
+
throw new GatewayLacksVerbError(body.kind);
|
|
237
|
+
return this.#gateway.retry(body.runId);
|
|
238
|
+
case 'continue':
|
|
239
|
+
if (!this.#gateway.continue)
|
|
240
|
+
throw new GatewayLacksVerbError(body.kind);
|
|
241
|
+
return this.#gateway.continue(body.runId);
|
|
242
|
+
case 'retryWithInput':
|
|
243
|
+
if (!this.#gateway.retryWithInput)
|
|
244
|
+
throw new GatewayLacksVerbError(body.kind);
|
|
245
|
+
return this.#gateway.retryWithInput(body.runId, body.input);
|
|
135
246
|
case 'getRun':
|
|
136
247
|
return Promise.resolve(run);
|
|
137
248
|
case 'getCheckpoints':
|
|
@@ -251,6 +362,18 @@ export class RunRequestResponder {
|
|
|
251
362
|
return verified ? verified.tenant : null;
|
|
252
363
|
}
|
|
253
364
|
}
|
|
365
|
+
/** A runId-bearing request addressed a run of another tenant. */
|
|
366
|
+
class CrossTenantError extends Error {
|
|
367
|
+
}
|
|
368
|
+
/** The control plane's gateway does not implement an optional verb (a hand-written gateway). */
|
|
369
|
+
class GatewayLacksVerbError extends Error {
|
|
370
|
+
constructor(kind) {
|
|
371
|
+
super(`the control plane does not support the ${kind} run request`);
|
|
372
|
+
}
|
|
373
|
+
}
|
|
374
|
+
function errorMessage(err) {
|
|
375
|
+
return err instanceof Error ? err.message : String(err);
|
|
376
|
+
}
|
|
254
377
|
/** Build a correlated {@link RunReply}. */
|
|
255
378
|
function reply(requestId, result) {
|
|
256
379
|
return { requestId, result };
|