@waffle-os/runtime 0.0.146 → 0.0.148
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/browser/command-input.ts +1 -4
- package/browser/filesystem-backend.ts +29 -6
- package/browser/fs-worker.ts +6 -3
- package/browser/process-broker.ts +5 -1
- package/browser/run-command.ts +5 -5
- package/browser/shared-fs.ts +104 -25
- package/browser/worker.ts +18 -12
- package/browser/yield-task.ts +25 -0
- package/build.ts +4 -4
- package/core/fd-reopen.ts +223 -77
- package/core/filesystem.ts +11 -1
- package/core/wasi.ts +108 -48
- package/dist/browser/command-input.js +1 -3
- package/dist/browser/filesystem-backend.js +22 -2
- package/dist/browser/fs-worker.js +8 -3
- package/dist/browser/process-broker.js +4 -2
- package/dist/browser/run-command.js +4 -4
- package/dist/browser/shared-fs.js +86 -20
- package/dist/browser/worker.js +24 -9
- package/dist/browser/yield-task.js +21 -0
- package/dist/core/fd-reopen.js +201 -84
- package/dist/core/wasi.js +92 -36
- package/dist/fs/backend.js +29 -38
- package/dist/fs/client.js +96 -38
- package/dist/fs/cold-read-cache.js +69 -0
- package/dist/fs/directory-pages.js +68 -24
- package/dist/fs/epoch-cache.js +48 -0
- package/dist/fs/guest-watch.js +9 -3
- package/dist/fs/idle-database.js +1 -1
- package/dist/fs/idle-owner.js +35 -4
- package/dist/fs/indexeddb.js +327 -63
- package/dist/fs/memory.js +48 -17
- package/dist/fs/multitab-backend.js +5065 -0
- package/dist/fs/multitab-protocol.js +301 -0
- package/dist/fs/opfs.js +26 -0
- package/dist/fs/persistent.js +104 -10
- package/dist/fs/protocol.js +57 -20
- package/dist/fs/request-memory.js +49 -21
- package/dist/fs/service.js +319 -109
- package/dist/fs/shared.js +52 -5
- package/dist/fs/vfs.js +26 -8
- package/dist/fs/watch-ring.js +7 -3
- package/dist/interrupt/diagnostics.js +8 -0
- package/dist/interrupt/index.js +5 -1
- package/dist/interrupt/loader-internal.js +147 -25
- package/dist/interrupt/loader.js +7 -3
- package/dist/interrupt/symbols.js +382 -0
- package/dist/proc/command-stdio.js +56 -1
- package/dist/proc/control.js +3 -0
- package/dist/proc/intrinsics/host.js +45 -0
- package/dist/proc/intrinsics.js +5 -0
- package/dist/proc/pipes.js +870 -186
- package/dist/proc/signals.js +21 -0
- package/dist/proc/worker-pipes.js +1 -0
- package/dist/runtime.js +4 -2
- package/dist/{tests → testing}/page-runner/framework-host.js +1 -1
- package/dist/thread/service.js +2 -2
- package/dist/tooling/program/program-build-tools.js +43 -5
- package/dist/tooling/program/program-build-tools.ts +62 -3
- package/dist/tooling/program/program-derivation.js +24 -4
- package/dist/tooling/program/program-derivation.ts +43 -3
- package/dist/tooling/program/program-symbols.js +155 -0
- package/dist/tooling/program/program-symbols.ts +200 -0
- package/dist/tooling/program/program-transformer.json +1 -1
- package/fs/backend.ts +71 -34
- package/fs/client.ts +101 -31
- package/fs/cold-read-cache.ts +76 -0
- package/fs/directory-pages.ts +88 -26
- package/fs/epoch-cache.ts +52 -0
- package/fs/guest-watch.ts +8 -3
- package/fs/idle-database.ts +1 -0
- package/fs/idle-owner.ts +48 -12
- package/fs/indexeddb.ts +402 -78
- package/fs/memory.ts +74 -15
- package/fs/multitab-backend.ts +6870 -0
- package/fs/multitab-protocol.ts +655 -0
- package/fs/opfs.ts +26 -0
- package/fs/persistent.ts +114 -8
- package/fs/protocol.ts +56 -24
- package/fs/request-memory.ts +65 -27
- package/fs/service.ts +388 -142
- package/fs/shared.ts +53 -4
- package/fs/storage.ts +7 -0
- package/fs/vfs.ts +44 -15
- package/fs/watch-ring.ts +5 -2
- package/interrupt/diagnostics.ts +29 -0
- package/interrupt/index.ts +8 -1
- package/interrupt/loader-internal.ts +178 -20
- package/interrupt/loader.ts +13 -2
- package/interrupt/symbols.ts +542 -0
- package/package.json +48 -27
- package/proc/command-stdio.ts +72 -2
- package/proc/control.ts +4 -0
- package/proc/intrinsics/host.ts +82 -0
- package/proc/intrinsics.ts +5 -0
- package/proc/pipes.ts +1089 -241
- package/proc/signals.ts +23 -0
- package/proc/worker-pipes.ts +5 -1
- package/runtime.ts +12 -3
- package/{tests → testing}/browser-runner-lifecycle.ts +27 -12
- package/testing/fixtures/rooted-symlinks-storage.ts +48 -0
- package/{tests → testing}/indexeddb-storage-browser.ts +49 -1
- package/{tests → testing}/page-runner/framework-host.ts +1 -1
- package/thread/service.ts +2 -2
- package/tooling/program/program-build-tools.ts +62 -3
- package/tooling/program/program-derivation.ts +43 -3
- package/tooling/program/program-symbols.ts +200 -0
- package/tooling/program/program-transformer.json +1 -1
- package/tooling/program-tools-package.ts +1 -0
- package/browser/gpu/method-coverage.json +0 -1933
- package/browser/gpu/stream.json +0 -4175
- package/browser/gpu/upstream/webgpu.h +0 -6774
- package/browser/gpu/upstream/webgpu.yml +0 -5532
- package/scripts/browser-command.ts +0 -34
- package/scripts/browser-supervisor.ts +0 -158
- package/scripts/build-c-thread-fixture.ts +0 -430
- package/scripts/build-gpu-fixture.ts +0 -279
- package/scripts/build-memory-group-fixture.ts +0 -147
- package/scripts/build-thread-fixture.ts +0 -205
- package/scripts/c-threads-fixture-producer.test.ts +0 -86
- package/scripts/owned-command.ts +0 -89
- package/scripts/test-browser.ts +0 -129
- package/scripts/test-wasi-libc.ts +0 -108
- package/scripts/threads-fixture-producer.test.ts +0 -177
- package/tests/aggregate-memory-contract.test.ts +0 -620
- package/tests/asset-load-recovery-browser-runner.ts +0 -179
- package/tests/asset-load-recovery.test.ts +0 -117
- package/tests/blocking-read-lock-contention.test.ts +0 -305
- package/tests/bootstrap-arrival-browser-runner.ts +0 -19
- package/tests/bootstrap-arrival-runner.test.ts +0 -89
- package/tests/browser-command-real.test.ts +0 -124
- package/tests/browser-command.test.ts +0 -342
- package/tests/browser-controls-discovery.test.ts +0 -56
- package/tests/browser-filesystem-cancel.test.ts +0 -248
- package/tests/browser-filesystem-disposal.test.ts +0 -469
- package/tests/browser-filesystem-failure.test.ts +0 -74
- package/tests/browser-filesystem-options.test.ts +0 -190
- package/tests/browser-filesystem-service-port.test.ts +0 -239
- package/tests/browser-matrix.test.ts +0 -605
- package/tests/browser-navigation-browser-runner.ts +0 -121
- package/tests/browser-navigation.test.ts +0 -106
- package/tests/browser-net-services.test.ts +0 -472
- package/tests/browser-net.test.ts +0 -310
- package/tests/browser-process-broker.test.ts +0 -4172
- package/tests/browser-runner-lifecycle.test.ts +0 -200
- package/tests/browser-worker.test.ts +0 -2736
- package/tests/buffer-boundaries.test.ts +0 -52
- package/tests/c-threads-embedding-runner.ts +0 -84
- package/tests/c-threads-fixture-inspect.ts +0 -23
- package/tests/c-threads-fixture.test.ts +0 -142
- package/tests/c-threads-packet-runner.ts +0 -6
- package/tests/c-threads-packet.ts +0 -132
- package/tests/c-threads-paths.test.ts +0 -83
- package/tests/c-threads-positive-worker.ts +0 -5
- package/tests/c-threads-runtime-browser-runner.ts +0 -122
- package/tests/c-threads-runtime-browser.ts +0 -334
- package/tests/c-threads-runtime-guest.ts +0 -14
- package/tests/c-threads-runtime.test.ts +0 -68
- package/tests/c-threads-safari-runner.ts +0 -178
- package/tests/checkpoint-pressure.test.ts +0 -602
- package/tests/child-diagnostic-browser.ts +0 -166
- package/tests/child-diagnostic-worker.ts +0 -25
- package/tests/child-diagnostics.test.ts +0 -114
- package/tests/ci-browser-install.test.ts +0 -244
- package/tests/cold-descriptor-lifecycle.test.ts +0 -170
- package/tests/cold-descriptor-read.test.ts +0 -245
- package/tests/command-input.test.ts +0 -40
- package/tests/command-scope.test.ts +0 -422
- package/tests/core-import-boundaries.test.ts +0 -92
- package/tests/core-size-contract.test.ts +0 -327
- package/tests/default-allocation-parity.test.ts +0 -184
- package/tests/descendant-preparation.test.ts +0 -726
- package/tests/descendant-real-worker.test.ts +0 -505
- package/tests/descriptors.test.ts +0 -71
- package/tests/dev-null.test.ts +0 -157
- package/tests/diagnostic-drain.test.ts +0 -62
- package/tests/dirty-admission.test.ts +0 -572
- package/tests/durable-file-identity.test.ts +0 -586
- package/tests/durable-identity-storage.test.ts +0 -112
- package/tests/error-serialization.test.ts +0 -94
- package/tests/exec-integration.test.ts +0 -94
- package/tests/fd-reopen.test.ts +0 -4
- package/tests/file-offset-contention.test.ts +0 -186
- package/tests/file-times.test.ts +0 -353
- package/tests/filesystem-allocation-context.test.ts +0 -198
- package/tests/filesystem-atomic.test.ts +0 -564
- package/tests/filesystem-capacity.test.ts +0 -34
- package/tests/filesystem-client-intrinsics.test.ts +0 -288
- package/tests/filesystem-codec.test.ts +0 -227
- package/tests/filesystem-conditional-remove.test.ts +0 -200
- package/tests/filesystem-endpoint-observer.test.ts +0 -371
- package/tests/filesystem-glob.test.ts +0 -38
- package/tests/filesystem-io-fastpath.test.ts +0 -339
- package/tests/filesystem-large-file.test.ts +0 -61
- package/tests/filesystem-lazy-backing.test.ts +0 -440
- package/tests/filesystem-nonblocking.test.ts +0 -339
- package/tests/filesystem-permissions.test.ts +0 -348
- package/tests/filesystem-persistence-shared.test.ts +0 -375
- package/tests/filesystem-port-transport.test.ts +0 -275
- package/tests/filesystem-private-input.test.ts +0 -1155
- package/tests/filesystem-publication-grant.test.ts +0 -674
- package/tests/filesystem-publication-workspace.test.ts +0 -2105
- package/tests/filesystem-publication.test.ts +0 -1774
- package/tests/filesystem-quiescence-rearm.test.ts +0 -76
- package/tests/filesystem-quiescence.test.ts +0 -522
- package/tests/filesystem-readlink-shared.test.ts +0 -311
- package/tests/filesystem-ready-disposal-browser-runner.ts +0 -243
- package/tests/filesystem-refcount.test.ts +0 -552
- package/tests/filesystem-request-memory.test.ts +0 -202
- package/tests/filesystem-request-pool.test.ts +0 -408
- package/tests/filesystem-resolve-observation.test.ts +0 -185
- package/tests/filesystem-retired-release.test.ts +0 -37
- package/tests/filesystem-review.test.ts +0 -284
- package/tests/filesystem-segment.test.ts +0 -339
- package/tests/filesystem-shared.test.ts +0 -304
- package/tests/filesystem-shutdown-browser-debt.ts +0 -267
- package/tests/filesystem-shutdown-browser-runner.ts +0 -524
- package/tests/filesystem-shutdown-browser.ts +0 -290
- package/tests/filesystem-shutdown-close-observation.test.ts +0 -437
- package/tests/filesystem-shutdown-close-observation.ts +0 -206
- package/tests/filesystem-shutdown-observer.test.ts +0 -93
- package/tests/filesystem-shutdown.test.ts +0 -893
- package/tests/filesystem-staged-write.test.ts +0 -909
- package/tests/filesystem-stop-observer.ts +0 -50
- package/tests/filesystem-storage-geometry.test.ts +0 -404
- package/tests/filesystem-transfer.test.ts +0 -135
- package/tests/filesystem-transport-browser-driver.ts +0 -28
- package/tests/filesystem-transport-browser-runner.ts +0 -134
- package/tests/filesystem-transport-browser.ts +0 -179
- package/tests/filesystem-transport-codec.test.ts +0 -96
- package/tests/filesystem-walk.test.ts +0 -524
- package/tests/filesystem-worker.test.ts +0 -676
- package/tests/first-worker-import.ts +0 -118
- package/tests/fixtures/asset-load-recovery-page.ts +0 -95
- package/tests/fixtures/bigint-hooks.ts +0 -28
- package/tests/fixtures/browser-cell-clone.ts +0 -100
- package/tests/fixtures/browser-process-child.ts +0 -25
- package/tests/fixtures/buffer-boundaries.ts +0 -65
- package/tests/fixtures/cold-descriptor-guest.ts +0 -58
- package/tests/fixtures/cold-descriptor.ts +0 -162
- package/tests/fixtures/cold-range-proof-lifecycle.ts +0 -136
- package/tests/fixtures/command-bounded-admission.ts +0 -31
- package/tests/fixtures/command-disposal.ts +0 -47
- package/tests/fixtures/command-guests.ts +0 -123
- package/tests/fixtures/default-allocation-capture.ts +0 -239
- package/tests/fixtures/descendant-real-worker.ts +0 -121
- package/tests/fixtures/diagnostic-public.ts +0 -14
- package/tests/fixtures/documented-startup-control.ts +0 -33
- package/tests/fixtures/durable-identity-opfs.ts +0 -123
- package/tests/fixtures/exec-browser-worker.ts +0 -5
- package/tests/fixtures/exec-guest.ts +0 -279
- package/tests/fixtures/exec-integration.ts +0 -305
- package/tests/fixtures/exec-node-control.ts +0 -22
- package/tests/fixtures/exec-node-host.ts +0 -31
- package/tests/fixtures/exec-node-worker.ts +0 -11
- package/tests/fixtures/exec-worker.ts +0 -33
- package/tests/fixtures/fd-kind-cases.ts +0 -81
- package/tests/fixtures/fd-reopen-cases.ts +0 -489
- package/tests/fixtures/file-offset-contention.ts +0 -110
- package/tests/fixtures/file-only-abi.ts +0 -48
- package/tests/fixtures/file-times-guest.ts +0 -151
- package/tests/fixtures/file-times-worker.ts +0 -16
- package/tests/fixtures/filesystem-atomic-guest.ts +0 -94
- package/tests/fixtures/filesystem-default-service.ts +0 -3
- package/tests/fixtures/filesystem-diagnostic-transfer-failure.ts +0 -15
- package/tests/fixtures/filesystem-endpoint-observer.ts +0 -159
- package/tests/fixtures/filesystem-endpoint-service.ts +0 -53
- package/tests/fixtures/filesystem-file.ts +0 -23
- package/tests/fixtures/filesystem-guest.ts +0 -119
- package/tests/fixtures/filesystem-offset-guest.ts +0 -48
- package/tests/fixtures/filesystem-permissions-worker.ts +0 -44
- package/tests/fixtures/filesystem-port-service.ts +0 -32
- package/tests/fixtures/filesystem-port-worker.ts +0 -71
- package/tests/fixtures/filesystem-proc-guest.ts +0 -59
- package/tests/fixtures/filesystem-quiescence-guest.ts +0 -23
- package/tests/fixtures/filesystem-refcount-guest.ts +0 -75
- package/tests/fixtures/filesystem-request-release-worker.ts +0 -32
- package/tests/fixtures/filesystem-segment-guest.ts +0 -46
- package/tests/fixtures/filesystem-service.ts +0 -17
- package/tests/fixtures/filesystem-shutdown-debt-page.ts +0 -178
- package/tests/fixtures/filesystem-shutdown-debt-worker.ts +0 -116
- package/tests/fixtures/filesystem-shutdown-page.ts +0 -288
- package/tests/fixtures/filesystem-shutdown-worker.ts +0 -168
- package/tests/fixtures/filesystem-startup-failure.ts +0 -24
- package/tests/fixtures/filesystem-transport-observation-worker.ts +0 -5
- package/tests/fixtures/filesystem-walk-worker.ts +0 -45
- package/tests/fixtures/generic-memory-node-worker.ts +0 -16
- package/tests/fixtures/global-lock-holder.ts +0 -55
- package/tests/fixtures/gpu/async-expected.json +0 -506
- package/tests/fixtures/gpu/async-host.ts +0 -263
- package/tests/fixtures/gpu/async-native.ts +0 -507
- package/tests/fixtures/gpu/async-page.ts +0 -193
- package/tests/fixtures/gpu/async.c +0 -463
- package/tests/fixtures/gpu/async_encode.h +0 -170
- package/tests/fixtures/gpu/bootstrap-cleanup-worker.ts +0 -135
- package/tests/fixtures/gpu/bundle-query-expected.json +0 -400
- package/tests/fixtures/gpu/bundle-query-fixture.ts +0 -121
- package/tests/fixtures/gpu/bundle-query-native.ts +0 -674
- package/tests/fixtures/gpu/compute-expected.json +0 -187
- package/tests/fixtures/gpu/compute-native.ts +0 -418
- package/tests/fixtures/gpu/copy-draw-expected.json +0 -372
- package/tests/fixtures/gpu/copy-draw-fixture.ts +0 -82
- package/tests/fixtures/gpu/copy-draw-native.ts +0 -690
- package/tests/fixtures/gpu/core-fixture.ts +0 -202
- package/tests/fixtures/gpu/core-transport-worker.ts +0 -76
- package/tests/fixtures/gpu/desktop-arm-contract.ts +0 -180
- package/tests/fixtures/gpu/desktop-fairness-contract.ts +0 -99
- package/tests/fixtures/gpu/desktop-fairness-observation.ts +0 -79
- package/tests/fixtures/gpu/disposal-retirement.ts +0 -21
- package/tests/fixtures/gpu/enums.json +0 -46
- package/tests/fixtures/gpu/expected.json +0 -251
- package/tests/fixtures/gpu/fairness-observer.ts +0 -504
- package/tests/fixtures/gpu/fairness-test-data.ts +0 -164
- package/tests/fixtures/gpu/fairness-validation.ts +0 -325
- package/tests/fixtures/gpu/fixture-runtime.ts +0 -48
- package/tests/fixtures/gpu/gpu_encode.h +0 -236
- package/tests/fixtures/gpu/gpu_fixture.h +0 -237
- package/tests/fixtures/gpu/import-unwind.ts +0 -12
- package/tests/fixtures/gpu/integration-guest.ts +0 -244
- package/tests/fixtures/gpu/integration-page.ts +0 -805
- package/tests/fixtures/gpu/integration-service-worker.ts +0 -113
- package/tests/fixtures/gpu/label-expected.json +0 -219
- package/tests/fixtures/gpu/label-native.ts +0 -280
- package/tests/fixtures/gpu/lazy-page.ts +0 -39
- package/tests/fixtures/gpu/measurement-contract.ts +0 -148
- package/tests/fixtures/gpu/measurement-desktop.ts +0 -121
- package/tests/fixtures/gpu/measurement-page.ts +0 -347
- package/tests/fixtures/gpu/measurement-runtime.ts +0 -82
- package/tests/fixtures/gpu/measurement-worker.ts +0 -310
- package/tests/fixtures/gpu/ownership-reader-terminal-worker.ts +0 -42
- package/tests/fixtures/gpu/ownership-service-worker.ts +0 -920
- package/tests/fixtures/gpu/peer-input.ts +0 -6
- package/tests/fixtures/gpu/qualification-contract.ts +0 -42
- package/tests/fixtures/gpu/qualification-page.ts +0 -67
- package/tests/fixtures/gpu/qualification-webgpu.ts +0 -199
- package/tests/fixtures/gpu/qualification-worker.ts +0 -97
- package/tests/fixtures/gpu/ring-snapshot.ts +0 -25
- package/tests/fixtures/gpu/ring-worker.ts +0 -227
- package/tests/fixtures/gpu/runtime-display-fence-launcher.ts +0 -16
- package/tests/fixtures/gpu/runtime-display-fence.ts +0 -193
- package/tests/fixtures/gpu/runtime-disposal-signal-order.ts +0 -195
- package/tests/fixtures/gpu/runtime-disposal-signal-worker.ts +0 -79
- package/tests/fixtures/gpu/scene-expected.json +0 -360
- package/tests/fixtures/gpu/scene-fixture.ts +0 -73
- package/tests/fixtures/gpu/scene-native.ts +0 -473
- package/tests/fixtures/gpu/scene.c +0 -73
- package/tests/fixtures/gpu/scene_encode.h +0 -302
- package/tests/fixtures/gpu/service-access.ts +0 -39
- package/tests/fixtures/gpu/service-bootstrap-worker.ts +0 -10
- package/tests/fixtures/gpu/service-reader-worker.ts +0 -29
- package/tests/fixtures/gpu/thrown-observation.ts +0 -120
- package/tests/fixtures/gpu/triangle.c +0 -480
- package/tests/fixtures/gpu/waffle_gpu_stream.h +0 -2046
- package/tests/fixtures/group-futex-worker.ts +0 -102
- package/tests/fixtures/group-link-program.ts +0 -18
- package/tests/fixtures/guarded-nonblock-worker.ts +0 -37
- package/tests/fixtures/guest-watch-runtime-worker.ts +0 -115
- package/tests/fixtures/guest-watch-worker.ts +0 -41
- package/tests/fixtures/guest-watch-writer-worker.ts +0 -46
- package/tests/fixtures/host-failure-worker.ts +0 -17
- package/tests/fixtures/indexeddb-background-confirmation.ts +0 -33
- package/tests/fixtures/indexeddb-caller-delivery.ts +0 -100
- package/tests/fixtures/installer-symlinks-support.ts +0 -25
- package/tests/fixtures/interrupt-browser-loops.ts +0 -78
- package/tests/fixtures/interrupt-browser-worker.ts +0 -104
- package/tests/fixtures/interrupt-browser-workload.ts +0 -17
- package/tests/fixtures/interrupt-dom-consumer.ts +0 -9
- package/tests/fixtures/interrupt-wait-wasm.ts +0 -108
- package/tests/fixtures/interrupt-wait-worker.ts +0 -61
- package/tests/fixtures/intrinsics.ts +0 -114
- package/tests/fixtures/isolated-process.ts +0 -98
- package/tests/fixtures/lazy-backing-constructions.ts +0 -117
- package/tests/fixtures/lazy-backing-guest.ts +0 -219
- package/tests/fixtures/lazy-backing.ts +0 -226
- package/tests/fixtures/link-initialization-worker.ts +0 -112
- package/tests/fixtures/link-initialization.ts +0 -169
- package/tests/fixtures/link-member-workers.ts +0 -73
- package/tests/fixtures/link-relay-program.ts +0 -76
- package/tests/fixtures/link-relay-worker.ts +0 -77
- package/tests/fixtures/linked-nested-node-worker.ts +0 -50
- package/tests/fixtures/logical-process-context-guest.ts +0 -37
- package/tests/fixtures/memory-group-abi-worker.ts +0 -108
- package/tests/fixtures/memory-group-member.c +0 -215
- package/tests/fixtures/memory-group-pie.ts +0 -46
- package/tests/fixtures/memory-group-wake-worker.ts +0 -14
- package/tests/fixtures/memory-group-worker.ts +0 -18
- package/tests/fixtures/memory-observation-guest.ts +0 -90
- package/tests/fixtures/metadata-completion-observer-worker.ts +0 -13
- package/tests/fixtures/metadata-enumeration-r173-service.ts +0 -71
- package/tests/fixtures/metadata-enumeration-r173-store.ts +0 -51
- package/tests/fixtures/metadata-enumeration-r173-wasi.ts +0 -168
- package/tests/fixtures/metadata-enumeration-r173-worker.ts +0 -68
- package/tests/fixtures/navigation-wire-child.ts +0 -134
- package/tests/fixtures/nested-wasi.ts +0 -260
- package/tests/fixtures/network-fence-script.ts +0 -46
- package/tests/fixtures/network-hook-positions.json +0 -16
- package/tests/fixtures/network-original-nodes.json +0 -149
- package/tests/fixtures/node-wasi-descriptors.ts +0 -203
- package/tests/fixtures/node-worker-transfers.ts +0 -11
- package/tests/fixtures/notification-collecting-worker.ts +0 -7
- package/tests/fixtures/notification-controlled-relay.ts +0 -57
- package/tests/fixtures/notification-deadline-worker.ts +0 -128
- package/tests/fixtures/notification-mixed-worker.ts +0 -215
- package/tests/fixtures/notification-probed-worker.ts +0 -53
- package/tests/fixtures/notification-reject-worker.ts +0 -7
- package/tests/fixtures/notification-runtime-worker.ts +0 -55
- package/tests/fixtures/notification-send-failure-worker.ts +0 -60
- package/tests/fixtures/notification-stalled-worker.ts +0 -5
- package/tests/fixtures/notification-traffic-worker.ts +0 -71
- package/tests/fixtures/operation-fs-worker.ts +0 -114
- package/tests/fixtures/operation-observer-worker.ts +0 -41
- package/tests/fixtures/operation-page.ts +0 -522
- package/tests/fixtures/opfs-close-page.ts +0 -94
- package/tests/fixtures/opfs-close-worker.ts +0 -565
- package/tests/fixtures/opfs-range-storage.ts +0 -285
- package/tests/fixtures/owned-job-root-worker.ts +0 -84
- package/tests/fixtures/owned-job-wait-worker.ts +0 -56
- package/tests/fixtures/owner-freeze-guest.ts +0 -81
- package/tests/fixtures/owner-freeze-owner.ts +0 -77
- package/tests/fixtures/page-root-client.ts +0 -33
- package/tests/fixtures/permissions-guest.ts +0 -55
- package/tests/fixtures/persistent-authority-observer.ts +0 -27
- package/tests/fixtures/persistent-lifecycle-r2-owner.ts +0 -149
- package/tests/fixtures/persistent-ready.ts +0 -34
- package/tests/fixtures/pipe-filestat-guest.ts +0 -101
- package/tests/fixtures/pipe-filestat-worker.ts +0 -36
- package/tests/fixtures/pipe-reuse-worker.ts +0 -41
- package/tests/fixtures/pipes-intrinsics.ts +0 -63
- package/tests/fixtures/preopen-guest.c +0 -44
- package/tests/fixtures/preopen-node-host.ts +0 -13
- package/tests/fixtures/prepared-program-loading-control.ts +0 -42
- package/tests/fixtures/prepared-runtime-control.ts +0 -80
- package/tests/fixtures/preview-wire-headers-page.ts +0 -84
- package/tests/fixtures/preview1-entry.ts +0 -1
- package/tests/fixtures/preview1-listener.wat +0 -44
- package/tests/fixtures/preview1-relay.wat +0 -24
- package/tests/fixtures/preview1-socket-imports.wat +0 -36
- package/tests/fixtures/preview1-socket-unknown.wat +0 -4
- package/tests/fixtures/preview1-socket-worker.ts +0 -72
- package/tests/fixtures/preview1-socket.c +0 -58
- package/tests/fixtures/preview1-socket.wat +0 -19
- package/tests/fixtures/private-authority-cases.ts +0 -260
- package/tests/fixtures/process-abi-guest.ts +0 -67
- package/tests/fixtures/process-abi-poll-guest.ts +0 -84
- package/tests/fixtures/process-cell-clone.ts +0 -520
- package/tests/fixtures/process-context-guest.ts +0 -22
- package/tests/fixtures/process-filesystem.ts +0 -34
- package/tests/fixtures/process-intrinsics.ts +0 -360
- package/tests/fixtures/process-lookup.ts +0 -6
- package/tests/fixtures/process-observation-acquisition-worker.ts +0 -68
- package/tests/fixtures/process-observation-controls.ts +0 -15
- package/tests/fixtures/process-observation-worker.ts +0 -72
- package/tests/fixtures/process-poll-start-failure.ts +0 -68
- package/tests/fixtures/process-root-navigation-original-bun-lock.txt +0 -333
- package/tests/fixtures/process-root-navigation-original-runner.txt +0 -378
- package/tests/fixtures/process-start-worker.ts +0 -32
- package/tests/fixtures/program-shell.ts +0 -86
- package/tests/fixtures/publication-channel-observer.ts +0 -144
- package/tests/fixtures/publication-cleanup-failure.ts +0 -16
- package/tests/fixtures/publication-guest.ts +0 -296
- package/tests/fixtures/publication-launch-close.ts +0 -61
- package/tests/fixtures/publication-resident-authority.ts +0 -464
- package/tests/fixtures/publication-resident-guest.ts +0 -331
- package/tests/fixtures/publication-storage.ts +0 -30
- package/tests/fixtures/publication-wasm.ts +0 -103
- package/tests/fixtures/readlink-service.ts +0 -19
- package/tests/fixtures/recovery-r42-owner.ts +0 -49
- package/tests/fixtures/recovery-r42-page.ts +0 -67
- package/tests/fixtures/reservation-waste-worker.ts +0 -16
- package/tests/fixtures/resident-memory.ts +0 -11
- package/tests/fixtures/retained-client.ts +0 -26
- package/tests/fixtures/root-return-gc.ts +0 -121
- package/tests/fixtures/running-member-wasm.ts +0 -55
- package/tests/fixtures/running-member-worker.ts +0 -50
- package/tests/fixtures/runtime-filesystem-close-debt.ts +0 -142
- package/tests/fixtures/runtime-stop-control.ts +0 -229
- package/tests/fixtures/search-count-worker.ts +0 -265
- package/tests/fixtures/search-fault-shard.ts +0 -21
- package/tests/fixtures/search-program-fs-worker.ts +0 -34
- package/tests/fixtures/shared-caller-debt-control.ts +0 -13
- package/tests/fixtures/shared-caller-exec-worker.ts +0 -119
- package/tests/fixtures/shared-caller-exec.ts +0 -597
- package/tests/fixtures/shared-caller-host-failure-control.ts +0 -92
- package/tests/fixtures/shared-memory-platform.ts +0 -6
- package/tests/fixtures/socket-admission-relay.ts +0 -114
- package/tests/fixtures/spawn-diagnostic-guest.ts +0 -44
- package/tests/fixtures/spawn-request.ts +0 -14
- package/tests/fixtures/stable-memory-grow-worker.ts +0 -10
- package/tests/fixtures/stable-memory-reader.ts +0 -253
- package/tests/fixtures/standalone-runtime-process.ts +0 -19
- package/tests/fixtures/start-failure-public.ts +0 -8
- package/tests/fixtures/start-failure-quiet-worker.ts +0 -54
- package/tests/fixtures/startup-diagnostic-request.ts +0 -8
- package/tests/fixtures/startup-diagnostic-worker.ts +0 -62
- package/tests/fixtures/startup-pool-worker.ts +0 -19
- package/tests/fixtures/stop-order-wasm.ts +0 -60
- package/tests/fixtures/stop-order-worker.ts +0 -11
- package/tests/fixtures/storage-lock-startup.ts +0 -70
- package/tests/fixtures/storage-maintenance.ts +0 -16
- package/tests/fixtures/symlink-sizing-probe.ts +0 -59
- package/tests/fixtures/terminal-control-worker.ts +0 -150
- package/tests/fixtures/terminal-input-pause.ts +0 -30
- package/tests/fixtures/terminal-input-producer.ts +0 -18
- package/tests/fixtures/terminal-mode-worker.ts +0 -58
- package/tests/fixtures/terminal-resolver-worker.ts +0 -92
- package/tests/fixtures/thread-admission-control.ts +0 -294
- package/tests/fixtures/threads-c.c +0 -117
- package/tests/fixtures/threads.rs +0 -140
- package/tests/fixtures/truncate-page-work.ts +0 -32
- package/tests/fixtures/wasi-atomic-host.ts +0 -92
- package/tests/fixtures/wasi-cat.ts +0 -177
- package/tests/fixtures/wasi-nonblock-inherited-worker.ts +0 -34
- package/tests/fixtures/wasi-nonblock-worker.ts +0 -33
- package/tests/fixtures/wasi-nonblock.ts +0 -48
- package/tests/fixtures/wasi-poll-guest.ts +0 -45
- package/tests/fixtures/wasi-write.ts +0 -72
- package/tests/fixtures/wasm-start-section.ts +0 -88
- package/tests/fixtures/watch-delivery-error-worker.ts +0 -4
- package/tests/fixtures/watch-guest.ts +0 -141
- package/tests/fixtures/watch-lifecycle-worker.ts +0 -2
- package/tests/fixtures/watch-startup-error-worker.ts +0 -1
- package/tests/fixtures/worker-pipe-transfer-guest.ts +0 -58
- package/tests/fixtures/workspace-endurance.ts +0 -113
- package/tests/fixtures/workspace-read-claim.ts +0 -41
- package/tests/fixtures/workspace-read.ts +0 -104
- package/tests/fs-socket-attachment-browser.ts +0 -184
- package/tests/fs-socket-browser-runner.ts +0 -35
- package/tests/fs-socket-node.test.ts +0 -123
- package/tests/fs-socket-owner.test.ts +0 -106
- package/tests/fs-socket-scope.test.ts +0 -285
- package/tests/gated-indexeddb.test.ts +0 -16
- package/tests/git-install.test.ts +0 -25
- package/tests/gpu-admission-browser.ts +0 -763
- package/tests/gpu-admission-controls.test.ts +0 -592
- package/tests/gpu-asset-paths.test.ts +0 -107
- package/tests/gpu-async-assets.ts +0 -29
- package/tests/gpu-async-browser-runner.ts +0 -20
- package/tests/gpu-async-command.test.ts +0 -249
- package/tests/gpu-async-command.ts +0 -272
- package/tests/gpu-async-desktop.ts +0 -78
- package/tests/gpu-async-fixture.test.ts +0 -252
- package/tests/gpu-async-native.test.ts +0 -38
- package/tests/gpu-async-native.ts +0 -70
- package/tests/gpu-async-output.test.ts +0 -49
- package/tests/gpu-async-payload.test.ts +0 -537
- package/tests/gpu-async-replay.test.ts +0 -656
- package/tests/gpu-async-stream.test.ts +0 -166
- package/tests/gpu-bootstrap-cleanup.test.ts +0 -185
- package/tests/gpu-browser-controls.test.ts +0 -64
- package/tests/gpu-browser-qualification.test.ts +0 -102
- package/tests/gpu-browser-qualification.ts +0 -432
- package/tests/gpu-browser-runner.ts +0 -554
- package/tests/gpu-browser-shared.ts +0 -59
- package/tests/gpu-bundle-query-native.test.ts +0 -8
- package/tests/gpu-bundle-query-native.ts +0 -55
- package/tests/gpu-bundle-query-replay.test.ts +0 -406
- package/tests/gpu-bundle-query-stream.test.ts +0 -97
- package/tests/gpu-ci.test.ts +0 -244
- package/tests/gpu-completions.test.ts +0 -404
- package/tests/gpu-compute-native.test.ts +0 -9
- package/tests/gpu-compute-native.ts +0 -47
- package/tests/gpu-compute-replay.test.ts +0 -363
- package/tests/gpu-compute-stream.test.ts +0 -53
- package/tests/gpu-control-retention.test.ts +0 -202
- package/tests/gpu-copy-draw-native.test.ts +0 -9
- package/tests/gpu-copy-draw-native.ts +0 -71
- package/tests/gpu-copy-draw-replay.test.ts +0 -350
- package/tests/gpu-copy-draw-stream.test.ts +0 -78
- package/tests/gpu-coverage.test.ts +0 -250
- package/tests/gpu-desktop-measure.test.ts +0 -344
- package/tests/gpu-display-retirement.test.ts +0 -213
- package/tests/gpu-display-shutdown.test.ts +0 -180
- package/tests/gpu-disposal-browser.ts +0 -685
- package/tests/gpu-disposal-controls.test.ts +0 -738
- package/tests/gpu-disposal-retirement.test.ts +0 -108
- package/tests/gpu-fairness-browser.ts +0 -273
- package/tests/gpu-fairness-fixture.test.ts +0 -202
- package/tests/gpu-fairness.test.ts +0 -203
- package/tests/gpu-fixture-closed.test.ts +0 -232
- package/tests/gpu-fixture-host.ts +0 -253
- package/tests/gpu-fixture.test.ts +0 -569
- package/tests/gpu-grant-quota-browser.ts +0 -767
- package/tests/gpu-grant-quota-controls.test.ts +0 -525
- package/tests/gpu-grant-retirement.test.ts +0 -413
- package/tests/gpu-import-observation.test.ts +0 -472
- package/tests/gpu-integration.test.ts +0 -479
- package/tests/gpu-label-native.test.ts +0 -8
- package/tests/gpu-label-native.ts +0 -37
- package/tests/gpu-label-replay.test.ts +0 -313
- package/tests/gpu-label-stream.test.ts +0 -135
- package/tests/gpu-launch-retention.test.ts +0 -134
- package/tests/gpu-loading-browser.ts +0 -54
- package/tests/gpu-loading.test.ts +0 -97
- package/tests/gpu-malformed-browser.ts +0 -522
- package/tests/gpu-malformed-controls.test.ts +0 -720
- package/tests/gpu-measure.test.ts +0 -281
- package/tests/gpu-native-browser-runner.ts +0 -48
- package/tests/gpu-native-controls.test.ts +0 -181
- package/tests/gpu-native-controls.ts +0 -117
- package/tests/gpu-ownership-browser.ts +0 -642
- package/tests/gpu-ownership-controls.test.ts +0 -373
- package/tests/gpu-payload-pressure-browser.ts +0 -1142
- package/tests/gpu-payload-pressure-controls.test.ts +0 -974
- package/tests/gpu-payload-settlement.test.ts +0 -323
- package/tests/gpu-peer-input.test.ts +0 -98
- package/tests/gpu-reader-terminal.test.ts +0 -194
- package/tests/gpu-regrant-browser.ts +0 -861
- package/tests/gpu-regrant-controls.test.ts +0 -680
- package/tests/gpu-replay.test.ts +0 -511
- package/tests/gpu-ring-snapshot.test.ts +0 -53
- package/tests/gpu-ring.test.ts +0 -497
- package/tests/gpu-scene-fixture.test.ts +0 -272
- package/tests/gpu-scene-native.test.ts +0 -14
- package/tests/gpu-scene-native.ts +0 -36
- package/tests/gpu-scene-replay.test.ts +0 -678
- package/tests/gpu-scene-stream.test.ts +0 -112
- package/tests/gpu-service-bootstrap.test.ts +0 -61
- package/tests/gpu-service-failure-browser.ts +0 -792
- package/tests/gpu-service-failure-controls.test.ts +0 -1035
- package/tests/gpu-service-failure-ordering.test.ts +0 -105
- package/tests/gpu-service-readers.test.ts +0 -247
- package/tests/gpu-stream.test.ts +0 -338
- package/tests/gpu-surface-transfer.test.ts +0 -855
- package/tests/gpu-transport.test.ts +0 -311
- package/tests/gpu-worker-bundle.test.ts +0 -31
- package/tests/group-futex-browser-runner.ts +0 -150
- package/tests/group-futex-browser.ts +0 -141
- package/tests/group-futex.test.ts +0 -798
- package/tests/guarded-stream-nonblock.test.ts +0 -130
- package/tests/guest-watch-browser-cases.test.ts +0 -24
- package/tests/guest-watch-browser-cases.ts +0 -271
- package/tests/guest-watch-browser-runner.ts +0 -66
- package/tests/host-interface.test.ts +0 -115
- package/tests/host.test.ts +0 -349
- package/tests/http1-buffer-boundaries.test.ts +0 -102
- package/tests/http1-framing-limits.test.ts +0 -419
- package/tests/imports.test.ts +0 -92
- package/tests/indexeddb-checkpoint-decode-browser.ts +0 -232
- package/tests/indexeddb-checkpoint-decode.test.ts +0 -32
- package/tests/indexeddb-chunks-browser-runner.ts +0 -39
- package/tests/indexeddb-chunks-browser.ts +0 -841
- package/tests/indexeddb-chunks.test.ts +0 -57
- package/tests/indexeddb-publication-browser.ts +0 -458
- package/tests/indexeddb-publication.test.ts +0 -89
- package/tests/inherited-fd-review.test.ts +0 -362
- package/tests/inherited-fd.test.ts +0 -82
- package/tests/installer-symlinks-alias.test.ts +0 -266
- package/tests/installer-symlinks-borrow.test.ts +0 -451
- package/tests/installer-symlinks-codec.test.ts +0 -117
- package/tests/installer-symlinks-creation.test.ts +0 -369
- package/tests/installer-symlinks-final-components.test.ts +0 -392
- package/tests/installer-symlinks-history.test.ts +0 -155
- package/tests/installer-symlinks-metadata-types.ts +0 -32
- package/tests/installer-symlinks-metadata.test.ts +0 -140
- package/tests/installer-symlinks-persistence.test.ts +0 -120
- package/tests/installer-symlinks-readlink.test.ts +0 -444
- package/tests/installer-symlinks-service.test.ts +0 -125
- package/tests/installer-symlinks-tree.test.ts +0 -88
- package/tests/installer-symlinks.test.ts +0 -251
- package/tests/interrupt-admitted-browser-runner.ts +0 -290
- package/tests/interrupt-admitted-browser.ts +0 -167
- package/tests/interrupt-admitted-fixture.ts +0 -44
- package/tests/interrupt-admitted-loader.test.ts +0 -324
- package/tests/interrupt-admitted-store.test.ts +0 -195
- package/tests/interrupt-browser-benchmark.ts +0 -208
- package/tests/interrupt-browser-control.ts +0 -55
- package/tests/interrupt-browser-fixtures.test.ts +0 -40
- package/tests/interrupt-browser-runner.test.ts +0 -125
- package/tests/interrupt-browser.ts +0 -251
- package/tests/interrupt-cache-storage-fixture.ts +0 -58
- package/tests/interrupt-check.test.ts +0 -47
- package/tests/interrupt-loader-cache.test.ts +0 -383
- package/tests/interrupt-loader.test.ts +0 -111
- package/tests/interrupt-rewriter-exports.test.ts +0 -11
- package/tests/interrupt-rewriter.test.ts +0 -740
- package/tests/interrupt-standard-eh.test.ts +0 -293
- package/tests/interrupt-transform-pin.test.ts +0 -16
- package/tests/interrupt-wait-profile.test.ts +0 -126
- package/tests/interrupt-wait.test.ts +0 -328
- package/tests/intrinsics-boundary.test.ts +0 -377
- package/tests/isolated-page-runner.ts +0 -186
- package/tests/libc-tooling.test.ts +0 -313
- package/tests/link-browser-runner.ts +0 -167
- package/tests/link-browser.ts +0 -61
- package/tests/link-initialization.test.ts +0 -344
- package/tests/link-member-workers.test.ts +0 -83
- package/tests/link-program.test.ts +0 -1642
- package/tests/link-quickjs-worker.ts +0 -140
- package/tests/link-quickjs.test.ts +0 -83
- package/tests/link-relay-browser.ts +0 -94
- package/tests/link-shared-basic512-fixture.ts +0 -48
- package/tests/link-shared-basic512.test.ts +0 -129
- package/tests/loopback-fetch-bun-consumer.test.ts +0 -121
- package/tests/loopback-fetch-compression.test.ts +0 -204
- package/tests/loopback-fetch-fixture.ts +0 -128
- package/tests/loopback-fetch-redirect.test.ts +0 -321
- package/tests/loopback-fetch-worker.ts +0 -115
- package/tests/memory-budget.test.ts +0 -952
- package/tests/memory-group-browser-runner.ts +0 -123
- package/tests/memory-group-browser.ts +0 -649
- package/tests/memory-group-cap.test.ts +0 -200
- package/tests/memory-group-exit-lock.test.ts +0 -325
- package/tests/memory-group-grow.test.ts +0 -151
- package/tests/memory-group-link.test.ts +0 -485
- package/tests/memory-group-pin-port.test.ts +0 -170
- package/tests/memory-group-pin.test.ts +0 -275
- package/tests/memory-group-review.test.ts +0 -286
- package/tests/memory-group-stack-worker.ts +0 -94
- package/tests/memory-group-state.test.ts +0 -537
- package/tests/memory-reservations.test.ts +0 -804
- package/tests/memory-views.test.ts +0 -168
- package/tests/metadata-directory-contract-r173.test.ts +0 -307
- package/tests/metadata-nlink-r173.test.ts +0 -201
- package/tests/metadata-readdir-r173.test.ts +0 -126
- package/tests/metadata-worker-completion.test.ts +0 -29
- package/tests/namespace-cursor.test.ts +0 -470
- package/tests/namespace-projection-memory-budget.test.ts +0 -250
- package/tests/namespace-projection-owner.test.ts +0 -880
- package/tests/namespace-projection-table.test.ts +0 -1598
- package/tests/nested-wasi.test.ts +0 -7
- package/tests/net-host-watch.test.ts +0 -236
- package/tests/net-transport-metadata.test.ts +0 -81
- package/tests/network-activation-browser.ts +0 -71
- package/tests/network-address.test.ts +0 -412
- package/tests/network-browser-runner.ts +0 -21
- package/tests/network-browser-service-worker.ts +0 -19
- package/tests/network-browser-worker.ts +0 -147
- package/tests/network-browser.test.ts +0 -22
- package/tests/network-browser.ts +0 -679
- package/tests/network-budget.test.ts +0 -103
- package/tests/network-command-controls.ts +0 -87
- package/tests/network-command.test.ts +0 -253
- package/tests/network-command.ts +0 -274
- package/tests/network-control-page.ts +0 -32
- package/tests/network-desktop-driver.ts +0 -66
- package/tests/network-failure-control.ts +0 -332
- package/tests/network-failure.test.ts +0 -14
- package/tests/network-finalizer.test.ts +0 -61
- package/tests/network-finalizer.ts +0 -17
- package/tests/network-flow-cases.ts +0 -146
- package/tests/network-flow-control.test.ts +0 -43
- package/tests/network-growth-control.ts +0 -18
- package/tests/network-growth.test.ts +0 -27
- package/tests/network-lazy.test.ts +0 -260
- package/tests/network-lookup-consumer.test.ts +0 -193
- package/tests/network-lookup-handles.test.ts +0 -527
- package/tests/network-lookup-node.test.ts +0 -32
- package/tests/network-lookup-worker.ts +0 -83
- package/tests/network-lookup.test.ts +0 -134
- package/tests/network-module-host.test.ts +0 -263
- package/tests/network-module.test.ts +0 -76
- package/tests/network-namespace.test.ts +0 -562
- package/tests/network-outbound.test.ts +0 -786
- package/tests/network-page-contract.ts +0 -24
- package/tests/network-page-inputs.ts +0 -79
- package/tests/network-page-suite.ts +0 -183
- package/tests/network-page.ts +0 -14
- package/tests/network-path-scope.test.ts +0 -93
- package/tests/network-relay-browser-runner.ts +0 -10
- package/tests/network-relay-browser.ts +0 -384
- package/tests/network-relay-contract.ts +0 -35
- package/tests/network-relay-fixture.ts +0 -249
- package/tests/network-relay-modules.ts +0 -21
- package/tests/network-relay-page.ts +0 -10
- package/tests/network-relay-runner.test.ts +0 -171
- package/tests/network-relay-worker.ts +0 -137
- package/tests/network-resource-control.ts +0 -73
- package/tests/network-ring-wake.test.ts +0 -186
- package/tests/network-safari-websocket.test.ts +0 -272
- package/tests/network-sentinel-assets.ts +0 -6
- package/tests/network-signal-control.test.ts +0 -8
- package/tests/network-signal-control.ts +0 -101
- package/tests/network-signal-controls.ts +0 -52
- package/tests/network-size.test.ts +0 -22
- package/tests/network-source-parity.test.ts +0 -95
- package/tests/network-source-parity.ts +0 -240
- package/tests/network-unix-fs.test.ts +0 -297
- package/tests/network-unix-guest.ts +0 -41
- package/tests/network-unix-races.test.ts +0 -370
- package/tests/network-unix-support.ts +0 -93
- package/tests/network-unix.test.ts +0 -600
- package/tests/network-wire.test.ts +0 -198
- package/tests/network-worker-peer.ts +0 -88
- package/tests/node-exports.test.ts +0 -258
- package/tests/node-wasi-descriptors.test.ts +0 -32
- package/tests/notification-admission.test.ts +0 -51
- package/tests/notification-browser-runner.ts +0 -92
- package/tests/notification-command.test.ts +0 -130
- package/tests/notification-command.ts +0 -230
- package/tests/notification-fairness-browser-runner.ts +0 -66
- package/tests/notification-fairness-cases.ts +0 -327
- package/tests/notification-lifetime-cases.ts +0 -457
- package/tests/notification-mixed-cases.ts +0 -220
- package/tests/notification-race-browser-runner.ts +0 -26
- package/tests/notification-race-cases.ts +0 -54
- package/tests/notification-relay-retention.test.ts +0 -133
- package/tests/notification-wait.test.ts +0 -100
- package/tests/operation-diagnostics-browser.ts +0 -192
- package/tests/operation-diagnostics.test.ts +0 -291
- package/tests/opfs-close-browser-observer.test.ts +0 -319
- package/tests/opfs-close-browser-runner.ts +0 -434
- package/tests/opfs-close-browser.ts +0 -113
- package/tests/opfs-close.test.ts +0 -504
- package/tests/opfs-range-browser-runner.ts +0 -86
- package/tests/opfs-range-browser.ts +0 -202
- package/tests/opfs-range.test.ts +0 -331
- package/tests/opfs-snapshot.test.ts +0 -224
- package/tests/owned-job-cleanup.test.ts +0 -1167
- package/tests/owner-freeze-browser-runner.ts +0 -571
- package/tests/owner-freeze-browser.ts +0 -226
- package/tests/packaging.test.ts +0 -278
- package/tests/page-runner/aggregate-error-fixture.ts +0 -18
- package/tests/page-runner/asset-hold-control-page.ts +0 -7
- package/tests/page-runner/asset-hold-controls.ts +0 -132
- package/tests/page-runner/asset-owner.test.ts +0 -635
- package/tests/page-runner/bootstrap-arrival-browser.test.ts +0 -139
- package/tests/page-runner/bootstrap-arrival.test.ts +0 -344
- package/tests/page-runner/bootstrap-control.ts +0 -19
- package/tests/page-runner/bootstrap-diagnostics.test.ts +0 -133
- package/tests/page-runner/browser-controls-process-fixture.ts +0 -112
- package/tests/page-runner/browser-controls-runner.test.ts +0 -380
- package/tests/page-runner/browser-controls-runner.ts +0 -130
- package/tests/page-runner/browser-controls-suite.ts +0 -443
- package/tests/page-runner/browser-observation.test.ts +0 -448
- package/tests/page-runner/collector-policy.test.ts +0 -216
- package/tests/page-runner/collector.test.ts +0 -429
- package/tests/page-runner/command-controls.ts +0 -334
- package/tests/page-runner/command-fixtures.ts +0 -46
- package/tests/page-runner/command-host.test.ts +0 -167
- package/tests/page-runner/command-observation.test.ts +0 -358
- package/tests/page-runner/command-page.ts +0 -21
- package/tests/page-runner/command-suites.ts +0 -142
- package/tests/page-runner/console-control-page.ts +0 -33
- package/tests/page-runner/console-control-worker.ts +0 -14
- package/tests/page-runner/console-controls.ts +0 -174
- package/tests/page-runner/console-first-line-worker.ts +0 -2
- package/tests/page-runner/console-late-control-page.ts +0 -25
- package/tests/page-runner/console-late-control.test.ts +0 -214
- package/tests/page-runner/console-late-control.ts +0 -398
- package/tests/page-runner/console-lifecycle.test.ts +0 -139
- package/tests/page-runner/console-observation.test.ts +0 -73
- package/tests/page-runner/consumer-control-chunk.ts +0 -1
- package/tests/page-runner/consumer-control-page.ts +0 -147
- package/tests/page-runner/consumer-control-worker.ts +0 -4
- package/tests/page-runner/consumer-controls.ts +0 -345
- package/tests/page-runner/consumer-entry.test.ts +0 -856
- package/tests/page-runner/continuity-lock-browser.test.ts +0 -29
- package/tests/page-runner/continuity-lock-control-page.ts +0 -430
- package/tests/page-runner/continuity-lock-diagnostic.test.ts +0 -122
- package/tests/page-runner/control-run.test.ts +0 -112
- package/tests/page-runner/control-run.ts +0 -44
- package/tests/page-runner/cross-tab-evaluator.ts +0 -162
- package/tests/page-runner/cross-tab-value.ts +0 -59
- package/tests/page-runner/document-retirement.test.ts +0 -288
- package/tests/page-runner/driver-observation-cleanup.test.ts +0 -63
- package/tests/page-runner/driver-observation-diagnostics.test.ts +0 -93
- package/tests/page-runner/error-context.test.ts +0 -95
- package/tests/page-runner/fake-driver.ts +0 -192
- package/tests/page-runner/filesystem-transport-browser.test.ts +0 -75
- package/tests/page-runner/filesystem-transport-native.ts +0 -13
- package/tests/page-runner/filesystem-transport-observation.ts +0 -65
- package/tests/page-runner/filesystem-transport-page.ts +0 -48
- package/tests/page-runner/filesystem-transport-suite.test.ts +0 -310
- package/tests/page-runner/filesystem-transport-suite.ts +0 -127
- package/tests/page-runner/fixture-admission.test.ts +0 -167
- package/tests/page-runner/fixture-capability-control-page.ts +0 -24
- package/tests/page-runner/fixture-capability-controls.ts +0 -189
- package/tests/page-runner/fixture-host.test.ts +0 -524
- package/tests/page-runner/fixture-owner.test.ts +0 -176
- package/tests/page-runner/fixtures/large-assertion.ts +0 -21
- package/tests/page-runner/framework-collector.test.ts +0 -277
- package/tests/page-runner/framework-controls/installed.ts +0 -433
- package/tests/page-runner/framework-dom-controls.ts +0 -685
- package/tests/page-runner/framework-dom-page.ts +0 -136
- package/tests/page-runner/framework-final-ack.test.ts +0 -79
- package/tests/page-runner/framework-host.test.ts +0 -443
- package/tests/page-runner/framework-middleware.test.ts +0 -85
- package/tests/page-runner/framework-queue.test.ts +0 -405
- package/tests/page-runner/framework-reporting.test.ts +0 -451
- package/tests/page-runner/framework-trace-host.test.ts +0 -106
- package/tests/page-runner/framework-trace-regression.test.ts +0 -300
- package/tests/page-runner/framework-trace.test.ts +0 -793
- package/tests/page-runner/framework-validation.test.ts +0 -52
- package/tests/page-runner/framework-verdict.test.ts +0 -259
- package/tests/page-runner/gpu-async-controls-runner.ts +0 -108
- package/tests/page-runner/gpu-async-failure-controls.ts +0 -93
- package/tests/page-runner/gpu-async-native.ts +0 -6
- package/tests/page-runner/gpu-async-operations.ts +0 -49
- package/tests/page-runner/gpu-async-page.ts +0 -14
- package/tests/page-runner/gpu-async-request.ts +0 -3
- package/tests/page-runner/gpu-async-suite.test.ts +0 -189
- package/tests/page-runner/gpu-async-suite.ts +0 -120
- package/tests/page-runner/guest-watch-command.ts +0 -11
- package/tests/page-runner/guest-watch-control-phases.ts +0 -20
- package/tests/page-runner/guest-watch-controls-runner.ts +0 -134
- package/tests/page-runner/guest-watch-stalled-helper.ts +0 -5
- package/tests/page-runner/host-drive-control-page.ts +0 -90
- package/tests/page-runner/host-drive-controls.test.ts +0 -91
- package/tests/page-runner/host-drive-controls.ts +0 -318
- package/tests/page-runner/host-drive.test.ts +0 -2222
- package/tests/page-runner/host-page.test.ts +0 -58
- package/tests/page-runner/host-storage-control-page.ts +0 -182
- package/tests/page-runner/host-storage-control-worker.ts +0 -11
- package/tests/page-runner/host-storage-controls.ts +0 -313
- package/tests/page-runner/host.test.ts +0 -133
- package/tests/page-runner/inspector-endpoint.test.ts +0 -236
- package/tests/page-runner/inspector-stream.test.ts +0 -149
- package/tests/page-runner/key-press-control-page.ts +0 -17
- package/tests/page-runner/key-press-controls-native.ts +0 -7
- package/tests/page-runner/key-press-controls.ts +0 -78
- package/tests/page-runner/key-press-fixture.ts +0 -109
- package/tests/page-runner/key-press-observation.ts +0 -129
- package/tests/page-runner/key-press-suite.ts +0 -138
- package/tests/page-runner/large-reporting.test.ts +0 -351
- package/tests/page-runner/lifecycle-queue.test.ts +0 -186
- package/tests/page-runner/memory-group-command.test.ts +0 -227
- package/tests/page-runner/memory-group-command.ts +0 -80
- package/tests/page-runner/memory-group-control-page.ts +0 -7
- package/tests/page-runner/memory-group-controls-runner.ts +0 -126
- package/tests/page-runner/native-cli.test.ts +0 -86
- package/tests/page-runner/native-failure.test.ts +0 -396
- package/tests/page-runner/notification-host.test.ts +0 -264
- package/tests/page-runner/notification-native.ts +0 -6
- package/tests/page-runner/peer-collector.test.ts +0 -356
- package/tests/page-runner/peer-control-page.ts +0 -33
- package/tests/page-runner/peer-controls.ts +0 -249
- package/tests/page-runner/peer-driver-fixture.test.ts +0 -219
- package/tests/page-runner/peer-driver-fixture.ts +0 -257
- package/tests/page-runner/peer-host.test.ts +0 -248
- package/tests/page-runner/peer-probe.test.ts +0 -131
- package/tests/page-runner/peer-storage-control-page.ts +0 -51
- package/tests/page-runner/peer-storage-controls.ts +0 -116
- package/tests/page-runner/playwright-driver.test.ts +0 -270
- package/tests/page-runner/prepared-assets.test.ts +0 -91
- package/tests/page-runner/process-recycling-assets.ts +0 -34
- package/tests/page-runner/process-recycling-controls-page.ts +0 -27
- package/tests/page-runner/process-recycling-controls.test.ts +0 -70
- package/tests/page-runner/process-recycling-controls.ts +0 -134
- package/tests/page-runner/process-recycling-error-control-worker.ts +0 -2
- package/tests/page-runner/process-recycling-fs-control-worker.ts +0 -3
- package/tests/page-runner/process-recycling-native.ts +0 -46
- package/tests/page-runner/process-recycling-page.ts +0 -24
- package/tests/page-runner/process-recycling-storage-control.ts +0 -11
- package/tests/page-runner/process-recycling-suite.test.ts +0 -202
- package/tests/page-runner/process-recycling-suite.ts +0 -38
- package/tests/page-runner/publication-bootstrap.ts +0 -65
- package/tests/page-runner/publication-cross-tab-browser.test.ts +0 -68
- package/tests/page-runner/publication-cross-tab-host.ts +0 -211
- package/tests/page-runner/publication-cross-tab-native.ts +0 -6
- package/tests/page-runner/publication-cross-tab-page.ts +0 -24
- package/tests/page-runner/publication-cross-tab-suite.test.ts +0 -181
- package/tests/page-runner/publication-cross-tab-suite.ts +0 -87
- package/tests/page-runner/publication-native.ts +0 -11
- package/tests/page-runner/publication-page.ts +0 -46
- package/tests/page-runner/publication-suite.test.ts +0 -100
- package/tests/page-runner/publication-suite.ts +0 -99
- package/tests/page-runner/report-chunks.test.ts +0 -295
- package/tests/page-runner/reporter-control-failure.test.ts +0 -119
- package/tests/page-runner/reporter-control-page.ts +0 -101
- package/tests/page-runner/reporter.test.ts +0 -237
- package/tests/page-runner/reporting-cleanup.test.ts +0 -118
- package/tests/page-runner/reporting-contract.test.ts +0 -242
- package/tests/page-runner/reporting-fixture.ts +0 -130
- package/tests/page-runner/reporting-host.test.ts +0 -149
- package/tests/page-runner/reporting-realm.ts +0 -4
- package/tests/page-runner/reporting-types.ts +0 -22
- package/tests/page-runner/retained-worker-control-page.ts +0 -23
- package/tests/page-runner/retained-worker-controls.ts +0 -107
- package/tests/page-runner/root-continuity-allocation.ts +0 -21
- package/tests/page-runner/root-continuity-control-fixture.ts +0 -11
- package/tests/page-runner/root-continuity-controls.ts +0 -237
- package/tests/page-runner/root-continuity-gate-page.ts +0 -94
- package/tests/page-runner/root-continuity-page.ts +0 -48
- package/tests/page-runner/root-continuity-suite.test.ts +0 -290
- package/tests/page-runner/root-continuity-suite.ts +0 -102
- package/tests/page-runner/safari-driver-log.test.ts +0 -202
- package/tests/page-runner/safari-driver.test.ts +0 -474
- package/tests/page-runner/safari-error.test.ts +0 -61
- package/tests/page-runner/safari-navigation.test.ts +0 -220
- package/tests/page-runner/safari-observer.test.ts +0 -868
- package/tests/page-runner/safari-session-startup.test.ts +0 -139
- package/tests/page-runner/safe-staging-allocation.ts +0 -19
- package/tests/page-runner/safe-staging-control-page.ts +0 -58
- package/tests/page-runner/safe-staging-controls-runner.ts +0 -53
- package/tests/page-runner/safe-staging-page.ts +0 -27
- package/tests/page-runner/safe-staging-suite.ts +0 -70
- package/tests/page-runner/safe-staging.test.ts +0 -145
- package/tests/page-runner/stall-diagnostics.test.ts +0 -380
- package/tests/page-runner/storage-control-page.ts +0 -124
- package/tests/page-runner/storage-control-worker.ts +0 -36
- package/tests/page-runner/storage-page-control-worker.ts +0 -15
- package/tests/page-runner/storage-worker.test.ts +0 -30
- package/tests/page-runner/suite-query.test.ts +0 -164
- package/tests/page-runner/suite-startup.test.ts +0 -102
- package/tests/page-runner/threads-runtime-browser.test.ts +0 -68
- package/tests/page-runner/threads-runtime-native.ts +0 -31
- package/tests/page-runner/threads-runtime-page.ts +0 -19
- package/tests/page-runner/threads-runtime-suite.test.ts +0 -245
- package/tests/page-runner/threads-runtime-suite.ts +0 -162
- package/tests/page-runner/worker-allocation.test.ts +0 -161
- package/tests/page-runner/worker-capability-control-page.ts +0 -91
- package/tests/page-runner/worker-capability-controls.ts +0 -394
- package/tests/page-runner/worker-close-query.test.ts +0 -229
- package/tests/page-runner/worker-lifecycle-browser.test.ts +0 -104
- package/tests/page-runner/worker-lifecycle-control-page.ts +0 -18
- package/tests/persistence-close.test.ts +0 -359
- package/tests/persistence-durability.test.ts +0 -588
- package/tests/persistence-queue.test.ts +0 -324
- package/tests/persistence.test.ts +0 -788
- package/tests/persistent-authority-browser-runner.ts +0 -518
- package/tests/persistent-authority-browser.ts +0 -25
- package/tests/persistent-authority-report.test.ts +0 -216
- package/tests/persistent-authority-report.ts +0 -81
- package/tests/persistent-lifecycle-r2-browser-runner.ts +0 -503
- package/tests/persistent-lifecycle-r2-page.ts +0 -248
- package/tests/persistent-lifecycle-r2.test.ts +0 -114
- package/tests/persistent-native-inspection.test.ts +0 -254
- package/tests/persistent-native-inspection.ts +0 -179
- package/tests/persistent-ready.test.ts +0 -54
- package/tests/persistent-resident-owner.test.ts +0 -612
- package/tests/pinned-truncate.test.ts +0 -137
- package/tests/pipe-description-flags.test.ts +0 -29
- package/tests/pipe-filestat-browser.ts +0 -182
- package/tests/pipe-filestat.test.ts +0 -157
- package/tests/pipe-persistent-lifetime.test.ts +0 -134
- package/tests/pipe-reader-lifetime.test.ts +0 -46
- package/tests/pipe-reader-reuse-races.test.ts +0 -228
- package/tests/pipe-registry-allocator.test.ts +0 -35
- package/tests/pipe-reuse-worker.test.ts +0 -112
- package/tests/pipe-shared-allocator.test.ts +0 -170
- package/tests/pipe-slot-reuse.test.ts +0 -500
- package/tests/pipes.test.ts +0 -1669
- package/tests/preopen-placement.test.ts +0 -236
- package/tests/prepared-platform-boundary.test.ts +0 -26
- package/tests/preview-host-reference.test.ts +0 -51
- package/tests/preview-host-reference.ts +0 -155
- package/tests/preview-host.test.ts +0 -875
- package/tests/preview-network-fixture.ts +0 -150
- package/tests/preview-upgrade-lifetime.test.ts +0 -123
- package/tests/preview-upgrade.test.ts +0 -277
- package/tests/preview-vite.test.ts +0 -296
- package/tests/preview.test.ts +0 -406
- package/tests/preview1-listener-browser.ts +0 -136
- package/tests/preview1-listener-lifecycle.test.ts +0 -55
- package/tests/preview1-listener-module.ts +0 -12
- package/tests/preview1-listener.test.ts +0 -430
- package/tests/preview1-network-launch.test.ts +0 -251
- package/tests/preview1-network-lifetime.test.ts +0 -71
- package/tests/preview1-socket-libc.test.ts +0 -65
- package/tests/preview1-socket-support.ts +0 -213
- package/tests/preview1-socket.test.ts +0 -506
- package/tests/preview1-worker-entry.test.ts +0 -42
- package/tests/preview1-worker-startup.test.ts +0 -74
- package/tests/process-abi.test.ts +0 -1568
- package/tests/process-access.test.ts +0 -653
- package/tests/process-admission.test.ts +0 -413
- package/tests/process-cell-clone-browser.test.ts +0 -24
- package/tests/process-cell-clone-browser.ts +0 -239
- package/tests/process-cell-clone.test.ts +0 -39
- package/tests/process-control.test.ts +0 -166
- package/tests/process-core.test.ts +0 -1528
- package/tests/process-cwd.test.ts +0 -237
- package/tests/process-directory-rejection.test.ts +0 -149
- package/tests/process-entry.test.ts +0 -12
- package/tests/process-execve.test.ts +0 -677
- package/tests/process-host-failure.test.ts +0 -149
- package/tests/process-identity.test.ts +0 -482
- package/tests/process-job.test.ts +0 -504
- package/tests/process-linux-signals.test.ts +0 -535
- package/tests/process-loader-retry.test.ts +0 -137
- package/tests/process-lookup.test.ts +0 -408
- package/tests/process-memory-admission-rollback.test.ts +0 -218
- package/tests/process-navigation-observer.test.ts +0 -362
- package/tests/process-navigation-observer.ts +0 -707
- package/tests/process-observation-boundary.test.ts +0 -103
- package/tests/process-observation-lifecycle.test.ts +0 -279
- package/tests/process-observation-root.test.ts +0 -498
- package/tests/process-observation-standalone.test.ts +0 -236
- package/tests/process-observation.test.ts +0 -243
- package/tests/process-outcome.test.ts +0 -222
- package/tests/process-pipe-recycling.test.ts +0 -336
- package/tests/process-poll-idle.test.ts +0 -345
- package/tests/process-quiescence.test.ts +0 -317
- package/tests/process-recycling-browser-runner.test.ts +0 -385
- package/tests/process-recycling-browser-runner.ts +0 -410
- package/tests/process-recycling-browser.ts +0 -1720
- package/tests/process-replacement.test.ts +0 -1950
- package/tests/process-root-navigation-diagnostic.test.ts +0 -1146
- package/tests/process-root-navigation-diagnostic.ts +0 -1291
- package/tests/process-signal-poll.test.ts +0 -168
- package/tests/process-spawn-diagnostic.test.ts +0 -388
- package/tests/process-spawn-errno.test.ts +0 -265
- package/tests/process-start-browser-runner.ts +0 -90
- package/tests/process-start-browser.ts +0 -181
- package/tests/process-start-diagnostics.test.ts +0 -301
- package/tests/process-start-failed.test.ts +0 -336
- package/tests/process-start-status.test.ts +0 -512
- package/tests/process-startup-review.test.ts +0 -507
- package/tests/process-worker-lifetime.test.ts +0 -125
- package/tests/process-worker-ownership.test.ts +0 -3153
- package/tests/program-admission-metadata.test.ts +0 -131
- package/tests/program-build-tools.test.ts +0 -271
- package/tests/program-host-command-debt.ts +0 -48
- package/tests/program-host-command-fixture.ts +0 -108
- package/tests/program-host-command-signals.test.ts +0 -271
- package/tests/program-host-command-types.test.ts +0 -46
- package/tests/program-host-command.test.ts +0 -688
- package/tests/program-loading-api.test.ts +0 -475
- package/tests/program-manifest-lookup.test.ts +0 -129
- package/tests/program-script-loading.test.ts +0 -174
- package/tests/program-session-example.test.ts +0 -313
- package/tests/program-url-download.test.ts +0 -380
- package/tests/programs-install-termination-debt.ts +0 -146
- package/tests/programs-install-termination.test.ts +0 -51
- package/tests/programs-install.test.ts +0 -388
- package/tests/public-workspace-endurance.test.ts +0 -244
- package/tests/publication-browser-runner.test.ts +0 -27
- package/tests/publication-browser-runner.ts +0 -96
- package/tests/publication-browser.ts +0 -913
- package/tests/publication-channel-observer.test.ts +0 -92
- package/tests/publication-checkpoint-contract.test.ts +0 -306
- package/tests/publication-command.ts +0 -35
- package/tests/publication-cross-tab-assets.ts +0 -38
- package/tests/publication-cross-tab-browser-runner.ts +0 -37
- package/tests/publication-cross-tab-browser.ts +0 -966
- package/tests/publication-cross-tab-command.ts +0 -1003
- package/tests/publication-cross-tab-host.ts +0 -89
- package/tests/publication-cross-tab-inventory.ts +0 -53
- package/tests/publication-durable-metadata.test.ts +0 -507
- package/tests/publication-limits-contract.test.ts +0 -106
- package/tests/publication-memory-accounting.test.ts +0 -575
- package/tests/readiness-stream.test.ts +0 -405
- package/tests/readiness.test.ts +0 -90
- package/tests/recovery-r42-browser-runner.ts +0 -330
- package/tests/recovery-r42.test.ts +0 -23
- package/tests/reservation-waste.test.ts +0 -243
- package/tests/resident-construction.test.ts +0 -663
- package/tests/root-continuity-browser-runner.ts +0 -62
- package/tests/root-continuity-browser.ts +0 -269
- package/tests/root-continuity-command.ts +0 -23
- package/tests/root-continuity-source-parity.test.ts +0 -77
- package/tests/root-continuity.test.ts +0 -196
- package/tests/root-return-gc.test.ts +0 -36
- package/tests/running-member-reuse-browser-runner.ts +0 -123
- package/tests/running-member-reuse-browser.ts +0 -383
- package/tests/runtime-budget-ownership.test.ts +0 -38
- package/tests/runtime-display-fence.test.ts +0 -20
- package/tests/runtime-disposal-signal-order.test.ts +0 -25
- package/tests/runtime-facade.test.ts +0 -2004
- package/tests/runtime-filesystem-close-debt.test.ts +0 -38
- package/tests/runtime-network-fence.test.ts +0 -8
- package/tests/runtime-network.test.ts +0 -456
- package/tests/runtime-process-context.test.ts +0 -349
- package/tests/runtime-request-pool.test.ts +0 -83
- package/tests/runtime-size.test.ts +0 -102
- package/tests/runtime-startup-proof.test.ts +0 -86
- package/tests/runtime-startup.test.ts +0 -299
- package/tests/runtime-terminals.test.ts +0 -496
- package/tests/safe-staging-browser-runner.ts +0 -22
- package/tests/safe-staging-browser.ts +0 -1224
- package/tests/safe-staging-fixture-hooks.test.ts +0 -63
- package/tests/safe-staging-native.test.ts +0 -29
- package/tests/safe-staging-native.ts +0 -32
- package/tests/safe-staging-runner-contract.test.ts +0 -30
- package/tests/safe-staging.test.ts +0 -96
- package/tests/search-executor-browser-runner.ts +0 -34
- package/tests/search-executor-browser.ts +0 -614
- package/tests/search-file-reader.test.ts +0 -58
- package/tests/search-grep-plan.test.ts +0 -364
- package/tests/search-matcher-differential.test.ts +0 -187
- package/tests/search-matcher.test.ts +0 -173
- package/tests/search-operand-plan.test.ts +0 -30
- package/tests/search-program-browser-runner.ts +0 -146
- package/tests/search-program-browser.ts +0 -388
- package/tests/search-rg-plan.test.ts +0 -407
- package/tests/search-run.test.ts +0 -366
- package/tests/search-source.test.ts +0 -129
- package/tests/sender-admission.test.ts +0 -251
- package/tests/shared-caller-admission.test.ts +0 -121
- package/tests/shared-caller-host-exec.test.ts +0 -119
- package/tests/shared-control-pipes.test.ts +0 -37
- package/tests/shared-guest-backing.test.ts +0 -746
- package/tests/shared-memory-admission.test.ts +0 -203
- package/tests/shared-memory-browser-bundle.test.ts +0 -62
- package/tests/shared-memory-input.test.ts +0 -79
- package/tests/shared-reservation-coverage.test.ts +0 -15
- package/tests/spawn-error-context.test.ts +0 -38
- package/tests/stable-memory-reader.test.ts +0 -26
- package/tests/start-command.test.ts +0 -109
- package/tests/start-failure-quiet-browser.ts +0 -333
- package/tests/start-failure-quiet.test.ts +0 -24
- package/tests/startup-diagnostic-browser.ts +0 -192
- package/tests/startup-diagnostic.test.ts +0 -43
- package/tests/startup-pool-browser.ts +0 -173
- package/tests/stop-order-browser-runner.ts +0 -135
- package/tests/stop-order-browser.ts +0 -166
- package/tests/storage-caller-release.test.ts +0 -82
- package/tests/storage-crash-r2-browser.ts +0 -7
- package/tests/storage-crash-r2-indexeddb.ts +0 -307
- package/tests/storage-crash-r2-opfs.ts +0 -224
- package/tests/storage-crash-r2-scheduler.ts +0 -88
- package/tests/storage-crash-r2-state.ts +0 -132
- package/tests/storage-crash-r2.test.ts +0 -109
- package/tests/storage-lock-adapter.test.ts +0 -82
- package/tests/storage-lock-browser-runner.ts +0 -1033
- package/tests/storage-lock-browser.ts +0 -321
- package/tests/storage-lock-cases.ts +0 -157
- package/tests/storage-lock-host.ts +0 -103
- package/tests/storage-lock-observation.ts +0 -60
- package/tests/storage-lock-page.ts +0 -18
- package/tests/storage-lock-peer.ts +0 -132
- package/tests/storage-lock-recovery-worker.ts +0 -60
- package/tests/storage-lock-schedules.ts +0 -375
- package/tests/storage-lock-startup.test.ts +0 -73
- package/tests/storage-navigation-diagnostics.test.ts +0 -548
- package/tests/storage-quota-r2-browser.ts +0 -548
- package/tests/storage-quota-r2-probes.ts +0 -393
- package/tests/storage-quota-r2.test.ts +0 -17
- package/tests/storage-release.test.ts +0 -442
- package/tests/storage-suite-contract.test.ts +0 -15
- package/tests/storage.test.ts +0 -520
- package/tests/symlink-sizing.test.ts +0 -226
- package/tests/terminal-control.test.ts +0 -639
- package/tests/terminal-deadholder.test.ts +0 -631
- package/tests/terminal-gate-wake.test.ts +0 -360
- package/tests/terminal-handoff.test.ts +0 -86
- package/tests/terminal-input.test.ts +0 -332
- package/tests/terminal-interrupt-flush.test.ts +0 -554
- package/tests/terminal-output.test.ts +0 -711
- package/tests/terminal-read-fds.test.ts +0 -153
- package/tests/terminal-resolver-worker.test.ts +0 -125
- package/tests/terminal-session.test.ts +0 -1794
- package/tests/thread-admission.test.ts +0 -151
- package/tests/threads-browser-contract.ts +0 -32
- package/tests/threads-browser-guest-worker.ts +0 -12
- package/tests/threads-browser-page.ts +0 -552
- package/tests/threads-browser-runner.test.ts +0 -83
- package/tests/threads-browser-runner.ts +0 -120
- package/tests/threads-browser-service-worker.ts +0 -116
- package/tests/threads-fdstat-admission.test.ts +0 -64
- package/tests/threads-fdstat-authority-worker.ts +0 -65
- package/tests/threads-fdstat-authority.test.ts +0 -81
- package/tests/threads-fdstat.test.ts +0 -304
- package/tests/threads-fixture-inspect.ts +0 -179
- package/tests/threads-fixture-producer.test.ts +0 -97
- package/tests/threads-guest-fixture.ts +0 -204
- package/tests/threads-guest-lane.test.ts +0 -64
- package/tests/threads-guest-memory.test.ts +0 -283
- package/tests/threads-guest-module.ts +0 -95
- package/tests/threads-guest-rust-runner.test.ts +0 -52
- package/tests/threads-guest-rust-runner.ts +0 -142
- package/tests/threads-guest-worker.ts +0 -50
- package/tests/threads-guest.test.ts +0 -305
- package/tests/threads-lifecycle-module.ts +0 -41
- package/tests/threads-lifecycle-waiter.ts +0 -38
- package/tests/threads-lifecycle.test.ts +0 -416
- package/tests/threads-memory-growth.test.ts +0 -188
- package/tests/threads-random-control.ts +0 -170
- package/tests/threads-random.test.ts +0 -23
- package/tests/threads-runtime-authority-worker.ts +0 -63
- package/tests/threads-runtime-browser-runner.ts +0 -119
- package/tests/threads-runtime-browser.ts +0 -622
- package/tests/threads-runtime-cases.ts +0 -38
- package/tests/threads-runtime-cleanup.test.ts +0 -58
- package/tests/threads-runtime-cleanup.ts +0 -46
- package/tests/threads-runtime-control.ts +0 -13
- package/tests/threads-runtime-failure-control.ts +0 -338
- package/tests/threads-runtime-failures.test.ts +0 -116
- package/tests/threads-runtime-fault-bootstrap.ts +0 -1
- package/tests/threads-runtime-fault-conditions.test.ts +0 -35
- package/tests/threads-runtime-fault-control.ts +0 -394
- package/tests/threads-runtime-fault-service.ts +0 -56
- package/tests/threads-runtime-fd-browser.ts +0 -247
- package/tests/threads-runtime-fd-control.ts +0 -6
- package/tests/threads-runtime-fd-descriptors.test.ts +0 -45
- package/tests/threads-runtime-fd-filesystem.ts +0 -41
- package/tests/threads-runtime-fd-module.ts +0 -102
- package/tests/threads-runtime-fd-service.ts +0 -75
- package/tests/threads-runtime-growth-worker.ts +0 -61
- package/tests/threads-runtime-host.ts +0 -32
- package/tests/threads-runtime-late-read-service.ts +0 -46
- package/tests/threads-runtime-modules.ts +0 -132
- package/tests/threads-runtime-regression-controls.ts +0 -386
- package/tests/threads-runtime-regression-modules.ts +0 -242
- package/tests/threads-runtime-safari-packet.ts +0 -285
- package/tests/threads-runtime-safari-runner.test.ts +0 -173
- package/tests/threads-runtime-safari-runner.ts +0 -270
- package/tests/threads-runtime-service-barrier.ts +0 -56
- package/tests/threads-runtime.test.ts +0 -143
- package/tests/threads-safari-runner.ts +0 -159
- package/tests/threads-service-edge.test.ts +0 -93
- package/tests/threads-service-fixture.ts +0 -117
- package/tests/threads-service-host.ts +0 -103
- package/tests/threads-service.test.ts +0 -305
- package/tests/threads-wait-owner.test.ts +0 -169
- package/tests/vfs-continuation.test.ts +0 -337
- package/tests/vfs-guest-buffer.test.ts +0 -31
- package/tests/vfs-harness.test.ts +0 -414
- package/tests/vfs.test.ts +0 -167
- package/tests/wasi-clocks.test.ts +0 -152
- package/tests/wasi-exit.test.ts +0 -74
- package/tests/wasi-libc.test.ts +0 -272
- package/tests/wasi-nonblock-inheritance.test.ts +0 -109
- package/tests/wasi-nonblock.test.ts +0 -181
- package/tests/wasi-path-memory.test.ts +0 -225
- package/tests/wasi-size-admission.test.ts +0 -227
- package/tests/wasm-start-section.test.ts +0 -39
- package/tests/watch-account.test.ts +0 -603
- package/tests/watch-admission.test.ts +0 -211
- package/tests/watch-committed.test.ts +0 -1068
- package/tests/watch-direct-worker.ts +0 -35
- package/tests/watch-registration-reap.test.ts +0 -129
- package/tests/watch-root-runtime.test.ts +0 -313
- package/tests/webkit-error-output.test.ts +0 -118
- package/tests/worker-access.test.ts +0 -331
- package/tests/worker-final-completion.test.ts +0 -434
- package/tests/worker-memory-bootstrap.test.ts +0 -237
- package/tests/worker-memory-broker.test.ts +0 -666
- package/tests/worker-memory.test.ts +0 -210
- package/tests/worker-pipes.test.ts +0 -993
- package/tests/worker-pool.test.ts +0 -88
- package/tests/worker-selected-signal.test.ts +0 -429
- package/tests/workspace-archive-pulls.test.ts +0 -501
- package/tests/workspace-archive.test.ts +0 -1281
- package/tests/workspace-browser.ts +0 -444
- package/tests/workspace-capacity.test.ts +0 -627
- package/tests/workspace-continuity-browser-runner.ts +0 -664
- package/tests/workspace-continuity-checkpoint.test.ts +0 -101
- package/tests/workspace-continuity.test.ts +0 -196
- package/tests/workspace-export-public.test.ts +0 -154
- package/tests/workspace-export.test.ts +0 -1709
- package/tests/workspace-import-admission.test.ts +0 -409
- package/tests/workspace-root-release.test.ts +0 -112
- package/tests/workspace-safari-browser.ts +0 -239
- package/tests/workspace-safari-guest.ts +0 -38
- package/tests/workspace-safari-local.ts +0 -33
- package/tests/workspace-safari-runner.test.ts +0 -298
- package/tests/workspace-search.test.ts +0 -892
- package/tests/workspace-vfs-read-browser.ts +0 -388
- package/tests/workspace-vfs-read-cold-lifecycle.test.ts +0 -236
- package/tests/workspace-vfs-read-cold-readiness.test.ts +0 -97
- package/tests/workspace-vfs-read-dirty.test.ts +0 -119
- package/tests/workspace-vfs-read-races.test.ts +0 -863
- package/tests/workspace-vfs-read-serials.test.ts +0 -124
- package/tests/workspace-vfs-read-shutdown.test.ts +0 -217
- package/tests/workspace-vfs-read-stream.test.ts +0 -878
- package/tests/workspace-vfs-read.test.ts +0 -758
- package/tests/workspace-vfs.test.ts +0 -785
- package/tooling/check-network-rust.ts +0 -59
- package/tooling/ci-paths.test.ts +0 -1904
- package/tooling/fixtures/page-runner-error-consumer.ts +0 -124
- package/tooling/gpu-coverage.ts +0 -177
- package/tooling/gpu-desktop-measure.ts +0 -100
- package/tooling/gpu-measure-host.ts +0 -59
- package/tooling/gpu-measure.ts +0 -512
- package/tooling/gpu-size.ts +0 -38
- package/tooling/gpu-stream-layout.ts +0 -268
- package/tooling/gpu-stream.ts +0 -951
- package/tooling/network-size.ts +0 -73
- package/tooling/network-source-smoke.ts +0 -86
- package/tooling/network-translator.test.ts +0 -117
- package/tooling/package-inputs.ts +0 -25
- package/tooling/prepare-allocation-reference.ts +0 -32
- package/tooling/private-authority.ts +0 -1445
- package/tooling/quality-probes.ts +0 -101
- package/tooling/runtime-size.ts +0 -42
- package/tooling/shared-reservations.ts +0 -57
- package/tooling/storage-crash-r2-mutations.ts +0 -59
- package/tooling/storage-crash-r2.ts +0 -89
- package/tooling/storage-quota-r2.ts +0 -141
- package/tooling/tarball-smoke.ts +0 -556
- package/tooling/typescript-source.test.ts +0 -38
- package/tooling/typescript-source.ts +0 -47
- package/tooling/vfs-benchmark.ts +0 -903
- package/tooling/vfs-browser.ts +0 -320
- package/tooling/vfs-continuation.ts +0 -313
- package/tooling/vfs-guest.ts +0 -235
- package/tooling/vfs-score-config.ts +0 -64
- package/tooling/vfs-score.ts +0 -406
- package/tooling/vfs-startup.ts +0 -21
- package/tooling/vfs-workloads.ts +0 -382
- package/tooling/workspace-safari-runner.ts +0 -313
- /package/dist/{tests → testing}/error-serialization.js +0 -0
- /package/dist/{tests → testing}/page-runner/bootstrap-diagnostics.js +0 -0
- /package/dist/{tests → testing}/page-runner/bootstrap-navigation.js +0 -0
- /package/dist/{tests → testing}/page-runner/browser-observation.js +0 -0
- /package/dist/{tests → testing}/page-runner/collector-fetch.js +0 -0
- /package/dist/{tests → testing}/page-runner/collector.js +0 -0
- /package/dist/{tests → testing}/page-runner/console-observation.js +0 -0
- /package/dist/{tests → testing}/page-runner/continuity-lock-diagnostic.js +0 -0
- /package/dist/{tests → testing}/page-runner/driver.js +0 -0
- /package/dist/{tests → testing}/page-runner/framework-bootstrap.js +0 -0
- /package/dist/{tests → testing}/page-runner/framework-collector.js +0 -0
- /package/dist/{tests → testing}/page-runner/framework-http-body.js +0 -0
- /package/dist/{tests → testing}/page-runner/framework-middleware.js +0 -0
- /package/dist/{tests → testing}/page-runner/framework-page.js +0 -0
- /package/dist/{tests → testing}/page-runner/framework-queue.js +0 -0
- /package/dist/{tests → testing}/page-runner/framework-trace.js +0 -0
- /package/dist/{tests → testing}/page-runner/framework-validation.js +0 -0
- /package/dist/{tests → testing}/page-runner/framework.js +0 -0
- /package/dist/{tests → testing}/page-runner/inspector-endpoint-receipt.js +0 -0
- /package/dist/{tests → testing}/page-runner/inspector-endpoint.js +0 -0
- /package/dist/{tests → testing}/page-runner/inspector-plist.js +0 -0
- /package/dist/{tests → testing}/page-runner/inspector-stream.js +0 -0
- /package/dist/{tests → testing}/page-runner/owned-consumers.js +0 -0
- /package/dist/{tests → testing}/page-runner/protocol.js +0 -0
- /package/dist/{tests → testing}/page-runner/report-chunks.js +0 -0
- /package/dist/{tests → testing}/page-runner/report-control.js +0 -0
- /package/dist/{tests → testing}/page-runner/report-stream.js +0 -0
- /package/dist/{tests → testing}/page-runner/result-file.js +0 -0
- /package/dist/{tests → testing}/page-runner/safari-console.js +0 -0
- /package/dist/{tests → testing}/page-runner/safari-driver.js +0 -0
- /package/dist/{tests → testing}/page-runner/safari-observer.js +0 -0
- /package/dist/{tests → testing}/page-runner/service-worker-page.js +0 -0
- /package/dist/{tests → testing}/page-runner/stall-diagnostics.js +0 -0
- /package/{tests → testing}/browser-navigation.ts +0 -0
- /package/{tests → testing}/checkpoint-failure-browser.ts +0 -0
- /package/{tests → testing}/error-serialization.ts +0 -0
- /package/{tests → testing}/fixtures/file-times-storage.ts +0 -0
- /package/{tests → testing}/fixtures/file-times.ts +0 -0
- /package/{tests → testing}/fixtures/filesystem-host.ts +0 -0
- /package/{tests → testing}/fixtures/permissions-storage.ts +0 -0
- /package/{tests → testing}/fixtures/storage-lifecycle-fs-prelude.ts +0 -0
- /package/{tests → testing}/fixtures/storage-lifecycle-fs-worker.ts +0 -0
- /package/{tests → testing}/fixtures/workspace-recovery.ts +0 -0
- /package/{tests → testing}/gated-indexeddb.ts +0 -0
- /package/{tests → testing}/idle-workspace-browser.ts +0 -0
- /package/{tests → testing}/idle-workspace-cancellation-browser.ts +0 -0
- /package/{tests → testing}/idle-workspace-fixtures.ts +0 -0
- /package/{tests → testing}/idle-workspace-maintenance-browser.ts +0 -0
- /package/{tests → testing}/idle-workspace-metadata-browser.ts +0 -0
- /package/{tests → testing}/interrupt-browser-runner-control.ts +0 -0
- /package/{tests → testing}/opfs-qualification-browser.ts +0 -0
- /package/{tests → testing}/opfs-storage-browser.ts +0 -0
- /package/{tests → testing}/page-runner/asset-owner.ts +0 -0
- /package/{tests → testing}/page-runner/bootstrap-diagnostics.ts +0 -0
- /package/{tests → testing}/page-runner/bootstrap-navigation.ts +0 -0
- /package/{tests → testing}/page-runner/browser-observation.ts +0 -0
- /package/{tests → testing}/page-runner/collector-fetch.ts +0 -0
- /package/{tests → testing}/page-runner/collector.ts +0 -0
- /package/{tests → testing}/page-runner/console-observation.ts +0 -0
- /package/{tests → testing}/page-runner/consumer-page.ts +0 -0
- /package/{tests → testing}/page-runner/consumer.ts +0 -0
- /package/{tests → testing}/page-runner/continuity-lock-diagnostic.ts +0 -0
- /package/{tests → testing}/page-runner/driver.ts +0 -0
- /package/{tests → testing}/page-runner/fixture-owner.ts +0 -0
- /package/{tests → testing}/page-runner/framework-bootstrap-main.ts +0 -0
- /package/{tests → testing}/page-runner/framework-bootstrap.ts +0 -0
- /package/{tests → testing}/page-runner/framework-collector.ts +0 -0
- /package/{tests → testing}/page-runner/framework-http-body.ts +0 -0
- /package/{tests → testing}/page-runner/framework-middleware.ts +0 -0
- /package/{tests → testing}/page-runner/framework-page.ts +0 -0
- /package/{tests → testing}/page-runner/framework-queue.ts +0 -0
- /package/{tests → testing}/page-runner/framework-trace-page.ts +0 -0
- /package/{tests → testing}/page-runner/framework-trace.ts +0 -0
- /package/{tests → testing}/page-runner/framework-types.ts +0 -0
- /package/{tests → testing}/page-runner/framework-validation.ts +0 -0
- /package/{tests → testing}/page-runner/framework.ts +0 -0
- /package/{tests → testing}/page-runner/host-drive.ts +0 -0
- /package/{tests → testing}/page-runner/host-page.ts +0 -0
- /package/{tests → testing}/page-runner/inspector-endpoint-receipt.ts +0 -0
- /package/{tests → testing}/page-runner/inspector-endpoint.ts +0 -0
- /package/{tests → testing}/page-runner/inspector-plist.ts +0 -0
- /package/{tests → testing}/page-runner/inspector-stream.ts +0 -0
- /package/{tests → testing}/page-runner/json-snapshot.ts +0 -0
- /package/{tests → testing}/page-runner/native.ts +0 -0
- /package/{tests → testing}/page-runner/ordered-reporter.ts +0 -0
- /package/{tests → testing}/page-runner/owned-consumers.ts +0 -0
- /package/{tests → testing}/page-runner/page-main.ts +0 -0
- /package/{tests → testing}/page-runner/playwright-driver.ts +0 -0
- /package/{tests → testing}/page-runner/playwright-observer.ts +0 -0
- /package/{tests → testing}/page-runner/protocol.ts +0 -0
- /package/{tests → testing}/page-runner/report-chunks.ts +0 -0
- /package/{tests → testing}/page-runner/report-control.ts +0 -0
- /package/{tests → testing}/page-runner/report-stream.ts +0 -0
- /package/{tests → testing}/page-runner/reporter.ts +0 -0
- /package/{tests → testing}/page-runner/result-file.ts +0 -0
- /package/{tests → testing}/page-runner/safari-console.ts +0 -0
- /package/{tests → testing}/page-runner/safari-driver.ts +0 -0
- /package/{tests → testing}/page-runner/safari-observer.ts +0 -0
- /package/{tests → testing}/page-runner/service-worker-page.ts +0 -0
- /package/{tests → testing}/page-runner/stall-diagnostics.ts +0 -0
- /package/{tests → testing}/page-runner/storage-cleanup.ts +0 -0
- /package/{tests → testing}/page-runner/storage-host.ts +0 -0
- /package/{tests → testing}/page-runner/storage-page.ts +0 -0
- /package/{tests → testing}/page-runner/storage-policy.ts +0 -0
- /package/{tests → testing}/page-runner/storage-worker.ts +0 -0
- /package/{tests → testing}/page-runner/suite-host.ts +0 -0
- /package/{tests → testing}/process-recycling-browser-runner-control.ts +0 -0
- /package/{tests → testing}/runtime-startup-proof.ts +0 -0
- /package/{tests → testing}/storage-allocation.ts +0 -0
- /package/{tests → testing}/storage-browser-helpers.ts +0 -0
- /package/{tests → testing}/storage-browser-runner.ts +0 -0
- /package/{tests → testing}/storage-browser.ts +0 -0
- /package/{tests → testing}/storage-lifecycle-marker.ts +0 -0
- /package/{tests → testing}/storage-lifecycle-observer.ts +0 -0
- /package/{tests → testing}/storage-navigation-diagnostics.ts +0 -0
- /package/{tests → testing}/storage-open-worker.ts +0 -0
- /package/{tests → testing}/storage-quota-control.ts +0 -0
- /package/{tests → testing}/storage-release-browser.ts +0 -0
- /package/{tests → testing}/webkit-diagnostics.ts +0 -0
|
@@ -1,1950 +0,0 @@
|
|
|
1
|
-
import { expect, test, spyOn } from "bun:test";
|
|
2
|
-
import { BrowserProcessBroker } from "../browser/process-broker.js";
|
|
3
|
-
import { MemoryGroups } from "../group/state.js";
|
|
4
|
-
import {
|
|
5
|
-
GroupOp,
|
|
6
|
-
PAGE_BYTES,
|
|
7
|
-
WAIT_CLOSED,
|
|
8
|
-
WAIT_ADDR,
|
|
9
|
-
WAIT_WIDTH,
|
|
10
|
-
WAIT_EPOCH,
|
|
11
|
-
} from "../group/protocol.js";
|
|
12
|
-
import { groupLinkProgram } from "./fixtures/group-link-program.js";
|
|
13
|
-
import type { LinkedWorkerRequest } from "../link/index.js";
|
|
14
|
-
import type { RuntimeWorkerRequest } from "../browser/worker.js";
|
|
15
|
-
import { DescriptorTable } from "../core/descriptors.js";
|
|
16
|
-
import {
|
|
17
|
-
connectFilesystemIdentity,
|
|
18
|
-
createFilesystemIdentity,
|
|
19
|
-
revokeFilesystem,
|
|
20
|
-
} from "../fs/protocol.js";
|
|
21
|
-
import { enterTerminalSection, leaveTerminalSection } from "../proc/terminal-lifetime.js";
|
|
22
|
-
import { controlLoad } from "../proc/control.js";
|
|
23
|
-
import { beginDirectoryAdmission } from "../proc/directory.js";
|
|
24
|
-
import type { SupervisorOptions } from "../proc/supervisor.js";
|
|
25
|
-
import { readExecCompletion } from "../proc/exec.js";
|
|
26
|
-
import { ProcessIdentityAllocator } from "../proc/identity.js";
|
|
27
|
-
import { captureProcessObserver } from "../proc/observation.js";
|
|
28
|
-
import { readOutcome } from "../proc/outcome.js";
|
|
29
|
-
import { ExecutableRegistry } from "../proc/registry.js";
|
|
30
|
-
import {
|
|
31
|
-
setSignalDisposition,
|
|
32
|
-
SignalDisposition,
|
|
33
|
-
signalDisposition,
|
|
34
|
-
requestSignal,
|
|
35
|
-
} from "../proc/signals.js";
|
|
36
|
-
import { ProcessTable } from "../proc/table.js";
|
|
37
|
-
import {
|
|
38
|
-
ProcessError,
|
|
39
|
-
ProcessErrno,
|
|
40
|
-
type ExecRequest,
|
|
41
|
-
type ProcessContext,
|
|
42
|
-
} from "../proc/types.js";
|
|
43
|
-
import {
|
|
44
|
-
createWorkerProcessTransport,
|
|
45
|
-
WorkerProcessClient,
|
|
46
|
-
workerProcessState,
|
|
47
|
-
workerProcessDirectoryId,
|
|
48
|
-
type WorkerProcessMessage,
|
|
49
|
-
type WorkerProcessTransport,
|
|
50
|
-
} from "../proc/worker-client.js";
|
|
51
|
-
import { WorkerPipeHost } from "../proc/worker-pipes.js";
|
|
52
|
-
import { bytes } from "../memory/reservations.js";
|
|
53
|
-
import { PipePublicationRegistry } from "../proc/pipes.js";
|
|
54
|
-
import { testReservations } from "./fixtures/shared-memory-platform.js";
|
|
55
|
-
|
|
56
|
-
const module = new WebAssembly.Module(new Uint8Array([0, 97, 115, 109, 1, 0, 0, 0]));
|
|
57
|
-
const request = (overrides: Partial<ExecRequest> = {}): ExecRequest => ({
|
|
58
|
-
executable: "fixture",
|
|
59
|
-
argv: ["next"],
|
|
60
|
-
env: { NEW: "value" },
|
|
61
|
-
cwd: "/next",
|
|
62
|
-
fds: [],
|
|
63
|
-
...overrides,
|
|
64
|
-
});
|
|
65
|
-
function deferred() {
|
|
66
|
-
return Promise.withResolvers<void>();
|
|
67
|
-
}
|
|
68
|
-
async function until(check: () => boolean): Promise<void> {
|
|
69
|
-
const deadline = performance.now() + 2000;
|
|
70
|
-
while (!check()) {
|
|
71
|
-
if (performance.now() > deadline) throw new Error("replacement test deadline");
|
|
72
|
-
await Bun.sleep(1);
|
|
73
|
-
}
|
|
74
|
-
}
|
|
75
|
-
/**
|
|
76
|
-
* The group's terminal seal (settleStopping). A stop closes the stopped member's own wait record
|
|
77
|
-
* at once, so its cell no longer tells whether the seal ran. Test-only reflection.
|
|
78
|
-
*/
|
|
79
|
-
function sealed(
|
|
80
|
-
f: { groups(): MemoryGroups },
|
|
81
|
-
group: Parameters<MemoryGroups["owner"]>[0],
|
|
82
|
-
): boolean {
|
|
83
|
-
return Reflect.get(f.groups().owner(group)!, "admission") === "sealed";
|
|
84
|
-
}
|
|
85
|
-
|
|
86
|
-
async function fixture(
|
|
87
|
-
options: {
|
|
88
|
-
stop?: () => void | Promise<void>;
|
|
89
|
-
quiesce?: () => void | Promise<void>;
|
|
90
|
-
construct?: () => void;
|
|
91
|
-
launch?: (
|
|
92
|
-
context: ProcessContext,
|
|
93
|
-
) =>
|
|
94
|
-
| void
|
|
95
|
-
| import("../proc/types.js").ProcessHandle
|
|
96
|
-
| Promise<import("../proc/types.js").ProcessHandle>;
|
|
97
|
-
hostOnly?: boolean;
|
|
98
|
-
shared?: boolean;
|
|
99
|
-
typed?: boolean;
|
|
100
|
-
processKind?: "process" | "thread";
|
|
101
|
-
acquired?: (context: ProcessContext) => Promise<void>;
|
|
102
|
-
wrap?: (
|
|
103
|
-
handle: import("../proc/types.js").ProcessHandle,
|
|
104
|
-
) => import("../proc/types.js").ProcessHandle;
|
|
105
|
-
} = {},
|
|
106
|
-
) {
|
|
107
|
-
const previous = globalThis.Worker;
|
|
108
|
-
const workers: FakeWorker[] = [];
|
|
109
|
-
const ports: MessagePort[] = [];
|
|
110
|
-
const descriptors: DescriptorTable[] = [];
|
|
111
|
-
const contexts: ProcessContext[] = [];
|
|
112
|
-
const diagnostics: unknown[] = [];
|
|
113
|
-
const reaped: number[] = [];
|
|
114
|
-
class FakeWorker {
|
|
115
|
-
onmessage: ((event: MessageEvent) => void) | null = null;
|
|
116
|
-
onerror: ((event: ErrorEvent) => void) | null = null;
|
|
117
|
-
request!: RuntimeWorkerRequest;
|
|
118
|
-
stops = 0;
|
|
119
|
-
constructor() {
|
|
120
|
-
options.construct?.();
|
|
121
|
-
workers.push(this);
|
|
122
|
-
}
|
|
123
|
-
postMessage(value: RuntimeWorkerRequest) {
|
|
124
|
-
this.request = value;
|
|
125
|
-
}
|
|
126
|
-
terminate() {
|
|
127
|
-
this.stops++;
|
|
128
|
-
return options.stop?.();
|
|
129
|
-
}
|
|
130
|
-
emit(data: unknown) {
|
|
131
|
-
this.onmessage?.({ data } as MessageEvent);
|
|
132
|
-
}
|
|
133
|
-
error() {
|
|
134
|
-
this.onerror?.({ message: "retiring worker failed", preventDefault() {} } as ErrorEvent);
|
|
135
|
-
}
|
|
136
|
-
}
|
|
137
|
-
globalThis.Worker = FakeWorker as unknown as typeof Worker;
|
|
138
|
-
const identities = new ProcessIdentityAllocator();
|
|
139
|
-
const table = new ProcessTable(identities);
|
|
140
|
-
const registry = new ExecutableRegistry();
|
|
141
|
-
const shared = options.shared ? await groupLinkProgram() : undefined;
|
|
142
|
-
registry.register("fixture", {
|
|
143
|
-
adapter: "fixture",
|
|
144
|
-
module: shared?.module ?? module,
|
|
145
|
-
interruptible: true,
|
|
146
|
-
});
|
|
147
|
-
registry.register("host", {
|
|
148
|
-
adapter: "host",
|
|
149
|
-
module,
|
|
150
|
-
execution: Object.freeze({
|
|
151
|
-
kind: "host",
|
|
152
|
-
launch: (context: ProcessContext) => {
|
|
153
|
-
contexts.push(context);
|
|
154
|
-
return options.launch?.(context) ?? { terminate() {} };
|
|
155
|
-
},
|
|
156
|
-
}),
|
|
157
|
-
});
|
|
158
|
-
const reservations = testReservations();
|
|
159
|
-
const broker = new BrowserProcessBroker({
|
|
160
|
-
identities,
|
|
161
|
-
table,
|
|
162
|
-
registry,
|
|
163
|
-
reservations,
|
|
164
|
-
onError: (error) => diagnostics.push(error),
|
|
165
|
-
filesystem: {
|
|
166
|
-
connect(identity) {
|
|
167
|
-
const pair = connectFilesystemIdentity(identity);
|
|
168
|
-
ports.push(pair.client.port, pair.server.port);
|
|
169
|
-
return pair.client;
|
|
170
|
-
},
|
|
171
|
-
revoke: revokeFilesystem,
|
|
172
|
-
reap: (identity) => {
|
|
173
|
-
reaped.push(identity.owner);
|
|
174
|
-
},
|
|
175
|
-
async quiesce() {
|
|
176
|
-
await options.quiesce?.();
|
|
177
|
-
},
|
|
178
|
-
},
|
|
179
|
-
launch(context) {
|
|
180
|
-
if (context.execution?.kind === "host") return context.execution.launch(context);
|
|
181
|
-
contexts.push(context);
|
|
182
|
-
const custom = options.launch?.(context);
|
|
183
|
-
if (custom) return custom;
|
|
184
|
-
if (options.hostOnly) return { terminate() {} };
|
|
185
|
-
const handle = broker.launchWorker(context, {
|
|
186
|
-
workerUrl: "http://localhost/exec-fixture.ts",
|
|
187
|
-
memoryGroup: shared ? "new" : undefined,
|
|
188
|
-
request: {
|
|
189
|
-
module: context.module,
|
|
190
|
-
args: context.request.argv,
|
|
191
|
-
env: context.request.env,
|
|
192
|
-
...(shared ? { linkPlan: shared.linkPlan } : {}),
|
|
193
|
-
},
|
|
194
|
-
});
|
|
195
|
-
const accepted = options.wrap?.(handle) ?? handle;
|
|
196
|
-
return options.acquired ? options.acquired(context).then(() => accepted) : accepted;
|
|
197
|
-
},
|
|
198
|
-
});
|
|
199
|
-
const root = createWorkerProcessTransport({ identity: identities.buffer, capacity: 32 });
|
|
200
|
-
const notices: WorkerProcessMessage[] = [];
|
|
201
|
-
const pipeRegistry = new PipePublicationRegistry({
|
|
202
|
-
wake: workerProcessState(root).wake,
|
|
203
|
-
allocate: (initial, maximum) =>
|
|
204
|
-
reservations.buffer("pipe-registry", {
|
|
205
|
-
kind: "growable-buffer",
|
|
206
|
-
initial,
|
|
207
|
-
maximum: bytes(maximum),
|
|
208
|
-
}),
|
|
209
|
-
});
|
|
210
|
-
pipeRegistry.registerProcess(root.pid);
|
|
211
|
-
const rootHost = new WorkerPipeHost({
|
|
212
|
-
transport: root,
|
|
213
|
-
registry: pipeRegistry,
|
|
214
|
-
postMessage: (message) => notices.push(message),
|
|
215
|
-
});
|
|
216
|
-
root.data = { filesystem: createFilesystemIdentity(), pipeRegistry: rootHost.registry.handle() };
|
|
217
|
-
function client(transport: WorkerProcessTransport) {
|
|
218
|
-
const fds = new DescriptorTable();
|
|
219
|
-
descriptors.push(fds);
|
|
220
|
-
const host = new WorkerPipeHost({
|
|
221
|
-
transport,
|
|
222
|
-
registry: rootHost.registry,
|
|
223
|
-
postMessage: (message) => notices.push(message),
|
|
224
|
-
});
|
|
225
|
-
const service = new WorkerProcessClient({
|
|
226
|
-
transport,
|
|
227
|
-
descriptors: fds,
|
|
228
|
-
codec: host.codec(),
|
|
229
|
-
postMessage: (message) => notices.push(message),
|
|
230
|
-
registerRevocation: () => () => {},
|
|
231
|
-
prepareSpawn(pid) {
|
|
232
|
-
host.registry.registerProcess(pid);
|
|
233
|
-
return {
|
|
234
|
-
data: { filesystem: createFilesystemIdentity(), pipeRegistry: host.registry.handle() },
|
|
235
|
-
};
|
|
236
|
-
},
|
|
237
|
-
prepareExec() {
|
|
238
|
-
return {
|
|
239
|
-
data: { filesystem: createFilesystemIdentity(), pipeRegistry: host.registry.handle() },
|
|
240
|
-
codec: host.codec(undefined, true),
|
|
241
|
-
};
|
|
242
|
-
},
|
|
243
|
-
});
|
|
244
|
-
service.installBindings();
|
|
245
|
-
return { service, fds, host };
|
|
246
|
-
}
|
|
247
|
-
async function flush(sender: number) {
|
|
248
|
-
for (const message of notices.splice(0)) await broker.runtimeMessage(message, sender);
|
|
249
|
-
}
|
|
250
|
-
const parent = client(root);
|
|
251
|
-
await broker.adoptRuntimeRoot(root, { memory: [] });
|
|
252
|
-
const supervisor = await broker.ready();
|
|
253
|
-
const pid = parent.service.spawn(root.pid, {
|
|
254
|
-
...request({ cwd: "/" }),
|
|
255
|
-
job: -1,
|
|
256
|
-
processKind: options.processKind,
|
|
257
|
-
...(options.typed ? { worker: { type: "fixture" } } : {}),
|
|
258
|
-
});
|
|
259
|
-
await flush(root.pid);
|
|
260
|
-
await supervisor.start(pid);
|
|
261
|
-
supervisor.started(pid);
|
|
262
|
-
let caller = client(broker.transportFor(pid)!);
|
|
263
|
-
async function stage(spec = request()) {
|
|
264
|
-
const completion = caller.service.exec(pid, spec);
|
|
265
|
-
await flush(pid);
|
|
266
|
-
await until(() => readExecCompletion(completion) !== null);
|
|
267
|
-
return readExecCompletion(completion)!;
|
|
268
|
-
}
|
|
269
|
-
async function replace(spec = request()) {
|
|
270
|
-
const previousCount = workers.length;
|
|
271
|
-
const retiring = workers.find(
|
|
272
|
-
(worker) => worker.request.runtimeProcess?.pid === pid && worker.stops === 0,
|
|
273
|
-
)!;
|
|
274
|
-
expect((await stage(spec)).result).toBe(0);
|
|
275
|
-
caller.fds.dispose();
|
|
276
|
-
retiring.emit({ type: "replaced" });
|
|
277
|
-
await until(() => workers.length === previousCount + 1);
|
|
278
|
-
await supervisor.start(pid);
|
|
279
|
-
caller = client(workers[workers.length - 1]!.request.runtimeProcess!);
|
|
280
|
-
}
|
|
281
|
-
async function close() {
|
|
282
|
-
try {
|
|
283
|
-
for (const fds of descriptors) fds.dispose();
|
|
284
|
-
await broker.dispose();
|
|
285
|
-
} finally {
|
|
286
|
-
for (const port of ports) port.close();
|
|
287
|
-
globalThis.Worker = previous;
|
|
288
|
-
}
|
|
289
|
-
}
|
|
290
|
-
return {
|
|
291
|
-
broker,
|
|
292
|
-
reservations,
|
|
293
|
-
supervisor,
|
|
294
|
-
table,
|
|
295
|
-
registry,
|
|
296
|
-
pid,
|
|
297
|
-
root,
|
|
298
|
-
parent,
|
|
299
|
-
contexts,
|
|
300
|
-
workers,
|
|
301
|
-
diagnostics,
|
|
302
|
-
notices,
|
|
303
|
-
groups() {
|
|
304
|
-
const groups: unknown = Reflect.get(broker, "groups");
|
|
305
|
-
if (!(groups instanceof MemoryGroups)) throw new Error("expected admitted memory groups");
|
|
306
|
-
return groups;
|
|
307
|
-
},
|
|
308
|
-
reaped,
|
|
309
|
-
client,
|
|
310
|
-
get caller() {
|
|
311
|
-
return caller;
|
|
312
|
-
},
|
|
313
|
-
stage,
|
|
314
|
-
replace,
|
|
315
|
-
flush,
|
|
316
|
-
close,
|
|
317
|
-
};
|
|
318
|
-
}
|
|
319
|
-
|
|
320
|
-
test("an unresolved real adapter defers the stopped group's seal and settles it on acquisition rejection", async () => {
|
|
321
|
-
const pending = Promise.withResolvers<import("../proc/types.js").ProcessHandle>();
|
|
322
|
-
const entered = deferred(),
|
|
323
|
-
stopped = deferred();
|
|
324
|
-
const failure = new Error("earlier acquisition rejected");
|
|
325
|
-
const f = await fixture({
|
|
326
|
-
shared: true,
|
|
327
|
-
stop: () => stopped.promise,
|
|
328
|
-
launch: (context) => {
|
|
329
|
-
if (context.pid !== 2) {
|
|
330
|
-
entered.resolve();
|
|
331
|
-
return pending.promise;
|
|
332
|
-
}
|
|
333
|
-
},
|
|
334
|
-
});
|
|
335
|
-
let starting: Promise<void> | undefined;
|
|
336
|
-
const cells = new Int32Array(f.workers[0]!.request.memoryGroup!.reply);
|
|
337
|
-
const sibling = f.parent.service.spawn(f.root.pid, { ...request({ cwd: "/" }), job: -1 });
|
|
338
|
-
try {
|
|
339
|
-
await f.flush(f.root.pid);
|
|
340
|
-
starting = f.supervisor.start(sibling).catch(() => {});
|
|
341
|
-
await entered.promise;
|
|
342
|
-
const group = f.broker.memoryGroupOf(f.pid)!;
|
|
343
|
-
f.supervisor.kill(f.pid, 9);
|
|
344
|
-
await until(() => f.workers[0]!.stops === 1);
|
|
345
|
-
// The stop closes the stopped member's own wait record (no wake); the group stays open.
|
|
346
|
-
expect(Atomics.load(cells, WAIT_CLOSED)).toBe(1);
|
|
347
|
-
expect(sealed(f, group)).toBe(false);
|
|
348
|
-
const reserved = f.groups().admit(90, workerProcessDirectoryId(f.root), group);
|
|
349
|
-
reserved.abort();
|
|
350
|
-
expect(sealed(f, group)).toBe(false);
|
|
351
|
-
pending.reject(failure);
|
|
352
|
-
await starting;
|
|
353
|
-
// The retry comes from acquisition settlement, not another lease transition or a pump.
|
|
354
|
-
expect(sealed(f, group)).toBe(true);
|
|
355
|
-
expect(() => f.groups().owner(group)!.reserve(91)).toThrow("admission is closed");
|
|
356
|
-
} finally {
|
|
357
|
-
pending.resolve({ terminate() {} });
|
|
358
|
-
stopped.resolve();
|
|
359
|
-
await starting;
|
|
360
|
-
await f.close().catch((error) => {
|
|
361
|
-
expect(error).toBeInstanceOf(AggregateError);
|
|
362
|
-
});
|
|
363
|
-
}
|
|
364
|
-
});
|
|
365
|
-
|
|
366
|
-
test("a pending adapter can still join before the terminal seal, and live siblings receive no stop wake", async () => {
|
|
367
|
-
const pending = Promise.withResolvers<import("../proc/types.js").ProcessHandle>();
|
|
368
|
-
const entered = Promise.withResolvers<ProcessContext>(),
|
|
369
|
-
stopped = deferred();
|
|
370
|
-
const f = await fixture({
|
|
371
|
-
shared: true,
|
|
372
|
-
stop: () => stopped.promise,
|
|
373
|
-
launch: (context) => {
|
|
374
|
-
if (context.pid !== 2) {
|
|
375
|
-
entered.resolve(context);
|
|
376
|
-
return pending.promise;
|
|
377
|
-
}
|
|
378
|
-
},
|
|
379
|
-
});
|
|
380
|
-
const group = f.broker.memoryGroupOf(f.pid)!;
|
|
381
|
-
const cells = new Int32Array(f.workers[0]!.request.memoryGroup!.reply);
|
|
382
|
-
let starting: Promise<void> | undefined;
|
|
383
|
-
try {
|
|
384
|
-
const sibling = f.parent.service.spawn(f.root.pid, { ...request({ cwd: "/" }), job: -1 });
|
|
385
|
-
await f.flush(f.root.pid);
|
|
386
|
-
starting = f.supervisor.start(sibling);
|
|
387
|
-
const context = await entered.promise;
|
|
388
|
-
f.supervisor.kill(f.pid, 9);
|
|
389
|
-
await until(() => f.workers[0]!.stops === 1);
|
|
390
|
-
const handle = f.broker.launchWorker<LinkedWorkerRequest>(context, {
|
|
391
|
-
workerUrl: "http://localhost/later-group.ts",
|
|
392
|
-
memoryGroup: group,
|
|
393
|
-
request: {
|
|
394
|
-
module: context.module,
|
|
395
|
-
args: context.request.argv,
|
|
396
|
-
env: context.request.env,
|
|
397
|
-
linkPlan: Reflect.get(f.workers[0]!.request, "linkPlan"),
|
|
398
|
-
},
|
|
399
|
-
});
|
|
400
|
-
pending.resolve(handle);
|
|
401
|
-
await starting;
|
|
402
|
-
// Only the stopped member's own record is closed; the live sibling's stays open.
|
|
403
|
-
expect(Atomics.load(cells, WAIT_CLOSED)).toBe(1);
|
|
404
|
-
expect(sealed(f, group)).toBe(false);
|
|
405
|
-
const next = new Int32Array(f.workers[1]!.request.memoryGroup!.reply);
|
|
406
|
-
expect(Atomics.load(next, WAIT_CLOSED)).toBe(0);
|
|
407
|
-
f.supervisor.kill(sibling, 9);
|
|
408
|
-
await until(() => f.workers[1]!.stops === 1);
|
|
409
|
-
expect(sealed(f, group)).toBe(true);
|
|
410
|
-
expect(Atomics.load(next, WAIT_CLOSED)).toBe(1);
|
|
411
|
-
const unrelated = f.groups().admit(92, workerProcessDirectoryId(f.root), "new");
|
|
412
|
-
const extra = f.groups().admit(93, workerProcessDirectoryId(f.root), unrelated.group);
|
|
413
|
-
extra.abort();
|
|
414
|
-
unrelated.abort();
|
|
415
|
-
} finally {
|
|
416
|
-
pending.resolve({ terminate() {} });
|
|
417
|
-
stopped.resolve();
|
|
418
|
-
await starting;
|
|
419
|
-
await f.close();
|
|
420
|
-
}
|
|
421
|
-
});
|
|
422
|
-
|
|
423
|
-
for (const mode of ["loader-rejection", "cancel-before-adapter"] as const) {
|
|
424
|
-
test(`${mode} settles an exact earlier acquisition without waiting for its row to be consumed`, async () => {
|
|
425
|
-
const loading = Promise.withResolvers<WebAssembly.Module>();
|
|
426
|
-
const entered = deferred(),
|
|
427
|
-
stopping = deferred(),
|
|
428
|
-
quiescent = deferred();
|
|
429
|
-
const f = await fixture({ shared: true, stop: () => stopping.promise });
|
|
430
|
-
f.registry.register("earlier", {
|
|
431
|
-
adapter: "fixture",
|
|
432
|
-
module: () => {
|
|
433
|
-
entered.resolve();
|
|
434
|
-
return loading.promise;
|
|
435
|
-
},
|
|
436
|
-
});
|
|
437
|
-
const sibling = f.parent.service.spawn(f.root.pid, {
|
|
438
|
-
...request({ executable: "earlier", cwd: "/" }),
|
|
439
|
-
job: -1,
|
|
440
|
-
});
|
|
441
|
-
const group = f.broker.memoryGroupOf(f.pid)!;
|
|
442
|
-
let starting: Promise<void> | undefined;
|
|
443
|
-
try {
|
|
444
|
-
await f.flush(f.root.pid);
|
|
445
|
-
f.supervisor.onProcessQuiescent((event) => {
|
|
446
|
-
if (event.pid === sibling) quiescent.resolve();
|
|
447
|
-
});
|
|
448
|
-
starting = f.supervisor.start(sibling);
|
|
449
|
-
await entered.promise;
|
|
450
|
-
f.supervisor.kill(f.pid, 9);
|
|
451
|
-
await until(() => f.workers[0]!.stops === 1);
|
|
452
|
-
expect(sealed(f, group)).toBe(false);
|
|
453
|
-
if (mode === "loader-rejection") loading.reject(new Error("registry load rejected"));
|
|
454
|
-
else f.supervisor.kill(sibling, 9);
|
|
455
|
-
await quiescent.promise;
|
|
456
|
-
expect(sealed(f, group)).toBe(true);
|
|
457
|
-
expect(f.table.get(sibling)).toBeDefined();
|
|
458
|
-
expect(f.contexts).toHaveLength(1);
|
|
459
|
-
} finally {
|
|
460
|
-
loading.resolve(module);
|
|
461
|
-
stopping.resolve();
|
|
462
|
-
await starting;
|
|
463
|
-
await f.close();
|
|
464
|
-
}
|
|
465
|
-
});
|
|
466
|
-
}
|
|
467
|
-
|
|
468
|
-
for (const mode of ["throw", "reject"] as const) {
|
|
469
|
-
test(`owned child native ${mode} closes before await and preserves backing, holds and capacity debt`, async () => {
|
|
470
|
-
const failure = new Error("native stop failure");
|
|
471
|
-
const f = await fixture({
|
|
472
|
-
shared: true,
|
|
473
|
-
stop: () => {
|
|
474
|
-
if (mode === "throw") throw failure;
|
|
475
|
-
return Promise.reject(failure);
|
|
476
|
-
},
|
|
477
|
-
});
|
|
478
|
-
const request = f.workers[0]!.request.memoryGroup!;
|
|
479
|
-
const cells = new Int32Array(request.reply);
|
|
480
|
-
const words = new Int32Array(request.memory.buffer);
|
|
481
|
-
Atomics.store(cells, WAIT_ADDR, 64);
|
|
482
|
-
Atomics.store(cells, WAIT_WIDTH, 4);
|
|
483
|
-
Atomics.store(cells, WAIT_EPOCH, 1);
|
|
484
|
-
const waiting = Atomics.waitAsync(words, 16, 0);
|
|
485
|
-
const group = f.broker.memoryGroupOf(f.pid)!;
|
|
486
|
-
const owner = f.groups().owner(group)!;
|
|
487
|
-
const lease = f.groups().admit(90, workerProcessDirectoryId(f.root), group);
|
|
488
|
-
lease.abort();
|
|
489
|
-
try {
|
|
490
|
-
f.supervisor.kill(f.pid, 9);
|
|
491
|
-
expect(await waiting.value).toBe("ok");
|
|
492
|
-
await until(() => f.broker.memoryGroups()[0]?.retained === 1);
|
|
493
|
-
expect(Atomics.load(cells, WAIT_CLOSED)).toBe(1);
|
|
494
|
-
expect(owner.snapshot().committedBytes).toBeGreaterThan(0);
|
|
495
|
-
expect(() => owner.reserve(91)).toThrow("admission is closed");
|
|
496
|
-
await expect(f.broker.dispose()).rejects.toBeInstanceOf(AggregateError);
|
|
497
|
-
} finally {
|
|
498
|
-
await f.close().catch(() => {});
|
|
499
|
-
}
|
|
500
|
-
});
|
|
501
|
-
}
|
|
502
|
-
|
|
503
|
-
test("an owned child fence failure retains an unattempted blocker without a cancellation wake", async () => {
|
|
504
|
-
const failure = new Error("filesystem fence failed");
|
|
505
|
-
const f = await fixture({
|
|
506
|
-
shared: true,
|
|
507
|
-
quiesce: () => {
|
|
508
|
-
throw failure;
|
|
509
|
-
},
|
|
510
|
-
});
|
|
511
|
-
const request = f.workers[0]!.request.memoryGroup!;
|
|
512
|
-
const cells = new Int32Array(request.reply);
|
|
513
|
-
const group = f.broker.memoryGroupOf(f.pid)!;
|
|
514
|
-
const sibling = f.groups().admit(90, workerProcessDirectoryId(f.root), group);
|
|
515
|
-
const launched = sibling.launch();
|
|
516
|
-
try {
|
|
517
|
-
const children: unknown = Reflect.get(f.broker, "children");
|
|
518
|
-
if (!(children instanceof Map)) throw new Error("missing child ownership map");
|
|
519
|
-
const stop: unknown = Reflect.get(f.broker, "stopPhysical");
|
|
520
|
-
if (typeof stop !== "function") throw new Error("missing physical stop path");
|
|
521
|
-
await expect(Reflect.apply(stop, f.broker, [children.get(f.pid)])).rejects.toBeDefined();
|
|
522
|
-
expect(f.broker.memoryGroups()[0]?.retained).toBe(1);
|
|
523
|
-
sibling.stopRequested();
|
|
524
|
-
expect(Atomics.load(cells, WAIT_CLOSED)).toBe(0);
|
|
525
|
-
expect(f.workers[0]!.stops).toBe(0);
|
|
526
|
-
expect(Atomics.load(new Int32Array(launched.request.reply), WAIT_CLOSED)).toBe(0);
|
|
527
|
-
} finally {
|
|
528
|
-
launched.request.port.close();
|
|
529
|
-
sibling.stopped();
|
|
530
|
-
await f.close().catch(() => {});
|
|
531
|
-
}
|
|
532
|
-
});
|
|
533
|
-
|
|
534
|
-
test("two execs keep PID, parent, waiters, observation and terminal lifetime until final exit", async () => {
|
|
535
|
-
const f = await fixture();
|
|
536
|
-
try {
|
|
537
|
-
const original = f.table.require(f.pid);
|
|
538
|
-
const observer = captureProcessObserver(original.observation);
|
|
539
|
-
let waited = false;
|
|
540
|
-
const waiting = f.supervisor.waitForExit(f.root.pid, f.pid).then((result) => {
|
|
541
|
-
waited = true;
|
|
542
|
-
return result;
|
|
543
|
-
});
|
|
544
|
-
await f.replace();
|
|
545
|
-
await f.replace(request({ argv: ["third"], cwd: "/third" }));
|
|
546
|
-
expect(f.table.require(f.pid)).toBe(original);
|
|
547
|
-
expect(original.image.generation).toBe(3);
|
|
548
|
-
expect(original.parentPid).toBe(f.root.pid);
|
|
549
|
-
expect(original.processIdentity).toEqual({ pid: f.pid, parentPid: f.root.pid });
|
|
550
|
-
expect(f.contexts.map((context) => context.processIdentity)).toEqual([
|
|
551
|
-
original.processIdentity,
|
|
552
|
-
original.processIdentity,
|
|
553
|
-
original.processIdentity,
|
|
554
|
-
]);
|
|
555
|
-
expect(f.caller.service.cwd(f.pid)).toBe("/third");
|
|
556
|
-
expect(f.contexts[2]!.request.argv).toEqual(["third"]);
|
|
557
|
-
expect(f.contexts[2]!.request.env).toEqual({ NEW: "value" });
|
|
558
|
-
expect(observer.read()).toEqual({ kind: "pending" });
|
|
559
|
-
expect(
|
|
560
|
-
controlLoad(workerProcessState(f.workers[2]!.request.runtimeProcess!).terminalStopped),
|
|
561
|
-
).toBe(0);
|
|
562
|
-
expect(waited).toBe(false);
|
|
563
|
-
expect(f.workers.map((worker) => worker.stops)).toEqual([1, 1, 0]);
|
|
564
|
-
f.contexts[0]!.exit(77);
|
|
565
|
-
f.contexts[0]!.fail(new Error("late old failure"));
|
|
566
|
-
expect(readOutcome(original.outcome)).toBeNull();
|
|
567
|
-
f.workers[2]!.emit({ type: "exit", code: 7 });
|
|
568
|
-
expect(await waiting).toMatchObject({ kind: "exited", code: 7 });
|
|
569
|
-
await original.stopping?.complete;
|
|
570
|
-
expect(observer.read()).toEqual({ kind: "terminated" });
|
|
571
|
-
expect(f.workers.map((worker) => worker.stops)).toEqual([1, 1, 1]);
|
|
572
|
-
expect(f.diagnostics).toEqual([]);
|
|
573
|
-
} finally {
|
|
574
|
-
await f.close();
|
|
575
|
-
}
|
|
576
|
-
});
|
|
577
|
-
|
|
578
|
-
for (const completion of ["revocation", "controller-stop", "physical-stop"] as const)
|
|
579
|
-
test(`${completion} completion cannot finish a retiring image`, async () => {
|
|
580
|
-
const lateStarted: boolean[] = [];
|
|
581
|
-
const f = await fixture({
|
|
582
|
-
stop: completion === "physical-stop" ? completeOldImage : undefined,
|
|
583
|
-
});
|
|
584
|
-
const oldContext = f.contexts[0]!;
|
|
585
|
-
function completeOldImage() {
|
|
586
|
-
lateStarted.push(oldContext.started());
|
|
587
|
-
oldContext.exit(33);
|
|
588
|
-
}
|
|
589
|
-
const record = f.table.require(f.pid);
|
|
590
|
-
const observer = captureProcessObserver(record.observation);
|
|
591
|
-
let waited = false;
|
|
592
|
-
const waiting = f.supervisor.waitForExit(f.root.pid, f.pid).then((result) => {
|
|
593
|
-
waited = true;
|
|
594
|
-
return result;
|
|
595
|
-
});
|
|
596
|
-
try {
|
|
597
|
-
if (completion === "revocation") oldContext.registerRevocation?.(completeOldImage);
|
|
598
|
-
if (completion === "controller-stop")
|
|
599
|
-
f.broker.registerController(f.pid, { stop: completeOldImage });
|
|
600
|
-
expect((await f.stage()).result).toBe(0);
|
|
601
|
-
f.workers[0]!.emit({ type: "replaced" });
|
|
602
|
-
await until(() => record.result !== null || f.workers.length === 2);
|
|
603
|
-
expect(record.result).toBeNull();
|
|
604
|
-
expect(f.workers).toHaveLength(2);
|
|
605
|
-
expect(lateStarted).toEqual([false]);
|
|
606
|
-
expect(waited).toBe(false);
|
|
607
|
-
expect(observer.read()).toEqual({ kind: "pending" });
|
|
608
|
-
expect(
|
|
609
|
-
controlLoad(workerProcessState(f.workers[1]!.request.runtimeProcess!).terminalStopped),
|
|
610
|
-
).toBe(0);
|
|
611
|
-
f.workers[1]!.emit({ type: "exit", code: 7 });
|
|
612
|
-
expect(await waiting).toMatchObject({ kind: "exited", code: 7 });
|
|
613
|
-
await record.stopping?.complete;
|
|
614
|
-
expect(observer.read()).toEqual({ kind: "terminated" });
|
|
615
|
-
expect(f.workers.map((worker) => worker.stops)).toEqual([1, 1]);
|
|
616
|
-
} finally {
|
|
617
|
-
await f.close();
|
|
618
|
-
}
|
|
619
|
-
});
|
|
620
|
-
|
|
621
|
-
test("lookup failure discards staged aliases and keeps caller pipes usable", async () => {
|
|
622
|
-
const f = await fixture();
|
|
623
|
-
try {
|
|
624
|
-
const [reader, writer] = f.caller.host.createPipe();
|
|
625
|
-
const fd = f.caller.fds.open(writer, 0n, 0n);
|
|
626
|
-
const alias = f.caller.fds.dup(fd);
|
|
627
|
-
await f.flush(f.pid);
|
|
628
|
-
const failed = await f.stage(
|
|
629
|
-
request({
|
|
630
|
-
executable: "missing",
|
|
631
|
-
fds: [
|
|
632
|
-
{ parent: fd, child: 1 },
|
|
633
|
-
{ parent: alias, child: 2 },
|
|
634
|
-
],
|
|
635
|
-
}),
|
|
636
|
-
);
|
|
637
|
-
expect(failed.result).toBe(-44);
|
|
638
|
-
expect(failed.diagnostic).toContain("missing");
|
|
639
|
-
expect(f.table.require(f.pid).image.generation).toBe(1);
|
|
640
|
-
expect(writer.tryWrite([new TextEncoder().encode("live")])).toBe(4);
|
|
641
|
-
const bytes = new Uint8Array(4);
|
|
642
|
-
expect(reader.tryRead([bytes])).toBe(4);
|
|
643
|
-
expect(new TextDecoder().decode(bytes)).toBe("live");
|
|
644
|
-
expect(readOutcome(f.table.require(f.pid).outcome)).toBeNull();
|
|
645
|
-
reader.close();
|
|
646
|
-
} finally {
|
|
647
|
-
await f.close();
|
|
648
|
-
}
|
|
649
|
-
});
|
|
650
|
-
|
|
651
|
-
test("exec preserves aliases, pipe flags and EOF continuity while closing omitted pipes", async () => {
|
|
652
|
-
const f = await fixture();
|
|
653
|
-
try {
|
|
654
|
-
const [reader, writer] = f.caller.host.createPipe();
|
|
655
|
-
const [omittedReader, omittedWriter] = f.caller.host.createPipe();
|
|
656
|
-
const fd = f.caller.fds.open(writer, 0n, 0n);
|
|
657
|
-
const alias = f.caller.fds.dup(fd);
|
|
658
|
-
f.caller.fds.open(omittedWriter, 0n, 0n);
|
|
659
|
-
writer.fdflags = 4;
|
|
660
|
-
await f.flush(f.pid);
|
|
661
|
-
writer.tryWrite([new Uint8Array([1])]);
|
|
662
|
-
await f.replace(
|
|
663
|
-
request({
|
|
664
|
-
fds: [
|
|
665
|
-
{ parent: fd, child: 7 },
|
|
666
|
-
{ parent: alias, child: 11 },
|
|
667
|
-
],
|
|
668
|
-
}),
|
|
669
|
-
);
|
|
670
|
-
expect(f.caller.fds.get(7)!.description).toBe(f.caller.fds.get(11)!.description);
|
|
671
|
-
const inherited = f.caller.fds.get(7)!.resource;
|
|
672
|
-
expect(inherited.kind).toBe("pipe");
|
|
673
|
-
if (inherited.kind !== "pipe") throw new Error("inherited pipe missing");
|
|
674
|
-
expect(inherited.fdflags).toBe(4);
|
|
675
|
-
expect(reader.tryRead([new Uint8Array(1)])).toBe(1);
|
|
676
|
-
expect(reader.tryRead([new Uint8Array(1)])).toBe(-ProcessErrno.AGAIN);
|
|
677
|
-
expect(omittedReader.tryRead([new Uint8Array(1)])).toBe(0);
|
|
678
|
-
f.caller.fds.close(7);
|
|
679
|
-
expect(reader.tryRead([new Uint8Array(1)])).toBe(-ProcessErrno.AGAIN);
|
|
680
|
-
f.caller.fds.close(11);
|
|
681
|
-
expect(reader.tryRead([new Uint8Array(1)])).toBe(0);
|
|
682
|
-
reader.close();
|
|
683
|
-
omittedReader.close();
|
|
684
|
-
} finally {
|
|
685
|
-
await f.close();
|
|
686
|
-
}
|
|
687
|
-
});
|
|
688
|
-
|
|
689
|
-
test("replacement waits for captured physical stop before launching", async () => {
|
|
690
|
-
const stopping = deferred();
|
|
691
|
-
const f = await fixture({ stop: () => stopping.promise });
|
|
692
|
-
try {
|
|
693
|
-
expect((await f.stage()).result).toBe(0);
|
|
694
|
-
f.workers[0]!.emit({ type: "replaced" });
|
|
695
|
-
await until(() => f.workers[0]!.stops === 1);
|
|
696
|
-
expect(f.workers.length).toBe(1);
|
|
697
|
-
stopping.resolve();
|
|
698
|
-
await until(() => f.workers.length === 2);
|
|
699
|
-
expect(f.workers[0]!.stops).toBe(1);
|
|
700
|
-
} finally {
|
|
701
|
-
stopping.resolve();
|
|
702
|
-
await f.close();
|
|
703
|
-
}
|
|
704
|
-
});
|
|
705
|
-
|
|
706
|
-
for (const cancellation of ["kill", "dispose"] as const)
|
|
707
|
-
test(`${cancellation} joins one pending image stop and prevents successor launch`, async () => {
|
|
708
|
-
const stopping = deferred();
|
|
709
|
-
const f = await fixture({ stop: () => stopping.promise });
|
|
710
|
-
let disposal: Promise<void> | undefined;
|
|
711
|
-
try {
|
|
712
|
-
expect((await f.stage()).result).toBe(0);
|
|
713
|
-
f.workers[0]!.emit({ type: "replaced" });
|
|
714
|
-
await until(() => f.workers[0]!.stops === 1);
|
|
715
|
-
const record = f.table.require(f.pid);
|
|
716
|
-
if (cancellation === "kill") f.supervisor.kill(f.pid, 9);
|
|
717
|
-
else disposal = f.broker.dispose();
|
|
718
|
-
stopping.resolve();
|
|
719
|
-
await until(() => record.result !== null);
|
|
720
|
-
await record.stopping?.complete;
|
|
721
|
-
await disposal;
|
|
722
|
-
expect(record.result).toMatchObject({ kind: "signaled", code: 9 });
|
|
723
|
-
expect(f.workers.length).toBe(1);
|
|
724
|
-
expect(f.workers[0]!.stops).toBe(1);
|
|
725
|
-
expect(captureProcessObserver(record.observation).read()).toEqual({ kind: "terminated" });
|
|
726
|
-
} finally {
|
|
727
|
-
stopping.resolve();
|
|
728
|
-
await disposal;
|
|
729
|
-
await f.close();
|
|
730
|
-
}
|
|
731
|
-
});
|
|
732
|
-
|
|
733
|
-
for (const failure of ["worker-error", "cleanup-error"] as const)
|
|
734
|
-
test(`${failure} before replaced selects 126 and settles native return`, async () => {
|
|
735
|
-
const f = await fixture();
|
|
736
|
-
try {
|
|
737
|
-
expect((await f.stage()).result).toBe(0);
|
|
738
|
-
const record = f.table.require(f.pid);
|
|
739
|
-
if (failure === "worker-error") f.workers[0]!.error();
|
|
740
|
-
else
|
|
741
|
-
f.workers[0]!.emit({
|
|
742
|
-
type: "cleanup-error",
|
|
743
|
-
message: "cleanup failed",
|
|
744
|
-
cleanupErrors: ["cleanup failed"],
|
|
745
|
-
code: 1,
|
|
746
|
-
});
|
|
747
|
-
await until(() => record.result !== null);
|
|
748
|
-
await record.stopping?.complete;
|
|
749
|
-
expect(record.result).toMatchObject({ kind: "exited", code: 126 });
|
|
750
|
-
expect(f.workers.length).toBe(1);
|
|
751
|
-
expect(f.workers[0]!.stops).toBe(1);
|
|
752
|
-
expect(captureProcessObserver(record.observation).read()).toEqual({ kind: "terminated" });
|
|
753
|
-
} finally {
|
|
754
|
-
await f.close();
|
|
755
|
-
}
|
|
756
|
-
});
|
|
757
|
-
|
|
758
|
-
test("exec resets handlers, preserves ignore and applies a pending terminating signal at commit", async () => {
|
|
759
|
-
const f = await fixture();
|
|
760
|
-
try {
|
|
761
|
-
const record = f.table.require(f.pid);
|
|
762
|
-
setSignalDisposition(record.signalState, 10, SignalDisposition.HANDLE, record.interrupt);
|
|
763
|
-
setSignalDisposition(record.signalState, 12, SignalDisposition.IGNORE, record.interrupt);
|
|
764
|
-
await f.replace();
|
|
765
|
-
expect(signalDisposition(record.signalState, 10)).toBe(SignalDisposition.DEFAULT);
|
|
766
|
-
expect(signalDisposition(record.signalState, 12)).toBe(SignalDisposition.IGNORE);
|
|
767
|
-
setSignalDisposition(record.signalState, 15, SignalDisposition.HANDLE, record.interrupt);
|
|
768
|
-
f.supervisor.kill(f.pid, 15);
|
|
769
|
-
await f.stage();
|
|
770
|
-
await until(() => record.result !== null);
|
|
771
|
-
expect(record.result).toMatchObject({ kind: "signaled", code: 15 });
|
|
772
|
-
expect(f.workers.length).toBe(2);
|
|
773
|
-
} finally {
|
|
774
|
-
await f.close();
|
|
775
|
-
}
|
|
776
|
-
});
|
|
777
|
-
|
|
778
|
-
for (const cancellation of ["kill", "dispose"] as const)
|
|
779
|
-
test(`${cancellation} during terminal handoff cannot rearm and releases the successor-free native slot`, async () => {
|
|
780
|
-
const f = await fixture();
|
|
781
|
-
let disposal: Promise<void> | undefined;
|
|
782
|
-
const record = f.table.require(f.pid);
|
|
783
|
-
const transport = f.workers[0]!.request.runtimeProcess!;
|
|
784
|
-
const state = workerProcessState(transport);
|
|
785
|
-
const owners = Reflect.get(f.broker, "observationOwners") as Map<number, object>;
|
|
786
|
-
const owner = owners.get(f.pid)!;
|
|
787
|
-
let held = enterTerminalSection(state);
|
|
788
|
-
expect(held).toBe(true);
|
|
789
|
-
try {
|
|
790
|
-
expect((await f.stage()).result).toBe(0);
|
|
791
|
-
f.workers[0]!.emit({ type: "replaced" });
|
|
792
|
-
await until(() => f.workers[0]!.stops === 1 && controlLoad(state.terminalAdmission) === -2);
|
|
793
|
-
expect(captureProcessObserver(record.observation).read()).toEqual({ kind: "pending" });
|
|
794
|
-
expect(Reflect.get(owner, "consumers")).toBe(1);
|
|
795
|
-
if (cancellation === "kill") f.supervisor.kill(f.pid, 9);
|
|
796
|
-
else disposal = f.broker.dispose();
|
|
797
|
-
expect(enterTerminalSection(state)).toBe(false);
|
|
798
|
-
leaveTerminalSection(state, transport.directory);
|
|
799
|
-
held = false;
|
|
800
|
-
await until(() => record.result !== null);
|
|
801
|
-
await disposal;
|
|
802
|
-
await record.stopping?.complete;
|
|
803
|
-
expect(record.result).toMatchObject({ kind: "signaled", code: 9 });
|
|
804
|
-
expect(f.workers.length).toBe(1);
|
|
805
|
-
expect(f.workers[0]!.stops).toBe(1);
|
|
806
|
-
expect(Reflect.get(owner, "consumers")).toBe(0);
|
|
807
|
-
expect(captureProcessObserver(record.observation).read()).toEqual({ kind: "terminated" });
|
|
808
|
-
let admitted = false;
|
|
809
|
-
try {
|
|
810
|
-
admitted = enterTerminalSection(state);
|
|
811
|
-
} catch (error) {
|
|
812
|
-
expect(error).toBeInstanceOf(ProcessError);
|
|
813
|
-
}
|
|
814
|
-
expect(admitted).toBe(false);
|
|
815
|
-
} finally {
|
|
816
|
-
if (held) leaveTerminalSection(state, transport.directory);
|
|
817
|
-
await disposal;
|
|
818
|
-
await f.close();
|
|
819
|
-
}
|
|
820
|
-
});
|
|
821
|
-
|
|
822
|
-
for (const failure of ["admission", "construction"] as const)
|
|
823
|
-
test(`${failure} failure before successor registration finalizes the continuous native slot`, async () => {
|
|
824
|
-
let rejectConstruction = false;
|
|
825
|
-
const f = await fixture({
|
|
826
|
-
construct() {
|
|
827
|
-
if (rejectConstruction) throw new Error("successor construction refused");
|
|
828
|
-
},
|
|
829
|
-
});
|
|
830
|
-
const record = f.table.require(f.pid);
|
|
831
|
-
const owner = (Reflect.get(f.broker, "observationOwners") as Map<number, object>).get(f.pid)!;
|
|
832
|
-
let admission: ReturnType<typeof spyOn> | undefined;
|
|
833
|
-
try {
|
|
834
|
-
expect((await f.stage()).result).toBe(0);
|
|
835
|
-
rejectConstruction = failure === "construction";
|
|
836
|
-
if (failure === "admission")
|
|
837
|
-
admission = spyOn(f.reservations, "admit").mockImplementationOnce(() => {
|
|
838
|
-
throw new RangeError("successor admission refused");
|
|
839
|
-
});
|
|
840
|
-
f.workers[0]!.emit({ type: "replaced" });
|
|
841
|
-
await until(() => record.result !== null);
|
|
842
|
-
await record.stopping?.complete;
|
|
843
|
-
expect(record.result).toMatchObject({ kind: "exited", code: 126 });
|
|
844
|
-
expect(f.workers.length).toBe(1);
|
|
845
|
-
expect(f.workers[0]!.stops).toBe(1);
|
|
846
|
-
expect(Reflect.get(owner, "consumers")).toBe(0);
|
|
847
|
-
expect(captureProcessObserver(record.observation).read()).toEqual({ kind: "terminated" });
|
|
848
|
-
expect(
|
|
849
|
-
f.diagnostics.some((error) => String(error).includes(`successor ${failure} refused`)),
|
|
850
|
-
).toBe(true);
|
|
851
|
-
} finally {
|
|
852
|
-
admission?.mockRestore();
|
|
853
|
-
await f.close();
|
|
854
|
-
}
|
|
855
|
-
});
|
|
856
|
-
|
|
857
|
-
test("a child and caller-fatal job remain owned and waitable after replacement", async () => {
|
|
858
|
-
const f = await fixture();
|
|
859
|
-
try {
|
|
860
|
-
const child = f.caller.service.spawn(f.pid, { ...request({ cwd: "/" }), job: -1 });
|
|
861
|
-
const fatalChild = f.caller.service.spawn(f.pid, {
|
|
862
|
-
...request({ cwd: "/" }),
|
|
863
|
-
job: -1,
|
|
864
|
-
jobLifetime: "caller-fatal",
|
|
865
|
-
});
|
|
866
|
-
await f.flush(f.pid);
|
|
867
|
-
await f.supervisor.start(child);
|
|
868
|
-
await f.supervisor.start(fatalChild);
|
|
869
|
-
const childRecord = f.table.require(child);
|
|
870
|
-
const fatalRecord = f.table.require(fatalChild);
|
|
871
|
-
const waiting = f.supervisor.waitForExit(f.pid, child);
|
|
872
|
-
await f.replace();
|
|
873
|
-
expect(childRecord.parentPid).toBe(f.pid);
|
|
874
|
-
expect(f.table.job(fatalRecord.job)?.ownerPid).toBe(f.pid);
|
|
875
|
-
const childWorker = f.workers.find((worker) => worker.request.runtimeProcess?.pid === child)!;
|
|
876
|
-
childWorker.emit({ type: "exit", code: 23 });
|
|
877
|
-
expect(await waiting).toMatchObject({ kind: "exited", code: 23 });
|
|
878
|
-
expect(f.caller.service.wait(f.pid, child)).toMatchObject({ kind: "exited", code: 23 });
|
|
879
|
-
f.supervisor.kill(f.pid, 9);
|
|
880
|
-
await until(() => fatalRecord.result !== null);
|
|
881
|
-
expect(fatalRecord.result).toMatchObject({ kind: "signaled", code: 9 });
|
|
882
|
-
} finally {
|
|
883
|
-
await f.close();
|
|
884
|
-
}
|
|
885
|
-
});
|
|
886
|
-
|
|
887
|
-
for (const phase of ["in-flight", "resolving"] as const)
|
|
888
|
-
test(`fatal cancellation while exec is ${phase} discards staged state once without launch`, async () => {
|
|
889
|
-
const f = await fixture();
|
|
890
|
-
const loading = Promise.withResolvers<WebAssembly.Module>();
|
|
891
|
-
let resolving = false;
|
|
892
|
-
f.registry.register("slow", {
|
|
893
|
-
adapter: "fixture",
|
|
894
|
-
module: () => {
|
|
895
|
-
resolving = true;
|
|
896
|
-
return loading.promise;
|
|
897
|
-
},
|
|
898
|
-
});
|
|
899
|
-
const record = f.table.require(f.pid);
|
|
900
|
-
try {
|
|
901
|
-
const completion = f.caller.service.exec(
|
|
902
|
-
f.pid,
|
|
903
|
-
request({ executable: phase === "resolving" ? "slow" : "fixture" }),
|
|
904
|
-
);
|
|
905
|
-
if (phase === "resolving") {
|
|
906
|
-
await f.flush(f.pid);
|
|
907
|
-
await until(() => resolving);
|
|
908
|
-
}
|
|
909
|
-
f.supervisor.kill(f.pid, 9);
|
|
910
|
-
if (phase === "in-flight") await f.flush(f.pid);
|
|
911
|
-
await until(() => readExecCompletion(completion) !== null && record.result !== null);
|
|
912
|
-
await record.stopping?.complete;
|
|
913
|
-
expect(readExecCompletion(completion)!.result).toBe(-ProcessErrno.SRCH);
|
|
914
|
-
expect(record.result).toMatchObject({ kind: "signaled", code: 9 });
|
|
915
|
-
expect(f.reaped).toHaveLength(1);
|
|
916
|
-
loading.resolve(module);
|
|
917
|
-
await Promise.resolve();
|
|
918
|
-
expect(f.workers).toHaveLength(1);
|
|
919
|
-
expect(f.workers[0]!.stops).toBe(1);
|
|
920
|
-
} finally {
|
|
921
|
-
loading.resolve(module);
|
|
922
|
-
await f.close();
|
|
923
|
-
}
|
|
924
|
-
});
|
|
925
|
-
|
|
926
|
-
test("an export failure before post closes only exported successor lifetimes", async () => {
|
|
927
|
-
const f = await fixture();
|
|
928
|
-
try {
|
|
929
|
-
const [reader, writer] = f.caller.host.createPipe();
|
|
930
|
-
const fd = f.caller.fds.open(writer, 0n, 0n);
|
|
931
|
-
const unsupported = f.caller.fds.open(
|
|
932
|
-
{ kind: "file", handle: 123, offset: 0, append: false },
|
|
933
|
-
0n,
|
|
934
|
-
0n,
|
|
935
|
-
);
|
|
936
|
-
await f.flush(f.pid);
|
|
937
|
-
const prepare = f.caller.service.options.prepareExec!;
|
|
938
|
-
let cancelled = 0,
|
|
939
|
-
released = 0,
|
|
940
|
-
posted = 0;
|
|
941
|
-
f.caller.service.options.prepareExec = (pid) => ({
|
|
942
|
-
...prepare(pid),
|
|
943
|
-
cancel() {
|
|
944
|
-
cancelled++;
|
|
945
|
-
},
|
|
946
|
-
release() {
|
|
947
|
-
released++;
|
|
948
|
-
},
|
|
949
|
-
});
|
|
950
|
-
f.caller.service.options.postMessage = () => {
|
|
951
|
-
posted++;
|
|
952
|
-
};
|
|
953
|
-
expect(() =>
|
|
954
|
-
f.caller.service.exec(
|
|
955
|
-
f.pid,
|
|
956
|
-
request({
|
|
957
|
-
fds: [
|
|
958
|
-
{ parent: fd, child: 1 },
|
|
959
|
-
{ parent: unsupported, child: 2 },
|
|
960
|
-
],
|
|
961
|
-
}),
|
|
962
|
-
),
|
|
963
|
-
).toThrow();
|
|
964
|
-
expect([cancelled, released, posted]).toEqual([1, 1, 0]);
|
|
965
|
-
expect(writer.tryWrite([new Uint8Array([7])])).toBe(1);
|
|
966
|
-
expect(reader.tryRead([new Uint8Array(1)])).toBe(1);
|
|
967
|
-
expect(readOutcome(f.table.require(f.pid).outcome)).toBeNull();
|
|
968
|
-
reader.close();
|
|
969
|
-
} finally {
|
|
970
|
-
await f.close();
|
|
971
|
-
}
|
|
972
|
-
});
|
|
973
|
-
|
|
974
|
-
test("fatal cancellation at successor launch prevents admission and construction", async () => {
|
|
975
|
-
let cancel: (() => void) | undefined;
|
|
976
|
-
const f = await fixture({
|
|
977
|
-
launch(context) {
|
|
978
|
-
if (context.generation === 2) cancel?.();
|
|
979
|
-
},
|
|
980
|
-
});
|
|
981
|
-
const record = f.table.require(f.pid);
|
|
982
|
-
try {
|
|
983
|
-
cancel = () => f.supervisor.kill(f.pid, 9);
|
|
984
|
-
expect((await f.stage()).result).toBe(0);
|
|
985
|
-
f.workers[0]!.emit({ type: "replaced" });
|
|
986
|
-
await until(() => record.result !== null);
|
|
987
|
-
await record.stopping?.complete;
|
|
988
|
-
expect(record.result).toMatchObject({ kind: "signaled", code: 9 });
|
|
989
|
-
expect(f.workers).toHaveLength(1);
|
|
990
|
-
expect(f.workers[0]!.stops).toBe(1);
|
|
991
|
-
expect(captureProcessObserver(record.observation).read()).toEqual({ kind: "terminated" });
|
|
992
|
-
} finally {
|
|
993
|
-
await f.close();
|
|
994
|
-
}
|
|
995
|
-
});
|
|
996
|
-
|
|
997
|
-
test("generation 2 terminal sections are joined by the next handoff and final quiesce", async () => {
|
|
998
|
-
const f = await fixture();
|
|
999
|
-
let state: ReturnType<typeof workerProcessState> | undefined;
|
|
1000
|
-
let held = false;
|
|
1001
|
-
let transport: WorkerProcessTransport | undefined;
|
|
1002
|
-
try {
|
|
1003
|
-
await f.replace();
|
|
1004
|
-
transport = f.workers[1]!.request.runtimeProcess!;
|
|
1005
|
-
state = workerProcessState(transport);
|
|
1006
|
-
held = enterTerminalSection(state);
|
|
1007
|
-
expect(held).toBe(true);
|
|
1008
|
-
expect((await f.stage()).result).toBe(0);
|
|
1009
|
-
f.workers[1]!.emit({ type: "replaced" });
|
|
1010
|
-
await until(() => controlLoad(state!.terminalAdmission) === -2);
|
|
1011
|
-
expect(f.workers).toHaveLength(2);
|
|
1012
|
-
expect(f.workers[1]!.stops).toBe(1);
|
|
1013
|
-
leaveTerminalSection(state, transport.directory);
|
|
1014
|
-
held = false;
|
|
1015
|
-
await until(() => f.workers.length === 3);
|
|
1016
|
-
transport = f.workers[2]!.request.runtimeProcess!;
|
|
1017
|
-
state = workerProcessState(transport);
|
|
1018
|
-
held = enterTerminalSection(state);
|
|
1019
|
-
const record = f.table.require(f.pid);
|
|
1020
|
-
f.supervisor.kill(f.pid, 9);
|
|
1021
|
-
expect(f.workers[2]!.stops).toBe(0);
|
|
1022
|
-
leaveTerminalSection(state, transport.directory);
|
|
1023
|
-
held = false;
|
|
1024
|
-
await until(() => record.result !== null);
|
|
1025
|
-
await record.stopping?.complete;
|
|
1026
|
-
expect(f.workers[2]!.stops).toBe(1);
|
|
1027
|
-
} finally {
|
|
1028
|
-
if (held && state && transport) leaveTerminalSection(state, transport.directory);
|
|
1029
|
-
await f.close();
|
|
1030
|
-
}
|
|
1031
|
-
});
|
|
1032
|
-
|
|
1033
|
-
test("a pre-existing physical receipt cannot certify an unproved successor launcher", async () => {
|
|
1034
|
-
const failure = new Error("unknown successor consumer");
|
|
1035
|
-
const f = await fixture({
|
|
1036
|
-
launch(context) {
|
|
1037
|
-
if (context.generation === 2) throw failure;
|
|
1038
|
-
},
|
|
1039
|
-
});
|
|
1040
|
-
const record = f.table.require(f.pid);
|
|
1041
|
-
const owner = (Reflect.get(f.broker, "observationOwners") as Map<number, object>).get(f.pid)!;
|
|
1042
|
-
try {
|
|
1043
|
-
expect((await f.stage()).result).toBe(0);
|
|
1044
|
-
f.workers[0]!.emit({ type: "replaced" });
|
|
1045
|
-
await until(() => record.result !== null);
|
|
1046
|
-
await expect(record.stopping!.complete).rejects.toBe(failure);
|
|
1047
|
-
expect(record.result).toMatchObject({ kind: "exited", code: 126 });
|
|
1048
|
-
expect(Reflect.get(owner, "consumers")).toBe(1);
|
|
1049
|
-
expect(captureProcessObserver(record.observation).read().kind).toBe("selected");
|
|
1050
|
-
await expect(f.broker.dispose()).rejects.toBeInstanceOf(AggregateError);
|
|
1051
|
-
} finally {
|
|
1052
|
-
await f.close().catch(() => {});
|
|
1053
|
-
}
|
|
1054
|
-
});
|
|
1055
|
-
|
|
1056
|
-
test("root and non-Worker callers receive ENOTSUP without changing their process", async () => {
|
|
1057
|
-
const f = await fixture({ hostOnly: true });
|
|
1058
|
-
try {
|
|
1059
|
-
expect((await f.stage()).result).toBe(-ProcessErrno.NOTSUP);
|
|
1060
|
-
const completion = f.parent.service.exec(f.root.pid, request());
|
|
1061
|
-
await f.flush(f.root.pid);
|
|
1062
|
-
expect(readExecCompletion(completion)!.result).toBe(-ProcessErrno.NOTSUP);
|
|
1063
|
-
expect(readOutcome(f.table.require(f.pid).outcome)).toBeNull();
|
|
1064
|
-
expect(readOutcome(f.table.require(f.root.pid).outcome)).toBeNull();
|
|
1065
|
-
expect(f.workers).toHaveLength(0);
|
|
1066
|
-
} finally {
|
|
1067
|
-
await f.close();
|
|
1068
|
-
}
|
|
1069
|
-
});
|
|
1070
|
-
|
|
1071
|
-
test("a failed captured image stop remains charged and is never retried by final cancellation", async () => {
|
|
1072
|
-
const failure = new Error("physical stop refused");
|
|
1073
|
-
const f = await fixture({ stop: () => Promise.reject(failure) });
|
|
1074
|
-
const record = f.table.require(f.pid);
|
|
1075
|
-
const owner = (Reflect.get(f.broker, "observationOwners") as Map<number, object>).get(f.pid)!;
|
|
1076
|
-
const charged = f.reservations.snapshot().reservedBytes;
|
|
1077
|
-
try {
|
|
1078
|
-
expect((await f.stage()).result).toBe(0);
|
|
1079
|
-
f.workers[0]!.emit({ type: "replaced" });
|
|
1080
|
-
await until(() => record.result !== null);
|
|
1081
|
-
await expect(record.stopping!.complete).rejects.toBeInstanceOf(AggregateError);
|
|
1082
|
-
f.supervisor.kill(f.pid, 9);
|
|
1083
|
-
expect(record.result).toMatchObject({ kind: "exited", code: 126 });
|
|
1084
|
-
expect(f.workers).toHaveLength(1);
|
|
1085
|
-
expect(f.workers[0]!.stops).toBe(1);
|
|
1086
|
-
expect(Reflect.get(owner, "consumers")).toBe(1);
|
|
1087
|
-
expect(f.reservations.snapshot().reservedBytes).toBeGreaterThanOrEqual(charged);
|
|
1088
|
-
await expect(f.broker.dispose()).rejects.toBeInstanceOf(AggregateError);
|
|
1089
|
-
expect(f.workers[0]!.stops).toBe(1);
|
|
1090
|
-
} finally {
|
|
1091
|
-
await f.close().catch(() => {});
|
|
1092
|
-
}
|
|
1093
|
-
});
|
|
1094
|
-
|
|
1095
|
-
test("an unclassified shared target is rejected after full module resolution", async () => {
|
|
1096
|
-
const f = await fixture();
|
|
1097
|
-
const child = (Reflect.get(f.broker, "children") as Map<number, object>).get(f.pid)!;
|
|
1098
|
-
let loaded = false;
|
|
1099
|
-
f.registry.register("unresolved", {
|
|
1100
|
-
adapter: "fixture",
|
|
1101
|
-
module: () => {
|
|
1102
|
-
loaded = true;
|
|
1103
|
-
return module;
|
|
1104
|
-
},
|
|
1105
|
-
});
|
|
1106
|
-
try {
|
|
1107
|
-
Reflect.set(child, "group", {});
|
|
1108
|
-
expect((await f.stage(request({ executable: "unresolved" }))).result).toBe(
|
|
1109
|
-
-ProcessErrno.NOTSUP,
|
|
1110
|
-
);
|
|
1111
|
-
expect(loaded).toBe(true);
|
|
1112
|
-
expect(f.table.require(f.pid).image.generation).toBe(1);
|
|
1113
|
-
} finally {
|
|
1114
|
-
Reflect.deleteProperty(child, "group");
|
|
1115
|
-
await f.close();
|
|
1116
|
-
}
|
|
1117
|
-
});
|
|
1118
|
-
|
|
1119
|
-
test("a fatal shared outcome during image stop settles without a signal notification or pump", async () => {
|
|
1120
|
-
const stopping = deferred();
|
|
1121
|
-
const f = await fixture({ stop: () => stopping.promise });
|
|
1122
|
-
const record = f.table.require(f.pid);
|
|
1123
|
-
try {
|
|
1124
|
-
expect((await f.stage()).result).toBe(0);
|
|
1125
|
-
const timer = Reflect.get(f.broker, "timer") as ReturnType<typeof setTimeout> | null;
|
|
1126
|
-
if (timer) clearTimeout(timer);
|
|
1127
|
-
Reflect.set(f.broker, "timer", null);
|
|
1128
|
-
f.workers[0]!.emit({ type: "replaced" });
|
|
1129
|
-
await until(() => f.workers[0]!.stops === 1);
|
|
1130
|
-
requestSignal(record, 9);
|
|
1131
|
-
stopping.resolve();
|
|
1132
|
-
await until(() => record.result !== null);
|
|
1133
|
-
await record.stopping?.complete;
|
|
1134
|
-
expect(record.result).toMatchObject({ kind: "signaled", code: 9 });
|
|
1135
|
-
expect(f.workers).toHaveLength(1);
|
|
1136
|
-
expect(f.workers[0]!.stops).toBe(1);
|
|
1137
|
-
expect(captureProcessObserver(record.observation).read()).toEqual({ kind: "terminated" });
|
|
1138
|
-
} finally {
|
|
1139
|
-
stopping.resolve();
|
|
1140
|
-
await f.close();
|
|
1141
|
-
}
|
|
1142
|
-
});
|
|
1143
|
-
|
|
1144
|
-
test("shared source closes joins only after target resolution and retains its native-stop charge", async () => {
|
|
1145
|
-
const stopping = deferred();
|
|
1146
|
-
const loading = Promise.withResolvers<WebAssembly.Module>();
|
|
1147
|
-
const f = await fixture({ shared: true, stop: () => stopping.promise });
|
|
1148
|
-
const target = await f.registry.resolve("host");
|
|
1149
|
-
if (target.kind !== "module") throw new Error("expected module target");
|
|
1150
|
-
f.registry.register("host", { ...target, module: () => loading.promise });
|
|
1151
|
-
try {
|
|
1152
|
-
const attempt = f.stage(request({ executable: "host" }));
|
|
1153
|
-
await until(() => f.table.require(f.pid).replacement?.state.phase === "resolving");
|
|
1154
|
-
const group = f.broker.memoryGroupOf(f.pid)!;
|
|
1155
|
-
const earlier = f.groups().admit(90, workerProcessDirectoryId(f.root), group);
|
|
1156
|
-
const counters = f.broker.memoryGroups();
|
|
1157
|
-
loading.resolve(module);
|
|
1158
|
-
expect((await attempt).result).toBe(-ProcessErrno.NOTSUP);
|
|
1159
|
-
expect(f.broker.memoryGroups()).toEqual(counters);
|
|
1160
|
-
earlier.abort();
|
|
1161
|
-
expect((await f.stage(request({ executable: "host" }))).result).toBe(0);
|
|
1162
|
-
expect(() => f.groups().admit(91, workerProcessDirectoryId(f.root), group)).toThrow(
|
|
1163
|
-
ProcessError,
|
|
1164
|
-
);
|
|
1165
|
-
expect(() =>
|
|
1166
|
-
f.broker.admitRootMemoryGroup(
|
|
1167
|
-
f.root.pid,
|
|
1168
|
-
{
|
|
1169
|
-
module: f.workers[0]!.request.module,
|
|
1170
|
-
linkPlan: Reflect.get(f.workers[0]!.request, "linkPlan"),
|
|
1171
|
-
},
|
|
1172
|
-
group,
|
|
1173
|
-
),
|
|
1174
|
-
).toThrow(ProcessError);
|
|
1175
|
-
f.workers[0]!.emit({ type: "replaced" });
|
|
1176
|
-
await until(() => f.workers[0]!.stops === 1);
|
|
1177
|
-
expect(f.broker.memoryGroupOf(f.pid)).toBe(group);
|
|
1178
|
-
expect(f.contexts).toHaveLength(1);
|
|
1179
|
-
stopping.resolve();
|
|
1180
|
-
await until(() => f.contexts.length === 2);
|
|
1181
|
-
expect(f.broker.memoryGroups()).toEqual([]);
|
|
1182
|
-
expect(f.contexts[1]!.generation).toBe(2);
|
|
1183
|
-
} finally {
|
|
1184
|
-
stopping.resolve();
|
|
1185
|
-
loading.resolve(module);
|
|
1186
|
-
await f.close();
|
|
1187
|
-
}
|
|
1188
|
-
});
|
|
1189
|
-
|
|
1190
|
-
for (const phase of ["reserved", "retained", "launched"] as const)
|
|
1191
|
-
test(`shared source preserves ${phase} members and group publications on refusal`, async () => {
|
|
1192
|
-
const f = await fixture({ shared: true });
|
|
1193
|
-
const groups = f.groups();
|
|
1194
|
-
const group = f.broker.memoryGroupOf(f.pid)!;
|
|
1195
|
-
const publisher = groups.admit(89, workerProcessDirectoryId(f.root), group);
|
|
1196
|
-
publisher.launch().request.port.close();
|
|
1197
|
-
const owner = groups.owner(group)!;
|
|
1198
|
-
const data = owner.request(publisher, GroupOp.CREATE, PAGE_BYTES, PAGE_BYTES)[1]!;
|
|
1199
|
-
const cell = owner.request(publisher, GroupOp.CREATE, 16, 16)[1]!;
|
|
1200
|
-
const pin = owner.request(publisher, GroupOp.PIN, data)[1]!;
|
|
1201
|
-
expect(owner.request(publisher, GroupOp.ROUTE_GROUP, pin)).toEqual([0]);
|
|
1202
|
-
expect(owner.request(publisher, GroupOp.PUBLISH, 1, data, cell, 1)[0]).toBe(0);
|
|
1203
|
-
publisher.stopped();
|
|
1204
|
-
const member = groups.admit(90, workerProcessDirectoryId(f.root), group);
|
|
1205
|
-
if (phase !== "reserved") member.launch().request.port.close();
|
|
1206
|
-
if (phase === "retained") member.failed();
|
|
1207
|
-
try {
|
|
1208
|
-
const before = f.broker.memoryGroups();
|
|
1209
|
-
expect(before[0]).toMatchObject({ pins: 1, published: 1 });
|
|
1210
|
-
expect((await f.stage(request({ executable: "host" }))).result).toBe(-ProcessErrno.NOTSUP);
|
|
1211
|
-
expect(f.broker.memoryGroups()).toEqual(before);
|
|
1212
|
-
expect(f.table.require(f.pid).image.generation).toBe(1);
|
|
1213
|
-
} finally {
|
|
1214
|
-
member.stopped();
|
|
1215
|
-
await f.close();
|
|
1216
|
-
}
|
|
1217
|
-
});
|
|
1218
|
-
|
|
1219
|
-
for (const phase of ["queued", "reserved", "pending-adapter"] as const)
|
|
1220
|
-
test(`an earlier same-directory ${phase} sibling intent cannot be silently declared unrelated`, async () => {
|
|
1221
|
-
const late = Promise.withResolvers<import("../proc/types.js").ProcessHandle>();
|
|
1222
|
-
const loading = Promise.withResolvers<WebAssembly.Module>();
|
|
1223
|
-
const f = await fixture({
|
|
1224
|
-
shared: true,
|
|
1225
|
-
launch: (context) => {
|
|
1226
|
-
if (phase === "pending-adapter" && context.pid !== 2) return late.promise;
|
|
1227
|
-
},
|
|
1228
|
-
});
|
|
1229
|
-
let starting: Promise<void> | undefined;
|
|
1230
|
-
try {
|
|
1231
|
-
if (phase === "reserved")
|
|
1232
|
-
f.registry.register("unresolved-sibling", {
|
|
1233
|
-
adapter: "fixture",
|
|
1234
|
-
module: () => loading.promise,
|
|
1235
|
-
});
|
|
1236
|
-
const sibling = f.parent.service.spawn(f.root.pid, {
|
|
1237
|
-
...request({
|
|
1238
|
-
cwd: "/",
|
|
1239
|
-
executable: phase === "reserved" ? "unresolved-sibling" : "fixture",
|
|
1240
|
-
}),
|
|
1241
|
-
job: -1,
|
|
1242
|
-
});
|
|
1243
|
-
const notices = f.notices.splice(0);
|
|
1244
|
-
if (phase !== "queued")
|
|
1245
|
-
for (const notice of notices) await f.broker.runtimeMessage(notice, f.root.pid);
|
|
1246
|
-
if (phase === "pending-adapter") {
|
|
1247
|
-
starting = f.supervisor.start(sibling);
|
|
1248
|
-
await until(() => f.contexts.length === 2);
|
|
1249
|
-
}
|
|
1250
|
-
expect((await f.stage(request({ executable: "host" }))).result).toBe(-ProcessErrno.NOTSUP);
|
|
1251
|
-
expect(f.table.require(f.pid).image.generation).toBe(1);
|
|
1252
|
-
if (phase === "queued")
|
|
1253
|
-
for (const notice of notices) await f.broker.runtimeMessage(notice, f.root.pid);
|
|
1254
|
-
expect(f.broker.transportFor(sibling)).toBeDefined();
|
|
1255
|
-
} finally {
|
|
1256
|
-
loading.resolve(module);
|
|
1257
|
-
late.resolve({ terminate() {} });
|
|
1258
|
-
await starting;
|
|
1259
|
-
await f.close();
|
|
1260
|
-
}
|
|
1261
|
-
});
|
|
1262
|
-
|
|
1263
|
-
test("an independently grouped live child survives shared-source exec and legacy PID-only kill", async () => {
|
|
1264
|
-
const f = await fixture({ shared: true });
|
|
1265
|
-
try {
|
|
1266
|
-
const child = f.caller.service.spawn(f.pid, { ...request({ cwd: "/" }), job: -1 });
|
|
1267
|
-
await f.flush(f.pid);
|
|
1268
|
-
await f.supervisor.start(child);
|
|
1269
|
-
const group = f.broker.memoryGroupOf(child);
|
|
1270
|
-
expect(group).toBeDefined();
|
|
1271
|
-
expect(group).not.toBe(f.broker.memoryGroupOf(f.pid));
|
|
1272
|
-
const before = f.table.require(child);
|
|
1273
|
-
expect((await f.stage(request({ executable: "host" }))).result).toBe(0);
|
|
1274
|
-
f.workers[0]!.emit({ type: "replaced" });
|
|
1275
|
-
await until(() => f.contexts.length === 3);
|
|
1276
|
-
expect(f.table.require(child)).toBe(before);
|
|
1277
|
-
expect(f.broker.memoryGroupOf(child)).toBe(group);
|
|
1278
|
-
f.supervisor.kill(f.pid, 9);
|
|
1279
|
-
await f.table.require(f.pid).stopping?.complete;
|
|
1280
|
-
expect(before.result).toBeNull();
|
|
1281
|
-
expect(f.broker.memoryGroupOf(child)).toBe(group);
|
|
1282
|
-
expect(f.workers[1]!.stops).toBe(0);
|
|
1283
|
-
} finally {
|
|
1284
|
-
await f.close();
|
|
1285
|
-
}
|
|
1286
|
-
});
|
|
1287
|
-
|
|
1288
|
-
for (const phase of ["lookup", "source-stop", "target-acquisition"] as const)
|
|
1289
|
-
test(`shared exec preserves the fatal winner during ${phase} and joins late handles`, async () => {
|
|
1290
|
-
const loading = Promise.withResolvers<WebAssembly.Module>();
|
|
1291
|
-
const stopping = deferred();
|
|
1292
|
-
const acquired = Promise.withResolvers<import("../proc/types.js").ProcessHandle>();
|
|
1293
|
-
let lateStops = 0;
|
|
1294
|
-
const f = await fixture({
|
|
1295
|
-
shared: true,
|
|
1296
|
-
stop: phase === "source-stop" ? () => stopping.promise : undefined,
|
|
1297
|
-
launch: (context) => {
|
|
1298
|
-
if (context.generation === 2 && phase === "target-acquisition") return acquired.promise;
|
|
1299
|
-
},
|
|
1300
|
-
});
|
|
1301
|
-
const record = f.table.require(f.pid);
|
|
1302
|
-
try {
|
|
1303
|
-
if (phase === "lookup") {
|
|
1304
|
-
const target = await f.registry.resolve("host");
|
|
1305
|
-
if (target.kind !== "module") throw new Error("expected module target");
|
|
1306
|
-
f.registry.register("slow-host", { ...target, module: () => loading.promise });
|
|
1307
|
-
const completion = f.caller.service.exec(f.pid, request({ executable: "slow-host" }));
|
|
1308
|
-
await f.flush(f.pid);
|
|
1309
|
-
await until(() => record.replacement?.state.phase === "resolving");
|
|
1310
|
-
f.supervisor.kill(f.pid, 9);
|
|
1311
|
-
loading.resolve(module);
|
|
1312
|
-
await until(() => readExecCompletion(completion) !== null);
|
|
1313
|
-
expect(readExecCompletion(completion)!.result).toBe(-ProcessErrno.SRCH);
|
|
1314
|
-
} else {
|
|
1315
|
-
expect((await f.stage(request({ executable: "host" }))).result).toBe(0);
|
|
1316
|
-
f.workers[0]!.emit({ type: "replaced" });
|
|
1317
|
-
await until(() =>
|
|
1318
|
-
phase === "source-stop" ? f.workers[0]!.stops === 1 : f.contexts.length === 2,
|
|
1319
|
-
);
|
|
1320
|
-
f.supervisor.kill(f.pid, 9);
|
|
1321
|
-
expect(captureProcessObserver(record.observation).read().kind).not.toBe("terminated");
|
|
1322
|
-
acquired.resolve({
|
|
1323
|
-
terminate() {
|
|
1324
|
-
lateStops++;
|
|
1325
|
-
},
|
|
1326
|
-
});
|
|
1327
|
-
stopping.resolve();
|
|
1328
|
-
}
|
|
1329
|
-
await until(() => record.result !== null);
|
|
1330
|
-
await record.stopping?.complete;
|
|
1331
|
-
expect(record.result).toMatchObject({ kind: "signaled", code: 9 });
|
|
1332
|
-
expect(f.broker.memoryGroups()).toEqual([]);
|
|
1333
|
-
expect(f.contexts).toHaveLength(phase === "target-acquisition" ? 2 : 1);
|
|
1334
|
-
expect(lateStops).toBe(phase === "target-acquisition" ? 1 : 0);
|
|
1335
|
-
} finally {
|
|
1336
|
-
acquired.resolve({
|
|
1337
|
-
terminate() {
|
|
1338
|
-
lateStops++;
|
|
1339
|
-
},
|
|
1340
|
-
});
|
|
1341
|
-
loading.resolve(module);
|
|
1342
|
-
stopping.resolve();
|
|
1343
|
-
await f.close();
|
|
1344
|
-
}
|
|
1345
|
-
});
|
|
1346
|
-
|
|
1347
|
-
test("typed shared callers remain unsupported and rejected targets preserve signal dispositions", async () => {
|
|
1348
|
-
const f = await fixture({ shared: true, typed: true });
|
|
1349
|
-
const record = f.table.require(f.pid);
|
|
1350
|
-
try {
|
|
1351
|
-
setSignalDisposition(record.signalState, 10, SignalDisposition.HANDLE, record.interrupt);
|
|
1352
|
-
setSignalDisposition(record.signalState, 12, SignalDisposition.IGNORE, record.interrupt);
|
|
1353
|
-
const before = f.broker.memoryGroups();
|
|
1354
|
-
expect((await f.stage(request({ executable: "host" }))).result).toBe(-ProcessErrno.NOTSUP);
|
|
1355
|
-
expect(signalDisposition(record.signalState, 10)).toBe(SignalDisposition.HANDLE);
|
|
1356
|
-
expect(signalDisposition(record.signalState, 12)).toBe(SignalDisposition.IGNORE);
|
|
1357
|
-
expect(f.broker.memoryGroups()).toEqual(before);
|
|
1358
|
-
expect(record.image.generation).toBe(1);
|
|
1359
|
-
} finally {
|
|
1360
|
-
await f.close();
|
|
1361
|
-
}
|
|
1362
|
-
});
|
|
1363
|
-
|
|
1364
|
-
test("an opaque sibling acquisition stays visible after it constructs an independent Worker", async () => {
|
|
1365
|
-
const acquired = deferred();
|
|
1366
|
-
const f = await fixture({
|
|
1367
|
-
shared: true,
|
|
1368
|
-
acquired: (context) =>
|
|
1369
|
-
context.request.argv[0] === "opaque" ? acquired.promise : Promise.resolve(),
|
|
1370
|
-
});
|
|
1371
|
-
try {
|
|
1372
|
-
const pid = f.parent.service.spawn(f.root.pid, {
|
|
1373
|
-
...request({ argv: ["opaque"], cwd: "/" }),
|
|
1374
|
-
job: -1,
|
|
1375
|
-
});
|
|
1376
|
-
await f.flush(f.root.pid);
|
|
1377
|
-
await until(() => f.workers.length === 2);
|
|
1378
|
-
const groups = f.broker.memoryGroups();
|
|
1379
|
-
expect((await f.stage(request({ executable: "host" }))).result).toBe(-ProcessErrno.NOTSUP);
|
|
1380
|
-
expect(f.broker.memoryGroups()).toEqual(groups);
|
|
1381
|
-
acquired.resolve();
|
|
1382
|
-
await f.supervisor.start(pid);
|
|
1383
|
-
expect((await f.stage(request({ executable: "host" }))).result).toBe(0);
|
|
1384
|
-
} finally {
|
|
1385
|
-
acquired.resolve();
|
|
1386
|
-
await f.close();
|
|
1387
|
-
}
|
|
1388
|
-
});
|
|
1389
|
-
|
|
1390
|
-
test("the classified host successor can spawn ordinary phase children in fresh groups", async () => {
|
|
1391
|
-
const f = await fixture({ shared: true });
|
|
1392
|
-
try {
|
|
1393
|
-
expect((await f.stage(request({ executable: "host" }))).result).toBe(0);
|
|
1394
|
-
f.workers[0]!.emit({ type: "replaced" });
|
|
1395
|
-
await until(() => f.contexts.length === 2);
|
|
1396
|
-
const host = f.client(f.broker.transportFor(f.pid)!);
|
|
1397
|
-
const child = host.service.spawn(f.pid, { ...request({ cwd: "/" }), job: -1 });
|
|
1398
|
-
await f.flush(f.pid);
|
|
1399
|
-
await f.supervisor.start(child);
|
|
1400
|
-
expect(f.broker.memoryGroupOf(f.pid)).toBeUndefined();
|
|
1401
|
-
expect(f.broker.memoryGroupOf(child)).toBeDefined();
|
|
1402
|
-
expect(f.table.require(child).parentPid).toBe(f.pid);
|
|
1403
|
-
expect(f.workers).toHaveLength(2);
|
|
1404
|
-
expect(f.workers[1]!.stops).toBe(0);
|
|
1405
|
-
} finally {
|
|
1406
|
-
await f.close();
|
|
1407
|
-
}
|
|
1408
|
-
});
|
|
1409
|
-
|
|
1410
|
-
test("a direct broker joins its exact accepted wrapper once through fatal pre-ack disposal", async () => {
|
|
1411
|
-
const entered = deferred();
|
|
1412
|
-
const released = deferred();
|
|
1413
|
-
let stops = 0;
|
|
1414
|
-
const f = await fixture({
|
|
1415
|
-
shared: true,
|
|
1416
|
-
wrap: (handle) => ({
|
|
1417
|
-
async terminate() {
|
|
1418
|
-
stops++;
|
|
1419
|
-
await handle.terminate();
|
|
1420
|
-
entered.resolve();
|
|
1421
|
-
await released.promise;
|
|
1422
|
-
},
|
|
1423
|
-
}),
|
|
1424
|
-
});
|
|
1425
|
-
let disposing: Promise<void> | undefined;
|
|
1426
|
-
const record = f.table.require(f.pid);
|
|
1427
|
-
try {
|
|
1428
|
-
expect((await f.stage(request({ executable: "host" }))).result).toBe(0);
|
|
1429
|
-
f.supervisor.kill(f.pid, 9);
|
|
1430
|
-
await entered.promise;
|
|
1431
|
-
expect(f.workers[0]!.stops).toBe(1);
|
|
1432
|
-
expect(f.broker.memoryGroups()[0]?.members).toBe(1);
|
|
1433
|
-
disposing = f.broker.dispose();
|
|
1434
|
-
expect(captureProcessObserver(record.observation).read().kind).not.toBe("terminated");
|
|
1435
|
-
released.resolve();
|
|
1436
|
-
await disposing;
|
|
1437
|
-
await record.stopping?.complete;
|
|
1438
|
-
expect(stops).toBe(1);
|
|
1439
|
-
expect(f.broker.memoryGroups()).toEqual([]);
|
|
1440
|
-
expect(captureProcessObserver(record.observation).read()).toEqual({ kind: "terminated" });
|
|
1441
|
-
} finally {
|
|
1442
|
-
released.resolve();
|
|
1443
|
-
await disposing;
|
|
1444
|
-
await f.close();
|
|
1445
|
-
}
|
|
1446
|
-
});
|
|
1447
|
-
|
|
1448
|
-
test("a thread-kind caller cannot exec even without opaque worker metadata", async () => {
|
|
1449
|
-
const f = await fixture({ processKind: "thread" });
|
|
1450
|
-
try {
|
|
1451
|
-
expect(f.table.require(f.pid).processIdentity).toEqual({ pid: f.root.pid, parentPid: 0 });
|
|
1452
|
-
expect(() => f.caller.service.exec(f.pid, request())).toThrow(
|
|
1453
|
-
expect.objectContaining({ errno: ProcessErrno.NOTSUP }),
|
|
1454
|
-
);
|
|
1455
|
-
expect(f.table.require(f.pid).image.phase).toBe("current");
|
|
1456
|
-
expect(f.caller.service.cwd(f.pid)).toBe("/");
|
|
1457
|
-
} finally {
|
|
1458
|
-
await f.close();
|
|
1459
|
-
}
|
|
1460
|
-
});
|
|
1461
|
-
|
|
1462
|
-
test("an undelivered logical thread blocks exec until owned no-consumer rollback", async () => {
|
|
1463
|
-
const f = await fixture();
|
|
1464
|
-
try {
|
|
1465
|
-
const tid = f.caller.service.spawn(f.pid, {
|
|
1466
|
-
...request({ cwd: "/" }),
|
|
1467
|
-
job: -1,
|
|
1468
|
-
processKind: "thread",
|
|
1469
|
-
});
|
|
1470
|
-
const thread = f.notices.shift()!;
|
|
1471
|
-
expect(thread.operation).toBe("spawn");
|
|
1472
|
-
expect(f.table.get(tid)).toBeUndefined();
|
|
1473
|
-
const completion = f.caller.service.exec(f.pid, request());
|
|
1474
|
-
await f.flush(f.pid);
|
|
1475
|
-
await until(() => readExecCompletion(completion) !== null);
|
|
1476
|
-
expect(readExecCompletion(completion)!.result).toBe(-ProcessErrno.NOTSUP);
|
|
1477
|
-
if (thread.operation !== "spawn") throw new Error("expected spawn");
|
|
1478
|
-
thread.request.processKind = "process";
|
|
1479
|
-
await expect(f.broker.runtimeMessage(thread, f.pid)).rejects.toMatchObject({
|
|
1480
|
-
errno: ProcessErrno.INVAL,
|
|
1481
|
-
});
|
|
1482
|
-
expect(f.table.get(tid)).toBeUndefined();
|
|
1483
|
-
expect((await f.stage()).result).toBe(0);
|
|
1484
|
-
} finally {
|
|
1485
|
-
await f.close();
|
|
1486
|
-
}
|
|
1487
|
-
});
|
|
1488
|
-
|
|
1489
|
-
test("collected logical siblings block exec through adapter stop and release unconsumed results", async () => {
|
|
1490
|
-
const stopping = deferred();
|
|
1491
|
-
const f = await fixture({ stop: () => stopping.promise });
|
|
1492
|
-
try {
|
|
1493
|
-
const tid = f.caller.service.spawn(f.pid, {
|
|
1494
|
-
...request({ cwd: "/" }),
|
|
1495
|
-
job: -1,
|
|
1496
|
-
processKind: "thread",
|
|
1497
|
-
});
|
|
1498
|
-
await f.flush(f.pid);
|
|
1499
|
-
await f.supervisor.start(tid);
|
|
1500
|
-
const threadJob = f.supervisor.jobOf(tid);
|
|
1501
|
-
expect((await f.stage()).result).toBe(-ProcessErrno.NOTSUP);
|
|
1502
|
-
const worker = f.workers.find((w) => w.request.runtimeProcess?.pid === tid)!;
|
|
1503
|
-
worker.emit({ type: "exit", code: 0 });
|
|
1504
|
-
await until(() => f.supervisor.childExited(f.pid, tid));
|
|
1505
|
-
expect((await f.stage()).result).toBe(-ProcessErrno.NOTSUP);
|
|
1506
|
-
expect(f.supervisor.wait(f.pid, tid)?.code).toBe(0);
|
|
1507
|
-
expect(f.table.get(tid)).toBeUndefined();
|
|
1508
|
-
expect((await f.stage()).result).toBe(-ProcessErrno.NOTSUP);
|
|
1509
|
-
stopping.resolve();
|
|
1510
|
-
await until(() => f.supervisor.jobRetired(threadJob));
|
|
1511
|
-
const completed = f.caller.service.spawn(f.pid, {
|
|
1512
|
-
...request({ cwd: "/" }),
|
|
1513
|
-
job: -1,
|
|
1514
|
-
processKind: "thread",
|
|
1515
|
-
});
|
|
1516
|
-
await f.flush(f.pid);
|
|
1517
|
-
await f.supervisor.start(completed);
|
|
1518
|
-
const completedJob = f.supervisor.jobOf(completed);
|
|
1519
|
-
f.workers
|
|
1520
|
-
.find((w) => w.request.runtimeProcess?.pid === completed)!
|
|
1521
|
-
.emit({ type: "exit", code: 0 });
|
|
1522
|
-
await until(() => f.supervisor.jobRetired(completedJob));
|
|
1523
|
-
expect(f.table.get(completed)!.result?.code).toBe(0);
|
|
1524
|
-
expect((await f.stage()).result).toBe(0);
|
|
1525
|
-
} finally {
|
|
1526
|
-
stopping.resolve();
|
|
1527
|
-
await f.close();
|
|
1528
|
-
}
|
|
1529
|
-
});
|
|
1530
|
-
|
|
1531
|
-
test("pending thread acquisition and cancellation retain exec blockers until native cleanup", async () => {
|
|
1532
|
-
const acquiring = Promise.withResolvers<import("../proc/types.js").ProcessHandle>();
|
|
1533
|
-
const stopped = deferred();
|
|
1534
|
-
const f = await fixture();
|
|
1535
|
-
let starting: Promise<void> | undefined;
|
|
1536
|
-
try {
|
|
1537
|
-
f.registry.register("thread-pending", {
|
|
1538
|
-
module,
|
|
1539
|
-
adapter: "thread-pending",
|
|
1540
|
-
execution: { kind: "host", launch: () => acquiring.promise },
|
|
1541
|
-
});
|
|
1542
|
-
const tid = f.caller.service.spawn(f.pid, {
|
|
1543
|
-
...request({ executable: "thread-pending", cwd: "/" }),
|
|
1544
|
-
job: -1,
|
|
1545
|
-
processKind: "thread",
|
|
1546
|
-
});
|
|
1547
|
-
await f.flush(f.pid);
|
|
1548
|
-
starting = f.supervisor.start(tid);
|
|
1549
|
-
const threadJob = f.supervisor.jobOf(tid);
|
|
1550
|
-
await until(() => f.table.require(tid).image.nativeAcquisition.kind === "invoked");
|
|
1551
|
-
expect((await f.stage()).result).toBe(-ProcessErrno.NOTSUP);
|
|
1552
|
-
f.supervisor.kill(tid, 9);
|
|
1553
|
-
expect((await f.stage()).result).toBe(-ProcessErrno.NOTSUP);
|
|
1554
|
-
acquiring.resolve({ terminate: () => stopped.promise });
|
|
1555
|
-
await starting;
|
|
1556
|
-
expect((await f.stage()).result).toBe(-ProcessErrno.NOTSUP);
|
|
1557
|
-
stopped.resolve();
|
|
1558
|
-
await until(() => f.supervisor.jobRetired(threadJob));
|
|
1559
|
-
expect((await f.stage()).result).toBe(0);
|
|
1560
|
-
} finally {
|
|
1561
|
-
acquiring.resolve({ terminate() {} });
|
|
1562
|
-
stopped.resolve();
|
|
1563
|
-
await starting;
|
|
1564
|
-
await f.close();
|
|
1565
|
-
}
|
|
1566
|
-
});
|
|
1567
|
-
|
|
1568
|
-
test("postcommit old-image threads are rejected and successor admission reopens", async () => {
|
|
1569
|
-
const f = await fixture();
|
|
1570
|
-
try {
|
|
1571
|
-
const old = f.caller.service;
|
|
1572
|
-
expect((await f.stage()).result).toBe(0);
|
|
1573
|
-
const rollback = f.table.require(f.pid).replacement!.admission!.rollback;
|
|
1574
|
-
rollback();
|
|
1575
|
-
expect(controlLoad(workerProcessState(f.broker.transportFor(f.pid)!).imageAdmission)).toBe(-1);
|
|
1576
|
-
expect(() => old.spawn(f.pid, { ...request(), job: -1, processKind: "thread" })).toThrow(
|
|
1577
|
-
expect.objectContaining({ errno: ProcessErrno.SRCH }),
|
|
1578
|
-
);
|
|
1579
|
-
expect(() =>
|
|
1580
|
-
f.supervisor.reserveSpawn(f.pid, { ...request(), job: -1, processKind: "thread" }),
|
|
1581
|
-
).toThrow(expect.objectContaining({ errno: ProcessErrno.SRCH }));
|
|
1582
|
-
f.workers[0]!.emit({ type: "replaced" });
|
|
1583
|
-
await until(() => f.workers.length === 2);
|
|
1584
|
-
const successor = f.client(f.workers[1]!.request.runtimeProcess!);
|
|
1585
|
-
rollback();
|
|
1586
|
-
expect(
|
|
1587
|
-
controlLoad(workerProcessState(f.workers[1]!.request.runtimeProcess!).imageAdmission),
|
|
1588
|
-
).toBe(2);
|
|
1589
|
-
expect(() => old.spawn(f.pid, { ...request(), job: -1, processKind: "thread" })).toThrow(
|
|
1590
|
-
expect.objectContaining({ errno: ProcessErrno.SRCH }),
|
|
1591
|
-
);
|
|
1592
|
-
const tid = successor.service.spawn(f.pid, { ...request(), job: -1, processKind: "thread" });
|
|
1593
|
-
await f.flush(f.pid);
|
|
1594
|
-
expect(f.table.require(tid).processIdentity).toEqual({ pid: f.pid, parentPid: f.root.pid });
|
|
1595
|
-
} finally {
|
|
1596
|
-
await f.close();
|
|
1597
|
-
}
|
|
1598
|
-
});
|
|
1599
|
-
|
|
1600
|
-
async function rollbackThreadNotice(f: Awaited<ReturnType<typeof fixture>>, pid: number) {
|
|
1601
|
-
const index = f.notices.findIndex((message) => message.transport.pid === pid);
|
|
1602
|
-
const notice = f.notices.splice(index, 1)[0];
|
|
1603
|
-
if (notice?.operation !== "spawn") throw new Error("expected undelivered thread reservation");
|
|
1604
|
-
await expect(
|
|
1605
|
-
f.broker.runtimeMessage(
|
|
1606
|
-
{ ...notice, request: { ...notice.request, processKind: "process" } },
|
|
1607
|
-
f.pid,
|
|
1608
|
-
),
|
|
1609
|
-
).rejects.toMatchObject({ errno: ProcessErrno.INVAL });
|
|
1610
|
-
expect(f.table.get(pid)).toBeUndefined();
|
|
1611
|
-
}
|
|
1612
|
-
|
|
1613
|
-
for (const generation of [1, 2]) {
|
|
1614
|
-
test(`exec commit closes admission before its final sibling scan in generation ${generation}`, async () => {
|
|
1615
|
-
const f = await fixture();
|
|
1616
|
-
try {
|
|
1617
|
-
if (generation === 2) await f.replace();
|
|
1618
|
-
const options: SupervisorOptions = Reflect.get(f.supervisor, "options");
|
|
1619
|
-
const commit = options.commitReplacement!;
|
|
1620
|
-
const admission = workerProcessState(f.broker.transportFor(f.pid)!).imageAdmission;
|
|
1621
|
-
let sibling = 0;
|
|
1622
|
-
options.commitReplacement = (...args) => {
|
|
1623
|
-
options.commitReplacement = commit;
|
|
1624
|
-
expect(controlLoad(admission)).toBe(generation);
|
|
1625
|
-
sibling = f.caller.service.spawn(f.pid, {
|
|
1626
|
-
...request({ cwd: "/" }),
|
|
1627
|
-
job: -1,
|
|
1628
|
-
processKind: "thread",
|
|
1629
|
-
});
|
|
1630
|
-
const notice = f.notices.find((message) => message.transport.pid === sibling)!;
|
|
1631
|
-
expect(workerProcessState(notice.transport).processIdentity).toEqual({
|
|
1632
|
-
pid: f.pid,
|
|
1633
|
-
parentPid: f.root.pid,
|
|
1634
|
-
});
|
|
1635
|
-
const closed = commit(...args);
|
|
1636
|
-
expect(controlLoad(admission)).toBe(-generation);
|
|
1637
|
-
return closed;
|
|
1638
|
-
};
|
|
1639
|
-
expect((await f.stage()).result).toBe(-ProcessErrno.NOTSUP);
|
|
1640
|
-
expect(sibling).toBeGreaterThan(f.pid);
|
|
1641
|
-
expect(f.table.require(f.pid).image.phase).toBe("current");
|
|
1642
|
-
expect(controlLoad(admission)).toBe(generation);
|
|
1643
|
-
expect(f.caller.service.cwd(f.pid)).toBe(generation === 1 ? "/" : "/next");
|
|
1644
|
-
const admittedAfterRollback = f.caller.service.spawn(f.pid, {
|
|
1645
|
-
...request({ cwd: "/" }),
|
|
1646
|
-
job: -1,
|
|
1647
|
-
processKind: "thread",
|
|
1648
|
-
});
|
|
1649
|
-
await rollbackThreadNotice(f, sibling);
|
|
1650
|
-
await rollbackThreadNotice(f, admittedAfterRollback);
|
|
1651
|
-
expect((await f.stage()).result).toBe(0);
|
|
1652
|
-
expect(controlLoad(admission)).toBe(-generation);
|
|
1653
|
-
} finally {
|
|
1654
|
-
await f.close();
|
|
1655
|
-
}
|
|
1656
|
-
});
|
|
1657
|
-
}
|
|
1658
|
-
|
|
1659
|
-
test("plain singleton exec ignores an unrelated pending directory admission", async () => {
|
|
1660
|
-
const f = await fixture();
|
|
1661
|
-
const release = beginDirectoryAdmission(f.root.directory);
|
|
1662
|
-
try {
|
|
1663
|
-
expect((await f.stage()).result).toBe(0);
|
|
1664
|
-
expect(f.table.require(f.pid).image.phase).toBe("retiring");
|
|
1665
|
-
} finally {
|
|
1666
|
-
release();
|
|
1667
|
-
await f.close();
|
|
1668
|
-
}
|
|
1669
|
-
});
|
|
1670
|
-
|
|
1671
|
-
test("shared caller exec preserves its directory-wide admission guard and rollback", async () => {
|
|
1672
|
-
const f = await fixture({ shared: true });
|
|
1673
|
-
const admission = workerProcessState(f.broker.transportFor(f.pid)!).imageAdmission;
|
|
1674
|
-
const release = beginDirectoryAdmission(f.root.directory);
|
|
1675
|
-
try {
|
|
1676
|
-
expect((await f.stage(request({ executable: "host" }))).result).toBe(-ProcessErrno.NOTSUP);
|
|
1677
|
-
expect(controlLoad(admission)).toBe(1);
|
|
1678
|
-
expect(f.table.require(f.pid).image.phase).toBe("current");
|
|
1679
|
-
expect(f.caller.service.cwd(f.pid)).toBe("/");
|
|
1680
|
-
release();
|
|
1681
|
-
expect((await f.stage(request({ executable: "host" }))).result).toBe(0);
|
|
1682
|
-
} finally {
|
|
1683
|
-
release();
|
|
1684
|
-
await f.close();
|
|
1685
|
-
}
|
|
1686
|
-
});
|
|
1687
|
-
|
|
1688
|
-
function closeExecDuringThreadPreparation(f: Awaited<ReturnType<typeof fixture>>) {
|
|
1689
|
-
const options: SupervisorOptions = Reflect.get(f.supervisor, "options");
|
|
1690
|
-
const commit = options.commitReplacement!;
|
|
1691
|
-
const clientOptions = f.caller.service.options;
|
|
1692
|
-
const prepare = clientOptions.prepareSpawn!;
|
|
1693
|
-
const admission = workerProcessState(f.broker.transportFor(f.pid)!).imageAdmission;
|
|
1694
|
-
options.commitReplacement = (...args) => {
|
|
1695
|
-
options.commitReplacement = commit;
|
|
1696
|
-
let closed: ReturnType<typeof commit>;
|
|
1697
|
-
let entered = false;
|
|
1698
|
-
clientOptions.prepareSpawn = (pid) => {
|
|
1699
|
-
entered = true;
|
|
1700
|
-
expect(controlLoad(admission)).toBe(1);
|
|
1701
|
-
closed = commit(...args);
|
|
1702
|
-
expect(controlLoad(admission)).toBe(-1);
|
|
1703
|
-
return prepare(pid);
|
|
1704
|
-
};
|
|
1705
|
-
try {
|
|
1706
|
-
expect(() =>
|
|
1707
|
-
f.caller.service.spawn(f.pid, {
|
|
1708
|
-
...request({ cwd: "/" }),
|
|
1709
|
-
job: -1,
|
|
1710
|
-
processKind: "thread",
|
|
1711
|
-
}),
|
|
1712
|
-
).toThrow(expect.objectContaining({ errno: ProcessErrno.SRCH }));
|
|
1713
|
-
} finally {
|
|
1714
|
-
clientOptions.prepareSpawn = prepare;
|
|
1715
|
-
}
|
|
1716
|
-
expect(entered).toBe(true);
|
|
1717
|
-
expect(f.notices).toHaveLength(0);
|
|
1718
|
-
return closed;
|
|
1719
|
-
};
|
|
1720
|
-
}
|
|
1721
|
-
|
|
1722
|
-
test("exec closes an in-flight thread before publication and admits only the successor generation", async () => {
|
|
1723
|
-
const f = await fixture();
|
|
1724
|
-
try {
|
|
1725
|
-
closeExecDuringThreadPreparation(f);
|
|
1726
|
-
const admission = workerProcessState(f.broker.transportFor(f.pid)!).imageAdmission;
|
|
1727
|
-
expect((await f.stage()).result).toBe(0);
|
|
1728
|
-
expect(controlLoad(admission)).toBe(-1);
|
|
1729
|
-
const old = f.caller.service;
|
|
1730
|
-
f.workers[0]!.emit({ type: "replaced" });
|
|
1731
|
-
await until(() => f.workers.length === 2);
|
|
1732
|
-
const transport = f.workers[1]!.request.runtimeProcess!;
|
|
1733
|
-
expect(transport.generation).toBe(2);
|
|
1734
|
-
expect(controlLoad(admission)).toBe(2);
|
|
1735
|
-
expect(() => old.spawn(f.pid, { ...request(), job: -1, processKind: "thread" })).toThrow(
|
|
1736
|
-
expect.objectContaining({ errno: ProcessErrno.SRCH }),
|
|
1737
|
-
);
|
|
1738
|
-
const successor = f.client(transport);
|
|
1739
|
-
const tid = successor.service.spawn(f.pid, {
|
|
1740
|
-
...request({ cwd: "/" }),
|
|
1741
|
-
job: -1,
|
|
1742
|
-
processKind: "thread",
|
|
1743
|
-
});
|
|
1744
|
-
await f.flush(f.pid);
|
|
1745
|
-
expect(f.table.require(tid).processIdentity).toEqual({ pid: f.pid, parentPid: f.root.pid });
|
|
1746
|
-
} finally {
|
|
1747
|
-
await f.close();
|
|
1748
|
-
}
|
|
1749
|
-
});
|
|
1750
|
-
|
|
1751
|
-
// docs/host-abi.md, "Stop polling": a guest polling signal(0, 4) must see a stop before its
|
|
1752
|
-
// worker is terminated, because terminate() alone never stops a busy Wasm thread on iOS.
|
|
1753
|
-
test("SIGKILL is selected before terminate(), except for an exec-replaced image", async () => {
|
|
1754
|
-
const handles: import("../proc/types.js").ProcessHandle[] = [];
|
|
1755
|
-
const atTerminate: unknown[] = [];
|
|
1756
|
-
let outcome = (): unknown => undefined;
|
|
1757
|
-
const f = await fixture({
|
|
1758
|
-
stop: () => {
|
|
1759
|
-
atTerminate.push(outcome());
|
|
1760
|
-
},
|
|
1761
|
-
wrap: (handle) => {
|
|
1762
|
-
handles.push(handle);
|
|
1763
|
-
return handle;
|
|
1764
|
-
},
|
|
1765
|
-
});
|
|
1766
|
-
outcome = () => readOutcome(f.table.require(f.pid).outcome);
|
|
1767
|
-
try {
|
|
1768
|
-
const replaced = f.replace();
|
|
1769
|
-
// The old image left guest code through its exec call; the process lives on. Checked at
|
|
1770
|
-
// the old worker's terminate(), before the replacement could stall on a wrong outcome.
|
|
1771
|
-
await until(() => atTerminate.length > 0);
|
|
1772
|
-
expect(atTerminate).toEqual([null]);
|
|
1773
|
-
await replaced;
|
|
1774
|
-
expect(outcome()).toBeNull();
|
|
1775
|
-
// A direct physical stop of the live replacement, with no outcome selected yet.
|
|
1776
|
-
const stopping = handles.at(-1)!.terminate();
|
|
1777
|
-
await until(() => outcome() !== null);
|
|
1778
|
-
f.workers.at(-1)!.emit({ type: "exit", code: 137, signal: 9 });
|
|
1779
|
-
await stopping;
|
|
1780
|
-
expect(atTerminate[1]).toMatchObject({ kind: "signaled", code: 9 });
|
|
1781
|
-
} finally {
|
|
1782
|
-
await f.close();
|
|
1783
|
-
}
|
|
1784
|
-
});
|
|
1785
|
-
|
|
1786
|
-
// docs/host-abi.md, "Stop polling": terminate() landing while a guest still calls host imports
|
|
1787
|
-
// in a loop can crash a WebKit page, so a started guest gets a bounded time to unwind first.
|
|
1788
|
-
async function stopTimed(options: { shared?: boolean; stop?: () => void } = {}) {
|
|
1789
|
-
const handles: import("../proc/types.js").ProcessHandle[] = [];
|
|
1790
|
-
const f = await fixture({
|
|
1791
|
-
...options,
|
|
1792
|
-
wrap: (handle) => {
|
|
1793
|
-
handles.push(handle);
|
|
1794
|
-
return handle;
|
|
1795
|
-
},
|
|
1796
|
-
});
|
|
1797
|
-
const worker = f.workers.at(-1)!;
|
|
1798
|
-
const stop = () => {
|
|
1799
|
-
const start = performance.now();
|
|
1800
|
-
return Promise.resolve(handles.at(-1)!.terminate()).then(() => performance.now() - start);
|
|
1801
|
-
};
|
|
1802
|
-
return { f, worker, stop };
|
|
1803
|
-
}
|
|
1804
|
-
|
|
1805
|
-
test("a physical stop selects SIGKILL, then terminates only after the guest reported exit", async () => {
|
|
1806
|
-
const { f, worker, stop } = await stopTimed();
|
|
1807
|
-
try {
|
|
1808
|
-
const stopping = stop();
|
|
1809
|
-
await until(() => readOutcome(f.table.require(f.pid).outcome) !== null);
|
|
1810
|
-
await Bun.sleep(20);
|
|
1811
|
-
// The guest is still unwinding: no terminate() yet.
|
|
1812
|
-
expect(worker.stops).toBe(0);
|
|
1813
|
-
worker.emit({ type: "exit", code: 137, signal: 9 });
|
|
1814
|
-
await stopping;
|
|
1815
|
-
expect(worker.stops).toBe(1);
|
|
1816
|
-
} finally {
|
|
1817
|
-
await f.close();
|
|
1818
|
-
}
|
|
1819
|
-
});
|
|
1820
|
-
|
|
1821
|
-
test("a started guest that never reports exit is still terminated after the bounded wait", async () => {
|
|
1822
|
-
const { f, worker, stop } = await stopTimed();
|
|
1823
|
-
const timers = unwindTimers();
|
|
1824
|
-
try {
|
|
1825
|
-
const waited = await stop();
|
|
1826
|
-
expect(worker.stops).toBe(1);
|
|
1827
|
-
// A lower bound only: the broker waited for the guest before terminate().
|
|
1828
|
-
expect(waited).toBeGreaterThanOrEqual(900);
|
|
1829
|
-
// Control for the parked test below: a real wait schedules one unwind timer.
|
|
1830
|
-
expect(timers.count()).toBe(1);
|
|
1831
|
-
} finally {
|
|
1832
|
-
timers.restore();
|
|
1833
|
-
await f.close();
|
|
1834
|
-
}
|
|
1835
|
-
});
|
|
1836
|
-
|
|
1837
|
-
test("a group member parked in its futex wait is terminated without the wait", async () => {
|
|
1838
|
-
const closedAtTerminate: number[] = [];
|
|
1839
|
-
let cells: Int32Array | undefined;
|
|
1840
|
-
const { f, worker, stop } = await stopTimed({
|
|
1841
|
-
shared: true,
|
|
1842
|
-
stop: () => {
|
|
1843
|
-
if (cells) closedAtTerminate.push(Atomics.load(cells, WAIT_CLOSED));
|
|
1844
|
-
},
|
|
1845
|
-
});
|
|
1846
|
-
try {
|
|
1847
|
-
// A published wait record (odd epoch): SIGKILL does not wake it, so the stop goes straight
|
|
1848
|
-
// to terminate(). The record must already be closed then, so a timed or sibling wake before
|
|
1849
|
-
// terminate() takes effect throws instead of resuming guest code.
|
|
1850
|
-
cells = new Int32Array(worker.request.memoryGroup!.reply);
|
|
1851
|
-
Atomics.store(cells, WAIT_EPOCH, 1);
|
|
1852
|
-
const timers = unwindTimers();
|
|
1853
|
-
try {
|
|
1854
|
-
const stopping = stop();
|
|
1855
|
-
await until(() => worker.stops === 1);
|
|
1856
|
-
await stopping;
|
|
1857
|
-
// The wait was skipped, not just run out: no unwind timer was ever scheduled.
|
|
1858
|
-
expect(timers.count()).toBe(0);
|
|
1859
|
-
} finally {
|
|
1860
|
-
timers.restore();
|
|
1861
|
-
}
|
|
1862
|
-
expect(closedAtTerminate).toEqual([1]);
|
|
1863
|
-
} finally {
|
|
1864
|
-
await f.close();
|
|
1865
|
-
}
|
|
1866
|
-
});
|
|
1867
|
-
|
|
1868
|
-
test("a group member that is not parked has its wait record closed by the stop", async () => {
|
|
1869
|
-
const closedAtTerminate: number[] = [];
|
|
1870
|
-
let cells: Int32Array | undefined;
|
|
1871
|
-
const { f, worker, stop } = await stopTimed({
|
|
1872
|
-
shared: true,
|
|
1873
|
-
stop: () => {
|
|
1874
|
-
if (cells) closedAtTerminate.push(Atomics.load(cells, WAIT_CLOSED));
|
|
1875
|
-
},
|
|
1876
|
-
});
|
|
1877
|
-
try {
|
|
1878
|
-
// Even epoch: not parked. The record is closed anyway, so a member that reaches its futex
|
|
1879
|
-
// wait after the stop signal throws instead of parking, and the stop waits for its report.
|
|
1880
|
-
cells = new Int32Array(worker.request.memoryGroup!.reply);
|
|
1881
|
-
const stopping = stop();
|
|
1882
|
-
await until(() => Atomics.load(cells!, WAIT_CLOSED) === 1);
|
|
1883
|
-
expect(worker.stops).toBe(0);
|
|
1884
|
-
worker.emit({ type: "exit", code: 137, signal: 9 });
|
|
1885
|
-
await stopping;
|
|
1886
|
-
expect(closedAtTerminate).toEqual([1]);
|
|
1887
|
-
} finally {
|
|
1888
|
-
await f.close();
|
|
1889
|
-
}
|
|
1890
|
-
});
|
|
1891
|
-
|
|
1892
|
-
// A physical stop revokes the filesystem in its quiesce fence. A guest that saw the revocation
|
|
1893
|
-
// before any outcome would exit 1, so SIGKILL is selected before the fence runs.
|
|
1894
|
-
test("a physical stop whose SIGKILL publication throws still terminates the worker", async () => {
|
|
1895
|
-
const { f, worker, stop } = await stopTimed();
|
|
1896
|
-
const failure = new Error("injected signal publication failure");
|
|
1897
|
-
const publish = spyOn(
|
|
1898
|
-
f.broker as unknown as { publishStopSignal(pid: number): void },
|
|
1899
|
-
"publishStopSignal",
|
|
1900
|
-
);
|
|
1901
|
-
publish.mockImplementation(() => {
|
|
1902
|
-
throw failure;
|
|
1903
|
-
});
|
|
1904
|
-
try {
|
|
1905
|
-
const stopping = stop();
|
|
1906
|
-
await until(() => publish.mock.calls.length > 0);
|
|
1907
|
-
// No SIGKILL was selected, so the stop waits for the guest's report; give it one.
|
|
1908
|
-
worker.emit({ type: "exit", code: 0 });
|
|
1909
|
-
await stopping;
|
|
1910
|
-
expect(worker.stops).toBe(1);
|
|
1911
|
-
expect(f.diagnostics).toContain(failure);
|
|
1912
|
-
} finally {
|
|
1913
|
-
publish.mockRestore();
|
|
1914
|
-
await f.close();
|
|
1915
|
-
}
|
|
1916
|
-
});
|
|
1917
|
-
|
|
1918
|
-
test("a physical stop selects SIGKILL before its quiesce fence revokes the process", async () => {
|
|
1919
|
-
const atQuiesce: unknown[] = [];
|
|
1920
|
-
let outcome = (): unknown => undefined;
|
|
1921
|
-
const handles: import("../proc/types.js").ProcessHandle[] = [];
|
|
1922
|
-
const f = await fixture({
|
|
1923
|
-
quiesce: () => {
|
|
1924
|
-
atQuiesce.push(outcome());
|
|
1925
|
-
},
|
|
1926
|
-
wrap: (handle) => {
|
|
1927
|
-
handles.push(handle);
|
|
1928
|
-
return handle;
|
|
1929
|
-
},
|
|
1930
|
-
});
|
|
1931
|
-
outcome = () => readOutcome(f.table.require(f.pid).outcome);
|
|
1932
|
-
try {
|
|
1933
|
-
const stopping = handles.at(-1)!.terminate();
|
|
1934
|
-
await until(() => atQuiesce.length > 0);
|
|
1935
|
-
expect(atQuiesce[0]).toMatchObject({ kind: "signaled", code: 9 });
|
|
1936
|
-
f.workers.at(-1)!.emit({ type: "exit", code: 137, signal: 9 });
|
|
1937
|
-
await stopping;
|
|
1938
|
-
} finally {
|
|
1939
|
-
await f.close();
|
|
1940
|
-
}
|
|
1941
|
-
});
|
|
1942
|
-
|
|
1943
|
-
/** Counts the broker's unwind waits: setTimeout calls with STOP_UNWIND_MS (1000). */
|
|
1944
|
-
function unwindTimers() {
|
|
1945
|
-
const spy = spyOn(globalThis, "setTimeout");
|
|
1946
|
-
return {
|
|
1947
|
-
count: () => spy.mock.calls.filter((call) => call[1] === 1000).length,
|
|
1948
|
-
restore: () => spy.mockRestore(),
|
|
1949
|
-
};
|
|
1950
|
-
}
|