deepline 0.3.89 → 0.3.91
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/contracts/install-commands.json +29 -0
- package/dist/bundling-sources/sdk/src/client.ts +221 -43
- package/dist/bundling-sources/sdk/src/index.ts +4 -0
- package/dist/bundling-sources/sdk/src/monitor-fleet-contract.ts +2 -556
- package/dist/bundling-sources/sdk/src/monitor-fleets.ts +2 -2
- package/dist/bundling-sources/sdk/src/pagination.ts +25 -0
- package/dist/bundling-sources/sdk/src/plays/bundle-play-file.ts +1 -1
- package/dist/bundling-sources/sdk/src/release.ts +11 -9
- package/dist/bundling-sources/sdk/src/types.ts +29 -1
- package/dist/bundling-sources/shared_libs/integration-contracts/monitor-fleet-contract.ts +549 -0
- package/dist/bundling-sources/shared_libs/monitors/analytics-public.ts +10 -0
- package/dist/bundling-sources/shared_libs/monitors/fleets/errors.ts +96 -0
- package/dist/bundling-sources/shared_libs/monitors/fleets/limits.ts +8 -0
- package/dist/bundling-sources/shared_libs/monitors/fleets/plan.ts +320 -0
- package/dist/bundling-sources/shared_libs/monitors/fleets/verdict.ts +106 -0
- package/dist/bundling-sources/shared_libs/monitors/http-error-response.ts +8 -1
- package/dist/bundling-sources/shared_libs/monitors/inbound-queue.ts +4 -4
- package/dist/bundling-sources/shared_libs/monitors/inventory-reconciliation.ts +59 -0
- package/dist/bundling-sources/shared_libs/monitors/lifecycle-notifications.ts +7 -9
- package/dist/bundling-sources/shared_libs/monitors/monitor-fleet-limits.ts +2 -12
- package/dist/bundling-sources/shared_libs/monitors/package.json +113 -4
- package/dist/bundling-sources/shared_libs/monitors/provider-monitor-batch-operation.ts +56 -9
- package/dist/bundling-sources/shared_libs/monitors/provider-monitor-consumer-health.ts +2 -2
- package/dist/bundling-sources/shared_libs/monitors/provider-monitor-identity-claims.ts +2 -2
- package/dist/bundling-sources/shared_libs/monitors/provider-monitor-public-aliases.ts +1 -1
- package/dist/bundling-sources/shared_libs/monitors/signal-radars/inbound-dead-letter.ts +245 -0
- package/dist/bundling-sources/shared_libs/monitors/signal-radars/inbound-message.ts +38 -0
- package/dist/bundling-sources/shared_libs/monitors/signal-radars/inbound-queue-ack-probe.ts +94 -0
- package/dist/bundling-sources/shared_libs/monitors/signal-radars/inbound-queue-delivery.ts +60 -0
- package/dist/bundling-sources/shared_libs/monitors/signal-radars/inbound-queue.ts +60 -0
- package/dist/bundling-sources/shared_libs/monitors/snitcher-install-validation.ts +1 -1
- package/dist/bundling-sources/shared_libs/monitors/snitcher-ip2company.ts +2 -2
- package/dist/bundling-sources/shared_libs/monitors/snitcher-radar.ts +1 -1
- package/dist/bundling-sources/shared_libs/monitors/tracking-provider-integrations.ts +1 -1
- package/dist/bundling-sources/shared_libs/observability/build-context.ts +13 -0
- package/dist/bundling-sources/shared_libs/observability/log-metadata.ts +160 -0
- package/dist/bundling-sources/shared_libs/observability/request-context.ts +68 -0
- package/dist/bundling-sources/shared_libs/observability/scheduled-jobs.json +690 -0
- package/dist/bundling-sources/shared_libs/observability/scheduled-work-manual.ts +35 -0
- package/dist/bundling-sources/shared_libs/observability/scheduled-work.ts +5 -0
- package/dist/bundling-sources/shared_libs/play-data-plane/neon-constants.ts +9 -0
- package/dist/bundling-sources/shared_libs/play-data-plane/r2.ts +272 -0
- package/dist/bundling-sources/shared_libs/play-runtime/app-runtime-api.ts +46 -1
- package/dist/bundling-sources/shared_libs/play-runtime/async-operation.ts +66 -1
- package/dist/bundling-sources/shared_libs/play-runtime/async-play-invocation.ts +0 -1
- package/dist/bundling-sources/shared_libs/play-runtime/bounceban-batching.ts +137 -0
- package/dist/bundling-sources/shared_libs/play-runtime/context.ts +779 -140
- package/dist/bundling-sources/shared_libs/play-runtime/ctx-types.ts +46 -0
- package/dist/bundling-sources/shared_libs/play-runtime/daytona-payload-contract.ts +68 -0
- package/dist/bundling-sources/shared_libs/play-runtime/daytona-sandbox-janitor.ts +103 -0
- package/dist/bundling-sources/shared_libs/play-runtime/daytona-sandbox-reaper.ts +725 -0
- package/dist/bundling-sources/shared_libs/play-runtime/db-session-lease-store.ts +578 -0
- package/dist/bundling-sources/shared_libs/play-runtime/deployment/commands/roll-execution-relay.ts +521 -0
- package/dist/bundling-sources/shared_libs/play-runtime/deployment/commands/roll-receipt-gateway.ts +1378 -0
- package/dist/bundling-sources/shared_libs/play-runtime/deployment/commands/runtime-topology.ts +1024 -0
- package/dist/bundling-sources/shared_libs/play-runtime/deployment/fly-gateway-route-probe.ts +193 -0
- package/dist/bundling-sources/shared_libs/play-runtime/deployment/fly-machine-lifecycle.ts +104 -0
- package/dist/bundling-sources/shared_libs/play-runtime/deployment/fly-machines.ts +1844 -0
- package/dist/bundling-sources/shared_libs/play-runtime/deployment/fly-registry.ts +21 -0
- package/dist/bundling-sources/shared_libs/play-runtime/deployment/process-tree.ts +40 -0
- package/dist/bundling-sources/shared_libs/play-runtime/deployment/runtime-gateway-drain.ts +262 -0
- package/dist/bundling-sources/shared_libs/play-runtime/deployment/runtime-surface.ts +98 -0
- package/dist/bundling-sources/shared_libs/play-runtime/deployment/runtime-topology.ts +303 -0
- package/dist/bundling-sources/shared_libs/play-runtime/deployment/runtime-tuple-publication-guardian.ts +70 -0
- package/dist/bundling-sources/shared_libs/play-runtime/deployment/runtime-tuple-recovery.ts +519 -0
- package/dist/bundling-sources/shared_libs/play-runtime/deployment/vercel-fly-rollback-alignment.ts +280 -0
- package/dist/bundling-sources/shared_libs/play-runtime/deployment/vercel-production-gate.ts +159 -0
- package/dist/bundling-sources/shared_libs/play-runtime/durable-call-cache.ts +29 -0
- package/dist/bundling-sources/shared_libs/play-runtime/execution-capabilities.ts +23 -0
- package/dist/bundling-sources/shared_libs/play-runtime/execution-gateway-invocation-fence.ts +442 -0
- package/dist/bundling-sources/shared_libs/play-runtime/execution-protocol.ts +3 -3
- package/dist/bundling-sources/shared_libs/play-runtime/fixture-behavior.ts +18 -0
- package/dist/bundling-sources/shared_libs/play-runtime/governor/app-runtime-rate-state-backend.ts +9 -0
- package/dist/bundling-sources/shared_libs/play-runtime/governor/policy.ts +1 -1
- package/dist/bundling-sources/shared_libs/play-runtime/governor/rate-state-backend.ts +1 -1
- package/dist/bundling-sources/shared_libs/play-runtime/integration-operation-reader-fence/contracts.ts +66 -0
- package/dist/bundling-sources/shared_libs/play-runtime/integration-operation-reader-fence/job.ts +145 -0
- package/dist/bundling-sources/shared_libs/play-runtime/integration-operation-reader-fence/memory-store.ts +114 -0
- package/dist/bundling-sources/shared_libs/play-runtime/integration-operation-reader-fence/ports.ts +21 -0
- package/dist/bundling-sources/shared_libs/play-runtime/integration-operation-reader-fence/postgres-store.ts +170 -0
- package/dist/bundling-sources/shared_libs/play-runtime/internal-bootstrap-token.ts +1322 -0
- package/dist/bundling-sources/shared_libs/play-runtime/internal-step-ids.ts +2 -2
- package/dist/bundling-sources/shared_libs/play-runtime/lane-retirement-gate.ts +1 -1
- package/dist/bundling-sources/shared_libs/play-runtime/launch-source-policy.ts +112 -0
- package/dist/bundling-sources/shared_libs/play-runtime/map-execution-frame.ts +8 -0
- package/dist/bundling-sources/shared_libs/play-runtime/perf-trace.ts +127 -0
- package/dist/bundling-sources/shared_libs/play-runtime/play-artifact-runtime-contract.ts +5 -0
- package/dist/bundling-sources/shared_libs/play-runtime/play-run-recovery-policy.ts +24 -1
- package/dist/bundling-sources/shared_libs/play-runtime/play-runs/admission/contracts.ts +56 -0
- package/dist/bundling-sources/shared_libs/play-runtime/play-runs/admission/index.ts +13 -0
- package/dist/bundling-sources/shared_libs/play-runtime/play-runs/admission/job.ts +41 -0
- package/dist/bundling-sources/shared_libs/play-runtime/play-runs/admission/ports.ts +17 -0
- package/dist/bundling-sources/shared_libs/play-runtime/play-runs/admission/postgres-adapter.ts +54 -0
- package/dist/bundling-sources/shared_libs/play-runtime/play-runs/attempts/contracts.ts +114 -0
- package/dist/bundling-sources/shared_libs/play-runtime/play-runs/attempts/engine-suspension.ts +108 -0
- package/dist/bundling-sources/shared_libs/play-runtime/play-runs/attempts/index.ts +36 -0
- package/dist/bundling-sources/shared_libs/play-runtime/play-runs/attempts/job.ts +97 -0
- package/dist/bundling-sources/shared_libs/play-runtime/play-runs/attempts/ports.ts +104 -0
- package/dist/bundling-sources/shared_libs/play-runtime/play-runs/attempts/postgres-fence-adapter.ts +263 -0
- package/dist/bundling-sources/shared_libs/play-runtime/play-runs/attempts/worker-terminal-projection.ts +64 -0
- package/dist/bundling-sources/shared_libs/play-runtime/play-runs/projection/contracts.ts +29 -0
- package/dist/bundling-sources/shared_libs/play-runtime/play-runs/projection/gateway-adapter.ts +56 -0
- package/dist/bundling-sources/shared_libs/play-runtime/play-runs/projection/index.ts +15 -0
- package/dist/bundling-sources/shared_libs/play-runtime/play-runs/projection/job.ts +65 -0
- package/dist/bundling-sources/shared_libs/play-runtime/play-runs/projection/ports.ts +17 -0
- package/dist/bundling-sources/shared_libs/play-runtime/play-runs/sandbox-cleanup/contracts.ts +42 -0
- package/dist/bundling-sources/shared_libs/play-runtime/play-runs/sandbox-cleanup/index.ts +17 -0
- package/dist/bundling-sources/shared_libs/play-runtime/play-runs/sandbox-cleanup/job.ts +142 -0
- package/dist/bundling-sources/shared_libs/play-runtime/play-runs/sandbox-cleanup/ports.ts +42 -0
- package/dist/bundling-sources/shared_libs/play-runtime/play-runs/sandbox-cleanup/postgres-adapter.ts +102 -0
- package/dist/bundling-sources/shared_libs/play-runtime/play-runs/terminal/contracts.ts +60 -0
- package/dist/bundling-sources/shared_libs/play-runtime/play-runs/terminal/index.ts +16 -0
- package/dist/bundling-sources/shared_libs/play-runtime/play-runs/terminal/job.ts +78 -0
- package/dist/bundling-sources/shared_libs/play-runtime/play-runs/terminal/ports.ts +54 -0
- package/dist/bundling-sources/shared_libs/play-runtime/play-runs/terminal/postgres-adapter.ts +71 -0
- package/dist/bundling-sources/shared_libs/play-runtime/play-runtime-batching-registry.ts +4 -0
- package/dist/bundling-sources/shared_libs/play-runtime/protocol.ts +2 -0
- package/dist/bundling-sources/shared_libs/play-runtime/receipt-status.ts +5 -8
- package/dist/bundling-sources/shared_libs/play-runtime/run-failure.ts +3 -5
- package/dist/bundling-sources/shared_libs/play-runtime/run-identity.ts +168 -0
- package/dist/bundling-sources/shared_libs/play-runtime/run-ledger.ts +44 -5
- package/dist/bundling-sources/shared_libs/play-runtime/runner-app/child-play-resolver.ts +26 -0
- package/dist/bundling-sources/shared_libs/play-runtime/runner-app/index.ts +3662 -0
- package/dist/bundling-sources/shared_libs/play-runtime/runner-app/progress-sidecar.ts +47 -0
- package/dist/bundling-sources/shared_libs/play-runtime/runner-app/runtime-deadline.ts +84 -0
- package/dist/bundling-sources/shared_libs/play-runtime/runner-app/runtime-gateway-transport.ts +91 -0
- package/dist/bundling-sources/shared_libs/play-runtime/runner-app/runtime-heartbeat.ts +424 -0
- package/dist/bundling-sources/shared_libs/play-runtime/runner-app/runtime-progress-push.ts +321 -0
- package/dist/bundling-sources/shared_libs/play-runtime/runner-app/runtime-sheet-persistence-retry.ts +110 -0
- package/dist/bundling-sources/shared_libs/play-runtime/runner-app/runtime-terminal-push.ts +625 -0
- package/dist/bundling-sources/shared_libs/play-runtime/runner-backends/backends/daytona-lifecycle.ts +72 -9
- package/dist/bundling-sources/shared_libs/play-runtime/runner-backends/backends/daytona-payload-transport.ts +6 -12
- package/dist/bundling-sources/shared_libs/play-runtime/runner-backends/backends/daytona.ts +19 -0
- package/dist/bundling-sources/shared_libs/play-runtime/runner-backends/bundle.ts +0 -1
- package/dist/bundling-sources/shared_libs/play-runtime/runner-backends/runtime-sandbox-reconciliation.ts +14 -44
- package/dist/bundling-sources/shared_libs/play-runtime/runtime-api.ts +103 -208
- package/dist/bundling-sources/shared_libs/play-runtime/runtime-authority.ts +201 -0
- package/dist/bundling-sources/shared_libs/play-runtime/runtime-env.ts +6 -0
- package/dist/bundling-sources/shared_libs/play-runtime/runtime-operation-contract.ts +67 -0
- package/dist/bundling-sources/shared_libs/play-runtime/runtime-release-environment.ts +2 -0
- package/dist/bundling-sources/shared_libs/play-runtime/runtime-sandbox-contract.ts +68 -0
- package/dist/bundling-sources/shared_libs/play-runtime/runtime-scheduler-topology.ts +14 -2
- package/dist/bundling-sources/shared_libs/play-runtime/runtime-telemetry.ts +108 -0
- package/dist/bundling-sources/shared_libs/play-runtime/sandbox-runs/contract.ts +4 -0
- package/dist/bundling-sources/shared_libs/play-runtime/sandbox-runs/runner-backend-adapter.ts +3 -0
- package/dist/bundling-sources/shared_libs/play-runtime/scheduler-backend.ts +7 -0
- package/dist/bundling-sources/shared_libs/play-runtime/scheduler-backends/absurd-deadline-reconciliation.ts +88 -0
- package/dist/bundling-sources/shared_libs/play-runtime/scheduler-backends/absurd-play-deploy-task.ts +124 -0
- package/dist/bundling-sources/shared_libs/play-runtime/scheduler-backends/absurd-play-run-task.ts +68 -0
- package/dist/bundling-sources/shared_libs/play-runtime/scheduler-backends/absurd-pool.ts +193 -0
- package/dist/bundling-sources/shared_libs/play-runtime/scheduler-backends/absurd-queue-lifecycle.ts +269 -0
- package/dist/bundling-sources/shared_libs/play-runtime/scheduler-backends/absurd-queue-suffix.ts +73 -0
- package/dist/bundling-sources/shared_libs/play-runtime/scheduler-backends/absurd-runtime-worker.ts +6642 -0
- package/dist/bundling-sources/shared_libs/play-runtime/scheduler-backends/absurd-shared.ts +897 -0
- package/dist/bundling-sources/shared_libs/play-runtime/scheduler-backends/absurd-worker-metrics.ts +120 -0
- package/dist/bundling-sources/shared_libs/play-runtime/scheduler-backends/absurd-worker-required-env.ts +76 -0
- package/dist/bundling-sources/shared_libs/play-runtime/scheduler-backends/absurd.ts +476 -0
- package/dist/bundling-sources/shared_libs/play-runtime/scheduler-backends/gateway-heavy-request-admission.ts +47 -0
- package/dist/bundling-sources/shared_libs/play-runtime/scheduler-backends/gateway-progress-registry.ts +147 -0
- package/dist/bundling-sources/shared_libs/play-runtime/scheduler-backends/index.ts +27 -0
- package/dist/bundling-sources/shared_libs/play-runtime/scheduler-backends/lazy.ts +50 -0
- package/dist/bundling-sources/shared_libs/play-runtime/scheduler-backends/play-run-recovery.ts +98 -0
- package/dist/bundling-sources/shared_libs/play-runtime/scheduler-backends/postgres-budget-state.ts +260 -0
- package/dist/bundling-sources/shared_libs/play-runtime/scheduler-backends/postgres-pool.ts +1416 -0
- package/dist/bundling-sources/shared_libs/play-runtime/scheduler-backends/postgres-progress.ts +1255 -0
- package/dist/bundling-sources/shared_libs/play-runtime/scheduler-backends/postgres-rate-state.ts +942 -0
- package/dist/bundling-sources/shared_libs/play-runtime/scheduler-backends/postgres.ts +14636 -0
- package/dist/bundling-sources/shared_libs/play-runtime/scheduler-backends/receipt-gateway.ts +888 -0
- package/dist/bundling-sources/shared_libs/play-runtime/scheduler-backends/run-ledger-outbox-recovery.ts +355 -0
- package/dist/bundling-sources/shared_libs/play-runtime/scheduler-backends/run-terminal-transition.ts +46 -0
- package/dist/bundling-sources/shared_libs/play-runtime/scheduler-backends/runner-push.ts +60 -0
- package/dist/bundling-sources/shared_libs/play-runtime/scheduler-backends/runtime-api-origin.ts +33 -0
- package/dist/bundling-sources/shared_libs/play-runtime/scheduler-backends/runtime-receipt-gateway-health.ts +64 -0
- package/dist/bundling-sources/shared_libs/play-runtime/scheduler-backends/runtime-sandbox-capacity.ts +835 -0
- package/dist/bundling-sources/shared_libs/play-runtime/scheduler-backends/runtime-sandbox-ledger-reconciliation.ts +1218 -0
- package/dist/bundling-sources/shared_libs/play-runtime/scheduler-backends/runtime-sandbox-operation.ts +207 -0
- package/dist/bundling-sources/shared_libs/play-runtime/scheduler-backends/runtime-scheduler-schema.ts +10 -0
- package/dist/bundling-sources/shared_libs/play-runtime/scheduler-backends/scheduler-capacity.ts +123 -0
- package/dist/bundling-sources/shared_libs/play-runtime/scheduler-backends/scheduler-launch-read-observability.ts +78 -0
- package/dist/bundling-sources/shared_libs/play-runtime/scheduler-backends/submit-admission.ts +169 -0
- package/dist/bundling-sources/shared_libs/play-runtime/scheduler-backends/terminal-contract.ts +20 -0
- package/dist/bundling-sources/shared_libs/play-runtime/scheduler-backends/worker-queue-metrics.ts +34 -0
- package/dist/bundling-sources/shared_libs/play-runtime/scheduler-backends/worker-resource-metrics.ts +249 -0
- package/dist/bundling-sources/shared_libs/play-runtime/sheet-attempt-sql.ts +7 -0
- package/dist/bundling-sources/shared_libs/play-runtime/step-progress.ts +296 -0
- package/dist/bundling-sources/shared_libs/play-runtime/tool-call/native-batch.ts +3 -3
- package/dist/bundling-sources/shared_libs/play-runtime/tool-call/runtime-step-receipts-adapter.ts +20 -1
- package/dist/bundling-sources/shared_libs/play-runtime/tool-execute-retry-policy.ts +60 -15
- package/dist/bundling-sources/shared_libs/play-runtime/tool-execution-outcome.ts +20 -0
- package/dist/bundling-sources/shared_libs/play-runtime/transient-service-error.ts +12 -0
- package/dist/bundling-sources/shared_libs/play-runtime/vercel-protection.ts +14 -1
- package/dist/bundling-sources/shared_libs/play-runtime/webhook-receipt-retry.ts +50 -0
- package/dist/bundling-sources/shared_libs/play-runtime/work-receipt-storage-contract.ts +165 -0
- package/dist/bundling-sources/shared_libs/play-runtime/work-receipts.ts +15 -23
- package/dist/bundling-sources/shared_libs/play-runtime/workflow-executor-auth.ts +169 -0
- package/dist/bundling-sources/shared_libs/play-runtime/zerobounce-batching.ts +122 -0
- package/dist/bundling-sources/shared_libs/plays/artifact-types.ts +2 -0
- package/dist/bundling-sources/shared_libs/plays/bundling/repository-adapter.ts +24 -0
- package/dist/bundling-sources/shared_libs/plays/child-run-projection.ts +174 -0
- package/dist/bundling-sources/shared_libs/plays/contracts.ts +2 -0
- package/dist/bundling-sources/shared_libs/plays/deploy/api-client.ts +267 -0
- package/dist/bundling-sources/shared_libs/plays/deploy/control-plane-types.ts +73 -0
- package/dist/bundling-sources/shared_libs/plays/deploy/manifest.ts +162 -0
- package/dist/bundling-sources/shared_libs/plays/deploy/project-serializer.ts +87 -0
- package/dist/bundling-sources/shared_libs/plays/deploy/source-file-path.ts +26 -0
- package/dist/bundling-sources/shared_libs/plays/deploy/target-paths.ts +36 -0
- package/dist/bundling-sources/shared_libs/plays/deployment-status.ts +1 -1
- package/dist/bundling-sources/shared_libs/plays/docflow.ts +1 -1
- package/dist/bundling-sources/shared_libs/plays/launch/input-contract.ts +400 -0
- package/dist/bundling-sources/shared_libs/plays/launch/prepare.ts +96 -0
- package/dist/bundling-sources/shared_libs/plays/local-file-discovery.ts +385 -0
- package/dist/bundling-sources/shared_libs/plays/play-grep-search.ts +112 -0
- package/dist/bundling-sources/shared_libs/plays/play-reference.ts +117 -0
- package/dist/bundling-sources/shared_libs/plays/run-input-summary.ts +260 -0
- package/dist/bundling-sources/shared_libs/plays/run-summary-types.ts +49 -0
- package/dist/bundling-sources/shared_libs/plays/secrets/errors.ts +19 -0
- package/dist/bundling-sources/shared_libs/plays/share/copy.ts +271 -0
- package/dist/bundling-sources/shared_libs/plays/share/metrics.ts +140 -0
- package/dist/bundling-sources/shared_libs/plays/share/public-read-model.ts +86 -0
- package/dist/bundling-sources/shared_libs/plays/share/seo-quality.ts +181 -0
- package/dist/bundling-sources/shared_libs/plays/share/static-pipeline-summary.ts +658 -0
- package/dist/bundling-sources/shared_libs/plays/share/types.ts +197 -0
- package/dist/bundling-sources/shared_libs/plays/sheet-filter.ts +347 -0
- package/dist/bundling-sources/shared_libs/plays/slack-hitl-timeout-error.ts +37 -0
- package/dist/bundling-sources/shared_libs/plays/standard-webhooks.ts +117 -0
- package/dist/bundling-sources/shared_libs/plays/static-pipeline.ts +6 -1
- package/dist/bundling-sources/shared_libs/plays/status-result.ts +388 -0
- package/dist/bundling-sources/shared_libs/plays/tool-result-types.ts +1 -1
- package/dist/bundling-sources/shared_libs/plays/transform-factor-structure.ts +377 -0
- package/dist/bundling-sources/shared_libs/plays/webhook-payload.ts +113 -0
- package/dist/bundling-sources/shared_libs/product-notifications/configuration.ts +7 -1
- package/dist/bundling-sources/shared_libs/product-notifications/default-policy.ts +3 -2
- package/dist/bundling-sources/shared_libs/product-notifications/overflow.ts +18 -0
- package/dist/bundling-sources/shared_libs/product-notifications/rolling-limit.ts +24 -0
- package/dist/bundling-sources/shared_libs/product-notifications/slack-delivery.ts +624 -0
- package/dist/bundling-sources/shared_libs/product-notifications/slack-payload.ts +140 -0
- package/dist/bundling-sources/shared_libs/product-notifications/slack-transport.ts +75 -0
- package/dist/bundling-sources/shared_libs/runtime-env.ts +6 -0
- package/dist/bundling-sources/shared_libs/security/email-blacklist.ts +42 -0
- package/dist/bundling-sources/shared_libs/security/header-safe-env.ts +10 -3
- package/dist/bundling-sources/shared_libs/security/slack-sanitize.ts +133 -0
- package/dist/cli/getting-started.d.mts +52 -0
- package/dist/cli/getting-started.d.ts +52 -0
- package/dist/cli/getting-started.js +65 -0
- package/dist/cli/getting-started.mjs +36 -0
- package/dist/cli/index.d.mts +9 -0
- package/dist/cli/index.d.ts +9 -0
- package/dist/cli/index.js +895 -407
- package/dist/cli/index.mjs +893 -414
- package/dist/{compiler-manifest-DsLbQaew.d.mts → compiler-manifest-x14KL83E.d.mts} +4 -2
- package/dist/{compiler-manifest-DsLbQaew.d.ts → compiler-manifest-x14KL83E.d.ts} +4 -2
- package/dist/index.d.mts +124 -154
- package/dist/index.d.ts +124 -154
- package/dist/index.js +132 -28
- package/dist/index.mjs +132 -28
- package/dist/install-integrity.json +182 -2
- package/dist/monitor-fleet-contract.d.mts +131 -0
- package/dist/monitor-fleet-contract.d.ts +131 -0
- package/dist/monitor-fleet-contract.js +406 -0
- package/dist/monitor-fleet-contract.mjs +367 -0
- package/dist/plays/bundle-play-file.d.mts +2 -2
- package/dist/plays/bundle-play-file.d.ts +2 -2
- package/dist/release.d.mts +255 -0
- package/dist/release.d.ts +255 -0
- package/dist/release.js +210 -0
- package/dist/release.mjs +183 -0
- package/package.json +21 -4
package/dist/bundling-sources/shared_libs/play-runtime/integration-operation-reader-fence/job.ts
ADDED
|
@@ -0,0 +1,145 @@
|
|
|
1
|
+
import {
|
|
2
|
+
INTEGRATION_OPERATION_CANONICAL_READER_CAPABILITY,
|
|
3
|
+
type IntegrationOperationStorageMode,
|
|
4
|
+
type ReaderFenceApplyOutcome,
|
|
5
|
+
type ReaderFenceWriterMode,
|
|
6
|
+
type RuntimeGatewayReaderFence,
|
|
7
|
+
type RuntimeGatewayReaderFenceCandidate,
|
|
8
|
+
type RuntimeGatewayReaderFenceJob,
|
|
9
|
+
} from '../integration-operation-reader-fence/contracts';
|
|
10
|
+
import type { RuntimeGatewayReaderFencePorts } from '../integration-operation-reader-fence/ports';
|
|
11
|
+
|
|
12
|
+
/**
|
|
13
|
+
* Decides which Integration Operation storage format a gateway may write.
|
|
14
|
+
*
|
|
15
|
+
* This job intentionally has no environment variable, deployment lookup, or
|
|
16
|
+
* fallback-to-canonical path. The durable, schema-scoped mirror is the only
|
|
17
|
+
* authority. A missing, malformed, or unreadable mirror therefore continues
|
|
18
|
+
* to select the old byte-response writer.
|
|
19
|
+
*/
|
|
20
|
+
export function createRuntimeGatewayReaderFenceJob(
|
|
21
|
+
ports: RuntimeGatewayReaderFencePorts,
|
|
22
|
+
): RuntimeGatewayReaderFenceJob {
|
|
23
|
+
return {
|
|
24
|
+
async writerMode(input): Promise<ReaderFenceWriterMode> {
|
|
25
|
+
validateSchema(input.schema);
|
|
26
|
+
let fence: RuntimeGatewayReaderFence | null;
|
|
27
|
+
try {
|
|
28
|
+
fence = await ports.store.read({ schema: input.schema });
|
|
29
|
+
} catch {
|
|
30
|
+
return {
|
|
31
|
+
mode: 'legacy_byte_reader',
|
|
32
|
+
source: 'fail_closed',
|
|
33
|
+
epoch: null,
|
|
34
|
+
failure: 'store_unavailable',
|
|
35
|
+
};
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
if (!fence) {
|
|
39
|
+
return { mode: 'legacy_byte_reader', source: 'absent', epoch: null };
|
|
40
|
+
}
|
|
41
|
+
if (
|
|
42
|
+
!isValidRuntimeGatewayReaderFence(fence) ||
|
|
43
|
+
fence.schema !== input.schema
|
|
44
|
+
) {
|
|
45
|
+
return {
|
|
46
|
+
mode: 'legacy_byte_reader',
|
|
47
|
+
source: 'fail_closed',
|
|
48
|
+
epoch: null,
|
|
49
|
+
failure: 'invalid_record',
|
|
50
|
+
};
|
|
51
|
+
}
|
|
52
|
+
return { mode: fence.mode, source: 'fence', epoch: fence.epoch };
|
|
53
|
+
},
|
|
54
|
+
|
|
55
|
+
async apply(
|
|
56
|
+
candidate: RuntimeGatewayReaderFenceCandidate,
|
|
57
|
+
): Promise<ReaderFenceApplyOutcome> {
|
|
58
|
+
validateRuntimeGatewayReaderFence(candidate);
|
|
59
|
+
return await ports.store.apply(candidate);
|
|
60
|
+
},
|
|
61
|
+
};
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
export function isValidRuntimeGatewayReaderFence(
|
|
65
|
+
fence: unknown,
|
|
66
|
+
): fence is RuntimeGatewayReaderFence {
|
|
67
|
+
try {
|
|
68
|
+
validateRuntimeGatewayReaderFence(fence as RuntimeGatewayReaderFence);
|
|
69
|
+
return true;
|
|
70
|
+
} catch {
|
|
71
|
+
return false;
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
export function validateRuntimeGatewayReaderFence(
|
|
76
|
+
fence: RuntimeGatewayReaderFenceCandidate,
|
|
77
|
+
): void {
|
|
78
|
+
validateSchema(fence.schema);
|
|
79
|
+
if (!Number.isSafeInteger(fence.epoch) || fence.epoch <= 0) {
|
|
80
|
+
throw new Error(
|
|
81
|
+
'Runtime Gateway Reader Fence requires a positive safe epoch.',
|
|
82
|
+
);
|
|
83
|
+
}
|
|
84
|
+
if (!isStorageMode(fence.mode)) {
|
|
85
|
+
throw new Error(
|
|
86
|
+
'Runtime Gateway Reader Fence has an unknown storage mode.',
|
|
87
|
+
);
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
if (fence.mode === 'legacy_byte_reader') {
|
|
91
|
+
if (fence.canonicalReaderProof !== null) {
|
|
92
|
+
throw new Error(
|
|
93
|
+
'Legacy byte-reader fences must not carry canonical reader proof.',
|
|
94
|
+
);
|
|
95
|
+
}
|
|
96
|
+
return;
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
const proof = fence.canonicalReaderProof;
|
|
100
|
+
if (!proof) {
|
|
101
|
+
throw new Error(
|
|
102
|
+
'Canonical reader fences require verified gateway reader proof.',
|
|
103
|
+
);
|
|
104
|
+
}
|
|
105
|
+
if (proof.capability !== INTEGRATION_OPERATION_CANONICAL_READER_CAPABILITY) {
|
|
106
|
+
throw new Error(
|
|
107
|
+
'Canonical reader fence has an unsupported gateway capability.',
|
|
108
|
+
);
|
|
109
|
+
}
|
|
110
|
+
if (!proof.sourceSha.trim()) {
|
|
111
|
+
throw new Error('Canonical reader fence requires a source SHA.');
|
|
112
|
+
}
|
|
113
|
+
for (const role of ['receipt', 'execution'] as const) {
|
|
114
|
+
const ids = proof.machineIds[role];
|
|
115
|
+
if (!Array.isArray(ids) || ids.length === 0) {
|
|
116
|
+
throw new Error(
|
|
117
|
+
`Canonical reader fence requires a verified ${role} gateway Machine.`,
|
|
118
|
+
);
|
|
119
|
+
}
|
|
120
|
+
if (ids.some((id) => typeof id !== 'string' || !id.trim())) {
|
|
121
|
+
throw new Error(
|
|
122
|
+
`Canonical reader fence has an invalid ${role} gateway Machine id.`,
|
|
123
|
+
);
|
|
124
|
+
}
|
|
125
|
+
if (new Set(ids).size !== ids.length) {
|
|
126
|
+
throw new Error(
|
|
127
|
+
`Canonical reader fence repeats a ${role} gateway Machine id.`,
|
|
128
|
+
);
|
|
129
|
+
}
|
|
130
|
+
}
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
function validateSchema(schema: string): void {
|
|
134
|
+
if (!schema?.trim()) {
|
|
135
|
+
throw new Error(
|
|
136
|
+
'Runtime Gateway Reader Fence requires a non-empty schema.',
|
|
137
|
+
);
|
|
138
|
+
}
|
|
139
|
+
}
|
|
140
|
+
|
|
141
|
+
function isStorageMode(
|
|
142
|
+
value: unknown,
|
|
143
|
+
): value is IntegrationOperationStorageMode {
|
|
144
|
+
return value === 'legacy_byte_reader' || value === 'canonical_v1';
|
|
145
|
+
}
|
|
@@ -0,0 +1,114 @@
|
|
|
1
|
+
import type {
|
|
2
|
+
ReaderFenceApplyOutcome,
|
|
3
|
+
RuntimeGatewayReaderFence,
|
|
4
|
+
RuntimeGatewayReaderFenceCandidate,
|
|
5
|
+
} from '../integration-operation-reader-fence/contracts';
|
|
6
|
+
import type { RuntimeGatewayReaderFenceStore } from '../integration-operation-reader-fence/ports';
|
|
7
|
+
|
|
8
|
+
/**
|
|
9
|
+
* Recording adapter for contract tests and local assembly. It implements the
|
|
10
|
+
* same atomic compare-and-advance law required of the Runtime Postgres mirror.
|
|
11
|
+
*/
|
|
12
|
+
export function createMemoryRuntimeGatewayReaderFenceStore(
|
|
13
|
+
initial: readonly RuntimeGatewayReaderFence[] = [],
|
|
14
|
+
): RuntimeGatewayReaderFenceStore {
|
|
15
|
+
const fences = new Map(
|
|
16
|
+
initial.map((fence) => [fence.schema, copyFence(fence)]),
|
|
17
|
+
);
|
|
18
|
+
|
|
19
|
+
return {
|
|
20
|
+
async read({ schema }) {
|
|
21
|
+
const fence = fences.get(schema);
|
|
22
|
+
return fence ? copyFence(fence) : null;
|
|
23
|
+
},
|
|
24
|
+
|
|
25
|
+
async apply(candidate): Promise<ReaderFenceApplyOutcome> {
|
|
26
|
+
const next = copyFence(candidate);
|
|
27
|
+
const current = fences.get(next.schema);
|
|
28
|
+
if (!current) {
|
|
29
|
+
fences.set(next.schema, next);
|
|
30
|
+
return { kind: 'advanced', fence: copyFence(next) };
|
|
31
|
+
}
|
|
32
|
+
if (next.epoch < current.epoch) {
|
|
33
|
+
return {
|
|
34
|
+
kind: 'rejected',
|
|
35
|
+
reason: 'stale_epoch',
|
|
36
|
+
current: copyFence(current),
|
|
37
|
+
};
|
|
38
|
+
}
|
|
39
|
+
if (next.epoch === current.epoch) {
|
|
40
|
+
if (sameFence(next, current)) {
|
|
41
|
+
return { kind: 'already_applied', fence: copyFence(current) };
|
|
42
|
+
}
|
|
43
|
+
return {
|
|
44
|
+
kind: 'rejected',
|
|
45
|
+
reason: 'epoch_conflict',
|
|
46
|
+
current: copyFence(current),
|
|
47
|
+
};
|
|
48
|
+
}
|
|
49
|
+
if (current.mode === 'canonical_v1' && next.mode !== 'canonical_v1') {
|
|
50
|
+
return {
|
|
51
|
+
kind: 'rejected',
|
|
52
|
+
reason: 'unsafe_mode_downgrade',
|
|
53
|
+
current: copyFence(current),
|
|
54
|
+
};
|
|
55
|
+
}
|
|
56
|
+
fences.set(next.schema, next);
|
|
57
|
+
return { kind: 'advanced', fence: copyFence(next) };
|
|
58
|
+
},
|
|
59
|
+
};
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
function sameFence(
|
|
63
|
+
left: RuntimeGatewayReaderFence,
|
|
64
|
+
right: RuntimeGatewayReaderFence,
|
|
65
|
+
): boolean {
|
|
66
|
+
if (
|
|
67
|
+
left.schema !== right.schema ||
|
|
68
|
+
left.epoch !== right.epoch ||
|
|
69
|
+
left.mode !== right.mode
|
|
70
|
+
) {
|
|
71
|
+
return false;
|
|
72
|
+
}
|
|
73
|
+
if (!left.canonicalReaderProof || !right.canonicalReaderProof) {
|
|
74
|
+
return left.canonicalReaderProof === right.canonicalReaderProof;
|
|
75
|
+
}
|
|
76
|
+
return (
|
|
77
|
+
left.canonicalReaderProof.capability ===
|
|
78
|
+
right.canonicalReaderProof.capability &&
|
|
79
|
+
left.canonicalReaderProof.sourceSha ===
|
|
80
|
+
right.canonicalReaderProof.sourceSha &&
|
|
81
|
+
sameMachineSet(
|
|
82
|
+
left.canonicalReaderProof.machineIds.receipt,
|
|
83
|
+
right.canonicalReaderProof.machineIds.receipt,
|
|
84
|
+
) &&
|
|
85
|
+
sameMachineSet(
|
|
86
|
+
left.canonicalReaderProof.machineIds.execution,
|
|
87
|
+
right.canonicalReaderProof.machineIds.execution,
|
|
88
|
+
)
|
|
89
|
+
);
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
function sameMachineSet(
|
|
93
|
+
left: readonly string[],
|
|
94
|
+
right: readonly string[],
|
|
95
|
+
): boolean {
|
|
96
|
+
return left.length === right.length && left.every((id) => right.includes(id));
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
function copyFence(
|
|
100
|
+
fence: RuntimeGatewayReaderFenceCandidate,
|
|
101
|
+
): RuntimeGatewayReaderFence {
|
|
102
|
+
return {
|
|
103
|
+
...fence,
|
|
104
|
+
canonicalReaderProof: fence.canonicalReaderProof
|
|
105
|
+
? {
|
|
106
|
+
...fence.canonicalReaderProof,
|
|
107
|
+
machineIds: {
|
|
108
|
+
receipt: [...fence.canonicalReaderProof.machineIds.receipt],
|
|
109
|
+
execution: [...fence.canonicalReaderProof.machineIds.execution],
|
|
110
|
+
},
|
|
111
|
+
}
|
|
112
|
+
: null,
|
|
113
|
+
};
|
|
114
|
+
}
|
package/dist/bundling-sources/shared_libs/play-runtime/integration-operation-reader-fence/ports.ts
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import type {
|
|
2
|
+
ReaderFenceApplyOutcome,
|
|
3
|
+
RuntimeGatewayReaderFence,
|
|
4
|
+
RuntimeGatewayReaderFenceCandidate,
|
|
5
|
+
} from '../integration-operation-reader-fence/contracts';
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* Durable, schema-keyed mirror port. `apply` must perform its comparison and
|
|
9
|
+
* update atomically: read-then-write in the job would let two operators reuse
|
|
10
|
+
* an epoch with different reader contracts.
|
|
11
|
+
*/
|
|
12
|
+
export type RuntimeGatewayReaderFenceStore = {
|
|
13
|
+
read(input: { schema: string }): Promise<RuntimeGatewayReaderFence | null>;
|
|
14
|
+
apply(
|
|
15
|
+
candidate: RuntimeGatewayReaderFenceCandidate,
|
|
16
|
+
): Promise<ReaderFenceApplyOutcome>;
|
|
17
|
+
};
|
|
18
|
+
|
|
19
|
+
export type RuntimeGatewayReaderFencePorts = {
|
|
20
|
+
store: RuntimeGatewayReaderFenceStore;
|
|
21
|
+
};
|
|
@@ -0,0 +1,170 @@
|
|
|
1
|
+
import { stringifyPostgresJson } from '../postgres-json';
|
|
2
|
+
|
|
3
|
+
import type { PostgresSchedulerQueryClient } from '../scheduler-backends/postgres';
|
|
4
|
+
|
|
5
|
+
import {
|
|
6
|
+
isValidRuntimeGatewayReaderFence,
|
|
7
|
+
validateRuntimeGatewayReaderFence,
|
|
8
|
+
} from '../integration-operation-reader-fence/job';
|
|
9
|
+
import type {
|
|
10
|
+
ReaderFenceApplyOutcome,
|
|
11
|
+
RuntimeGatewayReaderFence,
|
|
12
|
+
RuntimeGatewayReaderFenceCandidate,
|
|
13
|
+
} from '../integration-operation-reader-fence/contracts';
|
|
14
|
+
import type { RuntimeGatewayReaderFenceStore } from '../integration-operation-reader-fence/ports';
|
|
15
|
+
|
|
16
|
+
const DEFAULT_SCHEMA = 'runtime_scheduler';
|
|
17
|
+
const TABLE = 'runtime_gateway_reader_fences';
|
|
18
|
+
|
|
19
|
+
type Row = {
|
|
20
|
+
scheduler_schema: string;
|
|
21
|
+
epoch: number | string;
|
|
22
|
+
mode: unknown;
|
|
23
|
+
canonical_reader_proof: unknown;
|
|
24
|
+
};
|
|
25
|
+
|
|
26
|
+
function quoteIdent(value: string): string {
|
|
27
|
+
return `"${value.replace(/"/g, '""')}"`;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
function tableName(schema: string): string {
|
|
31
|
+
return `${quoteIdent(schema)}.${quoteIdent(TABLE)}`;
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
function parseRow(row: Row): RuntimeGatewayReaderFence {
|
|
35
|
+
const fence: RuntimeGatewayReaderFence = {
|
|
36
|
+
schema: row.scheduler_schema,
|
|
37
|
+
epoch: Number(row.epoch),
|
|
38
|
+
mode: row.mode as RuntimeGatewayReaderFence['mode'],
|
|
39
|
+
canonicalReaderProof:
|
|
40
|
+
row.canonical_reader_proof === null
|
|
41
|
+
? null
|
|
42
|
+
: (row.canonical_reader_proof as RuntimeGatewayReaderFence['canonicalReaderProof']),
|
|
43
|
+
};
|
|
44
|
+
if (!isValidRuntimeGatewayReaderFence(fence)) {
|
|
45
|
+
throw new Error('Runtime Gateway Reader Fence row is invalid.');
|
|
46
|
+
}
|
|
47
|
+
return fence;
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
function sameMachineSet(left: readonly string[], right: readonly string[]) {
|
|
51
|
+
return left.length === right.length && left.every((id) => right.includes(id));
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
function sameFence(
|
|
55
|
+
left: RuntimeGatewayReaderFence,
|
|
56
|
+
right: RuntimeGatewayReaderFence,
|
|
57
|
+
): boolean {
|
|
58
|
+
if (
|
|
59
|
+
left.schema !== right.schema ||
|
|
60
|
+
left.epoch !== right.epoch ||
|
|
61
|
+
left.mode !== right.mode
|
|
62
|
+
) {
|
|
63
|
+
return false;
|
|
64
|
+
}
|
|
65
|
+
const leftProof = left.canonicalReaderProof;
|
|
66
|
+
const rightProof = right.canonicalReaderProof;
|
|
67
|
+
if (!leftProof || !rightProof) return leftProof === rightProof;
|
|
68
|
+
return (
|
|
69
|
+
leftProof.capability === rightProof.capability &&
|
|
70
|
+
leftProof.sourceSha === rightProof.sourceSha &&
|
|
71
|
+
sameMachineSet(
|
|
72
|
+
leftProof.machineIds.receipt,
|
|
73
|
+
rightProof.machineIds.receipt,
|
|
74
|
+
) &&
|
|
75
|
+
sameMachineSet(
|
|
76
|
+
leftProof.machineIds.execution,
|
|
77
|
+
rightProof.machineIds.execution,
|
|
78
|
+
)
|
|
79
|
+
);
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
/**
|
|
83
|
+
* Runtime Postgres mirror adapter. The gateway reads this local record on its
|
|
84
|
+
* hot path; Convex remains the deployment control-plane source of truth.
|
|
85
|
+
*/
|
|
86
|
+
export function createPostgresRuntimeGatewayReaderFenceStore(input: {
|
|
87
|
+
client: PostgresSchedulerQueryClient;
|
|
88
|
+
schema?: string;
|
|
89
|
+
}): RuntimeGatewayReaderFenceStore {
|
|
90
|
+
const schema = input.schema?.trim() || DEFAULT_SCHEMA;
|
|
91
|
+
const table = tableName(schema);
|
|
92
|
+
const returning = `scheduler_schema, epoch, mode, canonical_reader_proof`;
|
|
93
|
+
const read = async ({
|
|
94
|
+
schema: schedulerSchema,
|
|
95
|
+
}: {
|
|
96
|
+
schema: string;
|
|
97
|
+
}): Promise<RuntimeGatewayReaderFence | null> => {
|
|
98
|
+
const row = (
|
|
99
|
+
await input.client.query<Row>(
|
|
100
|
+
`SELECT ${returning}
|
|
101
|
+
FROM ${table}
|
|
102
|
+
WHERE scheduler_schema = $1
|
|
103
|
+
LIMIT 1`,
|
|
104
|
+
[schedulerSchema],
|
|
105
|
+
)
|
|
106
|
+
).rows[0];
|
|
107
|
+
return row ? parseRow(row) : null;
|
|
108
|
+
};
|
|
109
|
+
|
|
110
|
+
return {
|
|
111
|
+
read,
|
|
112
|
+
|
|
113
|
+
async apply(candidate): Promise<ReaderFenceApplyOutcome> {
|
|
114
|
+
validateRuntimeGatewayReaderFence(candidate);
|
|
115
|
+
const before = await read({ schema: candidate.schema });
|
|
116
|
+
const result = await input.client.query<Row>(
|
|
117
|
+
`INSERT INTO ${table} AS fence
|
|
118
|
+
(scheduler_schema, epoch, mode, canonical_reader_proof)
|
|
119
|
+
VALUES ($1, $2, $3, $4::jsonb)
|
|
120
|
+
ON CONFLICT (scheduler_schema) DO UPDATE
|
|
121
|
+
SET epoch = EXCLUDED.epoch,
|
|
122
|
+
mode = EXCLUDED.mode,
|
|
123
|
+
canonical_reader_proof = EXCLUDED.canonical_reader_proof,
|
|
124
|
+
updated_at = now()
|
|
125
|
+
WHERE (
|
|
126
|
+
fence.epoch < EXCLUDED.epoch
|
|
127
|
+
AND NOT (
|
|
128
|
+
fence.mode = 'canonical_v1'
|
|
129
|
+
AND EXCLUDED.mode <> 'canonical_v1'
|
|
130
|
+
)
|
|
131
|
+
) OR (
|
|
132
|
+
fence.epoch = EXCLUDED.epoch
|
|
133
|
+
AND fence.mode = EXCLUDED.mode
|
|
134
|
+
AND fence.canonical_reader_proof IS NOT DISTINCT FROM EXCLUDED.canonical_reader_proof
|
|
135
|
+
)
|
|
136
|
+
RETURNING ${returning}`,
|
|
137
|
+
[
|
|
138
|
+
candidate.schema,
|
|
139
|
+
candidate.epoch,
|
|
140
|
+
candidate.mode,
|
|
141
|
+
candidate.canonicalReaderProof
|
|
142
|
+
? stringifyPostgresJson(candidate.canonicalReaderProof)
|
|
143
|
+
: null,
|
|
144
|
+
],
|
|
145
|
+
);
|
|
146
|
+
const applied = result.rows[0];
|
|
147
|
+
if (applied) {
|
|
148
|
+
const fence = parseRow(applied);
|
|
149
|
+
return before && sameFence(before, candidate)
|
|
150
|
+
? { kind: 'already_applied', fence }
|
|
151
|
+
: { kind: 'advanced', fence };
|
|
152
|
+
}
|
|
153
|
+
|
|
154
|
+
const current = await read({ schema: candidate.schema });
|
|
155
|
+
if (!current) {
|
|
156
|
+
throw new Error('Runtime Gateway Reader Fence apply lost its row.');
|
|
157
|
+
}
|
|
158
|
+
if (candidate.epoch < current.epoch) {
|
|
159
|
+
return { kind: 'rejected', reason: 'stale_epoch', current };
|
|
160
|
+
}
|
|
161
|
+
if (
|
|
162
|
+
current.mode === 'canonical_v1' &&
|
|
163
|
+
candidate.mode !== 'canonical_v1'
|
|
164
|
+
) {
|
|
165
|
+
return { kind: 'rejected', reason: 'unsafe_mode_downgrade', current };
|
|
166
|
+
}
|
|
167
|
+
return { kind: 'rejected', reason: 'epoch_conflict', current };
|
|
168
|
+
},
|
|
169
|
+
};
|
|
170
|
+
}
|