@codyswann/lisa 5.4.0 → 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-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-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-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 +105 -17
- 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 +318 -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 +197 -123
- 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
|
@@ -0,0 +1,537 @@
|
|
|
1
|
+
// This file is managed by Lisa and IS replaced on each `lisa` run.
|
|
2
|
+
// Do not edit directly — durable changes belong upstream in Lisa.
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* Remember a push gate's pass by the content it proved (CodySwannGT/lisa#4594).
|
|
6
|
+
*
|
|
7
|
+
* A retry, or a re-push of an identical tree, used to pay every push gate
|
|
8
|
+
* again — minutes to hours each — for content that had already passed. A pass
|
|
9
|
+
* is remembered under a key derived from everything its verdict can depend on,
|
|
10
|
+
* and a later run with the SAME key reports `CACHED PASS (<key>)` instead of
|
|
11
|
+
* running the gate.
|
|
12
|
+
*
|
|
13
|
+
* ## The cache must never prove what it did not see
|
|
14
|
+
*
|
|
15
|
+
* Every rule here fails toward running the gate:
|
|
16
|
+
*
|
|
17
|
+
* - The working tree must be exactly the tree being pushed: nothing
|
|
18
|
+
* uncommitted or untracked, and `HEAD^{tree}` equal to the tree of every
|
|
19
|
+
* non-deletion ref in the push. Otherwise a green would describe a different
|
|
20
|
+
* tree than the one pushed (CodySwannGT/lisa#3874).
|
|
21
|
+
* - Only a full PASS is recorded — never a failure, a kill, an unprovable or
|
|
22
|
+
* not-run outcome, or a pass inherited from a shared prover that did not
|
|
23
|
+
* itself pass — and only after the run, once the tree is re-read unchanged.
|
|
24
|
+
* - A gate whose verdict depends on anything outside the key (the tracker,
|
|
25
|
+
* live machine state, history beyond the tree) declares `"cache": false` on
|
|
26
|
+
* its moment entry and always runs.
|
|
27
|
+
* - CI never reads or writes it, and `LISA_GATE_CACHE=off` disables it.
|
|
28
|
+
* - It is off unless `.lisa.config.json` sets `pushGate.cache: true`, so a
|
|
29
|
+
* host behaves exactly as before until its template turns it on.
|
|
30
|
+
*
|
|
31
|
+
* The store is machine-local — one JSON file per passing key under
|
|
32
|
+
* `${XDG_CACHE_HOME:-~/.cache}/lisa/gate-passes/` — shared by every worktree,
|
|
33
|
+
* and pruned of entries older than 30 days whenever it is written.
|
|
34
|
+
*
|
|
35
|
+
* ## The store never holds an environment value
|
|
36
|
+
*
|
|
37
|
+
* `LISA_*` variables enter the key because some of them change a verdict, but
|
|
38
|
+
* that family also carries credentials — `LISA_SECRETS_BOOTSTRAP` and its key
|
|
39
|
+
* hold the secrets-provider bootstrap credential. The key therefore takes one
|
|
40
|
+
* digest of the relevant environment, and a stored record keeps only that
|
|
41
|
+
* digest plus the NAMES of the variables that are not secret-looking. No value
|
|
42
|
+
* is ever written. The directory is created (and re-tightened) 0700 and every
|
|
43
|
+
* entry 0600, so even the names and digests are private to the user, and an
|
|
44
|
+
* entry not written under the current schema is deleted on the next write —
|
|
45
|
+
* an earlier schema stored raw values (CodySwannGT/lisa#4594 review).
|
|
46
|
+
* @module lib/gate-pass-cache
|
|
47
|
+
*/
|
|
48
|
+
import { spawnSync } from "node:child_process";
|
|
49
|
+
import { createHash } from "node:crypto";
|
|
50
|
+
import {
|
|
51
|
+
chmodSync,
|
|
52
|
+
existsSync,
|
|
53
|
+
mkdirSync,
|
|
54
|
+
readdirSync,
|
|
55
|
+
readFileSync,
|
|
56
|
+
renameSync,
|
|
57
|
+
rmSync,
|
|
58
|
+
statSync,
|
|
59
|
+
writeFileSync,
|
|
60
|
+
} from "node:fs";
|
|
61
|
+
import { homedir } from "node:os";
|
|
62
|
+
import { join } from "node:path";
|
|
63
|
+
|
|
64
|
+
/** The environment variable that switches the cache off for one run. */
|
|
65
|
+
export const CACHE_ENV = "LISA_GATE_CACHE";
|
|
66
|
+
|
|
67
|
+
/** The per-moment gate field that opts a gate out of the cache. */
|
|
68
|
+
export const CACHE_FIELD = "cache";
|
|
69
|
+
|
|
70
|
+
/** Version of the key derivation; bumping it invalidates every entry. */
|
|
71
|
+
export const KEY_SCHEMA = "lisa.gate-pass/v2";
|
|
72
|
+
|
|
73
|
+
/**
|
|
74
|
+
* Name fragments that mark a variable as possibly holding a credential. Such a
|
|
75
|
+
* name stays out of every stored record; its value still enters the digest.
|
|
76
|
+
*/
|
|
77
|
+
export const SECRET_NAME_PATTERN =
|
|
78
|
+
/KEY|TOKEN|SECRET|PASSWORD|PASSWD|BOOTSTRAP|CREDENTIAL|AUTH|PRIVATE/i;
|
|
79
|
+
|
|
80
|
+
/** Mode of the store directory: only the user may list or enter it. */
|
|
81
|
+
export const STORE_DIR_MODE = 0o700;
|
|
82
|
+
|
|
83
|
+
/** Mode of every stored entry: only the user may read it. */
|
|
84
|
+
export const STORE_FILE_MODE = 0o600;
|
|
85
|
+
|
|
86
|
+
/** Entries older than this are ignored on read and pruned on write. */
|
|
87
|
+
export const MAX_AGE_MS = 30 * 24 * 60 * 60 * 1000;
|
|
88
|
+
|
|
89
|
+
/** Lockfiles whose bytes enter the key whenever they are present. */
|
|
90
|
+
export const LOCKFILES = Object.freeze([
|
|
91
|
+
"bun.lock",
|
|
92
|
+
"bun.lockb",
|
|
93
|
+
"package-lock.json",
|
|
94
|
+
"yarn.lock",
|
|
95
|
+
"pnpm-lock.yaml",
|
|
96
|
+
"Gemfile.lock",
|
|
97
|
+
]);
|
|
98
|
+
|
|
99
|
+
/** Non-`LISA_*` variables that change how a gate behaves. */
|
|
100
|
+
export const ENV_ALLOWLIST = Object.freeze(["NODE_OPTIONS", "NODE_ENV", "TZ"]);
|
|
101
|
+
|
|
102
|
+
/**
|
|
103
|
+
* `LISA_*` variables left out of the key because they differ on every run
|
|
104
|
+
* without changing a verdict: the switch itself, the hook's temp file of
|
|
105
|
+
* pushed refs, and the cleanup sweep's ownership marker. Left in, each would
|
|
106
|
+
* make every lookup miss.
|
|
107
|
+
*
|
|
108
|
+
* The admission wait bounds are excluded too, by the `LISA_ADMISSION` prefix
|
|
109
|
+
* rule in `relevantEnvironment`: `lisa check` sets `LISA_ADMISSION_MAX_WAIT`
|
|
110
|
+
* so it can wait longer for machine headroom than a push may, and the push
|
|
111
|
+
* that follows does not. A wait bound decides when a gate STARTS, never what
|
|
112
|
+
* it proves, so keying on it would only make the push miss every pass
|
|
113
|
+
* `lisa check` recorded (CodySwannGT/lisa#4601).
|
|
114
|
+
*/
|
|
115
|
+
export const VOLATILE_LISA_ENV = Object.freeze([
|
|
116
|
+
CACHE_ENV,
|
|
117
|
+
"LISA_PUSHED_REFS_FILE",
|
|
118
|
+
"LISA_CLEANUP_SWEPT",
|
|
119
|
+
// The test-run owner marker (`<pid>:0`) a Rails pre-push command exports
|
|
120
|
+
// before its payload (CodySwannGT/lisa#4603, #4613): a new pid every run.
|
|
121
|
+
"LISA_TEST_RUN_OWNER",
|
|
122
|
+
// Headroom admission (CodySwannGT/lisa#4596): a grant and a holder pid
|
|
123
|
+
// describe the machine at that moment, not the content being proved.
|
|
124
|
+
"LISA_ADMITTED_WORKERS",
|
|
125
|
+
"LISA_ADMISSION_HOLDER",
|
|
126
|
+
]);
|
|
127
|
+
|
|
128
|
+
const ZERO_SHA = /^0+$/;
|
|
129
|
+
|
|
130
|
+
/**
|
|
131
|
+
* Read `pushGate.cache` from the project config.
|
|
132
|
+
* @param {object|null|undefined} config Parsed `.lisa.config.json`.
|
|
133
|
+
* @returns {{enabled: boolean, problem: string|null}} Whether the cache is on,
|
|
134
|
+
* and why the declaration was refused when it is malformed.
|
|
135
|
+
*/
|
|
136
|
+
export function cacheSetting(config) {
|
|
137
|
+
const block = config?.pushGate;
|
|
138
|
+
if (block === undefined) return { enabled: false, problem: null };
|
|
139
|
+
if (block === null || typeof block !== "object" || Array.isArray(block)) {
|
|
140
|
+
return {
|
|
141
|
+
enabled: false,
|
|
142
|
+
problem: `pushGate is ${JSON.stringify(block)}; expected an object such as {"cache": true}`,
|
|
143
|
+
};
|
|
144
|
+
}
|
|
145
|
+
if (block.cache === undefined) return { enabled: false, problem: null };
|
|
146
|
+
if (typeof block.cache !== "boolean") {
|
|
147
|
+
return {
|
|
148
|
+
enabled: false,
|
|
149
|
+
problem: `pushGate.cache is ${JSON.stringify(block.cache)}; expected true or false`,
|
|
150
|
+
};
|
|
151
|
+
}
|
|
152
|
+
return { enabled: block.cache, problem: null };
|
|
153
|
+
}
|
|
154
|
+
|
|
155
|
+
/**
|
|
156
|
+
* Where passes are stored.
|
|
157
|
+
* @param {Record<string, string|undefined>} env Process environment.
|
|
158
|
+
* @returns {string} Absolute directory path.
|
|
159
|
+
*/
|
|
160
|
+
export function cacheDirectory(env) {
|
|
161
|
+
const base = env.XDG_CACHE_HOME || join(homedir(), ".cache");
|
|
162
|
+
return join(base, "lisa", "gate-passes");
|
|
163
|
+
}
|
|
164
|
+
|
|
165
|
+
/**
|
|
166
|
+
* The environment variables that enter the key, sorted by name.
|
|
167
|
+
* @param {Record<string, string|undefined>} env Process environment.
|
|
168
|
+
* @returns {Record<string, string>} The allowlisted, defined variables.
|
|
169
|
+
*/
|
|
170
|
+
export function relevantEnvironment(env) {
|
|
171
|
+
const names = Object.keys(env)
|
|
172
|
+
.filter(
|
|
173
|
+
name =>
|
|
174
|
+
ENV_ALLOWLIST.includes(name) ||
|
|
175
|
+
(name.startsWith("LISA_") &&
|
|
176
|
+
!VOLATILE_LISA_ENV.includes(name) &&
|
|
177
|
+
// Every headroom-admission knob (CodySwannGT/lisa#4596) changes
|
|
178
|
+
// only WHEN a step starts, never what it proves.
|
|
179
|
+
!name.startsWith("LISA_ADMISSION"))
|
|
180
|
+
)
|
|
181
|
+
.filter(name => env[name] !== undefined)
|
|
182
|
+
.sort();
|
|
183
|
+
return Object.fromEntries(names.map(name => [name, env[name]]));
|
|
184
|
+
}
|
|
185
|
+
|
|
186
|
+
/**
|
|
187
|
+
* The relevant environment reduced to what may be stored: one digest of every
|
|
188
|
+
* relevant name and value, and the names that do not look like credentials.
|
|
189
|
+
* @param {Record<string, string|undefined>} env Process environment.
|
|
190
|
+
* @returns {{digest: string, names: string[]}} The digest enters the key, so
|
|
191
|
+
* changing any relevant value — secret-looking or not — still misses.
|
|
192
|
+
*/
|
|
193
|
+
export function environmentFingerprint(env) {
|
|
194
|
+
const relevant = relevantEnvironment(env);
|
|
195
|
+
return {
|
|
196
|
+
digest: createHash("sha256").update(canonicalJson(relevant)).digest("hex"),
|
|
197
|
+
names: Object.keys(relevant).filter(
|
|
198
|
+
name => !SECRET_NAME_PATTERN.test(name)
|
|
199
|
+
),
|
|
200
|
+
};
|
|
201
|
+
}
|
|
202
|
+
|
|
203
|
+
/**
|
|
204
|
+
* JSON with object keys sorted at every depth, so equal inputs hash equally.
|
|
205
|
+
* @param {unknown} value Any JSON value.
|
|
206
|
+
* @returns {string} Canonical JSON text.
|
|
207
|
+
*/
|
|
208
|
+
export function canonicalJson(value) {
|
|
209
|
+
if (Array.isArray(value)) return `[${value.map(canonicalJson).join(",")}]`;
|
|
210
|
+
if (value !== null && typeof value === "object") {
|
|
211
|
+
const keys = Object.keys(value)
|
|
212
|
+
.filter(key => value[key] !== undefined)
|
|
213
|
+
.sort();
|
|
214
|
+
return `{${keys
|
|
215
|
+
.map(key => `${JSON.stringify(key)}:${canonicalJson(value[key])}`)
|
|
216
|
+
.join(",")}}`;
|
|
217
|
+
}
|
|
218
|
+
return JSON.stringify(value ?? null);
|
|
219
|
+
}
|
|
220
|
+
|
|
221
|
+
/**
|
|
222
|
+
* The cache key for one gate.
|
|
223
|
+
* @param {object} inputs Everything the verdict can depend on.
|
|
224
|
+
* @returns {string} sha256 hex digest.
|
|
225
|
+
*/
|
|
226
|
+
export function gateKey(inputs) {
|
|
227
|
+
return createHash("sha256")
|
|
228
|
+
.update(canonicalJson({ schema: KEY_SCHEMA, ...inputs }))
|
|
229
|
+
.digest("hex");
|
|
230
|
+
}
|
|
231
|
+
|
|
232
|
+
/**
|
|
233
|
+
* Run git and return trimmed stdout, or null when it failed.
|
|
234
|
+
* @param {string[]} args Git arguments.
|
|
235
|
+
* @param {string} cwd Directory to run in.
|
|
236
|
+
* @returns {string|null} Output.
|
|
237
|
+
*/
|
|
238
|
+
function defaultGit(args, cwd) {
|
|
239
|
+
const child = spawnSync("git", args, { cwd, encoding: "utf8" });
|
|
240
|
+
return child.status === 0 ? String(child.stdout).trim() : null;
|
|
241
|
+
}
|
|
242
|
+
|
|
243
|
+
/**
|
|
244
|
+
* The tree this run proves, or why the cache cannot be used for it.
|
|
245
|
+
* @param {object} options Inputs.
|
|
246
|
+
* @param {string} options.cwd Repository directory.
|
|
247
|
+
* @param {Record<string, string|undefined>} options.env Process environment.
|
|
248
|
+
* @param {(args: string[], cwd: string) => (string|null)} options.git Git runner.
|
|
249
|
+
* @returns {{tree: string}|{skip: string}} The proved tree, or a reason.
|
|
250
|
+
*/
|
|
251
|
+
export function provedTree({ cwd, env, git }) {
|
|
252
|
+
const status = git(["status", "--porcelain"], cwd);
|
|
253
|
+
if (status === null) return { skip: "git could not read the working tree" };
|
|
254
|
+
if (status !== "") {
|
|
255
|
+
return {
|
|
256
|
+
skip: "the working tree differs from the pushed commit (uncommitted or untracked changes)",
|
|
257
|
+
};
|
|
258
|
+
}
|
|
259
|
+
const tree = git(["rev-parse", "HEAD^{tree}"], cwd);
|
|
260
|
+
if (!tree) return { skip: "HEAD has no tree to prove" };
|
|
261
|
+
const refsFile = env.LISA_PUSHED_REFS_FILE;
|
|
262
|
+
if (!refsFile) return { tree };
|
|
263
|
+
let lines;
|
|
264
|
+
try {
|
|
265
|
+
lines = readFileSync(refsFile, "utf8").split("\n").filter(Boolean);
|
|
266
|
+
} catch {
|
|
267
|
+
return { skip: "the list of pushed refs could not be read" };
|
|
268
|
+
}
|
|
269
|
+
const shas = lines
|
|
270
|
+
.map(line => line.trim().split(/\s+/)[1] ?? "")
|
|
271
|
+
.filter(sha => /^[0-9a-f]+$/.test(sha) && !ZERO_SHA.test(sha));
|
|
272
|
+
if (shas.length === 0) return { skip: "nothing pushed has a tree" };
|
|
273
|
+
for (const sha of shas) {
|
|
274
|
+
if (git(["rev-parse", `${sha}^{tree}`], cwd) !== tree) {
|
|
275
|
+
return {
|
|
276
|
+
skip: "the working tree differs from the pushed commit (a pushed ref's tree is not HEAD's tree)",
|
|
277
|
+
};
|
|
278
|
+
}
|
|
279
|
+
}
|
|
280
|
+
return { tree };
|
|
281
|
+
}
|
|
282
|
+
|
|
283
|
+
/**
|
|
284
|
+
* Read one JSON file's `gates` block; absent file reads as null.
|
|
285
|
+
* @param {string} path File path.
|
|
286
|
+
* @returns {unknown} The block, or null.
|
|
287
|
+
* @throws {Error} When the file exists but is not JSON.
|
|
288
|
+
*/
|
|
289
|
+
function gatesBlockOf(path) {
|
|
290
|
+
if (!existsSync(path)) return null;
|
|
291
|
+
return JSON.parse(readFileSync(path, "utf8")).gates ?? null;
|
|
292
|
+
}
|
|
293
|
+
|
|
294
|
+
/**
|
|
295
|
+
* Key inputs shared by every gate in one run.
|
|
296
|
+
* @param {string} cwd Repository directory.
|
|
297
|
+
* @param {Record<string, string|undefined>} env Process environment.
|
|
298
|
+
* @param {() => (string|null)} bunVersion Reads the bun version.
|
|
299
|
+
* @param {Record<string, string|null>} [extraTools] Further toolchain
|
|
300
|
+
* versions a caller's gates depend on — a Rails host adds `ruby -v` and
|
|
301
|
+
* `bundle -v` (CodySwannGT/lisa#4613). Empty for the gate runner, so its
|
|
302
|
+
* keys are unchanged.
|
|
303
|
+
* @param {Record<string, unknown>} [extraConfig] Further configuration a
|
|
304
|
+
* caller's verdicts depend on — a Rails host adds its effective `pushGate`,
|
|
305
|
+
* which decides whether RSpec runs a selection. Empty for the gate runner,
|
|
306
|
+
* so its keys are unchanged.
|
|
307
|
+
* @returns {{lockfiles: Record<string, string>, tools: {node: string, bun: string|null}, gatesConfig: {project: unknown, local: unknown}, environment: {digest: string, names: string[]}, extraConfig?: Record<string, unknown>}}
|
|
308
|
+
* Lockfile digests, tool versions, config and the environment fingerprint
|
|
309
|
+
* (never raw values — see `environmentFingerprint`).
|
|
310
|
+
*/
|
|
311
|
+
export function sharedInputs(
|
|
312
|
+
cwd,
|
|
313
|
+
env,
|
|
314
|
+
bunVersion,
|
|
315
|
+
extraTools = {},
|
|
316
|
+
extraConfig = {}
|
|
317
|
+
) {
|
|
318
|
+
const lockfiles = Object.fromEntries(
|
|
319
|
+
LOCKFILES.filter(name => existsSync(join(cwd, name))).map(name => [
|
|
320
|
+
name,
|
|
321
|
+
createHash("sha256")
|
|
322
|
+
.update(readFileSync(join(cwd, name)))
|
|
323
|
+
.digest("hex"),
|
|
324
|
+
])
|
|
325
|
+
);
|
|
326
|
+
return {
|
|
327
|
+
lockfiles,
|
|
328
|
+
tools: { node: process.versions.node, bun: bunVersion(), ...extraTools },
|
|
329
|
+
gatesConfig: {
|
|
330
|
+
project: gatesBlockOf(join(cwd, ".lisa.config.json")),
|
|
331
|
+
local: gatesBlockOf(join(cwd, ".lisa.config.local.json")),
|
|
332
|
+
},
|
|
333
|
+
environment: environmentFingerprint(env),
|
|
334
|
+
...(Object.keys(extraConfig).length > 0 ? { extraConfig } : {}),
|
|
335
|
+
};
|
|
336
|
+
}
|
|
337
|
+
|
|
338
|
+
/**
|
|
339
|
+
* `bun --version`, or null when bun is not installed.
|
|
340
|
+
* @returns {string|null} Version.
|
|
341
|
+
*/
|
|
342
|
+
function defaultBunVersion() {
|
|
343
|
+
const child = spawnSync("bun", ["--version"], { encoding: "utf8" });
|
|
344
|
+
return child.status === 0 ? String(child.stdout).trim() : null;
|
|
345
|
+
}
|
|
346
|
+
|
|
347
|
+
/**
|
|
348
|
+
* Why this run may not use the cache at all, or null when it may.
|
|
349
|
+
* @param {object} config Parsed `.lisa.config.json`.
|
|
350
|
+
* @param {Record<string, string|undefined>} env Process environment.
|
|
351
|
+
* @returns {{silent: boolean, reason: string}|null} The refusal.
|
|
352
|
+
*/
|
|
353
|
+
function refusal(config, env) {
|
|
354
|
+
const setting = cacheSetting(config);
|
|
355
|
+
if (setting.problem) {
|
|
356
|
+
return { silent: false, reason: `${setting.problem}, so it is off` };
|
|
357
|
+
}
|
|
358
|
+
if (!setting.enabled) return { silent: true, reason: "" };
|
|
359
|
+
if (String(env[CACHE_ENV] ?? "").toLowerCase() === "off") {
|
|
360
|
+
return { silent: false, reason: `the cache is off (${CACHE_ENV}=off)` };
|
|
361
|
+
}
|
|
362
|
+
if (env.CI || env.GITHUB_ACTIONS) {
|
|
363
|
+
return { silent: false, reason: "CI never reads or writes the cache" };
|
|
364
|
+
}
|
|
365
|
+
return null;
|
|
366
|
+
}
|
|
367
|
+
|
|
368
|
+
/**
|
|
369
|
+
* Whether a stored file was written under the current schema. An entry from an
|
|
370
|
+
* earlier schema may hold raw environment values, so it is never kept.
|
|
371
|
+
* @param {string} path Entry path.
|
|
372
|
+
* @returns {boolean} True for a current entry.
|
|
373
|
+
*/
|
|
374
|
+
function isCurrentEntry(path) {
|
|
375
|
+
try {
|
|
376
|
+
return JSON.parse(readFileSync(path, "utf8")).schema === KEY_SCHEMA;
|
|
377
|
+
} catch {
|
|
378
|
+
return false;
|
|
379
|
+
}
|
|
380
|
+
}
|
|
381
|
+
|
|
382
|
+
/**
|
|
383
|
+
* Create the store private to the user, or tighten one an earlier run left
|
|
384
|
+
* readable. Throws when it cannot, so nothing is written to an open directory.
|
|
385
|
+
* @param {string} dir Store directory.
|
|
386
|
+
*/
|
|
387
|
+
function preparePrivateStore(dir) {
|
|
388
|
+
mkdirSync(dir, { recursive: true, mode: STORE_DIR_MODE });
|
|
389
|
+
chmodSync(dir, STORE_DIR_MODE);
|
|
390
|
+
}
|
|
391
|
+
|
|
392
|
+
/**
|
|
393
|
+
* Delete entries older than the retention window or from an earlier schema,
|
|
394
|
+
* and tighten any left readable. Best effort.
|
|
395
|
+
* @param {string} dir Store directory.
|
|
396
|
+
* @param {number} now Epoch milliseconds.
|
|
397
|
+
*/
|
|
398
|
+
function prune(dir, now) {
|
|
399
|
+
for (const name of readdirSync(dir)) {
|
|
400
|
+
const path = join(dir, name);
|
|
401
|
+
try {
|
|
402
|
+
const stale = now - statSync(path).mtimeMs > MAX_AGE_MS;
|
|
403
|
+
const current = name.endsWith(".json") && isCurrentEntry(path);
|
|
404
|
+
if (stale || (name.endsWith(".json") && !current))
|
|
405
|
+
rmSync(path, { force: true });
|
|
406
|
+
else chmodSync(path, STORE_FILE_MODE);
|
|
407
|
+
} catch {
|
|
408
|
+
// Another run pruned it first.
|
|
409
|
+
}
|
|
410
|
+
}
|
|
411
|
+
}
|
|
412
|
+
|
|
413
|
+
/**
|
|
414
|
+
* Open the cache for one run, or return null when it may not be used.
|
|
415
|
+
*
|
|
416
|
+
* Prints one line saying why it was skipped, except when the project never
|
|
417
|
+
* turned it on — that path stays silent and touches nothing, so a host is
|
|
418
|
+
* unaffected until its template opts in.
|
|
419
|
+
* @param {object} options Inputs.
|
|
420
|
+
* @param {object} options.config Parsed `.lisa.config.json`.
|
|
421
|
+
* @param {object} options.gates The gates block, for per-moment `cache` flags.
|
|
422
|
+
* @param {string} options.moment The moment being run.
|
|
423
|
+
* @param {(line: string) => void} options.out Line sink.
|
|
424
|
+
* @param {string} [options.cwd] Repository directory.
|
|
425
|
+
* @param {Record<string, string|undefined>} [options.env] Environment.
|
|
426
|
+
* @param {() => number} [options.now] Clock.
|
|
427
|
+
* @param {(args: string[], cwd: string) => (string|null)} [options.git] Git runner.
|
|
428
|
+
* @param {() => (string|null)} [options.bunVersion] Bun version reader.
|
|
429
|
+
* @param {Record<string, string|null>} [options.extraTools] Further toolchain
|
|
430
|
+
* versions that enter every key (see `sharedInputs`).
|
|
431
|
+
* @param {Record<string, unknown>} [options.extraConfig] Further configuration
|
|
432
|
+
* that enters every key (see `sharedInputs`).
|
|
433
|
+
* @returns {{lookup: Function, remember: Function, commit: Function}|null} The cache.
|
|
434
|
+
*/
|
|
435
|
+
export function openGatePassCache({
|
|
436
|
+
config,
|
|
437
|
+
gates,
|
|
438
|
+
moment,
|
|
439
|
+
out,
|
|
440
|
+
cwd = process.cwd(),
|
|
441
|
+
env = process.env,
|
|
442
|
+
now = Date.now,
|
|
443
|
+
git = defaultGit,
|
|
444
|
+
bunVersion = defaultBunVersion,
|
|
445
|
+
extraTools = {},
|
|
446
|
+
extraConfig = {},
|
|
447
|
+
}) {
|
|
448
|
+
const refused = refusal(config, env);
|
|
449
|
+
if (refused) {
|
|
450
|
+
if (!refused.silent)
|
|
451
|
+
out(`🗃️ Gate pass cache not used: ${refused.reason}.`);
|
|
452
|
+
return null;
|
|
453
|
+
}
|
|
454
|
+
const proved = provedTree({ cwd, env, git });
|
|
455
|
+
if ("skip" in proved) {
|
|
456
|
+
out(`🗃️ Gate pass cache skipped: ${proved.skip}. Every gate runs.`);
|
|
457
|
+
return null;
|
|
458
|
+
}
|
|
459
|
+
let shared;
|
|
460
|
+
try {
|
|
461
|
+
shared = sharedInputs(cwd, env, bunVersion, extraTools, extraConfig);
|
|
462
|
+
} catch (err) {
|
|
463
|
+
out(`🗃️ Gate pass cache skipped: ${err.message}. Every gate runs.`);
|
|
464
|
+
return null;
|
|
465
|
+
}
|
|
466
|
+
const dir = cacheDirectory(env);
|
|
467
|
+
const keyFor = gate =>
|
|
468
|
+
gateKey({
|
|
469
|
+
...shared,
|
|
470
|
+
tree: proved.tree,
|
|
471
|
+
moment,
|
|
472
|
+
gate: gate.id,
|
|
473
|
+
command: gate.command,
|
|
474
|
+
});
|
|
475
|
+
const eligible = gate =>
|
|
476
|
+
Boolean(gate.command) &&
|
|
477
|
+
gates?.[gate.id]?.[moment]?.[CACHE_FIELD] !== false;
|
|
478
|
+
const pending = [];
|
|
479
|
+
out(`🗃️ Gate pass cache on for tree ${proved.tree.slice(0, 12)}.`);
|
|
480
|
+
return {
|
|
481
|
+
lookup(gate) {
|
|
482
|
+
if (!eligible(gate)) return null;
|
|
483
|
+
const key = keyFor(gate);
|
|
484
|
+
try {
|
|
485
|
+
const entry = JSON.parse(
|
|
486
|
+
readFileSync(join(dir, `${key}.json`), "utf8")
|
|
487
|
+
);
|
|
488
|
+
const age = now() - Date.parse(entry.passedAt);
|
|
489
|
+
return entry.key === key && age >= 0 && age <= MAX_AGE_MS
|
|
490
|
+
? { key }
|
|
491
|
+
: null;
|
|
492
|
+
} catch {
|
|
493
|
+
return null;
|
|
494
|
+
}
|
|
495
|
+
},
|
|
496
|
+
remember(gate, durationMs) {
|
|
497
|
+
if (eligible(gate)) pending.push({ gate, durationMs });
|
|
498
|
+
},
|
|
499
|
+
commit() {
|
|
500
|
+
if (pending.length === 0) return;
|
|
501
|
+
const after = provedTree({ cwd, env, git });
|
|
502
|
+
if (!("tree" in after) || after.tree !== proved.tree) {
|
|
503
|
+
out(
|
|
504
|
+
"🗃️ Gate passes not recorded: the working tree changed during the run."
|
|
505
|
+
);
|
|
506
|
+
return;
|
|
507
|
+
}
|
|
508
|
+
try {
|
|
509
|
+
preparePrivateStore(dir);
|
|
510
|
+
prune(dir, now());
|
|
511
|
+
for (const { gate, durationMs } of pending) {
|
|
512
|
+
const key = keyFor(gate);
|
|
513
|
+
const entry = {
|
|
514
|
+
schema: KEY_SCHEMA,
|
|
515
|
+
key,
|
|
516
|
+
gate: gate.id,
|
|
517
|
+
inputs: {
|
|
518
|
+
...shared,
|
|
519
|
+
tree: proved.tree,
|
|
520
|
+
moment,
|
|
521
|
+
command: gate.command,
|
|
522
|
+
},
|
|
523
|
+
passedAt: new Date(now()).toISOString(),
|
|
524
|
+
durationMs,
|
|
525
|
+
};
|
|
526
|
+
const temp = join(dir, `.${key}.${process.pid}.tmp`);
|
|
527
|
+
writeFileSync(temp, `${JSON.stringify(entry, null, 2)}\n`, {
|
|
528
|
+
mode: STORE_FILE_MODE,
|
|
529
|
+
});
|
|
530
|
+
renameSync(temp, join(dir, `${key}.json`));
|
|
531
|
+
}
|
|
532
|
+
} catch (err) {
|
|
533
|
+
out(`🗃️ Gate passes not recorded: ${err.message}.`);
|
|
534
|
+
}
|
|
535
|
+
},
|
|
536
|
+
};
|
|
537
|
+
}
|
|
@@ -100,8 +100,7 @@ export function recordKillMark({ kind, gateId }, deps = {}) {
|
|
|
100
100
|
// `randomBytes`, not `Math.random`: the suffix only has to make two marks
|
|
101
101
|
// written in the same millisecond by the same pid distinct, but a shipped
|
|
102
102
|
// file reaches every downstream project and the shipped ruleset refuses a
|
|
103
|
-
// pseudorandom source on sight rather than judging each call site.
|
|
104
|
-
// what `scratch-owner` already does costs nothing here.
|
|
103
|
+
// pseudorandom source on sight rather than judging each call site.
|
|
105
104
|
const name = `${String(now)}-${String(pid)}-${randomBytes(4).toString("hex")}.json`;
|
|
106
105
|
writeFileSync(
|
|
107
106
|
join(dir, name),
|
|
@@ -48,9 +48,8 @@
|
|
|
48
48
|
* deliberately carries that text is exposed, and only to the same user's
|
|
49
49
|
* sweep; Linux reads whole environ entries and has no such ambiguity.
|
|
50
50
|
*
|
|
51
|
-
*
|
|
52
|
-
*
|
|
53
|
-
* reading mirrors `scratch-owner.ts` rather than importing it.
|
|
51
|
+
* Self-contained: the per-test scratch policing this sweep replaced was
|
|
52
|
+
* retired (CodySwannGT/lisa#4602), so nothing here depends on it.
|
|
54
53
|
* @module scripts/lib/lisa-cleanup-sweep-processes
|
|
55
54
|
*/
|
|
56
55
|
import { readdirSync, readFileSync, statSync } from "node:fs";
|
|
@@ -73,7 +72,7 @@ const PS_TIMEOUT_MS = 5_000;
|
|
|
73
72
|
/** `ps -E` prints every environment; leave room for a busy desktop. */
|
|
74
73
|
const PS_MAX_BUFFER = 64 * 1024 * 1024;
|
|
75
74
|
|
|
76
|
-
/** Pids per `ps -p` call,
|
|
75
|
+
/** Pids per `ps -p` call, so one argument list stays well under `ARG_MAX`. */
|
|
77
76
|
const PS_BATCH = 256;
|
|
78
77
|
|
|
79
78
|
/** Locale-independent `ps` output, so `lstart` parses the same everywhere. */
|
|
@@ -37,7 +37,7 @@ function recipesFor(authority) {
|
|
|
37
37
|
"broker controller Node identity differs"
|
|
38
38
|
);
|
|
39
39
|
required(
|
|
40
|
-
graph && Object.keys(graph).length > 0 && Object.keys(graph).length <=
|
|
40
|
+
graph && Object.keys(graph).length > 0 && Object.keys(graph).length <= 256,
|
|
41
41
|
"broker graph is absent or unbounded"
|
|
42
42
|
);
|
|
43
43
|
required(
|
|
@@ -100,7 +100,8 @@ export function controllerGraph(graph, routes = []) {
|
|
|
100
100
|
}
|
|
101
101
|
}
|
|
102
102
|
required(
|
|
103
|
-
|
|
103
|
+
// 256, like the helper graph: at 128 the managed inventory sat at the cap.
|
|
104
|
+
Object.keys(expected).length <= 256,
|
|
104
105
|
"configured helper/configuration closure exceeds bound"
|
|
105
106
|
);
|
|
106
107
|
return expected;
|
|
@@ -36,10 +36,18 @@ const COMMON = [
|
|
|
36
36
|
"lib/windows-process-job.ps1",
|
|
37
37
|
"lib/windows-process-job.cs",
|
|
38
38
|
"lib/kill-marks.mjs",
|
|
39
|
+
"lib/push-timing.mjs",
|
|
39
40
|
"lib/gate-failure-diagnosis.mjs",
|
|
40
41
|
"lib/worktree-dependencies.mjs",
|
|
41
42
|
"lib/lisa-cleanup-sweep.mjs",
|
|
42
43
|
"lib/lisa-cleanup-sweep-processes.mjs",
|
|
44
|
+
"lib/build-marker.mjs",
|
|
45
|
+
"lib/gate-pass-cache.mjs",
|
|
46
|
+
"lib/affected-tests.mjs",
|
|
47
|
+
"lisa-rspec-select.mjs",
|
|
48
|
+
"lib/rspec-selection.mjs",
|
|
49
|
+
"lib/push-admission.mjs",
|
|
50
|
+
"lib/push-gate-defaults.mjs",
|
|
43
51
|
"lib/history-secret-git.mjs",
|
|
44
52
|
"lib/history-secret-scanner.mjs",
|
|
45
53
|
"lib/history-secret-evidence.mjs",
|
|
@@ -52,7 +60,6 @@ const COMMON = [
|
|
|
52
60
|
"lib/automation-provenance-files.mjs",
|
|
53
61
|
"lib/automation-provenance-local.mjs",
|
|
54
62
|
"lisa-clean-git-env.sh",
|
|
55
|
-
"lisa-scratch-run.sh",
|
|
56
63
|
"check-threshold-ratchet.mjs",
|
|
57
64
|
"threshold-ratchet-families.mjs",
|
|
58
65
|
"threshold-ratchet-compare.mjs",
|
|
@@ -53,7 +53,7 @@ export function hostedHookContext(file) {
|
|
|
53
53
|
);
|
|
54
54
|
const observed = currentGraph(context.graph);
|
|
55
55
|
required(
|
|
56
|
-
Object.keys(observed).length <=
|
|
56
|
+
Object.keys(observed).length <= 256 &&
|
|
57
57
|
Object.entries(context.graph).every(
|
|
58
58
|
([path, hash]) => observed[path] === hash
|
|
59
59
|
),
|
|
@@ -105,7 +105,7 @@ export function launcherContext(file) {
|
|
|
105
105
|
value.graph &&
|
|
106
106
|
typeof value.graph === "object" &&
|
|
107
107
|
!Array.isArray(value.graph) &&
|
|
108
|
-
Object.keys(value.graph).length <=
|
|
108
|
+
Object.keys(value.graph).length <= 256,
|
|
109
109
|
"unbounded trusted import graph"
|
|
110
110
|
);
|
|
111
111
|
controllerGraph(value.graph, value.routes);
|