@codyswann/lisa 5.4.0 → 5.6.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +60 -3
- package/all/copy-contents/gitignore +16 -0
- package/all/copy-contents/scripts/lisa-mutation.sh +4 -6
- package/all/copy-overwrite/scripts/fetch-test-access-map.d.mts +71 -0
- package/all/copy-overwrite/scripts/fetch-test-access-map.mjs +674 -0
- package/all/copy-overwrite/scripts/lib/affected-tests.mjs +818 -0
- package/all/copy-overwrite/scripts/lib/automation-provenance-local.mjs +48 -3
- package/all/copy-overwrite/scripts/lib/build-marker.mjs +410 -0
- package/all/copy-overwrite/scripts/lib/gate-pass-cache.mjs +537 -0
- package/all/copy-overwrite/scripts/lib/github-attestation-provider.mjs +68 -0
- package/all/copy-overwrite/scripts/lib/github-attestation-recovery.mjs +25 -10
- package/all/copy-overwrite/scripts/lib/github-attestation-verifier.mjs +4 -1
- package/all/copy-overwrite/scripts/lib/kill-marks.mjs +1 -2
- package/all/copy-overwrite/scripts/lib/lisa-cleanup-sweep-processes.mjs +3 -4
- package/all/copy-overwrite/scripts/lib/npm-update-allocate.mjs +1 -6
- package/all/copy-overwrite/scripts/lib/npm-update-authorization.mjs +25 -14
- package/all/copy-overwrite/scripts/lib/npm-update-cancel-origin.mjs +45 -11
- package/all/copy-overwrite/scripts/lib/npm-update-cancellation-proof.mjs +22 -11
- package/all/copy-overwrite/scripts/lib/npm-update-cancellation.mjs +29 -17
- package/all/copy-overwrite/scripts/lib/npm-update-controller-broker.mjs +1 -1
- package/all/copy-overwrite/scripts/lib/npm-update-controller-factory.mjs +19 -1
- package/all/copy-overwrite/scripts/lib/npm-update-gate-hooks.mjs +2 -1
- package/all/copy-overwrite/scripts/lib/npm-update-gate.mjs +5 -0
- package/all/copy-overwrite/scripts/lib/npm-update-gh-requests.mjs +57 -30
- package/all/copy-overwrite/scripts/lib/npm-update-helper-inventory.mjs +9 -1
- package/all/copy-overwrite/scripts/lib/npm-update-hosted-hook.mjs +1 -1
- package/all/copy-overwrite/scripts/lib/npm-update-leaf.mjs +6 -1
- package/all/copy-overwrite/scripts/lib/npm-update-policy.mjs +38 -0
- package/all/copy-overwrite/scripts/lib/npm-update-publication.mjs +21 -3
- package/all/copy-overwrite/scripts/lib/npm-update-publish.mjs +13 -1
- package/all/copy-overwrite/scripts/lib/npm-update-recovery.mjs +29 -4
- package/all/copy-overwrite/scripts/lib/npm-update-supersession.mjs +21 -7
- package/all/copy-overwrite/scripts/lib/npm-update-tool-launcher.mjs +1 -1
- package/all/copy-overwrite/scripts/lib/npm-update-tracker-cancel.mjs +139 -0
- package/all/copy-overwrite/scripts/lib/npm-update-tracker-jira.mjs +149 -19
- package/all/copy-overwrite/scripts/lib/npm-update-tracker-linear.mjs +72 -17
- package/all/copy-overwrite/scripts/lib/npm-update-tracker-wire.mjs +102 -12
- package/all/copy-overwrite/scripts/lib/npm-update-tracker.mjs +91 -13
- package/all/copy-overwrite/scripts/lib/push-admission.mjs +158 -0
- package/all/copy-overwrite/scripts/lib/push-gate-defaults.d.mts +34 -0
- package/all/copy-overwrite/scripts/lib/push-gate-defaults.mjs +147 -0
- package/all/copy-overwrite/scripts/lib/push-timing.mjs +323 -0
- package/all/copy-overwrite/scripts/lib/rspec-selection.mjs +672 -0
- package/all/copy-overwrite/scripts/lisa-affected-tests.mjs +566 -0
- package/all/copy-overwrite/scripts/lisa-automation-provenance.mjs +35 -8
- package/all/copy-overwrite/scripts/lisa-gates.mjs +29 -0
- package/all/copy-overwrite/scripts/lisa-lint-staged-preflight.mjs +10 -1
- package/all/copy-overwrite/scripts/lisa-npm-updater.mjs +8 -5
- package/all/copy-overwrite/scripts/lisa-push-timing-report.mjs +153 -0
- package/all/copy-overwrite/scripts/lisa-rspec-select.mjs +982 -0
- package/all/copy-overwrite/scripts/lisa-run-gates.mjs +231 -6
- package/all/copy-overwrite/scripts/npm-updater-helper-graph.json +148 -41
- package/all/deletions.json +11 -2
- package/cdk/create-only/vitest.config.local.ts +1 -7
- package/cdk/package-lisa/package.lisa.json +4 -4
- package/dist/cli/admit-cmd.d.ts +21 -0
- package/dist/cli/admit-cmd.d.ts.map +1 -0
- package/dist/cli/admit-cmd.js +142 -0
- package/dist/cli/admit-cmd.js.map +1 -0
- package/dist/cli/check-cmd.d.ts +72 -0
- package/dist/cli/check-cmd.d.ts.map +1 -0
- package/dist/cli/check-cmd.js +316 -0
- package/dist/cli/check-cmd.js.map +1 -0
- package/dist/cli/index.d.ts.map +1 -1
- package/dist/cli/index.js +6 -4
- package/dist/cli/index.js.map +1 -1
- package/dist/cli/lisa-test-run-admission.d.ts +18 -0
- package/dist/cli/lisa-test-run-admission.d.ts.map +1 -0
- package/dist/cli/lisa-test-run-admission.js +62 -0
- package/dist/cli/lisa-test-run-admission.js.map +1 -0
- package/dist/cli/lisa-test-run-payload.d.ts +37 -0
- package/dist/cli/lisa-test-run-payload.d.ts.map +1 -0
- package/dist/cli/lisa-test-run-payload.js +55 -0
- package/dist/cli/lisa-test-run-payload.js.map +1 -0
- package/dist/cli/lisa-test-run-shard-files.d.ts +89 -0
- package/dist/cli/lisa-test-run-shard-files.d.ts.map +1 -0
- package/dist/cli/lisa-test-run-shard-files.js +239 -0
- package/dist/cli/lisa-test-run-shard-files.js.map +1 -0
- package/dist/cli/lisa-test-run-shard.d.ts +6 -2
- package/dist/cli/lisa-test-run-shard.d.ts.map +1 -1
- package/dist/cli/lisa-test-run-shard.js +25 -13
- package/dist/cli/lisa-test-run-shard.js.map +1 -1
- package/dist/cli/lisa-test-run.d.ts +1 -1
- package/dist/cli/lisa-test-run.d.ts.map +1 -1
- package/dist/cli/lisa-test-run.js +47 -10
- package/dist/cli/lisa-test-run.js.map +1 -1
- package/dist/cli/update-check-hook.d.ts.map +1 -1
- package/dist/cli/update-check-hook.js +3 -0
- package/dist/cli/update-check-hook.js.map +1 -1
- package/dist/configs/vitest/base.d.ts +58 -135
- package/dist/configs/vitest/base.d.ts.map +1 -1
- package/dist/configs/vitest/base.js +76 -228
- package/dist/configs/vitest/base.js.map +1 -1
- package/dist/configs/vitest/cdk.d.ts.map +1 -1
- package/dist/configs/vitest/cdk.js +3 -2
- package/dist/configs/vitest/cdk.js.map +1 -1
- package/dist/configs/vitest/coverage-include-global-setup.d.ts.map +1 -1
- package/dist/configs/vitest/coverage-include-global-setup.js +3 -4
- package/dist/configs/vitest/coverage-include-global-setup.js.map +1 -1
- package/dist/configs/vitest/coverage-reports-directory.d.ts +27 -5
- package/dist/configs/vitest/coverage-reports-directory.d.ts.map +1 -1
- package/dist/configs/vitest/coverage-reports-directory.js +47 -10
- package/dist/configs/vitest/coverage-reports-directory.js.map +1 -1
- package/dist/configs/vitest/harper-fabric.d.ts.map +1 -1
- package/dist/configs/vitest/harper-fabric.js +3 -2
- package/dist/configs/vitest/harper-fabric.js.map +1 -1
- package/dist/configs/vitest/nestjs.d.ts.map +1 -1
- package/dist/configs/vitest/nestjs.js +3 -2
- package/dist/configs/vitest/nestjs.js.map +1 -1
- package/dist/configs/vitest/phaser.d.ts.map +1 -1
- package/dist/configs/vitest/phaser.js +3 -2
- package/dist/configs/vitest/phaser.js.map +1 -1
- package/dist/configs/vitest/refusal-announcement.d.ts +51 -0
- package/dist/configs/vitest/refusal-announcement.d.ts.map +1 -0
- package/dist/configs/vitest/refusal-announcement.js +97 -0
- package/dist/configs/vitest/refusal-announcement.js.map +1 -0
- package/dist/configs/vitest/socket-safe-temp-base.d.ts +3 -4
- package/dist/configs/vitest/socket-safe-temp-base.d.ts.map +1 -1
- package/dist/configs/vitest/socket-safe-temp-base.js +7 -6
- package/dist/configs/vitest/socket-safe-temp-base.js.map +1 -1
- package/dist/configs/vitest/typescript.d.ts.map +1 -1
- package/dist/configs/vitest/typescript.js +3 -2
- package/dist/configs/vitest/typescript.js.map +1 -1
- package/dist/core/admission-decision.d.ts +110 -0
- package/dist/core/admission-decision.d.ts.map +1 -0
- package/dist/core/admission-decision.js +91 -0
- package/dist/core/admission-decision.js.map +1 -0
- package/dist/core/admission-lock.d.ts +69 -0
- package/dist/core/admission-lock.d.ts.map +1 -0
- package/dist/core/admission-lock.js +278 -0
- package/dist/core/admission-lock.js.map +1 -0
- package/dist/core/admission-settings.d.ts +69 -0
- package/dist/core/admission-settings.d.ts.map +1 -0
- package/dist/core/admission-settings.js +204 -0
- package/dist/core/admission-settings.js.map +1 -0
- package/dist/core/admission-state.d.ts +50 -0
- package/dist/core/admission-state.d.ts.map +1 -0
- package/dist/core/admission-state.js +168 -0
- package/dist/core/admission-state.js.map +1 -0
- package/dist/core/admission.d.ts +70 -0
- package/dist/core/admission.d.ts.map +1 -0
- package/dist/core/admission.js +205 -0
- package/dist/core/admission.js.map +1 -0
- package/dist/core/lisa-owned-hash-ledger.d.ts.map +1 -1
- package/dist/core/lisa-owned-hash-ledger.js +440 -0
- package/dist/core/lisa-owned-hash-ledger.js.map +1 -1
- package/dist/core/nightly-e2e-guard-behavior-certificate.js +2 -2
- package/dist/core/project-config-push-gate.d.ts +66 -0
- package/dist/core/project-config-push-gate.d.ts.map +1 -0
- package/dist/core/project-config-push-gate.js +82 -0
- package/dist/core/project-config-push-gate.js.map +1 -0
- package/dist/core/project-config.d.ts +4 -0
- package/dist/core/project-config.d.ts.map +1 -1
- package/dist/core/project-config.js +14 -9
- package/dist/core/project-config.js.map +1 -1
- package/dist/core/upstream-evidence-manifest.d.ts.map +1 -1
- package/dist/core/upstream-evidence-manifest.js +234 -146
- package/dist/core/upstream-evidence-manifest.js.map +1 -1
- package/expo/package-lisa/package.lisa.json +2 -2
- package/harper-fabric/package-lisa/package.lisa.json +4 -4
- package/nestjs/create-only/vitest.config.local.ts +1 -7
- package/nestjs/package-lisa/package.lisa.json +4 -4
- package/npm-package/package-lisa/package.lisa.json +4 -4
- package/package.json +12 -11
- package/phaser/package-lisa/package.lisa.json +4 -4
- package/plugins/lisa/.claude-plugin/plugin.json +1 -1
- package/plugins/lisa/.codex-plugin/plugin.json +1 -1
- package/plugins/lisa/.codex-plugin/skills/lisa-drive-pr-to-merge/SKILL.md +16 -3
- package/plugins/lisa/.codex-plugin/skills/lisa-git-submit-pr/SKILL.md +1 -1
- package/plugins/lisa/.codex-plugin/skills/lisa-implement/SKILL.md +1 -1
- package/plugins/lisa/skills/lisa-drive-pr-to-merge/SKILL.md +16 -3
- package/plugins/lisa/skills/lisa-git-submit-pr/SKILL.md +1 -1
- package/plugins/lisa/skills/lisa-implement/SKILL.md +1 -1
- package/plugins/lisa-agy/plugin.json +1 -1
- package/plugins/lisa-agy/skills/lisa-drive-pr-to-merge/SKILL.md +16 -3
- package/plugins/lisa-agy/skills/lisa-git-submit-pr/SKILL.md +1 -1
- package/plugins/lisa-agy/skills/lisa-implement/SKILL.md +1 -1
- package/plugins/lisa-cdk/.claude-plugin/plugin.json +1 -1
- package/plugins/lisa-cdk/.codex-plugin/plugin.json +1 -1
- package/plugins/lisa-cdk-agy/plugin.json +1 -1
- package/plugins/lisa-cdk-copilot/.claude-plugin/plugin.json +1 -1
- package/plugins/lisa-cdk-cursor/.claude-plugin/plugin.json +1 -1
- package/plugins/lisa-cdk-devin/.claude-plugin/plugin.json +1 -1
- package/plugins/lisa-cdk-devin/.devin-plugin/plugin.json +1 -1
- package/plugins/lisa-copilot/.claude-plugin/plugin.json +1 -1
- package/plugins/lisa-copilot/skills/lisa-drive-pr-to-merge/SKILL.md +16 -3
- package/plugins/lisa-copilot/skills/lisa-git-submit-pr/SKILL.md +1 -1
- package/plugins/lisa-copilot/skills/lisa-implement/SKILL.md +1 -1
- package/plugins/lisa-cursor/.claude-plugin/plugin.json +1 -1
- package/plugins/lisa-cursor/skills/lisa-drive-pr-to-merge/SKILL.md +16 -3
- package/plugins/lisa-cursor/skills/lisa-git-submit-pr/SKILL.md +1 -1
- package/plugins/lisa-cursor/skills/lisa-implement/SKILL.md +1 -1
- package/plugins/lisa-devin/.claude-plugin/plugin.json +1 -1
- package/plugins/lisa-devin/.devin-plugin/plugin.json +1 -1
- package/plugins/lisa-devin/skills/lisa-drive-pr-to-merge/SKILL.md +16 -3
- package/plugins/lisa-devin/skills/lisa-git-submit-pr/SKILL.md +1 -1
- package/plugins/lisa-devin/skills/lisa-implement/SKILL.md +1 -1
- package/plugins/lisa-expo/.claude-plugin/plugin.json +1 -1
- package/plugins/lisa-expo/.codex-plugin/plugin.json +1 -1
- package/plugins/lisa-expo-agy/plugin.json +1 -1
- package/plugins/lisa-expo-copilot/.claude-plugin/plugin.json +1 -1
- package/plugins/lisa-expo-cursor/.claude-plugin/plugin.json +1 -1
- package/plugins/lisa-expo-devin/.claude-plugin/plugin.json +1 -1
- package/plugins/lisa-expo-devin/.devin-plugin/plugin.json +1 -1
- package/plugins/lisa-harper-fabric/.claude-plugin/plugin.json +1 -1
- package/plugins/lisa-harper-fabric/.codex-plugin/plugin.json +1 -1
- package/plugins/lisa-harper-fabric-agy/plugin.json +1 -1
- package/plugins/lisa-harper-fabric-copilot/.claude-plugin/plugin.json +1 -1
- package/plugins/lisa-harper-fabric-cursor/.claude-plugin/plugin.json +1 -1
- package/plugins/lisa-harper-fabric-devin/.claude-plugin/plugin.json +1 -1
- package/plugins/lisa-harper-fabric-devin/.devin-plugin/plugin.json +1 -1
- package/plugins/lisa-nestjs/.claude-plugin/plugin.json +1 -1
- package/plugins/lisa-nestjs/.codex-plugin/plugin.json +1 -1
- package/plugins/lisa-nestjs-agy/plugin.json +1 -1
- package/plugins/lisa-nestjs-copilot/.claude-plugin/plugin.json +1 -1
- package/plugins/lisa-nestjs-cursor/.claude-plugin/plugin.json +1 -1
- package/plugins/lisa-nestjs-devin/.claude-plugin/plugin.json +1 -1
- package/plugins/lisa-nestjs-devin/.devin-plugin/plugin.json +1 -1
- package/plugins/lisa-phaser/.claude-plugin/plugin.json +1 -1
- package/plugins/lisa-phaser/.codex-plugin/plugin.json +1 -1
- package/plugins/lisa-phaser-agy/plugin.json +1 -1
- package/plugins/lisa-phaser-copilot/.claude-plugin/plugin.json +1 -1
- package/plugins/lisa-phaser-cursor/.claude-plugin/plugin.json +1 -1
- package/plugins/lisa-phaser-devin/.claude-plugin/plugin.json +1 -1
- package/plugins/lisa-phaser-devin/.devin-plugin/plugin.json +1 -1
- package/plugins/lisa-rails/.claude-plugin/plugin.json +1 -1
- package/plugins/lisa-rails/.codex-plugin/plugin.json +1 -1
- package/plugins/lisa-rails-agy/plugin.json +1 -1
- package/plugins/lisa-rails-copilot/.claude-plugin/plugin.json +1 -1
- package/plugins/lisa-rails-cursor/.claude-plugin/plugin.json +1 -1
- package/plugins/lisa-rails-devin/.claude-plugin/plugin.json +1 -1
- package/plugins/lisa-rails-devin/.devin-plugin/plugin.json +1 -1
- package/plugins/lisa-typescript/.claude-plugin/plugin.json +1 -1
- package/plugins/lisa-typescript/.codex-plugin/plugin.json +1 -1
- package/plugins/lisa-typescript-agy/plugin.json +1 -1
- package/plugins/lisa-typescript-copilot/.claude-plugin/plugin.json +1 -1
- package/plugins/lisa-typescript-cursor/.claude-plugin/plugin.json +1 -1
- package/plugins/lisa-typescript-devin/.claude-plugin/plugin.json +1 -1
- package/plugins/lisa-typescript-devin/.devin-plugin/plugin.json +1 -1
- package/plugins/lisa-wiki/.claude-plugin/plugin.json +1 -1
- package/plugins/lisa-wiki/.codex-plugin/plugin.json +1 -1
- package/plugins/lisa-wiki-agy/plugin.json +1 -1
- package/plugins/lisa-wiki-copilot/.claude-plugin/plugin.json +1 -1
- package/plugins/lisa-wiki-cursor/.claude-plugin/plugin.json +1 -1
- package/plugins/lisa-wiki-devin/.claude-plugin/plugin.json +1 -1
- package/plugins/lisa-wiki-devin/.devin-plugin/plugin.json +1 -1
- package/plugins/src/base/skills/lisa-drive-pr-to-merge/SKILL.md +16 -3
- package/plugins/src/base/skills/lisa-git-submit-pr/SKILL.md +1 -1
- package/plugins/src/base/skills/lisa-implement/SKILL.md +1 -1
- package/rails/copy-overwrite/Gemfile.lisa +8 -0
- package/rails/copy-overwrite/lefthook.yml +25 -11
- package/rails/copy-overwrite/scripts/lisa-rails-gates.mjs +686 -0
- package/rails/copy-overwrite/scripts/lisa-rspec-shards.mjs +2 -2
- package/rails/copy-overwrite/scripts/lisa_crystalball_recorder.rb +239 -0
- package/rails/copy-overwrite/scripts/lisa_rspec_partial_coverage.rb +83 -0
- package/scripts/build-unless-marked.mjs +83 -0
- package/scripts/check-plugins-sync.sh +22 -5
- package/scripts/classify-markdown-assertions.mjs +141 -0
- package/scripts/integration-shard-build.mjs +143 -0
- package/scripts/lib/history-scanner-suites.mjs +19 -0
- package/scripts/lib/markdown-assertions/classify.mjs +289 -0
- package/scripts/lib/markdown-assertions/context.mjs +53 -0
- package/scripts/lib/markdown-assertions/corpus.mjs +222 -0
- package/scripts/lib/markdown-assertions/manifest-cull.mjs +86 -0
- package/scripts/lib/markdown-assertions/record-setup.mjs +265 -0
- package/scripts/lib/markdown-assertions/record.mjs +115 -0
- package/scripts/lib/markdown-assertions/record.vitest.config.mjs +24 -0
- package/scripts/lib/markdown-assertions/sites.mjs +273 -0
- package/scripts/lib/markdown-assertions/test-cull.mjs +768 -0
- package/scripts/lib/markdown-assertions/tokens.mjs +158 -0
- package/scripts/lib/shell-guard-trace.mjs +6 -0
- package/scripts/lib/test-access-map-setup.mjs +40 -0
- package/scripts/lib/test-access-map-tracer.mjs +205 -0
- package/scripts/lib/test-access-map.d.mts +72 -0
- package/scripts/lib/test-access-map.mjs +395 -0
- package/scripts/lib/test-timings-reporter.d.mts +17 -0
- package/scripts/lib/test-timings-reporter.mjs +99 -0
- package/scripts/plan-integration-shards.mjs +300 -0
- package/scripts/test-timing-report.d.mts +41 -0
- package/scripts/test-timing-report.mjs +361 -0
- package/scripts/two-channel-couplings.json +132 -36
- package/scripts/verify-npm-advisories-4333.mjs +3 -12
- package/typescript/copy-overwrite/.prettierignore +13 -0
- package/typescript/create-only/vitest.config.local.ts +1 -7
- package/typescript/package-lisa/package.lisa.json +4 -4
- package/all/copy-overwrite/scripts/lisa-scratch-run.sh +0 -1078
- package/dist/cli/lisa-test-run-bootstrap.d.ts +0 -3
- package/dist/cli/lisa-test-run-bootstrap.d.ts.map +0 -1
- package/dist/cli/lisa-test-run-bootstrap.js +0 -229
- package/dist/cli/lisa-test-run-bootstrap.js.map +0 -1
- package/dist/cli/lisa-test-run-ipc.d.ts +0 -49
- package/dist/cli/lisa-test-run-ipc.d.ts.map +0 -1
- package/dist/cli/lisa-test-run-ipc.js +0 -226
- package/dist/cli/lisa-test-run-ipc.js.map +0 -1
- package/dist/cli/lisa-test-run-process-group.d.ts +0 -30
- package/dist/cli/lisa-test-run-process-group.d.ts.map +0 -1
- package/dist/cli/lisa-test-run-process-group.js +0 -140
- package/dist/cli/lisa-test-run-process-group.js.map +0 -1
- package/dist/cli/lisa-test-run-reaper.d.ts +0 -3
- package/dist/cli/lisa-test-run-reaper.d.ts.map +0 -1
- package/dist/cli/lisa-test-run-reaper.js +0 -195
- package/dist/cli/lisa-test-run-reaper.js.map +0 -1
- package/dist/cli/lisa-test-run-runtime.d.ts +0 -46
- package/dist/cli/lisa-test-run-runtime.d.ts.map +0 -1
- package/dist/cli/lisa-test-run-runtime.js +0 -123
- package/dist/cli/lisa-test-run-runtime.js.map +0 -1
- package/dist/cli/lisa-test-run-supervisor.d.ts +0 -13
- package/dist/cli/lisa-test-run-supervisor.d.ts.map +0 -1
- package/dist/cli/lisa-test-run-supervisor.js +0 -265
- package/dist/cli/lisa-test-run-supervisor.js.map +0 -1
- package/dist/configs/vitest/fleet-admission-global-setup.d.ts +0 -34
- package/dist/configs/vitest/fleet-admission-global-setup.d.ts.map +0 -1
- package/dist/configs/vitest/fleet-admission-global-setup.js +0 -123
- package/dist/configs/vitest/fleet-admission-global-setup.js.map +0 -1
- package/dist/configs/vitest/fleet-admission.d.ts +0 -129
- package/dist/configs/vitest/fleet-admission.d.ts.map +0 -1
- package/dist/configs/vitest/fleet-admission.js +0 -239
- package/dist/configs/vitest/fleet-admission.js.map +0 -1
- package/dist/configs/vitest/scratch-authority.d.ts +0 -25
- package/dist/configs/vitest/scratch-authority.d.ts.map +0 -1
- package/dist/configs/vitest/scratch-authority.js +0 -107
- package/dist/configs/vitest/scratch-authority.js.map +0 -1
- package/dist/configs/vitest/scratch-bound-cleanup-programs.d.ts +0 -5
- package/dist/configs/vitest/scratch-bound-cleanup-programs.d.ts.map +0 -1
- package/dist/configs/vitest/scratch-bound-cleanup-programs.js +0 -219
- package/dist/configs/vitest/scratch-bound-cleanup-programs.js.map +0 -1
- package/dist/configs/vitest/scratch-bound-cleanup.d.ts +0 -28
- package/dist/configs/vitest/scratch-bound-cleanup.d.ts.map +0 -1
- package/dist/configs/vitest/scratch-bound-cleanup.js +0 -155
- package/dist/configs/vitest/scratch-bound-cleanup.js.map +0 -1
- package/dist/configs/vitest/scratch-bound-root-cleanup.d.ts +0 -17
- package/dist/configs/vitest/scratch-bound-root-cleanup.d.ts.map +0 -1
- package/dist/configs/vitest/scratch-bound-root-cleanup.js +0 -149
- package/dist/configs/vitest/scratch-bound-root-cleanup.js.map +0 -1
- package/dist/configs/vitest/scratch-global-setup.d.ts +0 -258
- package/dist/configs/vitest/scratch-global-setup.d.ts.map +0 -1
- package/dist/configs/vitest/scratch-global-setup.js +0 -505
- package/dist/configs/vitest/scratch-global-setup.js.map +0 -1
- package/dist/configs/vitest/scratch-leak-setup.d.ts +0 -2
- package/dist/configs/vitest/scratch-leak-setup.d.ts.map +0 -1
- package/dist/configs/vitest/scratch-leak-setup.js +0 -108
- package/dist/configs/vitest/scratch-leak-setup.js.map +0 -1
- package/dist/configs/vitest/scratch-namespace-authority.d.ts +0 -80
- package/dist/configs/vitest/scratch-namespace-authority.d.ts.map +0 -1
- package/dist/configs/vitest/scratch-namespace-authority.js +0 -291
- package/dist/configs/vitest/scratch-namespace-authority.js.map +0 -1
- package/dist/configs/vitest/scratch-owner.d.ts +0 -131
- package/dist/configs/vitest/scratch-owner.d.ts.map +0 -1
- package/dist/configs/vitest/scratch-owner.js +0 -297
- package/dist/configs/vitest/scratch-owner.js.map +0 -1
- package/dist/configs/vitest/scratch-route-profile.d.ts +0 -46
- package/dist/configs/vitest/scratch-route-profile.d.ts.map +0 -1
- package/dist/configs/vitest/scratch-route-profile.js +0 -233
- package/dist/configs/vitest/scratch-route-profile.js.map +0 -1
- package/dist/configs/vitest/scratch-run-root-compatibility.d.ts +0 -33
- package/dist/configs/vitest/scratch-run-root-compatibility.d.ts.map +0 -1
- package/dist/configs/vitest/scratch-run-root-compatibility.js +0 -137
- package/dist/configs/vitest/scratch-run-root-compatibility.js.map +0 -1
- package/dist/configs/vitest/scratch-run-root-intent.d.ts +0 -66
- package/dist/configs/vitest/scratch-run-root-intent.d.ts.map +0 -1
- package/dist/configs/vitest/scratch-run-root-intent.js +0 -183
- package/dist/configs/vitest/scratch-run-root-intent.js.map +0 -1
- package/dist/configs/vitest/scratch-setup.d.ts +0 -46
- package/dist/configs/vitest/scratch-setup.d.ts.map +0 -1
- package/dist/configs/vitest/scratch-setup.js +0 -226
- package/dist/configs/vitest/scratch-setup.js.map +0 -1
- package/dist/configs/vitest/scratch-supervision-intent.d.ts +0 -8
- package/dist/configs/vitest/scratch-supervision-intent.d.ts.map +0 -1
- package/dist/configs/vitest/scratch-supervision-intent.js +0 -125
- package/dist/configs/vitest/scratch-supervision-intent.js.map +0 -1
- package/dist/configs/vitest/scratch-supervision-protocol.d.ts +0 -12
- package/dist/configs/vitest/scratch-supervision-protocol.d.ts.map +0 -1
- package/dist/configs/vitest/scratch-supervision-protocol.js +0 -230
- package/dist/configs/vitest/scratch-supervision-protocol.js.map +0 -1
- package/dist/configs/vitest/scratch-supervision.d.ts +0 -69
- package/dist/configs/vitest/scratch-supervision.d.ts.map +0 -1
- package/dist/configs/vitest/scratch-supervision.js +0 -244
- package/dist/configs/vitest/scratch-supervision.js.map +0 -1
- package/dist/configs/vitest/scratch-sweep.d.ts +0 -66
- package/dist/configs/vitest/scratch-sweep.d.ts.map +0 -1
- package/dist/configs/vitest/scratch-sweep.js +0 -82
- package/dist/configs/vitest/scratch-sweep.js.map +0 -1
- package/dist/configs/vitest/scratch-tmpdir-trust.d.ts +0 -48
- package/dist/configs/vitest/scratch-tmpdir-trust.d.ts.map +0 -1
- package/dist/configs/vitest/scratch-tmpdir-trust.js +0 -194
- package/dist/configs/vitest/scratch-tmpdir-trust.js.map +0 -1
- package/dist/configs/vitest/scratch.d.ts +0 -19
- package/dist/configs/vitest/scratch.d.ts.map +0 -1
- package/dist/configs/vitest/scratch.js +0 -34
- package/dist/configs/vitest/scratch.js.map +0 -1
- package/dist/configs/vitest/synthesis-scratch-reclaim.d.ts +0 -86
- package/dist/configs/vitest/synthesis-scratch-reclaim.d.ts.map +0 -1
- package/dist/configs/vitest/synthesis-scratch-reclaim.js +0 -226
- package/dist/configs/vitest/synthesis-scratch-reclaim.js.map +0 -1
|
@@ -0,0 +1,566 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
// This file is managed by Lisa and IS replaced on each `lisa` run.
|
|
3
|
+
// Do not edit directly — durable changes belong upstream in Lisa.
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* Run a test command at push, narrowed to the tests the change can affect
|
|
7
|
+
* (CodySwannGT/lisa#4600). The decisions are in `lib/affected-tests.mjs`; this
|
|
8
|
+
* file gathers their inputs (git, `.lisa.config.json`, the access map) and
|
|
9
|
+
* runs the command.
|
|
10
|
+
*
|
|
11
|
+
* Usage:
|
|
12
|
+
* node scripts/lisa-affected-tests.mjs [--fetch <script>] -- <full test command…>
|
|
13
|
+
*
|
|
14
|
+
* The command after `--` is the FULL command, exactly as the push gate ran it
|
|
15
|
+
* before. With `pushGate.affectedTests` off it runs unchanged and this prints
|
|
16
|
+
* nothing. With it on, the command runs unchanged whenever a full-suite reason
|
|
17
|
+
* holds (the reason is printed), or with its `vitest run` rewritten to
|
|
18
|
+
* `vitest related --run <changed files> <map-selected tests>` otherwise.
|
|
19
|
+
*
|
|
20
|
+
* `--fetch <script>` names the script that downloads the access map
|
|
21
|
+
* (`--base <sha> --out <dir>`, exit 1 when there is none). Without it, or when
|
|
22
|
+
* it fails or takes too long, a map already on disk is used if it is still
|
|
23
|
+
* valid for this branch; otherwise the full suite runs.
|
|
24
|
+
* @module lisa-affected-tests
|
|
25
|
+
*/
|
|
26
|
+
import { spawnSync } from "node:child_process";
|
|
27
|
+
import {
|
|
28
|
+
existsSync,
|
|
29
|
+
mkdirSync,
|
|
30
|
+
mkdtempSync,
|
|
31
|
+
readFileSync,
|
|
32
|
+
realpathSync,
|
|
33
|
+
rmSync,
|
|
34
|
+
writeFileSync,
|
|
35
|
+
} from "node:fs";
|
|
36
|
+
import { tmpdir } from "node:os";
|
|
37
|
+
import { join } from "node:path";
|
|
38
|
+
|
|
39
|
+
import {
|
|
40
|
+
DEFAULT_MAX_AGE_DAYS,
|
|
41
|
+
MAX_AGE_ENV,
|
|
42
|
+
PARTIAL_COVERAGE_SKIP_REASON,
|
|
43
|
+
SELECTION_REPORT_ENV,
|
|
44
|
+
affectedTestsSettings,
|
|
45
|
+
changedFileCoverage,
|
|
46
|
+
coverageDeclaredAtPush,
|
|
47
|
+
coverageEscalationLines,
|
|
48
|
+
excludedBy,
|
|
49
|
+
explainSelection,
|
|
50
|
+
fullSuiteEscalation,
|
|
51
|
+
measuresCoverage,
|
|
52
|
+
narrowable,
|
|
53
|
+
partialArgv,
|
|
54
|
+
recordedTriggers,
|
|
55
|
+
selectAffectedTests,
|
|
56
|
+
staleMapReason,
|
|
57
|
+
} from "./lib/affected-tests.mjs";
|
|
58
|
+
import { invokedAsScript } from "./lib/invoked-as-script.mjs";
|
|
59
|
+
import { withPushGateDefaults } from "./lib/push-gate-defaults.mjs";
|
|
60
|
+
|
|
61
|
+
/** Where the map lives, relative to the repository root (gitignored). */
|
|
62
|
+
export const MAP_DIR = ".lisa/test-access-map";
|
|
63
|
+
|
|
64
|
+
/** Who speaks in this selector's lines. */
|
|
65
|
+
const SUBJECT = "affected tests";
|
|
66
|
+
|
|
67
|
+
/** The coverage mode that holds each changed file to the floor. */
|
|
68
|
+
const CHANGED_FILES = "changed-files";
|
|
69
|
+
|
|
70
|
+
/** How long a failed download is remembered before it is tried again. */
|
|
71
|
+
const MISS_TTL_MS = 15 * 60_000;
|
|
72
|
+
|
|
73
|
+
/** How long a map download may take before the push stops waiting for it. */
|
|
74
|
+
const FETCH_TIMEOUT_MS = 60_000;
|
|
75
|
+
|
|
76
|
+
/** Git's location variables, which a hook exports to its children. */
|
|
77
|
+
const GIT_LOCATION_ENV = new Set([
|
|
78
|
+
"GIT_DIR",
|
|
79
|
+
"GIT_WORK_TREE",
|
|
80
|
+
"GIT_INDEX_FILE",
|
|
81
|
+
"GIT_PREFIX",
|
|
82
|
+
]);
|
|
83
|
+
|
|
84
|
+
/**
|
|
85
|
+
* Narrow only when the push gate runner asked for it.
|
|
86
|
+
*
|
|
87
|
+
* A host's shared `test:cov:unit` script carries the selector
|
|
88
|
+
* (CodySwannGT/lisa#4611), and a developer who runs that script by hand
|
|
89
|
+
* expects every test. With this flag the command runs unchanged unless the
|
|
90
|
+
* gate runner set `LISA_SELECTION_REPORT`, which it does only at push (and
|
|
91
|
+
* for `lisa check`, which runs the push gates ahead of the push).
|
|
92
|
+
*/
|
|
93
|
+
export const PUSH_ONLY_FLAG = "--push-only";
|
|
94
|
+
|
|
95
|
+
/**
|
|
96
|
+
* Split `[--fetch <script>] [--push-only] -- <command…>`.
|
|
97
|
+
* @param {ReadonlyArray<string>} argv Arguments after the script.
|
|
98
|
+
* @returns {{fetch: string|undefined, pushOnly: boolean, command: string[]}} Parsed options.
|
|
99
|
+
*/
|
|
100
|
+
export function parseArgs(argv) {
|
|
101
|
+
const separator = argv.indexOf("--");
|
|
102
|
+
const own = separator === -1 ? [] : argv.slice(0, separator);
|
|
103
|
+
const command = separator === -1 ? [] : argv.slice(separator + 1);
|
|
104
|
+
const at = own.indexOf("--fetch");
|
|
105
|
+
return {
|
|
106
|
+
fetch: at === -1 ? undefined : own[at + 1],
|
|
107
|
+
pushOnly: own.includes(PUSH_ONLY_FLAG),
|
|
108
|
+
command,
|
|
109
|
+
};
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
/**
|
|
113
|
+
* Run git in `root`, without the location variables a hook exports.
|
|
114
|
+
* @param {string} root Repository root.
|
|
115
|
+
* @param {string[]} args Git arguments.
|
|
116
|
+
* @returns {string|null} Trimmed stdout, or null when git fails.
|
|
117
|
+
*/
|
|
118
|
+
function git(root, args) {
|
|
119
|
+
const env = Object.fromEntries(
|
|
120
|
+
Object.entries(process.env).filter(([key]) => !GIT_LOCATION_ENV.has(key))
|
|
121
|
+
);
|
|
122
|
+
const child = spawnSync("git", args, {
|
|
123
|
+
cwd: root,
|
|
124
|
+
env,
|
|
125
|
+
encoding: "utf8",
|
|
126
|
+
maxBuffer: 64 * 1024 * 1024,
|
|
127
|
+
});
|
|
128
|
+
return child.status === 0 ? child.stdout.trim() : null;
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
/**
|
|
132
|
+
* Parse a JSON file, or undefined when it is missing or unreadable.
|
|
133
|
+
* @param {string} file Path.
|
|
134
|
+
* @returns {any} Parsed value.
|
|
135
|
+
*/
|
|
136
|
+
function readJson(file) {
|
|
137
|
+
try {
|
|
138
|
+
return JSON.parse(readFileSync(file, "utf8"));
|
|
139
|
+
} catch {
|
|
140
|
+
return undefined;
|
|
141
|
+
}
|
|
142
|
+
}
|
|
143
|
+
|
|
144
|
+
/**
|
|
145
|
+
* The commit this branch left the default branch at.
|
|
146
|
+
* @param {string} root Repository root.
|
|
147
|
+
* @param {NodeJS.ProcessEnv} env Environment (`LISA_AFFECTED_BASE_REF` overrides).
|
|
148
|
+
* @returns {{sha: string, ref: string}|null} The merge-base, or null.
|
|
149
|
+
*/
|
|
150
|
+
function mergeBaseOf(root, env) {
|
|
151
|
+
const symbolic = git(root, [
|
|
152
|
+
"symbolic-ref",
|
|
153
|
+
"--quiet",
|
|
154
|
+
"refs/remotes/origin/HEAD",
|
|
155
|
+
]);
|
|
156
|
+
const ref =
|
|
157
|
+
env.LISA_AFFECTED_BASE_REF ||
|
|
158
|
+
(symbolic ? symbolic.replace(/^refs\/remotes\//, "") : "origin/main");
|
|
159
|
+
const sha = git(root, ["merge-base", "HEAD", ref]);
|
|
160
|
+
return sha ? { sha, ref } : null;
|
|
161
|
+
}
|
|
162
|
+
|
|
163
|
+
/**
|
|
164
|
+
* Files that differ between the merge-base and the working tree.
|
|
165
|
+
* @param {string} root Repository root.
|
|
166
|
+
* @param {string} base Merge-base.
|
|
167
|
+
* @returns {Array<{path: string, status: "added"|"modified"|"deleted"}>|null} Changes, or null.
|
|
168
|
+
*/
|
|
169
|
+
function changedFiles(root, base) {
|
|
170
|
+
const tracked = git(root, ["diff", "--name-status", "--no-renames", base]);
|
|
171
|
+
const untracked = git(root, ["ls-files", "--others", "--exclude-standard"]);
|
|
172
|
+
if (tracked === null || untracked === null) return null;
|
|
173
|
+
const status = letter =>
|
|
174
|
+
letter === "A" ? "added" : letter === "D" ? "deleted" : "modified";
|
|
175
|
+
const entries = tracked
|
|
176
|
+
.split("\n")
|
|
177
|
+
.filter(Boolean)
|
|
178
|
+
.map(line => {
|
|
179
|
+
const [letter, ...rest] = line.split("\t");
|
|
180
|
+
return { path: rest.join("\t"), status: status(letter[0]) };
|
|
181
|
+
});
|
|
182
|
+
const seen = new Set(entries.map(entry => entry.path));
|
|
183
|
+
const added = untracked
|
|
184
|
+
.split("\n")
|
|
185
|
+
.filter(file => file && !seen.has(file))
|
|
186
|
+
.map(file => ({ path: file, status: "added" }));
|
|
187
|
+
return [...entries, ...added];
|
|
188
|
+
}
|
|
189
|
+
|
|
190
|
+
/**
|
|
191
|
+
* Make sure a map for `base` is on disk, downloading it when needed.
|
|
192
|
+
*
|
|
193
|
+
* A map already downloaded for this exact base is reused without asking the
|
|
194
|
+
* network. A download that found nothing is remembered for a few minutes so
|
|
195
|
+
* a run of pushes does not pay for it each time.
|
|
196
|
+
* @param {object} input Inputs.
|
|
197
|
+
* @param {string} input.root Repository root.
|
|
198
|
+
* @param {string} input.base Merge-base.
|
|
199
|
+
* @param {string|undefined} input.fetch The download script.
|
|
200
|
+
* @param {(line: string) => void} input.out Output.
|
|
201
|
+
* @param {() => Date} input.now Clock.
|
|
202
|
+
* @returns {void}
|
|
203
|
+
*/
|
|
204
|
+
function ensureMap({ root, base, fetch, out, now }) {
|
|
205
|
+
const dir = join(root, MAP_DIR);
|
|
206
|
+
if (readJson(join(dir, "meta.json"))?.requestedBase === base) return;
|
|
207
|
+
if (!fetch || !existsSync(join(root, fetch))) return;
|
|
208
|
+
const missFile = join(dir, "miss.json");
|
|
209
|
+
const miss = readJson(missFile);
|
|
210
|
+
if (
|
|
211
|
+
miss?.requestedBase === base &&
|
|
212
|
+
now().getTime() - Date.parse(miss.at) < MISS_TTL_MS
|
|
213
|
+
) {
|
|
214
|
+
return;
|
|
215
|
+
}
|
|
216
|
+
out(
|
|
217
|
+
`🎯 affected tests: downloading the test access map for ${base.slice(0, 12)}…`
|
|
218
|
+
);
|
|
219
|
+
const child = spawnSync(
|
|
220
|
+
process.execPath,
|
|
221
|
+
[join(root, fetch), "--base", base, "--out", dir],
|
|
222
|
+
{ cwd: root, encoding: "utf8", timeout: FETCH_TIMEOUT_MS }
|
|
223
|
+
);
|
|
224
|
+
if (child.status === 0) return;
|
|
225
|
+
const why =
|
|
226
|
+
child.error?.code === "ETIMEDOUT"
|
|
227
|
+
? `it took longer than ${FETCH_TIMEOUT_MS / 1000}s`
|
|
228
|
+
: (child.stderr || "").trim().split("\n").at(-1) || "it failed";
|
|
229
|
+
out(` No new map: ${why}.`);
|
|
230
|
+
mkdirSync(dir, { recursive: true });
|
|
231
|
+
writeFileSync(
|
|
232
|
+
missFile,
|
|
233
|
+
`${JSON.stringify({ requestedBase: base, at: now().toISOString() })}\n`
|
|
234
|
+
);
|
|
235
|
+
}
|
|
236
|
+
|
|
237
|
+
/**
|
|
238
|
+
* Read the map, or say why it cannot be used.
|
|
239
|
+
* @param {object} input Inputs.
|
|
240
|
+
* @param {string} input.root Repository root.
|
|
241
|
+
* @param {string} input.base Merge-base.
|
|
242
|
+
* @param {NodeJS.ProcessEnv} input.env Environment.
|
|
243
|
+
* @param {() => Date} input.now Clock.
|
|
244
|
+
* @returns {{map: Record<string, string[]>, meta: Record<string, any>}|{problem: string}} The map.
|
|
245
|
+
*/
|
|
246
|
+
function loadMap({ root, base, env, now }) {
|
|
247
|
+
const dir = join(root, MAP_DIR);
|
|
248
|
+
const meta = readJson(join(dir, "meta.json"));
|
|
249
|
+
if (meta === undefined) {
|
|
250
|
+
return {
|
|
251
|
+
problem:
|
|
252
|
+
"missing map: no test access map is available for this branch's base",
|
|
253
|
+
};
|
|
254
|
+
}
|
|
255
|
+
const configured = Number(env[MAX_AGE_ENV]);
|
|
256
|
+
const maxAgeDays =
|
|
257
|
+
env[MAX_AGE_ENV] !== undefined &&
|
|
258
|
+
env[MAX_AGE_ENV] !== "" &&
|
|
259
|
+
Number.isFinite(configured)
|
|
260
|
+
? configured
|
|
261
|
+
: DEFAULT_MAX_AGE_DAYS;
|
|
262
|
+
const stale = staleMapReason({
|
|
263
|
+
meta,
|
|
264
|
+
mergeBase: base,
|
|
265
|
+
isAncestor: (a, b) =>
|
|
266
|
+
git(root, ["merge-base", "--is-ancestor", a, b]) !== null,
|
|
267
|
+
now: now(),
|
|
268
|
+
maxAgeDays,
|
|
269
|
+
});
|
|
270
|
+
if (stale) return { problem: stale };
|
|
271
|
+
const map = readJson(join(dir, "map.json"));
|
|
272
|
+
if (!map || typeof map !== "object" || Array.isArray(map)) {
|
|
273
|
+
return {
|
|
274
|
+
problem: "missing map: the downloaded map file could not be read",
|
|
275
|
+
};
|
|
276
|
+
}
|
|
277
|
+
return { map, meta };
|
|
278
|
+
}
|
|
279
|
+
|
|
280
|
+
/**
|
|
281
|
+
* The project's coverage floors, from `vitest.thresholds.json`'s `global`.
|
|
282
|
+
* @param {string} root Repository root.
|
|
283
|
+
* @returns {Record<string, number>|null} Floors, or null when there are none.
|
|
284
|
+
*/
|
|
285
|
+
function thresholdsOf(root) {
|
|
286
|
+
const floors = readJson(join(root, "vitest.thresholds.json"))?.global;
|
|
287
|
+
return floors && typeof floors === "object" ? floors : null;
|
|
288
|
+
}
|
|
289
|
+
|
|
290
|
+
/**
|
|
291
|
+
* Decide what to run.
|
|
292
|
+
* @param {object} input Inputs.
|
|
293
|
+
* @param {string} input.root Repository root.
|
|
294
|
+
* @param {string[]} input.command The full command.
|
|
295
|
+
* @param {string|undefined} input.fetch The download script.
|
|
296
|
+
* @param {Record<string, any>} input.config Parsed `.lisa.config.json`.
|
|
297
|
+
* @param {"full"|"changed-files"|"skip"} input.mode Coverage mode.
|
|
298
|
+
* @param {NodeJS.ProcessEnv} input.env Environment.
|
|
299
|
+
* @param {(line: string) => void} input.out Output.
|
|
300
|
+
* @param {() => Date} input.now Clock.
|
|
301
|
+
* @returns {{selection: import("./lib/affected-tests.mjs").Selection, coverage: "measured"|"changed-files"|"skip"|"none"}} The plan.
|
|
302
|
+
*/
|
|
303
|
+
export function plan({ root, command, fetch, config, mode, env, out, now }) {
|
|
304
|
+
const coverageWanted = measuresCoverage(command);
|
|
305
|
+
const fullRun = reason => ({
|
|
306
|
+
selection: { kind: "full", reason, tests: [], related: [], unread: [] },
|
|
307
|
+
coverage: coverageWanted ? "measured" : "none",
|
|
308
|
+
});
|
|
309
|
+
if (env.CI || env.GITHUB_ACTIONS) {
|
|
310
|
+
return fullRun("this is a CI run, and CI always runs every test");
|
|
311
|
+
}
|
|
312
|
+
if (!narrowable(command)) {
|
|
313
|
+
return fullRun(
|
|
314
|
+
"the test command is not a `vitest run`, so it cannot be narrowed"
|
|
315
|
+
);
|
|
316
|
+
}
|
|
317
|
+
const declared = coverageDeclaredAtPush(config.gates) && coverageWanted;
|
|
318
|
+
if (declared && mode === "full") {
|
|
319
|
+
return fullRun(
|
|
320
|
+
'coverage-adequacy is checked at push and needs every test, because pushGate.affectedCoverage is "full"'
|
|
321
|
+
);
|
|
322
|
+
}
|
|
323
|
+
if (declared && mode === CHANGED_FILES && !thresholdsOf(root)) {
|
|
324
|
+
return fullRun(
|
|
325
|
+
"there is no vitest.thresholds.json to hold the changed files to"
|
|
326
|
+
);
|
|
327
|
+
}
|
|
328
|
+
const base = mergeBaseOf(root, env);
|
|
329
|
+
if (!base) {
|
|
330
|
+
return fullRun("could not find where this branch left the default branch");
|
|
331
|
+
}
|
|
332
|
+
const changed = changedFiles(root, base.sha);
|
|
333
|
+
if (!changed) return fullRun("could not list the changed files");
|
|
334
|
+
if (changed.length === 0) {
|
|
335
|
+
return fullRun(
|
|
336
|
+
`nothing differs from ${base.ref}, so there is no change to narrow to`
|
|
337
|
+
);
|
|
338
|
+
}
|
|
339
|
+
ensureMap({ root, base: base.sha, fetch, out, now });
|
|
340
|
+
const loaded = loadMap({ root, base: base.sha, env, now });
|
|
341
|
+
if ("problem" in loaded) return fullRun(loaded.problem);
|
|
342
|
+
const atMapBase = new Set(
|
|
343
|
+
(git(root, ["ls-tree", "-r", "--name-only", loaded.meta.baseSha]) ?? "")
|
|
344
|
+
.split("\n")
|
|
345
|
+
.filter(Boolean)
|
|
346
|
+
);
|
|
347
|
+
const selection = selectAffectedTests({
|
|
348
|
+
changed: changed.map(entry => ({
|
|
349
|
+
...entry,
|
|
350
|
+
existedAtMapBase: atMapBase.has(entry.path),
|
|
351
|
+
})),
|
|
352
|
+
map: loaded.map,
|
|
353
|
+
excluded: excludedBy(command),
|
|
354
|
+
exists: file => existsSync(join(root, file)),
|
|
355
|
+
testFiles: (
|
|
356
|
+
git(root, ["ls-files", "--cached", "--others", "--exclude-standard"]) ??
|
|
357
|
+
""
|
|
358
|
+
)
|
|
359
|
+
.split("\n")
|
|
360
|
+
.filter(Boolean),
|
|
361
|
+
triggers: recordedTriggers(loaded.meta),
|
|
362
|
+
});
|
|
363
|
+
if (selection.kind === "full") {
|
|
364
|
+
return { selection, coverage: coverageWanted ? "measured" : "none" };
|
|
365
|
+
}
|
|
366
|
+
if (!declared) return { selection, coverage: "none" };
|
|
367
|
+
if (
|
|
368
|
+
mode === CHANGED_FILES &&
|
|
369
|
+
selection.tests.length === 0 &&
|
|
370
|
+
selection.related.length > 0
|
|
371
|
+
) {
|
|
372
|
+
return fullRun(
|
|
373
|
+
"no test reaches the changed source files, so their coverage can only be measured by the full suite"
|
|
374
|
+
);
|
|
375
|
+
}
|
|
376
|
+
return { selection, coverage: mode };
|
|
377
|
+
}
|
|
378
|
+
|
|
379
|
+
/** What each coverage outcome means, for the explanation. */
|
|
380
|
+
const COVERAGE_NOTE = Object.freeze({
|
|
381
|
+
measured: "measured over the full suite, as before",
|
|
382
|
+
none: "not measured at push (coverage-adequacy is not checked at push)",
|
|
383
|
+
[CHANGED_FILES]:
|
|
384
|
+
"each changed source file is held to vitest.thresholds.json on its own; one below it sends the push to the full suite",
|
|
385
|
+
skip: `not measured; coverage-adequacy reports SKIPPED (${PARTIAL_COVERAGE_SKIP_REASON})`,
|
|
386
|
+
});
|
|
387
|
+
|
|
388
|
+
/**
|
|
389
|
+
* Run a command with inherited output and return its exit code.
|
|
390
|
+
* @param {string[]} argv Command.
|
|
391
|
+
* @param {string} cwd Working directory.
|
|
392
|
+
* @returns {number} Exit code (1 for a signal or a spawn failure).
|
|
393
|
+
*/
|
|
394
|
+
function run(argv, cwd) {
|
|
395
|
+
const child = spawnSync(argv[0], argv.slice(1), { cwd, stdio: "inherit" });
|
|
396
|
+
return typeof child.status === "number" ? child.status : 1;
|
|
397
|
+
}
|
|
398
|
+
|
|
399
|
+
/**
|
|
400
|
+
* The CLI.
|
|
401
|
+
* @param {string[]} argv Arguments after the script.
|
|
402
|
+
* @param {object} [deps] Effects, injectable for tests.
|
|
403
|
+
* @param {NodeJS.ProcessEnv} [deps.env] Environment.
|
|
404
|
+
* @param {string} [deps.cwd] Working directory.
|
|
405
|
+
* @param {(line: string) => void} [deps.out] Output.
|
|
406
|
+
* @param {() => Date} [deps.now] Clock.
|
|
407
|
+
* @returns {number} Exit code.
|
|
408
|
+
*/
|
|
409
|
+
export function main(argv, deps = {}) {
|
|
410
|
+
const env = deps.env ?? process.env;
|
|
411
|
+
const out = deps.out ?? (line => console.log(line));
|
|
412
|
+
const now = deps.now ?? (() => new Date());
|
|
413
|
+
const { fetch, pushOnly, command } = parseArgs(argv);
|
|
414
|
+
if (command.length === 0) {
|
|
415
|
+
console.error(
|
|
416
|
+
"usage: lisa-affected-tests.mjs [--fetch <script>] [--push-only] -- <test command…>"
|
|
417
|
+
);
|
|
418
|
+
return 2;
|
|
419
|
+
}
|
|
420
|
+
const cwd = deps.cwd ?? process.cwd();
|
|
421
|
+
if (pushOnly && !env[SELECTION_REPORT_ENV]) return run(command, cwd);
|
|
422
|
+
const root = git(cwd, ["rev-parse", "--show-toplevel"]) ?? cwd;
|
|
423
|
+
// The stack's defaults under the project's own keys (CodySwannGT/lisa#4611).
|
|
424
|
+
const config = withPushGateDefaults(
|
|
425
|
+
readJson(join(root, ".lisa.config.json")) ?? {},
|
|
426
|
+
root
|
|
427
|
+
);
|
|
428
|
+
let settings;
|
|
429
|
+
try {
|
|
430
|
+
settings = affectedTestsSettings(config);
|
|
431
|
+
} catch (error) {
|
|
432
|
+
console.error(
|
|
433
|
+
`🚫 affected tests: ${error.message} Fix pushGate in .lisa.config.json. Nothing ran.`
|
|
434
|
+
);
|
|
435
|
+
return 2;
|
|
436
|
+
}
|
|
437
|
+
if (!settings.enabled) return run(command, cwd);
|
|
438
|
+
|
|
439
|
+
const chosen = plan({
|
|
440
|
+
root,
|
|
441
|
+
command,
|
|
442
|
+
fetch,
|
|
443
|
+
config,
|
|
444
|
+
mode: settings.coverage,
|
|
445
|
+
env,
|
|
446
|
+
out,
|
|
447
|
+
now,
|
|
448
|
+
});
|
|
449
|
+
const { selection, coverage } = chosen;
|
|
450
|
+
if (env[SELECTION_REPORT_ENV]) {
|
|
451
|
+
try {
|
|
452
|
+
writeFileSync(
|
|
453
|
+
env[SELECTION_REPORT_ENV],
|
|
454
|
+
`${JSON.stringify({ selection: selection.kind, reason: selection.reason ?? null, coverage, tests: selection.tests.length })}\n`
|
|
455
|
+
);
|
|
456
|
+
} catch {
|
|
457
|
+
// Without the report the runner reads nothing and reports as before.
|
|
458
|
+
}
|
|
459
|
+
}
|
|
460
|
+
for (const line of explainSelection(selection, COVERAGE_NOTE[coverage]))
|
|
461
|
+
out(line);
|
|
462
|
+
if (selection.kind === "full") return run(command, cwd);
|
|
463
|
+
// Only a selection with neither a test nor a file for Vitest's import graph
|
|
464
|
+
// has nothing to run. With changed files left, `vitest related` still runs:
|
|
465
|
+
// the map may miss an importer that the import graph finds.
|
|
466
|
+
if (selection.tests.length === 0 && selection.related.length === 0) {
|
|
467
|
+
out(
|
|
468
|
+
" No unit test can reach the changed files, so there is nothing to run."
|
|
469
|
+
);
|
|
470
|
+
return 0;
|
|
471
|
+
}
|
|
472
|
+
|
|
473
|
+
const coverageDir =
|
|
474
|
+
coverage === CHANGED_FILES
|
|
475
|
+
? mkdtempSync(join(tmpdir(), "lisa-affected-coverage-"))
|
|
476
|
+
: undefined;
|
|
477
|
+
let escalation;
|
|
478
|
+
try {
|
|
479
|
+
const code = run(
|
|
480
|
+
partialArgv({
|
|
481
|
+
argv: command,
|
|
482
|
+
selection,
|
|
483
|
+
coverage: coverage === CHANGED_FILES ? "on" : "off",
|
|
484
|
+
coverageDir,
|
|
485
|
+
}),
|
|
486
|
+
cwd
|
|
487
|
+
);
|
|
488
|
+
if (code !== 0 || coverage !== CHANGED_FILES) return code;
|
|
489
|
+
escalation = checkChangedFiles({ root, coverageDir, selection, out });
|
|
490
|
+
} finally {
|
|
491
|
+
if (coverageDir) rmSync(coverageDir, { recursive: true, force: true });
|
|
492
|
+
}
|
|
493
|
+
if (escalation.length === 0) return 0;
|
|
494
|
+
return escalate({ lines: escalation, command, cwd, env, out });
|
|
495
|
+
}
|
|
496
|
+
|
|
497
|
+
/**
|
|
498
|
+
* Run the full command, as `full` mode does, after a partial run could not
|
|
499
|
+
* clear the changed files (CodySwannGT/lisa#4600: a push is never stricter
|
|
500
|
+
* than whole-repo coverage). Its verdict is the push's, and the report says
|
|
501
|
+
* a full run produced it, so the gate runner may remember the pass.
|
|
502
|
+
* @param {object} input Inputs.
|
|
503
|
+
* @param {string[]} input.lines Why, one line per reason.
|
|
504
|
+
* @param {string[]} input.command The full command.
|
|
505
|
+
* @param {string} input.cwd Working directory.
|
|
506
|
+
* @param {NodeJS.ProcessEnv} input.env Environment.
|
|
507
|
+
* @param {(line: string) => void} input.out Output.
|
|
508
|
+
* @returns {number} The full run's exit code.
|
|
509
|
+
*/
|
|
510
|
+
function escalate({ lines, command, cwd, env, out }) {
|
|
511
|
+
for (const line of lines) out(line);
|
|
512
|
+
if (env[SELECTION_REPORT_ENV]) {
|
|
513
|
+
try {
|
|
514
|
+
writeFileSync(
|
|
515
|
+
env[SELECTION_REPORT_ENV],
|
|
516
|
+
`${JSON.stringify({ selection: "full", reason: lines.join(" "), coverage: "measured", tests: 0, escalated: true })}\n`
|
|
517
|
+
);
|
|
518
|
+
} catch {
|
|
519
|
+
// Without the report the runner reads nothing and reports as before.
|
|
520
|
+
}
|
|
521
|
+
}
|
|
522
|
+
return run(command, cwd);
|
|
523
|
+
}
|
|
524
|
+
|
|
525
|
+
/**
|
|
526
|
+
* Hold each changed source file to the thresholds after a coverage-on run.
|
|
527
|
+
* @param {object} input Inputs.
|
|
528
|
+
* @param {string} input.root Repository root.
|
|
529
|
+
* @param {string} input.coverageDir Where the run wrote `coverage-summary.json`.
|
|
530
|
+
* @param {import("./lib/affected-tests.mjs").Selection} input.selection The selection.
|
|
531
|
+
* @param {(line: string) => void} input.out Output.
|
|
532
|
+
* @returns {string[]} Escalation lines; empty when every changed file meets its floor.
|
|
533
|
+
*/
|
|
534
|
+
function checkChangedFiles({ root, coverageDir, selection, out }) {
|
|
535
|
+
const summary = readJson(join(coverageDir, "coverage-summary.json"));
|
|
536
|
+
if (!summary) {
|
|
537
|
+
return [
|
|
538
|
+
fullSuiteEscalation(SUBJECT, "the partial run wrote no coverage summary"),
|
|
539
|
+
];
|
|
540
|
+
}
|
|
541
|
+
const verdict = changedFileCoverage({
|
|
542
|
+
summary,
|
|
543
|
+
root,
|
|
544
|
+
realRoot: realpathSync(root),
|
|
545
|
+
files: selection.related,
|
|
546
|
+
thresholds: thresholdsOf(root) ?? {},
|
|
547
|
+
});
|
|
548
|
+
if (verdict.shortfalls.length > 0) {
|
|
549
|
+
return coverageEscalationLines({
|
|
550
|
+
subject: SUBJECT,
|
|
551
|
+
files: selection.related,
|
|
552
|
+
shortfalls: verdict.shortfalls,
|
|
553
|
+
});
|
|
554
|
+
}
|
|
555
|
+
const outside = verdict.unmeasured.length
|
|
556
|
+
? `; ${verdict.unmeasured.length} are outside coverage`
|
|
557
|
+
: "";
|
|
558
|
+
out(
|
|
559
|
+
`✅ affected tests: ${verdict.measured.length} changed source file(s) meet the coverage floor${outside}`
|
|
560
|
+
);
|
|
561
|
+
return [];
|
|
562
|
+
}
|
|
563
|
+
|
|
564
|
+
if (invokedAsScript(import.meta.url)) {
|
|
565
|
+
process.exitCode = main(process.argv.slice(2));
|
|
566
|
+
}
|
|
@@ -16,6 +16,7 @@ import {
|
|
|
16
16
|
requireProof,
|
|
17
17
|
sha256,
|
|
18
18
|
verifyCurrentProvider,
|
|
19
|
+
verifyCurrentRun,
|
|
19
20
|
verifyDescriptorAttestation,
|
|
20
21
|
targetBranch,
|
|
21
22
|
} from "./lib/github-attestation-verifier.mjs";
|
|
@@ -77,6 +78,11 @@ function recoveryPermission(
|
|
|
77
78
|
const entry = policyEntry(config, directory);
|
|
78
79
|
requireProof(entry, "committed npm directory policy is absent");
|
|
79
80
|
const npmPolicySha256 = sha256(canonicalJson(entry));
|
|
81
|
+
// The hooks hold no Jira/Linear credential: the leaf body, owner and claim
|
|
82
|
+
// time are proved by the adapter at checkpoint and again before publication,
|
|
83
|
+
// and the signed recovery record binds them here (#4873).
|
|
84
|
+
// Only an explicit Jira/Linear tracker takes this path; anything else is checked as GitHub.
|
|
85
|
+
const vendor = ["jira", "linear"].includes(config.tracker);
|
|
80
86
|
verifyRecoveryOrigin(policy, descriptor, recovery, sha256(bytes), paths, {
|
|
81
87
|
npmPolicySha256,
|
|
82
88
|
proposalKey: sha256(
|
|
@@ -92,10 +98,13 @@ function recoveryPermission(
|
|
|
92
98
|
...signedProposalFields(descriptor),
|
|
93
99
|
})
|
|
94
100
|
),
|
|
95
|
-
leafBodySha256:
|
|
101
|
+
leafBodySha256: vendor
|
|
102
|
+
? recovery.leafBodySha256
|
|
103
|
+
: sha256(context.issue.body),
|
|
96
104
|
commit: predictedCommit(descriptor, messageBytes),
|
|
97
105
|
maintainer: entry.maintainer,
|
|
98
106
|
recoverySha256: sha256(recoveryBytes),
|
|
107
|
+
...(vendor ? { tracker: true, claim: null } : {}),
|
|
99
108
|
});
|
|
100
109
|
requireProof(
|
|
101
110
|
privateBytes(paths.recovery, 65_536).equals(recoveryBytes) &&
|
|
@@ -105,8 +114,14 @@ function recoveryPermission(
|
|
|
105
114
|
}
|
|
106
115
|
|
|
107
116
|
/** Keep unchanged local authorization together without obscuring the canonical phase. */
|
|
108
|
-
function verifyLocalProposal(
|
|
109
|
-
|
|
117
|
+
function verifyLocalProposal(
|
|
118
|
+
descriptor,
|
|
119
|
+
messageBytes,
|
|
120
|
+
reference,
|
|
121
|
+
policy,
|
|
122
|
+
tracker
|
|
123
|
+
) {
|
|
124
|
+
localDescriptor(descriptor, messageBytes, reference, policy, tracker);
|
|
110
125
|
npmProposal(descriptor, git);
|
|
111
126
|
requireProof(
|
|
112
127
|
descriptor.proposalKey ===
|
|
@@ -130,7 +145,8 @@ function verifyFinalSnapshot(
|
|
|
130
145
|
descriptor,
|
|
131
146
|
messageFile,
|
|
132
147
|
reference,
|
|
133
|
-
policy
|
|
148
|
+
policy,
|
|
149
|
+
tracker
|
|
134
150
|
) {
|
|
135
151
|
requireProof(
|
|
136
152
|
privateBytes(paths.bundle, 1_048_576).equals(bundleBytes),
|
|
@@ -144,7 +160,8 @@ function verifyFinalSnapshot(
|
|
|
144
160
|
descriptor,
|
|
145
161
|
privateBytes(messageFile, 65_536, false),
|
|
146
162
|
reference,
|
|
147
|
-
policy
|
|
163
|
+
policy,
|
|
164
|
+
tracker
|
|
148
165
|
);
|
|
149
166
|
}
|
|
150
167
|
|
|
@@ -164,7 +181,13 @@ export function verifyAutomationProvenance(messageFile) {
|
|
|
164
181
|
const { paths, optional, bytes, bundleBytes, descriptor } =
|
|
165
182
|
withProvenancePhase(LOCAL_PROOF, proofSnapshot);
|
|
166
183
|
withProvenancePhase(LOCAL_PROOF, () =>
|
|
167
|
-
verifyLocalProposal(
|
|
184
|
+
verifyLocalProposal(
|
|
185
|
+
descriptor,
|
|
186
|
+
messageBytes,
|
|
187
|
+
reference,
|
|
188
|
+
policy,
|
|
189
|
+
config.tracker
|
|
190
|
+
)
|
|
168
191
|
);
|
|
169
192
|
withProvenancePhase(LOCAL_PROOF, () =>
|
|
170
193
|
assertCommittedTarget(config, descriptor)
|
|
@@ -198,8 +221,11 @@ export function verifyAutomationProvenance(messageFile) {
|
|
|
198
221
|
withProvenancePhase("ordinary-signature", () =>
|
|
199
222
|
verifyDescriptorAttestation(policy, descriptor, paths, sha256(bytes))
|
|
200
223
|
);
|
|
224
|
+
// A Jira/Linear claim is proved by the publisher's adapter, never a GitHub comment.
|
|
201
225
|
withProvenancePhase("ordinary-provider", () =>
|
|
202
|
-
|
|
226
|
+
(!["jira", "linear"].includes(config.tracker)
|
|
227
|
+
? verifyCurrentProvider
|
|
228
|
+
: verifyCurrentRun)(policy, descriptor)
|
|
203
229
|
);
|
|
204
230
|
}
|
|
205
231
|
verifyFinalSnapshot(
|
|
@@ -209,7 +235,8 @@ export function verifyAutomationProvenance(messageFile) {
|
|
|
209
235
|
descriptor,
|
|
210
236
|
messageFile,
|
|
211
237
|
reference,
|
|
212
|
-
policy
|
|
238
|
+
policy,
|
|
239
|
+
config.tracker
|
|
213
240
|
);
|
|
214
241
|
return true;
|
|
215
242
|
});
|