@speedkit/cli 4.51.1 → 4.52.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +14 -0
- package/README.md +1426 -14
- package/dist/base/run-control-command.d.ts +15 -0
- package/dist/base/run-control-command.js +20 -0
- package/dist/build-info.json +6 -0
- package/dist/commands/diff.d.ts +7 -1
- package/dist/commands/diff.js +9 -3
- package/dist/commands/login.d.ts +3 -0
- package/dist/commands/login.js +14 -3
- package/dist/commands/onboarding/browser/click.d.ts +75 -0
- package/dist/commands/onboarding/browser/click.js +19 -0
- package/dist/commands/onboarding/browser/emulate.d.ts +105 -0
- package/dist/commands/onboarding/browser/emulate.js +26 -0
- package/dist/commands/onboarding/browser/navigate.d.ts +75 -0
- package/dist/commands/onboarding/browser/navigate.js +19 -0
- package/dist/commands/onboarding/browser/panel.d.ts +63 -0
- package/dist/commands/onboarding/browser/panel.js +12 -0
- package/dist/commands/onboarding/browser/reinstall-sw.d.ts +63 -0
- package/dist/commands/onboarding/browser/reinstall-sw.js +14 -0
- package/dist/commands/onboarding/browser/reset.d.ts +71 -0
- package/dist/commands/onboarding/browser/reset.js +18 -0
- package/dist/commands/onboarding/browser/screenshot.d.ts +77 -0
- package/dist/commands/onboarding/browser/screenshot.js +19 -0
- package/dist/commands/onboarding/browser/state.d.ts +63 -0
- package/dist/commands/onboarding/browser/state.js +12 -0
- package/dist/commands/onboarding/browser/tabs.d.ts +58 -0
- package/dist/commands/onboarding/browser/tabs.js +16 -0
- package/dist/commands/onboarding/cache/clear.d.ts +58 -0
- package/dist/commands/onboarding/cache/clear.js +12 -0
- package/dist/commands/onboarding/cache/errors.d.ts +58 -0
- package/dist/commands/onboarding/cache/errors.js +12 -0
- package/dist/commands/onboarding/cache/evict.d.ts +62 -0
- package/dist/commands/onboarding/cache/evict.js +15 -0
- package/dist/commands/onboarding/cache/get.d.ts +85 -0
- package/dist/commands/onboarding/cache/get.js +17 -0
- package/dist/commands/onboarding/cache/list.d.ts +58 -0
- package/dist/commands/onboarding/cache/list.js +15 -0
- package/dist/commands/onboarding/cache/prewarm.d.ts +73 -0
- package/dist/commands/onboarding/cache/prewarm.js +20 -0
- package/dist/commands/onboarding/cache/refresh.d.ts +62 -0
- package/dist/commands/onboarding/cache/refresh.js +18 -0
- package/dist/commands/onboarding/cdp.d.ts +81 -0
- package/dist/commands/onboarding/cdp.js +18 -0
- package/dist/commands/onboarding/debug/arm.d.ts +83 -0
- package/dist/commands/onboarding/debug/arm.js +19 -0
- package/dist/commands/onboarding/debug/await.d.ts +71 -0
- package/dist/commands/onboarding/debug/await.js +18 -0
- package/dist/commands/onboarding/debug/disarm.d.ts +63 -0
- package/dist/commands/onboarding/debug/disarm.js +12 -0
- package/dist/commands/onboarding/debug/eval.d.ts +75 -0
- package/dist/commands/onboarding/debug/eval.js +16 -0
- package/dist/commands/onboarding/debug/release.d.ts +63 -0
- package/dist/commands/onboarding/debug/release.js +12 -0
- package/dist/commands/onboarding/debug/resume.d.ts +63 -0
- package/dist/commands/onboarding/debug/resume.js +12 -0
- package/dist/commands/onboarding/debug/status.d.ts +63 -0
- package/dist/commands/onboarding/debug/status.js +12 -0
- package/dist/commands/onboarding/debug/step.d.ts +67 -0
- package/dist/commands/onboarding/debug/step.js +15 -0
- package/dist/commands/onboarding/files/list.d.ts +58 -0
- package/dist/commands/onboarding/files/list.js +12 -0
- package/dist/commands/onboarding/files/read.d.ts +73 -0
- package/dist/commands/onboarding/files/read.js +16 -0
- package/dist/commands/onboarding/files/rebuild.d.ts +63 -0
- package/dist/commands/onboarding/files/rebuild.js +18 -0
- package/dist/commands/onboarding/files/validate.d.ts +58 -0
- package/dist/commands/onboarding/files/validate.js +12 -0
- package/dist/commands/onboarding/fouc.d.ts +77 -0
- package/dist/commands/onboarding/fouc.js +16 -0
- package/dist/commands/onboarding/inject/add.d.ts +89 -0
- package/dist/commands/onboarding/inject/add.js +17 -0
- package/dist/commands/onboarding/inject/clear.d.ts +63 -0
- package/dist/commands/onboarding/inject/clear.js +12 -0
- package/dist/commands/onboarding/inject/list.d.ts +63 -0
- package/dist/commands/onboarding/inject/list.js +12 -0
- package/dist/commands/onboarding/inject/read.d.ts +75 -0
- package/dist/commands/onboarding/inject/read.js +18 -0
- package/dist/commands/onboarding/inject/recipes.d.ts +63 -0
- package/dist/commands/onboarding/inject/recipes.js +12 -0
- package/dist/commands/onboarding/inject/remove.d.ts +67 -0
- package/dist/commands/onboarding/inject/remove.js +15 -0
- package/dist/commands/onboarding/list.d.ts +13 -0
- package/dist/commands/onboarding/list.js +12 -0
- package/dist/commands/onboarding/logs.d.ts +41 -0
- package/dist/commands/onboarding/logs.js +257 -0
- package/dist/commands/onboarding/navwalk.d.ts +95 -0
- package/dist/commands/onboarding/navwalk.js +19 -0
- package/dist/commands/onboarding/response.d.ts +67 -0
- package/dist/commands/onboarding/response.js +18 -0
- package/dist/commands/onboarding/rum/beacons.d.ts +75 -0
- package/dist/commands/onboarding/rum/beacons.js +16 -0
- package/dist/commands/onboarding/rum/get.d.ts +77 -0
- package/dist/commands/onboarding/rum/get.js +18 -0
- package/dist/commands/onboarding/rum/key.d.ts +67 -0
- package/dist/commands/onboarding/rum/key.js +13 -0
- package/dist/commands/onboarding/rum/previous.d.ts +63 -0
- package/dist/commands/onboarding/rum/previous.js +12 -0
- package/dist/commands/onboarding/status.d.ts +13 -0
- package/dist/commands/onboarding/status.js +17 -0
- package/dist/commands/onboarding/stop.d.ts +13 -0
- package/dist/commands/onboarding/stop.js +17 -0
- package/dist/commands/onboarding/todo.d.ts +58 -0
- package/dist/commands/onboarding/todo.js +12 -0
- package/dist/commands/onboarding/viewport.d.ts +101 -0
- package/dist/commands/onboarding/viewport.js +18 -0
- package/dist/commands/onboarding/watch.d.ts +93 -0
- package/dist/commands/onboarding/watch.js +16 -0
- package/dist/commands/onboarding.d.ts +26 -0
- package/dist/commands/onboarding.js +221 -4
- package/dist/commands/origin-request.d.ts +4 -0
- package/dist/commands/origin-request.js +4 -0
- package/dist/commands/spec/onboarding.spec.d.ts +1 -0
- package/dist/commands/spec/onboarding.spec.js +127 -0
- package/dist/services/browser-fetch/device-emulation.d.ts +11 -0
- package/dist/services/browser-fetch/device-emulation.js +14 -0
- package/dist/services/cli/build-info.d.ts +33 -0
- package/dist/services/cli/build-info.js +63 -0
- package/dist/services/cli/cli-environment-factory.d.ts +3 -0
- package/dist/services/cli/cli-environment-factory.js +1 -0
- package/dist/services/cli/cli-service-build-context.d.ts +3 -0
- package/dist/services/cli/cli-service-factory.js +1 -1
- package/dist/services/cli/cli-service-model.d.ts +29 -10
- package/dist/services/cli/cli-service.d.ts +60 -11
- package/dist/services/cli/cli-service.js +196 -32
- package/dist/services/cli/index.d.ts +2 -0
- package/dist/services/cli/index.js +2 -0
- package/dist/services/cli/sink.d.ts +47 -0
- package/dist/services/cli/sink.js +31 -0
- package/dist/services/cli/spec/build-identity.spec.d.ts +1 -0
- package/dist/services/cli/spec/build-identity.spec.js +85 -0
- package/dist/services/cli/spec/build-info.spec.d.ts +1 -0
- package/dist/services/cli/spec/build-info.spec.js +10 -0
- package/dist/services/cli/spec/cli-service-log.spec.d.ts +1 -0
- package/dist/services/cli/spec/cli-service-log.spec.js +133 -0
- package/dist/services/cli/spec/cli-service.spec.js +113 -50
- package/dist/services/cli/spec/memory-cli.d.ts +9 -0
- package/dist/services/cli/spec/memory-cli.js +9 -0
- package/dist/services/diff/config-at-ref.d.ts +20 -0
- package/dist/services/diff/config-at-ref.js +33 -0
- package/dist/services/diff/diff-service-build-context.d.ts +12 -0
- package/dist/services/diff/diff-service-build-context.js +45 -1
- package/dist/services/diff/diff-service-factory.d.ts +2 -0
- package/dist/services/diff/diff-service-factory.js +65 -25
- package/dist/services/diff/diff-service.d.ts +11 -0
- package/dist/services/diff/diff-service.js +37 -11
- package/dist/services/diff/page-source.d.ts +12 -0
- package/dist/services/diff/page-source.js +16 -11
- package/dist/services/diff/run-runtime-config.d.ts +33 -0
- package/dist/services/diff/run-runtime-config.js +74 -0
- package/dist/services/diff/sinks/tool-diff-sink.d.ts +3 -2
- package/dist/services/diff/sinks/tool-diff-sink.js +3 -2
- package/dist/services/diff/spec/config-at-ref.spec.d.ts +1 -0
- package/dist/services/diff/spec/config-at-ref.spec.js +46 -0
- package/dist/services/diff/spec/diff-service-build-context.spec.js +19 -0
- package/dist/services/diff/spec/diff-service.spec.js +95 -0
- package/dist/services/diff/spec/run-runtime-config.spec.d.ts +1 -0
- package/dist/services/diff/spec/run-runtime-config.spec.js +87 -0
- package/dist/services/git/git-repository.d.ts +2 -0
- package/dist/services/git/git-repository.js +6 -0
- package/dist/services/integration-api/customer-config-flags.js +1 -0
- package/dist/services/onboarding/browse/browse-service.d.ts +13 -1
- package/dist/services/onboarding/browse/browse-service.js +43 -7
- package/dist/services/onboarding/browser/answer-dialogs.d.ts +12 -0
- package/dist/services/onboarding/browser/answer-dialogs.js +25 -0
- package/dist/services/onboarding/browser/baqend-response.d.ts +17 -1
- package/dist/services/onboarding/browser/baqend-response.js +23 -0
- package/dist/services/onboarding/browser/console-log.d.ts +9 -0
- package/dist/services/onboarding/browser/console-log.js +27 -0
- package/dist/services/onboarding/browser/emulate-device.d.ts +12 -1
- package/dist/services/onboarding/browser/emulate-device.js +68 -13
- package/dist/services/onboarding/browser/executable/executable-validator.js +4 -2
- package/dist/services/onboarding/browser/extension/extension-bridge.js +5 -3
- package/dist/services/onboarding/browser/extension/extension-downloader.js +17 -8
- package/dist/services/onboarding/browser/extension/extension-validator.js +9 -4
- package/dist/services/onboarding/browser/launch-browser.d.ts +2 -1
- package/dist/services/onboarding/browser/launch-browser.js +6 -1
- package/dist/services/onboarding/browser/resume-restarted-workers.d.ts +14 -0
- package/dist/services/onboarding/browser/resume-restarted-workers.js +26 -0
- package/dist/services/onboarding/control/body-inspect.d.ts +24 -0
- package/dist/services/onboarding/control/body-inspect.js +106 -0
- package/dist/services/onboarding/control/browser-session.d.ts +547 -0
- package/dist/services/onboarding/control/browser-session.js +1337 -0
- package/dist/services/onboarding/control/config-validation.d.ts +17 -0
- package/dist/services/onboarding/control/config-validation.js +46 -0
- package/dist/services/onboarding/control/control-protocol.d.ts +1430 -0
- package/dist/services/onboarding/control/control-protocol.js +58 -0
- package/dist/services/onboarding/control/control-server.d.ts +292 -0
- package/dist/services/onboarding/control/control-server.js +1629 -0
- package/dist/services/onboarding/control/debug-session.d.ts +219 -0
- package/dist/services/onboarding/control/debug-session.js +897 -0
- package/dist/services/onboarding/control/fouc.d.ts +23 -0
- package/dist/services/onboarding/control/fouc.js +151 -0
- package/dist/services/onboarding/control/index.d.ts +4 -0
- package/dist/services/onboarding/control/index.js +4 -0
- package/dist/services/onboarding/control/navigate-wait.d.ts +33 -0
- package/dist/services/onboarding/control/navigate-wait.js +56 -0
- package/dist/services/onboarding/control/navwalk.d.ts +65 -0
- package/dist/services/onboarding/control/navwalk.js +248 -0
- package/dist/services/onboarding/control/preload-registry.d.ts +150 -0
- package/dist/services/onboarding/control/preload-registry.js +829 -0
- package/dist/services/onboarding/control/response-explainer.d.ts +24 -0
- package/dist/services/onboarding/control/response-explainer.js +257 -0
- package/dist/services/onboarding/control/rum.d.ts +8 -0
- package/dist/services/onboarding/control/rum.js +220 -0
- package/dist/services/onboarding/control/service-worker-tracker.d.ts +68 -0
- package/dist/services/onboarding/control/service-worker-tracker.js +120 -0
- package/dist/services/onboarding/control/viewport.d.ts +45 -0
- package/dist/services/onboarding/control/viewport.js +344 -0
- package/dist/services/onboarding/control/watch.d.ts +26 -0
- package/dist/services/onboarding/control/watch.js +157 -0
- package/dist/services/onboarding/dashboard/diff-against-current-page.js +3 -1
- package/dist/services/onboarding/dashboard/index.js +7 -2
- package/dist/services/onboarding/fetch-event-handler.d.ts +24 -5
- package/dist/services/onboarding/fetch-event-handler.js +103 -32
- package/dist/services/onboarding/fetch-events/speed-kit-install-js.js +11 -2
- package/dist/services/onboarding/fetch-events/speed-kit-rum-pi-request.d.ts +14 -0
- package/dist/services/onboarding/fetch-events/speed-kit-rum-pi-request.js +30 -0
- package/dist/services/onboarding/fetch-events/speed-kit-service-worker-js.d.ts +13 -0
- package/dist/services/onboarding/fetch-events/speed-kit-service-worker-js.js +28 -1
- package/dist/services/onboarding/file-events/file-watcher.d.ts +42 -1
- package/dist/services/onboarding/file-events/file-watcher.js +117 -12
- package/dist/services/onboarding/inject/inject-service.js +1 -1
- package/dist/services/onboarding/onboarding-model.d.ts +40 -7
- package/dist/services/onboarding/onboarding-model.js +20 -9
- package/dist/services/onboarding/onboarding-service-build-context.d.ts +4 -0
- package/dist/services/onboarding/onboarding-service-build-context.js +7 -1
- package/dist/services/onboarding/onboarding-service-factory.d.ts +17 -1
- package/dist/services/onboarding/onboarding-service-factory.js +150 -23
- package/dist/services/onboarding/onboarding-service.d.ts +40 -1
- package/dist/services/onboarding/onboarding-service.js +139 -23
- package/dist/services/onboarding/request-cache/asset-key.d.ts +61 -0
- package/dist/services/onboarding/request-cache/asset-key.js +115 -0
- package/dist/services/onboarding/request-cache/cache.d.ts +62 -5
- package/dist/services/onboarding/request-cache/cache.js +128 -17
- package/dist/services/onboarding/spec/browser/answer-dialogs.spec.d.ts +1 -0
- package/dist/services/onboarding/spec/browser/answer-dialogs.spec.js +66 -0
- package/dist/services/onboarding/spec/browser/console-log.spec.d.ts +1 -0
- package/dist/services/onboarding/spec/browser/console-log.spec.js +42 -0
- package/dist/services/onboarding/spec/browser/resume-restarted-workers.spec.d.ts +1 -0
- package/dist/services/onboarding/spec/browser/resume-restarted-workers.spec.js +45 -0
- package/dist/services/onboarding/spec/control/browser-session.spec.d.ts +1 -0
- package/dist/services/onboarding/spec/control/browser-session.spec.js +753 -0
- package/dist/services/onboarding/spec/control/control-server.spec.d.ts +1 -0
- package/dist/services/onboarding/spec/control/control-server.spec.js +371 -0
- package/dist/services/onboarding/spec/control/debug-session.spec.d.ts +1 -0
- package/dist/services/onboarding/spec/control/debug-session.spec.js +751 -0
- package/dist/services/onboarding/spec/control/fakes.d.ts +31 -0
- package/dist/services/onboarding/spec/control/fakes.js +67 -0
- package/dist/services/onboarding/spec/control/fouc.spec.d.ts +1 -0
- package/dist/services/onboarding/spec/control/fouc.spec.js +167 -0
- package/dist/services/onboarding/spec/control/navigate-wait.spec.d.ts +1 -0
- package/dist/services/onboarding/spec/control/navigate-wait.spec.js +47 -0
- package/dist/services/onboarding/spec/control/navwalk.spec.d.ts +1 -0
- package/dist/services/onboarding/spec/control/navwalk.spec.js +222 -0
- package/dist/services/onboarding/spec/control/preload-registry.spec.d.ts +1 -0
- package/dist/services/onboarding/spec/control/preload-registry.spec.js +432 -0
- package/dist/services/onboarding/spec/control/response-explainer.spec.d.ts +1 -0
- package/dist/services/onboarding/spec/control/response-explainer.spec.js +324 -0
- package/dist/services/onboarding/spec/control/rum.spec.d.ts +1 -0
- package/dist/services/onboarding/spec/control/rum.spec.js +222 -0
- package/dist/services/onboarding/spec/control/service-worker-tracker.spec.d.ts +1 -0
- package/dist/services/onboarding/spec/control/service-worker-tracker.spec.js +193 -0
- package/dist/services/onboarding/spec/control/viewport.spec.d.ts +1 -0
- package/dist/services/onboarding/spec/control/viewport.spec.js +200 -0
- package/dist/services/onboarding/spec/control/watch.spec.d.ts +1 -0
- package/dist/services/onboarding/spec/control/watch.spec.js +187 -0
- package/dist/services/onboarding/spec/fetch-event-handler.spec.d.ts +1 -0
- package/dist/services/onboarding/spec/fetch-event-handler.spec.js +219 -0
- package/dist/services/onboarding/spec/fetch-events/speed-kit-service-worker-js.spec.d.ts +1 -0
- package/dist/services/onboarding/spec/fetch-events/speed-kit-service-worker-js.spec.js +41 -0
- package/dist/services/onboarding/spec/onboarding-model.spec.js +39 -3
- package/dist/services/onboarding/spec/onboarding-service-factory.spec.js +25 -1
- package/dist/services/onboarding/spec/request-cache/cache.spec.d.ts +1 -0
- package/dist/services/onboarding/spec/request-cache/cache.spec.js +107 -0
- package/dist/services/onboarding/spec/todo-collector.spec.d.ts +1 -0
- package/dist/services/onboarding/spec/todo-collector.spec.js +136 -0
- package/dist/services/onboarding/spec/virtual-orestes-app/virtual-orestes-app.spec.d.ts +1 -0
- package/dist/services/onboarding/spec/virtual-orestes-app/virtual-orestes-app.spec.js +65 -0
- package/dist/services/onboarding/templates/install-speed-kit-html-template.js +11 -0
- package/dist/services/onboarding/templates/spec/install-speed-kit-html-template.spec.d.ts +1 -0
- package/dist/services/onboarding/templates/spec/install-speed-kit-html-template.spec.js +119 -0
- package/dist/services/onboarding/todo-collector.d.ts +7 -2
- package/dist/services/onboarding/todo-collector.js +49 -12
- package/dist/services/onboarding/virtual-orestes-app/index.d.ts +38 -0
- package/dist/services/onboarding/virtual-orestes-app/index.js +113 -27
- package/dist/services/origin-request/asset-variations.d.ts +14 -0
- package/dist/services/origin-request/asset-variations.js +11 -4
- package/dist/services/origin-request/origin-fetcher.d.ts +7 -0
- package/dist/services/origin-request/origin-fetcher.js +43 -5
- package/dist/services/origin-request/origin-request-service-build-context.d.ts +17 -0
- package/dist/services/origin-request/origin-request-service-build-context.js +8 -0
- package/dist/services/origin-request/origin-request-service-factory.d.ts +0 -5
- package/dist/services/origin-request/origin-request-service-factory.js +2 -30
- package/dist/services/origin-request/origin-request-service.d.ts +121 -6
- package/dist/services/origin-request/origin-request-service.js +273 -49
- package/dist/services/origin-request/runtime-config-source.d.ts +6 -0
- package/dist/services/origin-request/runtime-config-source.js +15 -4
- package/dist/services/origin-request/spec/asset-variations.spec.js +20 -0
- package/dist/services/origin-request/spec/origin-request-service.spec.js +329 -6
- package/dist/services/query-builder/rules/rule-match.d.ts +35 -0
- package/dist/services/query-builder/rules/rule-match.js +70 -0
- package/dist/services/query-builder/spec/rules/rule-match.spec.d.ts +1 -0
- package/dist/services/query-builder/spec/rules/rule-match.spec.js +121 -0
- package/dist/services/run-control/browser/run-browser-contexts.d.ts +557 -0
- package/dist/services/run-control/browser/run-browser-contexts.js +91 -0
- package/dist/services/run-control/browser/run-browser-service-factory.d.ts +5 -0
- package/dist/services/run-control/browser/run-browser-service-factory.js +7 -0
- package/dist/services/run-control/browser/run-browser-service.d.ts +68 -0
- package/dist/services/run-control/browser/run-browser-service.js +206 -0
- package/dist/services/run-control/cache/run-cache-contexts.d.ts +349 -0
- package/dist/services/run-control/cache/run-cache-contexts.js +51 -0
- package/dist/services/run-control/cache/run-cache-service-factory.d.ts +6 -0
- package/dist/services/run-control/cache/run-cache-service-factory.js +12 -0
- package/dist/services/run-control/cache/run-cache-service.d.ts +35 -0
- package/dist/services/run-control/cache/run-cache-service.js +151 -0
- package/dist/services/run-control/control-client.d.ts +36 -0
- package/dist/services/run-control/control-client.js +147 -0
- package/dist/services/run-control/debug/run-debug-contexts.d.ts +416 -0
- package/dist/services/run-control/debug/run-debug-contexts.js +47 -0
- package/dist/services/run-control/debug/run-debug-service-factory.d.ts +5 -0
- package/dist/services/run-control/debug/run-debug-service-factory.js +7 -0
- package/dist/services/run-control/debug/run-debug-service.d.ts +39 -0
- package/dist/services/run-control/debug/run-debug-service.js +164 -0
- package/dist/services/run-control/files/run-files-contexts.d.ts +238 -0
- package/dist/services/run-control/files/run-files-contexts.js +26 -0
- package/dist/services/run-control/files/run-files-service-factory.d.ts +5 -0
- package/dist/services/run-control/files/run-files-service-factory.js +7 -0
- package/dist/services/run-control/files/run-files-service.d.ts +29 -0
- package/dist/services/run-control/files/run-files-service.js +120 -0
- package/dist/services/run-control/index.d.ts +32 -0
- package/dist/services/run-control/index.js +31 -0
- package/dist/services/run-control/inject/run-inject-contexts.d.ts +319 -0
- package/dist/services/run-control/inject/run-inject-contexts.js +38 -0
- package/dist/services/run-control/inject/run-inject-service-factory.d.ts +5 -0
- package/dist/services/run-control/inject/run-inject-service-factory.js +7 -0
- package/dist/services/run-control/inject/run-inject-service.d.ts +31 -0
- package/dist/services/run-control/inject/run-inject-service.js +227 -0
- package/dist/services/run-control/live-run.d.ts +37 -0
- package/dist/services/run-control/live-run.js +56 -0
- package/dist/services/run-control/probe/run-probe-contexts.d.ts +333 -0
- package/dist/services/run-control/probe/run-probe-contexts.js +73 -0
- package/dist/services/run-control/probe/run-probe-service-factory.d.ts +5 -0
- package/dist/services/run-control/probe/run-probe-service-factory.js +7 -0
- package/dist/services/run-control/probe/run-probe-service.d.ts +54 -0
- package/dist/services/run-control/probe/run-probe-service.js +194 -0
- package/dist/services/run-control/rum/run-rum-contexts.d.ts +216 -0
- package/dist/services/run-control/rum/run-rum-contexts.js +34 -0
- package/dist/services/run-control/rum/run-rum-service-factory.d.ts +5 -0
- package/dist/services/run-control/rum/run-rum-service-factory.js +7 -0
- package/dist/services/run-control/rum/run-rum-service.d.ts +36 -0
- package/dist/services/run-control/rum/run-rum-service.js +122 -0
- package/dist/services/run-control/run-answer.d.ts +28 -0
- package/dist/services/run-control/run-answer.js +58 -0
- package/dist/services/run-control/run-control-context.d.ts +102 -0
- package/dist/services/run-control/run-control-context.js +36 -0
- package/dist/services/run-control/run-control-flags.d.ts +12 -0
- package/dist/services/run-control/run-control-flags.js +22 -0
- package/dist/services/run-control/run-control-model.d.ts +9 -0
- package/dist/services/run-control/run-control-model.js +1 -0
- package/dist/services/run-control/run-control-service-factory.d.ts +14 -0
- package/dist/services/run-control/run-control-service-factory.js +26 -0
- package/dist/services/run-control/session/run-session-contexts.d.ts +25 -0
- package/dist/services/run-control/session/run-session-contexts.js +20 -0
- package/dist/services/run-control/session/run-session-service-factory.d.ts +8 -0
- package/dist/services/run-control/session/run-session-service-factory.js +18 -0
- package/dist/services/run-control/session/run-session-service.d.ts +32 -0
- package/dist/services/run-control/session/run-session-service.js +151 -0
- package/dist/services/run-control/spec/browser/run-browser-service.spec.d.ts +1 -0
- package/dist/services/run-control/spec/browser/run-browser-service.spec.js +328 -0
- package/dist/services/run-control/spec/cache/run-cache-service.spec.d.ts +1 -0
- package/dist/services/run-control/spec/cache/run-cache-service.spec.js +454 -0
- package/dist/services/run-control/spec/debug/run-debug-service.spec.d.ts +1 -0
- package/dist/services/run-control/spec/debug/run-debug-service.spec.js +113 -0
- package/dist/services/run-control/spec/files/run-files-service.spec.d.ts +1 -0
- package/dist/services/run-control/spec/files/run-files-service.spec.js +234 -0
- package/dist/services/run-control/spec/inject/run-inject-service.spec.d.ts +1 -0
- package/dist/services/run-control/spec/inject/run-inject-service.spec.js +251 -0
- package/dist/services/run-control/spec/live-run-fixture.d.ts +32 -0
- package/dist/services/run-control/spec/live-run-fixture.js +109 -0
- package/dist/services/run-control/spec/probe/run-probe-service.spec.d.ts +1 -0
- package/dist/services/run-control/spec/probe/run-probe-service.spec.js +108 -0
- package/dist/services/run-control/spec/rum/run-rum-service.spec.d.ts +1 -0
- package/dist/services/run-control/spec/rum/run-rum-service.spec.js +47 -0
- package/dist/services/run-control/spec/run-answer.spec.d.ts +1 -0
- package/dist/services/run-control/spec/run-answer.spec.js +57 -0
- package/dist/services/run-control/spec/session/run-session-service.spec.d.ts +1 -0
- package/dist/services/run-control/spec/session/run-session-service.spec.js +150 -0
- package/dist/services/run-log/crash-mirror.d.ts +31 -0
- package/dist/services/run-log/crash-mirror.js +69 -0
- package/dist/services/run-log/index.d.ts +11 -0
- package/dist/services/run-log/index.js +11 -0
- package/dist/services/run-log/jsonl-appender.d.ts +46 -0
- package/dist/services/run-log/jsonl-appender.js +91 -0
- package/dist/services/run-log/log-event-model.d.ts +104 -0
- package/dist/services/run-log/log-event-model.js +56 -0
- package/dist/services/run-log/log-query-service-factory.d.ts +11 -0
- package/dist/services/run-log/log-query-service-factory.js +14 -0
- package/dist/services/run-log/log-query-service.d.ts +59 -0
- package/dist/services/run-log/log-query-service.js +111 -0
- package/dist/services/run-log/log-reader.d.ts +84 -0
- package/dist/services/run-log/log-reader.js +180 -0
- package/dist/services/run-log/log-summary.d.ts +72 -0
- package/dist/services/run-log/log-summary.js +208 -0
- package/dist/services/run-log/redaction.d.ts +34 -0
- package/dist/services/run-log/redaction.js +124 -0
- package/dist/services/run-log/request-log.d.ts +82 -0
- package/dist/services/run-log/request-log.js +69 -0
- package/dist/services/run-log/request-summary.d.ts +76 -0
- package/dist/services/run-log/request-summary.js +0 -0
- package/dist/services/run-log/run-log.d.ts +61 -0
- package/dist/services/run-log/run-log.js +102 -0
- package/dist/services/run-log/spec/log-query-service.spec.d.ts +1 -0
- package/dist/services/run-log/spec/log-query-service.spec.js +197 -0
- package/dist/services/run-log/spec/log-reader.spec.d.ts +1 -0
- package/dist/services/run-log/spec/log-reader.spec.js +109 -0
- package/dist/services/run-log/spec/log-summary.spec.d.ts +1 -0
- package/dist/services/run-log/spec/log-summary.spec.js +153 -0
- package/dist/services/run-log/spec/redaction.spec.d.ts +1 -0
- package/dist/services/run-log/spec/redaction.spec.js +61 -0
- package/dist/services/run-log/spec/request-log.spec.d.ts +1 -0
- package/dist/services/run-log/spec/request-log.spec.js +101 -0
- package/dist/services/run-log/spec/request-summary.spec.d.ts +1 -0
- package/dist/services/run-log/spec/request-summary.spec.js +171 -0
- package/dist/services/run-log/spec/run-log.spec.d.ts +1 -0
- package/dist/services/run-log/spec/run-log.spec.js +122 -0
- package/dist/services/run-registry/exit-classification.d.ts +39 -0
- package/dist/services/run-registry/exit-classification.js +42 -0
- package/dist/services/run-registry/index.d.ts +3 -0
- package/dist/services/run-registry/index.js +3 -0
- package/dist/services/run-registry/process-identity.d.ts +28 -0
- package/dist/services/run-registry/process-identity.js +80 -0
- package/dist/services/run-registry/run-registry-model.d.ts +128 -0
- package/dist/services/run-registry/run-registry-model.js +16 -0
- package/dist/services/run-registry/run-registry.d.ts +155 -0
- package/dist/services/run-registry/run-registry.js +430 -0
- package/dist/services/run-registry/spec/exit-classification.spec.d.ts +1 -0
- package/dist/services/run-registry/spec/exit-classification.spec.js +82 -0
- package/dist/services/run-registry/spec/run-registry.spec.d.ts +1 -0
- package/dist/services/run-registry/spec/run-registry.spec.js +526 -0
- package/dist/services/setup/os/tool-registry.js +2 -2
- package/oclif.manifest.json +3414 -293
- package/package.json +20 -2
|
@@ -0,0 +1,526 @@
|
|
|
1
|
+
import { expect } from "chai";
|
|
2
|
+
import { afterEach, beforeEach, describe, it } from "mocha";
|
|
3
|
+
import { existsSync, mkdtempSync, mkdirSync, readlinkSync, rmSync, truncateSync, writeFileSync, } from "node:fs";
|
|
4
|
+
import { tmpdir } from "node:os";
|
|
5
|
+
import { join } from "node:path";
|
|
6
|
+
import { AmbiguousRunError, NoSuchRunError, RunRegistry, } from "../run-registry.js";
|
|
7
|
+
import { CURRENT_LINK, META_FILE } from "../run-registry-model.js";
|
|
8
|
+
import { processStartToken, sameProcess } from "../process-identity.js";
|
|
9
|
+
import { KEEP_BYTES } from "../run-registry-model.js";
|
|
10
|
+
/** A pid nothing can be running under, so the registry must call it dead. */
|
|
11
|
+
const DEAD_PID = 2_147_483_646;
|
|
12
|
+
describe("RunRegistry", () => {
|
|
13
|
+
let cacheDirectory;
|
|
14
|
+
let registry;
|
|
15
|
+
const writeRun = (meta) => {
|
|
16
|
+
const full = {
|
|
17
|
+
customer: "example.com",
|
|
18
|
+
customerPath: "customers/example.com",
|
|
19
|
+
configName: "production",
|
|
20
|
+
pid: DEAD_PID,
|
|
21
|
+
startedAt: new Date().toISOString(),
|
|
22
|
+
status: "finished",
|
|
23
|
+
flags: {
|
|
24
|
+
local: false,
|
|
25
|
+
headless: false,
|
|
26
|
+
useTestConfig: false,
|
|
27
|
+
ignoreContentSecurityPolicy: false,
|
|
28
|
+
},
|
|
29
|
+
cliVersion: "0.0.0",
|
|
30
|
+
...meta,
|
|
31
|
+
};
|
|
32
|
+
const dir = join(registry.directory, full.id);
|
|
33
|
+
mkdirSync(dir, { recursive: true });
|
|
34
|
+
writeFileSync(join(dir, META_FILE), JSON.stringify(full));
|
|
35
|
+
return dir;
|
|
36
|
+
};
|
|
37
|
+
beforeEach(() => {
|
|
38
|
+
cacheDirectory = mkdtempSync(join(tmpdir(), "sk-runs-"));
|
|
39
|
+
registry = new RunRegistry(cacheDirectory);
|
|
40
|
+
});
|
|
41
|
+
afterEach(() => {
|
|
42
|
+
rmSync(cacheDirectory, { recursive: true, force: true });
|
|
43
|
+
});
|
|
44
|
+
it("should answer an empty listing before anything has run", () => {
|
|
45
|
+
expect(registry.list()).to.deep.equal([]);
|
|
46
|
+
expect(registry.liveRuns()).to.deep.equal([]);
|
|
47
|
+
});
|
|
48
|
+
it("should record a starting run and find it again", () => {
|
|
49
|
+
const handle = registry.start({
|
|
50
|
+
customerPath: "customers/example.com",
|
|
51
|
+
configName: "production",
|
|
52
|
+
cliVersion: "1.2.3",
|
|
53
|
+
flags: {
|
|
54
|
+
local: true,
|
|
55
|
+
headless: false,
|
|
56
|
+
useTestConfig: false,
|
|
57
|
+
ignoreContentSecurityPolicy: false,
|
|
58
|
+
},
|
|
59
|
+
});
|
|
60
|
+
const [run] = registry.list();
|
|
61
|
+
expect(run.meta.id).to.equal(handle.id);
|
|
62
|
+
expect(run.meta.customer).to.equal("example.com");
|
|
63
|
+
expect(run.meta.pid).to.equal(process.pid);
|
|
64
|
+
expect(run.meta.flags.local).to.equal(true);
|
|
65
|
+
// this process is alive, so its own run must read as live
|
|
66
|
+
expect(run.status).to.equal("running");
|
|
67
|
+
expect(run.live).to.equal(true);
|
|
68
|
+
});
|
|
69
|
+
it("should name a browse run without a customer directory after its host", () => {
|
|
70
|
+
registry.start({
|
|
71
|
+
domain: "https://www.example.com/de",
|
|
72
|
+
configName: "production",
|
|
73
|
+
cliVersion: "1.2.3",
|
|
74
|
+
flags: {
|
|
75
|
+
local: true,
|
|
76
|
+
headless: true,
|
|
77
|
+
useTestConfig: false,
|
|
78
|
+
ignoreContentSecurityPolicy: false,
|
|
79
|
+
},
|
|
80
|
+
});
|
|
81
|
+
const [run] = registry.list();
|
|
82
|
+
expect(run.meta.customer).to.equal("www.example.com");
|
|
83
|
+
expect(run.meta.customerDir).to.equal(undefined);
|
|
84
|
+
expect(registry.conflicts({}).sameCustomer).to.deep.equal([]);
|
|
85
|
+
});
|
|
86
|
+
it("should call a run that claims to be running but is not, crashed", () => {
|
|
87
|
+
writeRun({ id: "example.com-production-1", status: "running" });
|
|
88
|
+
const [run] = registry.list();
|
|
89
|
+
expect(run.meta.status).to.equal("running"); // the claim is untouched
|
|
90
|
+
expect(run.status).to.equal("crashed"); // the reconciled answer
|
|
91
|
+
expect(run.live).to.equal(false);
|
|
92
|
+
});
|
|
93
|
+
it("should record why a run ended, alongside how", () => {
|
|
94
|
+
const handle = registry.start({
|
|
95
|
+
customerPath: "customers/example.com",
|
|
96
|
+
configName: "production",
|
|
97
|
+
cliVersion: "1.2.3",
|
|
98
|
+
flags: {
|
|
99
|
+
local: false,
|
|
100
|
+
headless: false,
|
|
101
|
+
useTestConfig: false,
|
|
102
|
+
ignoreContentSecurityPolicy: false,
|
|
103
|
+
},
|
|
104
|
+
});
|
|
105
|
+
// A teardown that throws after a requested stop is still a stop — but the
|
|
106
|
+
// message is worth keeping, or the status hides it.
|
|
107
|
+
handle.finish("stopped", "Target closed");
|
|
108
|
+
const [run] = registry.list();
|
|
109
|
+
expect(run.status).to.equal("stopped");
|
|
110
|
+
expect(run.meta.error).to.equal("Target closed");
|
|
111
|
+
});
|
|
112
|
+
it("should stamp an outcome, and let the first stamp win", () => {
|
|
113
|
+
const handle = registry.start({
|
|
114
|
+
customerPath: "customers/example.com",
|
|
115
|
+
configName: "production",
|
|
116
|
+
cliVersion: "1.2.3",
|
|
117
|
+
flags: {
|
|
118
|
+
local: false,
|
|
119
|
+
headless: false,
|
|
120
|
+
useTestConfig: false,
|
|
121
|
+
ignoreContentSecurityPolicy: false,
|
|
122
|
+
},
|
|
123
|
+
});
|
|
124
|
+
handle.finish("failed");
|
|
125
|
+
handle.finish("finished"); // a later `finally` must not overwrite it
|
|
126
|
+
const [run] = registry.list();
|
|
127
|
+
expect(run.status).to.equal("failed");
|
|
128
|
+
expect(run.meta.endedAt).to.be.a("string");
|
|
129
|
+
});
|
|
130
|
+
it("should fill in what was not known at startup", () => {
|
|
131
|
+
const handle = registry.start({
|
|
132
|
+
customerPath: "customers/example.com",
|
|
133
|
+
configName: "production",
|
|
134
|
+
cliVersion: "1.2.3",
|
|
135
|
+
flags: {
|
|
136
|
+
local: false,
|
|
137
|
+
headless: false,
|
|
138
|
+
useTestConfig: false,
|
|
139
|
+
ignoreContentSecurityPolicy: false,
|
|
140
|
+
},
|
|
141
|
+
});
|
|
142
|
+
handle.update({ app: "example-app" });
|
|
143
|
+
expect(registry.list()[0].meta.app).to.equal("example-app");
|
|
144
|
+
});
|
|
145
|
+
it("should list newest first", () => {
|
|
146
|
+
writeRun({ id: "a-production-1", startedAt: "2026-09-01T00:00:00.000Z" });
|
|
147
|
+
writeRun({ id: "b-production-2", startedAt: "2026-09-03T00:00:00.000Z" });
|
|
148
|
+
writeRun({ id: "c-production-3", startedAt: "2026-09-02T00:00:00.000Z" });
|
|
149
|
+
expect(registry.list().map((run) => run.meta.id)).to.deep.equal([
|
|
150
|
+
"b-production-2",
|
|
151
|
+
"c-production-3",
|
|
152
|
+
"a-production-1",
|
|
153
|
+
]);
|
|
154
|
+
});
|
|
155
|
+
it("should ignore a half-written meta.json rather than fail the listing", () => {
|
|
156
|
+
writeRun({ id: "good-production-1" });
|
|
157
|
+
const broken = join(registry.directory, "broken-production-2");
|
|
158
|
+
mkdirSync(broken, { recursive: true });
|
|
159
|
+
writeFileSync(join(broken, META_FILE), "{ not json");
|
|
160
|
+
expect(registry.list().map((run) => run.meta.id)).to.deep.equal([
|
|
161
|
+
"good-production-1",
|
|
162
|
+
]);
|
|
163
|
+
});
|
|
164
|
+
describe("conflicts", () => {
|
|
165
|
+
const liveRun = (id, extra = {}) => writeRun({
|
|
166
|
+
id,
|
|
167
|
+
status: "running",
|
|
168
|
+
pid: process.pid,
|
|
169
|
+
startToken: processStartToken(process.pid) ?? undefined,
|
|
170
|
+
...extra,
|
|
171
|
+
});
|
|
172
|
+
it("should find nothing when nothing is running", () => {
|
|
173
|
+
writeRun({ id: "ended-production-1" });
|
|
174
|
+
expect(registry.conflicts({ customerPath: "customers/example.com" })).to.deep.equal({ sameCustomer: [], samePort: [] });
|
|
175
|
+
});
|
|
176
|
+
it("should recognise the same directory spelled differently", () => {
|
|
177
|
+
liveRun("example.com-production-1", {
|
|
178
|
+
customerPath: "./customers/example.com/",
|
|
179
|
+
});
|
|
180
|
+
const { sameCustomer } = registry.conflicts({
|
|
181
|
+
customerPath: "customers/example.com",
|
|
182
|
+
});
|
|
183
|
+
// The same customer is routinely given as `customers/x`, `./customers/x`
|
|
184
|
+
// and `./customers/x/`; they are one directory and one collision.
|
|
185
|
+
expect(sameCustomer.map((run) => run.meta.id)).to.deep.equal([
|
|
186
|
+
"example.com-production-1",
|
|
187
|
+
]);
|
|
188
|
+
});
|
|
189
|
+
it("should not call a different customer a collision", () => {
|
|
190
|
+
liveRun("other.com-production-1", {
|
|
191
|
+
customerPath: "customers/other.com",
|
|
192
|
+
});
|
|
193
|
+
expect(registry.conflicts({ customerPath: "customers/example.com" })
|
|
194
|
+
.sameCustomer).to.deep.equal([]);
|
|
195
|
+
});
|
|
196
|
+
it("should report a live run holding the debug port", () => {
|
|
197
|
+
liveRun("other.com-production-1", {
|
|
198
|
+
customerPath: "customers/other.com",
|
|
199
|
+
debugPort: 9222,
|
|
200
|
+
});
|
|
201
|
+
const { samePort, sameCustomer } = registry.conflicts({
|
|
202
|
+
customerPath: "customers/example.com",
|
|
203
|
+
debugPort: 9222,
|
|
204
|
+
});
|
|
205
|
+
// A different customer entirely, but the port is the thing that collides.
|
|
206
|
+
expect(samePort.map((run) => run.meta.id)).to.deep.equal([
|
|
207
|
+
"other.com-production-1",
|
|
208
|
+
]);
|
|
209
|
+
expect(sameCustomer).to.deep.equal([]);
|
|
210
|
+
});
|
|
211
|
+
it("should say nothing about the port when this run will not open one", () => {
|
|
212
|
+
liveRun("other.com-production-1", {
|
|
213
|
+
customerPath: "customers/other.com",
|
|
214
|
+
debugPort: 9222,
|
|
215
|
+
});
|
|
216
|
+
// Without -p the new run records no port and opens none, so the other
|
|
217
|
+
// run holding 9222 is not its problem.
|
|
218
|
+
expect(registry.conflicts({ customerPath: "customers/example.com" }).samePort).to.deep.equal([]);
|
|
219
|
+
});
|
|
220
|
+
it("should ignore a port held by a run that has ended", () => {
|
|
221
|
+
writeRun({ id: "other.com-production-1", debugPort: 9222 });
|
|
222
|
+
expect(registry.conflicts({
|
|
223
|
+
customerPath: "customers/example.com",
|
|
224
|
+
debugPort: 9222,
|
|
225
|
+
}).samePort).to.deep.equal([]);
|
|
226
|
+
});
|
|
227
|
+
it("should report both when both collide", () => {
|
|
228
|
+
liveRun("example.com-production-1", { debugPort: 9222 });
|
|
229
|
+
const conflicts = registry.conflicts({
|
|
230
|
+
customerPath: "customers/example.com",
|
|
231
|
+
debugPort: 9222,
|
|
232
|
+
});
|
|
233
|
+
expect(conflicts.sameCustomer).to.have.lengthOf(1);
|
|
234
|
+
expect(conflicts.samePort).to.have.lengthOf(1);
|
|
235
|
+
});
|
|
236
|
+
});
|
|
237
|
+
describe("retention", () => {
|
|
238
|
+
/**
|
|
239
|
+
* A run whose cache reports `bytes`.
|
|
240
|
+
*
|
|
241
|
+
* Sparse: truncate sets the size the pruner measures without the test
|
|
242
|
+
* having to write half a gigabyte to find out whether it is counted.
|
|
243
|
+
*/
|
|
244
|
+
const withCachedBytes = (dir, bytes) => {
|
|
245
|
+
mkdirSync(join(dir, "dh-cache"), { recursive: true });
|
|
246
|
+
const path = join(dir, "dh-cache", "a.body");
|
|
247
|
+
writeFileSync(path, "");
|
|
248
|
+
truncateSync(path, bytes);
|
|
249
|
+
};
|
|
250
|
+
const writeHeavyRun = (id, startedAt, bytes) => withCachedBytes(writeRun({ id, startedAt }), bytes);
|
|
251
|
+
it("should evict oldest-first once the runs outgrow their budget", () => {
|
|
252
|
+
// Well inside the count and age rules, and far outside the byte one —
|
|
253
|
+
// which is the gap: those rules count runs, and what grows is bytes.
|
|
254
|
+
const chunk = Math.ceil(KEEP_BYTES / 3);
|
|
255
|
+
writeHeavyRun("a-production-1", "2026-09-01T00:00:00.000Z", chunk);
|
|
256
|
+
writeHeavyRun("b-production-2", "2026-09-02T00:00:00.000Z", chunk);
|
|
257
|
+
writeHeavyRun("c-production-3", "2026-09-03T00:00:00.000Z", chunk);
|
|
258
|
+
writeHeavyRun("d-production-4", "2026-09-04T00:00:00.000Z", chunk);
|
|
259
|
+
registry.prune();
|
|
260
|
+
const kept = registry.list().map((run) => run.meta.id);
|
|
261
|
+
expect(kept).to.not.contain("a-production-1");
|
|
262
|
+
expect(kept).to.contain("d-production-4");
|
|
263
|
+
});
|
|
264
|
+
it("should never evict a live run, however large", () => {
|
|
265
|
+
const dir = writeRun({
|
|
266
|
+
id: "live-production-1",
|
|
267
|
+
status: "running",
|
|
268
|
+
pid: process.pid,
|
|
269
|
+
startToken: processStartToken(process.pid) ?? undefined,
|
|
270
|
+
});
|
|
271
|
+
withCachedBytes(dir, KEEP_BYTES + 1);
|
|
272
|
+
registry.prune();
|
|
273
|
+
// Taking the cache out from under a running session would be worse than
|
|
274
|
+
// the disk it saves.
|
|
275
|
+
expect(registry.list().map((run) => run.meta.id)).to.contain("live-production-1");
|
|
276
|
+
});
|
|
277
|
+
});
|
|
278
|
+
describe("the current link", () => {
|
|
279
|
+
it("should hand current to a live run when the newest one ends", () => {
|
|
280
|
+
writeRun({
|
|
281
|
+
id: "live-production-1",
|
|
282
|
+
status: "running",
|
|
283
|
+
pid: process.pid,
|
|
284
|
+
startToken: processStartToken(process.pid) ?? undefined,
|
|
285
|
+
});
|
|
286
|
+
const handle = registry.start({
|
|
287
|
+
customerPath: "customers/later.com",
|
|
288
|
+
configName: "production",
|
|
289
|
+
cliVersion: "1.2.3",
|
|
290
|
+
flags: {
|
|
291
|
+
local: false,
|
|
292
|
+
headless: false,
|
|
293
|
+
useTestConfig: false,
|
|
294
|
+
ignoreContentSecurityPolicy: false,
|
|
295
|
+
},
|
|
296
|
+
});
|
|
297
|
+
// No link at all while two are live: `current` names one directory, so
|
|
298
|
+
// pointing it at the newer of two running sessions is exactly the
|
|
299
|
+
// confident wrong answer the link exists to avoid.
|
|
300
|
+
expect(existsSync(join(registry.directory, CURRENT_LINK))).to.equal(false);
|
|
301
|
+
handle.finish("finished");
|
|
302
|
+
// A current that points at a finished run while a live one sits next to
|
|
303
|
+
// it is a confident wrong answer for anyone reading it by hand.
|
|
304
|
+
expect(readlinkSync(join(registry.directory, CURRENT_LINK))).to.equal("live-production-1");
|
|
305
|
+
});
|
|
306
|
+
it("should point current at the only live run", () => {
|
|
307
|
+
const handle = registry.start({
|
|
308
|
+
customerPath: "customers/only.com",
|
|
309
|
+
configName: "production",
|
|
310
|
+
cliVersion: "1.2.3",
|
|
311
|
+
flags: {
|
|
312
|
+
local: false,
|
|
313
|
+
headless: false,
|
|
314
|
+
useTestConfig: false,
|
|
315
|
+
ignoreContentSecurityPolicy: false,
|
|
316
|
+
},
|
|
317
|
+
});
|
|
318
|
+
expect(readlinkSync(join(registry.directory, CURRENT_LINK))).to.equal(handle.id);
|
|
319
|
+
});
|
|
320
|
+
it("should remove current when nothing is running any more", () => {
|
|
321
|
+
const handle = registry.start({
|
|
322
|
+
customerPath: "customers/only.com",
|
|
323
|
+
configName: "production",
|
|
324
|
+
cliVersion: "1.2.3",
|
|
325
|
+
flags: {
|
|
326
|
+
local: false,
|
|
327
|
+
headless: false,
|
|
328
|
+
useTestConfig: false,
|
|
329
|
+
ignoreContentSecurityPolicy: false,
|
|
330
|
+
},
|
|
331
|
+
});
|
|
332
|
+
handle.finish("finished");
|
|
333
|
+
expect(existsSync(join(registry.directory, CURRENT_LINK))).to.equal(false);
|
|
334
|
+
});
|
|
335
|
+
});
|
|
336
|
+
describe("liveRuns", () => {
|
|
337
|
+
it("should return every live run rather than picking one", () => {
|
|
338
|
+
// The method it replaced was `list().find(run => run.live)`, which named
|
|
339
|
+
// the newest and said nothing about the rest — the only place in the
|
|
340
|
+
// registry that guessed where `resolve` refuses.
|
|
341
|
+
writeRun({
|
|
342
|
+
id: "one-production-1",
|
|
343
|
+
status: "running",
|
|
344
|
+
pid: process.pid,
|
|
345
|
+
startToken: processStartToken(process.pid) ?? undefined,
|
|
346
|
+
});
|
|
347
|
+
writeRun({
|
|
348
|
+
id: "two-production-1",
|
|
349
|
+
status: "running",
|
|
350
|
+
pid: process.pid,
|
|
351
|
+
startToken: processStartToken(process.pid) ?? undefined,
|
|
352
|
+
});
|
|
353
|
+
writeRun({ id: "ended-production-1" });
|
|
354
|
+
expect(registry
|
|
355
|
+
.liveRuns()
|
|
356
|
+
.map((run) => run.meta.id)
|
|
357
|
+
.sort()).to.deep.equal(["one-production-1", "two-production-1"]);
|
|
358
|
+
});
|
|
359
|
+
});
|
|
360
|
+
describe("process identity", () => {
|
|
361
|
+
it("should call a reused pid what it is: a different process", () => {
|
|
362
|
+
// The pid is this process, so it is alive — but the token says the run
|
|
363
|
+
// that recorded it was something else.
|
|
364
|
+
writeRun({
|
|
365
|
+
id: "example.com-production-1",
|
|
366
|
+
status: "running",
|
|
367
|
+
pid: process.pid,
|
|
368
|
+
startToken: "not-the-token-of-this-process",
|
|
369
|
+
});
|
|
370
|
+
const [run] = registry.list();
|
|
371
|
+
expect(run.live).to.equal(false);
|
|
372
|
+
expect(run.status).to.equal("crashed");
|
|
373
|
+
expect(run.liveVerified).to.equal(true);
|
|
374
|
+
});
|
|
375
|
+
it("should accept a live pid whose token matches", () => {
|
|
376
|
+
writeRun({
|
|
377
|
+
id: "example.com-production-1",
|
|
378
|
+
status: "running",
|
|
379
|
+
pid: process.pid,
|
|
380
|
+
startToken: processStartToken(process.pid) ?? undefined,
|
|
381
|
+
});
|
|
382
|
+
const [run] = registry.list();
|
|
383
|
+
expect(run.live).to.equal(true);
|
|
384
|
+
expect(run.status).to.equal("running");
|
|
385
|
+
});
|
|
386
|
+
it("should keep a live pid without a token, but say it is unconfirmed", () => {
|
|
387
|
+
// An older run directory, or a platform that cannot tell us. Hiding a
|
|
388
|
+
// live run because we could not confirm it is worse than the risk.
|
|
389
|
+
writeRun({
|
|
390
|
+
id: "example.com-production-1",
|
|
391
|
+
status: "running",
|
|
392
|
+
pid: process.pid,
|
|
393
|
+
});
|
|
394
|
+
const [run] = registry.list();
|
|
395
|
+
expect(run.live).to.equal(true);
|
|
396
|
+
expect(run.liveVerified).to.equal(false);
|
|
397
|
+
});
|
|
398
|
+
it("should be certain about a run that ended and one whose pid is gone", () => {
|
|
399
|
+
writeRun({ id: "ended-production-1", status: "finished" });
|
|
400
|
+
writeRun({ id: "gone-production-2", status: "running" });
|
|
401
|
+
for (const run of registry.list()) {
|
|
402
|
+
expect(run.live).to.equal(false);
|
|
403
|
+
expect(run.liveVerified).to.equal(true);
|
|
404
|
+
}
|
|
405
|
+
});
|
|
406
|
+
});
|
|
407
|
+
describe("sameProcess", () => {
|
|
408
|
+
it("should not claim a verdict it cannot support", () => {
|
|
409
|
+
expect(sameProcess(process.pid, undefined)).to.deep.equal({
|
|
410
|
+
same: true,
|
|
411
|
+
verified: false,
|
|
412
|
+
});
|
|
413
|
+
});
|
|
414
|
+
it("should confirm this process against its own token", () => {
|
|
415
|
+
const token = processStartToken(process.pid);
|
|
416
|
+
if (token === null) {
|
|
417
|
+
return; // platform gives us nothing to check; covered by the case above
|
|
418
|
+
}
|
|
419
|
+
expect(sameProcess(process.pid, token)).to.deep.equal({
|
|
420
|
+
same: true,
|
|
421
|
+
verified: true,
|
|
422
|
+
});
|
|
423
|
+
});
|
|
424
|
+
});
|
|
425
|
+
describe("resolve", () => {
|
|
426
|
+
it("should refuse to guess between several live runs", () => {
|
|
427
|
+
writeRun({ id: "a-production-1", status: "running", pid: process.pid });
|
|
428
|
+
writeRun({ id: "b-production-2", status: "running", pid: process.pid });
|
|
429
|
+
expect(() => registry.resolve()).to.throw(AmbiguousRunError);
|
|
430
|
+
});
|
|
431
|
+
it("should take the one live run without being asked", () => {
|
|
432
|
+
writeRun({
|
|
433
|
+
id: "old-production-1",
|
|
434
|
+
startedAt: "2026-09-01T00:00:00.000Z",
|
|
435
|
+
});
|
|
436
|
+
writeRun({
|
|
437
|
+
id: "live-production-2",
|
|
438
|
+
status: "running",
|
|
439
|
+
pid: process.pid,
|
|
440
|
+
startedAt: "2026-09-02T00:00:00.000Z",
|
|
441
|
+
});
|
|
442
|
+
expect(registry.resolve().meta.id).to.equal("live-production-2");
|
|
443
|
+
});
|
|
444
|
+
it("should fall back to the newest finished run when none is live", () => {
|
|
445
|
+
writeRun({ id: "a-production-1", startedAt: "2026-09-01T00:00:00.000Z" });
|
|
446
|
+
writeRun({ id: "b-production-2", startedAt: "2026-09-02T00:00:00.000Z" });
|
|
447
|
+
expect(registry.resolve().meta.id).to.equal("b-production-2");
|
|
448
|
+
});
|
|
449
|
+
it("should find a run by id, customer or path", () => {
|
|
450
|
+
writeRun({ id: "example.com-production-1" });
|
|
451
|
+
expect(registry.resolve("example.com-production-1").meta.id).to.equal("example.com-production-1");
|
|
452
|
+
expect(registry.resolve("example.com").meta.id).to.equal("example.com-production-1");
|
|
453
|
+
expect(registry.resolve("customers/example.com").meta.id).to.equal("example.com-production-1");
|
|
454
|
+
});
|
|
455
|
+
it("should read ./customers/x/ and customers/x as one path", () => {
|
|
456
|
+
writeRun({
|
|
457
|
+
id: "example.com-production-1",
|
|
458
|
+
customerPath: "./customers/example.com",
|
|
459
|
+
});
|
|
460
|
+
expect(registry.resolve("customers/example.com/").meta.id).to.equal("example.com-production-1");
|
|
461
|
+
});
|
|
462
|
+
it("should find a run by the start of its customer name", () => {
|
|
463
|
+
// What people type: the directory is hirmer-de, the selector is hirmer.
|
|
464
|
+
writeRun({
|
|
465
|
+
id: "hirmer-de-production-1",
|
|
466
|
+
customer: "hirmer-de",
|
|
467
|
+
status: "stopped",
|
|
468
|
+
});
|
|
469
|
+
expect(registry.resolve("hirmer").meta.id).to.equal("hirmer-de-production-1");
|
|
470
|
+
});
|
|
471
|
+
it("should refuse a prefix that reaches two customers", () => {
|
|
472
|
+
writeRun({ id: "hirmer-de-production-1", customer: "hirmer-de" });
|
|
473
|
+
writeRun({ id: "hirmer-at-production-1", customer: "hirmer-at" });
|
|
474
|
+
expect(() => registry.resolve("hirmer")).to.throw(AmbiguousRunError);
|
|
475
|
+
});
|
|
476
|
+
it("should prefer an exact match over a prefix", () => {
|
|
477
|
+
writeRun({ id: "shop-production-1", customer: "shop" });
|
|
478
|
+
writeRun({ id: "shop-de-production-1", customer: "shop-de" });
|
|
479
|
+
expect(registry.resolve("shop").meta.id).to.equal("shop-production-1");
|
|
480
|
+
});
|
|
481
|
+
it("should prefer the live run when a name matches several", () => {
|
|
482
|
+
// A customer name matches every run they have ever had, so this is the
|
|
483
|
+
// normal case rather than an edge one.
|
|
484
|
+
writeRun({ id: "example.com-production-1" });
|
|
485
|
+
writeRun({
|
|
486
|
+
id: "example.com-production-2",
|
|
487
|
+
status: "running",
|
|
488
|
+
pid: process.pid,
|
|
489
|
+
startToken: processStartToken(process.pid) ?? undefined,
|
|
490
|
+
});
|
|
491
|
+
writeRun({ id: "example.com-production-3" });
|
|
492
|
+
expect(registry.resolve("example.com").meta.id).to.equal("example.com-production-2");
|
|
493
|
+
});
|
|
494
|
+
it("should take the newest when a name matches only finished runs", () => {
|
|
495
|
+
writeRun({
|
|
496
|
+
id: "example.com-production-1",
|
|
497
|
+
startedAt: "2026-09-01T00:00:00.000Z",
|
|
498
|
+
});
|
|
499
|
+
writeRun({
|
|
500
|
+
id: "example.com-production-2",
|
|
501
|
+
startedAt: "2026-09-02T00:00:00.000Z",
|
|
502
|
+
});
|
|
503
|
+
// Nothing can be done to a finished run, so there is nothing to get wrong.
|
|
504
|
+
expect(registry.resolve("example.com").meta.id).to.equal("example.com-production-2");
|
|
505
|
+
});
|
|
506
|
+
it("should still refuse when a name matches several live runs", () => {
|
|
507
|
+
writeRun({
|
|
508
|
+
id: "example.com-production-1",
|
|
509
|
+
status: "running",
|
|
510
|
+
pid: process.pid,
|
|
511
|
+
startToken: processStartToken(process.pid) ?? undefined,
|
|
512
|
+
});
|
|
513
|
+
writeRun({
|
|
514
|
+
id: "example.com-production-2",
|
|
515
|
+
status: "running",
|
|
516
|
+
pid: process.pid,
|
|
517
|
+
startToken: processStartToken(process.pid) ?? undefined,
|
|
518
|
+
});
|
|
519
|
+
expect(() => registry.resolve("example.com")).to.throw(AmbiguousRunError);
|
|
520
|
+
});
|
|
521
|
+
it("should say so when there is nothing to resolve", () => {
|
|
522
|
+
expect(() => registry.resolve()).to.throw(NoSuchRunError);
|
|
523
|
+
expect(() => registry.resolve("nope")).to.throw(NoSuchRunError);
|
|
524
|
+
});
|
|
525
|
+
});
|
|
526
|
+
});
|
|
@@ -123,7 +123,7 @@ export const EDITORS = [
|
|
|
123
123
|
id: "code",
|
|
124
124
|
name: "Visual Studio Code",
|
|
125
125
|
commands: ["code"],
|
|
126
|
-
diffExecTemplate: '"$exec" --diff "$file1" "$file2"',
|
|
126
|
+
diffExecTemplate: '"$exec" --wait --diff "$file1" "$file2"',
|
|
127
127
|
paths: {
|
|
128
128
|
darwin: [
|
|
129
129
|
"/Applications/Visual Studio Code.app/Contents/Resources/app/bin/code",
|
|
@@ -140,7 +140,7 @@ export const EDITORS = [
|
|
|
140
140
|
id: "codium",
|
|
141
141
|
name: "VSCodium",
|
|
142
142
|
commands: ["codium"],
|
|
143
|
-
diffExecTemplate: '"$exec" --diff "$file1" "$file2"',
|
|
143
|
+
diffExecTemplate: '"$exec" --wait --diff "$file1" "$file2"',
|
|
144
144
|
paths: {
|
|
145
145
|
darwin: [
|
|
146
146
|
"/Applications/VSCodium.app/Contents/Resources/app/bin/codium",
|