@rikalabs/akter 0.1.0-alpha.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 +15 -0
- package/LICENSE +202 -0
- package/NOTICE +8 -0
- package/README.md +116 -0
- package/dist/actor/codecs.d.ts +77 -0
- package/dist/actor/codecs.js +87 -0
- package/dist/actor/connections.d.ts +34 -0
- package/dist/actor/connections.js +145 -0
- package/dist/actor/definition.d.ts +893 -0
- package/dist/actor/definition.js +147 -0
- package/dist/actor/descriptor.d.ts +172 -0
- package/dist/actor/descriptor.js +367 -0
- package/dist/actor/handles.d.ts +77 -0
- package/dist/actor/handles.js +265 -0
- package/dist/actor/jobs.d.ts +10 -0
- package/dist/actor/jobs.js +137 -0
- package/dist/actor/layers.d.ts +41 -0
- package/dist/actor/layers.js +177 -0
- package/dist/actor/reads.d.ts +47 -0
- package/dist/actor/reads.js +224 -0
- package/dist/actor/served.d.ts +120 -0
- package/dist/actor/served.js +72 -0
- package/dist/actor/turns.d.ts +13 -0
- package/dist/actor/turns.js +332 -0
- package/dist/actor/workflows.d.ts +16 -0
- package/dist/actor/workflows.js +37 -0
- package/dist/client/calls.d.ts +47 -0
- package/dist/client/calls.js +425 -0
- package/dist/client/clock.d.ts +56 -0
- package/dist/client/clock.js +119 -0
- package/dist/client/fleet-page.d.ts +15 -0
- package/dist/client/fleet-page.js +13 -0
- package/dist/client/fleet.d.ts +29 -0
- package/dist/client/fleet.js +51 -0
- package/dist/client/index.d.ts +17 -0
- package/dist/client/index.js +6 -0
- package/dist/client/make.d.ts +157 -0
- package/dist/client/make.js +221 -0
- package/dist/client/offline/queue.d.ts +118 -0
- package/dist/client/offline/queue.js +292 -0
- package/dist/client/offline/store.d.ts +74 -0
- package/dist/client/offline/store.js +78 -0
- package/dist/client/optimistic.d.ts +57 -0
- package/dist/client/optimistic.js +136 -0
- package/dist/client/report.d.ts +2 -0
- package/dist/client/report.js +8 -0
- package/dist/client/sessions/connection.d.ts +118 -0
- package/dist/client/sessions/connection.js +162 -0
- package/dist/client/sessions/feed.d.ts +42 -0
- package/dist/client/sessions/feed.js +43 -0
- package/dist/client/sessions/sse.d.ts +47 -0
- package/dist/client/sessions/sse.js +112 -0
- package/dist/client/sessions/stream.d.ts +28 -0
- package/dist/client/sessions/stream.js +35 -0
- package/dist/client/sessions/watch.d.ts +34 -0
- package/dist/client/sessions/watch.js +40 -0
- package/dist/client/transport.d.ts +37 -0
- package/dist/client/transport.js +66 -0
- package/dist/contexts/command.d.ts +132 -0
- package/dist/contexts/command.js +20 -0
- package/dist/contexts/connection.d.ts +68 -0
- package/dist/contexts/connection.js +0 -0
- package/dist/contexts/job.d.ts +49 -0
- package/dist/contexts/job.js +0 -0
- package/dist/contexts/workflow.d.ts +147 -0
- package/dist/contexts/workflow.js +22 -0
- package/dist/errors/actor.d.ts +200 -0
- package/dist/errors/actor.js +271 -0
- package/dist/errors/content.d.ts +19 -0
- package/dist/errors/content.js +14 -0
- package/dist/errors/database.d.ts +22 -0
- package/dist/errors/database.js +23 -0
- package/dist/errors/events.d.ts +17 -0
- package/dist/errors/events.js +14 -0
- package/dist/errors/subscription.d.ts +12 -0
- package/dist/errors/subscription.js +8 -0
- package/dist/errors/workflow.d.ts +28 -0
- package/dist/errors/workflow.js +17 -0
- package/dist/handles/actors.d.ts +17 -0
- package/dist/handles/actors.js +7 -0
- package/dist/handles/content.d.ts +59 -0
- package/dist/handles/content.js +36 -0
- package/dist/handles/intents.d.ts +164 -0
- package/dist/handles/intents.js +214 -0
- package/dist/handles/run.d.ts +31 -0
- package/dist/handles/run.js +21 -0
- package/dist/handles/workflow.d.ts +27 -0
- package/dist/handles/workflow.js +23 -0
- package/dist/identity/caller.d.ts +105 -0
- package/dist/identity/caller.js +68 -0
- package/dist/identity/child.d.ts +18 -0
- package/dist/identity/child.js +39 -0
- package/dist/identity/command.d.ts +19 -0
- package/dist/identity/command.js +21 -0
- package/dist/identity/connection.d.ts +24 -0
- package/dist/identity/connection.js +29 -0
- package/dist/identity/content.d.ts +18 -0
- package/dist/identity/content.js +12 -0
- package/dist/identity/digest.d.ts +4 -0
- package/dist/identity/digest.js +5 -0
- package/dist/identity/execution.d.ts +32 -0
- package/dist/identity/execution.js +63 -0
- package/dist/identity/mint.d.ts +51 -0
- package/dist/identity/mint.js +76 -0
- package/dist/identity/version.d.ts +2 -0
- package/dist/identity/version.js +3 -0
- package/dist/index.d.ts +159 -0
- package/dist/index.js +97 -0
- package/dist/members/blob.d.ts +43 -0
- package/dist/members/blob.js +29 -0
- package/dist/members/command.d.ts +109 -0
- package/dist/members/command.js +61 -0
- package/dist/members/connection.d.ts +55 -0
- package/dist/members/connection.js +49 -0
- package/dist/members/event.d.ts +36 -0
- package/dist/members/event.js +24 -0
- package/dist/members/job.d.ts +157 -0
- package/dist/members/job.js +67 -0
- package/dist/members/payload.d.ts +93 -0
- package/dist/members/payload.js +145 -0
- package/dist/members/reducer.d.ts +64 -0
- package/dist/members/reducer.js +27 -0
- package/dist/members/stream.d.ts +36 -0
- package/dist/members/stream.js +14 -0
- package/dist/members/subscription.d.ts +182 -0
- package/dist/members/subscription.js +91 -0
- package/dist/members/workflow.d.ts +99 -0
- package/dist/members/workflow.js +2 -0
- package/dist/policies/access.d.ts +35 -0
- package/dist/policies/access.js +6 -0
- package/dist/policies/command.d.ts +127 -0
- package/dist/policies/command.js +45 -0
- package/dist/policies/job.d.ts +28 -0
- package/dist/policies/job.js +60 -0
- package/dist/policies/schedules.d.ts +33 -0
- package/dist/policies/schedules.js +131 -0
- package/dist/protocol/frames.d.ts +66 -0
- package/dist/protocol/frames.js +55 -0
- package/dist/protocol/inspection.d.ts +807 -0
- package/dist/protocol/inspection.js +243 -0
- package/dist/protocol/wire.d.ts +184 -0
- package/dist/protocol/wire.js +150 -0
- package/dist/runtime/actors.d.ts +155 -0
- package/dist/runtime/actors.js +4 -0
- package/dist/runtime/admission.d.ts +34 -0
- package/dist/runtime/admission.js +72 -0
- package/dist/runtime/adoption/backfill.d.ts +27 -0
- package/dist/runtime/adoption/backfill.js +144 -0
- package/dist/runtime/adoption/enforce.d.ts +55 -0
- package/dist/runtime/adoption/enforce.js +241 -0
- package/dist/runtime/adoption/observe.d.ts +43 -0
- package/dist/runtime/adoption/observe.js +139 -0
- package/dist/runtime/adoption/plan.d.ts +45 -0
- package/dist/runtime/adoption/plan.js +192 -0
- package/dist/runtime/adoption/startup.d.ts +32 -0
- package/dist/runtime/adoption/startup.js +76 -0
- package/dist/runtime/adoption/status.d.ts +23 -0
- package/dist/runtime/adoption/status.js +47 -0
- package/dist/runtime/adoption/target.d.ts +33 -0
- package/dist/runtime/adoption/target.js +49 -0
- package/dist/runtime/connections/holder.d.ts +221 -0
- package/dist/runtime/connections/holder.js +816 -0
- package/dist/runtime/connections/owner.d.ts +263 -0
- package/dist/runtime/connections/owner.js +896 -0
- package/dist/runtime/connections/protocol.d.ts +441 -0
- package/dist/runtime/connections/protocol.js +222 -0
- package/dist/runtime/connections/reads.d.ts +24 -0
- package/dist/runtime/connections/reads.js +19 -0
- package/dist/runtime/connections/streams.d.ts +62 -0
- package/dist/runtime/connections/streams.js +128 -0
- package/dist/runtime/connections/transport.d.ts +40 -0
- package/dist/runtime/connections/transport.js +68 -0
- package/dist/runtime/connections/watch.d.ts +52 -0
- package/dist/runtime/connections/watch.js +159 -0
- package/dist/runtime/content/grant.d.ts +34 -0
- package/dist/runtime/content/grant.js +58 -0
- package/dist/runtime/content/store.d.ts +63 -0
- package/dist/runtime/content/store.js +294 -0
- package/dist/runtime/cron/key.d.ts +2 -0
- package/dist/runtime/cron/key.js +2 -0
- package/dist/runtime/cron/schedule.d.ts +69 -0
- package/dist/runtime/cron/schedule.js +144 -0
- package/dist/runtime/database/bounded.d.ts +43 -0
- package/dist/runtime/database/bounded.js +108 -0
- package/dist/runtime/database/connection.d.ts +8 -0
- package/dist/runtime/database/connection.js +18 -0
- package/dist/runtime/database/coordination.d.ts +19 -0
- package/dist/runtime/database/coordination.js +72 -0
- package/dist/runtime/database/flock.d.ts +10 -0
- package/dist/runtime/database/flock.js +60 -0
- package/dist/runtime/database/gate.d.ts +26 -0
- package/dist/runtime/database/gate.js +54 -0
- package/dist/runtime/database/keepalive.d.ts +11 -0
- package/dist/runtime/database/keepalive.js +22 -0
- package/dist/runtime/database/migrations.d.ts +177 -0
- package/dist/runtime/database/migrations.js +1018 -0
- package/dist/runtime/database/neki/migrations.d.ts +31 -0
- package/dist/runtime/database/neki/migrations.js +276 -0
- package/dist/runtime/database/neki/session.d.ts +23 -0
- package/dist/runtime/database/neki/session.js +31 -0
- package/dist/runtime/database/pglite.d.ts +21 -0
- package/dist/runtime/database/pglite.js +74 -0
- package/dist/runtime/database/replica.d.ts +41 -0
- package/dist/runtime/database/replica.js +51 -0
- package/dist/runtime/database/shards.d.ts +21 -0
- package/dist/runtime/database/shards.js +37 -0
- package/dist/runtime/database/snapshot.d.ts +7 -0
- package/dist/runtime/database/snapshot.js +7 -0
- package/dist/runtime/database/tenancy.d.ts +69 -0
- package/dist/runtime/database/tenancy.js +145 -0
- package/dist/runtime/database/transient.d.ts +10 -0
- package/dist/runtime/database/transient.js +25 -0
- package/dist/runtime/drain.d.ts +132 -0
- package/dist/runtime/drain.js +109 -0
- package/dist/runtime/entity/mailbox.d.ts +86 -0
- package/dist/runtime/entity/mailbox.js +121 -0
- package/dist/runtime/entity/register.d.ts +424 -0
- package/dist/runtime/entity/register.js +669 -0
- package/dist/runtime/events/append.d.ts +192 -0
- package/dist/runtime/events/append.js +128 -0
- package/dist/runtime/events/cursor.d.ts +2 -0
- package/dist/runtime/events/cursor.js +5 -0
- package/dist/runtime/events/replay.d.ts +20 -0
- package/dist/runtime/events/replay.js +45 -0
- package/dist/runtime/feeds.d.ts +26 -0
- package/dist/runtime/feeds.js +100 -0
- package/dist/runtime/fleet/checks.d.ts +17 -0
- package/dist/runtime/fleet/checks.js +106 -0
- package/dist/runtime/fleet/maintainer.d.ts +38 -0
- package/dist/runtime/fleet/maintainer.js +383 -0
- package/dist/runtime/fleet/pgoutput.d.ts +41 -0
- package/dist/runtime/fleet/pgoutput.js +102 -0
- package/dist/runtime/fleet/setup.d.ts +36 -0
- package/dist/runtime/fleet/setup.js +58 -0
- package/dist/runtime/fleet/subscribe.d.ts +42 -0
- package/dist/runtime/fleet/subscribe.js +147 -0
- package/dist/runtime/index.d.ts +66 -0
- package/dist/runtime/index.js +37 -0
- package/dist/runtime/inspector/http.d.ts +19 -0
- package/dist/runtime/inspector/http.js +36 -0
- package/dist/runtime/inspector/layer.d.ts +46 -0
- package/dist/runtime/inspector/layer.js +180 -0
- package/dist/runtime/inspector/queries.d.ts +711 -0
- package/dist/runtime/inspector/queries.js +494 -0
- package/dist/runtime/jobs/attempt.d.ts +254 -0
- package/dist/runtime/jobs/attempt.js +413 -0
- package/dist/runtime/jobs/isolation.d.ts +20 -0
- package/dist/runtime/jobs/isolation.js +10 -0
- package/dist/runtime/jobs/progress.d.ts +95 -0
- package/dist/runtime/jobs/progress.js +144 -0
- package/dist/runtime/layer.d.ts +260 -0
- package/dist/runtime/layer.js +876 -0
- package/dist/runtime/members.d.ts +381 -0
- package/dist/runtime/members.js +8 -0
- package/dist/runtime/operators/audit.d.ts +64 -0
- package/dist/runtime/operators/audit.js +56 -0
- package/dist/runtime/operators/auth.d.ts +29 -0
- package/dist/runtime/operators/auth.js +42 -0
- package/dist/runtime/operators/export.d.ts +68 -0
- package/dist/runtime/operators/export.js +137 -0
- package/dist/runtime/operators/grants.d.ts +45 -0
- package/dist/runtime/operators/grants.js +40 -0
- package/dist/runtime/operators/repair.d.ts +206 -0
- package/dist/runtime/operators/repair.js +226 -0
- package/dist/runtime/operators/routes.d.ts +35 -0
- package/dist/runtime/operators/routes.js +190 -0
- package/dist/runtime/operators/seed.d.ts +123 -0
- package/dist/runtime/operators/seed.js +123 -0
- package/dist/runtime/payloads/versions.d.ts +65 -0
- package/dist/runtime/payloads/versions.js +240 -0
- package/dist/runtime/peering/authority.d.ts +42 -0
- package/dist/runtime/peering/authority.js +132 -0
- package/dist/runtime/peering/credentials.d.ts +21 -0
- package/dist/runtime/peering/credentials.js +13 -0
- package/dist/runtime/peering/transport.d.ts +51 -0
- package/dist/runtime/peering/transport.js +175 -0
- package/dist/runtime/queries.d.ts +18 -0
- package/dist/runtime/queries.js +169 -0
- package/dist/runtime/readiness.d.ts +36 -0
- package/dist/runtime/readiness.js +44 -0
- package/dist/runtime/registration.d.ts +58 -0
- package/dist/runtime/registration.js +186 -0
- package/dist/runtime/request.d.ts +158 -0
- package/dist/runtime/request.js +102 -0
- package/dist/runtime/retry.d.ts +8 -0
- package/dist/runtime/retry.js +11 -0
- package/dist/runtime/runner.d.ts +93 -0
- package/dist/runtime/runner.js +122 -0
- package/dist/runtime/storage/codec.d.ts +39 -0
- package/dist/runtime/storage/codec.js +41 -0
- package/dist/runtime/storage/generation.d.ts +69 -0
- package/dist/runtime/storage/generation.js +49 -0
- package/dist/runtime/storage/placements.d.ts +15 -0
- package/dist/runtime/storage/placements.js +38 -0
- package/dist/runtime/storage/platform.d.ts +6 -0
- package/dist/runtime/storage/platform.js +9 -0
- package/dist/runtime/storage/retention.d.ts +73 -0
- package/dist/runtime/storage/retention.js +158 -0
- package/dist/runtime/subscriptions/identity.d.ts +31 -0
- package/dist/runtime/subscriptions/identity.js +45 -0
- package/dist/runtime/subscriptions/relay.d.ts +175 -0
- package/dist/runtime/subscriptions/relay.js +763 -0
- package/dist/runtime/subscriptions/storage.d.ts +40 -0
- package/dist/runtime/subscriptions/storage.js +98 -0
- package/dist/runtime/sweeps.d.ts +39 -0
- package/dist/runtime/sweeps.js +54 -0
- package/dist/runtime/telemetry/defects.d.ts +57 -0
- package/dist/runtime/telemetry/defects.js +43 -0
- package/dist/runtime/telemetry/metrics.d.ts +52 -0
- package/dist/runtime/telemetry/metrics.js +138 -0
- package/dist/runtime/telemetry/routes.d.ts +19 -0
- package/dist/runtime/telemetry/routes.js +18 -0
- package/dist/runtime/telemetry/sampler.d.ts +26 -0
- package/dist/runtime/telemetry/sampler.js +101 -0
- package/dist/runtime/telemetry/spans.d.ts +38 -0
- package/dist/runtime/telemetry/spans.js +44 -0
- package/dist/runtime/telemetry/usage.d.ts +52 -0
- package/dist/runtime/telemetry/usage.js +30 -0
- package/dist/runtime/topology/admission.d.ts +13 -0
- package/dist/runtime/topology/admission.js +36 -0
- package/dist/runtime/topology/locks.d.ts +56 -0
- package/dist/runtime/topology/locks.js +81 -0
- package/dist/runtime/topology/messages.d.ts +15 -0
- package/dist/runtime/topology/messages.js +32 -0
- package/dist/runtime/turn/admission.d.ts +22 -0
- package/dist/runtime/turn/admission.js +41 -0
- package/dist/runtime/turn/blobs.d.ts +38 -0
- package/dist/runtime/turn/blobs.js +215 -0
- package/dist/runtime/turn/execute.d.ts +208 -0
- package/dist/runtime/turn/execute.js +972 -0
- package/dist/runtime/turn/group.d.ts +165 -0
- package/dist/runtime/turn/group.js +326 -0
- package/dist/runtime/turn/hooks.d.ts +44 -0
- package/dist/runtime/turn/hooks.js +28 -0
- package/dist/runtime/turn/outbox.d.ts +159 -0
- package/dist/runtime/turn/outbox.js +269 -0
- package/dist/runtime/turn/pipeline.d.ts +68 -0
- package/dist/runtime/turn/pipeline.js +83 -0
- package/dist/runtime/turn/receipt.d.ts +81 -0
- package/dist/runtime/turn/receipt.js +32 -0
- package/dist/runtime/turn/relay.d.ts +179 -0
- package/dist/runtime/turn/relay.js +685 -0
- package/dist/runtime/turn/rows.d.ts +43 -0
- package/dist/runtime/turn/rows.js +592 -0
- package/dist/runtime/workflows/compatibility.d.ts +125 -0
- package/dist/runtime/workflows/compatibility.js +285 -0
- package/dist/runtime/workflows/engine.d.ts +107 -0
- package/dist/runtime/workflows/engine.js +826 -0
- package/dist/runtime/workflows/manifest.d.ts +34 -0
- package/dist/runtime/workflows/manifest.js +39 -0
- package/dist/runtime/workflows/steps.d.ts +33 -0
- package/dist/runtime/workflows/steps.js +152 -0
- package/dist/serve/api.d.ts +99 -0
- package/dist/serve/api.js +403 -0
- package/dist/serve/assertion/binding.d.ts +41 -0
- package/dist/serve/assertion/binding.js +92 -0
- package/dist/serve/assertion/verify.d.ts +93 -0
- package/dist/serve/assertion/verify.js +189 -0
- package/dist/serve/auth.d.ts +200 -0
- package/dist/serve/auth.js +92 -0
- package/dist/serve/clock.d.ts +10 -0
- package/dist/serve/clock.js +25 -0
- package/dist/serve/jwt.d.ts +65 -0
- package/dist/serve/jwt.js +202 -0
- package/dist/serve/layer.d.ts +98 -0
- package/dist/serve/layer.js +809 -0
- package/dist/serve/mcp/endpoint.d.ts +39 -0
- package/dist/serve/mcp/endpoint.js +187 -0
- package/dist/serve/mcp/tools.d.ts +37 -0
- package/dist/serve/mcp/tools.js +125 -0
- package/dist/serve/origin.d.ts +6 -0
- package/dist/serve/origin.js +21 -0
- package/dist/serve/sessions/feed.d.ts +79 -0
- package/dist/serve/sessions/feed.js +115 -0
- package/dist/serve/sessions/socket.d.ts +56 -0
- package/dist/serve/sessions/socket.js +212 -0
- package/dist/serve/sessions/sse.d.ts +27 -0
- package/dist/serve/sessions/sse.js +26 -0
- package/dist/serve/sessions/stream.d.ts +9 -0
- package/dist/serve/sessions/stream.js +9 -0
- package/dist/serve/sessions/watch.d.ts +12 -0
- package/dist/serve/sessions/watch.js +11 -0
- package/dist/serve/wire.d.ts +16 -0
- package/dist/serve/wire.js +50 -0
- package/dist/state/blob.d.ts +71 -0
- package/dist/state/blob.js +0 -0
- package/dist/state/migration.d.ts +53 -0
- package/dist/state/migration.js +29 -0
- package/dist/tables/fleet.d.ts +170 -0
- package/dist/tables/fleet.js +214 -0
- package/dist/tables/owned.d.ts +250 -0
- package/dist/tables/owned.js +233 -0
- package/dist/testing/actor-test.d.ts +360 -0
- package/dist/testing/actor-test.js +337 -0
- package/dist/testing/cluster.d.ts +93 -0
- package/dist/testing/cluster.js +296 -0
- package/dist/testing/conformance/access.d.ts +5 -0
- package/dist/testing/conformance/access.js +531 -0
- package/dist/testing/conformance/admission.d.ts +11 -0
- package/dist/testing/conformance/admission.js +182 -0
- package/dist/testing/conformance/adoption.d.ts +2 -0
- package/dist/testing/conformance/adoption.js +1019 -0
- package/dist/testing/conformance/assertions.d.ts +202 -0
- package/dist/testing/conformance/assertions.js +849 -0
- package/dist/testing/conformance/batches.d.ts +41 -0
- package/dist/testing/conformance/batches.js +388 -0
- package/dist/testing/conformance/blobs.d.ts +14 -0
- package/dist/testing/conformance/blobs.js +405 -0
- package/dist/testing/conformance/capacity.d.ts +8 -0
- package/dist/testing/conformance/capacity.js +433 -0
- package/dist/testing/conformance/client.d.ts +5 -0
- package/dist/testing/conformance/client.js +719 -0
- package/dist/testing/conformance/cold-serve.d.ts +16 -0
- package/dist/testing/conformance/cold-serve.js +254 -0
- package/dist/testing/conformance/connections/actors.d.ts +1143 -0
- package/dist/testing/conformance/connections/actors.js +180 -0
- package/dist/testing/conformance/connections/harness.d.ts +1754 -0
- package/dist/testing/conformance/connections/harness.js +142 -0
- package/dist/testing/conformance/connections/holders.d.ts +4 -0
- package/dist/testing/conformance/connections/holders.js +165 -0
- package/dist/testing/conformance/connections/lifecycle.d.ts +4 -0
- package/dist/testing/conformance/connections/lifecycle.js +113 -0
- package/dist/testing/conformance/connections/limits.d.ts +4 -0
- package/dist/testing/conformance/connections/limits.js +127 -0
- package/dist/testing/conformance/connections/reauthorization.d.ts +4 -0
- package/dist/testing/conformance/connections/reauthorization.js +170 -0
- package/dist/testing/conformance/connections/resync.d.ts +4 -0
- package/dist/testing/conformance/connections/resync.js +360 -0
- package/dist/testing/conformance/connections/takeover.d.ts +4 -0
- package/dist/testing/conformance/connections/takeover.js +287 -0
- package/dist/testing/conformance/connections.d.ts +4 -0
- package/dist/testing/conformance/connections.js +15 -0
- package/dist/testing/conformance/content-blobs.d.ts +16 -0
- package/dist/testing/conformance/content-blobs.js +534 -0
- package/dist/testing/conformance/counter.d.ts +16 -0
- package/dist/testing/conformance/counter.js +813 -0
- package/dist/testing/conformance/cron.d.ts +5 -0
- package/dist/testing/conformance/cron.js +665 -0
- package/dist/testing/conformance/drain.d.ts +26 -0
- package/dist/testing/conformance/drain.js +540 -0
- package/dist/testing/conformance/effect-control.d.ts +38 -0
- package/dist/testing/conformance/effect-control.js +1059 -0
- package/dist/testing/conformance/effects.d.ts +23 -0
- package/dist/testing/conformance/effects.js +432 -0
- package/dist/testing/conformance/events.d.ts +28 -0
- package/dist/testing/conformance/events.js +335 -0
- package/dist/testing/conformance/export.d.ts +2 -0
- package/dist/testing/conformance/export.js +368 -0
- package/dist/testing/conformance/fleet.d.ts +444 -0
- package/dist/testing/conformance/fleet.js +1009 -0
- package/dist/testing/conformance/groups.d.ts +7 -0
- package/dist/testing/conformance/groups.js +353 -0
- package/dist/testing/conformance/heap.d.ts +3 -0
- package/dist/testing/conformance/heap.js +149 -0
- package/dist/testing/conformance/http.d.ts +2809 -0
- package/dist/testing/conformance/http.js +1234 -0
- package/dist/testing/conformance/inspection-views.d.ts +8 -0
- package/dist/testing/conformance/inspection-views.js +272 -0
- package/dist/testing/conformance/inspector.d.ts +7 -0
- package/dist/testing/conformance/inspector.js +650 -0
- package/dist/testing/conformance/mint.d.ts +58 -0
- package/dist/testing/conformance/mint.js +692 -0
- package/dist/testing/conformance/multi-runner.d.ts +8 -0
- package/dist/testing/conformance/multi-runner.js +403 -0
- package/dist/testing/conformance/neki/plan.d.ts +19 -0
- package/dist/testing/conformance/neki/plan.js +30 -0
- package/dist/testing/conformance/observability.d.ts +3 -0
- package/dist/testing/conformance/observability.js +343 -0
- package/dist/testing/conformance/offline.d.ts +4 -0
- package/dist/testing/conformance/offline.js +474 -0
- package/dist/testing/conformance/operator-harness.d.ts +57 -0
- package/dist/testing/conformance/operator-harness.js +78 -0
- package/dist/testing/conformance/operator.d.ts +3 -0
- package/dist/testing/conformance/operator.js +379 -0
- package/dist/testing/conformance/outbox-cross-shard.d.ts +14 -0
- package/dist/testing/conformance/outbox-cross-shard.js +160 -0
- package/dist/testing/conformance/outbox.d.ts +36 -0
- package/dist/testing/conformance/outbox.js +437 -0
- package/dist/testing/conformance/payload-migrations.d.ts +3 -0
- package/dist/testing/conformance/payload-migrations.js +612 -0
- package/dist/testing/conformance/pipeline.d.ts +3 -0
- package/dist/testing/conformance/pipeline.js +1040 -0
- package/dist/testing/conformance/placement.d.ts +22 -0
- package/dist/testing/conformance/placement.js +539 -0
- package/dist/testing/conformance/platform.d.ts +40 -0
- package/dist/testing/conformance/platform.js +101 -0
- package/dist/testing/conformance/progress.d.ts +39 -0
- package/dist/testing/conformance/progress.js +666 -0
- package/dist/testing/conformance/properties.d.ts +6 -0
- package/dist/testing/conformance/properties.js +295 -0
- package/dist/testing/conformance/protocols.d.ts +4 -0
- package/dist/testing/conformance/protocols.js +618 -0
- package/dist/testing/conformance/provider/advertise.d.ts +21 -0
- package/dist/testing/conformance/provider/advertise.js +44 -0
- package/dist/testing/conformance/read-your-writes.d.ts +20 -0
- package/dist/testing/conformance/read-your-writes.js +192 -0
- package/dist/testing/conformance/reducers.d.ts +8 -0
- package/dist/testing/conformance/reducers.js +258 -0
- package/dist/testing/conformance/relay.d.ts +42 -0
- package/dist/testing/conformance/relay.js +1115 -0
- package/dist/testing/conformance/restore.d.ts +43 -0
- package/dist/testing/conformance/restore.js +341 -0
- package/dist/testing/conformance/retention.d.ts +14 -0
- package/dist/testing/conformance/retention.js +463 -0
- package/dist/testing/conformance/rls.d.ts +24 -0
- package/dist/testing/conformance/rls.js +576 -0
- package/dist/testing/conformance/simulation.d.ts +31 -0
- package/dist/testing/conformance/simulation.js +167 -0
- package/dist/testing/conformance/single-shard.d.ts +2 -0
- package/dist/testing/conformance/single-shard.js +125 -0
- package/dist/testing/conformance/singleton.d.ts +3 -0
- package/dist/testing/conformance/singleton.js +293 -0
- package/dist/testing/conformance/statements.d.ts +60 -0
- package/dist/testing/conformance/statements.js +108 -0
- package/dist/testing/conformance/streams.d.ts +7 -0
- package/dist/testing/conformance/streams.js +280 -0
- package/dist/testing/conformance/subscriptions/access.d.ts +4 -0
- package/dist/testing/conformance/subscriptions/access.js +98 -0
- package/dist/testing/conformance/subscriptions/actors.d.ts +4910 -0
- package/dist/testing/conformance/subscriptions/actors.js +372 -0
- package/dist/testing/conformance/subscriptions/cluster.d.ts +4 -0
- package/dist/testing/conformance/subscriptions/cluster.js +89 -0
- package/dist/testing/conformance/subscriptions/delivery.d.ts +4 -0
- package/dist/testing/conformance/subscriptions/delivery.js +253 -0
- package/dist/testing/conformance/subscriptions/deploys.d.ts +4 -0
- package/dist/testing/conformance/subscriptions/deploys.js +162 -0
- package/dist/testing/conformance/subscriptions/epochs.d.ts +4 -0
- package/dist/testing/conformance/subscriptions/epochs.js +169 -0
- package/dist/testing/conformance/subscriptions/failures.d.ts +4 -0
- package/dist/testing/conformance/subscriptions/failures.js +108 -0
- package/dist/testing/conformance/subscriptions/feeds.d.ts +4 -0
- package/dist/testing/conformance/subscriptions/feeds.js +218 -0
- package/dist/testing/conformance/subscriptions/harness.d.ts +124 -0
- package/dist/testing/conformance/subscriptions/harness.js +143 -0
- package/dist/testing/conformance/subscriptions/operator.d.ts +4 -0
- package/dist/testing/conformance/subscriptions/operator.js +128 -0
- package/dist/testing/conformance/subscriptions/retention.d.ts +4 -0
- package/dist/testing/conformance/subscriptions/retention.js +288 -0
- package/dist/testing/conformance/subscriptions/routing.d.ts +4 -0
- package/dist/testing/conformance/subscriptions/routing.js +179 -0
- package/dist/testing/conformance/subscriptions.d.ts +4 -0
- package/dist/testing/conformance/subscriptions.js +19 -0
- package/dist/testing/conformance/tables.d.ts +125 -0
- package/dist/testing/conformance/tables.js +664 -0
- package/dist/testing/conformance/transports/actors.d.ts +1907 -0
- package/dist/testing/conformance/transports/actors.js +163 -0
- package/dist/testing/conformance/transports/client.d.ts +3 -0
- package/dist/testing/conformance/transports/client.js +237 -0
- package/dist/testing/conformance/transports/feeds.d.ts +3 -0
- package/dist/testing/conformance/transports/feeds.js +232 -0
- package/dist/testing/conformance/transports/harness.d.ts +93 -0
- package/dist/testing/conformance/transports/harness.js +84 -0
- package/dist/testing/conformance/transports/streams.d.ts +3 -0
- package/dist/testing/conformance/transports/streams.js +96 -0
- package/dist/testing/conformance/transports/websocket.d.ts +3 -0
- package/dist/testing/conformance/transports/websocket.js +384 -0
- package/dist/testing/conformance/transports/wire.d.ts +141 -0
- package/dist/testing/conformance/transports/wire.js +204 -0
- package/dist/testing/conformance/transports.d.ts +3 -0
- package/dist/testing/conformance/transports.js +11 -0
- package/dist/testing/conformance/watch.d.ts +59 -0
- package/dist/testing/conformance/watch.js +879 -0
- package/dist/testing/conformance/workflow-engine.d.ts +97 -0
- package/dist/testing/conformance/workflow-engine.js +253 -0
- package/dist/testing/conformance/workflow-versions.d.ts +3 -0
- package/dist/testing/conformance/workflow-versions.js +545 -0
- package/dist/testing/conformance/workflows/access.d.ts +4 -0
- package/dist/testing/conformance/workflows/access.js +147 -0
- package/dist/testing/conformance/workflows/actors.d.ts +2317 -0
- package/dist/testing/conformance/workflows/actors.js +305 -0
- package/dist/testing/conformance/workflows/basics.d.ts +4 -0
- package/dist/testing/conformance/workflows/basics.js +144 -0
- package/dist/testing/conformance/workflows/engine.d.ts +4 -0
- package/dist/testing/conformance/workflows/engine.js +80 -0
- package/dist/testing/conformance/workflows/guards.d.ts +4 -0
- package/dist/testing/conformance/workflows/guards.js +172 -0
- package/dist/testing/conformance/workflows/harness.d.ts +14 -0
- package/dist/testing/conformance/workflows/harness.js +44 -0
- package/dist/testing/conformance/workflows/recovery.d.ts +4 -0
- package/dist/testing/conformance/workflows/recovery.js +181 -0
- package/dist/testing/conformance/workflows/starts.d.ts +4 -0
- package/dist/testing/conformance/workflows/starts.js +57 -0
- package/dist/testing/conformance/workflows/suspension.d.ts +4 -0
- package/dist/testing/conformance/workflows/suspension.js +106 -0
- package/dist/testing/conformance/workflows/waits.d.ts +4 -0
- package/dist/testing/conformance/workflows/waits.js +284 -0
- package/dist/testing/conformance/workflows.d.ts +4 -0
- package/dist/testing/conformance/workflows.js +19 -0
- package/dist/testing/conformance.d.ts +330 -0
- package/dist/testing/conformance.js +364 -0
- package/dist/testing/database.d.ts +31 -0
- package/dist/testing/database.js +70 -0
- package/dist/testing/foundation.d.ts +41 -0
- package/dist/testing/foundation.js +517 -0
- package/dist/testing/index.d.ts +20 -0
- package/dist/testing/index.js +12 -0
- package/dist/testing/property.d.ts +40 -0
- package/dist/testing/property.js +95 -0
- package/dist/testing/simulate-cluster.d.ts +112 -0
- package/dist/testing/simulate-cluster.js +257 -0
- package/dist/testing/simulate.d.ts +90 -0
- package/dist/testing/simulate.js +127 -0
- package/package.json +1 -0
|
@@ -0,0 +1,666 @@
|
|
|
1
|
+
import { Deferred, Effect, Exit, Fiber, Layer, Predicate, Schedule, Schema, Scope, Stream, } from "effect";
|
|
2
|
+
import { Actor, User } from "../../index.js";
|
|
3
|
+
import { ActorTest, ProgressRecord } from "../actor-test.js";
|
|
4
|
+
import { ActorCluster } from "../cluster.js";
|
|
5
|
+
export const progressFixture = () => ({
|
|
6
|
+
frames: [],
|
|
7
|
+
plan: [],
|
|
8
|
+
captured: undefined,
|
|
9
|
+
progressFailed: false,
|
|
10
|
+
});
|
|
11
|
+
class EncoderDown extends Schema.TaggedError()("EncoderDown", {}) {
|
|
12
|
+
}
|
|
13
|
+
const Stage = Schema.Struct({
|
|
14
|
+
percent: Schema.Finite,
|
|
15
|
+
stage: Schema.Literals(["probe", "encode", "upload"]),
|
|
16
|
+
note: Schema.optional(Schema.String),
|
|
17
|
+
});
|
|
18
|
+
const Transcode = Actor.job("Transcode", {
|
|
19
|
+
payload: { assetId: Schema.String },
|
|
20
|
+
success: Schema.String,
|
|
21
|
+
progress: Stage,
|
|
22
|
+
});
|
|
23
|
+
const Import = Actor.job("Import", {
|
|
24
|
+
payload: { rows: Schema.Int },
|
|
25
|
+
progress: Schema.Struct({ done: Schema.Int }),
|
|
26
|
+
});
|
|
27
|
+
const Thumbnail = Actor.job("Thumbnail", {
|
|
28
|
+
payload: { assetId: Schema.String },
|
|
29
|
+
});
|
|
30
|
+
const Start = Actor.command("Start", { payload: Schema.String });
|
|
31
|
+
const Thumb = Actor.command("Thumb", { payload: Schema.String });
|
|
32
|
+
const Transcoded = Actor.command("Transcoded", { payload: Schema.String });
|
|
33
|
+
const Watch = Actor.connection("Watch", {
|
|
34
|
+
server: Schema.String,
|
|
35
|
+
progress: { jobs: [Transcode, Import] },
|
|
36
|
+
});
|
|
37
|
+
const Encoder = Actor.make("Encoder", {
|
|
38
|
+
key: Schema.String,
|
|
39
|
+
state: Actor.state({
|
|
40
|
+
outputs: Schema.Array(Schema.String).pipe(Schema.withDecodingDefault(Effect.succeed([]))),
|
|
41
|
+
}),
|
|
42
|
+
jobs: {
|
|
43
|
+
Transcode: {
|
|
44
|
+
job: Transcode,
|
|
45
|
+
retry: { times: 1 },
|
|
46
|
+
onSuccess: Transcoded,
|
|
47
|
+
progressEvery: "1 minute",
|
|
48
|
+
},
|
|
49
|
+
Import: { job: Import },
|
|
50
|
+
Thumbnail: { job: Thumbnail, retry: { times: 0 } },
|
|
51
|
+
},
|
|
52
|
+
api: { Start, Thumb, Watch },
|
|
53
|
+
internal: { Transcoded },
|
|
54
|
+
});
|
|
55
|
+
const EncoderState = Schema.Struct({ outputs: Schema.optional(Schema.Array(Schema.String)) });
|
|
56
|
+
export const progressLayer = (fixture) => Layer.mergeAll(Encoder.toLayer(Effect.succeed({
|
|
57
|
+
Start: Effect.fnUntraced(function* (assetId) {
|
|
58
|
+
yield* (yield* Encoder.Turn).enqueue(Transcode.make({ assetId }));
|
|
59
|
+
}),
|
|
60
|
+
Thumb: Effect.fnUntraced(function* (assetId) {
|
|
61
|
+
yield* (yield* Encoder.Turn).enqueue(Thumbnail.make({ assetId }));
|
|
62
|
+
}),
|
|
63
|
+
Transcoded: Effect.fnUntraced(function* (output) {
|
|
64
|
+
const turn = yield* Encoder.Turn;
|
|
65
|
+
yield* turn.state.set({ outputs: [...turn.state.outputs, output] });
|
|
66
|
+
}),
|
|
67
|
+
Watch: { open: () => Effect.void, frame: () => Effect.void },
|
|
68
|
+
})), Encoder.toJobLayer(Effect.succeed({
|
|
69
|
+
Transcode: Effect.fnUntraced(function* ({ assetId }) {
|
|
70
|
+
const exec = yield* Encoder.Executor;
|
|
71
|
+
fixture.captured = exec;
|
|
72
|
+
for (const frame of fixture.frames)
|
|
73
|
+
yield* exec.progress(Transcode, frame).pipe(Effect.exit, Effect.tap((exit) => Effect.sync(() => {
|
|
74
|
+
fixture.progressFailed ||= Exit.isFailure(exit);
|
|
75
|
+
})));
|
|
76
|
+
if (fixture.plan.shift() === "fail")
|
|
77
|
+
return yield* EncoderDown.make({});
|
|
78
|
+
return `${assetId}.mp4`;
|
|
79
|
+
}),
|
|
80
|
+
Import: () => Effect.void,
|
|
81
|
+
Thumbnail: Effect.fnUntraced(function* () {
|
|
82
|
+
fixture.captured = yield* Encoder.Executor;
|
|
83
|
+
}),
|
|
84
|
+
})));
|
|
85
|
+
const recordsOf = Effect.fnUntraced(function* (id) {
|
|
86
|
+
const records = yield* (yield* ActorTest).progress;
|
|
87
|
+
return records.filter((record) => record.ref.id === id);
|
|
88
|
+
});
|
|
89
|
+
const framesOf = (records) => records.flatMap((record) => ProgressRecord.$is("Progress")(record)
|
|
90
|
+
? [
|
|
91
|
+
{
|
|
92
|
+
attempt: record.attempt,
|
|
93
|
+
seq: record.seq,
|
|
94
|
+
frame: JSON.parse(new TextDecoder().decode(record.frame)),
|
|
95
|
+
},
|
|
96
|
+
]
|
|
97
|
+
: []);
|
|
98
|
+
const closedOf = (records) => records.filter(ProgressRecord.$is("ProgressClosed"));
|
|
99
|
+
const outputsOf = Effect.fnUntraced(function* (id) {
|
|
100
|
+
const encoder = yield* Encoder.get(id);
|
|
101
|
+
const { state } = yield* (yield* ActorTest).inspect(encoder.ref);
|
|
102
|
+
const decoded = yield* Schema.decodeUnknownEffect(EncoderState)(state).pipe(Effect.orDie);
|
|
103
|
+
return decoded.outputs ?? [];
|
|
104
|
+
});
|
|
105
|
+
const probe = { percent: 5, stage: "probe" };
|
|
106
|
+
const encode = { percent: 50, stage: "encode" };
|
|
107
|
+
const upload = { percent: 95, stage: "upload" };
|
|
108
|
+
export const progressConformance = [
|
|
109
|
+
{
|
|
110
|
+
name: "sends an executor's latest progress frame before the effect settles, then closes it",
|
|
111
|
+
run: ({ expect, environment, fixture }) => environment.run(Effect.gen(function* () {
|
|
112
|
+
const test = yield* ActorTest;
|
|
113
|
+
const encoder = yield* Encoder.get("latest");
|
|
114
|
+
fixture.frames = [probe, encode, upload];
|
|
115
|
+
yield* encoder.Start("a");
|
|
116
|
+
yield* test.advance(0);
|
|
117
|
+
const records = yield* recordsOf("latest");
|
|
118
|
+
const frames = framesOf(records);
|
|
119
|
+
const jobId = fixture.captured?.jobId;
|
|
120
|
+
expect([1, 2]).toContain(frames.length);
|
|
121
|
+
expect(frames.at(-1)).toEqual({ attempt: 1, seq: 3, frame: upload });
|
|
122
|
+
expect(frames.map((frame) => frame.seq)).toEqual(frames.map((frame) => frame.seq).toSorted((a, b) => a - b));
|
|
123
|
+
expect(records.every((record) => record.jobId === jobId)).toBe(true);
|
|
124
|
+
expect(records.at(-1) && ProgressRecord.$is("ProgressClosed")(records.at(-1))).toBe(true);
|
|
125
|
+
expect(records.at(-1)).toMatchObject({ attempt: 1 });
|
|
126
|
+
expect(yield* outputsOf("latest")).toEqual(["a.mp4"]);
|
|
127
|
+
expect(yield* test.inspect(encoder.ref)).toMatchObject({ outbox: 0, jobs: 0 });
|
|
128
|
+
})),
|
|
129
|
+
},
|
|
130
|
+
{
|
|
131
|
+
name: "drops undecodable, oversized, and mismatched progress frames without failing the effect",
|
|
132
|
+
run: ({ expect, environment, fixture }) => environment.run(Effect.gen(function* () {
|
|
133
|
+
const test = yield* ActorTest;
|
|
134
|
+
const encoder = yield* Encoder.get("invalid");
|
|
135
|
+
const exec = () => fixture.captured;
|
|
136
|
+
fixture.frames = [
|
|
137
|
+
{ percent: "half", stage: "encode" },
|
|
138
|
+
{ percent: 1, stage: "encode", note: "x".repeat(5000) },
|
|
139
|
+
{ percent: 1, stage: "mux" },
|
|
140
|
+
];
|
|
141
|
+
fixture.progressFailed = false;
|
|
142
|
+
yield* encoder.Start("b");
|
|
143
|
+
yield* test.advance(0);
|
|
144
|
+
yield* exec().progress(Import, { done: 1 });
|
|
145
|
+
expect(fixture.progressFailed).toBe(false);
|
|
146
|
+
expect(framesOf(yield* recordsOf("invalid"))).toEqual([]);
|
|
147
|
+
expect(closedOf(yield* recordsOf("invalid")).length).toBe(1);
|
|
148
|
+
expect(yield* outputsOf("invalid")).toEqual(["b.mp4"]);
|
|
149
|
+
})),
|
|
150
|
+
},
|
|
151
|
+
{
|
|
152
|
+
name: "ignores a captured progress callback once its attempt ends",
|
|
153
|
+
run: ({ expect, environment, fixture }) => environment.run(Effect.gen(function* () {
|
|
154
|
+
const test = yield* ActorTest;
|
|
155
|
+
const encoder = yield* Encoder.get("captured");
|
|
156
|
+
fixture.frames = [probe];
|
|
157
|
+
yield* encoder.Start("c");
|
|
158
|
+
yield* test.advance(0);
|
|
159
|
+
const before = (yield* recordsOf("captured")).length;
|
|
160
|
+
yield* fixture.captured.progress(Transcode, upload);
|
|
161
|
+
yield* test.advance("1 minute");
|
|
162
|
+
expect((yield* recordsOf("captured")).length).toBe(before);
|
|
163
|
+
expect(framesOf(yield* recordsOf("captured"))).toEqual([
|
|
164
|
+
{ attempt: 1, seq: 1, frame: probe },
|
|
165
|
+
]);
|
|
166
|
+
})),
|
|
167
|
+
},
|
|
168
|
+
{
|
|
169
|
+
name: "keeps progress open across a retryable failure and restarts the sequence per attempt",
|
|
170
|
+
run: ({ expect, environment, fixture }) => environment.run(Effect.gen(function* () {
|
|
171
|
+
const test = yield* ActorTest;
|
|
172
|
+
const encoder = yield* Encoder.get("retry");
|
|
173
|
+
fixture.frames = [encode];
|
|
174
|
+
fixture.plan = ["fail"];
|
|
175
|
+
yield* encoder.Start("d");
|
|
176
|
+
yield* test.advance(0);
|
|
177
|
+
expect(closedOf(yield* recordsOf("retry"))).toEqual([]);
|
|
178
|
+
expect(framesOf(yield* recordsOf("retry"))).toEqual([
|
|
179
|
+
{ attempt: 1, seq: 1, frame: encode },
|
|
180
|
+
]);
|
|
181
|
+
yield* test.advance("1 minute");
|
|
182
|
+
const records = yield* recordsOf("retry");
|
|
183
|
+
expect(framesOf(records)).toEqual([
|
|
184
|
+
{ attempt: 1, seq: 1, frame: encode },
|
|
185
|
+
{ attempt: 2, seq: 1, frame: encode },
|
|
186
|
+
]);
|
|
187
|
+
expect(closedOf(records)).toMatchObject([{ attempt: 2 }]);
|
|
188
|
+
expect(yield* outputsOf("retry")).toEqual(["d.mp4"]);
|
|
189
|
+
})),
|
|
190
|
+
},
|
|
191
|
+
{
|
|
192
|
+
name: "closes progress when an effect dead-letters",
|
|
193
|
+
run: ({ expect, environment, fixture }) => environment.run(Effect.gen(function* () {
|
|
194
|
+
const test = yield* ActorTest;
|
|
195
|
+
const encoder = yield* Encoder.get("dead");
|
|
196
|
+
fixture.frames = [probe];
|
|
197
|
+
fixture.plan = ["fail", "fail"];
|
|
198
|
+
yield* encoder.Start("e");
|
|
199
|
+
yield* test.advance(0);
|
|
200
|
+
yield* test.advance("1 minute");
|
|
201
|
+
const records = yield* recordsOf("dead");
|
|
202
|
+
expect(framesOf(records).map((frame) => frame.attempt)).toEqual([1, 2]);
|
|
203
|
+
expect(closedOf(records)).toMatchObject([{ attempt: 2 }]);
|
|
204
|
+
expect(yield* outputsOf("dead")).toEqual([]);
|
|
205
|
+
expect(yield* test.inspect(encoder.ref)).toMatchObject({ outbox: 0, jobs: 0 });
|
|
206
|
+
})),
|
|
207
|
+
},
|
|
208
|
+
{
|
|
209
|
+
name: "loses dropped progress frames without changing the effect's durable outcome",
|
|
210
|
+
run: ({ expect, environment, fixture }) => environment.run(Effect.gen(function* () {
|
|
211
|
+
const test = yield* ActorTest;
|
|
212
|
+
const encoder = yield* Encoder.get("lossy");
|
|
213
|
+
fixture.frames = [probe, encode, upload];
|
|
214
|
+
yield* test.dropProgress((message) => message.ref.id === "lossy");
|
|
215
|
+
yield* encoder.Start("f");
|
|
216
|
+
yield* test.advance(0);
|
|
217
|
+
yield* test.dropProgress(() => false);
|
|
218
|
+
const records = yield* recordsOf("lossy");
|
|
219
|
+
expect(records.every((record) => ProgressRecord.$is("ProgressClosed")(record) || record.dropped)).toBe(true);
|
|
220
|
+
expect(yield* outputsOf("lossy")).toEqual(["f.mp4"]);
|
|
221
|
+
expect(yield* test.receiptsFor(encoder.ref, "Transcoded")).toBe(1);
|
|
222
|
+
})),
|
|
223
|
+
},
|
|
224
|
+
{
|
|
225
|
+
name: "sends no progress for an effect that declares no progress schema",
|
|
226
|
+
run: ({ expect, environment, fixture }) => environment.run(Effect.gen(function* () {
|
|
227
|
+
const test = yield* ActorTest;
|
|
228
|
+
const encoder = yield* Encoder.get("plain");
|
|
229
|
+
yield* encoder.Thumb("g");
|
|
230
|
+
yield* test.advance(0);
|
|
231
|
+
yield* fixture.captured.progress(Transcode, probe);
|
|
232
|
+
expect(yield* recordsOf("plain")).toEqual([]);
|
|
233
|
+
})),
|
|
234
|
+
},
|
|
235
|
+
];
|
|
236
|
+
const Render = Actor.job("Render", {
|
|
237
|
+
payload: { job: Schema.String },
|
|
238
|
+
success: Schema.String,
|
|
239
|
+
progress: Schema.Struct({ percent: Schema.Finite }),
|
|
240
|
+
});
|
|
241
|
+
class Rendered extends Schema.TaggedClass()("Rendered", { output: Schema.String }) {
|
|
242
|
+
}
|
|
243
|
+
const renderPlans = new Map();
|
|
244
|
+
const plan = (job, frames) => Effect.gen(function* () {
|
|
245
|
+
const created = {
|
|
246
|
+
frames,
|
|
247
|
+
go: yield* Deferred.make(),
|
|
248
|
+
finish: yield* Deferred.make(),
|
|
249
|
+
};
|
|
250
|
+
renderPlans.set(job, created);
|
|
251
|
+
return created;
|
|
252
|
+
});
|
|
253
|
+
const Render_ = Actor.command("Render", { payload: Schema.String });
|
|
254
|
+
const Finished = Actor.command("Finished", { payload: Schema.String });
|
|
255
|
+
/** Performs Render under the job as its key, so a later turn can cancel it. */
|
|
256
|
+
const RenderKeyed = Actor.command("RenderKeyed", { payload: Schema.String });
|
|
257
|
+
/** Cancels the keyed Render of a job and tells `Mine` connections in the same turn. */
|
|
258
|
+
const CancelRender = Actor.command("CancelRender", { payload: Schema.String });
|
|
259
|
+
/** Progress for the performer's own connections only (the default audience). */
|
|
260
|
+
const Mine = Actor.connection("Mine", { server: Rendered, progress: { jobs: [Render] } });
|
|
261
|
+
/** Progress for every open connection of the member. */
|
|
262
|
+
const Everyone = Actor.connection("Everyone", {
|
|
263
|
+
server: Rendered,
|
|
264
|
+
progress: { jobs: [Render], to: "all" },
|
|
265
|
+
});
|
|
266
|
+
/** Receives no progress: it lists no effect. */
|
|
267
|
+
const Quiet = Actor.connection("Quiet", { server: Rendered });
|
|
268
|
+
/** A stream of the job's progress percentages, filtered by the effect's own input. */
|
|
269
|
+
const Percent = Actor.stream("Percent", {
|
|
270
|
+
payload: Schema.String,
|
|
271
|
+
success: Schema.Finite,
|
|
272
|
+
progress: { jobs: [Render] },
|
|
273
|
+
});
|
|
274
|
+
/** Receives every Render frame; each client frame `n` makes the owner send it `n` frames. */
|
|
275
|
+
const Busy = Actor.connection("Busy", {
|
|
276
|
+
server: Rendered,
|
|
277
|
+
client: Schema.Finite,
|
|
278
|
+
progress: { jobs: [Render], to: "all" },
|
|
279
|
+
});
|
|
280
|
+
/** Broadcasts one frame to `Busy`, from a turn of whichever activation owns the actor. */
|
|
281
|
+
const Announce = Actor.command("Announce", { payload: Schema.String });
|
|
282
|
+
const Studio = Actor.make("Studio", {
|
|
283
|
+
key: Schema.String,
|
|
284
|
+
jobs: {
|
|
285
|
+
Render: { job: Render, onSuccess: Finished, retry: { times: 0 }, progressEvery: "50 millis" },
|
|
286
|
+
},
|
|
287
|
+
api: {
|
|
288
|
+
Render: Render_,
|
|
289
|
+
RenderKeyed,
|
|
290
|
+
CancelRender,
|
|
291
|
+
Mine,
|
|
292
|
+
Everyone,
|
|
293
|
+
Quiet,
|
|
294
|
+
Percent,
|
|
295
|
+
Busy,
|
|
296
|
+
Announce,
|
|
297
|
+
},
|
|
298
|
+
internal: { Finished },
|
|
299
|
+
});
|
|
300
|
+
const handlers = { open: () => Effect.void, frame: () => Effect.void };
|
|
301
|
+
const studioCommands = Studio.toLayer(Effect.succeed({
|
|
302
|
+
Render: Effect.fnUntraced(function* (job) {
|
|
303
|
+
yield* (yield* Studio.Turn).enqueue(Render.make({ job }));
|
|
304
|
+
}),
|
|
305
|
+
RenderKeyed: Effect.fnUntraced(function* (job) {
|
|
306
|
+
yield* (yield* Studio.Turn).enqueue(Render.make({ job }), { key: job });
|
|
307
|
+
}),
|
|
308
|
+
CancelRender: Effect.fnUntraced(function* (job) {
|
|
309
|
+
const turn = yield* Studio.Turn;
|
|
310
|
+
yield* turn.cancelJob(job);
|
|
311
|
+
yield* turn.broadcast(Mine, Rendered.make({ output: `cancelled-${job}` }));
|
|
312
|
+
}),
|
|
313
|
+
Finished: Effect.fnUntraced(function* (output) {
|
|
314
|
+
const turn = yield* Studio.Turn;
|
|
315
|
+
yield* turn.broadcast(Mine, Rendered.make({ output }));
|
|
316
|
+
yield* turn.broadcast(Everyone, Rendered.make({ output }));
|
|
317
|
+
yield* turn.broadcast(Quiet, Rendered.make({ output }));
|
|
318
|
+
yield* turn.broadcast(Busy, Rendered.make({ output }));
|
|
319
|
+
}),
|
|
320
|
+
Mine: handlers,
|
|
321
|
+
Everyone: handlers,
|
|
322
|
+
Quiet: handlers,
|
|
323
|
+
Busy: {
|
|
324
|
+
open: () => Effect.void,
|
|
325
|
+
frame: Effect.fnUntraced(function* (count) {
|
|
326
|
+
const conn = yield* Studio.Connection;
|
|
327
|
+
for (let index = 0; index < count; index++)
|
|
328
|
+
yield* conn.send(Rendered.make({ output: `flood-${index}` }));
|
|
329
|
+
}),
|
|
330
|
+
},
|
|
331
|
+
Announce: Effect.fnUntraced(function* (output) {
|
|
332
|
+
yield* (yield* Studio.Turn).broadcast(Busy, Rendered.make({ output }));
|
|
333
|
+
}),
|
|
334
|
+
Percent: (job) => Stream.unwrap(Effect.gen(function* () {
|
|
335
|
+
const read = yield* Studio.Read;
|
|
336
|
+
return read.progress(Render).pipe(Stream.filter((entry) => entry.job.job === job), Stream.map((entry) => entry.frame.percent));
|
|
337
|
+
})),
|
|
338
|
+
}));
|
|
339
|
+
export const studioExecutors = Studio.toJobLayer(Effect.succeed({
|
|
340
|
+
Render: Effect.fnUntraced(function* ({ job }) {
|
|
341
|
+
const exec = yield* Studio.Executor;
|
|
342
|
+
const found = renderPlans.get(job);
|
|
343
|
+
if (found === undefined)
|
|
344
|
+
return job;
|
|
345
|
+
yield* Deferred.await(found.go);
|
|
346
|
+
for (const percent of found.frames) {
|
|
347
|
+
yield* exec.progress(Render, { percent });
|
|
348
|
+
yield* Effect.sleep("150 millis");
|
|
349
|
+
}
|
|
350
|
+
yield* Deferred.await(found.finish);
|
|
351
|
+
return `${job}.png`;
|
|
352
|
+
}),
|
|
353
|
+
}));
|
|
354
|
+
export const studioLayer = Layer.mergeAll(studioCommands, studioExecutors);
|
|
355
|
+
const WAIT = "20 seconds";
|
|
356
|
+
const nextOf = (connection) => connection.messages.pipe(Stream.take(1), Stream.runCollect, Effect.map((chunk) => [...chunk][0]), Effect.timeoutOrElse({
|
|
357
|
+
duration: WAIT,
|
|
358
|
+
orElse: () => Effect.die(new Error("No connection message arrived")),
|
|
359
|
+
}));
|
|
360
|
+
/** Messages that arrive within `window`, without waiting past it. */
|
|
361
|
+
const quietFor = (connection, window) => connection.messages.pipe(Stream.interruptWhen(Effect.sleep(window)), Stream.runCollect, Effect.map((chunk) => [...chunk]));
|
|
362
|
+
const progressOf = (message) => Predicate.isTagged(message, "Progress") ? message : undefined;
|
|
363
|
+
/** A member frame's value, or undefined for progress and control frames. */
|
|
364
|
+
const frameOf = (message) => Predicate.isTagged(message, "Frame") ? message.frame : undefined;
|
|
365
|
+
const bob = User.make({ subject: "bob" });
|
|
366
|
+
const withStudioCluster = (environment, body) => environment.run(Effect.gen(function* () {
|
|
367
|
+
const database = yield* environment.freshDatabase;
|
|
368
|
+
const context = yield* Layer.build(ActorTest.cluster({
|
|
369
|
+
database,
|
|
370
|
+
runners: 3,
|
|
371
|
+
shardLockExpiration: "3 seconds",
|
|
372
|
+
actors: studioCommands,
|
|
373
|
+
runnerActors: (runner) => (runner === 2 ? studioExecutors : Layer.empty),
|
|
374
|
+
as: User.make({ subject: "alice" }),
|
|
375
|
+
authorize: () => Effect.succeed(true),
|
|
376
|
+
}));
|
|
377
|
+
return yield* body.pipe(Effect.scoped, Effect.provideContext(context));
|
|
378
|
+
}));
|
|
379
|
+
/** Waits until the pool sent `count` progress frames for actor `id`, then for them to reach the holder. */
|
|
380
|
+
const sentFor = (id, count) => Effect.gen(function* () {
|
|
381
|
+
const test = yield* ActorTest;
|
|
382
|
+
const sent = Effect.map(test.progress, (records) => records.filter((record) => record.ref.id === id && ProgressRecord.$is("Progress")(record))
|
|
383
|
+
.length);
|
|
384
|
+
yield* sent.pipe(Effect.repeat({ schedule: Schedule.spaced("20 millis"), until: (found) => found >= count }), Effect.timeout(WAIT), Effect.orDie);
|
|
385
|
+
yield* Effect.sleep("300 millis");
|
|
386
|
+
});
|
|
387
|
+
/** Progress-delivery cases: frames stay in order, drop after cancellation, and coalesce per effect for a paused client. */
|
|
388
|
+
export const progressDeliveryConformance = [
|
|
389
|
+
{
|
|
390
|
+
name: "keeps an effect's progress in order when its first frames on an activation arrive together",
|
|
391
|
+
run: ({ expect, environment }) => environment.run(Effect.gen(function* () {
|
|
392
|
+
const test = yield* ActorTest;
|
|
393
|
+
const studio = yield* Studio.get("racing");
|
|
394
|
+
const mine = yield* test.connect(studio.ref, Mine, undefined);
|
|
395
|
+
const job = yield* plan("racing", [10]);
|
|
396
|
+
yield* studio.Render("racing");
|
|
397
|
+
yield* test.advance(0).pipe(Effect.forkChild);
|
|
398
|
+
yield* Deferred.succeed(job.go, undefined);
|
|
399
|
+
expect(progressOf(yield* nextOf(mine))?.seq).toBe(1);
|
|
400
|
+
const [sent] = (yield* test.progress).filter((record) => record.ref.id === "racing" && ProgressRecord.$is("Progress")(record));
|
|
401
|
+
if (sent === undefined || !ProgressRecord.$is("Progress")(sent))
|
|
402
|
+
return yield* Effect.die(new Error("No progress was sent"));
|
|
403
|
+
yield* test.hibernate(studio.ref);
|
|
404
|
+
yield* Effect.all([test.resendProgress({ ...sent, seq: 5 }), test.resendProgress({ ...sent, seq: 3 })], { concurrency: "unbounded" });
|
|
405
|
+
yield* Effect.sleep("500 millis");
|
|
406
|
+
const seqs = (yield* quietFor(mine, "1 second")).flatMap((message) => {
|
|
407
|
+
const found = progressOf(message);
|
|
408
|
+
return found === undefined ? [] : [found.seq];
|
|
409
|
+
});
|
|
410
|
+
expect(seqs.at(-1)).toBe(5);
|
|
411
|
+
expect(seqs).toEqual(seqs.toSorted((a, b) => a - b));
|
|
412
|
+
yield* Deferred.succeed(job.finish, undefined);
|
|
413
|
+
})),
|
|
414
|
+
},
|
|
415
|
+
{
|
|
416
|
+
name: "drops progress after the cancelling commit",
|
|
417
|
+
run: ({ expect, environment }) => environment.run(Effect.gen(function* () {
|
|
418
|
+
const test = yield* ActorTest;
|
|
419
|
+
const studio = yield* Studio.get("cancelled");
|
|
420
|
+
const mine = yield* test.connect(studio.ref, Mine, undefined);
|
|
421
|
+
const job = yield* plan("cancelled", [10]);
|
|
422
|
+
yield* test.dropProgress((message) => message.ref.id === "cancelled" && !("seq" in message));
|
|
423
|
+
yield* studio.RenderKeyed("cancelled");
|
|
424
|
+
yield* test.advance(0).pipe(Effect.forkChild);
|
|
425
|
+
yield* Deferred.succeed(job.go, undefined);
|
|
426
|
+
expect(progressOf(yield* nextOf(mine))?.frame).toEqual({ percent: 10 });
|
|
427
|
+
yield* studio.CancelRender("cancelled");
|
|
428
|
+
expect(frameOf(yield* nextOf(mine))).toEqual(Rendered.make({ output: "cancelled-cancelled" }));
|
|
429
|
+
const [sent] = (yield* test.progress).filter((record) => record.ref.id === "cancelled" && ProgressRecord.$is("Progress")(record));
|
|
430
|
+
if (sent === undefined || !ProgressRecord.$is("Progress")(sent))
|
|
431
|
+
return yield* Effect.die(new Error("No progress was sent"));
|
|
432
|
+
yield* test.resendProgress({ ...sent, seq: sent.seq + 1 });
|
|
433
|
+
expect(yield* quietFor(mine, "1 second")).toEqual([]);
|
|
434
|
+
yield* test.hibernate(studio.ref);
|
|
435
|
+
yield* test.resendProgress({ ...sent, seq: sent.seq + 2 });
|
|
436
|
+
expect(yield* quietFor(mine, "1 second")).toEqual([]);
|
|
437
|
+
yield* test.dropProgress(() => false);
|
|
438
|
+
yield* Deferred.succeed(job.finish, undefined);
|
|
439
|
+
})),
|
|
440
|
+
},
|
|
441
|
+
{
|
|
442
|
+
name: "coalesces a paused client's progress per effect at the holder, newest in place",
|
|
443
|
+
run: ({ expect, environment }) => environment.run(Effect.gen(function* () {
|
|
444
|
+
const test = yield* ActorTest;
|
|
445
|
+
const studio = yield* Studio.get("coalesce");
|
|
446
|
+
const busy = yield* test.connect(studio.ref, Busy, undefined);
|
|
447
|
+
const job = yield* plan("coalesce", [10, 20, 30, 40]);
|
|
448
|
+
yield* studio.Render("coalesce");
|
|
449
|
+
yield* test.advance(0).pipe(Effect.forkChild);
|
|
450
|
+
yield* Deferred.succeed(job.go, undefined);
|
|
451
|
+
yield* sentFor("coalesce", 4);
|
|
452
|
+
expect(progressOf(yield* nextOf(busy))).toMatchObject({ seq: 4, frame: { percent: 40 } });
|
|
453
|
+
yield* Deferred.succeed(job.finish, undefined);
|
|
454
|
+
expect(frameOf(yield* nextOf(busy))).toEqual(Rendered.make({ output: "coalesce.png" }));
|
|
455
|
+
})),
|
|
456
|
+
},
|
|
457
|
+
{
|
|
458
|
+
name: "discards a paused client's buffered progress at the effect's route",
|
|
459
|
+
run: ({ expect, environment }) => environment.run(Effect.gen(function* () {
|
|
460
|
+
const test = yield* ActorTest;
|
|
461
|
+
const studio = yield* Studio.get("ended");
|
|
462
|
+
const busy = yield* test.connect(studio.ref, Busy, undefined);
|
|
463
|
+
const job = yield* plan("ended", [10]);
|
|
464
|
+
yield* studio.Render("ended");
|
|
465
|
+
yield* test.advance(0).pipe(Effect.forkChild);
|
|
466
|
+
yield* Deferred.succeed(job.go, undefined);
|
|
467
|
+
yield* sentFor("ended", 1);
|
|
468
|
+
yield* Deferred.succeed(job.finish, undefined);
|
|
469
|
+
yield* test.receiptsFor(studio.ref, "Finished").pipe(Effect.repeat({
|
|
470
|
+
schedule: Schedule.spaced("20 millis"),
|
|
471
|
+
until: (found) => found === 1,
|
|
472
|
+
}), Effect.timeout(WAIT), Effect.orDie);
|
|
473
|
+
yield* Effect.sleep("300 millis");
|
|
474
|
+
expect((yield* quietFor(busy, "1 second")).map(frameOf)).toEqual([
|
|
475
|
+
Rendered.make({ output: "ended.png" }),
|
|
476
|
+
]);
|
|
477
|
+
})),
|
|
478
|
+
},
|
|
479
|
+
{
|
|
480
|
+
name: "evicts progress before member frames overflow, and drops progress instead of ending a full session",
|
|
481
|
+
timeoutMs: 60_000,
|
|
482
|
+
run: ({ expect, environment }) => environment.run(Effect.gen(function* () {
|
|
483
|
+
const test = yield* ActorTest;
|
|
484
|
+
const studio = yield* Studio.get("evict");
|
|
485
|
+
const busy = yield* test.connect(studio.ref, Busy, undefined);
|
|
486
|
+
const jobs = yield* Effect.forEach(["evict-a", "evict-b", "evict-c", "evict-d"], (job) => plan(job, [1]));
|
|
487
|
+
yield* Effect.forEach(jobs.map((_, index) => `evict-${"abcd"[index]}`), studio.Render, {
|
|
488
|
+
discard: true,
|
|
489
|
+
});
|
|
490
|
+
yield* test.advance(0).pipe(Effect.forkChild);
|
|
491
|
+
for (const job of jobs.slice(0, 3))
|
|
492
|
+
yield* Deferred.succeed(job.go, undefined);
|
|
493
|
+
yield* sentFor("evict", 3);
|
|
494
|
+
yield* busy.send(1022);
|
|
495
|
+
yield* Effect.sleep("1500 millis");
|
|
496
|
+
yield* Deferred.succeed(jobs[3].go, undefined);
|
|
497
|
+
yield* sentFor("evict", 4);
|
|
498
|
+
const drained = yield* quietFor(busy, "2 seconds");
|
|
499
|
+
const progress = drained.flatMap((message) => {
|
|
500
|
+
const found = progressOf(message);
|
|
501
|
+
return found === undefined ? [] : [found.jobId];
|
|
502
|
+
});
|
|
503
|
+
expect(drained.length).toBe(1024);
|
|
504
|
+
expect(progress.length).toBe(2);
|
|
505
|
+
expect(drained.filter((message) => frameOf(message) !== undefined).length).toBe(1022);
|
|
506
|
+
yield* busy.send(1);
|
|
507
|
+
expect(frameOf(yield* nextOf(busy))).toEqual(Rendered.make({ output: "flood-0" }));
|
|
508
|
+
for (const job of jobs)
|
|
509
|
+
yield* Deferred.succeed(job.finish, undefined);
|
|
510
|
+
})),
|
|
511
|
+
},
|
|
512
|
+
{
|
|
513
|
+
name: "discards an older owner's buffered progress once a newer owner sends",
|
|
514
|
+
run: ({ expect, environment }) => environment.run(Effect.gen(function* () {
|
|
515
|
+
const test = yield* ActorTest;
|
|
516
|
+
const studio = yield* Studio.get("moved");
|
|
517
|
+
const busy = yield* test.connect(studio.ref, Busy, undefined);
|
|
518
|
+
const job = yield* plan("moved", [10]);
|
|
519
|
+
yield* studio.Render("moved");
|
|
520
|
+
yield* test.advance(0).pipe(Effect.forkChild);
|
|
521
|
+
yield* Deferred.succeed(job.go, undefined);
|
|
522
|
+
yield* sentFor("moved", 1);
|
|
523
|
+
yield* test.hibernate(studio.ref);
|
|
524
|
+
yield* studio.Announce("moved-on");
|
|
525
|
+
expect((yield* quietFor(busy, "1 second")).map(frameOf)).toEqual([
|
|
526
|
+
Rendered.make({ output: "moved-on" }),
|
|
527
|
+
]);
|
|
528
|
+
yield* Deferred.succeed(job.finish, undefined);
|
|
529
|
+
})),
|
|
530
|
+
},
|
|
531
|
+
{
|
|
532
|
+
name: "delivers performer progress only to the performer's connection, and to every connection with to: all",
|
|
533
|
+
run: ({ expect, environment }) => environment.run(Effect.gen(function* () {
|
|
534
|
+
const test = yield* ActorTest;
|
|
535
|
+
const studio = yield* Studio.get("audience");
|
|
536
|
+
const mine = yield* test.connect(studio.ref, Mine, undefined);
|
|
537
|
+
const theirs = yield* test.connect(studio.ref, Mine, undefined).pipe(Actor.as(bob));
|
|
538
|
+
const everyone = yield* test.connect(studio.ref, Everyone, undefined).pipe(Actor.as(bob));
|
|
539
|
+
const quiet = yield* test.connect(studio.ref, Quiet, undefined);
|
|
540
|
+
const job = yield* plan("audience", [10, 60]);
|
|
541
|
+
yield* studio.Render("audience");
|
|
542
|
+
yield* test.advance(0).pipe(Effect.forkChild);
|
|
543
|
+
yield* Deferred.succeed(job.go, undefined);
|
|
544
|
+
const first = progressOf(yield* nextOf(mine));
|
|
545
|
+
expect(first).toMatchObject({
|
|
546
|
+
job: "Render",
|
|
547
|
+
attempt: 1,
|
|
548
|
+
seq: 1,
|
|
549
|
+
frame: { percent: 10 },
|
|
550
|
+
});
|
|
551
|
+
expect(progressOf(yield* nextOf(everyone))?.frame).toEqual({ percent: 10 });
|
|
552
|
+
expect(progressOf(yield* nextOf(mine))).toMatchObject({ seq: 2, frame: { percent: 60 } });
|
|
553
|
+
yield* Deferred.succeed(job.finish, undefined);
|
|
554
|
+
const seen = yield* quietFor(theirs, "1500 millis");
|
|
555
|
+
expect(seen.map(frameOf)).toEqual([Rendered.make({ output: "audience.png" })]);
|
|
556
|
+
expect(frameOf(yield* nextOf(quiet))).toEqual(Rendered.make({ output: "audience.png" }));
|
|
557
|
+
})),
|
|
558
|
+
},
|
|
559
|
+
{
|
|
560
|
+
name: "loses nothing durable when every progress message is dropped",
|
|
561
|
+
run: ({ expect, environment }) => environment.run(Effect.gen(function* () {
|
|
562
|
+
const test = yield* ActorTest;
|
|
563
|
+
const studio = yield* Studio.get("dropped");
|
|
564
|
+
const mine = yield* test.connect(studio.ref, Mine, undefined);
|
|
565
|
+
const job = yield* plan("dropped", [10, 60]);
|
|
566
|
+
yield* test.dropProgress((message) => message.ref.id === "dropped");
|
|
567
|
+
yield* studio.Render("dropped");
|
|
568
|
+
yield* test.advance(0).pipe(Effect.forkChild);
|
|
569
|
+
yield* Deferred.succeed(job.go, undefined);
|
|
570
|
+
yield* Deferred.succeed(job.finish, undefined);
|
|
571
|
+
const [arrived] = yield* mine.messages.pipe(Stream.take(1), Stream.runCollect, Effect.timeout(WAIT), Effect.ensuring(test.dropProgress(() => false)));
|
|
572
|
+
expect(frameOf(arrived)).toEqual(Rendered.make({ output: "dropped.png" }));
|
|
573
|
+
const settled = yield* test.inspect(studio.ref).pipe(Effect.repeat({
|
|
574
|
+
schedule: Schedule.spaced("20 millis"),
|
|
575
|
+
until: (inspection) => inspection.outbox === 0 && inspection.jobs === 0,
|
|
576
|
+
}), Effect.timeout(WAIT), Effect.orDie);
|
|
577
|
+
expect(settled).toMatchObject({ outbox: 0, jobs: 0 });
|
|
578
|
+
expect(yield* test.receiptsFor(studio.ref, "Finished")).toBe(1);
|
|
579
|
+
const sent = (yield* test.progress).filter((record) => record.ref.id === "dropped");
|
|
580
|
+
expect(sent.some(ProgressRecord.$is("Progress"))).toBe(true);
|
|
581
|
+
})),
|
|
582
|
+
},
|
|
583
|
+
{
|
|
584
|
+
name: "drops progress that arrives after the effect's route commits, on the same activation and after a move",
|
|
585
|
+
run: ({ expect, environment }) => environment.run(Effect.gen(function* () {
|
|
586
|
+
const test = yield* ActorTest;
|
|
587
|
+
const studio = yield* Studio.get("late");
|
|
588
|
+
const mine = yield* test.connect(studio.ref, Mine, undefined);
|
|
589
|
+
const job = yield* plan("late", [10]);
|
|
590
|
+
yield* test.dropProgress((message) => message.ref.id === "late" && !("seq" in message));
|
|
591
|
+
yield* studio.Render("late");
|
|
592
|
+
yield* test.advance(0).pipe(Effect.forkChild);
|
|
593
|
+
yield* Deferred.succeed(job.go, undefined);
|
|
594
|
+
expect(progressOf(yield* nextOf(mine))?.frame).toEqual({ percent: 10 });
|
|
595
|
+
yield* Deferred.succeed(job.finish, undefined);
|
|
596
|
+
expect(frameOf(yield* nextOf(mine))).toEqual(Rendered.make({ output: "late.png" }));
|
|
597
|
+
const [sent] = (yield* test.progress).filter((record) => record.ref.id === "late" && ProgressRecord.$is("Progress")(record));
|
|
598
|
+
if (sent === undefined || !ProgressRecord.$is("Progress")(sent))
|
|
599
|
+
return yield* Effect.die(new Error("No progress was sent"));
|
|
600
|
+
yield* test.resendProgress({ ...sent, seq: sent.seq + 1 });
|
|
601
|
+
expect(yield* quietFor(mine, "1 second")).toEqual([]);
|
|
602
|
+
yield* test.hibernate(studio.ref);
|
|
603
|
+
yield* test.resendProgress({ ...sent, seq: sent.seq + 2 });
|
|
604
|
+
expect(yield* quietFor(mine, "1 second")).toEqual([]);
|
|
605
|
+
yield* test.dropProgress(() => false);
|
|
606
|
+
})),
|
|
607
|
+
},
|
|
608
|
+
{
|
|
609
|
+
name: "streams progress to an Actor.stream handler through read.progress, filtered by effect input",
|
|
610
|
+
run: ({ expect, environment }) => environment.run(Effect.gen(function* () {
|
|
611
|
+
const test = yield* ActorTest;
|
|
612
|
+
const studio = yield* Studio.get("streamed");
|
|
613
|
+
const one = yield* plan("streamed-one", [20, 40]);
|
|
614
|
+
const other = yield* plan("streamed-other", [99]);
|
|
615
|
+
const percents = yield* studio
|
|
616
|
+
.Percent("streamed-one")
|
|
617
|
+
.pipe(Stream.take(2), Stream.runCollect, Effect.forkChild);
|
|
618
|
+
yield* Effect.sleep("300 millis");
|
|
619
|
+
yield* studio.Render("streamed-one");
|
|
620
|
+
yield* studio.Render("streamed-other");
|
|
621
|
+
yield* test.advance(0).pipe(Effect.forkChild);
|
|
622
|
+
yield* Deferred.succeed(other.go, undefined);
|
|
623
|
+
yield* Deferred.succeed(one.go, undefined);
|
|
624
|
+
expect([...(yield* Fiber.join(percents).pipe(Effect.timeout(WAIT)))]).toEqual([20, 40]);
|
|
625
|
+
yield* Deferred.succeed(one.finish, undefined);
|
|
626
|
+
yield* Deferred.succeed(other.finish, undefined);
|
|
627
|
+
})),
|
|
628
|
+
},
|
|
629
|
+
{
|
|
630
|
+
name: "delivers progress from an executor on runner C to a connection parked at holder A for an actor owned by runner B",
|
|
631
|
+
requiresFreshDatabase: true,
|
|
632
|
+
requiresIndependentConnections: true,
|
|
633
|
+
timeoutMs: 90_000,
|
|
634
|
+
run: ({ expect, environment }) => withStudioCluster(environment, Effect.gen(function* () {
|
|
635
|
+
const cluster = yield* ActorCluster;
|
|
636
|
+
yield* cluster.ready;
|
|
637
|
+
let ref;
|
|
638
|
+
for (let index = 0; ref === undefined && index < 200; index++) {
|
|
639
|
+
const candidate = (yield* cluster.on(0)(Studio.get(`parked-${index}`))).ref;
|
|
640
|
+
if ((yield* cluster.owner(candidate)) === 1)
|
|
641
|
+
ref = candidate;
|
|
642
|
+
}
|
|
643
|
+
if (ref === undefined)
|
|
644
|
+
return yield* Effect.die(new Error("Runner 1 owns no probed actor"));
|
|
645
|
+
const target = ref;
|
|
646
|
+
const mine = yield* cluster.on(0)(ActorTest.use((test) => test.connect(target, Mine, undefined)));
|
|
647
|
+
const job = yield* plan(target.id, [30]);
|
|
648
|
+
yield* cluster.on(0)(Studio.get(target.id).pipe(Effect.flatMap((s) => s.Render(target.id))));
|
|
649
|
+
yield* cluster.on(1)(ActorTest.use((test) => test.hibernate(target)));
|
|
650
|
+
const before = (yield* cluster.on(0)(ActorTest.use((test) => test.inspect(target))))
|
|
651
|
+
.generation;
|
|
652
|
+
yield* Deferred.succeed(job.go, undefined);
|
|
653
|
+
const first = yield* nextOf(mine);
|
|
654
|
+
expect(progressOf(first)).toMatchObject({ job: "Render", frame: { percent: 30 } });
|
|
655
|
+
const after = (yield* cluster.on(0)(ActorTest.use((test) => test.inspect(target))))
|
|
656
|
+
.generation;
|
|
657
|
+
expect(BigInt(after) > BigInt(before)).toBe(true);
|
|
658
|
+
yield* Deferred.succeed(job.finish, undefined);
|
|
659
|
+
})),
|
|
660
|
+
},
|
|
661
|
+
];
|
|
662
|
+
/** Progress actors, executors and the studio. */
|
|
663
|
+
export const progressSuite = {
|
|
664
|
+
fixture: progressFixture,
|
|
665
|
+
layer: (fixture) => Layer.merge(progressLayer(fixture), studioLayer),
|
|
666
|
+
};
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import type { ConformanceCase, ConformanceSuite } from "../conformance.ts";
|
|
2
|
+
export declare const propertiesLayer: import("effect/Layer").Layer<never, never, import("../index.ts").InternalActors>;
|
|
3
|
+
/** Property cases: payload hashing and receipts checked against a model over generated inputs. */
|
|
4
|
+
export declare const propertiesConformance: ReadonlyArray<ConformanceCase>;
|
|
5
|
+
/** Property actors, beside the feed and outbox actors the properties drive. */
|
|
6
|
+
export declare const propertiesSuite: ConformanceSuite;
|