@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,686 @@
|
|
|
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 the Rails pre-push gates with the pass cache and headroom admission
|
|
7
|
+
* (CodySwannGT/lisa#4613).
|
|
8
|
+
*
|
|
9
|
+
* A Rails host's pre-push used to run RSpec, Brakeman, Reek, Flog and Flay on
|
|
10
|
+
* every push, remembering no pass and ignoring every other heavy run on the
|
|
11
|
+
* machine. Each lefthook pre-push command now calls this script with one gate
|
|
12
|
+
* name, and `lisa check` calls it with `--all`, so both run the SAME commands
|
|
13
|
+
* through the SAME machinery Lisa's own gate runner uses:
|
|
14
|
+
*
|
|
15
|
+
* - The pass cache (`lib/gate-pass-cache.mjs`, `pushGate.cache`). Brakeman,
|
|
16
|
+
* Reek, Flog, Flay and RSpec are cacheable; a hit prints
|
|
17
|
+
* `CACHED PASS (<key>)`. `Gemfile.lock`, `ruby -v`, `bundle -v` and the
|
|
18
|
+
* effective `pushGate` block enter the key. The mutation gate is never
|
|
19
|
+
* cached, and neither is an RSpec run that ran only a partial selection:
|
|
20
|
+
* it proved a slice, not the tree (the same contract as `lisa-run-gates.mjs`).
|
|
21
|
+
* - Headroom admission (`lisa admit`, `pushGate.admission`). RSpec, and the
|
|
22
|
+
* mutation gate when `mutation.gate.yml` enables it, start only when the
|
|
23
|
+
* machine has headroom; the wait names the busy runs. Static analysers run
|
|
24
|
+
* without admission.
|
|
25
|
+
* - A full RSpec run uses `parallel_rspec -n <admitted workers>` when the
|
|
26
|
+
* host's `config/database.yml` names its test database with
|
|
27
|
+
* `TEST_ENV_NUMBER`. Lisa never edits that file; without the pattern the run
|
|
28
|
+
* is serial and one line says what to add.
|
|
29
|
+
*
|
|
30
|
+
* Both switches are ON by default for a Rails project โ detected as
|
|
31
|
+
* `src/detection/detectors/rails.ts` does, by `bin/rails` or else
|
|
32
|
+
* `config/application.rb` โ and an explicit `false` in `.lisa.config.json`
|
|
33
|
+
* wins.
|
|
34
|
+
*
|
|
35
|
+
* Work-item traceability and the history scan stay in
|
|
36
|
+
* `lisa-rails-prepush.mjs`, untouched and never cached: they read the pushed
|
|
37
|
+
* refs from Git's stdin, which this script never sees.
|
|
38
|
+
* @module lisa-rails-gates
|
|
39
|
+
*/
|
|
40
|
+
import { spawnSync } from "node:child_process";
|
|
41
|
+
import { createHash } from "node:crypto";
|
|
42
|
+
import { existsSync, mkdirSync, readFileSync, writeFileSync } from "node:fs";
|
|
43
|
+
import { availableParallelism } from "node:os";
|
|
44
|
+
import { dirname, join } from "node:path";
|
|
45
|
+
import { fileURLToPath } from "node:url";
|
|
46
|
+
|
|
47
|
+
import {
|
|
48
|
+
openSelectionReports,
|
|
49
|
+
SELECTION_REPORT_ENV,
|
|
50
|
+
} from "./lib/affected-tests.mjs";
|
|
51
|
+
import { openGatePassCache } from "./lib/gate-pass-cache.mjs";
|
|
52
|
+
import { invokedAsScript } from "./lib/invoked-as-script.mjs";
|
|
53
|
+
import { runStartOfRunSweep } from "./lib/lisa-cleanup-sweep.mjs";
|
|
54
|
+
import {
|
|
55
|
+
admissionEnabled,
|
|
56
|
+
lisaCliPrefix,
|
|
57
|
+
PUSH_CONTEXT,
|
|
58
|
+
shellQuote,
|
|
59
|
+
} from "./lib/push-admission.mjs";
|
|
60
|
+
import {
|
|
61
|
+
isRailsProject,
|
|
62
|
+
RAILS_PUSH_GATE_DEFAULTS,
|
|
63
|
+
withDefaults,
|
|
64
|
+
} from "./lib/push-gate-defaults.mjs";
|
|
65
|
+
import { hostReading, recordPushTiming } from "./lib/push-timing.mjs";
|
|
66
|
+
|
|
67
|
+
const SCRIPT = fileURLToPath(import.meta.url);
|
|
68
|
+
|
|
69
|
+
/** Exit status `lisa admit` uses when the wait bound expired (EX_TEMPFAIL). */
|
|
70
|
+
export const ADMISSION_REFUSED_EXIT = 75;
|
|
71
|
+
|
|
72
|
+
/**
|
|
73
|
+
* The Rails pre-push gates, in the order lefthook runs them. `command` is the
|
|
74
|
+
* gate's identity in the cache key; how RSpec is actually started (serial,
|
|
75
|
+
* parallel, a selection) is decided at run time and does not change it.
|
|
76
|
+
*/
|
|
77
|
+
export const RAILS_GATES = Object.freeze({
|
|
78
|
+
rspec: Object.freeze({
|
|
79
|
+
command: ["bundle", "exec", "rspec"],
|
|
80
|
+
cacheable: true,
|
|
81
|
+
admitted: true,
|
|
82
|
+
}),
|
|
83
|
+
brakeman: Object.freeze({
|
|
84
|
+
command: ["bundle", "exec", "brakeman", "--no-pager", "--quiet"],
|
|
85
|
+
cacheable: true,
|
|
86
|
+
admitted: false,
|
|
87
|
+
}),
|
|
88
|
+
reek: Object.freeze({
|
|
89
|
+
command: ["bundle", "exec", "reek", "app/", "lib/"],
|
|
90
|
+
cacheable: true,
|
|
91
|
+
admitted: false,
|
|
92
|
+
}),
|
|
93
|
+
flog: Object.freeze({
|
|
94
|
+
command: ["bundle", "exec", "flog", "--all", "--group", "app/", "lib/"],
|
|
95
|
+
cacheable: true,
|
|
96
|
+
admitted: false,
|
|
97
|
+
}),
|
|
98
|
+
flay: Object.freeze({
|
|
99
|
+
command: ["bundle", "exec", "flay", "app/", "lib/"],
|
|
100
|
+
cacheable: true,
|
|
101
|
+
admitted: false,
|
|
102
|
+
}),
|
|
103
|
+
mutation: Object.freeze({
|
|
104
|
+
command: ["bash", "scripts/lisa-mutation.sh"],
|
|
105
|
+
cacheable: false,
|
|
106
|
+
admitted: true,
|
|
107
|
+
}),
|
|
108
|
+
});
|
|
109
|
+
|
|
110
|
+
/** What `lisa check` runs: every gate whose pass a later push can reuse. */
|
|
111
|
+
export const CHECK_GATES = Object.freeze(
|
|
112
|
+
Object.keys(RAILS_GATES).filter(id => RAILS_GATES[id].cacheable)
|
|
113
|
+
);
|
|
114
|
+
|
|
115
|
+
/** The pattern a parallel-ready test database name carries. */
|
|
116
|
+
const TEST_ENV_NUMBER = /TEST_ENV_NUMBER/u;
|
|
117
|
+
|
|
118
|
+
/** Where the per-process database preparation is remembered. */
|
|
119
|
+
const PREPARE_MARKER = join("tmp", "lisa-parallel-prepare.json");
|
|
120
|
+
|
|
121
|
+
/** Whether `root` is a Rails project (re-exported from the shared defaults). */
|
|
122
|
+
export { isRailsProject };
|
|
123
|
+
|
|
124
|
+
/**
|
|
125
|
+
* The `pushGate` block a Rails project runs with: the Rails defaults from
|
|
126
|
+
* `lib/push-gate-defaults.mjs` (cache, admission, affected specs with
|
|
127
|
+
* `changed-files` coverage) under anything the host set. A malformed block is
|
|
128
|
+
* handed through unchanged so the shared readers refuse it exactly as they do
|
|
129
|
+
* for Lisa's own runner.
|
|
130
|
+
* @param {object|null|undefined} config Parsed `.lisa.config.json`.
|
|
131
|
+
* @param {string} root Project root.
|
|
132
|
+
* @returns {object} The config, with the effective `pushGate`.
|
|
133
|
+
*/
|
|
134
|
+
export function railsEffectiveConfig(config, root) {
|
|
135
|
+
const base = config ?? {};
|
|
136
|
+
if (!isRailsProject(root)) return base;
|
|
137
|
+
return withDefaults(base, RAILS_PUSH_GATE_DEFAULTS);
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
/**
|
|
141
|
+
* Read `.lisa.config.json`; absent reads as `{}`.
|
|
142
|
+
* @param {string} root Project root.
|
|
143
|
+
* @returns {object} Parsed config.
|
|
144
|
+
* @throws {Error} When the file exists but is not JSON.
|
|
145
|
+
*/
|
|
146
|
+
function readConfig(root) {
|
|
147
|
+
const path = join(root, ".lisa.config.json");
|
|
148
|
+
if (!existsSync(path)) return {};
|
|
149
|
+
return JSON.parse(readFileSync(path, "utf8"));
|
|
150
|
+
}
|
|
151
|
+
|
|
152
|
+
/**
|
|
153
|
+
* First line of a tool's version output, or null when it is not installed.
|
|
154
|
+
* @param {string} command Executable.
|
|
155
|
+
* @param {string[]} args Arguments.
|
|
156
|
+
* @param {string} cwd Directory.
|
|
157
|
+
* @returns {string|null} Version text.
|
|
158
|
+
*/
|
|
159
|
+
function versionOf(command, args, cwd) {
|
|
160
|
+
const child = spawnSync(command, args, { cwd, encoding: "utf8" });
|
|
161
|
+
// probe-direction: fail-closed โ an unreadable version keys as null, apart
|
|
162
|
+
// from every pass recorded under a readable toolchain, so it reuses none.
|
|
163
|
+
if (child.status !== 0) return null;
|
|
164
|
+
return String(child.stdout).trim().split("\n")[0] ?? null;
|
|
165
|
+
}
|
|
166
|
+
|
|
167
|
+
/**
|
|
168
|
+
* Whether the host's test database name carries `TEST_ENV_NUMBER`, so each
|
|
169
|
+
* parallel process gets its own database.
|
|
170
|
+
* @param {string} root Project root.
|
|
171
|
+
* @returns {boolean} True when `config/database.yml`'s `test:` block names it.
|
|
172
|
+
*/
|
|
173
|
+
export function parallelDatabaseReady(root) {
|
|
174
|
+
const path = join(root, "config", "database.yml");
|
|
175
|
+
if (!existsSync(path)) return false;
|
|
176
|
+
const lines = readFileSync(path, "utf8").split("\n");
|
|
177
|
+
const start = lines.findIndex(line => /^test:\s*(#.*)?$/u.test(line));
|
|
178
|
+
if (start === -1) return false;
|
|
179
|
+
const end = lines.findIndex(
|
|
180
|
+
(line, index) => index > start && /^\S/u.test(line) && !line.startsWith("#")
|
|
181
|
+
);
|
|
182
|
+
return lines
|
|
183
|
+
.slice(start + 1, end === -1 ? lines.length : end)
|
|
184
|
+
.some(line => TEST_ENV_NUMBER.test(line));
|
|
185
|
+
}
|
|
186
|
+
|
|
187
|
+
/**
|
|
188
|
+
* A file's lines. Line by line rather than one multiline pattern: `^\s+` with
|
|
189
|
+
* the `m` flag lets `\s` run across newlines and backtrack
|
|
190
|
+
* (sonarjs/slow-regex).
|
|
191
|
+
* @param {string} text File contents.
|
|
192
|
+
* @returns {string[]} Lines, without their endings.
|
|
193
|
+
*/
|
|
194
|
+
function linesOf(text) {
|
|
195
|
+
return text.split(/\r?\n/u);
|
|
196
|
+
}
|
|
197
|
+
|
|
198
|
+
/**
|
|
199
|
+
* Whether the bundle carries the `parallel_tests` gem.
|
|
200
|
+
* @param {string} root Project root.
|
|
201
|
+
* @returns {boolean} True when `Gemfile.lock` lists it.
|
|
202
|
+
*/
|
|
203
|
+
function parallelGemInstalled(root) {
|
|
204
|
+
const lock = join(root, "Gemfile.lock");
|
|
205
|
+
return (
|
|
206
|
+
existsSync(lock) &&
|
|
207
|
+
linesOf(readFileSync(lock, "utf8")).some(
|
|
208
|
+
line =>
|
|
209
|
+
line !== line.trimStart() &&
|
|
210
|
+
line.trimStart().startsWith("parallel_tests (")
|
|
211
|
+
)
|
|
212
|
+
);
|
|
213
|
+
}
|
|
214
|
+
|
|
215
|
+
/**
|
|
216
|
+
* The workers granted by admission, or 1 when none were.
|
|
217
|
+
* @param {Record<string, string|undefined>} env Environment.
|
|
218
|
+
* @returns {number} Workers.
|
|
219
|
+
*/
|
|
220
|
+
export function grantedWorkers(env) {
|
|
221
|
+
const granted = Number(env.LISA_ADMITTED_WORKERS);
|
|
222
|
+
return Number.isInteger(granted) && granted > 0 ? granted : 1;
|
|
223
|
+
}
|
|
224
|
+
|
|
225
|
+
/**
|
|
226
|
+
* The spec selection, when the affected-spec selector (CodySwannGT/lisa#4612)
|
|
227
|
+
* is installed; a full run otherwise.
|
|
228
|
+
*
|
|
229
|
+
* A partial plan is run by the selector's own `runRspecPlan`, never as a plain
|
|
230
|
+
* `bundle exec rspec <specs>`: that would hold the slice to SimpleCov's
|
|
231
|
+
* project-wide minimums (failing every partial push on a host with a coverage
|
|
232
|
+
* floor) and skip the changed-files coverage check. A selector that offers a
|
|
233
|
+
* partial plan but no `runRspecPlan` gets a full run instead.
|
|
234
|
+
* @param {string} root Project root.
|
|
235
|
+
* @param {Record<string, string|undefined>} env Environment.
|
|
236
|
+
* @param {(line: string) => void} out Line sink.
|
|
237
|
+
* @param {() => number} runFull Runs the full suite; a partial plan's
|
|
238
|
+
* escalation (CodySwannGT/lisa#4600) runs it too.
|
|
239
|
+
* @returns {Promise<{kind: "full"|"partial", specs: string[], run?: () => Promise<number>|number}>}
|
|
240
|
+
* The plan, and for a partial one the call that runs it.
|
|
241
|
+
*/
|
|
242
|
+
async function rspecPlan(root, env, out, runFull) {
|
|
243
|
+
const selector = join(dirname(SCRIPT), "lisa-rspec-select.mjs");
|
|
244
|
+
if (!existsSync(selector)) return { kind: "full", specs: [] };
|
|
245
|
+
try {
|
|
246
|
+
const { planRspecRun, runRspecPlan } = await import(selector);
|
|
247
|
+
const plan = await planRspecRun({ cwd: root, env });
|
|
248
|
+
for (const line of plan.lines ?? []) out(line);
|
|
249
|
+
if (plan.kind !== "partial") return { kind: "full", specs: [] };
|
|
250
|
+
if (typeof runRspecPlan !== "function") {
|
|
251
|
+
out(
|
|
252
|
+
"โน๏ธ rspec: this spec selector cannot run a partial plan with its coverage check; running the full suite."
|
|
253
|
+
);
|
|
254
|
+
return { kind: "full", specs: [] };
|
|
255
|
+
}
|
|
256
|
+
return {
|
|
257
|
+
kind: "partial",
|
|
258
|
+
specs: [...plan.specs],
|
|
259
|
+
run: () => runRspecPlan({ plan, cwd: root, env, out, runFull }),
|
|
260
|
+
};
|
|
261
|
+
} catch (err) {
|
|
262
|
+
out(
|
|
263
|
+
`โน๏ธ rspec: spec selection unavailable (${err.message}); running the full suite.`
|
|
264
|
+
);
|
|
265
|
+
return { kind: "full", specs: [] };
|
|
266
|
+
}
|
|
267
|
+
}
|
|
268
|
+
|
|
269
|
+
/**
|
|
270
|
+
* Prepare the per-process test databases once per schema and worker count.
|
|
271
|
+
* @param {string} root Project root.
|
|
272
|
+
* @param {number} workers Workers.
|
|
273
|
+
* @param {(argv: string[]) => number} run Runs a command.
|
|
274
|
+
* @param {(line: string) => void} out Line sink.
|
|
275
|
+
* @returns {number} Exit status of the preparation (0 when it was not needed).
|
|
276
|
+
*/
|
|
277
|
+
function prepareParallelDatabases(root, workers, run, out) {
|
|
278
|
+
const schema = ["db/schema.rb", "db/structure.sql"]
|
|
279
|
+
.map(name => join(root, name))
|
|
280
|
+
.find(path => existsSync(path));
|
|
281
|
+
const digest = createHash("sha256")
|
|
282
|
+
.update(schema ? readFileSync(schema) : "")
|
|
283
|
+
.update(String(workers))
|
|
284
|
+
.digest("hex");
|
|
285
|
+
const marker = join(root, PREPARE_MARKER);
|
|
286
|
+
try {
|
|
287
|
+
if (JSON.parse(readFileSync(marker, "utf8")).digest === digest) return 0;
|
|
288
|
+
} catch {
|
|
289
|
+
// No marker yet: prepare.
|
|
290
|
+
}
|
|
291
|
+
out(
|
|
292
|
+
`๐๏ธ rspec: preparing ${workers} test databases (bundle exec rake parallel:prepare).`
|
|
293
|
+
);
|
|
294
|
+
const status = run(["bundle", "exec", "rake", "parallel:prepare"]);
|
|
295
|
+
if (status === 0) {
|
|
296
|
+
try {
|
|
297
|
+
mkdirSync(dirname(marker), { recursive: true });
|
|
298
|
+
writeFileSync(marker, `${JSON.stringify({ digest })}\n`);
|
|
299
|
+
} catch {
|
|
300
|
+
// Best effort: the next run prepares again.
|
|
301
|
+
}
|
|
302
|
+
}
|
|
303
|
+
return status;
|
|
304
|
+
}
|
|
305
|
+
|
|
306
|
+
/**
|
|
307
|
+
* The command RSpec actually starts with.
|
|
308
|
+
* @param {object} options Inputs.
|
|
309
|
+
* @param {string} options.root Project root.
|
|
310
|
+
* @param {{kind: string, specs: string[]}} options.plan The selection.
|
|
311
|
+
* @param {number} options.workers Granted workers.
|
|
312
|
+
* @returns {{argv: string[], parallel: boolean, hint: string|null}} The command.
|
|
313
|
+
*/
|
|
314
|
+
export function rspecCommand({ root, plan, workers }) {
|
|
315
|
+
const serial = [...RAILS_GATES.rspec.command, ...plan.specs];
|
|
316
|
+
if (plan.kind !== "full" || workers < 2) {
|
|
317
|
+
return { argv: serial, parallel: false, hint: null };
|
|
318
|
+
}
|
|
319
|
+
if (!parallelDatabaseReady(root)) {
|
|
320
|
+
return {
|
|
321
|
+
argv: serial,
|
|
322
|
+
parallel: false,
|
|
323
|
+
hint:
|
|
324
|
+
"โน๏ธ rspec runs serially: add <%= ENV['TEST_ENV_NUMBER'] %> to the test " +
|
|
325
|
+
"database name in config/database.yml so the full suite can use " +
|
|
326
|
+
`${workers} parallel workers (Lisa never edits that file).`,
|
|
327
|
+
};
|
|
328
|
+
}
|
|
329
|
+
if (!parallelGemInstalled(root)) {
|
|
330
|
+
return {
|
|
331
|
+
argv: serial,
|
|
332
|
+
parallel: false,
|
|
333
|
+
hint:
|
|
334
|
+
"โน๏ธ rspec runs serially: the parallel_tests gem is not in Gemfile.lock; " +
|
|
335
|
+
"run bundle install so the full suite can use " +
|
|
336
|
+
`${workers} parallel workers.`,
|
|
337
|
+
};
|
|
338
|
+
}
|
|
339
|
+
return {
|
|
340
|
+
argv: ["bundle", "exec", "parallel_rspec", "-n", String(workers)],
|
|
341
|
+
parallel: true,
|
|
342
|
+
hint: null,
|
|
343
|
+
};
|
|
344
|
+
}
|
|
345
|
+
|
|
346
|
+
/**
|
|
347
|
+
* Run one command with inherited output.
|
|
348
|
+
* @param {string} root Directory.
|
|
349
|
+
* @param {Record<string, string|undefined>} env Environment.
|
|
350
|
+
* @returns {(argv: string[]) => number} Runner returning the exit status.
|
|
351
|
+
*/
|
|
352
|
+
function runner(root, env) {
|
|
353
|
+
return argv => {
|
|
354
|
+
const child = spawnSync(argv[0], argv.slice(1), {
|
|
355
|
+
cwd: root,
|
|
356
|
+
env,
|
|
357
|
+
stdio: "inherit",
|
|
358
|
+
});
|
|
359
|
+
if (child.error) {
|
|
360
|
+
console.error(`โ could not start ${argv[0]}: ${child.error.message}`);
|
|
361
|
+
return 127;
|
|
362
|
+
}
|
|
363
|
+
return child.status ?? 1;
|
|
364
|
+
};
|
|
365
|
+
}
|
|
366
|
+
|
|
367
|
+
/**
|
|
368
|
+
* Run a gate's own payload. This is what runs under `lisa admit`.
|
|
369
|
+
* @param {string} id Gate id.
|
|
370
|
+
* @param {string} root Project root.
|
|
371
|
+
* @param {Record<string, string|undefined>} env Environment.
|
|
372
|
+
* @param {(line: string) => void} out Line sink.
|
|
373
|
+
* @returns {Promise<number>} Exit status.
|
|
374
|
+
*/
|
|
375
|
+
export async function runPayload(id, root, env, out) {
|
|
376
|
+
const run = runner(root, env);
|
|
377
|
+
if (id === "rspec") return runRspecPayload(root, env, out, run);
|
|
378
|
+
return run([...RAILS_GATES[id].command]);
|
|
379
|
+
}
|
|
380
|
+
|
|
381
|
+
/**
|
|
382
|
+
* Tell the gate runner which kind of RSpec run this is, through the
|
|
383
|
+
* selection-report file it named in `LISA_SELECTION_REPORT`. The runner
|
|
384
|
+
* remembers an RSpec pass only when the report says `full`, so a report that
|
|
385
|
+
* cannot be written leaves the pass unremembered rather than mistaken for a
|
|
386
|
+
* full one. A partial run that escalates overwrites it with `full` (the
|
|
387
|
+
* selector's `runRspecPlan` does that).
|
|
388
|
+
* @param {Record<string, string|undefined>} env Environment.
|
|
389
|
+
* @param {"full"|"partial"} kind The run.
|
|
390
|
+
* @param {number} tests Spec files a partial run selected.
|
|
391
|
+
*/
|
|
392
|
+
function reportSelection(env, kind, tests) {
|
|
393
|
+
const file = env[SELECTION_REPORT_ENV];
|
|
394
|
+
if (!file) return;
|
|
395
|
+
try {
|
|
396
|
+
writeFileSync(file, `${JSON.stringify({ selection: kind, tests })}\n`);
|
|
397
|
+
} catch {
|
|
398
|
+
// Unwritten, the runner reads no report and does not remember the pass.
|
|
399
|
+
}
|
|
400
|
+
}
|
|
401
|
+
|
|
402
|
+
/**
|
|
403
|
+
* Run RSpec: the selector's partial plan when it offers one, else the full
|
|
404
|
+
* suite, serial or parallel.
|
|
405
|
+
* @param {string} root Project root.
|
|
406
|
+
* @param {Record<string, string|undefined>} env Environment.
|
|
407
|
+
* @param {(line: string) => void} out Line sink.
|
|
408
|
+
* @param {(argv: string[]) => number} run Command runner.
|
|
409
|
+
* @returns {Promise<number>} Exit status.
|
|
410
|
+
*/
|
|
411
|
+
async function runRspecPayload(root, env, out, run) {
|
|
412
|
+
const workers = grantedWorkers(env);
|
|
413
|
+
// The full run, also what a partial plan escalates to when its changed
|
|
414
|
+
// files fall short (CodySwannGT/lisa#4600), so it keeps the parallel path.
|
|
415
|
+
const runFull = () => {
|
|
416
|
+
const command = rspecCommand({
|
|
417
|
+
root,
|
|
418
|
+
plan: { kind: "full", specs: [] },
|
|
419
|
+
workers,
|
|
420
|
+
});
|
|
421
|
+
if (command.hint) out(command.hint);
|
|
422
|
+
if (command.parallel) {
|
|
423
|
+
const prepared = prepareParallelDatabases(root, workers, run, out);
|
|
424
|
+
if (prepared !== 0) return prepared;
|
|
425
|
+
}
|
|
426
|
+
out(`โถ๏ธ rspec: ${command.argv.join(" ")}`);
|
|
427
|
+
return run(command.argv);
|
|
428
|
+
};
|
|
429
|
+
const plan = await rspecPlan(root, env, out, runFull);
|
|
430
|
+
reportSelection(env, plan.kind, plan.specs.length);
|
|
431
|
+
return plan.run ? plan.run() : runFull();
|
|
432
|
+
}
|
|
433
|
+
|
|
434
|
+
/**
|
|
435
|
+
* Whether the opt-in mutation gate is enabled, so waiting for headroom for it
|
|
436
|
+
* is worth anything; disabled, it self-skips instantly.
|
|
437
|
+
* @param {string} root Project root.
|
|
438
|
+
* @returns {boolean} True when `mutation.gate.yml` sets `enabled: true`.
|
|
439
|
+
*/
|
|
440
|
+
export function mutationEnabled(root) {
|
|
441
|
+
const path = join(root, "mutation.gate.yml");
|
|
442
|
+
return (
|
|
443
|
+
existsSync(path) &&
|
|
444
|
+
linesOf(readFileSync(path, "utf8")).some(line =>
|
|
445
|
+
/^enabled:[ \t]*true\b/u.test(line.trimStart())
|
|
446
|
+
)
|
|
447
|
+
);
|
|
448
|
+
}
|
|
449
|
+
|
|
450
|
+
/**
|
|
451
|
+
* The Lisa CLI as a shell prefix: the project's install, else `lisa` on PATH
|
|
452
|
+
* (a Rails host usually has no `node_modules`).
|
|
453
|
+
* @param {string} root Project root.
|
|
454
|
+
* @returns {string|null} Prefix, or null when none is installed.
|
|
455
|
+
*/
|
|
456
|
+
export function railsLisaCli(root) {
|
|
457
|
+
const local = lisaCliPrefix(root);
|
|
458
|
+
if (local) return local;
|
|
459
|
+
const found = spawnSync("sh", ["-c", "command -v lisa"], {
|
|
460
|
+
encoding: "utf8",
|
|
461
|
+
});
|
|
462
|
+
return found.status === 0 && String(found.stdout).trim() ? "lisa" : null;
|
|
463
|
+
}
|
|
464
|
+
|
|
465
|
+
/** Overrides how many workers a full RSpec run asks admission for. */
|
|
466
|
+
export const RSPEC_WORKERS_ENV = "LISA_ADMISSION_RSPEC_WORKERS";
|
|
467
|
+
|
|
468
|
+
/**
|
|
469
|
+
* Workers RSpec declares: every core but one, unless
|
|
470
|
+
* `LISA_ADMISSION_RSPEC_WORKERS` names a count. Admission grants fewer, down
|
|
471
|
+
* to one, when the machine is busy. Like every `LISA_ADMISSION*` knob it
|
|
472
|
+
* decides how a run starts, never what it proves, so it stays out of the pass
|
|
473
|
+
* cache key.
|
|
474
|
+
* @param {Record<string, string|undefined>} env Environment.
|
|
475
|
+
* @returns {number} Declared workers.
|
|
476
|
+
*/
|
|
477
|
+
export function declaredWorkers(env) {
|
|
478
|
+
const asked = Number(env[RSPEC_WORKERS_ENV]);
|
|
479
|
+
if (Number.isInteger(asked) && asked > 0) return asked;
|
|
480
|
+
return Math.max(1, availableParallelism() - 1);
|
|
481
|
+
}
|
|
482
|
+
|
|
483
|
+
/**
|
|
484
|
+
* Run a gate, through `lisa admit` when it is heavy and admission is on.
|
|
485
|
+
* @param {object} options Inputs.
|
|
486
|
+
* @param {string} options.id Gate id.
|
|
487
|
+
* @param {string} options.root Project root.
|
|
488
|
+
* @param {Record<string, string|undefined>} options.env Environment.
|
|
489
|
+
* @param {boolean} options.admit Whether admission is on.
|
|
490
|
+
* @param {(line: string) => void} options.out Line sink.
|
|
491
|
+
* @param {(root: string) => string|null} options.cli CLI resolver.
|
|
492
|
+
* @returns {Promise<number>} Exit status.
|
|
493
|
+
*/
|
|
494
|
+
async function execute({ id, root, env, admit, out, cli }) {
|
|
495
|
+
const gate = RAILS_GATES[id];
|
|
496
|
+
const wanted =
|
|
497
|
+
admit && gate.admitted && (id !== "mutation" || mutationEnabled(root));
|
|
498
|
+
if (!wanted) return runPayload(id, root, env, out);
|
|
499
|
+
if (process.platform === "win32") {
|
|
500
|
+
out(
|
|
501
|
+
`โ ๏ธ pushGate.admission is on, but ${id} is not admitted on Windows; it starts immediately.`
|
|
502
|
+
);
|
|
503
|
+
return runPayload(id, root, env, out);
|
|
504
|
+
}
|
|
505
|
+
const prefix = cli(root);
|
|
506
|
+
if (prefix === null) {
|
|
507
|
+
out(
|
|
508
|
+
`โ ๏ธ pushGate.admission is on, but no Lisa CLI is installed here ` +
|
|
509
|
+
`(node_modules/.bin/lisa or lisa on PATH); ${id} starts without admission.`
|
|
510
|
+
);
|
|
511
|
+
return runPayload(id, root, env, out);
|
|
512
|
+
}
|
|
513
|
+
const workers = id === "rspec" ? declaredWorkers(env) : 1;
|
|
514
|
+
const inner = `node ${shellQuote(SCRIPT)} --admitted ${id}`;
|
|
515
|
+
const status = runner(root, { ...env, LISA_ADMISSION_CONTEXT: PUSH_CONTEXT })(
|
|
516
|
+
[
|
|
517
|
+
"sh",
|
|
518
|
+
"-c",
|
|
519
|
+
`${prefix} admit --workers ${workers} --min-workers 1 -- ${shellQuote(inner)}`,
|
|
520
|
+
]
|
|
521
|
+
);
|
|
522
|
+
if (status === ADMISSION_REFUSED_EXIT) {
|
|
523
|
+
out(
|
|
524
|
+
`โ ${id} did not start: the machine had no headroom within the wait bound ` +
|
|
525
|
+
"(see the lisa admission line above for the busy runs). This is NOT a pass; retry when they finish."
|
|
526
|
+
);
|
|
527
|
+
return 1;
|
|
528
|
+
}
|
|
529
|
+
return status;
|
|
530
|
+
}
|
|
531
|
+
|
|
532
|
+
/**
|
|
533
|
+
* Whether a passing gate's run proved the whole tree, so its pass may be
|
|
534
|
+
* remembered. RSpec qualifies only when its run reported a full suite: a
|
|
535
|
+
* partial selection proved a slice, and an unreadable report is treated as
|
|
536
|
+
* one (fail closed). Every other gate always runs whole.
|
|
537
|
+
* @param {string} id Gate id.
|
|
538
|
+
* @param {{read: (command: string) => any}} selection The selection reports.
|
|
539
|
+
* @param {{command: string}} entry The gate's result entry.
|
|
540
|
+
* @returns {boolean} True when the pass may be remembered.
|
|
541
|
+
*/
|
|
542
|
+
function provedWholeTree(id, selection, entry) {
|
|
543
|
+
if (id !== "rspec") return true;
|
|
544
|
+
return selection.read(entry.command)?.selection === "full";
|
|
545
|
+
}
|
|
546
|
+
|
|
547
|
+
/**
|
|
548
|
+
* Run the named gates in order, each through the cache and, when heavy,
|
|
549
|
+
* admission. Every gate runs even after one fails, so one push reports all.
|
|
550
|
+
* @param {string[]} ids Gate ids.
|
|
551
|
+
* @param {object} [options] Seams.
|
|
552
|
+
* @param {string} [options.root] Project root.
|
|
553
|
+
* @param {Record<string, string|undefined>} [options.env] Environment.
|
|
554
|
+
* @param {(line: string) => void} [options.out] Line sink.
|
|
555
|
+
* @param {(root: string) => string|null} [options.cli] CLI resolver.
|
|
556
|
+
* @returns {Promise<number>} 0 when every gate passed, else 1.
|
|
557
|
+
*/
|
|
558
|
+
export async function runRailsGates(
|
|
559
|
+
ids,
|
|
560
|
+
{
|
|
561
|
+
root = process.cwd(),
|
|
562
|
+
env = process.env,
|
|
563
|
+
out = line => console.log(line),
|
|
564
|
+
cli = railsLisaCli,
|
|
565
|
+
} = {}
|
|
566
|
+
) {
|
|
567
|
+
let config;
|
|
568
|
+
let admit;
|
|
569
|
+
try {
|
|
570
|
+
config = railsEffectiveConfig(readConfig(root), root);
|
|
571
|
+
admit = admissionEnabled(config);
|
|
572
|
+
} catch (err) {
|
|
573
|
+
out(`๐ซ Rails push gates did not run: ${err.message}`);
|
|
574
|
+
out(" Fix pushGate in .lisa.config.json. This is NOT a pass.");
|
|
575
|
+
return 1;
|
|
576
|
+
}
|
|
577
|
+
const startedAtMs = Date.now();
|
|
578
|
+
const start = hostReading();
|
|
579
|
+
const cache = ids.some(id => RAILS_GATES[id].cacheable)
|
|
580
|
+
? openGatePassCache({
|
|
581
|
+
config,
|
|
582
|
+
gates: config.gates ?? {},
|
|
583
|
+
moment: "push",
|
|
584
|
+
out,
|
|
585
|
+
cwd: root,
|
|
586
|
+
env,
|
|
587
|
+
extraTools: {
|
|
588
|
+
ruby: versionOf("ruby", ["-v"], root),
|
|
589
|
+
bundler: versionOf("bundle", ["-v"], root),
|
|
590
|
+
},
|
|
591
|
+
// What RSpec selects decides what its pass proves, so the effective
|
|
592
|
+
// pushGate (selection, coverage mode) is part of every key.
|
|
593
|
+
extraConfig: { pushGate: config.pushGate ?? null },
|
|
594
|
+
})
|
|
595
|
+
: null;
|
|
596
|
+
// The gates run with a copy of the environment carrying the RSpec
|
|
597
|
+
// selection-report path, so the caller's object is never mutated.
|
|
598
|
+
const runEnv = { ...env };
|
|
599
|
+
const selection = openSelectionReports(runEnv);
|
|
600
|
+
const results = [];
|
|
601
|
+
for (const id of ids) {
|
|
602
|
+
const gate = RAILS_GATES[id];
|
|
603
|
+
const entry = { id, level: "required", command: gate.command.join(" ") };
|
|
604
|
+
const hit = gate.cacheable ? (cache?.lookup(entry) ?? null) : null;
|
|
605
|
+
if (hit) {
|
|
606
|
+
out(`โ
${id}: CACHED PASS (${hit.key.slice(0, 12)}) ${entry.command}`);
|
|
607
|
+
results.push({
|
|
608
|
+
...entry,
|
|
609
|
+
state: "passed",
|
|
610
|
+
cached: true,
|
|
611
|
+
code: 0,
|
|
612
|
+
durationMs: 0,
|
|
613
|
+
});
|
|
614
|
+
continue;
|
|
615
|
+
}
|
|
616
|
+
const began = Date.now();
|
|
617
|
+
if (id === "rspec") selection.before(entry.command);
|
|
618
|
+
const code = await execute({ id, root, env: runEnv, admit, out, cli });
|
|
619
|
+
const durationMs = Date.now() - began;
|
|
620
|
+
results.push({
|
|
621
|
+
...entry,
|
|
622
|
+
state: code === 0 ? "passed" : "failed",
|
|
623
|
+
code,
|
|
624
|
+
startedAt: new Date(began).toISOString(),
|
|
625
|
+
durationMs,
|
|
626
|
+
});
|
|
627
|
+
if (code === 0) {
|
|
628
|
+
if (gate.cacheable && provedWholeTree(id, selection, entry)) {
|
|
629
|
+
cache?.remember(entry, durationMs);
|
|
630
|
+
}
|
|
631
|
+
} else {
|
|
632
|
+
out(`โ ${id} FAILED (exit ${code}): ${entry.command}`);
|
|
633
|
+
}
|
|
634
|
+
}
|
|
635
|
+
selection.close();
|
|
636
|
+
cache?.commit();
|
|
637
|
+
recordPushTiming({
|
|
638
|
+
moment: "push",
|
|
639
|
+
startedAtMs,
|
|
640
|
+
start,
|
|
641
|
+
result: { results },
|
|
642
|
+
out,
|
|
643
|
+
});
|
|
644
|
+
return results.every(result => result.code === 0) ? 0 : 1;
|
|
645
|
+
}
|
|
646
|
+
|
|
647
|
+
/**
|
|
648
|
+
* Command-line entry.
|
|
649
|
+
*
|
|
650
|
+
* - `<gate>โฆ` runs the named gates (what lefthook runs).
|
|
651
|
+
* - `--all` runs the cacheable set after the start-of-run sweep (what
|
|
652
|
+
* `lisa check` runs), so the push that follows finds cached passes.
|
|
653
|
+
* - `--admitted <gate>` runs one payload; `lisa admit` calls it.
|
|
654
|
+
* @param {string[]} argv Arguments.
|
|
655
|
+
* @returns {Promise<number>} Exit status.
|
|
656
|
+
*/
|
|
657
|
+
export async function main(argv = process.argv.slice(2)) {
|
|
658
|
+
if (argv[0] === "--admitted") {
|
|
659
|
+
const id = argv[1] ?? "";
|
|
660
|
+
if (!RAILS_GATES[id]) return 2;
|
|
661
|
+
return runPayload(id, process.cwd(), process.env, line =>
|
|
662
|
+
console.log(line)
|
|
663
|
+
);
|
|
664
|
+
}
|
|
665
|
+
if (argv[0] === "--all") {
|
|
666
|
+
try {
|
|
667
|
+
runStartOfRunSweep();
|
|
668
|
+
} catch (err) {
|
|
669
|
+
console.log(
|
|
670
|
+
`๐งน cleanup sweep did not finish (${err.message}); continuing`
|
|
671
|
+
);
|
|
672
|
+
}
|
|
673
|
+
process.env.LISA_TEST_RUN_OWNER ??= `${process.pid}:0`;
|
|
674
|
+
return runRailsGates([...CHECK_GATES]);
|
|
675
|
+
}
|
|
676
|
+
const unknown = argv.filter(id => !RAILS_GATES[id]);
|
|
677
|
+
if (argv.length === 0 || unknown.length > 0) {
|
|
678
|
+
console.error(
|
|
679
|
+
`๐ซ lisa-rails-gates: name one or more of ${Object.keys(RAILS_GATES).join(", ")}, or --all.`
|
|
680
|
+
);
|
|
681
|
+
return 2;
|
|
682
|
+
}
|
|
683
|
+
return runRailsGates(argv);
|
|
684
|
+
}
|
|
685
|
+
|
|
686
|
+
if (invokedAsScript(import.meta.url)) process.exitCode = await main();
|
|
@@ -26,8 +26,8 @@
|
|
|
26
26
|
* for the next run's plan.
|
|
27
27
|
*
|
|
28
28
|
* Node-only and dependency-free on purpose: it runs on the bare runner, in
|
|
29
|
-
* jobs that never install the project's gems, and never
|
|
30
|
-
*
|
|
29
|
+
* jobs that never install the project's gems, and never as part of the RSpec
|
|
30
|
+
* payload itself.
|
|
31
31
|
*
|
|
32
32
|
* Usage:
|
|
33
33
|
* node scripts/lisa-rspec-shards.mjs plan --shards N --out plan.json [--timings t.json] [--root .]
|