@codyswann/lisa 5.3.2 → 5.5.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-contract.mjs +13 -3
- package/all/copy-overwrite/scripts/lib/automation-provenance-local.mjs +22 -1
- 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/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-bun.mjs +39 -14
- package/all/copy-overwrite/scripts/lib/npm-update-controller-broker.mjs +1 -1
- package/all/copy-overwrite/scripts/lib/npm-update-gate-hooks.mjs +2 -1
- package/all/copy-overwrite/scripts/lib/npm-update-helper-inventory.mjs +8 -1
- package/all/copy-overwrite/scripts/lib/npm-update-hosted-gate.mjs +25 -9
- package/all/copy-overwrite/scripts/lib/npm-update-hosted-hook.mjs +1 -1
- package/all/copy-overwrite/scripts/lib/npm-update-tool-launcher.mjs +1 -1
- 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-gates.mjs +29 -0
- package/all/copy-overwrite/scripts/lisa-lint-staged-preflight.mjs +10 -1
- 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 +108 -20
- 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 +336 -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 +207 -126
- 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 +12 -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,194 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Vitest Configuration - TMPDIR ancestor-chain trust (refusal)
|
|
3
|
-
*
|
|
4
|
-
* A test run under a `TMPDIR` whose ancestor chain is untrusted produces four
|
|
5
|
-
* failing assertions about enforcement rate-limiting and says nothing about the
|
|
6
|
-
* environment that caused them. Nobody's first hypothesis is "my temp
|
|
7
|
-
* directory's ancestor has the wrong mode bits", so the failure reads as a
|
|
8
|
-
* defect in the rate limiter — measured at four separate investigations, two of
|
|
9
|
-
* which escalated claiming `main` was red (CodySwannGT/lisa#3691).
|
|
10
|
-
*
|
|
11
|
-
* The mechanism is `scripts/lisa-enforcement-fallback.sh`, which walks every
|
|
12
|
-
* ancestor of the resolved `TMPDIR` before it writes its once-per-session
|
|
13
|
-
* marker. When a rung fails the walk the marker is never created, the rate
|
|
14
|
-
* limit stands down, and the notice speaks on every call. THAT STAND-DOWN IS
|
|
15
|
-
* CORRECT — the guard is designed to fail open rather than write into an
|
|
16
|
-
* untrusted state directory, and it should keep doing that. What was missing is
|
|
17
|
-
* anything telling the operator why, which is what this module supplies.
|
|
18
|
-
*
|
|
19
|
-
* The verdict is deliberately a REFUSAL rather than a warning, and it is wired
|
|
20
|
-
* into `globalSetup` rather than `setupFiles` for a measured reason: a throw
|
|
21
|
-
* from a `setupFiles` module fails collection, so the suite reports zero tests
|
|
22
|
-
* and the gate goes red having evaluated nothing — a result that looks like a
|
|
23
|
-
* verdict and is not one. Installing that failure to fix a failure that names
|
|
24
|
-
* nothing would reproduce the defect one level up. `scratch-global-setup`
|
|
25
|
-
* already refuses from `setup`, where vitest honours the throw and exits 1.
|
|
26
|
-
*
|
|
27
|
-
* The predicate below is a second expression of the shell's arithmetic, which
|
|
28
|
-
* is a real risk: two copies can drift, and the copy that decides behaviour is
|
|
29
|
-
* the shell's. That risk is priced by a case in
|
|
30
|
-
* `tests/unit/config/scratch-tmpdir-trust.test.ts` asserting the two agree on a
|
|
31
|
-
* table of representative roots, real directories rather than fabricated modes.
|
|
32
|
-
* Sharing the shell predicate directly was rejected: that script is the
|
|
33
|
-
* PreToolUse dispatcher that runs on EVERY tool call and consumes stdin, so a
|
|
34
|
-
* probe mode would put a test-serving branch on the hottest path in the repo.
|
|
35
|
-
* @see {@link module:configs/vitest/scratch-global-setup} for the refusal path
|
|
36
|
-
* @module configs/vitest/scratch-tmpdir-trust
|
|
37
|
-
*/
|
|
38
|
-
import { realpathSync, statSync } from "node:fs";
|
|
39
|
-
import { tmpdir } from "node:os";
|
|
40
|
-
import * as path from "node:path";
|
|
41
|
-
import { getuid, platform } from "node:process";
|
|
42
|
-
/** Permission, setuid/setgid and sticky bits of `st_mode`. */
|
|
43
|
-
const PERMISSION_BITS = 0o7777;
|
|
44
|
-
/** Write access granted to group or to other. */
|
|
45
|
-
const SHARED_WRITE_BITS = 0o022;
|
|
46
|
-
/**
|
|
47
|
-
* The sticky bit.
|
|
48
|
-
*
|
|
49
|
-
* It is what makes a shared, world-writable temp root safe to hold per-user
|
|
50
|
-
* state: another uid can still CREATE a name there, but cannot unlink or rename
|
|
51
|
-
* one that is not theirs. That is the whole basis on which `/tmp` is trusted.
|
|
52
|
-
*/
|
|
53
|
-
const STICKY_BIT = 0o1000;
|
|
54
|
-
/**
|
|
55
|
-
* Render a mode the way `ls` and `chmod` spell it, so it can be compared.
|
|
56
|
-
* @param mode - Permission bits
|
|
57
|
-
* @returns Four-digit octal string
|
|
58
|
-
*/
|
|
59
|
-
export const octalMode = (mode) => mode.toString(8).padStart(4, "0");
|
|
60
|
-
/**
|
|
61
|
-
* Every ancestor of an absolute path, root first and the path itself last.
|
|
62
|
-
* @param target - Absolute, symlink-resolved path
|
|
63
|
-
* @returns The chain to walk, in the order the shell walks it
|
|
64
|
-
*/
|
|
65
|
-
export const ancestorChain = (target) => target
|
|
66
|
-
.split(path.sep)
|
|
67
|
-
.filter(segment => segment !== "")
|
|
68
|
-
.reduce((chain, segment) => [
|
|
69
|
-
...chain,
|
|
70
|
-
path.join(chain[chain.length - 1] ?? path.sep, segment),
|
|
71
|
-
], [path.sep]);
|
|
72
|
-
/**
|
|
73
|
-
* Why one directory is untrusted, or `undefined` when it is trusted.
|
|
74
|
-
*
|
|
75
|
-
* Ownership is checked as "root or me" rather than "mine". A valid chain is
|
|
76
|
-
* MOSTLY root-owned — on macOS four of the six rungs above the per-user temp
|
|
77
|
-
* root are uid 0 — so a check written as "is this mine?" would reject every
|
|
78
|
-
* valid root on the machine. The discriminating property is the MODE.
|
|
79
|
-
* @param uid - Owning uid of the directory
|
|
80
|
-
* @param mode - Its permission, setuid/setgid and sticky bits
|
|
81
|
-
* @param self - The current uid
|
|
82
|
-
* @returns The failing property, or undefined
|
|
83
|
-
*/
|
|
84
|
-
const untrustReason = (uid, mode, self) => {
|
|
85
|
-
if (uid !== 0 && uid !== self) {
|
|
86
|
-
return (`owned by uid ${String(uid)}, which is neither root nor you ` +
|
|
87
|
-
`(uid ${String(self)}), so its owner can replace it underneath you`);
|
|
88
|
-
}
|
|
89
|
-
if ((mode & SHARED_WRITE_BITS) !== 0 && (mode & STICKY_BIT) === 0) {
|
|
90
|
-
return (`mode ${octalMode(mode)} grants write access to group or other ` +
|
|
91
|
-
`WITHOUT the sticky bit, so any user can replace entries in it`);
|
|
92
|
-
}
|
|
93
|
-
return undefined;
|
|
94
|
-
};
|
|
95
|
-
/**
|
|
96
|
-
* The first rung of a chain that fails the trust test.
|
|
97
|
-
*
|
|
98
|
-
* A rung that cannot be inspected at all counts as untrusted, matching the
|
|
99
|
-
* shell, whose `stat` failure returns the same verdict as a bad mode.
|
|
100
|
-
* @param target - Absolute, symlink-resolved path to walk
|
|
101
|
-
* @param self - The current uid
|
|
102
|
-
* @returns The first failing rung, or undefined when every rung passes
|
|
103
|
-
*/
|
|
104
|
-
const firstUntrustedRung = (target, self) => ancestorChain(target).reduce((found, directory) => {
|
|
105
|
-
if (found !== undefined)
|
|
106
|
-
return found;
|
|
107
|
-
try {
|
|
108
|
-
const stat = statSync(directory);
|
|
109
|
-
const mode = stat.mode & PERMISSION_BITS;
|
|
110
|
-
const reason = untrustReason(stat.uid, mode, self);
|
|
111
|
-
return reason === undefined
|
|
112
|
-
? undefined
|
|
113
|
-
: { directory, uid: stat.uid, mode, reason };
|
|
114
|
-
}
|
|
115
|
-
catch (error) {
|
|
116
|
-
return {
|
|
117
|
-
directory,
|
|
118
|
-
uid: -1,
|
|
119
|
-
mode: 0,
|
|
120
|
-
reason: `could not be inspected: ${error instanceof Error ? error.message : String(error)}`,
|
|
121
|
-
};
|
|
122
|
-
}
|
|
123
|
-
}, undefined);
|
|
124
|
-
/**
|
|
125
|
-
* The first untrusted ancestor of a path, if any.
|
|
126
|
-
*
|
|
127
|
-
* Platforms without uid ownership have nothing to check and are never refused.
|
|
128
|
-
* @param target - Absolute, symlink-resolved path to walk
|
|
129
|
-
* @returns The first failing rung, or undefined
|
|
130
|
-
*/
|
|
131
|
-
export const findUntrustedAncestor = (target) => {
|
|
132
|
-
const self = getuid?.();
|
|
133
|
-
return self === undefined ? undefined : firstUntrustedRung(target, self);
|
|
134
|
-
};
|
|
135
|
-
/**
|
|
136
|
-
* The remedy lines, spelled for the platform the operator is actually on.
|
|
137
|
-
*
|
|
138
|
-
* A remedy that cannot be followed is worse than none: it reads as the guard
|
|
139
|
-
* being wrong rather than the environment being wrong, and the available move
|
|
140
|
-
* then is to route around the guard.
|
|
141
|
-
* @returns Shell lines that produce a trusted TMPDIR
|
|
142
|
-
*/
|
|
143
|
-
const remedyLines = () => platform === "darwin"
|
|
144
|
-
? [
|
|
145
|
-
' root="$(getconf DARWIN_USER_TEMP_DIR)"',
|
|
146
|
-
' mkdir -p "${root}lisa" && export TMPDIR="${root}lisa"',
|
|
147
|
-
]
|
|
148
|
-
: [
|
|
149
|
-
' root="${XDG_RUNTIME_DIR:-/tmp}/lisa-$(id -u)"',
|
|
150
|
-
' mkdir -p "$root" && export TMPDIR="$root"',
|
|
151
|
-
];
|
|
152
|
-
/**
|
|
153
|
-
* The refusal text: what was rejected, which rung rejected it, and the fix.
|
|
154
|
-
* @param resolved - The symlink-resolved TMPDIR that was walked
|
|
155
|
-
* @param ancestor - The rung that failed
|
|
156
|
-
* @returns Operator-readable failure text
|
|
157
|
-
*/
|
|
158
|
-
export const describeUntrustedTmpdir = (resolved, ancestor) => [
|
|
159
|
-
"Lisa test scratch requires a TMPDIR whose ancestor chain is trusted.",
|
|
160
|
-
"",
|
|
161
|
-
` TMPDIR resolves to ${resolved}`,
|
|
162
|
-
` rejected at ${ancestor.directory}`,
|
|
163
|
-
` uid ${String(ancestor.uid)}, mode ${octalMode(ancestor.mode)}`,
|
|
164
|
-
` ${ancestor.reason}`,
|
|
165
|
-
"",
|
|
166
|
-
"A directory is trusted when it is owned by root or by you AND is not",
|
|
167
|
-
"group- or world-writable unless it carries the sticky bit.",
|
|
168
|
-
"",
|
|
169
|
-
"This is the same chain scripts/lisa-enforcement-fallback.sh walks before",
|
|
170
|
-
"it writes per-session state. A TMPDIR refused here would silently stand",
|
|
171
|
-
"that rate limit down instead, which surfaces as four assertion failures",
|
|
172
|
-
"in tests/unit/hooks/enforcement-fallback-notice-rate.test.ts that read as",
|
|
173
|
-
"defects in the rate limiter and say nothing about your environment. That",
|
|
174
|
-
"is the failure this refusal replaces (CodySwannGT/lisa#3691).",
|
|
175
|
-
"",
|
|
176
|
-
"Point TMPDIR at a directory of your own instead:",
|
|
177
|
-
...remedyLines(),
|
|
178
|
-
].join("\n");
|
|
179
|
-
/**
|
|
180
|
-
* Why this run's TMPDIR must be refused, or `undefined` when it is trusted.
|
|
181
|
-
*
|
|
182
|
-
* Read through `realpathSync` because the shell resolves with `cd -P` before it
|
|
183
|
-
* walks: the chain that matters is the physical one, and a symlinked TMPDIR
|
|
184
|
-
* whose logical spelling looks fine can resolve onto a rung that is not.
|
|
185
|
-
* @returns Refusal text, or undefined when the chain is trusted
|
|
186
|
-
*/
|
|
187
|
-
export const describeTmpdirTrustFailure = () => {
|
|
188
|
-
const resolved = realpathSync(tmpdir());
|
|
189
|
-
const ancestor = findUntrustedAncestor(resolved);
|
|
190
|
-
return ancestor === undefined
|
|
191
|
-
? undefined
|
|
192
|
-
: describeUntrustedTmpdir(resolved, ancestor);
|
|
193
|
-
};
|
|
194
|
-
//# sourceMappingURL=scratch-tmpdir-trust.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"scratch-tmpdir-trust.js","sourceRoot":"","sources":["../../../src/configs/vitest/scratch-tmpdir-trust.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAoCG;AACH,OAAO,EAAE,YAAY,EAAE,QAAQ,EAAE,MAAM,SAAS,CAAC;AACjD,OAAO,EAAE,MAAM,EAAE,MAAM,SAAS,CAAC;AACjC,OAAO,KAAK,IAAI,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* Remove a non-authoritative fixture directory on a best-effort basis.
|
|
3
|
-
*
|
|
4
|
-
* Owned run-root teardown must use `removeOwnedScratchRunRoot`; this helper is
|
|
5
|
-
* retained only for nested fixture compatibility, where the next bounded sweep
|
|
6
|
-
* can recover residue.
|
|
7
|
-
* @param dir - Nested fixture directory to remove
|
|
8
|
-
*/
|
|
9
|
-
export declare const removeScratchDir: (dir: string) => void;
|
|
10
|
-
export { DEFAULT_RECLAIM_AGE_MS, RUN_ROOT_PREFIX, SCRATCH_NAMESPACE, parseRunRootName, runRootName, scratchBaseDir, scratchNamespaceDir, } from "./scratch-authority.js";
|
|
11
|
-
export { SCRATCH_PREFIXES_ENV, SCRATCH_SUITE_ENV, } from "./scratch-route-profile.js";
|
|
12
|
-
export { registeredScratchPrefixes, scratchSuiteLabel, } from "./scratch-route-profile.js";
|
|
13
|
-
export { isProcessAlive, isReclaimable, isStaleForeignEntry, liveOwnerBirthProbe, readNamespaceEntries, sweepScratchNamespace, } from "./scratch-sweep.js";
|
|
14
|
-
export type { ReclaimDecisionInput, SweepOptions, SweepResult, } from "./scratch-sweep.js";
|
|
15
|
-
export { materializeOwnedScratchRunRoot, openOwnedScratchRunRoot, prepareOwnedScratchRunRoot, } from "./scratch-run-root-intent.js";
|
|
16
|
-
export type { OwnedScratchRunRoot, ScratchRunRootIntentV1, } from "./scratch-run-root-intent.js";
|
|
17
|
-
export { adoptOwnedScratchRunRoot, createRunRoot, reclaimAndCreateOwnedRunRoot, reclaimAndCreateRunRoot, } from "./scratch-run-root-compatibility.js";
|
|
18
|
-
export { removeOwnedScratchRunRoot } from "./scratch-run-root-intent.js";
|
|
19
|
-
//# sourceMappingURL=scratch.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"scratch.d.ts","sourceRoot":"","sources":["../../../src/configs/vitest/scratch.ts"],"names":[],"mappings":"AAWA;;;;;;;GAOG;AACH,eAAO,MAAM,gBAAgB,GAAI,KAAK,MAAM,KAAG,IAM9C,CAAC;AAEF,OAAO,EACL,sBAAsB,EACtB,eAAe,EACf,iBAAiB,EACjB,gBAAgB,EAChB,WAAW,EACX,cAAc,EACd,mBAAmB,GACpB,MAAM,wBAAwB,CAAC;AAEhC,OAAO,EACL,oBAAoB,EACpB,iBAAiB,GAClB,MAAM,4BAA4B,CAAC;AAEpC,OAAO,EACL,yBAAyB,EACzB,iBAAiB,GAClB,MAAM,4BAA4B,CAAC;AAEpC,OAAO,EACL,cAAc,EACd,aAAa,EACb,mBAAmB,EACnB,mBAAmB,EACnB,oBAAoB,EACpB,qBAAqB,GACtB,MAAM,oBAAoB,CAAC;AAE5B,YAAY,EACV,oBAAoB,EACpB,YAAY,EACZ,WAAW,GACZ,MAAM,oBAAoB,CAAC;AAE5B,OAAO,EACL,8BAA8B,EAC9B,uBAAuB,EACvB,0BAA0B,GAC3B,MAAM,8BAA8B,CAAC;AAEtC,YAAY,EACV,mBAAmB,EACnB,sBAAsB,GACvB,MAAM,8BAA8B,CAAC;AAEtC,OAAO,EACL,wBAAwB,EACxB,aAAa,EACb,4BAA4B,EAC5B,uBAAuB,GACxB,MAAM,qCAAqC,CAAC;AAE7C,OAAO,EAAE,yBAAyB,EAAE,MAAM,8BAA8B,CAAC"}
|
|
@@ -1,34 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Bounded, self-reclaiming Vitest scratch lifecycle.
|
|
3
|
-
*
|
|
4
|
-
* Every fixture directory lives under one platform-temp namespace and one
|
|
5
|
-
* per-process owned root. The public facade stays deliberately small: naming,
|
|
6
|
-
* authority, startup sweeping, transactional allocation, and token-bound
|
|
7
|
-
* teardown live in focused sibling modules.
|
|
8
|
-
* @module configs/vitest/scratch
|
|
9
|
-
*/
|
|
10
|
-
import * as fs from "node:fs";
|
|
11
|
-
/**
|
|
12
|
-
* Remove a non-authoritative fixture directory on a best-effort basis.
|
|
13
|
-
*
|
|
14
|
-
* Owned run-root teardown must use `removeOwnedScratchRunRoot`; this helper is
|
|
15
|
-
* retained only for nested fixture compatibility, where the next bounded sweep
|
|
16
|
-
* can recover residue.
|
|
17
|
-
* @param dir - Nested fixture directory to remove
|
|
18
|
-
*/
|
|
19
|
-
export const removeScratchDir = (dir) => {
|
|
20
|
-
try {
|
|
21
|
-
fs.rmSync(dir, { recursive: true, force: true });
|
|
22
|
-
}
|
|
23
|
-
catch {
|
|
24
|
-
// The next owned-root teardown or startup sweep recovers nested residue.
|
|
25
|
-
}
|
|
26
|
-
};
|
|
27
|
-
export { DEFAULT_RECLAIM_AGE_MS, RUN_ROOT_PREFIX, SCRATCH_NAMESPACE, parseRunRootName, runRootName, scratchBaseDir, scratchNamespaceDir, } from "./scratch-authority.js";
|
|
28
|
-
export { SCRATCH_PREFIXES_ENV, SCRATCH_SUITE_ENV, } from "./scratch-route-profile.js";
|
|
29
|
-
export { registeredScratchPrefixes, scratchSuiteLabel, } from "./scratch-route-profile.js";
|
|
30
|
-
export { isProcessAlive, isReclaimable, isStaleForeignEntry, liveOwnerBirthProbe, readNamespaceEntries, sweepScratchNamespace, } from "./scratch-sweep.js";
|
|
31
|
-
export { materializeOwnedScratchRunRoot, openOwnedScratchRunRoot, prepareOwnedScratchRunRoot, } from "./scratch-run-root-intent.js";
|
|
32
|
-
export { adoptOwnedScratchRunRoot, createRunRoot, reclaimAndCreateOwnedRunRoot, reclaimAndCreateRunRoot, } from "./scratch-run-root-compatibility.js";
|
|
33
|
-
export { removeOwnedScratchRunRoot } from "./scratch-run-root-intent.js";
|
|
34
|
-
//# sourceMappingURL=scratch.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"scratch.js","sourceRoot":"","sources":["../../../src/configs/vitest/scratch.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AACH,OAAO,KAAK,EAAE,MAAM,SAAS,CAAC;AAE9B;;;;;;;GAOG;AACH,MAAM,CAAC,MAAM,gBAAgB,GAAG,CAAC,GAAW,EAAQ,EAAE;IACpD,IAAI,CAAC;QACH,EAAE,CAAC,MAAM,CAAC,GAAG,EAAE,EAAE,SAAS,EAAE,IAAI,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC,CAAC;IACnD,CAAC;IAAC,MAAM,CAAC;QACP,yEAAyE;IAC3E,CAAC;AACH,CAAC,CAAC;AAEF,OAAO,EACL,sBAAsB,EACtB,eAAe,EACf,iBAAiB,EACjB,gBAAgB,EAChB,WAAW,EACX,cAAc,EACd,mBAAmB,GACpB,MAAM,wBAAwB,CAAC;AAEhC,OAAO,EACL,oBAAoB,EACpB,iBAAiB,GAClB,MAAM,4BAA4B,CAAC;AAEpC,OAAO,EACL,yBAAyB,EACzB,iBAAiB,GAClB,MAAM,4BAA4B,CAAC;AAEpC,OAAO,EACL,cAAc,EACd,aAAa,EACb,mBAAmB,EACnB,mBAAmB,EACnB,oBAAoB,EACpB,qBAAqB,GACtB,MAAM,oBAAoB,CAAC;AAQ5B,OAAO,EACL,8BAA8B,EAC9B,uBAAuB,EACvB,0BAA0B,GAC3B,MAAM,8BAA8B,CAAC;AAOtC,OAAO,EACL,wBAAwB,EACxB,aAAa,EACb,4BAA4B,EAC5B,uBAAuB,GACxB,MAAM,qCAAqC,CAAC;AAE7C,OAAO,EAAE,yBAAyB,EAAE,MAAM,8BAA8B,CAAC"}
|
|
@@ -1,86 +0,0 @@
|
|
|
1
|
-
/** Prefix CDK uses for a `mkdtemp` cloud-assembly directory. */
|
|
2
|
-
export declare const SYNTHESIS_PREFIX = "cdk.out";
|
|
3
|
-
/** File CDK writes when an assembly completes. */
|
|
4
|
-
export declare const COMPLETION_MANIFEST = "manifest.json";
|
|
5
|
-
/** How long an assembly must be untouched before completion authorizes removal. */
|
|
6
|
-
export declare const DEFAULT_QUIESCENCE_MS: number;
|
|
7
|
-
/** Why one entry was placed in its bucket. */
|
|
8
|
-
export type ReclaimDisposition = "reclaimable" | "live" | "undetermined";
|
|
9
|
-
/** Facts read from one candidate, separated from the judgement about them. */
|
|
10
|
-
export interface SynthesisEntryFacts {
|
|
11
|
-
/** Direct child basename. */
|
|
12
|
-
readonly name: string;
|
|
13
|
-
/** Whether the candidate is a real directory rather than a link or file. */
|
|
14
|
-
readonly directory: boolean;
|
|
15
|
-
/** Whether the candidate's children could be listed. */
|
|
16
|
-
readonly readable: boolean;
|
|
17
|
-
/** Whether the completion manifest is present. */
|
|
18
|
-
readonly complete: boolean;
|
|
19
|
-
/** Milliseconds since the candidate was last modified. */
|
|
20
|
-
readonly ageMs: number;
|
|
21
|
-
}
|
|
22
|
-
/** One entry's bucket, with the reason stated for an operator. */
|
|
23
|
-
export interface SynthesisEntryVerdict {
|
|
24
|
-
/** Direct child basename. */
|
|
25
|
-
readonly name: string;
|
|
26
|
-
/** Bucket this entry falls in. */
|
|
27
|
-
readonly disposition: ReclaimDisposition;
|
|
28
|
-
/** Operator-readable reason, always populated. */
|
|
29
|
-
readonly reason: string;
|
|
30
|
-
}
|
|
31
|
-
/**
|
|
32
|
-
* Judge one candidate from its facts alone.
|
|
33
|
-
*
|
|
34
|
-
* Ordered so the conservative arms win: anything that is not a plain directory,
|
|
35
|
-
* or cannot be read, or was touched recently, is kept before completion is even
|
|
36
|
-
* consulted. Completion is necessary but never sufficient.
|
|
37
|
-
* @param facts - Facts read from the candidate
|
|
38
|
-
* @param quiescenceMs - Required untouched interval
|
|
39
|
-
* @returns The bucket and the reason for it
|
|
40
|
-
*/
|
|
41
|
-
export declare const classifySynthesisEntry: (facts: SynthesisEntryFacts, quiescenceMs?: number) => SynthesisEntryVerdict;
|
|
42
|
-
/**
|
|
43
|
-
* Read the facts for one candidate without ever following a symlink.
|
|
44
|
-
* @param root - Directory holding the candidate
|
|
45
|
-
* @param name - Direct child basename
|
|
46
|
-
* @param now - Clock reading for the age computation
|
|
47
|
-
* @returns Facts describing the candidate
|
|
48
|
-
*/
|
|
49
|
-
export declare const readSynthesisEntryFacts: (root: string, name: string, now: number) => SynthesisEntryFacts;
|
|
50
|
-
/** Inputs for one reclaim pass. */
|
|
51
|
-
export interface ReclaimSynthesisScratchOptions {
|
|
52
|
-
/** Temp root to inspect. */
|
|
53
|
-
readonly root: string;
|
|
54
|
-
/** Clock reading used for every age computation. */
|
|
55
|
-
readonly now?: number;
|
|
56
|
-
/** Required untouched interval before completion authorizes removal. */
|
|
57
|
-
readonly quiescenceMs?: number;
|
|
58
|
-
/** Whether to remove. False reports without touching anything. */
|
|
59
|
-
readonly apply?: boolean;
|
|
60
|
-
/** Adversarial hook invoked after quarantine and before unlink, for tests. */
|
|
61
|
-
readonly afterQuarantine?: (quarantine: string) => void;
|
|
62
|
-
}
|
|
63
|
-
/** What one reclaim pass found and did. */
|
|
64
|
-
export interface ReclaimSynthesisScratchResult {
|
|
65
|
-
/** Whether any candidate matched the expected naming convention. */
|
|
66
|
-
readonly recognised: boolean;
|
|
67
|
-
/** Entries removed, or that would be removed when not applying. */
|
|
68
|
-
readonly reclaimed: readonly SynthesisEntryVerdict[];
|
|
69
|
-
/** Entries kept because they are inside the quiescence window. */
|
|
70
|
-
readonly live: readonly SynthesisEntryVerdict[];
|
|
71
|
-
/** Entries kept because their status could not be established. */
|
|
72
|
-
readonly undetermined: readonly SynthesisEntryVerdict[];
|
|
73
|
-
/** Entries whose removal was attempted and refused by the fence. */
|
|
74
|
-
readonly refused: readonly SynthesisEntryVerdict[];
|
|
75
|
-
}
|
|
76
|
-
/**
|
|
77
|
-
* Reclaim completed, quiescent synthesis assemblies from one temp root.
|
|
78
|
-
*
|
|
79
|
-
* Removes nothing when no candidate matches the convention: a naming change in
|
|
80
|
-
* the producing tool must read as "recognised nothing" rather than as a clean
|
|
81
|
-
* sweep, because the two are opposite facts and only one of them is good news.
|
|
82
|
-
* @param options - Root, clock, thresholds and hooks
|
|
83
|
-
* @returns What was found in each bucket, and what was removed
|
|
84
|
-
*/
|
|
85
|
-
export declare function reclaimSynthesisScratch(options: ReclaimSynthesisScratchOptions): ReclaimSynthesisScratchResult;
|
|
86
|
-
//# sourceMappingURL=synthesis-scratch-reclaim.d.ts.map
|
|
@@ -1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5B,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,oDAAoD;IACpD,QAAQ,CAAC,GAAG,CAAC,EAAE,MAAM,CAAC;IACtB,wEAAwE;IACxE,QAAQ,CAAC,YAAY,CAAC,EAAE,MAAM,CAAC;IAC/B,kEAAkE;IAClE,QAAQ,CAAC,KAAK,CAAC,EAAE,OAAO,CAAC;IACzB,8EAA8E;IAC9E,QAAQ,CAAC,eAAe,CAAC,EAAE,CAAC,UAAU,EAAE,MAAM,KAAK,IAAI,CAAC;CACzD;AAED,2CAA2C;AAC3C,MAAM,WAAW,6BAA6B;IAC5C,oEAAoE;IACpE,QAAQ,CAAC,UAAU,EAAE,OAAO,CAAC;IAC7B,mEAAmE;IACnE,QAAQ,CAAC,SAAS,EAAE,SAAS,qBAAqB,EAAE,CAAC;IACrD,kEAAkE;IAClE,QAAQ,CAAC,IAAI,EAAE,SAAS,qBAAqB,EAAE,CAAC;IAChD,kEAAkE;IAClE,QAAQ,CAAC,YAAY,EAAE,SAAS,qBAAqB,EAAE,CAAC;IACxD,oEAAoE;IACpE,QAAQ,CAAC,OAAO,EAAE,SAAS,qBAAqB,EAAE,CAAC;CACpD;AA2FD;;;;;;;;GAQG;AACH,wBAAgB,uBAAuB,CACrC,OAAO,EAAE,8BAA8B,GACtC,6BAA6B,CA8B/B"}
|
|
@@ -1,226 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Reclaim for abandoned CDK synthesis assemblies left in the platform temp root.
|
|
3
|
-
*
|
|
4
|
-
* The scratch sweep in this directory reclaims what Lisa created, proved by an
|
|
5
|
-
* owner token it wrote itself. Synthesis assemblies carry no such token: CDK
|
|
6
|
-
* calls `mkdtemp` against the platform temp root with prefix `cdk.out`, so the
|
|
7
|
-
* directory is real, unowned, and indistinguishable by name from one a live
|
|
8
|
-
* synthesis is still writing.
|
|
9
|
-
*
|
|
10
|
-
* `isStaleForeignEntry` refuses to authorize a foreign entry on age alone, and
|
|
11
|
-
* that refusal is correct — a long synthesis is indistinguishable from an
|
|
12
|
-
* abandoned one by mtime. This module supplies the authority age cannot:
|
|
13
|
-
* **evidence that the writer finished**. CDK writes `manifest.json` when an
|
|
14
|
-
* assembly completes, so its presence is positive proof that the process which
|
|
15
|
-
* created the directory got to the end of its work. A directory still being
|
|
16
|
-
* written has no manifest, and one that just finished has a recent mtime.
|
|
17
|
-
*
|
|
18
|
-
* Both facts must hold before anything is removed, and every other case is
|
|
19
|
-
* reported as undetermined rather than swept. The unsafe path here is the one
|
|
20
|
-
* that looks like progress: deleting everything matching the prefix finishes
|
|
21
|
-
* fast and frees the disk, right up until it takes a live synthesis with it.
|
|
22
|
-
* @module configs/vitest/synthesis-scratch-reclaim
|
|
23
|
-
*/
|
|
24
|
-
import { randomBytes } from "node:crypto";
|
|
25
|
-
import * as fs from "node:fs";
|
|
26
|
-
import * as path from "node:path";
|
|
27
|
-
/** Prefix CDK uses for a `mkdtemp` cloud-assembly directory. */
|
|
28
|
-
export const SYNTHESIS_PREFIX = "cdk.out";
|
|
29
|
-
/** File CDK writes when an assembly completes. */
|
|
30
|
-
export const COMPLETION_MANIFEST = "manifest.json";
|
|
31
|
-
/** How long an assembly must be untouched before completion authorizes removal. */
|
|
32
|
-
export const DEFAULT_QUIESCENCE_MS = 24 * 60 * 60 * 1000;
|
|
33
|
-
/**
|
|
34
|
-
* Judge one candidate from its facts alone.
|
|
35
|
-
*
|
|
36
|
-
* Ordered so the conservative arms win: anything that is not a plain directory,
|
|
37
|
-
* or cannot be read, or was touched recently, is kept before completion is even
|
|
38
|
-
* consulted. Completion is necessary but never sufficient.
|
|
39
|
-
* @param facts - Facts read from the candidate
|
|
40
|
-
* @param quiescenceMs - Required untouched interval
|
|
41
|
-
* @returns The bucket and the reason for it
|
|
42
|
-
*/
|
|
43
|
-
export const classifySynthesisEntry = (facts, quiescenceMs = DEFAULT_QUIESCENCE_MS) => {
|
|
44
|
-
const { name } = facts;
|
|
45
|
-
const minutes = String(Math.round(facts.ageMs / 60000));
|
|
46
|
-
const hours = String(Math.round(facts.ageMs / 3600000));
|
|
47
|
-
if (!facts.directory)
|
|
48
|
-
return {
|
|
49
|
-
disposition: "undetermined",
|
|
50
|
-
name,
|
|
51
|
-
reason: "not a plain directory; a link or file is never followed",
|
|
52
|
-
};
|
|
53
|
-
if (!facts.readable)
|
|
54
|
-
return {
|
|
55
|
-
disposition: "undetermined",
|
|
56
|
-
name,
|
|
57
|
-
reason: "contents could not be listed, so completion cannot be established",
|
|
58
|
-
};
|
|
59
|
-
if (facts.ageMs < quiescenceMs)
|
|
60
|
-
return {
|
|
61
|
-
disposition: "live",
|
|
62
|
-
name,
|
|
63
|
-
reason: `modified ${minutes} minute(s) ago, inside the quiescence window`,
|
|
64
|
-
};
|
|
65
|
-
if (!facts.complete)
|
|
66
|
-
return {
|
|
67
|
-
disposition: "undetermined",
|
|
68
|
-
name,
|
|
69
|
-
reason: `no ${COMPLETION_MANIFEST}, so the writer is not proven to have finished`,
|
|
70
|
-
};
|
|
71
|
-
return {
|
|
72
|
-
disposition: "reclaimable",
|
|
73
|
-
name,
|
|
74
|
-
reason: `completed assembly, untouched for ${hours} hour(s)`,
|
|
75
|
-
};
|
|
76
|
-
};
|
|
77
|
-
/**
|
|
78
|
-
* Stat a candidate without following it, returning nothing when it is absent.
|
|
79
|
-
* @param candidate - Absolute candidate path
|
|
80
|
-
* @returns Candidate metadata, or undefined
|
|
81
|
-
*/
|
|
82
|
-
const lstatIfPresent = (candidate) => {
|
|
83
|
-
try {
|
|
84
|
-
return fs.lstatSync(candidate);
|
|
85
|
-
}
|
|
86
|
-
catch {
|
|
87
|
-
return undefined;
|
|
88
|
-
}
|
|
89
|
-
};
|
|
90
|
-
/**
|
|
91
|
-
* List a directory's children, returning nothing when it cannot be read.
|
|
92
|
-
* @param candidate - Absolute directory path
|
|
93
|
-
* @returns Direct child names, or undefined
|
|
94
|
-
*/
|
|
95
|
-
const readdirIfPossible = (candidate) => {
|
|
96
|
-
try {
|
|
97
|
-
return fs.readdirSync(candidate);
|
|
98
|
-
}
|
|
99
|
-
catch {
|
|
100
|
-
return undefined;
|
|
101
|
-
}
|
|
102
|
-
};
|
|
103
|
-
/**
|
|
104
|
-
* Read the facts for one candidate without ever following a symlink.
|
|
105
|
-
* @param root - Directory holding the candidate
|
|
106
|
-
* @param name - Direct child basename
|
|
107
|
-
* @param now - Clock reading for the age computation
|
|
108
|
-
* @returns Facts describing the candidate
|
|
109
|
-
*/
|
|
110
|
-
export const readSynthesisEntryFacts = (root, name, now) => {
|
|
111
|
-
const candidate = path.join(root, name);
|
|
112
|
-
const stat = lstatIfPresent(candidate);
|
|
113
|
-
if (stat === undefined || !stat.isDirectory())
|
|
114
|
-
return {
|
|
115
|
-
ageMs: 0,
|
|
116
|
-
complete: false,
|
|
117
|
-
directory: false,
|
|
118
|
-
name,
|
|
119
|
-
readable: false,
|
|
120
|
-
};
|
|
121
|
-
const children = readdirIfPossible(candidate);
|
|
122
|
-
return {
|
|
123
|
-
ageMs: Math.max(0, now - stat.mtimeMs),
|
|
124
|
-
complete: children?.includes(COMPLETION_MANIFEST) ?? false,
|
|
125
|
-
directory: true,
|
|
126
|
-
name,
|
|
127
|
-
readable: children !== undefined,
|
|
128
|
-
};
|
|
129
|
-
};
|
|
130
|
-
/**
|
|
131
|
-
* Revalidate a quarantined candidate against its pre-rename identity.
|
|
132
|
-
*
|
|
133
|
-
* This is the arm that survives a writer racing the decision: a directory
|
|
134
|
-
* swapped for a symlink between the judgement and the unlink fails here rather
|
|
135
|
-
* than being followed out of the root.
|
|
136
|
-
* @param quarantine - Quarantined path
|
|
137
|
-
* @param before - Pinned pre-rename metadata
|
|
138
|
-
* @throws When device, inode or kind changed across the rename
|
|
139
|
-
*/
|
|
140
|
-
const assertIdentityUnchanged = (quarantine, before) => {
|
|
141
|
-
const after = fs.lstatSync(quarantine);
|
|
142
|
-
if (after.dev !== before.dev ||
|
|
143
|
-
after.ino !== before.ino ||
|
|
144
|
-
!after.isDirectory())
|
|
145
|
-
throw new Error("Synthesis assembly identity changed during quarantine");
|
|
146
|
-
};
|
|
147
|
-
/**
|
|
148
|
-
* Quarantine one candidate and unlink it, revalidating identity across the rename.
|
|
149
|
-
* @param root - Directory holding the candidate
|
|
150
|
-
* @param name - Direct child basename
|
|
151
|
-
* @param afterQuarantine - Adversarial hook for tests
|
|
152
|
-
* @returns True when the entry was removed
|
|
153
|
-
*/
|
|
154
|
-
const quarantineAndRemove = (root, name, afterQuarantine) => {
|
|
155
|
-
const candidate = path.join(root, name);
|
|
156
|
-
const before = fs.lstatSync(candidate);
|
|
157
|
-
const suffix = randomBytes(6).toString("hex");
|
|
158
|
-
const quarantine = path.join(root, `.${SYNTHESIS_PREFIX}-reclaim-${String(process.pid)}-${suffix}`);
|
|
159
|
-
if (!before.isDirectory())
|
|
160
|
-
return false;
|
|
161
|
-
fs.renameSync(candidate, quarantine);
|
|
162
|
-
afterQuarantine?.(quarantine);
|
|
163
|
-
assertIdentityUnchanged(quarantine, before);
|
|
164
|
-
fs.rmSync(quarantine, { force: true, recursive: true });
|
|
165
|
-
return true;
|
|
166
|
-
};
|
|
167
|
-
/**
|
|
168
|
-
* Attempt one fenced removal, converting a refusal into a reported outcome.
|
|
169
|
-
* @param options - Root and hooks for this pass
|
|
170
|
-
* @param verdict - The reclaimable verdict to act on
|
|
171
|
-
* @returns Whether it was removed, and the verdict to report
|
|
172
|
-
*/
|
|
173
|
-
const attemptRemoval = (options, verdict) => {
|
|
174
|
-
if (options.apply !== true)
|
|
175
|
-
return { removed: true, verdict };
|
|
176
|
-
try {
|
|
177
|
-
const removed = quarantineAndRemove(options.root, verdict.name, options.afterQuarantine);
|
|
178
|
-
return removed
|
|
179
|
-
? { removed, verdict }
|
|
180
|
-
: {
|
|
181
|
-
removed,
|
|
182
|
-
verdict: { ...verdict, reason: "no longer a plain directory" },
|
|
183
|
-
};
|
|
184
|
-
}
|
|
185
|
-
catch (error) {
|
|
186
|
-
return {
|
|
187
|
-
removed: false,
|
|
188
|
-
verdict: { ...verdict, reason: error.message },
|
|
189
|
-
};
|
|
190
|
-
}
|
|
191
|
-
};
|
|
192
|
-
/**
|
|
193
|
-
* Reclaim completed, quiescent synthesis assemblies from one temp root.
|
|
194
|
-
*
|
|
195
|
-
* Removes nothing when no candidate matches the convention: a naming change in
|
|
196
|
-
* the producing tool must read as "recognised nothing" rather than as a clean
|
|
197
|
-
* sweep, because the two are opposite facts and only one of them is good news.
|
|
198
|
-
* @param options - Root, clock, thresholds and hooks
|
|
199
|
-
* @returns What was found in each bucket, and what was removed
|
|
200
|
-
*/
|
|
201
|
-
export function reclaimSynthesisScratch(options) {
|
|
202
|
-
const now = options.now ?? Date.now();
|
|
203
|
-
const quiescenceMs = options.quiescenceMs ?? DEFAULT_QUIESCENCE_MS;
|
|
204
|
-
const names = (readdirIfPossible(options.root) ?? []).filter(entry => entry.startsWith(SYNTHESIS_PREFIX));
|
|
205
|
-
const empty = {
|
|
206
|
-
live: [],
|
|
207
|
-
reclaimed: [],
|
|
208
|
-
recognised: false,
|
|
209
|
-
refused: [],
|
|
210
|
-
undetermined: [],
|
|
211
|
-
};
|
|
212
|
-
if (names.length === 0)
|
|
213
|
-
return empty;
|
|
214
|
-
const verdicts = names.map(name => classifySynthesisEntry(readSynthesisEntryFacts(options.root, name, now), quiescenceMs));
|
|
215
|
-
const outcomes = verdicts
|
|
216
|
-
.filter(one => one.disposition === "reclaimable")
|
|
217
|
-
.map(verdict => attemptRemoval(options, verdict));
|
|
218
|
-
return {
|
|
219
|
-
live: verdicts.filter(one => one.disposition === "live"),
|
|
220
|
-
reclaimed: outcomes.filter(one => one.removed).map(one => one.verdict),
|
|
221
|
-
recognised: true,
|
|
222
|
-
refused: outcomes.filter(one => !one.removed).map(one => one.verdict),
|
|
223
|
-
undetermined: verdicts.filter(one => one.disposition === "undetermined"),
|
|
224
|
-
};
|
|
225
|
-
}
|
|
226
|
-
//# sourceMappingURL=synthesis-scratch-reclaim.js.map
|
|
@@ -1 +0,0 @@
|
|
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