@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,239 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Admission control for the fleet's test runs.
|
|
3
|
-
*
|
|
4
|
-
* ## The gap this fills
|
|
5
|
-
*
|
|
6
|
-
* `resolveMaxWorkers` has three layers and all three size a *pool*. None of
|
|
7
|
-
* them decides whether a run may start. Past the point where the divisor
|
|
8
|
-
* saturates that distinction becomes the whole problem: on eighteen cores
|
|
9
|
-
* `floor(cores / 2 / fleet)` clamps to {@link MIN_FLEET_WORKERS} from a fleet of
|
|
10
|
-
* five upward, so fleets of 5, 13, 20 and 50 all resolve to two workers each and
|
|
11
|
-
* the fleet's TOTAL demand is `2 x fleet` — 26 workers at thirteen runs, 100 at
|
|
12
|
-
* fifty, on a machine with eighteen cores. The layer's own docstring says it
|
|
13
|
-
* bounds the fleet "rather than multiplied by its own size"; past four runs it
|
|
14
|
-
* multiplies (CodySwannGT/lisa#3941).
|
|
15
|
-
*
|
|
16
|
-
* The arithmetic is not a bug in the divisor. **With a per-run floor that may
|
|
17
|
-
* not be lowered, no pool-sizing rule can bound a sum over an unbounded number
|
|
18
|
-
* of runs.** Bounding it requires deciding that some run does not execute yet.
|
|
19
|
-
* That decision is what this module is.
|
|
20
|
-
*
|
|
21
|
-
* ## Why the floor is not the lever
|
|
22
|
-
*
|
|
23
|
-
* {@link MIN_FLEET_WORKERS} is measured and deliberately out of scope. One
|
|
24
|
-
* worker serialises a suite, so every file waits behind every other file and
|
|
25
|
-
* per-test budgets expire even as machine load falls — the recorded 124-timeouts
|
|
26
|
-
* -against-54 result. Lowering it trades a visible failure for a subtler one,
|
|
27
|
-
* which is the move this module exists to avoid rather than to make.
|
|
28
|
-
*
|
|
29
|
-
* ## The rule, and why it cannot deadlock
|
|
30
|
-
*
|
|
31
|
-
* Every supervised run registers a `run-<pid>-<startedAt>-<suffix>` root before
|
|
32
|
-
* its payload starts. A run admits itself when its own root is among the
|
|
33
|
-
* {@link fleetCapacity} OLDEST live roots. That is a total order on facts each
|
|
34
|
-
* run can read for itself: no lock, no leader, no coordinator, and no message
|
|
35
|
-
* anybody has to receive. At least `capacity` runs always satisfy it, so the
|
|
36
|
-
* fleet always makes progress, and a waiting run's rank improves for free as
|
|
37
|
-
* older runs finish and their roots disappear.
|
|
38
|
-
*
|
|
39
|
-
* Ranking by age rather than by, say, pid also makes the queue fair in the one
|
|
40
|
-
* direction that matters: the run that has been waiting longest goes first, so
|
|
41
|
-
* nothing starves.
|
|
42
|
-
*
|
|
43
|
-
* ## Every unknown admits
|
|
44
|
-
*
|
|
45
|
-
* This runs before a single test does, so a mistake here does not degrade a run,
|
|
46
|
-
* it prevents one. Unranked (the run registered no root, or is unsupervised), an
|
|
47
|
-
* unreadable namespace, a capacity of zero, a disabled switch, an expired
|
|
48
|
-
* deadline — all admit. The control bounds demand when it can see the fleet and
|
|
49
|
-
* gets out of the way when it cannot. It is deliberately NOT fail-closed:
|
|
50
|
-
* refusing to run on missing information would turn a load control into a
|
|
51
|
-
* correctness signal, and a red gate reads exactly like a regression.
|
|
52
|
-
*
|
|
53
|
-
* ## Why the deadline exists
|
|
54
|
-
*
|
|
55
|
-
* A run that waits forever is worse than an overloaded machine. The agent
|
|
56
|
-
* watching it sees a hang, kills it, and retries — which is the cascade the cap
|
|
57
|
-
* exists to stop, arriving through the control rather than around it. So the
|
|
58
|
-
* wait is bounded, and expiry admits with a notice rather than refusing. Past
|
|
59
|
-
* the deadline the behaviour degrades exactly to what shipped before this
|
|
60
|
-
* module, loudly.
|
|
61
|
-
* @module configs/vitest/fleet-admission
|
|
62
|
-
*/
|
|
63
|
-
import { env } from "node:process";
|
|
64
|
-
import { MIN_FLEET_WORKERS, fleetShare } from "./base.js";
|
|
65
|
-
import { parseScratchRunRootName } from "./scratch-owner.js";
|
|
66
|
-
/**
|
|
67
|
-
* Environment variable that switches admission off entirely.
|
|
68
|
-
*
|
|
69
|
-
* The value `off` disables the wait; anything else leaves it armed. This
|
|
70
|
-
* matches the escape hatch `LISA_VITEST_MAX_WORKERS` already provides and the
|
|
71
|
-
* reason given for it — a cap nobody can lift is a cap that gets worked around
|
|
72
|
-
* by deleting it. This is a load control, not a safety guard, and the two want
|
|
73
|
-
* opposite answers about overrides.
|
|
74
|
-
*/
|
|
75
|
-
export const FLEET_ADMISSION_VAR = "LISA_FLEET_ADMISSION";
|
|
76
|
-
/** Value of {@link FLEET_ADMISSION_VAR} that disables the wait. */
|
|
77
|
-
export const FLEET_ADMISSION_OFF = "off";
|
|
78
|
-
/** Environment variable overriding how long a run may wait for a slot. */
|
|
79
|
-
export const FLEET_ADMISSION_DEADLINE_VAR = "LISA_FLEET_ADMISSION_DEADLINE_MS";
|
|
80
|
-
/**
|
|
81
|
-
* How long a run waits for a slot before starting anyway.
|
|
82
|
-
*
|
|
83
|
-
* Two minutes is long enough for a typical unit suite ahead of it to finish and
|
|
84
|
-
* short enough that a stuck older run cannot look like a hang. It is not a
|
|
85
|
-
* measured optimum and is overridable; what matters is that it is finite.
|
|
86
|
-
*/
|
|
87
|
-
export const DEFAULT_ADMISSION_DEADLINE_MS = 120_000;
|
|
88
|
-
/** How often a waiting run re-reads the namespace. */
|
|
89
|
-
export const ADMISSION_POLL_MS = 2_000;
|
|
90
|
-
/**
|
|
91
|
-
* How many runs may execute workers at once before demand exceeds the machine.
|
|
92
|
-
*
|
|
93
|
-
* The bound is the same one the divisor layer starts from — half the cores —
|
|
94
|
-
* divided by the smallest pool a run may be given. Below that, admitting
|
|
95
|
-
* another run necessarily pushes total demand past the machine, because every
|
|
96
|
-
* admitted run is entitled to {@link MIN_FLEET_WORKERS}.
|
|
97
|
-
*
|
|
98
|
-
* Never zero. A machine too small to host one run at the minimum still has to
|
|
99
|
-
* run its tests, and a capacity of zero would refuse every run on every
|
|
100
|
-
* two-core CI runner.
|
|
101
|
-
* @param cores - Logical cores available.
|
|
102
|
-
* @returns The number of runs that may execute concurrently, at least one.
|
|
103
|
-
*/
|
|
104
|
-
export function fleetCapacity(cores) {
|
|
105
|
-
return Math.max(1, Math.floor(cores / 2 / MIN_FLEET_WORKERS));
|
|
106
|
-
}
|
|
107
|
-
/**
|
|
108
|
-
* Total workers the fleet demands once admission is enforced.
|
|
109
|
-
*
|
|
110
|
-
* The property #3941 asks for, expressed as a number a test can check at any
|
|
111
|
-
* fleet size. Pool sizing alone cannot satisfy it: `fleetShare(cores, fleet) *
|
|
112
|
-
* fleet` grows without bound in `fleet`, because the share stops falling at the
|
|
113
|
-
* floor. Capping the count of runs that execute is what makes the product stop
|
|
114
|
-
* growing.
|
|
115
|
-
* @param fleet - How many runs want to execute.
|
|
116
|
-
* @param cores - Logical cores available.
|
|
117
|
-
* @returns Workers demanded by the runs actually executing.
|
|
118
|
-
*/
|
|
119
|
-
export function admittedWorkerDemand(fleet, cores) {
|
|
120
|
-
const wanted = Math.max(1, Math.floor(fleet));
|
|
121
|
-
const admitted = Math.min(wanted, fleetCapacity(cores));
|
|
122
|
-
return admitted * fleetShare(cores, wanted);
|
|
123
|
-
}
|
|
124
|
-
/**
|
|
125
|
-
* Where a run stands in the queue, oldest first.
|
|
126
|
-
*
|
|
127
|
-
* Ordered by creation time, then by pid, then by basename — a total order over
|
|
128
|
-
* facts every run reads identically, so two runs never both believe they hold
|
|
129
|
-
* the same slot. Ties on the millisecond are real: several lanes launched
|
|
130
|
-
* together routinely share a timestamp.
|
|
131
|
-
* @param roots - Live run roots read from the namespace.
|
|
132
|
-
* @param selfBasename - This run's own root basename, if it has one.
|
|
133
|
-
* @returns The zero-based position, or undefined when this run is not among them.
|
|
134
|
-
*/
|
|
135
|
-
export function admissionRank(roots, selfBasename) {
|
|
136
|
-
if (selfBasename === undefined)
|
|
137
|
-
return undefined;
|
|
138
|
-
const ordered = [...roots].sort((left, right) => left.startedAt - right.startedAt ||
|
|
139
|
-
left.pid - right.pid ||
|
|
140
|
-
(left.basename < right.basename
|
|
141
|
-
? -1
|
|
142
|
-
: left.basename > right.basename
|
|
143
|
-
? 1
|
|
144
|
-
: 0));
|
|
145
|
-
const position = ordered.findIndex(root => root.basename === selfBasename);
|
|
146
|
-
return position === -1 ? undefined : position;
|
|
147
|
-
}
|
|
148
|
-
/**
|
|
149
|
-
* Parse the run roots out of one namespace listing.
|
|
150
|
-
* @param names - Directory basenames, already bounded by the caller.
|
|
151
|
-
* @returns The entries that are run roots, in the order given.
|
|
152
|
-
*/
|
|
153
|
-
export function readFleetRunRoots(names) {
|
|
154
|
-
return names.flatMap(basename => {
|
|
155
|
-
const owner = parseScratchRunRootName(basename);
|
|
156
|
-
return owner === undefined
|
|
157
|
-
? []
|
|
158
|
-
: [{ basename, pid: owner.pid, startedAt: owner.startedAt }];
|
|
159
|
-
});
|
|
160
|
-
}
|
|
161
|
-
/**
|
|
162
|
-
* Read the admission deadline an operator stated, or the default.
|
|
163
|
-
* @param environment - Environment to read.
|
|
164
|
-
* @returns Milliseconds a run may wait before starting anyway.
|
|
165
|
-
*/
|
|
166
|
-
export function admissionDeadlineMs(environment = env) {
|
|
167
|
-
const raw = environment[FLEET_ADMISSION_DEADLINE_VAR]?.trim();
|
|
168
|
-
if (raw === undefined || !/^\d+$/u.test(raw)) {
|
|
169
|
-
return DEFAULT_ADMISSION_DEADLINE_MS;
|
|
170
|
-
}
|
|
171
|
-
const value = Number(raw);
|
|
172
|
-
return value > 0 ? value : DEFAULT_ADMISSION_DEADLINE_MS;
|
|
173
|
-
}
|
|
174
|
-
/**
|
|
175
|
-
* Whether admission is armed at all.
|
|
176
|
-
* @param environment - Environment to read.
|
|
177
|
-
* @returns Whether the wait should be attempted.
|
|
178
|
-
*/
|
|
179
|
-
export function admissionEnabled(environment = env) {
|
|
180
|
-
return environment[FLEET_ADMISSION_VAR]?.trim() !== FLEET_ADMISSION_OFF;
|
|
181
|
-
}
|
|
182
|
-
/**
|
|
183
|
-
* Decide whether this run may execute now, and say so in one line.
|
|
184
|
-
*
|
|
185
|
-
* The order of the branches is the order of confidence. Anything this cannot
|
|
186
|
-
* measure admits before anything it can measure is consulted, so a defect in
|
|
187
|
-
* the ranking can only make the control weaker, never make it refuse a run it
|
|
188
|
-
* should have allowed.
|
|
189
|
-
* @param input - The facts the decision is made from.
|
|
190
|
-
* @returns The verdict and its operator-readable notice.
|
|
191
|
-
*/
|
|
192
|
-
export function admissionVerdict(input) {
|
|
193
|
-
if (!input.enabled) {
|
|
194
|
-
return { decision: "admit-disabled", admitted: true, notice: "" };
|
|
195
|
-
}
|
|
196
|
-
if (input.rank === undefined) {
|
|
197
|
-
return { decision: "admit-unranked", admitted: true, notice: "" };
|
|
198
|
-
}
|
|
199
|
-
if (input.rank < input.capacity) {
|
|
200
|
-
return {
|
|
201
|
-
decision: input.liveRuns <= 1 ? "admit-alone" : "admit-within-capacity",
|
|
202
|
-
admitted: true,
|
|
203
|
-
notice: "",
|
|
204
|
-
};
|
|
205
|
-
}
|
|
206
|
-
if (input.elapsedMs >= input.deadlineMs) {
|
|
207
|
-
return {
|
|
208
|
-
decision: "admit-deadline-expired",
|
|
209
|
-
admitted: true,
|
|
210
|
-
notice: overCapacityNotice(input),
|
|
211
|
-
};
|
|
212
|
-
}
|
|
213
|
-
return { decision: "wait", admitted: false, notice: waitingNotice(input) };
|
|
214
|
-
}
|
|
215
|
-
/**
|
|
216
|
-
* The line a run prints while it is waiting for a slot.
|
|
217
|
-
* @param input - The facts the decision was made from.
|
|
218
|
-
* @returns One operator-readable line.
|
|
219
|
-
*/
|
|
220
|
-
function waitingNotice(input) {
|
|
221
|
-
return (`lisa fleet admission: waiting for a worker slot — ` +
|
|
222
|
-
`${String(input.liveRuns)} run(s) live, this run is #${String((input.rank ?? 0) + 1)}, ` +
|
|
223
|
-
`${String(input.capacity)} may execute at once. ` +
|
|
224
|
-
`Starting anyway in ${String(Math.max(0, Math.ceil((input.deadlineMs - input.elapsedMs) / 1000)))}s. ` +
|
|
225
|
-
`Set ${FLEET_ADMISSION_VAR}=${FLEET_ADMISSION_OFF} to disable this wait.`);
|
|
226
|
-
}
|
|
227
|
-
/**
|
|
228
|
-
* The line a run prints when it starts despite being over capacity.
|
|
229
|
-
* @param input - The facts the decision was made from.
|
|
230
|
-
* @returns One operator-readable line.
|
|
231
|
-
*/
|
|
232
|
-
function overCapacityNotice(input) {
|
|
233
|
-
return (`lisa fleet admission: starting OVER CAPACITY after ` +
|
|
234
|
-
`${String(Math.round(input.elapsedMs / 1000))}s — ` +
|
|
235
|
-
`${String(input.liveRuns)} run(s) live, this run is #${String((input.rank ?? 0) + 1)}, ` +
|
|
236
|
-
`${String(input.capacity)} may execute at once. ` +
|
|
237
|
-
`The machine is oversubscribed; expect timeouts rather than failures.`);
|
|
238
|
-
}
|
|
239
|
-
//# sourceMappingURL=fleet-admission.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"fleet-admission.js","sourceRoot":"","sources":["../../../src/configs/vitest/fleet-admission.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6DG;AACH,OAAO,EAAE,GAAG,EAAE,MAAM,cAAc,CAAC;AAEnC,OAAO,EAAE,iBAAiB,EAAE,UAAU,EAAE,MAAM,WAAW,CAAC;AAC1D,OAAO,EAAE,uBAAuB,EAAE,MAAM,oBAAoB,CAAC;AA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AQ,CAAC,8BAA8B,MAAM,CAAC,CAAC,KAAK,CAAC,IAAI,IAAI,CAAC,CAAC,GAAG,CAAC,CAAC,IAAI;QACxF,GAAG,MAAM,CAAC,KAAK,CAAC,QAAQ,CAAC,wBAAwB;QACjD,sBAAsB,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,EAAE,IAAI,CAAC,IAAI,CAAC,CAAC,KAAK,CAAC,UAAU,GAAG,KAAK,CAAC,SAAS,CAAC,GAAG,IAAI,CAAC,CAAC,CAAC,KAAK;QACtG,OAAO,mBAAmB,IAAI,mBAAmB,wBAAwB,CAC1E,CAAC;AACJ,CAAC;AAED;;;;GAIG;AACH,SAAS,kBAAkB,CAAC,KAAqB;IAC/C,OAAO,CACL,qDAAqD;QACrD,GAAG,MAAM,CAAC,IAAI,CAAC,KAAK,CAAC,KAAK,CAAC,SAAS,GAAG,IAAI,CAAC,CAAC,MAAM;QACnD,GAAG,MAAM,CAAC,KAAK,CAAC,QAAQ,CAAC,8BAA8B,MAAM,CAAC,CAAC,KAAK,CAAC,IAAI,IAAI,CAAC,CAAC,GAAG,CAAC,CAAC,IAAI;QACxF,GAAG,MAAM,CAAC,KAAK,CAAC,QAAQ,CAAC,wBAAwB;QACjD,sEAAsE,CACvE,CAAC;AACJ,CAAC"}
|
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
import { removeAuthorizedScratchRoot } from "./scratch-bound-root-cleanup.js";
|
|
2
|
-
/** Inputs for one authority-bound namespace sweep. */
|
|
3
|
-
export interface AuthorizedScratchSweepOptions {
|
|
4
|
-
readonly isProcessAlive: (pid: number) => boolean;
|
|
5
|
-
readonly processBirthFingerprint: (pid: number) => string | undefined;
|
|
6
|
-
readonly selfName?: string;
|
|
7
|
-
}
|
|
8
|
-
/** Names removed and preserved by one authority-bound sweep. */
|
|
9
|
-
export interface AuthorizedScratchSweepResult {
|
|
10
|
-
readonly removed: readonly string[];
|
|
11
|
-
readonly kept: readonly string[];
|
|
12
|
-
}
|
|
13
|
-
/**
|
|
14
|
-
* Sweep one canonical namespace using durable owner/process-birth authority.
|
|
15
|
-
* @param options - Namespace and process probes
|
|
16
|
-
* @returns Names removed and preserved
|
|
17
|
-
*/
|
|
18
|
-
export declare function sweepAuthorizedScratchNamespace(options: AuthorizedScratchSweepOptions): AuthorizedScratchSweepResult;
|
|
19
|
-
export { BOUND_DIRECTORY_CLEANUP_PROGRAM, removeAuthorizedScratchChild, removeAuthorizedScratchChildren, } from "./scratch-bound-cleanup.js";
|
|
20
|
-
export { removeAuthorizedScratchRoot };
|
|
21
|
-
export { DEFAULT_RECLAIM_AGE_MS, MAX_SCRATCH_NAMESPACE_NAME_BYTES, MAX_SCRATCH_NAMESPACE_SCAN_ENTRIES, RUN_ROOT_PREFIX, SCRATCH_DIRECT_ENTRY_LIMIT, SCRATCH_DIRECT_NAME_BYTES, SCRATCH_QUARANTINE_PREFIX, SCRATCH_NAMESPACE, assertScratchNamespaceAuthority, collectBoundedScratchNames, collectBoundedScratchNamespaceNames, createScratchNamespaceAuthority, parseRunRootName, readBoundedScratchNames, readBoundedScratchNamespace, runRootName, scratchBaseDir, scratchNamespaceDir, } from "./scratch-namespace-authority.js";
|
|
22
|
-
export type { RemoveAuthorizedScratchChildOptions, RemoveAuthorizedScratchChildrenOptions, } from "./scratch-bound-cleanup.js";
|
|
23
|
-
export type { RemoveAuthorizedScratchRootOptions } from "./scratch-bound-root-cleanup.js";
|
|
24
|
-
export type { ScratchNamespaceAuthority, ScratchNamespaceIdentity, } from "./scratch-namespace-authority.js";
|
|
25
|
-
//# sourceMappingURL=scratch-authority.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"scratch-authority.d.ts","sourceRoot":"","sources":["../../../src/configs/vitest/scratch-authority.ts"],"names":[],"mappings":"AAsBA,OAAO,EAAE,2BAA2B,EAAE,MAAM,iCAAiC,CAAC;AAE9E,sDAAsD;AACtD,MAAM,WAAW,6BAA6B;IAC5C,QAAQ,CAAC,cAAc,EAAE,CAAC,GAAG,EAAE,MAAM,KAAK,OAAO,CAAC;IAClD,QAAQ,CAAC,uBAAuB,EAAE,CAAC,GAAG,EAAE,MAAM,KAAK,MAAM,GAAG,SAAS,CAAC;IACtE,QAAQ,CAAC,QAAQ,CAAC,EAAE,MAAM,CAAC;CAC5B;AAED,gEAAgE;AAChE,MAAM,WAAW,4BAA4B;IAC3C,QAAQ,CAAC,OAAO,EAAE,SAAS,MAAM,EAAE,CAAC;IACpC,QAAQ,CAAC,IAAI,EAAE,SAAS,MAAM,EAAE,CAAC;CAClC;AA+FD;;;;GAIG;AACH,wBAAgB,+BAA+B,CAC7C,OAAO,EAAE,6BAA6B,GACrC,4BAA4B,CAU9B;AAED,OAAO,EACL,+BAA+B,EAC/B,4BAA4B,EAC5B,+BAA+B,GAChC,MAAM,4BAA4B,CAAC;AAEpC,OAAO,EAAE,2BAA2B,EAAE,CAAC;AAEvC,OAAO,EACL,sBAAsB,EACtB,gCAAgC,EAChC,kCAAkC,EAClC,eAAe,EACf,0BAA0B,EAC1B,yBAAyB,EACzB,yBAAyB,EACzB,iBAAiB,EACjB,+BAA+B,EAC/B,0BAA0B,EAC1B,mCAAmC,EACnC,+BAA+B,EAC/B,gBAAgB,EAChB,uBAAuB,EACvB,2BAA2B,EAC3B,WAAW,EACX,cAAc,EACd,mBAAmB,GACpB,MAAM,kCAAkC,CAAC;AAE1C,YAAY,EACV,mCAAmC,EACnC,sCAAsC,GACvC,MAAM,4BAA4B,CAAC;AAEpC,YAAY,EAAE,kCAAkC,EAAE,MAAM,iCAAiC,CAAC;AAE1F,YAAY,EACV,yBAAyB,EACzB,wBAAwB,GACzB,MAAM,kCAAkC,CAAC"}
|
|
@@ -1,107 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Filesystem authority for destructive scratch cleanup.
|
|
3
|
-
*
|
|
4
|
-
* Every removal is constrained to one direct child of a canonical, uid-owned,
|
|
5
|
-
* mode-0700 `lisa-scratch` namespace. The child is renamed to a random
|
|
6
|
-
* quarantine name inside that same namespace, then its inode and owner token
|
|
7
|
-
* are revalidated before a no-follow recursive unlink.
|
|
8
|
-
* @module configs/vitest/scratch-authority
|
|
9
|
-
*/
|
|
10
|
-
import * as fs from "node:fs";
|
|
11
|
-
import * as path from "node:path";
|
|
12
|
-
import { classifyScratchOwner, readScratchOwnerRecord, } from "./scratch-owner.js";
|
|
13
|
-
import { SCRATCH_QUARANTINE_PREFIX, authorityForExistingScratchNamespace, readBoundedScratchNamespace, } from "./scratch-namespace-authority.js";
|
|
14
|
-
import { removeAuthorizedScratchRoot } from "./scratch-bound-root-cleanup.js";
|
|
15
|
-
/**
|
|
16
|
-
* Whether a marker is bound to the exact root and namespace inspected.
|
|
17
|
-
* @param authority - Pinned namespace authority
|
|
18
|
-
* @param root - Direct namespace child
|
|
19
|
-
* @param allowQuarantine - Whether the root canonical path may reflect quarantine
|
|
20
|
-
* @returns Parsed marker and whether every authority fact matches
|
|
21
|
-
*/
|
|
22
|
-
function ownerMatchesPath(authority, root, allowQuarantine) {
|
|
23
|
-
const owner = readScratchOwnerRecord(root);
|
|
24
|
-
const stat = fs.lstatSync(root);
|
|
25
|
-
const matches = owner.namespace.canonicalPath === authority.namespace.canonicalPath &&
|
|
26
|
-
owner.namespace.dev === authority.namespace.dev &&
|
|
27
|
-
owner.namespace.ino === authority.namespace.ino &&
|
|
28
|
-
owner.root.dev === stat.dev &&
|
|
29
|
-
owner.root.ino === stat.ino &&
|
|
30
|
-
(allowQuarantine || owner.root.canonicalPath === fs.realpathSync(root));
|
|
31
|
-
return { owner, matches };
|
|
32
|
-
}
|
|
33
|
-
/**
|
|
34
|
-
* Remove a marked entry only when ownership says its process is gone or reused.
|
|
35
|
-
* @param authority - Pinned namespace authority
|
|
36
|
-
* @param name - Direct child basename
|
|
37
|
-
* @param root - Direct child path
|
|
38
|
-
* @param quarantine - Whether the child is an interrupted quarantine
|
|
39
|
-
* @param options - Process probes and self name
|
|
40
|
-
* @returns Removal disposition
|
|
41
|
-
*/
|
|
42
|
-
function sweepMarkedEntry(authority, name, root, quarantine, options) {
|
|
43
|
-
const marked = ownerMatchesPath(authority, root, quarantine);
|
|
44
|
-
if (!marked.matches)
|
|
45
|
-
return "kept";
|
|
46
|
-
const disposition = classifyScratchOwner(marked.owner, options);
|
|
47
|
-
if (disposition === "preserve")
|
|
48
|
-
return "kept";
|
|
49
|
-
removeAuthorizedScratchRoot({
|
|
50
|
-
authority,
|
|
51
|
-
basename: name,
|
|
52
|
-
expectedToken: marked.owner.token,
|
|
53
|
-
});
|
|
54
|
-
return "removed";
|
|
55
|
-
}
|
|
56
|
-
/**
|
|
57
|
-
* Judge one direct namespace entry without ever following a symlink.
|
|
58
|
-
* @param authority - Pinned namespace authority
|
|
59
|
-
* @param name - Direct child basename
|
|
60
|
-
* @param options - Process probes and self name
|
|
61
|
-
* @returns Removal disposition
|
|
62
|
-
*/
|
|
63
|
-
function sweepAuthorizedEntry(authority, name, options) {
|
|
64
|
-
if (name === options.selfName)
|
|
65
|
-
return "kept";
|
|
66
|
-
const root = path.join(authority.namespace.canonicalPath, name);
|
|
67
|
-
try {
|
|
68
|
-
const stat = fs.lstatSync(root);
|
|
69
|
-
if (stat.isSymbolicLink() || !stat.isDirectory())
|
|
70
|
-
return "kept";
|
|
71
|
-
}
|
|
72
|
-
catch (error) {
|
|
73
|
-
return error.code === "ENOENT"
|
|
74
|
-
? "removed"
|
|
75
|
-
: "kept";
|
|
76
|
-
}
|
|
77
|
-
const quarantine = name.startsWith(SCRATCH_QUARANTINE_PREFIX);
|
|
78
|
-
const recognized = /^run-\d+-\d+-[^/\\]+$/u.test(name);
|
|
79
|
-
if (!recognized && !quarantine)
|
|
80
|
-
return "kept";
|
|
81
|
-
try {
|
|
82
|
-
return sweepMarkedEntry(authority, name, root, quarantine, options);
|
|
83
|
-
}
|
|
84
|
-
catch {
|
|
85
|
-
// A recognizable name is never deletion authority. Missing, malformed,
|
|
86
|
-
// unreadable, oversized, or identity-mismatched markers remain in place
|
|
87
|
-
// for the namespace audit to refuse with an actionable diagnosis.
|
|
88
|
-
return "kept";
|
|
89
|
-
}
|
|
90
|
-
}
|
|
91
|
-
/**
|
|
92
|
-
* Sweep one canonical namespace using durable owner/process-birth authority.
|
|
93
|
-
* @param options - Namespace and process probes
|
|
94
|
-
* @returns Names removed and preserved
|
|
95
|
-
*/
|
|
96
|
-
export function sweepAuthorizedScratchNamespace(options) {
|
|
97
|
-
const authority = authorityForExistingScratchNamespace();
|
|
98
|
-
if (authority === undefined)
|
|
99
|
-
return { removed: [], kept: [] };
|
|
100
|
-
return readBoundedScratchNamespace(authority.namespace.canonicalPath).reduce((result, name) => sweepAuthorizedEntry(authority, name, options) === "removed"
|
|
101
|
-
? { removed: [...result.removed, name], kept: result.kept }
|
|
102
|
-
: { removed: result.removed, kept: [...result.kept, name] }, { removed: [], kept: [] });
|
|
103
|
-
}
|
|
104
|
-
export { BOUND_DIRECTORY_CLEANUP_PROGRAM, removeAuthorizedScratchChild, removeAuthorizedScratchChildren, } from "./scratch-bound-cleanup.js";
|
|
105
|
-
export { removeAuthorizedScratchRoot };
|
|
106
|
-
export { DEFAULT_RECLAIM_AGE_MS, MAX_SCRATCH_NAMESPACE_NAME_BYTES, MAX_SCRATCH_NAMESPACE_SCAN_ENTRIES, RUN_ROOT_PREFIX, SCRATCH_DIRECT_ENTRY_LIMIT, SCRATCH_DIRECT_NAME_BYTES, SCRATCH_QUARANTINE_PREFIX, SCRATCH_NAMESPACE, assertScratchNamespaceAuthority, collectBoundedScratchNames, collectBoundedScratchNamespaceNames, createScratchNamespaceAuthority, parseRunRootName, readBoundedScratchNames, readBoundedScratchNamespace, runRootName, scratchBaseDir, scratchNamespaceDir, } from "./scratch-namespace-authority.js";
|
|
107
|
-
//# sourceMappingURL=scratch-authority.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"scratch-authority.js","sourceRoot":"","sources":["../../../src/configs/vitest/scratch-authority.ts"],"names":[],"m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,cAAc,EACd,mBAAmB,GACpB,MAAM,kCAAkC,CAAC"}
|
|
@@ -1,5 +0,0 @@
|
|
|
1
|
-
/** Synchronous deletion program whose cwd is bound before traversal. */
|
|
2
|
-
export declare const BOUND_DIRECTORY_CLEANUP_PROGRAM: string;
|
|
3
|
-
/** Parent-cwd-bound program removing every preclassified direct child. */
|
|
4
|
-
export declare const BOUND_CHILDREN_CLEANUP_PROGRAM: string;
|
|
5
|
-
//# sourceMappingURL=scratch-bound-cleanup-programs.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"scratch-bound-cleanup-programs.d.ts","sourceRoot":"","sources":["../../../src/configs/vitest/scratch-bound-cleanup-programs.ts"],"names":[],"mappings":"AAIA,wEAAwE;AACxE,eAAO,MAAM,+BAA+B,QAuE3C,CAAC;AAEF,0EAA0E;AAC1E,eAAO,MAAM,8BAA8B,QA4I1C,CAAC"}
|
|
@@ -1,219 +0,0 @@
|
|
|
1
|
-
/** Inert CommonJS programs executed in kernel-bound scratch cwd handles. */
|
|
2
|
-
/** Exit status used when the child cwd does not match the expected inode. */
|
|
3
|
-
const BOUND_CLEANUP_IDENTITY_EXIT = 73;
|
|
4
|
-
/** Synchronous deletion program whose cwd is bound before traversal. */
|
|
5
|
-
export const BOUND_DIRECTORY_CLEANUP_PROGRAM = String.raw `
|
|
6
|
-
const fs = require("node:fs");
|
|
7
|
-
const path = require("node:path");
|
|
8
|
-
const expectedDev = process.argv[1];
|
|
9
|
-
const expectedIno = process.argv[2];
|
|
10
|
-
const root = fs.lstatSync(".");
|
|
11
|
-
if (!root.isDirectory() || root.isSymbolicLink() || String(root.dev) !== expectedDev || String(root.ino) !== expectedIno) {
|
|
12
|
-
process.stderr.write("scratch directory identity changed before bound cleanup\n");
|
|
13
|
-
process.exit(${String(BOUND_CLEANUP_IDENTITY_EXIT)});
|
|
14
|
-
}
|
|
15
|
-
const deadline = Date.now() + 30000;
|
|
16
|
-
let entries = 0;
|
|
17
|
-
const readChildren = candidate => {
|
|
18
|
-
const handle = fs.opendirSync(candidate);
|
|
19
|
-
const names = [];
|
|
20
|
-
try {
|
|
21
|
-
for (;;) {
|
|
22
|
-
const entry = handle.readSync();
|
|
23
|
-
if (entry === null) break;
|
|
24
|
-
if (Buffer.byteLength(entry.name, "utf8") > 1024) throw new Error("scratch cleanup basename exceeds 1024 bytes");
|
|
25
|
-
entries += 1;
|
|
26
|
-
if (entries > 100000) throw new Error("scratch cleanup entry bound exceeded");
|
|
27
|
-
names.push(entry.name);
|
|
28
|
-
}
|
|
29
|
-
} finally {
|
|
30
|
-
handle.closeSync();
|
|
31
|
-
}
|
|
32
|
-
return names;
|
|
33
|
-
};
|
|
34
|
-
const pending = [{ candidate: ".", depth: 0 }];
|
|
35
|
-
const scanned = [];
|
|
36
|
-
while (pending.length > 0) {
|
|
37
|
-
if (Date.now() > deadline) throw new Error("scratch cleanup time bound exceeded");
|
|
38
|
-
const item = pending.pop();
|
|
39
|
-
if (item.depth > 128) throw new Error("scratch cleanup depth bound exceeded");
|
|
40
|
-
let stat;
|
|
41
|
-
try {
|
|
42
|
-
stat = fs.lstatSync(item.candidate);
|
|
43
|
-
} catch (error) {
|
|
44
|
-
if (error.code === "ENOENT") continue;
|
|
45
|
-
throw error;
|
|
46
|
-
}
|
|
47
|
-
if (item.candidate !== ".") {
|
|
48
|
-
scanned.push({ candidate: item.candidate, depth: item.depth, dev: String(stat.dev), ino: String(stat.ino), directory: stat.isDirectory(), symlink: stat.isSymbolicLink() });
|
|
49
|
-
}
|
|
50
|
-
if (stat.isDirectory() && !stat.isSymbolicLink()) {
|
|
51
|
-
for (const child of readChildren(item.candidate)) {
|
|
52
|
-
pending.push({ candidate: path.join(item.candidate, child), depth: item.depth + 1 });
|
|
53
|
-
}
|
|
54
|
-
}
|
|
55
|
-
}
|
|
56
|
-
scanned.sort((left, right) => right.depth - left.depth);
|
|
57
|
-
for (const item of scanned) {
|
|
58
|
-
let stat;
|
|
59
|
-
try {
|
|
60
|
-
stat = fs.lstatSync(item.candidate);
|
|
61
|
-
} catch (error) {
|
|
62
|
-
if (error.code === "ENOENT") continue;
|
|
63
|
-
throw error;
|
|
64
|
-
}
|
|
65
|
-
if (String(stat.dev) !== item.dev || String(stat.ino) !== item.ino || stat.isDirectory() !== item.directory || stat.isSymbolicLink() !== item.symlink) {
|
|
66
|
-
process.stderr.write("scratch entry identity changed before bound cleanup: " + item.candidate + "\n");
|
|
67
|
-
process.exit(${String(BOUND_CLEANUP_IDENTITY_EXIT)});
|
|
68
|
-
}
|
|
69
|
-
try {
|
|
70
|
-
if (item.directory && !item.symlink) fs.rmdirSync(item.candidate);
|
|
71
|
-
else fs.unlinkSync(item.candidate);
|
|
72
|
-
} catch (error) {
|
|
73
|
-
if (error.code !== "ENOENT") throw error;
|
|
74
|
-
}
|
|
75
|
-
}
|
|
76
|
-
`;
|
|
77
|
-
/** Parent-cwd-bound program removing every preclassified direct child. */
|
|
78
|
-
export const BOUND_CHILDREN_CLEANUP_PROGRAM = String.raw `
|
|
79
|
-
const crypto = require("node:crypto");
|
|
80
|
-
const fs = require("node:fs");
|
|
81
|
-
const path = require("node:path");
|
|
82
|
-
const expectedDev = process.argv[1];
|
|
83
|
-
const expectedIno = process.argv[2];
|
|
84
|
-
const parent = fs.lstatSync(".");
|
|
85
|
-
if (!parent.isDirectory() || parent.isSymbolicLink() || String(parent.dev) !== expectedDev || String(parent.ino) !== expectedIno) {
|
|
86
|
-
process.stderr.write("scratch parent identity changed before bound cleanup\n");
|
|
87
|
-
process.exit(${String(BOUND_CLEANUP_IDENTITY_EXIT)});
|
|
88
|
-
}
|
|
89
|
-
const items = JSON.parse(fs.readFileSync(0, "utf8"));
|
|
90
|
-
const deadline = Date.now() + 30000;
|
|
91
|
-
let entries = 0;
|
|
92
|
-
const readChildren = candidate => {
|
|
93
|
-
const handle = fs.opendirSync(candidate);
|
|
94
|
-
const names = [];
|
|
95
|
-
try {
|
|
96
|
-
for (;;) {
|
|
97
|
-
const entry = handle.readSync();
|
|
98
|
-
if (entry === null) break;
|
|
99
|
-
if (Buffer.byteLength(entry.name, "utf8") > 1024) throw new Error("scratch cleanup basename exceeds 1024 bytes");
|
|
100
|
-
entries += 1;
|
|
101
|
-
if (entries > 100000) throw new Error("scratch cleanup entry bound exceeded");
|
|
102
|
-
names.push(entry.name);
|
|
103
|
-
}
|
|
104
|
-
} finally {
|
|
105
|
-
handle.closeSync();
|
|
106
|
-
}
|
|
107
|
-
return names;
|
|
108
|
-
};
|
|
109
|
-
const scanDirectory = rootName => {
|
|
110
|
-
const pending = [{ candidate: rootName, relative: "", depth: 0 }];
|
|
111
|
-
const scanned = [];
|
|
112
|
-
while (pending.length > 0) {
|
|
113
|
-
if (Date.now() > deadline) throw new Error("scratch cleanup time bound exceeded");
|
|
114
|
-
const item = pending.pop();
|
|
115
|
-
if (item.depth > 128) throw new Error("scratch cleanup depth bound exceeded");
|
|
116
|
-
let stat;
|
|
117
|
-
try {
|
|
118
|
-
stat = fs.lstatSync(item.candidate);
|
|
119
|
-
} catch (error) {
|
|
120
|
-
if (error.code === "ENOENT") continue;
|
|
121
|
-
throw error;
|
|
122
|
-
}
|
|
123
|
-
if (item.relative !== "") {
|
|
124
|
-
scanned.push({ relative: item.relative, depth: item.depth, dev: String(stat.dev), ino: String(stat.ino), directory: stat.isDirectory(), symlink: stat.isSymbolicLink() });
|
|
125
|
-
}
|
|
126
|
-
if (stat.isDirectory() && !stat.isSymbolicLink()) {
|
|
127
|
-
for (const child of readChildren(item.candidate)) {
|
|
128
|
-
pending.push({ candidate: path.join(item.candidate, child), relative: item.relative === "" ? child : path.join(item.relative, child), depth: item.depth + 1 });
|
|
129
|
-
}
|
|
130
|
-
}
|
|
131
|
-
}
|
|
132
|
-
return scanned;
|
|
133
|
-
};
|
|
134
|
-
const prepared = [];
|
|
135
|
-
for (const item of items) {
|
|
136
|
-
if (typeof item.basename !== "string" || item.basename === "" || path.basename(item.basename) !== item.basename || Buffer.byteLength(item.basename, "utf8") > 1024) {
|
|
137
|
-
throw new Error("scratch cleanup candidate must be a bounded direct basename");
|
|
138
|
-
}
|
|
139
|
-
let before;
|
|
140
|
-
try {
|
|
141
|
-
before = fs.lstatSync(item.basename);
|
|
142
|
-
} catch (error) {
|
|
143
|
-
if (error.code === "ENOENT") continue;
|
|
144
|
-
throw error;
|
|
145
|
-
}
|
|
146
|
-
if (String(before.dev) !== item.dev || String(before.ino) !== item.ino || before.isDirectory() !== item.directory || before.isSymbolicLink() !== item.symlink) {
|
|
147
|
-
process.stderr.write("scratch child identity changed before bound cleanup: " + item.basename + "\n");
|
|
148
|
-
process.exit(${String(BOUND_CLEANUP_IDENTITY_EXIT)});
|
|
149
|
-
}
|
|
150
|
-
prepared.push({ item });
|
|
151
|
-
}
|
|
152
|
-
for (const preparedItem of prepared) {
|
|
153
|
-
const item = preparedItem.item;
|
|
154
|
-
let before;
|
|
155
|
-
try {
|
|
156
|
-
before = fs.lstatSync(item.basename);
|
|
157
|
-
} catch (error) {
|
|
158
|
-
if (error.code === "ENOENT") continue;
|
|
159
|
-
throw error;
|
|
160
|
-
}
|
|
161
|
-
if (String(before.dev) !== item.dev || String(before.ino) !== item.ino || before.isDirectory() !== item.directory || before.isSymbolicLink() !== item.symlink) {
|
|
162
|
-
process.stderr.write("scratch child identity changed before quarantine: " + item.basename + "\n");
|
|
163
|
-
process.exit(${String(BOUND_CLEANUP_IDENTITY_EXIT)});
|
|
164
|
-
}
|
|
165
|
-
// Deterministic seam for the scan-after-quarantine control, in the shape the
|
|
166
|
-
// rest of this subsystem already uses for protocol faults. It writes only
|
|
167
|
-
// inside a child already authorized for deletion, and only under an explicit
|
|
168
|
-
// environment opt-in, so it cannot fire in a real run.
|
|
169
|
-
if (process.env.LISA_TEST_SCRATCH_CLEANUP_FAULT === "write-before-quarantine" && item.directory && !item.symlink) {
|
|
170
|
-
fs.writeFileSync(path.join(item.basename, "late-writer.txt"), "late");
|
|
171
|
-
}
|
|
172
|
-
const quarantine = ".lisa-child-quarantine-" + crypto.randomBytes(16).toString("hex");
|
|
173
|
-
fs.renameSync(item.basename, quarantine);
|
|
174
|
-
const quarantined = fs.lstatSync(quarantine);
|
|
175
|
-
if (String(quarantined.dev) !== item.dev || String(quarantined.ino) !== item.ino) {
|
|
176
|
-
process.stderr.write("scratch child identity changed during quarantine: " + item.basename + "\n");
|
|
177
|
-
process.exit(${String(BOUND_CLEANUP_IDENTITY_EXIT)});
|
|
178
|
-
}
|
|
179
|
-
if (item.directory && !item.symlink) {
|
|
180
|
-
// Scanned AFTER the quarantine rename, never before it. A pre-rename scan
|
|
181
|
-
// leaves a window in which a writer creates an entry that is therefore
|
|
182
|
-
// absent from the recorded list, never deleted, and left to fail the final
|
|
183
|
-
// rmdirSync with ENOTEMPTY -- so the cleanup that exists to remove a tree
|
|
184
|
-
// leaves the whole quarantined tree behind. After the rename the directory
|
|
185
|
-
// sits at an unguessable name no other writer holds a path to, so what is
|
|
186
|
-
// scanned here is what is there.
|
|
187
|
-
const scanned = scanDirectory(quarantine).sort((left, right) => right.depth - left.depth);
|
|
188
|
-
for (const child of scanned) {
|
|
189
|
-
const candidate = path.join(quarantine, child.relative);
|
|
190
|
-
let stat;
|
|
191
|
-
try {
|
|
192
|
-
stat = fs.lstatSync(candidate);
|
|
193
|
-
} catch (error) {
|
|
194
|
-
if (error.code === "ENOENT") continue;
|
|
195
|
-
throw error;
|
|
196
|
-
}
|
|
197
|
-
if (String(stat.dev) !== child.dev || String(stat.ino) !== child.ino || stat.isDirectory() !== child.directory || stat.isSymbolicLink() !== child.symlink) {
|
|
198
|
-
process.stderr.write("scratch descendant identity changed during bound cleanup: " + item.basename + "\n");
|
|
199
|
-
process.exit(${String(BOUND_CLEANUP_IDENTITY_EXIT)});
|
|
200
|
-
}
|
|
201
|
-
try {
|
|
202
|
-
if (child.directory && !child.symlink) fs.rmdirSync(candidate);
|
|
203
|
-
else fs.unlinkSync(candidate);
|
|
204
|
-
} catch (error) {
|
|
205
|
-
if (error.code !== "ENOENT") throw error;
|
|
206
|
-
}
|
|
207
|
-
}
|
|
208
|
-
const after = fs.lstatSync(quarantine);
|
|
209
|
-
if (String(after.dev) !== item.dev || String(after.ino) !== item.ino) {
|
|
210
|
-
process.stderr.write("scratch child identity changed during bound cleanup: " + item.basename + "\n");
|
|
211
|
-
process.exit(${String(BOUND_CLEANUP_IDENTITY_EXIT)});
|
|
212
|
-
}
|
|
213
|
-
fs.rmdirSync(quarantine);
|
|
214
|
-
} else {
|
|
215
|
-
fs.unlinkSync(quarantine);
|
|
216
|
-
}
|
|
217
|
-
}
|
|
218
|
-
`;
|
|
219
|
-
//# sourceMappingURL=scratch-bound-cleanup-programs.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"scratch-bound-cleanup-programs.js","sourceRoot":"","sources":["../../../src/configs/vitest/scratch-bound-cleanup-programs.ts"],"names":[],"mappings":"AAAA,4EAA4E;AAC5E,6EAA6E;AAC7E,MAAM,2BAA2B,GAAG,EAAE,CAAC;AAEvC,wEAAwE;AACxE,MAAM,CAAC,MAAM,+BAA+B,GAAG,MAAM,CAAC,GAAG,CAAA;;;;;;;;iBAQxC,MAAM,CAAC,2BAA2B,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;mBAsDjC,MAAM,CAAC,2BAA2B,CAAC;;;;;;;;;CASrD,CAAC;AAEF,0EAA0E;AAC1E,MAAM,CAAC,MAAM,8BAA8B,GAAG,MAAM,CAAC,GAAG,CAAA;;;;;;;;;iBASvC,MAAM,CAAC,2BAA2B,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;mBA6DjC,MAAM,CAAC,2BAA2B,CAAC;;;;;;;;;;;;;;;mBAenC,MAAM,CAAC,2BAA2B,CAAC;;;;;;;;;;;;;;mBAcnC,MAAM,CAAC,2BAA2B,CAAC;;;;;;;;;;;;;;;;;;;;;;uBAsB/B,MAAM,CAAC,2BAA2B,CAAC;;;;;;;;;;;;qBAYrC,MAAM,CAAC,2BAA2B,CAAC;;;;;;;CAOvD,CAAC"}
|
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
import { type ScratchPathIdentity } from "./scratch-owner.js";
|
|
2
|
-
export { BOUND_DIRECTORY_CLEANUP_PROGRAM } from "./scratch-bound-cleanup-programs.js";
|
|
3
|
-
/** Options for removing one direct child of an already-owned run root. */
|
|
4
|
-
export interface RemoveAuthorizedScratchChildOptions {
|
|
5
|
-
readonly parent: ScratchPathIdentity;
|
|
6
|
-
readonly basename: string;
|
|
7
|
-
readonly beforeIdentityCheck?: (candidate: string) => void;
|
|
8
|
-
readonly afterIdentityCheck?: (candidate: string) => void;
|
|
9
|
-
}
|
|
10
|
-
/** Options for one batched removal under an already-owned run root. */
|
|
11
|
-
export interface RemoveAuthorizedScratchChildrenOptions {
|
|
12
|
-
readonly parent: ScratchPathIdentity;
|
|
13
|
-
readonly basenames: readonly string[];
|
|
14
|
-
readonly beforeIdentityCheck?: (candidate: string) => void;
|
|
15
|
-
readonly afterIdentityCheck?: (candidate: string) => void;
|
|
16
|
-
readonly beforeBoundCleanup?: () => void;
|
|
17
|
-
}
|
|
18
|
-
/**
|
|
19
|
-
* Remove direct children through one process bound to the parent inode.
|
|
20
|
-
* @param options - Batched child-removal options
|
|
21
|
-
*/
|
|
22
|
-
export declare function removeAuthorizedScratchChildren(options: RemoveAuthorizedScratchChildrenOptions): void;
|
|
23
|
-
/**
|
|
24
|
-
* Remove one direct child through the batched authority.
|
|
25
|
-
* @param options - Single child-removal options
|
|
26
|
-
*/
|
|
27
|
-
export declare function removeAuthorizedScratchChild(options: RemoveAuthorizedScratchChildOptions): void;
|
|
28
|
-
//# sourceMappingURL=scratch-bound-cleanup.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"scratch-bound-cleanup.d.ts","sourceRoot":"","sources":["../../../src/configs/vitest/scratch-bound-cleanup.ts"],"names":[],"mappings":"AAKA,OAAO,EAEL,KAAK,mBAAmB,EACzB,MAAM,oBAAoB,CAAC;AAG5B,OAAO,EAAE,+BAA+B,EAAE,MAAM,qCAAqC,CAAC;AAEtF,0EAA0E;AAC1E,MAAM,WAAW,mCAAmC;IAClD,QAAQ,CAAC,MAAM,EAAE,mBAAmB,CAAC;IACrC,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAC;IAC1B,QAAQ,CAAC,mBAAmB,CAAC,EAAE,CAAC,SAAS,EAAE,MAAM,KAAK,IAAI,CAAC;IAC3D,QAAQ,CAAC,kBAAkB,CAAC,EAAE,CAAC,SAAS,EAAE,MAAM,KAAK,IAAI,CAAC;CAC3D;AAED,uEAAuE;AACvE,MAAM,WAAW,sCAAsC;IACrD,QAAQ,CAAC,MAAM,EAAE,mBAAmB,CAAC;IACrC,QAAQ,CAAC,SAAS,EAAE,SAAS,MAAM,EAAE,CAAC;IACtC,QAAQ,CAAC,mBAAmB,CAAC,EAAE,CAAC,SAAS,EAAE,MAAM,KAAK,IAAI,CAAC;IAC3D,QAAQ,CAAC,kBAAkB,CAAC,EAAE,CAAC,SAAS,EAAE,MAAM,KAAK,IAAI,CAAC;IAC1D,QAAQ,CAAC,kBAAkB,CAAC,EAAE,MAAM,IAAI,CAAC;CAC1C;AA+HD;;;GAGG;AACH,wBAAgB,+BAA+B,CAC7C,OAAO,EAAE,sCAAsC,GAC9C,IAAI,CAwBN;AAED;;;GAGG;AACH,wBAAgB,4BAA4B,CAC1C,OAAO,EAAE,mCAAmC,GAC3C,IAAI,CAWN"}
|