@codyswann/lisa 5.4.0 → 5.6.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +60 -3
- package/all/copy-contents/gitignore +16 -0
- package/all/copy-contents/scripts/lisa-mutation.sh +4 -6
- package/all/copy-overwrite/scripts/fetch-test-access-map.d.mts +71 -0
- package/all/copy-overwrite/scripts/fetch-test-access-map.mjs +674 -0
- package/all/copy-overwrite/scripts/lib/affected-tests.mjs +818 -0
- package/all/copy-overwrite/scripts/lib/automation-provenance-local.mjs +48 -3
- package/all/copy-overwrite/scripts/lib/build-marker.mjs +410 -0
- package/all/copy-overwrite/scripts/lib/gate-pass-cache.mjs +537 -0
- package/all/copy-overwrite/scripts/lib/github-attestation-provider.mjs +68 -0
- package/all/copy-overwrite/scripts/lib/github-attestation-recovery.mjs +25 -10
- package/all/copy-overwrite/scripts/lib/github-attestation-verifier.mjs +4 -1
- package/all/copy-overwrite/scripts/lib/kill-marks.mjs +1 -2
- package/all/copy-overwrite/scripts/lib/lisa-cleanup-sweep-processes.mjs +3 -4
- package/all/copy-overwrite/scripts/lib/npm-update-allocate.mjs +1 -6
- package/all/copy-overwrite/scripts/lib/npm-update-authorization.mjs +25 -14
- package/all/copy-overwrite/scripts/lib/npm-update-cancel-origin.mjs +45 -11
- package/all/copy-overwrite/scripts/lib/npm-update-cancellation-proof.mjs +22 -11
- package/all/copy-overwrite/scripts/lib/npm-update-cancellation.mjs +29 -17
- package/all/copy-overwrite/scripts/lib/npm-update-controller-broker.mjs +1 -1
- package/all/copy-overwrite/scripts/lib/npm-update-controller-factory.mjs +19 -1
- package/all/copy-overwrite/scripts/lib/npm-update-gate-hooks.mjs +2 -1
- package/all/copy-overwrite/scripts/lib/npm-update-gate.mjs +5 -0
- package/all/copy-overwrite/scripts/lib/npm-update-gh-requests.mjs +57 -30
- package/all/copy-overwrite/scripts/lib/npm-update-helper-inventory.mjs +9 -1
- package/all/copy-overwrite/scripts/lib/npm-update-hosted-hook.mjs +1 -1
- package/all/copy-overwrite/scripts/lib/npm-update-leaf.mjs +6 -1
- package/all/copy-overwrite/scripts/lib/npm-update-policy.mjs +38 -0
- package/all/copy-overwrite/scripts/lib/npm-update-publication.mjs +21 -3
- package/all/copy-overwrite/scripts/lib/npm-update-publish.mjs +13 -1
- package/all/copy-overwrite/scripts/lib/npm-update-recovery.mjs +29 -4
- package/all/copy-overwrite/scripts/lib/npm-update-supersession.mjs +21 -7
- package/all/copy-overwrite/scripts/lib/npm-update-tool-launcher.mjs +1 -1
- package/all/copy-overwrite/scripts/lib/npm-update-tracker-cancel.mjs +139 -0
- package/all/copy-overwrite/scripts/lib/npm-update-tracker-jira.mjs +149 -19
- package/all/copy-overwrite/scripts/lib/npm-update-tracker-linear.mjs +72 -17
- package/all/copy-overwrite/scripts/lib/npm-update-tracker-wire.mjs +102 -12
- package/all/copy-overwrite/scripts/lib/npm-update-tracker.mjs +91 -13
- package/all/copy-overwrite/scripts/lib/push-admission.mjs +158 -0
- package/all/copy-overwrite/scripts/lib/push-gate-defaults.d.mts +34 -0
- package/all/copy-overwrite/scripts/lib/push-gate-defaults.mjs +147 -0
- package/all/copy-overwrite/scripts/lib/push-timing.mjs +323 -0
- package/all/copy-overwrite/scripts/lib/rspec-selection.mjs +672 -0
- package/all/copy-overwrite/scripts/lisa-affected-tests.mjs +566 -0
- package/all/copy-overwrite/scripts/lisa-automation-provenance.mjs +35 -8
- package/all/copy-overwrite/scripts/lisa-gates.mjs +29 -0
- package/all/copy-overwrite/scripts/lisa-lint-staged-preflight.mjs +10 -1
- package/all/copy-overwrite/scripts/lisa-npm-updater.mjs +8 -5
- package/all/copy-overwrite/scripts/lisa-push-timing-report.mjs +153 -0
- package/all/copy-overwrite/scripts/lisa-rspec-select.mjs +982 -0
- package/all/copy-overwrite/scripts/lisa-run-gates.mjs +231 -6
- package/all/copy-overwrite/scripts/npm-updater-helper-graph.json +148 -41
- package/all/deletions.json +11 -2
- package/cdk/create-only/vitest.config.local.ts +1 -7
- package/cdk/package-lisa/package.lisa.json +4 -4
- package/dist/cli/admit-cmd.d.ts +21 -0
- package/dist/cli/admit-cmd.d.ts.map +1 -0
- package/dist/cli/admit-cmd.js +142 -0
- package/dist/cli/admit-cmd.js.map +1 -0
- package/dist/cli/check-cmd.d.ts +72 -0
- package/dist/cli/check-cmd.d.ts.map +1 -0
- package/dist/cli/check-cmd.js +316 -0
- package/dist/cli/check-cmd.js.map +1 -0
- package/dist/cli/index.d.ts.map +1 -1
- package/dist/cli/index.js +6 -4
- package/dist/cli/index.js.map +1 -1
- package/dist/cli/lisa-test-run-admission.d.ts +18 -0
- package/dist/cli/lisa-test-run-admission.d.ts.map +1 -0
- package/dist/cli/lisa-test-run-admission.js +62 -0
- package/dist/cli/lisa-test-run-admission.js.map +1 -0
- package/dist/cli/lisa-test-run-payload.d.ts +37 -0
- package/dist/cli/lisa-test-run-payload.d.ts.map +1 -0
- package/dist/cli/lisa-test-run-payload.js +55 -0
- package/dist/cli/lisa-test-run-payload.js.map +1 -0
- package/dist/cli/lisa-test-run-shard-files.d.ts +89 -0
- package/dist/cli/lisa-test-run-shard-files.d.ts.map +1 -0
- package/dist/cli/lisa-test-run-shard-files.js +239 -0
- package/dist/cli/lisa-test-run-shard-files.js.map +1 -0
- package/dist/cli/lisa-test-run-shard.d.ts +6 -2
- package/dist/cli/lisa-test-run-shard.d.ts.map +1 -1
- package/dist/cli/lisa-test-run-shard.js +25 -13
- package/dist/cli/lisa-test-run-shard.js.map +1 -1
- package/dist/cli/lisa-test-run.d.ts +1 -1
- package/dist/cli/lisa-test-run.d.ts.map +1 -1
- package/dist/cli/lisa-test-run.js +47 -10
- package/dist/cli/lisa-test-run.js.map +1 -1
- package/dist/cli/update-check-hook.d.ts.map +1 -1
- package/dist/cli/update-check-hook.js +3 -0
- package/dist/cli/update-check-hook.js.map +1 -1
- package/dist/configs/vitest/base.d.ts +58 -135
- package/dist/configs/vitest/base.d.ts.map +1 -1
- package/dist/configs/vitest/base.js +76 -228
- package/dist/configs/vitest/base.js.map +1 -1
- package/dist/configs/vitest/cdk.d.ts.map +1 -1
- package/dist/configs/vitest/cdk.js +3 -2
- package/dist/configs/vitest/cdk.js.map +1 -1
- package/dist/configs/vitest/coverage-include-global-setup.d.ts.map +1 -1
- package/dist/configs/vitest/coverage-include-global-setup.js +3 -4
- package/dist/configs/vitest/coverage-include-global-setup.js.map +1 -1
- package/dist/configs/vitest/coverage-reports-directory.d.ts +27 -5
- package/dist/configs/vitest/coverage-reports-directory.d.ts.map +1 -1
- package/dist/configs/vitest/coverage-reports-directory.js +47 -10
- package/dist/configs/vitest/coverage-reports-directory.js.map +1 -1
- package/dist/configs/vitest/harper-fabric.d.ts.map +1 -1
- package/dist/configs/vitest/harper-fabric.js +3 -2
- package/dist/configs/vitest/harper-fabric.js.map +1 -1
- package/dist/configs/vitest/nestjs.d.ts.map +1 -1
- package/dist/configs/vitest/nestjs.js +3 -2
- package/dist/configs/vitest/nestjs.js.map +1 -1
- package/dist/configs/vitest/phaser.d.ts.map +1 -1
- package/dist/configs/vitest/phaser.js +3 -2
- package/dist/configs/vitest/phaser.js.map +1 -1
- package/dist/configs/vitest/refusal-announcement.d.ts +51 -0
- package/dist/configs/vitest/refusal-announcement.d.ts.map +1 -0
- package/dist/configs/vitest/refusal-announcement.js +97 -0
- package/dist/configs/vitest/refusal-announcement.js.map +1 -0
- package/dist/configs/vitest/socket-safe-temp-base.d.ts +3 -4
- package/dist/configs/vitest/socket-safe-temp-base.d.ts.map +1 -1
- package/dist/configs/vitest/socket-safe-temp-base.js +7 -6
- package/dist/configs/vitest/socket-safe-temp-base.js.map +1 -1
- package/dist/configs/vitest/typescript.d.ts.map +1 -1
- package/dist/configs/vitest/typescript.js +3 -2
- package/dist/configs/vitest/typescript.js.map +1 -1
- package/dist/core/admission-decision.d.ts +110 -0
- package/dist/core/admission-decision.d.ts.map +1 -0
- package/dist/core/admission-decision.js +91 -0
- package/dist/core/admission-decision.js.map +1 -0
- package/dist/core/admission-lock.d.ts +69 -0
- package/dist/core/admission-lock.d.ts.map +1 -0
- package/dist/core/admission-lock.js +278 -0
- package/dist/core/admission-lock.js.map +1 -0
- package/dist/core/admission-settings.d.ts +69 -0
- package/dist/core/admission-settings.d.ts.map +1 -0
- package/dist/core/admission-settings.js +204 -0
- package/dist/core/admission-settings.js.map +1 -0
- package/dist/core/admission-state.d.ts +50 -0
- package/dist/core/admission-state.d.ts.map +1 -0
- package/dist/core/admission-state.js +168 -0
- package/dist/core/admission-state.js.map +1 -0
- package/dist/core/admission.d.ts +70 -0
- package/dist/core/admission.d.ts.map +1 -0
- package/dist/core/admission.js +205 -0
- package/dist/core/admission.js.map +1 -0
- package/dist/core/lisa-owned-hash-ledger.d.ts.map +1 -1
- package/dist/core/lisa-owned-hash-ledger.js +440 -0
- package/dist/core/lisa-owned-hash-ledger.js.map +1 -1
- package/dist/core/nightly-e2e-guard-behavior-certificate.js +2 -2
- package/dist/core/project-config-push-gate.d.ts +66 -0
- package/dist/core/project-config-push-gate.d.ts.map +1 -0
- package/dist/core/project-config-push-gate.js +82 -0
- package/dist/core/project-config-push-gate.js.map +1 -0
- package/dist/core/project-config.d.ts +4 -0
- package/dist/core/project-config.d.ts.map +1 -1
- package/dist/core/project-config.js +14 -9
- package/dist/core/project-config.js.map +1 -1
- package/dist/core/upstream-evidence-manifest.d.ts.map +1 -1
- package/dist/core/upstream-evidence-manifest.js +234 -146
- package/dist/core/upstream-evidence-manifest.js.map +1 -1
- package/expo/package-lisa/package.lisa.json +2 -2
- package/harper-fabric/package-lisa/package.lisa.json +4 -4
- package/nestjs/create-only/vitest.config.local.ts +1 -7
- package/nestjs/package-lisa/package.lisa.json +4 -4
- package/npm-package/package-lisa/package.lisa.json +4 -4
- package/package.json +12 -11
- package/phaser/package-lisa/package.lisa.json +4 -4
- package/plugins/lisa/.claude-plugin/plugin.json +1 -1
- package/plugins/lisa/.codex-plugin/plugin.json +1 -1
- package/plugins/lisa/.codex-plugin/skills/lisa-drive-pr-to-merge/SKILL.md +16 -3
- package/plugins/lisa/.codex-plugin/skills/lisa-git-submit-pr/SKILL.md +1 -1
- package/plugins/lisa/.codex-plugin/skills/lisa-implement/SKILL.md +1 -1
- package/plugins/lisa/skills/lisa-drive-pr-to-merge/SKILL.md +16 -3
- package/plugins/lisa/skills/lisa-git-submit-pr/SKILL.md +1 -1
- package/plugins/lisa/skills/lisa-implement/SKILL.md +1 -1
- package/plugins/lisa-agy/plugin.json +1 -1
- package/plugins/lisa-agy/skills/lisa-drive-pr-to-merge/SKILL.md +16 -3
- package/plugins/lisa-agy/skills/lisa-git-submit-pr/SKILL.md +1 -1
- package/plugins/lisa-agy/skills/lisa-implement/SKILL.md +1 -1
- package/plugins/lisa-cdk/.claude-plugin/plugin.json +1 -1
- package/plugins/lisa-cdk/.codex-plugin/plugin.json +1 -1
- package/plugins/lisa-cdk-agy/plugin.json +1 -1
- package/plugins/lisa-cdk-copilot/.claude-plugin/plugin.json +1 -1
- package/plugins/lisa-cdk-cursor/.claude-plugin/plugin.json +1 -1
- package/plugins/lisa-cdk-devin/.claude-plugin/plugin.json +1 -1
- package/plugins/lisa-cdk-devin/.devin-plugin/plugin.json +1 -1
- package/plugins/lisa-copilot/.claude-plugin/plugin.json +1 -1
- package/plugins/lisa-copilot/skills/lisa-drive-pr-to-merge/SKILL.md +16 -3
- package/plugins/lisa-copilot/skills/lisa-git-submit-pr/SKILL.md +1 -1
- package/plugins/lisa-copilot/skills/lisa-implement/SKILL.md +1 -1
- package/plugins/lisa-cursor/.claude-plugin/plugin.json +1 -1
- package/plugins/lisa-cursor/skills/lisa-drive-pr-to-merge/SKILL.md +16 -3
- package/plugins/lisa-cursor/skills/lisa-git-submit-pr/SKILL.md +1 -1
- package/plugins/lisa-cursor/skills/lisa-implement/SKILL.md +1 -1
- package/plugins/lisa-devin/.claude-plugin/plugin.json +1 -1
- package/plugins/lisa-devin/.devin-plugin/plugin.json +1 -1
- package/plugins/lisa-devin/skills/lisa-drive-pr-to-merge/SKILL.md +16 -3
- package/plugins/lisa-devin/skills/lisa-git-submit-pr/SKILL.md +1 -1
- package/plugins/lisa-devin/skills/lisa-implement/SKILL.md +1 -1
- package/plugins/lisa-expo/.claude-plugin/plugin.json +1 -1
- package/plugins/lisa-expo/.codex-plugin/plugin.json +1 -1
- package/plugins/lisa-expo-agy/plugin.json +1 -1
- package/plugins/lisa-expo-copilot/.claude-plugin/plugin.json +1 -1
- package/plugins/lisa-expo-cursor/.claude-plugin/plugin.json +1 -1
- package/plugins/lisa-expo-devin/.claude-plugin/plugin.json +1 -1
- package/plugins/lisa-expo-devin/.devin-plugin/plugin.json +1 -1
- package/plugins/lisa-harper-fabric/.claude-plugin/plugin.json +1 -1
- package/plugins/lisa-harper-fabric/.codex-plugin/plugin.json +1 -1
- package/plugins/lisa-harper-fabric-agy/plugin.json +1 -1
- package/plugins/lisa-harper-fabric-copilot/.claude-plugin/plugin.json +1 -1
- package/plugins/lisa-harper-fabric-cursor/.claude-plugin/plugin.json +1 -1
- package/plugins/lisa-harper-fabric-devin/.claude-plugin/plugin.json +1 -1
- package/plugins/lisa-harper-fabric-devin/.devin-plugin/plugin.json +1 -1
- package/plugins/lisa-nestjs/.claude-plugin/plugin.json +1 -1
- package/plugins/lisa-nestjs/.codex-plugin/plugin.json +1 -1
- package/plugins/lisa-nestjs-agy/plugin.json +1 -1
- package/plugins/lisa-nestjs-copilot/.claude-plugin/plugin.json +1 -1
- package/plugins/lisa-nestjs-cursor/.claude-plugin/plugin.json +1 -1
- package/plugins/lisa-nestjs-devin/.claude-plugin/plugin.json +1 -1
- package/plugins/lisa-nestjs-devin/.devin-plugin/plugin.json +1 -1
- package/plugins/lisa-phaser/.claude-plugin/plugin.json +1 -1
- package/plugins/lisa-phaser/.codex-plugin/plugin.json +1 -1
- package/plugins/lisa-phaser-agy/plugin.json +1 -1
- package/plugins/lisa-phaser-copilot/.claude-plugin/plugin.json +1 -1
- package/plugins/lisa-phaser-cursor/.claude-plugin/plugin.json +1 -1
- package/plugins/lisa-phaser-devin/.claude-plugin/plugin.json +1 -1
- package/plugins/lisa-phaser-devin/.devin-plugin/plugin.json +1 -1
- package/plugins/lisa-rails/.claude-plugin/plugin.json +1 -1
- package/plugins/lisa-rails/.codex-plugin/plugin.json +1 -1
- package/plugins/lisa-rails-agy/plugin.json +1 -1
- package/plugins/lisa-rails-copilot/.claude-plugin/plugin.json +1 -1
- package/plugins/lisa-rails-cursor/.claude-plugin/plugin.json +1 -1
- package/plugins/lisa-rails-devin/.claude-plugin/plugin.json +1 -1
- package/plugins/lisa-rails-devin/.devin-plugin/plugin.json +1 -1
- package/plugins/lisa-typescript/.claude-plugin/plugin.json +1 -1
- package/plugins/lisa-typescript/.codex-plugin/plugin.json +1 -1
- package/plugins/lisa-typescript-agy/plugin.json +1 -1
- package/plugins/lisa-typescript-copilot/.claude-plugin/plugin.json +1 -1
- package/plugins/lisa-typescript-cursor/.claude-plugin/plugin.json +1 -1
- package/plugins/lisa-typescript-devin/.claude-plugin/plugin.json +1 -1
- package/plugins/lisa-typescript-devin/.devin-plugin/plugin.json +1 -1
- package/plugins/lisa-wiki/.claude-plugin/plugin.json +1 -1
- package/plugins/lisa-wiki/.codex-plugin/plugin.json +1 -1
- package/plugins/lisa-wiki-agy/plugin.json +1 -1
- package/plugins/lisa-wiki-copilot/.claude-plugin/plugin.json +1 -1
- package/plugins/lisa-wiki-cursor/.claude-plugin/plugin.json +1 -1
- package/plugins/lisa-wiki-devin/.claude-plugin/plugin.json +1 -1
- package/plugins/lisa-wiki-devin/.devin-plugin/plugin.json +1 -1
- package/plugins/src/base/skills/lisa-drive-pr-to-merge/SKILL.md +16 -3
- package/plugins/src/base/skills/lisa-git-submit-pr/SKILL.md +1 -1
- package/plugins/src/base/skills/lisa-implement/SKILL.md +1 -1
- package/rails/copy-overwrite/Gemfile.lisa +8 -0
- package/rails/copy-overwrite/lefthook.yml +25 -11
- package/rails/copy-overwrite/scripts/lisa-rails-gates.mjs +686 -0
- package/rails/copy-overwrite/scripts/lisa-rspec-shards.mjs +2 -2
- package/rails/copy-overwrite/scripts/lisa_crystalball_recorder.rb +239 -0
- package/rails/copy-overwrite/scripts/lisa_rspec_partial_coverage.rb +83 -0
- package/scripts/build-unless-marked.mjs +83 -0
- package/scripts/check-plugins-sync.sh +22 -5
- package/scripts/classify-markdown-assertions.mjs +141 -0
- package/scripts/integration-shard-build.mjs +143 -0
- package/scripts/lib/history-scanner-suites.mjs +19 -0
- package/scripts/lib/markdown-assertions/classify.mjs +289 -0
- package/scripts/lib/markdown-assertions/context.mjs +53 -0
- package/scripts/lib/markdown-assertions/corpus.mjs +222 -0
- package/scripts/lib/markdown-assertions/manifest-cull.mjs +86 -0
- package/scripts/lib/markdown-assertions/record-setup.mjs +265 -0
- package/scripts/lib/markdown-assertions/record.mjs +115 -0
- package/scripts/lib/markdown-assertions/record.vitest.config.mjs +24 -0
- package/scripts/lib/markdown-assertions/sites.mjs +273 -0
- package/scripts/lib/markdown-assertions/test-cull.mjs +768 -0
- package/scripts/lib/markdown-assertions/tokens.mjs +158 -0
- package/scripts/lib/shell-guard-trace.mjs +6 -0
- package/scripts/lib/test-access-map-setup.mjs +40 -0
- package/scripts/lib/test-access-map-tracer.mjs +205 -0
- package/scripts/lib/test-access-map.d.mts +72 -0
- package/scripts/lib/test-access-map.mjs +395 -0
- package/scripts/lib/test-timings-reporter.d.mts +17 -0
- package/scripts/lib/test-timings-reporter.mjs +99 -0
- package/scripts/plan-integration-shards.mjs +300 -0
- package/scripts/test-timing-report.d.mts +41 -0
- package/scripts/test-timing-report.mjs +361 -0
- package/scripts/two-channel-couplings.json +132 -36
- package/scripts/verify-npm-advisories-4333.mjs +3 -12
- package/typescript/copy-overwrite/.prettierignore +13 -0
- package/typescript/create-only/vitest.config.local.ts +1 -7
- package/typescript/package-lisa/package.lisa.json +4 -4
- package/all/copy-overwrite/scripts/lisa-scratch-run.sh +0 -1078
- package/dist/cli/lisa-test-run-bootstrap.d.ts +0 -3
- package/dist/cli/lisa-test-run-bootstrap.d.ts.map +0 -1
- package/dist/cli/lisa-test-run-bootstrap.js +0 -229
- package/dist/cli/lisa-test-run-bootstrap.js.map +0 -1
- package/dist/cli/lisa-test-run-ipc.d.ts +0 -49
- package/dist/cli/lisa-test-run-ipc.d.ts.map +0 -1
- package/dist/cli/lisa-test-run-ipc.js +0 -226
- package/dist/cli/lisa-test-run-ipc.js.map +0 -1
- package/dist/cli/lisa-test-run-process-group.d.ts +0 -30
- package/dist/cli/lisa-test-run-process-group.d.ts.map +0 -1
- package/dist/cli/lisa-test-run-process-group.js +0 -140
- package/dist/cli/lisa-test-run-process-group.js.map +0 -1
- package/dist/cli/lisa-test-run-reaper.d.ts +0 -3
- package/dist/cli/lisa-test-run-reaper.d.ts.map +0 -1
- package/dist/cli/lisa-test-run-reaper.js +0 -195
- package/dist/cli/lisa-test-run-reaper.js.map +0 -1
- package/dist/cli/lisa-test-run-runtime.d.ts +0 -46
- package/dist/cli/lisa-test-run-runtime.d.ts.map +0 -1
- package/dist/cli/lisa-test-run-runtime.js +0 -123
- package/dist/cli/lisa-test-run-runtime.js.map +0 -1
- package/dist/cli/lisa-test-run-supervisor.d.ts +0 -13
- package/dist/cli/lisa-test-run-supervisor.d.ts.map +0 -1
- package/dist/cli/lisa-test-run-supervisor.js +0 -265
- package/dist/cli/lisa-test-run-supervisor.js.map +0 -1
- package/dist/configs/vitest/fleet-admission-global-setup.d.ts +0 -34
- package/dist/configs/vitest/fleet-admission-global-setup.d.ts.map +0 -1
- package/dist/configs/vitest/fleet-admission-global-setup.js +0 -123
- package/dist/configs/vitest/fleet-admission-global-setup.js.map +0 -1
- package/dist/configs/vitest/fleet-admission.d.ts +0 -129
- package/dist/configs/vitest/fleet-admission.d.ts.map +0 -1
- package/dist/configs/vitest/fleet-admission.js +0 -239
- package/dist/configs/vitest/fleet-admission.js.map +0 -1
- package/dist/configs/vitest/scratch-authority.d.ts +0 -25
- package/dist/configs/vitest/scratch-authority.d.ts.map +0 -1
- package/dist/configs/vitest/scratch-authority.js +0 -107
- package/dist/configs/vitest/scratch-authority.js.map +0 -1
- package/dist/configs/vitest/scratch-bound-cleanup-programs.d.ts +0 -5
- package/dist/configs/vitest/scratch-bound-cleanup-programs.d.ts.map +0 -1
- package/dist/configs/vitest/scratch-bound-cleanup-programs.js +0 -219
- package/dist/configs/vitest/scratch-bound-cleanup-programs.js.map +0 -1
- package/dist/configs/vitest/scratch-bound-cleanup.d.ts +0 -28
- package/dist/configs/vitest/scratch-bound-cleanup.d.ts.map +0 -1
- package/dist/configs/vitest/scratch-bound-cleanup.js +0 -155
- package/dist/configs/vitest/scratch-bound-cleanup.js.map +0 -1
- package/dist/configs/vitest/scratch-bound-root-cleanup.d.ts +0 -17
- package/dist/configs/vitest/scratch-bound-root-cleanup.d.ts.map +0 -1
- package/dist/configs/vitest/scratch-bound-root-cleanup.js +0 -149
- package/dist/configs/vitest/scratch-bound-root-cleanup.js.map +0 -1
- package/dist/configs/vitest/scratch-global-setup.d.ts +0 -258
- package/dist/configs/vitest/scratch-global-setup.d.ts.map +0 -1
- package/dist/configs/vitest/scratch-global-setup.js +0 -505
- package/dist/configs/vitest/scratch-global-setup.js.map +0 -1
- package/dist/configs/vitest/scratch-leak-setup.d.ts +0 -2
- package/dist/configs/vitest/scratch-leak-setup.d.ts.map +0 -1
- package/dist/configs/vitest/scratch-leak-setup.js +0 -108
- package/dist/configs/vitest/scratch-leak-setup.js.map +0 -1
- package/dist/configs/vitest/scratch-namespace-authority.d.ts +0 -80
- package/dist/configs/vitest/scratch-namespace-authority.d.ts.map +0 -1
- package/dist/configs/vitest/scratch-namespace-authority.js +0 -291
- package/dist/configs/vitest/scratch-namespace-authority.js.map +0 -1
- package/dist/configs/vitest/scratch-owner.d.ts +0 -131
- package/dist/configs/vitest/scratch-owner.d.ts.map +0 -1
- package/dist/configs/vitest/scratch-owner.js +0 -297
- package/dist/configs/vitest/scratch-owner.js.map +0 -1
- package/dist/configs/vitest/scratch-route-profile.d.ts +0 -46
- package/dist/configs/vitest/scratch-route-profile.d.ts.map +0 -1
- package/dist/configs/vitest/scratch-route-profile.js +0 -233
- package/dist/configs/vitest/scratch-route-profile.js.map +0 -1
- package/dist/configs/vitest/scratch-run-root-compatibility.d.ts +0 -33
- package/dist/configs/vitest/scratch-run-root-compatibility.d.ts.map +0 -1
- package/dist/configs/vitest/scratch-run-root-compatibility.js +0 -137
- package/dist/configs/vitest/scratch-run-root-compatibility.js.map +0 -1
- package/dist/configs/vitest/scratch-run-root-intent.d.ts +0 -66
- package/dist/configs/vitest/scratch-run-root-intent.d.ts.map +0 -1
- package/dist/configs/vitest/scratch-run-root-intent.js +0 -183
- package/dist/configs/vitest/scratch-run-root-intent.js.map +0 -1
- package/dist/configs/vitest/scratch-setup.d.ts +0 -46
- package/dist/configs/vitest/scratch-setup.d.ts.map +0 -1
- package/dist/configs/vitest/scratch-setup.js +0 -226
- package/dist/configs/vitest/scratch-setup.js.map +0 -1
- package/dist/configs/vitest/scratch-supervision-intent.d.ts +0 -8
- package/dist/configs/vitest/scratch-supervision-intent.d.ts.map +0 -1
- package/dist/configs/vitest/scratch-supervision-intent.js +0 -125
- package/dist/configs/vitest/scratch-supervision-intent.js.map +0 -1
- package/dist/configs/vitest/scratch-supervision-protocol.d.ts +0 -12
- package/dist/configs/vitest/scratch-supervision-protocol.d.ts.map +0 -1
- package/dist/configs/vitest/scratch-supervision-protocol.js +0 -230
- package/dist/configs/vitest/scratch-supervision-protocol.js.map +0 -1
- package/dist/configs/vitest/scratch-supervision.d.ts +0 -69
- package/dist/configs/vitest/scratch-supervision.d.ts.map +0 -1
- package/dist/configs/vitest/scratch-supervision.js +0 -244
- package/dist/configs/vitest/scratch-supervision.js.map +0 -1
- package/dist/configs/vitest/scratch-sweep.d.ts +0 -66
- package/dist/configs/vitest/scratch-sweep.d.ts.map +0 -1
- package/dist/configs/vitest/scratch-sweep.js +0 -82
- package/dist/configs/vitest/scratch-sweep.js.map +0 -1
- package/dist/configs/vitest/scratch-tmpdir-trust.d.ts +0 -48
- package/dist/configs/vitest/scratch-tmpdir-trust.d.ts.map +0 -1
- package/dist/configs/vitest/scratch-tmpdir-trust.js +0 -194
- package/dist/configs/vitest/scratch-tmpdir-trust.js.map +0 -1
- package/dist/configs/vitest/scratch.d.ts +0 -19
- package/dist/configs/vitest/scratch.d.ts.map +0 -1
- package/dist/configs/vitest/scratch.js +0 -34
- package/dist/configs/vitest/scratch.js.map +0 -1
- package/dist/configs/vitest/synthesis-scratch-reclaim.d.ts +0 -86
- package/dist/configs/vitest/synthesis-scratch-reclaim.d.ts.map +0 -1
- package/dist/configs/vitest/synthesis-scratch-reclaim.js +0 -226
- package/dist/configs/vitest/synthesis-scratch-reclaim.js.map +0 -1
|
@@ -1,69 +0,0 @@
|
|
|
1
|
-
import { removeAuthorizedScratchChild } from "./scratch-authority.js";
|
|
2
|
-
import { writeScratchOwnerRecord, type ScratchOwnerRecordV1, type ScratchPathIdentity } from "./scratch-owner.js";
|
|
3
|
-
import { type ScratchRunRootIntentV1 } from "./scratch.js";
|
|
4
|
-
/** Private environment variable inherited only by a supervised test payload. */
|
|
5
|
-
export declare const SCRATCH_SUPERVISION_LEASE_ENV = "LISA_TEST_RUN_LEASE";
|
|
6
|
-
/** Version-one lease: basenames and identities, never a free-form root path. */
|
|
7
|
-
export interface ScratchSupervisionLeaseV1 {
|
|
8
|
-
readonly schema: 1;
|
|
9
|
-
readonly token: string;
|
|
10
|
-
readonly suiteRootBasename: string;
|
|
11
|
-
readonly baseCanonicalPath: string;
|
|
12
|
-
readonly namespace: ScratchPathIdentity;
|
|
13
|
-
readonly suiteRoot: ScratchPathIdentity;
|
|
14
|
-
readonly suiteLabel: string;
|
|
15
|
-
readonly registeredPrefixes: readonly string[];
|
|
16
|
-
}
|
|
17
|
-
/** Durable handle for one worker scope nested inside the supervised suite root. */
|
|
18
|
-
export interface SupervisedWorkerScope {
|
|
19
|
-
readonly path: string;
|
|
20
|
-
readonly basename: string;
|
|
21
|
-
readonly parent: ScratchPathIdentity;
|
|
22
|
-
readonly suiteToken: string;
|
|
23
|
-
readonly owner: ScratchOwnerRecordV1;
|
|
24
|
-
}
|
|
25
|
-
/** Deterministic seams for worker-scope allocation failure controls. */
|
|
26
|
-
export interface SupervisedWorkerScopeOptions {
|
|
27
|
-
readonly removeAuthorizedChild?: typeof removeAuthorizedScratchChild;
|
|
28
|
-
readonly writeOwnerRecord?: typeof writeScratchOwnerRecord;
|
|
29
|
-
}
|
|
30
|
-
/**
|
|
31
|
-
* Construct a bounded lease only after the suite root has been independently opened.
|
|
32
|
-
* @param intent - Armed suite-root intent
|
|
33
|
-
* @param configuration - Suite attribution captured before collection
|
|
34
|
-
* @param configuration.suiteLabel - Opaque suite label
|
|
35
|
-
* @param configuration.registeredPrefixes - Pre-collection prefix registry
|
|
36
|
-
* @returns Immutable lease
|
|
37
|
-
*/
|
|
38
|
-
export declare function createScratchSupervisionLease(intent: ScratchRunRootIntentV1, configuration: {
|
|
39
|
-
readonly suiteLabel: string;
|
|
40
|
-
readonly registeredPrefixes: readonly string[];
|
|
41
|
-
}): ScratchSupervisionLeaseV1;
|
|
42
|
-
/**
|
|
43
|
-
* Parse and validate the private bounded lease contract.
|
|
44
|
-
* @param raw - Serialized lease
|
|
45
|
-
* @returns Validated version-one lease
|
|
46
|
-
*/
|
|
47
|
-
export declare function parseScratchSupervisionLease(raw: string): ScratchSupervisionLeaseV1;
|
|
48
|
-
/**
|
|
49
|
-
* Anchor inherited authority before setup redirects this process's temp path.
|
|
50
|
-
* @param lease - Parsed inherited lease.
|
|
51
|
-
*/
|
|
52
|
-
export declare function assertScratchSupervisionTempRoot(lease: ScratchSupervisionLeaseV1): void;
|
|
53
|
-
/**
|
|
54
|
-
* Allocate one random worker scope under a token-validated suite root.
|
|
55
|
-
* @param lease - Validated suite lease
|
|
56
|
-
* @param options - Optional deterministic persistence seam
|
|
57
|
-
* @returns Durable worker-scope handle
|
|
58
|
-
*/
|
|
59
|
-
export declare function createSupervisedWorkerScope(lease: ScratchSupervisionLeaseV1, options?: SupervisedWorkerScopeOptions): SupervisedWorkerScope;
|
|
60
|
-
/**
|
|
61
|
-
* Remove one worker scope while revalidating its parent lease around deletion.
|
|
62
|
-
* @param scope - Durable worker handle
|
|
63
|
-
* @param lease - Optional parent lease for pre/post validation
|
|
64
|
-
*/
|
|
65
|
-
export declare function removeSupervisedWorkerScope(scope: SupervisedWorkerScope, lease?: ScratchSupervisionLeaseV1): void;
|
|
66
|
-
export { parseScratchProtocolMessage } from "./scratch-supervision-protocol.js";
|
|
67
|
-
export { validateScratchRunRootIntent } from "./scratch-supervision-intent.js";
|
|
68
|
-
export type { ScratchProtocolMessageV1 } from "./scratch-supervision-protocol.js";
|
|
69
|
-
//# sourceMappingURL=scratch-supervision.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"scratch-supervision.d.ts","sourceRoot":"","sources":["../../../src/configs/vitest/scratch-supervision.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,4BAA4B,EAAE,MAAM,wBAAwB,CAAC;AACtE,OAAO,EAKL,uBAAuB,EACvB,KAAK,oBAAoB,EACzB,KAAK,mBAAmB,EACzB,MAAM,oBAAoB,CAAC;AAK5B,OAAO,EAEL,KAAK,sBAAsB,EAC5B,MAAM,cAAc,CAAC;AAEtB,gFAAgF;AAChF,eAAO,MAAM,6BAA6B,wBAAwB,CAAC;AAKnE,gFAAgF;AAChF,MAAM,WAAW,yBAAyB;IACxC,QAAQ,CAAC,MAAM,EAAE,CAAC,CAAC;IACnB,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;IACvB,QAAQ,CAAC,iBAAiB,EAAE,MAAM,CAAC;IACnC,QAAQ,CAAC,iBAAiB,EAAE,MAAM,CAAC;IACnC,QAAQ,CAAC,SAAS,EAAE,mBAAmB,CAAC;IACxC,QAAQ,CAAC,SAAS,EAAE,mBAAmB,CAAC;IACxC,QAAQ,CAAC,UAAU,EAAE,MAAM,C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E,YAAY,EAAE,wBAAwB,EAAE,MAAM,mCAAmC,CAAC"}
|
|
@@ -1,244 +0,0 @@
|
|
|
1
|
-
/** Versioned supervision leases and nested Vitest worker scratch scopes. */
|
|
2
|
-
import { randomBytes } from "node:crypto";
|
|
3
|
-
import * as fs from "node:fs";
|
|
4
|
-
import * as path from "node:path";
|
|
5
|
-
import { removeAuthorizedScratchChild } from "./scratch-authority.js";
|
|
6
|
-
import { createScratchOwnerRecord, processBirthFingerprint, readScratchOwnerRecord, scratchPathIdentity, writeScratchOwnerRecord, } from "./scratch-owner.js";
|
|
7
|
-
import { SCRATCH_NAMESPACE, scratchBaseDir, } from "./scratch-namespace-authority.js";
|
|
8
|
-
import { openOwnedScratchRunRoot, } from "./scratch.js";
|
|
9
|
-
/** Private environment variable inherited only by a supervised test payload. */
|
|
10
|
-
export const SCRATCH_SUPERVISION_LEASE_ENV = "LISA_TEST_RUN_LEASE";
|
|
11
|
-
/** Maximum serialized lease accepted from an inherited environment. */
|
|
12
|
-
const MAX_LEASE_BYTES = 16 * 1024;
|
|
13
|
-
/**
|
|
14
|
-
* Whether a value contains an ASCII control code.
|
|
15
|
-
* @param value - Candidate string
|
|
16
|
-
* @returns Whether a control code is present
|
|
17
|
-
*/
|
|
18
|
-
function hasControlCode(value) {
|
|
19
|
-
return [...value].some(character => {
|
|
20
|
-
const codePoint = character.codePointAt(0) ?? 0;
|
|
21
|
-
return codePoint <= 31 || codePoint === 127;
|
|
22
|
-
});
|
|
23
|
-
}
|
|
24
|
-
/**
|
|
25
|
-
* Validate one inert direct basename.
|
|
26
|
-
* @param value - Candidate basename
|
|
27
|
-
* @returns Whether the value is a direct basename
|
|
28
|
-
*/
|
|
29
|
-
function validBasename(value) {
|
|
30
|
-
return (typeof value === "string" &&
|
|
31
|
-
value !== "" &&
|
|
32
|
-
value !== "." &&
|
|
33
|
-
value !== ".." &&
|
|
34
|
-
path.basename(value) === value &&
|
|
35
|
-
!value.includes("/") &&
|
|
36
|
-
!value.includes("\\") &&
|
|
37
|
-
Buffer.byteLength(value, "utf8") <= 1_024 &&
|
|
38
|
-
!hasControlCode(value));
|
|
39
|
-
}
|
|
40
|
-
/**
|
|
41
|
-
* Validate one serialized filesystem identity.
|
|
42
|
-
* @param value - Candidate identity
|
|
43
|
-
* @returns Whether all identity fields are bounded and typed
|
|
44
|
-
*/
|
|
45
|
-
function validIdentity(value) {
|
|
46
|
-
if (typeof value !== "object" || value === null)
|
|
47
|
-
return false;
|
|
48
|
-
const candidate = value;
|
|
49
|
-
return (typeof candidate["canonicalPath"] === "string" &&
|
|
50
|
-
path.isAbsolute(candidate["canonicalPath"]) &&
|
|
51
|
-
Number.isSafeInteger(candidate["dev"]) &&
|
|
52
|
-
Number.isSafeInteger(candidate["ino"]));
|
|
53
|
-
}
|
|
54
|
-
/**
|
|
55
|
-
* Construct a bounded lease only after the suite root has been independently opened.
|
|
56
|
-
* @param intent - Armed suite-root intent
|
|
57
|
-
* @param configuration - Suite attribution captured before collection
|
|
58
|
-
* @param configuration.suiteLabel - Opaque suite label
|
|
59
|
-
* @param configuration.registeredPrefixes - Pre-collection prefix registry
|
|
60
|
-
* @returns Immutable lease
|
|
61
|
-
*/
|
|
62
|
-
export function createScratchSupervisionLease(intent, configuration) {
|
|
63
|
-
const opened = openOwnedScratchRunRoot(intent);
|
|
64
|
-
if (opened === undefined)
|
|
65
|
-
throw new Error("Supervised suite root is absent");
|
|
66
|
-
return Object.freeze({
|
|
67
|
-
schema: 1,
|
|
68
|
-
token: intent.token,
|
|
69
|
-
suiteRootBasename: intent.basename,
|
|
70
|
-
baseCanonicalPath: intent.authority.baseCanonicalPath,
|
|
71
|
-
namespace: intent.authority.namespace,
|
|
72
|
-
suiteRoot: opened.owner.root,
|
|
73
|
-
suiteLabel: configuration.suiteLabel,
|
|
74
|
-
registeredPrefixes: [...configuration.registeredPrefixes],
|
|
75
|
-
});
|
|
76
|
-
}
|
|
77
|
-
/**
|
|
78
|
-
* Parse and validate the private bounded lease contract.
|
|
79
|
-
* @param raw - Serialized lease
|
|
80
|
-
* @returns Validated version-one lease
|
|
81
|
-
*/
|
|
82
|
-
export function parseScratchSupervisionLease(raw) {
|
|
83
|
-
if (Buffer.byteLength(raw, "utf8") > MAX_LEASE_BYTES) {
|
|
84
|
-
throw new Error("Scratch supervision lease exceeds its byte bound");
|
|
85
|
-
}
|
|
86
|
-
const value = (() => {
|
|
87
|
-
try {
|
|
88
|
-
return JSON.parse(raw);
|
|
89
|
-
}
|
|
90
|
-
catch {
|
|
91
|
-
throw new Error("Scratch supervision lease must be valid JSON");
|
|
92
|
-
}
|
|
93
|
-
})();
|
|
94
|
-
if (typeof value !== "object" || value === null) {
|
|
95
|
-
throw new Error("Scratch supervision lease must be an object");
|
|
96
|
-
}
|
|
97
|
-
const lease = value;
|
|
98
|
-
const prefixes = lease["registeredPrefixes"];
|
|
99
|
-
if (lease["schema"] !== 1 ||
|
|
100
|
-
typeof lease["token"] !== "string" ||
|
|
101
|
-
!/^[a-f0-9]{32}$/u.test(lease["token"]) ||
|
|
102
|
-
!validBasename(lease["suiteRootBasename"]) ||
|
|
103
|
-
typeof lease["baseCanonicalPath"] !== "string" ||
|
|
104
|
-
!path.isAbsolute(lease["baseCanonicalPath"]) ||
|
|
105
|
-
!validIdentity(lease["namespace"]) ||
|
|
106
|
-
!validIdentity(lease["suiteRoot"]) ||
|
|
107
|
-
typeof lease["suiteLabel"] !== "string" ||
|
|
108
|
-
lease["suiteLabel"] === "" ||
|
|
109
|
-
!Array.isArray(prefixes) ||
|
|
110
|
-
prefixes.length > 64 ||
|
|
111
|
-
!prefixes.every(validBasename)) {
|
|
112
|
-
throw new Error("Invalid scratch supervision lease schema");
|
|
113
|
-
}
|
|
114
|
-
return value;
|
|
115
|
-
}
|
|
116
|
-
/**
|
|
117
|
-
* Resolve and validate the suite root from inert lease fields.
|
|
118
|
-
* @param lease - Validated lease
|
|
119
|
-
* @returns Canonical suite-root path and identity
|
|
120
|
-
*/
|
|
121
|
-
function validateSuiteRoot(lease) {
|
|
122
|
-
const namespace = scratchPathIdentity(lease.namespace.canonicalPath);
|
|
123
|
-
if (namespace.dev !== lease.namespace.dev ||
|
|
124
|
-
namespace.ino !== lease.namespace.ino ||
|
|
125
|
-
namespace.canonicalPath !==
|
|
126
|
-
path.join(lease.baseCanonicalPath, SCRATCH_NAMESPACE)) {
|
|
127
|
-
throw new Error("Scratch supervision namespace identity changed");
|
|
128
|
-
}
|
|
129
|
-
const rootPath = path.join(namespace.canonicalPath, lease.suiteRootBasename);
|
|
130
|
-
const identity = scratchPathIdentity(rootPath);
|
|
131
|
-
const owner = readScratchOwnerRecord(rootPath);
|
|
132
|
-
if (identity.dev !== lease.suiteRoot.dev ||
|
|
133
|
-
identity.ino !== lease.suiteRoot.ino ||
|
|
134
|
-
owner.token !== lease.token ||
|
|
135
|
-
owner.root.dev !== identity.dev ||
|
|
136
|
-
owner.root.ino !== identity.ino) {
|
|
137
|
-
throw new Error("Scratch supervision suite token or identity changed");
|
|
138
|
-
}
|
|
139
|
-
return { path: rootPath, identity };
|
|
140
|
-
}
|
|
141
|
-
/**
|
|
142
|
-
* Anchor inherited authority before setup redirects this process's temp path.
|
|
143
|
-
* @param lease - Parsed inherited lease.
|
|
144
|
-
*/
|
|
145
|
-
export function assertScratchSupervisionTempRoot(lease) {
|
|
146
|
-
const suite = validateSuiteRoot(lease);
|
|
147
|
-
const current = scratchPathIdentity(scratchBaseDir());
|
|
148
|
-
if (current.canonicalPath === lease.baseCanonicalPath)
|
|
149
|
-
return;
|
|
150
|
-
// The direct adapter starts inside the suite; nested workers inherit a
|
|
151
|
-
// marked worker directory. Neither permits an unrelated temp base.
|
|
152
|
-
if (current.canonicalPath === suite.path &&
|
|
153
|
-
current.dev === suite.identity.dev &&
|
|
154
|
-
current.ino === suite.identity.ino)
|
|
155
|
-
return;
|
|
156
|
-
if (path.dirname(current.canonicalPath) !== suite.path ||
|
|
157
|
-
!/^worker-\d+-[a-f0-9]{16}$/u.test(path.basename(current.canonicalPath))) {
|
|
158
|
-
throw new Error("Scratch supervision lease does not belong to this process temp root");
|
|
159
|
-
}
|
|
160
|
-
const owner = readScratchOwnerRecord(current.canonicalPath);
|
|
161
|
-
// Inherited nested authority requires an OS-verifiable birth. Missing or
|
|
162
|
-
// unsupported platform probes refuse; Windows managed supervision is not
|
|
163
|
-
// supported. PID liveness alone must not authorize this entry path.
|
|
164
|
-
if (owner.namespace.canonicalPath !== suite.path ||
|
|
165
|
-
owner.namespace.dev !== suite.identity.dev ||
|
|
166
|
-
owner.namespace.ino !== suite.identity.ino ||
|
|
167
|
-
owner.root.canonicalPath !== current.canonicalPath ||
|
|
168
|
-
owner.root.dev !== current.dev ||
|
|
169
|
-
owner.root.ino !== current.ino ||
|
|
170
|
-
processBirthFingerprint(owner.pid) !== owner.processBirthFingerprint) {
|
|
171
|
-
throw new Error("Scratch supervision inherited temp worker authority changed");
|
|
172
|
-
}
|
|
173
|
-
}
|
|
174
|
-
/**
|
|
175
|
-
* Allocate one random worker scope under a token-validated suite root.
|
|
176
|
-
* @param lease - Validated suite lease
|
|
177
|
-
* @param options - Optional deterministic persistence seam
|
|
178
|
-
* @returns Durable worker-scope handle
|
|
179
|
-
*/
|
|
180
|
-
export function createSupervisedWorkerScope(lease, options = {}) {
|
|
181
|
-
const suite = validateSuiteRoot(lease);
|
|
182
|
-
const basename = `worker-${String(process.pid)}-${randomBytes(8).toString("hex")}`;
|
|
183
|
-
const workerPath = path.join(suite.path, basename);
|
|
184
|
-
fs.mkdirSync(workerPath, { mode: 0o700 });
|
|
185
|
-
try {
|
|
186
|
-
const owner = createScratchOwnerRecord({
|
|
187
|
-
authority: { namespace: suite.identity },
|
|
188
|
-
root: workerPath,
|
|
189
|
-
suiteLabel: lease.suiteLabel,
|
|
190
|
-
registeredPrefixes: lease.registeredPrefixes,
|
|
191
|
-
});
|
|
192
|
-
(options.writeOwnerRecord ?? writeScratchOwnerRecord)(workerPath, owner);
|
|
193
|
-
validateSuiteRoot(lease);
|
|
194
|
-
return {
|
|
195
|
-
path: workerPath,
|
|
196
|
-
basename,
|
|
197
|
-
parent: suite.identity,
|
|
198
|
-
suiteToken: lease.token,
|
|
199
|
-
owner,
|
|
200
|
-
};
|
|
201
|
-
}
|
|
202
|
-
catch (error) {
|
|
203
|
-
try {
|
|
204
|
-
(options.removeAuthorizedChild ?? removeAuthorizedScratchChild)({
|
|
205
|
-
parent: suite.identity,
|
|
206
|
-
basename,
|
|
207
|
-
});
|
|
208
|
-
}
|
|
209
|
-
catch (cleanupError) {
|
|
210
|
-
throw new AggregateError([error, cleanupError], "Failed to persist and roll back a supervised worker owner marker");
|
|
211
|
-
}
|
|
212
|
-
throw error;
|
|
213
|
-
}
|
|
214
|
-
}
|
|
215
|
-
/**
|
|
216
|
-
* Remove one worker scope while revalidating its parent lease around deletion.
|
|
217
|
-
* @param scope - Durable worker handle
|
|
218
|
-
* @param lease - Optional parent lease for pre/post validation
|
|
219
|
-
*/
|
|
220
|
-
export function removeSupervisedWorkerScope(scope, lease) {
|
|
221
|
-
if (lease !== undefined)
|
|
222
|
-
validateSuiteRoot(lease);
|
|
223
|
-
try {
|
|
224
|
-
const owner = readScratchOwnerRecord(scope.path);
|
|
225
|
-
if (owner.token !== scope.owner.token ||
|
|
226
|
-
owner.root.dev !== scope.owner.root.dev ||
|
|
227
|
-
owner.root.ino !== scope.owner.root.ino) {
|
|
228
|
-
throw new Error("Supervised worker token or identity changed");
|
|
229
|
-
}
|
|
230
|
-
removeAuthorizedScratchChild({
|
|
231
|
-
parent: scope.parent,
|
|
232
|
-
basename: scope.basename,
|
|
233
|
-
});
|
|
234
|
-
}
|
|
235
|
-
catch (error) {
|
|
236
|
-
if (error.code !== "ENOENT")
|
|
237
|
-
throw error;
|
|
238
|
-
}
|
|
239
|
-
if (lease !== undefined)
|
|
240
|
-
validateSuiteRoot(lease);
|
|
241
|
-
}
|
|
242
|
-
export { parseScratchProtocolMessage } from "./scratch-supervision-protocol.js";
|
|
243
|
-
export { validateScratchRunRootIntent } from "./scratch-supervision-intent.js";
|
|
244
|
-
//# sourceMappingURL=scratch-supervision.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"scratch-supervision.js","sourceRoot":"","sources":["../../../src/configs/vitest/scratch-supervision.ts"],"names":[],"mappings":"AAAA,4EAA4E;AAC5E,OAAO,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAC1C,OAAO,KAAK,EAAE,MAAM,SAAS,CAAC;AAC9B,OAAO,KAAK,IAAI,MAAM,WAAW,CAAC;AAElC,OAAO,EAAE,4BAA4B,EAAE,MAAM,wBAAwB,CAAC;AACtE,OAAO,EACL,wBAAwB,EACxB,uBAAuB,EACvB,sBAAsB,EACtB,mBAAmB,EACnB,uBAAuB,GAGxB,MAAM,oBAAoB,CAAC;AAC5B,OAAO,EACL,iBAAiB,EACjB,cAAc,GACf,MAAM,kCAAkC,CAAC;AAC1C,OAAO,EACL,uBAAuB,GAExB,MAAM,cAAc,CAAC;AAEtB,gFAAgF;AAChF,MAAM,CAAC,MAAM,6BAA6B,GAAG,qBAAqB,CAAC;AAEnE,uEAAuE;AACvE,MAAM,eAAe,GAAG,EAAE,GAAG,IAAI,CAAC;AA6BlC;;;;GAIG;AACH,SAAS,cAAc,CAAC,KAAa;IACnC,OAAO,CAAC,GAAG,KAAK,CAAC,CAAC,IAAI,CAAC,SAAS,CAAC,EAAE;QACjC,MAAM,SAAS,GAAG,SAAS,CAAC,WAAW,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC;QAChD,OAAO,SAAS,IAAI,EAAE,IAAI,SAAS,KAAK,GAAG,CAAC;IAC9C,CAAC,CAAC,CAAC;AACL,CAAC;AAED;;;;GAIG;AACH,SAAS,aAAa,CAAC,KAAc;IACnC,OAAO,CACL,OAAO,KAAK,KAAK,QAAQ;QACzB,KAAK,KAAK,EAAE;QACZ,KAAK,KAAK,GAAG;QACb,KAAK,KAAK,IAAI;QACd,IAAI,CAAC,QAAQ,CAAC,KAAK,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,CAAC;AAED,OAAO,EAAE,2BAA2B,EAAE,MAAM,mCAAmC,CAAC;AAChF,OAAO,EAAE,4BAA4B,EAAE,MAAM,iCAAiC,CAAC"}
|
|
@@ -1,66 +0,0 @@
|
|
|
1
|
-
import { processBirthFingerprintSnapshot } from "./scratch-owner.js";
|
|
2
|
-
/** Inputs deciding whether one namespace entry may be removed. */
|
|
3
|
-
export interface ReclaimDecisionInput {
|
|
4
|
-
readonly name: string;
|
|
5
|
-
readonly now: number;
|
|
6
|
-
readonly isProcessAlive: (pid: number) => boolean;
|
|
7
|
-
readonly maxAgeMs?: number;
|
|
8
|
-
readonly selfName?: string;
|
|
9
|
-
}
|
|
10
|
-
/** Outcome of one sweep of the namespace. */
|
|
11
|
-
export interface SweepResult {
|
|
12
|
-
readonly removed: readonly string[];
|
|
13
|
-
readonly kept: readonly string[];
|
|
14
|
-
}
|
|
15
|
-
/** Options controlling one sweep. */
|
|
16
|
-
export interface SweepOptions {
|
|
17
|
-
readonly now?: number;
|
|
18
|
-
readonly isProcessAlive?: (pid: number) => boolean;
|
|
19
|
-
readonly maxAgeMs?: number;
|
|
20
|
-
readonly selfName?: string;
|
|
21
|
-
readonly processBirthFingerprint?: (pid: number) => string | undefined;
|
|
22
|
-
}
|
|
23
|
-
/**
|
|
24
|
-
* Decide whether a recognized entry belongs to a dead process.
|
|
25
|
-
* @param input - Entry and liveness facts
|
|
26
|
-
* @param input.name - Direct namespace basename
|
|
27
|
-
* @param input.isProcessAlive - Recorded-owner liveness probe
|
|
28
|
-
* @param input.selfName - Optional caller-owned basename
|
|
29
|
-
* @returns True only for a recognized dead-process name
|
|
30
|
-
*/
|
|
31
|
-
export declare const isReclaimable: ({ name, isProcessAlive: alive, selfName, }: ReclaimDecisionInput) => boolean;
|
|
32
|
-
/**
|
|
33
|
-
* Report whether a pid resolves to a running process.
|
|
34
|
-
* @param pid - Process id to probe
|
|
35
|
-
* @returns True when the kernel still resolves the process
|
|
36
|
-
*/
|
|
37
|
-
export declare const isProcessAlive: (pid: number) => boolean;
|
|
38
|
-
/**
|
|
39
|
-
* Refuse to authorize a foreign entry using age alone.
|
|
40
|
-
* @param _entryPath - Retained compatibility path
|
|
41
|
-
* @param _now - Retained compatibility clock
|
|
42
|
-
* @param _maxAgeMs - Retained compatibility age
|
|
43
|
-
* @returns Always false
|
|
44
|
-
*/
|
|
45
|
-
export declare const isStaleForeignEntry: (_entryPath: string, _now: number, _maxAgeMs: number) => boolean;
|
|
46
|
-
/**
|
|
47
|
-
* Read bounded direct namespace entries.
|
|
48
|
-
* @param dir - Exact namespace directory
|
|
49
|
-
* @returns Direct basenames, or an empty list when absent
|
|
50
|
-
*/
|
|
51
|
-
export declare const readNamespaceEntries: (dir: string) => readonly string[];
|
|
52
|
-
/**
|
|
53
|
-
* Capture birth fingerprints for the currently live marked owners.
|
|
54
|
-
* @param dir - Exact namespace path
|
|
55
|
-
* @param alive - Process liveness probe
|
|
56
|
-
* @param snapshot - One bounded bulk process-birth snapshot provider
|
|
57
|
-
* @returns Snapshot-backed process-birth probe
|
|
58
|
-
*/
|
|
59
|
-
export declare function liveOwnerBirthProbe(dir: string, alive: (pid: number) => boolean, snapshot?: typeof processBirthFingerprintSnapshot): (pid: number) => string | undefined;
|
|
60
|
-
/**
|
|
61
|
-
* Sweep abandoned marked roots using process-birth authority.
|
|
62
|
-
* @param options - Sweep inputs
|
|
63
|
-
* @returns Removed and preserved names
|
|
64
|
-
*/
|
|
65
|
-
export declare const sweepScratchNamespace: (options?: SweepOptions) => SweepResult;
|
|
66
|
-
//# sourceMappingURL=scratch-sweep.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"scratch-sweep.d.ts","sourceRoot":"","sources":["../../../src/configs/vitest/scratch-sweep.ts"],"names":[],"mappings":"AASA,OAAO,EACL,+BAA+B,EAEhC,MAAM,oBAAoB,CAAC;AAE5B,kEAAkE;AAClE,MAAM,WAAW,oBAAoB;IACnC,QAAQ,CAAC,IAAI,EAAE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,MAAM,KAAK,OAAO,EAC/B,QAAQ,GAAE,OAAO,+BAAiE,GACjF,CAAC,GAAG,EAAE,MAAM,KAAK,MAAM,GAAG,SAAS,CAWrC;AAED;;;;GAIG;AACH,eAAO,MAAM,qBAAqB,GAChC,UAAS,YAAiB,KACzB,WAUF,CAAC"}
|
|
@@ -1,82 +0,0 @@
|
|
|
1
|
-
/** Bounded, ownership-aware startup sweep for the scratch namespace. */
|
|
2
|
-
import * as path from "node:path";
|
|
3
|
-
import { parseRunRootName, readBoundedScratchNamespace, scratchNamespaceDir, sweepAuthorizedScratchNamespace, } from "./scratch-authority.js";
|
|
4
|
-
import { processBirthFingerprintSnapshot, readScratchOwnerRecord, } from "./scratch-owner.js";
|
|
5
|
-
/**
|
|
6
|
-
* Decide whether a recognized entry belongs to a dead process.
|
|
7
|
-
* @param input - Entry and liveness facts
|
|
8
|
-
* @param input.name - Direct namespace basename
|
|
9
|
-
* @param input.isProcessAlive - Recorded-owner liveness probe
|
|
10
|
-
* @param input.selfName - Optional caller-owned basename
|
|
11
|
-
* @returns True only for a recognized dead-process name
|
|
12
|
-
*/
|
|
13
|
-
export const isReclaimable = ({ name, isProcessAlive: alive, selfName, }) => {
|
|
14
|
-
if (selfName !== undefined && name === selfName)
|
|
15
|
-
return false;
|
|
16
|
-
const owner = parseRunRootName(name);
|
|
17
|
-
return owner !== undefined && !alive(owner.pid);
|
|
18
|
-
};
|
|
19
|
-
/**
|
|
20
|
-
* Report whether a pid resolves to a running process.
|
|
21
|
-
* @param pid - Process id to probe
|
|
22
|
-
* @returns True when the kernel still resolves the process
|
|
23
|
-
*/
|
|
24
|
-
export const isProcessAlive = (pid) => {
|
|
25
|
-
try {
|
|
26
|
-
process.kill(pid, 0);
|
|
27
|
-
return true;
|
|
28
|
-
}
|
|
29
|
-
catch (error) {
|
|
30
|
-
return error.code === "EPERM";
|
|
31
|
-
}
|
|
32
|
-
};
|
|
33
|
-
/**
|
|
34
|
-
* Refuse to authorize a foreign entry using age alone.
|
|
35
|
-
* @param _entryPath - Retained compatibility path
|
|
36
|
-
* @param _now - Retained compatibility clock
|
|
37
|
-
* @param _maxAgeMs - Retained compatibility age
|
|
38
|
-
* @returns Always false
|
|
39
|
-
*/
|
|
40
|
-
export const isStaleForeignEntry = (_entryPath, _now, _maxAgeMs) => false;
|
|
41
|
-
/**
|
|
42
|
-
* Read bounded direct namespace entries.
|
|
43
|
-
* @param dir - Exact namespace directory
|
|
44
|
-
* @returns Direct basenames, or an empty list when absent
|
|
45
|
-
*/
|
|
46
|
-
export const readNamespaceEntries = (dir) => readBoundedScratchNamespace(dir);
|
|
47
|
-
/**
|
|
48
|
-
* Capture birth fingerprints for the currently live marked owners.
|
|
49
|
-
* @param dir - Exact namespace path
|
|
50
|
-
* @param alive - Process liveness probe
|
|
51
|
-
* @param snapshot - One bounded bulk process-birth snapshot provider
|
|
52
|
-
* @returns Snapshot-backed process-birth probe
|
|
53
|
-
*/
|
|
54
|
-
export function liveOwnerBirthProbe(dir, alive, snapshot = processBirthFingerprintSnapshot) {
|
|
55
|
-
const livePids = readNamespaceEntries(dir).flatMap(name => {
|
|
56
|
-
try {
|
|
57
|
-
const pid = readScratchOwnerRecord(path.join(dir, name)).pid;
|
|
58
|
-
return alive(pid) ? [pid] : [];
|
|
59
|
-
}
|
|
60
|
-
catch {
|
|
61
|
-
return [];
|
|
62
|
-
}
|
|
63
|
-
});
|
|
64
|
-
const births = snapshot(livePids);
|
|
65
|
-
return (pid) => births.get(pid);
|
|
66
|
-
}
|
|
67
|
-
/**
|
|
68
|
-
* Sweep abandoned marked roots using process-birth authority.
|
|
69
|
-
* @param options - Sweep inputs
|
|
70
|
-
* @returns Removed and preserved names
|
|
71
|
-
*/
|
|
72
|
-
export const sweepScratchNamespace = (options = {}) => {
|
|
73
|
-
const dir = scratchNamespaceDir();
|
|
74
|
-
const alive = options.isProcessAlive ?? isProcessAlive;
|
|
75
|
-
const birthProbe = options.processBirthFingerprint ?? liveOwnerBirthProbe(dir, alive);
|
|
76
|
-
return sweepAuthorizedScratchNamespace({
|
|
77
|
-
isProcessAlive: alive,
|
|
78
|
-
processBirthFingerprint: birthProbe,
|
|
79
|
-
...(options.selfName === undefined ? {} : { selfName: options.selfName }),
|
|
80
|
-
});
|
|
81
|
-
};
|
|
82
|
-
//# sourceMappingURL=scratch-sweep.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"scratch-sweep.js","sourceRoot":"","sources":["../../../src/configs/vitest/scratch-sweep.ts"],"names":[],"mappings":"AAAA,wEAAwE;AACxE,OAAO,KAAK,IAAI,MAAM,WAAW,CAAC;AAElC,OAAO,EACL,gBAAgB,EAChB,2BAA2B,EAC3B,mBAAmB,EACnB,+BAA+B,GAChC,MAAM,wBAAwB,CAAC;AAChC,OAAO,EACL,+BAA+B,EAC/B,sBAAsB,GACvB,MAAM,oBAAoB,CAAC;AA0B5B;;;;;;;GAOG;AACH,MAAM,CAAC,MAAM,aAAa,GAAG,CAAC,EAC5B,IAAI,EACJ,cAAc,EAAE,KAAK,EACrB,QAAQ,GACa,EAAW,EAAE;IAClC,IAAI,QAAQ,KAAK,SAAS,IAAI,IAAI,KAAK,QAAQ;QAAE,OAAO,KAAK,CAAC;IAC9D,MAAM,KAAK,GAAG,gBAAgB,CAAC,IAAI,CAAC,CAAC;IACrC,OAAO,KAAK,KAAK,SAAS,IAAI,CAAC,KAAK,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;AAClD,CAAC,CAAC;AAEF;;;;GAIG;AACH,MAAM,CAAC,MAAM,cAAc,GAAG,CAAC,GAAW,EAAW,EAAE;IACrD,IAAI,CAAC;QACH,OAAO,CAAC,IAAI,CAAC,GAAG,EAAE,CAAC,CAAC,CAAC;QACrB,OAAO,IAAI,CAAC;IACd,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,OAAQ,KAA+B,CAAC,IAAI,KAAK,OAAO,CAAC;IAC3D,CAAC;AACH,CAAC,CAAC;AAEF;;;;;;GAMG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QACnC,GAAG,CAAC,OAAO,CAAC,QAAQ,KAAK,SAAS,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,QAAQ,EAAE,OAAO,CAAC,QAAQ,EAAE,CAAC;KAC1E,CAAC,CAAC;AACL,CAAC,CAAC"}
|
|
@@ -1,48 +0,0 @@
|
|
|
1
|
-
/** The rung of the chain that failed the trust test, and why it failed. */
|
|
2
|
-
export interface UntrustedAncestor {
|
|
3
|
-
/** Absolute path of the rejected directory. */
|
|
4
|
-
readonly directory: string;
|
|
5
|
-
/** Owning uid, as reported by `stat`. */
|
|
6
|
-
readonly uid: number;
|
|
7
|
-
/** Permission, setuid/setgid and sticky bits. */
|
|
8
|
-
readonly mode: number;
|
|
9
|
-
/** Operator-readable statement of which property failed. */
|
|
10
|
-
readonly reason: string;
|
|
11
|
-
}
|
|
12
|
-
/**
|
|
13
|
-
* Render a mode the way `ls` and `chmod` spell it, so it can be compared.
|
|
14
|
-
* @param mode - Permission bits
|
|
15
|
-
* @returns Four-digit octal string
|
|
16
|
-
*/
|
|
17
|
-
export declare const octalMode: (mode: number) => string;
|
|
18
|
-
/**
|
|
19
|
-
* Every ancestor of an absolute path, root first and the path itself last.
|
|
20
|
-
* @param target - Absolute, symlink-resolved path
|
|
21
|
-
* @returns The chain to walk, in the order the shell walks it
|
|
22
|
-
*/
|
|
23
|
-
export declare const ancestorChain: (target: string) => readonly string[];
|
|
24
|
-
/**
|
|
25
|
-
* The first untrusted ancestor of a path, if any.
|
|
26
|
-
*
|
|
27
|
-
* Platforms without uid ownership have nothing to check and are never refused.
|
|
28
|
-
* @param target - Absolute, symlink-resolved path to walk
|
|
29
|
-
* @returns The first failing rung, or undefined
|
|
30
|
-
*/
|
|
31
|
-
export declare const findUntrustedAncestor: (target: string) => UntrustedAncestor | undefined;
|
|
32
|
-
/**
|
|
33
|
-
* The refusal text: what was rejected, which rung rejected it, and the fix.
|
|
34
|
-
* @param resolved - The symlink-resolved TMPDIR that was walked
|
|
35
|
-
* @param ancestor - The rung that failed
|
|
36
|
-
* @returns Operator-readable failure text
|
|
37
|
-
*/
|
|
38
|
-
export declare const describeUntrustedTmpdir: (resolved: string, ancestor: UntrustedAncestor) => string;
|
|
39
|
-
/**
|
|
40
|
-
* Why this run's TMPDIR must be refused, or `undefined` when it is trusted.
|
|
41
|
-
*
|
|
42
|
-
* Read through `realpathSync` because the shell resolves with `cd -P` before it
|
|
43
|
-
* walks: the chain that matters is the physical one, and a symlinked TMPDIR
|
|
44
|
-
* whose logical spelling looks fine can resolve onto a rung that is not.
|
|
45
|
-
* @returns Refusal text, or undefined when the chain is trusted
|
|
46
|
-
*/
|
|
47
|
-
export declare const describeTmpdirTrustFailure: () => string | undefined;
|
|
48
|
-
//# sourceMappingURL=scratch-tmpdir-trust.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"scratch-tmpdir-trust.d.ts","sourceRoot":"","sources":["../../../src/configs/vitest/scratch-tmpdir-trust.ts"],"names":[],"mappings":"AA0DA,2EAA2E;AAC3E,MAAM,WAAW,iBAAiB;IAChC,+CAA+C;IAC/C,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAC;IAC3B,yCAAyC;IACzC,QAAQ,CAAC,GAAG,EAAE,MAAM,CAAC;IACrB,iDAAiD;IACjD,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,4DAA4D;IAC5D,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;CACzB;AAED;;;;GAIG;AACH,eAAO,MAAM,SAAS,GAAI,MAAM,MAAM,KAAG,MACN,CAAC;AAEpC;;;;GAIG;AACH,eAAO,MAAM,aAAa,GAAI,QAAQ,MAAM,KAAG,SAAS,MAAM,EAUzD,CAAC;AAuEN;;;;;;GAMG;AACH,eAAO,MAAM,qBAAqB,GAChC,QAAQ,MAAM,KACb,iBAAiB,GAAG,SAItB,CAAC;AAqBF;;;;;GAKG;AACH,eAAO,MAAM,uBAAuB,GAClC,UAAU,MAAM,EAChB,UAAU,iBAAiB,KAC1B,MAuBW,CAAC;AAEf;;;;;;;GAOG;AACH,eAAO,MAAM,0BAA0B,QAAO,MAAM,GAAG,SAOtD,CAAC"}
|