@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,672 @@
|
|
|
1
|
+
// This file is managed by Lisa and IS replaced on each `lisa` run.
|
|
2
|
+
// Do not edit directly — durable changes belong upstream in Lisa.
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* Run only the RSpec specs a change can reach, at push, on Rails hosts
|
|
6
|
+
* (CodySwannGT/lisa#4612). The Rails counterpart of `affected-tests.mjs`
|
|
7
|
+
* (CodySwannGT/lisa#4600), with the same contract:
|
|
8
|
+
*
|
|
9
|
+
* - `pushGate.affectedTests` switches it (default ON for a Rails project,
|
|
10
|
+
* detected by `bin/rails` or `config/application.rb`; explicit `false`
|
|
11
|
+
* runs the full suite as before).
|
|
12
|
+
* - `pushGate.affectedCoverage` says what a partial run does about coverage:
|
|
13
|
+
* `changed-files` (the Rails default) holds each changed Ruby file to
|
|
14
|
+
* `simplecov.thresholds.json` on its own, `skip` leaves coverage to CI,
|
|
15
|
+
* `full` keeps the full suite so coverage is measured over every spec.
|
|
16
|
+
* - Whenever the selection could be wrong it runs the FULL suite and says
|
|
17
|
+
* why: a CI run, a missing or stale map, a trigger file, or a changed file
|
|
18
|
+
* the map has never seen.
|
|
19
|
+
*
|
|
20
|
+
* The map comes from gitlab-crystalball, recorded by CI's full RSpec run
|
|
21
|
+
* (`scripts/lisa_crystalball_recorder.rb`), instead of the Node file-read
|
|
22
|
+
* tracer TypeScript hosts use. Crystalball's own predictor strategies
|
|
23
|
+
* (modified execution paths, modified specs, associated specs) are applied
|
|
24
|
+
* here, in plain JavaScript, so the decision is a pure function of its inputs
|
|
25
|
+
* that shares the TypeScript side's fallback rules and needs no Ruby to test.
|
|
26
|
+
*
|
|
27
|
+
* Everything here is pure; git, the download and RSpec itself live in
|
|
28
|
+
* `scripts/lisa-rspec-select.mjs`. CI always runs every spec.
|
|
29
|
+
* @module rspec-selection
|
|
30
|
+
*/
|
|
31
|
+
import {
|
|
32
|
+
affectedTestsSettings,
|
|
33
|
+
coverageEscalationLines,
|
|
34
|
+
firedTrigger,
|
|
35
|
+
fullSuiteEscalation,
|
|
36
|
+
readersByFile,
|
|
37
|
+
} from "./affected-tests.mjs";
|
|
38
|
+
import {
|
|
39
|
+
RAILS_PUSH_GATE_DEFAULTS,
|
|
40
|
+
withDefaults,
|
|
41
|
+
} from "./push-gate-defaults.mjs";
|
|
42
|
+
|
|
43
|
+
/** Where the downloaded map lives, relative to the repository root (gitignored). */
|
|
44
|
+
export const MAP_DIR = ".lisa/crystalball-map";
|
|
45
|
+
|
|
46
|
+
/** Every CI map artifact is named `crystalball-map-<base sha>-<run id>[-<leg>]`. */
|
|
47
|
+
export const ARTIFACT_NAME = /^crystalball-map-([0-9a-f]{40})-(\d+)(?:-(.+))?$/;
|
|
48
|
+
|
|
49
|
+
/**
|
|
50
|
+
* The coverage mode a Rails project gets when it names none (owner decision).
|
|
51
|
+
* Owned by `push-gate-defaults.mjs`; re-exported for existing readers.
|
|
52
|
+
*/
|
|
53
|
+
export const RAILS_DEFAULT_COVERAGE = RAILS_PUSH_GATE_DEFAULTS.affectedCoverage;
|
|
54
|
+
|
|
55
|
+
/** Where a partial run's coverage floors come from. */
|
|
56
|
+
export const THRESHOLDS_FILE = "simplecov.thresholds.json";
|
|
57
|
+
|
|
58
|
+
/**
|
|
59
|
+
* Rails changes that reach specs no map can point at, so the full suite runs.
|
|
60
|
+
* The shared list in `affected-tests.mjs` (lockfiles among them) is checked
|
|
61
|
+
* as well.
|
|
62
|
+
*/
|
|
63
|
+
export const RAILS_FULL_SUITE_TRIGGERS = Object.freeze([
|
|
64
|
+
{
|
|
65
|
+
pattern: /^Gemfile$/,
|
|
66
|
+
reason: "the Gemfile changed (installed gems)",
|
|
67
|
+
},
|
|
68
|
+
{
|
|
69
|
+
pattern: /^db\/(schema\.rb|structure\.sql)$/,
|
|
70
|
+
reason: "the database schema changed",
|
|
71
|
+
},
|
|
72
|
+
{
|
|
73
|
+
pattern: /^config\//,
|
|
74
|
+
reason: "application configuration under config/ changed",
|
|
75
|
+
},
|
|
76
|
+
{
|
|
77
|
+
pattern: /^spec\/support\//,
|
|
78
|
+
reason: "shared spec support code changed",
|
|
79
|
+
},
|
|
80
|
+
{
|
|
81
|
+
pattern: /^spec\/[^/]+_helper\.rb$/,
|
|
82
|
+
reason: "a spec helper changed",
|
|
83
|
+
},
|
|
84
|
+
{
|
|
85
|
+
pattern: /^(\.rspec|\.simplecov)$/,
|
|
86
|
+
reason: "the RSpec or SimpleCov configuration changed",
|
|
87
|
+
},
|
|
88
|
+
{
|
|
89
|
+
pattern:
|
|
90
|
+
/^scripts\/(lisa-rspec-select\.mjs|lib\/rspec-selection\.mjs|lib\/affected-tests\.mjs|lisa_crystalball_recorder\.rb|lisa_rspec_partial_coverage\.rb)$/,
|
|
91
|
+
reason: "the spec-selection machinery itself changed",
|
|
92
|
+
},
|
|
93
|
+
]);
|
|
94
|
+
|
|
95
|
+
/**
|
|
96
|
+
* Paths RSpec never loads, so a change to one cannot reach a spec and needs
|
|
97
|
+
* no map entry: documentation, CI and coding-agent configuration.
|
|
98
|
+
*/
|
|
99
|
+
const NOT_LOADED_BY_RSPEC = Object.freeze([
|
|
100
|
+
/\.(md|mdx|markdown|txt|rdoc)$/i,
|
|
101
|
+
/^(LICENSE|CHANGELOG|README)[^/]*$/i,
|
|
102
|
+
/^(docs|wiki)\//,
|
|
103
|
+
/^\.(github|claude|codex|cursor|opencode|agents|devin|windsurf|gemini|agy)\//,
|
|
104
|
+
]);
|
|
105
|
+
|
|
106
|
+
/** A file RSpec collects as a spec. */
|
|
107
|
+
export const SPEC_FILE = /^spec\/.+_spec\.rb$/;
|
|
108
|
+
|
|
109
|
+
/** Spec groups whose behaviour lives outside the RSpec process; always run. */
|
|
110
|
+
export const ALWAYS_RUN_DIRS = Object.freeze([
|
|
111
|
+
"spec/system/",
|
|
112
|
+
"spec/features/",
|
|
113
|
+
]);
|
|
114
|
+
|
|
115
|
+
/** `:js`, `js: true`, `lisa_always_run: true` (or `:lisa_always_run`) in a spec. */
|
|
116
|
+
const ALWAYS_RUN_TAG =
|
|
117
|
+
/(?:[,(]\s*:js\b|\bjs:\s*true\b|\blisa_always_run:\s*true\b|[,(]\s*:lisa_always_run\b)/;
|
|
118
|
+
|
|
119
|
+
/**
|
|
120
|
+
* Whether a checkout is a Rails project (the detection G3 uses too).
|
|
121
|
+
* @param {(file: string) => boolean} exists Whether a repository file exists.
|
|
122
|
+
* @returns {boolean} True for a Rails project.
|
|
123
|
+
*/
|
|
124
|
+
export function isRailsProject(exists) {
|
|
125
|
+
return exists("bin/rails") || exists("config/application.rb");
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
/**
|
|
129
|
+
* The selection settings for a Rails project.
|
|
130
|
+
*
|
|
131
|
+
* Validation is `affectedTestsSettings`', so a typo is refused exactly as on
|
|
132
|
+
* TypeScript hosts; only the defaults differ: selection is on for a Rails
|
|
133
|
+
* project and coverage defaults to `changed-files`.
|
|
134
|
+
* @param {Record<string, unknown>|null|undefined} config Parsed `.lisa.config.json`.
|
|
135
|
+
* @param {boolean} rails Whether this is a Rails project.
|
|
136
|
+
* @returns {{enabled: boolean, coverage: "full"|"changed-files"|"skip"}} Settings.
|
|
137
|
+
* @throws {Error} When `pushGate` is invalid.
|
|
138
|
+
*/
|
|
139
|
+
export function rspecSelectionSettings(config, rails) {
|
|
140
|
+
return affectedTestsSettings(
|
|
141
|
+
rails ? withDefaults(config, RAILS_PUSH_GATE_DEFAULTS) : config
|
|
142
|
+
);
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
/**
|
|
146
|
+
* The first full-suite trigger any changed file fires, Rails list first.
|
|
147
|
+
* @param {ReadonlyArray<string>} paths Changed paths.
|
|
148
|
+
* @returns {{file: string, reason: string}|null} The trigger.
|
|
149
|
+
*/
|
|
150
|
+
export function railsTrigger(paths) {
|
|
151
|
+
for (const file of paths) {
|
|
152
|
+
const hit = RAILS_FULL_SUITE_TRIGGERS.find(entry =>
|
|
153
|
+
entry.pattern.test(file)
|
|
154
|
+
);
|
|
155
|
+
if (hit) return { file, reason: hit.reason };
|
|
156
|
+
}
|
|
157
|
+
return firedTrigger(paths);
|
|
158
|
+
}
|
|
159
|
+
|
|
160
|
+
/**
|
|
161
|
+
* Whether a spec's source tags anything to run on every partial push.
|
|
162
|
+
* @param {string} source The spec file's text.
|
|
163
|
+
* @returns {boolean} True when it carries `:js` or `lisa_always_run: true`.
|
|
164
|
+
*/
|
|
165
|
+
export function taggedAlwaysRun(source) {
|
|
166
|
+
return ALWAYS_RUN_TAG.test(source);
|
|
167
|
+
}
|
|
168
|
+
|
|
169
|
+
/**
|
|
170
|
+
* The spec Rails conventions pair with a source file (Crystalball's
|
|
171
|
+
* associated-specs predictor): `app/models/user.rb` ->
|
|
172
|
+
* `spec/models/user_spec.rb`, `lib/a/b.rb` -> `spec/lib/a/b_spec.rb`.
|
|
173
|
+
* @param {string} file Changed path.
|
|
174
|
+
* @returns {string|null} The conventional spec, or null.
|
|
175
|
+
*/
|
|
176
|
+
export function associatedSpec(file) {
|
|
177
|
+
const app = /^app\/(.+)\.rb$/.exec(file);
|
|
178
|
+
if (app) return `spec/${app[1]}_spec.rb`;
|
|
179
|
+
const lib = /^lib\/(.+)\.rb$/.exec(file);
|
|
180
|
+
return lib ? `spec/lib/${lib[1]}_spec.rb` : null;
|
|
181
|
+
}
|
|
182
|
+
|
|
183
|
+
/**
|
|
184
|
+
* @typedef {object} RspecSelection
|
|
185
|
+
* @property {"full"|"partial"} kind Which run to do.
|
|
186
|
+
* @property {string|null} reason Why the full suite runs (kind `full`).
|
|
187
|
+
* @property {Array<{file: string, reason: string}>} specs Spec files to run, with why.
|
|
188
|
+
* @property {string[]} ignored Changed files RSpec never loads.
|
|
189
|
+
*/
|
|
190
|
+
|
|
191
|
+
/**
|
|
192
|
+
* A full-suite selection.
|
|
193
|
+
* @param {string} reason Why.
|
|
194
|
+
* @returns {RspecSelection} The selection.
|
|
195
|
+
*/
|
|
196
|
+
export function fullSuite(reason) {
|
|
197
|
+
return { kind: "full", reason, specs: [], ignored: [] };
|
|
198
|
+
}
|
|
199
|
+
|
|
200
|
+
/**
|
|
201
|
+
* Why a deleted spec sends a `changed-files` push to the full suite, or null
|
|
202
|
+
* when no spec was deleted.
|
|
203
|
+
*
|
|
204
|
+
* Deleting a spec removes the coverage it gave the files it executed, and
|
|
205
|
+
* those files are usually unchanged, so the per-file check (which holds only
|
|
206
|
+
* the changed Ruby files to the floor) never looks at them. A branch could
|
|
207
|
+
* delete the only spec covering a model, drop whole-repo coverage below the
|
|
208
|
+
* floor, and still pass a partial push that the full run it replaced would
|
|
209
|
+
* have failed. Holding the deleted spec's map entry to the floor instead is
|
|
210
|
+
* not safe either: a file no remaining spec loads is absent from SimpleCov's
|
|
211
|
+
* resultset and would read as "outside coverage". So the push fails closed:
|
|
212
|
+
* the full suite runs and its whole-repo minimums decide.
|
|
213
|
+
* @param {ReadonlyArray<{path: string, status: string}>} changed Changed files.
|
|
214
|
+
* @returns {string|null} The full-suite reason.
|
|
215
|
+
*/
|
|
216
|
+
export function deletedSpecReason(changed) {
|
|
217
|
+
const gone = changed.find(
|
|
218
|
+
entry => entry.status === "deleted" && SPEC_FILE.test(entry.path)
|
|
219
|
+
);
|
|
220
|
+
if (!gone) return null;
|
|
221
|
+
return (
|
|
222
|
+
`deleted spec: ${gone.path} no longer covers what it ran, and only ` +
|
|
223
|
+
"the full suite's whole-repo coverage can say whether the project still meets its floor"
|
|
224
|
+
);
|
|
225
|
+
}
|
|
226
|
+
|
|
227
|
+
/**
|
|
228
|
+
* Choose the specs a change can reach, or say why everything must run.
|
|
229
|
+
* @param {object} input Inputs.
|
|
230
|
+
* @param {ReadonlyArray<{path: string, status: "added"|"modified"|"deleted"}>} input.changed Changed files.
|
|
231
|
+
* @param {Readonly<Record<string, ReadonlyArray<string>>>} input.map Spec file -> application files it executed.
|
|
232
|
+
* @param {ReadonlyArray<string>} input.alwaysRun Spec files to run on every partial push.
|
|
233
|
+
* @param {(file: string) => boolean} input.exists Whether a file is in the working tree.
|
|
234
|
+
* @param {"changed-files"|"skip"} [input.coverage] What the partial run does
|
|
235
|
+
* about coverage. In `changed-files` mode a deleted spec sends the push to
|
|
236
|
+
* the full suite: see {@link deletedSpecReason}.
|
|
237
|
+
* @returns {RspecSelection} The selection.
|
|
238
|
+
*/
|
|
239
|
+
export function selectRailsSpecs({
|
|
240
|
+
changed,
|
|
241
|
+
map,
|
|
242
|
+
alwaysRun,
|
|
243
|
+
exists,
|
|
244
|
+
coverage,
|
|
245
|
+
}) {
|
|
246
|
+
const trigger = railsTrigger(changed.map(entry => entry.path));
|
|
247
|
+
if (trigger) return fullSuite(`${trigger.reason} (${trigger.file})`);
|
|
248
|
+
const deleted =
|
|
249
|
+
coverage === "changed-files" ? deletedSpecReason(changed) : null;
|
|
250
|
+
if (deleted) return fullSuite(deleted);
|
|
251
|
+
const readers = readersByFile(map);
|
|
252
|
+
const chosen = new Map();
|
|
253
|
+
const choose = (file, reason) => {
|
|
254
|
+
if (SPEC_FILE.test(file) && exists(file) && !chosen.has(file)) {
|
|
255
|
+
chosen.set(file, reason);
|
|
256
|
+
}
|
|
257
|
+
};
|
|
258
|
+
const ignored = [];
|
|
259
|
+
for (const entry of changed) {
|
|
260
|
+
if (SPEC_FILE.test(entry.path)) {
|
|
261
|
+
if (entry.status !== "deleted") choose(entry.path, "changed spec");
|
|
262
|
+
continue;
|
|
263
|
+
}
|
|
264
|
+
const reading = readers.get(entry.path);
|
|
265
|
+
if (reading) {
|
|
266
|
+
for (const spec of reading) choose(spec, `map: ${entry.path}`);
|
|
267
|
+
const paired = associatedSpec(entry.path);
|
|
268
|
+
if (paired) choose(paired, `conventional spec for ${entry.path}`);
|
|
269
|
+
continue;
|
|
270
|
+
}
|
|
271
|
+
if (entry.status === "deleted") continue;
|
|
272
|
+
if (NOT_LOADED_BY_RSPEC.some(pattern => pattern.test(entry.path))) {
|
|
273
|
+
ignored.push(entry.path);
|
|
274
|
+
continue;
|
|
275
|
+
}
|
|
276
|
+
return fullSuite(
|
|
277
|
+
`unmapped file: ${entry.path} is not in the map, so no map entry can say which specs it reaches`
|
|
278
|
+
);
|
|
279
|
+
}
|
|
280
|
+
for (const spec of alwaysRun) choose(spec, "always run");
|
|
281
|
+
return {
|
|
282
|
+
kind: "partial",
|
|
283
|
+
reason: null,
|
|
284
|
+
specs: [...chosen].map(([file, reason]) => ({ file, reason })),
|
|
285
|
+
ignored,
|
|
286
|
+
};
|
|
287
|
+
}
|
|
288
|
+
|
|
289
|
+
/**
|
|
290
|
+
* The spec files that run on every partial push: everything under the
|
|
291
|
+
* always-run folders, every spec the map recorded with `:js` or
|
|
292
|
+
* `lisa_always_run`, and every spec whose source carries one of those tags.
|
|
293
|
+
* @param {object} input Inputs.
|
|
294
|
+
* @param {ReadonlyArray<string>} input.specFiles Every spec file in the tree.
|
|
295
|
+
* @param {ReadonlyArray<string>} input.recorded The map's `alwaysRun` list.
|
|
296
|
+
* @param {(file: string) => string} input.read A spec file's text.
|
|
297
|
+
* @returns {string[]} Spec files, sorted.
|
|
298
|
+
*/
|
|
299
|
+
export function alwaysRunSpecs({ specFiles, recorded, read }) {
|
|
300
|
+
const present = new Set(specFiles);
|
|
301
|
+
const picked = specFiles.filter(
|
|
302
|
+
file =>
|
|
303
|
+
ALWAYS_RUN_DIRS.some(dir => file.startsWith(dir)) ||
|
|
304
|
+
taggedAlwaysRun(read(file))
|
|
305
|
+
);
|
|
306
|
+
return [
|
|
307
|
+
...new Set([...picked, ...recorded.filter(file => present.has(file))]),
|
|
308
|
+
].sort();
|
|
309
|
+
}
|
|
310
|
+
|
|
311
|
+
/**
|
|
312
|
+
* Merge map documents (`{meta, map, alwaysRun}`) from several CI legs; a spec
|
|
313
|
+
* listed by several legs gets the union of their files.
|
|
314
|
+
* @param {ReadonlyArray<any>} documents Parsed map files.
|
|
315
|
+
* @returns {{map: Record<string, string[]>, alwaysRun: string[], metas: Array<Record<string, unknown>>}} The merge.
|
|
316
|
+
*/
|
|
317
|
+
export function mergeMapDocuments(documents) {
|
|
318
|
+
const valid = documents.filter(
|
|
319
|
+
document =>
|
|
320
|
+
document &&
|
|
321
|
+
typeof document.map === "object" &&
|
|
322
|
+
document.map !== null &&
|
|
323
|
+
!Array.isArray(document.map)
|
|
324
|
+
);
|
|
325
|
+
const specs = [
|
|
326
|
+
...new Set(valid.flatMap(document => Object.keys(document.map))),
|
|
327
|
+
].sort();
|
|
328
|
+
const map = Object.fromEntries(
|
|
329
|
+
specs.map(spec => [
|
|
330
|
+
spec,
|
|
331
|
+
[...new Set(valid.flatMap(document => document.map[spec] ?? []))].sort(),
|
|
332
|
+
])
|
|
333
|
+
);
|
|
334
|
+
const alwaysRun = [
|
|
335
|
+
...new Set(
|
|
336
|
+
valid.flatMap(document =>
|
|
337
|
+
Array.isArray(document.alwaysRun) ? document.alwaysRun : []
|
|
338
|
+
)
|
|
339
|
+
),
|
|
340
|
+
].sort();
|
|
341
|
+
return { map, alwaysRun, metas: valid.map(document => document.meta ?? {}) };
|
|
342
|
+
}
|
|
343
|
+
|
|
344
|
+
/**
|
|
345
|
+
* Map artifacts from `gh api … --jq '{name, runId, createdAt, expired}'`
|
|
346
|
+
* NDJSON. Expired and unrelated artifacts are dropped.
|
|
347
|
+
* @param {string} output NDJSON.
|
|
348
|
+
* @returns {Array<{name: string, baseSha: string, runId: string, createdAt: string}>} Artifacts.
|
|
349
|
+
*/
|
|
350
|
+
export function parseMapArtifacts(output) {
|
|
351
|
+
return output
|
|
352
|
+
.split("\n")
|
|
353
|
+
.filter(line => line.trim() !== "")
|
|
354
|
+
.flatMap(line => {
|
|
355
|
+
let parsed;
|
|
356
|
+
try {
|
|
357
|
+
parsed = JSON.parse(line);
|
|
358
|
+
} catch {
|
|
359
|
+
return [];
|
|
360
|
+
}
|
|
361
|
+
const match = ARTIFACT_NAME.exec(parsed?.name ?? "");
|
|
362
|
+
if (!match || parsed.expired === true) return [];
|
|
363
|
+
return [
|
|
364
|
+
{
|
|
365
|
+
name: parsed.name,
|
|
366
|
+
baseSha: match[1],
|
|
367
|
+
runId: String(parsed.runId ?? match[2]),
|
|
368
|
+
createdAt: String(parsed.createdAt ?? ""),
|
|
369
|
+
},
|
|
370
|
+
];
|
|
371
|
+
});
|
|
372
|
+
}
|
|
373
|
+
|
|
374
|
+
/** Candidate runs checked before the push gives up on a map. */
|
|
375
|
+
export const MAX_MAP_RUN_CHECKS = 10;
|
|
376
|
+
|
|
377
|
+
/**
|
|
378
|
+
* What a verified map's saved metadata carries. A map saved without it was
|
|
379
|
+
* saved before Lisa checked a map's run, so it is not used.
|
|
380
|
+
*/
|
|
381
|
+
export const MAP_TRUST = 1;
|
|
382
|
+
|
|
383
|
+
/** A full 40-character commit SHA. */
|
|
384
|
+
const FULL_SHA = /^[0-9a-f]{40}$/;
|
|
385
|
+
|
|
386
|
+
/**
|
|
387
|
+
* @typedef {{runId: string, baseSha: string, distance: number, names: string[]}} MapRunChoice
|
|
388
|
+
*/
|
|
389
|
+
|
|
390
|
+
/**
|
|
391
|
+
* Every candidate run, in preference order: base equal to the merge-base
|
|
392
|
+
* first, then nearer ancestors, and within one base the newest run first.
|
|
393
|
+
* Each must still pass {@link mapRunRefusal} and {@link mapPiecesRefusal}
|
|
394
|
+
* before its map is used (same contract as `fetch-test-access-map.mjs`).
|
|
395
|
+
* @param {ReadonlyArray<{name: string, baseSha: string, runId: string, createdAt: string}>} artifacts Artifacts.
|
|
396
|
+
* @param {(baseSha: string) => number|undefined} distance Commits from a base to the merge-base, undefined when it is not an ancestor.
|
|
397
|
+
* @returns {MapRunChoice[]} The candidates.
|
|
398
|
+
*/
|
|
399
|
+
export function rankMapRuns(artifacts, distance) {
|
|
400
|
+
const bases = [...new Set(artifacts.map(artifact => artifact.baseSha))]
|
|
401
|
+
.map(baseSha => ({ baseSha, distance: distance(baseSha) }))
|
|
402
|
+
.filter(entry => entry.distance !== undefined)
|
|
403
|
+
.sort((a, b) => a.distance - b.distance);
|
|
404
|
+
return bases.flatMap(({ baseSha, distance: behind }) => {
|
|
405
|
+
const atBase = artifacts.filter(artifact => artifact.baseSha === baseSha);
|
|
406
|
+
const runs = [
|
|
407
|
+
...new Set(
|
|
408
|
+
[...atBase]
|
|
409
|
+
.sort(
|
|
410
|
+
(a, b) =>
|
|
411
|
+
b.createdAt.localeCompare(a.createdAt) ||
|
|
412
|
+
Number(b.runId) - Number(a.runId)
|
|
413
|
+
)
|
|
414
|
+
.map(artifact => artifact.runId)
|
|
415
|
+
),
|
|
416
|
+
];
|
|
417
|
+
return runs.map(runId => {
|
|
418
|
+
const names = [
|
|
419
|
+
...new Set(
|
|
420
|
+
atBase
|
|
421
|
+
.filter(artifact => artifact.runId === runId)
|
|
422
|
+
.map(artifact => artifact.name)
|
|
423
|
+
),
|
|
424
|
+
].sort();
|
|
425
|
+
// A sharded run uploads each leg's map and the aggregate's merge of
|
|
426
|
+
// them; the merge alone is the whole suite, so it is all that needs
|
|
427
|
+
// downloading. Its metadata lists every leg, so completeness is still
|
|
428
|
+
// checked (see mapPiecesRefusal).
|
|
429
|
+
const whole = `crystalball-map-${baseSha}-${runId}`;
|
|
430
|
+
return {
|
|
431
|
+
runId,
|
|
432
|
+
baseSha,
|
|
433
|
+
distance: behind,
|
|
434
|
+
names: names.includes(whole) ? [whole] : names,
|
|
435
|
+
};
|
|
436
|
+
});
|
|
437
|
+
});
|
|
438
|
+
}
|
|
439
|
+
|
|
440
|
+
/**
|
|
441
|
+
* The preferred candidate run, before any trust check (see {@link rankMapRuns}).
|
|
442
|
+
* @param {ReadonlyArray<{name: string, baseSha: string, runId: string, createdAt: string}>} artifacts Artifacts.
|
|
443
|
+
* @param {(baseSha: string) => number|undefined} distance Commits from a base to the merge-base.
|
|
444
|
+
* @returns {MapRunChoice|undefined} The choice.
|
|
445
|
+
*/
|
|
446
|
+
export function chooseMapRun(artifacts, distance) {
|
|
447
|
+
return rankMapRuns(artifacts, distance)[0];
|
|
448
|
+
}
|
|
449
|
+
|
|
450
|
+
/**
|
|
451
|
+
* Why a workflow run's map must not be used, or null when it may.
|
|
452
|
+
*
|
|
453
|
+
* A map decides which specs a push skips, and a public repository's artifact
|
|
454
|
+
* listing includes fork pull requests' runs and runs that failed or were
|
|
455
|
+
* cancelled part way. Only a run of this repository's own code that concluded
|
|
456
|
+
* `success` qualifies: a fork controls the code (and recorder) that wrote its
|
|
457
|
+
* map, and a failed or cancelled run may have stopped before every spec ran.
|
|
458
|
+
* @param {{conclusion?: unknown, headSha?: unknown, headRepository?: unknown}|null|undefined} info What `gh api repos/<repo>/actions/runs/<id>` reports.
|
|
459
|
+
* @param {string} repo owner/name the map is meant for.
|
|
460
|
+
* @returns {string|null} The reason, or null.
|
|
461
|
+
*/
|
|
462
|
+
export function mapRunRefusal(info, repo) {
|
|
463
|
+
const head =
|
|
464
|
+
typeof info?.headRepository === "string" ? info.headRepository : "";
|
|
465
|
+
if (!repo || head.toLowerCase() !== repo.toLowerCase()) {
|
|
466
|
+
return `its code came from ${head || "an unknown repository"}, not ${repo || "this repository"}`;
|
|
467
|
+
}
|
|
468
|
+
if (info?.conclusion !== "success") {
|
|
469
|
+
return `it did not succeed (${typeof info?.conclusion === "string" ? info.conclusion : "still running"})`;
|
|
470
|
+
}
|
|
471
|
+
if (typeof info.headSha !== "string" || !FULL_SHA.test(info.headSha)) {
|
|
472
|
+
return "GitHub reported no head commit for it";
|
|
473
|
+
}
|
|
474
|
+
return null;
|
|
475
|
+
}
|
|
476
|
+
|
|
477
|
+
/**
|
|
478
|
+
* The per-leg metadata a downloaded map stands for: a merged map's
|
|
479
|
+
* `meta.merged` (one entry per shard leg), else the map's own `meta`.
|
|
480
|
+
* @param {ReadonlyArray<Record<string, any>>} metas Downloaded documents' metadata.
|
|
481
|
+
* @returns {Array<Record<string, any>>} One entry per recorded piece.
|
|
482
|
+
*/
|
|
483
|
+
function pieceMetas(metas) {
|
|
484
|
+
return metas.flatMap(meta =>
|
|
485
|
+
Array.isArray(meta?.merged) ? meta.merged : [meta ?? {}]
|
|
486
|
+
);
|
|
487
|
+
}
|
|
488
|
+
|
|
489
|
+
/**
|
|
490
|
+
* Why a run's downloaded map pieces are not one complete map of that run, or
|
|
491
|
+
* null when they are.
|
|
492
|
+
*
|
|
493
|
+
* Each piece names the run, base and head commit it was recorded at, how many
|
|
494
|
+
* pieces the suite has (`pieces`, one per shard leg) and its own zero-based
|
|
495
|
+
* index (`piece`). Every piece must be present exactly once: a shard that
|
|
496
|
+
* never recorded would otherwise drop its specs from the map. A piece that
|
|
497
|
+
* does not say how many there are (an older recorder) is refused too.
|
|
498
|
+
* @param {ReadonlyArray<Record<string, any>>} metas Downloaded documents' metadata.
|
|
499
|
+
* @param {{runId: string, baseSha: string, headSha: string}} run The run they must belong to.
|
|
500
|
+
* @returns {string|null} The reason, or null.
|
|
501
|
+
*/
|
|
502
|
+
export function mapPiecesRefusal(metas, { runId, baseSha, headSha }) {
|
|
503
|
+
const pieces = pieceMetas(metas);
|
|
504
|
+
if (pieces.length === 0) return "its artifacts hold no map";
|
|
505
|
+
const foreign = pieces.some(
|
|
506
|
+
meta =>
|
|
507
|
+
String(meta.runId ?? "") !== runId ||
|
|
508
|
+
meta.baseSha !== baseSha ||
|
|
509
|
+
meta.headSha !== headSha
|
|
510
|
+
);
|
|
511
|
+
if (foreign) {
|
|
512
|
+
return `a map piece was not recorded by run ${runId} at its head commit ${headSha.slice(0, 12)}`;
|
|
513
|
+
}
|
|
514
|
+
const declared = [...new Set(pieces.map(meta => meta.pieces))];
|
|
515
|
+
if (declared.length !== 1) {
|
|
516
|
+
return "its map pieces disagree on how many there are";
|
|
517
|
+
}
|
|
518
|
+
const [total] = declared;
|
|
519
|
+
if (!Number.isInteger(total) || total < 1) {
|
|
520
|
+
return "its map does not say how many pieces it has";
|
|
521
|
+
}
|
|
522
|
+
const indices = new Set(
|
|
523
|
+
pieces
|
|
524
|
+
.map(meta => meta.piece)
|
|
525
|
+
.filter(piece => Number.isInteger(piece) && piece >= 0 && piece < total)
|
|
526
|
+
);
|
|
527
|
+
if (indices.size !== total || pieces.length !== total) {
|
|
528
|
+
return `only ${indices.size} of ${total} map pieces were recorded`;
|
|
529
|
+
}
|
|
530
|
+
return null;
|
|
531
|
+
}
|
|
532
|
+
|
|
533
|
+
/**
|
|
534
|
+
* Line numbers (1-based) inside `# :nocov:` blocks, which SimpleCov skips.
|
|
535
|
+
* @param {string} source File text.
|
|
536
|
+
* @returns {Set<number>} Skipped lines.
|
|
537
|
+
*/
|
|
538
|
+
export function nocovLines(source) {
|
|
539
|
+
const skipped = new Set();
|
|
540
|
+
let inside = false;
|
|
541
|
+
source.split("\n").forEach((line, index) => {
|
|
542
|
+
const marker = /^\s*#\s*:nocov:/.test(line);
|
|
543
|
+
if (marker) inside = !inside;
|
|
544
|
+
if (marker || inside) skipped.add(index + 1);
|
|
545
|
+
});
|
|
546
|
+
return skipped;
|
|
547
|
+
}
|
|
548
|
+
|
|
549
|
+
/**
|
|
550
|
+
* One file's line and branch percentages from a SimpleCov resultset entry.
|
|
551
|
+
* @param {{lines?: Array<number|null|"ignored">, branches?: Record<string, Record<string, number>>}} entry Resultset entry.
|
|
552
|
+
* @param {Set<number>} skipped Lines SimpleCov skips.
|
|
553
|
+
* @returns {{line: number|null, branch: number|null}} Percentages, null when nothing is measurable.
|
|
554
|
+
*/
|
|
555
|
+
export function filePercentages(entry, skipped) {
|
|
556
|
+
const relevant = (entry.lines ?? [])
|
|
557
|
+
.map((count, index) => ({ count, line: index + 1 }))
|
|
558
|
+
.filter(
|
|
559
|
+
({ count, line }) => typeof count === "number" && !skipped.has(line)
|
|
560
|
+
);
|
|
561
|
+
const covered = relevant.filter(({ count }) => count > 0).length;
|
|
562
|
+
const branches = Object.entries(entry.branches ?? {}).flatMap(
|
|
563
|
+
([condition, outcomes]) => {
|
|
564
|
+
const line = Number(/^\[:\w+, \d+, (\d+)/.exec(condition)?.[1]);
|
|
565
|
+
return skipped.has(line) ? [] : Object.values(outcomes ?? {});
|
|
566
|
+
}
|
|
567
|
+
);
|
|
568
|
+
const taken = branches.filter(count => count > 0).length;
|
|
569
|
+
return {
|
|
570
|
+
line: relevant.length ? (covered / relevant.length) * 100 : null,
|
|
571
|
+
branch: branches.length ? (taken / branches.length) * 100 : null,
|
|
572
|
+
};
|
|
573
|
+
}
|
|
574
|
+
|
|
575
|
+
/**
|
|
576
|
+
* Hold each changed Ruby file to the thresholds on its own.
|
|
577
|
+
* @param {object} input Inputs.
|
|
578
|
+
* @param {Record<string, {coverage?: Record<string, any>}>} input.resultset SimpleCov's `.resultset.json`.
|
|
579
|
+
* @param {string} input.root Repository root, absolute.
|
|
580
|
+
* @param {ReadonlyArray<string>} input.files Changed, existing Ruby files outside spec/.
|
|
581
|
+
* @param {{line?: number, branch?: number}} input.thresholds Floors.
|
|
582
|
+
* @param {(file: string) => string} input.read A file's text.
|
|
583
|
+
* @returns {{shortfalls: string[], measured: string[], unmeasured: string[]}} The verdict.
|
|
584
|
+
*/
|
|
585
|
+
export function changedRubyCoverage({
|
|
586
|
+
resultset,
|
|
587
|
+
root,
|
|
588
|
+
files,
|
|
589
|
+
thresholds,
|
|
590
|
+
read,
|
|
591
|
+
}) {
|
|
592
|
+
const coverage = Object.assign(
|
|
593
|
+
{},
|
|
594
|
+
...Object.values(resultset ?? {}).map(run => run?.coverage ?? {})
|
|
595
|
+
);
|
|
596
|
+
const shortfalls = [];
|
|
597
|
+
const measured = [];
|
|
598
|
+
const unmeasured = [];
|
|
599
|
+
for (const file of files) {
|
|
600
|
+
const key = Object.hasOwn(coverage, `${root}/${file}`)
|
|
601
|
+
? `${root}/${file}`
|
|
602
|
+
: Object.keys(coverage).find(candidate => candidate.endsWith(`/${file}`));
|
|
603
|
+
const entry = key === undefined ? undefined : coverage[key];
|
|
604
|
+
if (!entry) {
|
|
605
|
+
unmeasured.push(file);
|
|
606
|
+
continue;
|
|
607
|
+
}
|
|
608
|
+
measured.push(file);
|
|
609
|
+
const pct = filePercentages(entry, nocovLines(read(file)));
|
|
610
|
+
for (const metric of ["line", "branch"]) {
|
|
611
|
+
const floor = thresholds[metric];
|
|
612
|
+
const value = pct[metric];
|
|
613
|
+
if (typeof floor !== "number" || value === null) continue;
|
|
614
|
+
if (value < floor) {
|
|
615
|
+
shortfalls.push(
|
|
616
|
+
`${file}: ${metric} coverage ${value.toFixed(2)}% is below ${floor}%`
|
|
617
|
+
);
|
|
618
|
+
}
|
|
619
|
+
}
|
|
620
|
+
}
|
|
621
|
+
return { shortfalls, measured, unmeasured };
|
|
622
|
+
}
|
|
623
|
+
|
|
624
|
+
/** Who speaks in the Rails selector's lines. */
|
|
625
|
+
export const RSPEC_SUBJECT = "affected specs";
|
|
626
|
+
|
|
627
|
+
/**
|
|
628
|
+
* The Rails selector's escalation lines: one per changed Ruby file below its
|
|
629
|
+
* floor. A push is never stricter than whole-repo coverage
|
|
630
|
+
* (CodySwannGT/lisa#4600), so such a file sends the push to the full suite,
|
|
631
|
+
* whose SimpleCov minimums decide it, rather than failing it.
|
|
632
|
+
* @param {object} input Inputs.
|
|
633
|
+
* @param {ReadonlyArray<string>} input.files Changed Ruby files, in order.
|
|
634
|
+
* @param {ReadonlyArray<string>} input.shortfalls {@link changedRubyCoverage}'s shortfalls.
|
|
635
|
+
* @returns {string[]} Lines; empty when every file meets its floor.
|
|
636
|
+
*/
|
|
637
|
+
export function railsCoverageEscalation({ files, shortfalls }) {
|
|
638
|
+
return coverageEscalationLines({ subject: RSPEC_SUBJECT, files, shortfalls });
|
|
639
|
+
}
|
|
640
|
+
|
|
641
|
+
/**
|
|
642
|
+
* The Rails selector's escalation line for a partial run that proved nothing.
|
|
643
|
+
* @param {string} because Why the partial run could not decide the push.
|
|
644
|
+
* @returns {string} One line.
|
|
645
|
+
*/
|
|
646
|
+
export function railsFullSuiteEscalation(because) {
|
|
647
|
+
return fullSuiteEscalation(RSPEC_SUBJECT, because);
|
|
648
|
+
}
|
|
649
|
+
|
|
650
|
+
/**
|
|
651
|
+
* The lines that explain a selection before RSpec runs.
|
|
652
|
+
* @param {RspecSelection} selection The selection.
|
|
653
|
+
* @param {string} coverageNote What this run does about coverage.
|
|
654
|
+
* @returns {string[]} Plain-language lines.
|
|
655
|
+
*/
|
|
656
|
+
export function explainRspecSelection(selection, coverageNote) {
|
|
657
|
+
if (selection.kind === "full") {
|
|
658
|
+
return [`🎯 affected specs: Running the full suite: ${selection.reason}`];
|
|
659
|
+
}
|
|
660
|
+
return [
|
|
661
|
+
`🎯 affected specs: running ${selection.specs.length} spec file(s) the change can reach.`,
|
|
662
|
+
...selection.specs.map(spec => ` ${spec.file} (${spec.reason})`),
|
|
663
|
+
...(selection.ignored.length
|
|
664
|
+
? [
|
|
665
|
+
" RSpec never loads these changed files:",
|
|
666
|
+
...selection.ignored.map(file => ` ${file}`),
|
|
667
|
+
]
|
|
668
|
+
: []),
|
|
669
|
+
` Coverage: ${coverageNote}`,
|
|
670
|
+
" CI still runs every spec before merge.",
|
|
671
|
+
];
|
|
672
|
+
}
|