@codyswann/lisa 5.4.0 → 5.5.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +60 -3
- package/all/copy-contents/gitignore +16 -0
- package/all/copy-contents/scripts/lisa-mutation.sh +4 -6
- package/all/copy-overwrite/scripts/fetch-test-access-map.d.mts +71 -0
- package/all/copy-overwrite/scripts/fetch-test-access-map.mjs +674 -0
- package/all/copy-overwrite/scripts/lib/affected-tests.mjs +818 -0
- package/all/copy-overwrite/scripts/lib/automation-provenance-local.mjs +22 -1
- package/all/copy-overwrite/scripts/lib/build-marker.mjs +410 -0
- package/all/copy-overwrite/scripts/lib/gate-pass-cache.mjs +537 -0
- package/all/copy-overwrite/scripts/lib/kill-marks.mjs +1 -2
- package/all/copy-overwrite/scripts/lib/lisa-cleanup-sweep-processes.mjs +3 -4
- package/all/copy-overwrite/scripts/lib/npm-update-controller-broker.mjs +1 -1
- package/all/copy-overwrite/scripts/lib/npm-update-gate-hooks.mjs +2 -1
- package/all/copy-overwrite/scripts/lib/npm-update-helper-inventory.mjs +8 -1
- package/all/copy-overwrite/scripts/lib/npm-update-hosted-hook.mjs +1 -1
- package/all/copy-overwrite/scripts/lib/npm-update-tool-launcher.mjs +1 -1
- package/all/copy-overwrite/scripts/lib/push-admission.mjs +158 -0
- package/all/copy-overwrite/scripts/lib/push-gate-defaults.d.mts +34 -0
- package/all/copy-overwrite/scripts/lib/push-gate-defaults.mjs +147 -0
- package/all/copy-overwrite/scripts/lib/push-timing.mjs +323 -0
- package/all/copy-overwrite/scripts/lib/rspec-selection.mjs +672 -0
- package/all/copy-overwrite/scripts/lisa-affected-tests.mjs +566 -0
- package/all/copy-overwrite/scripts/lisa-gates.mjs +29 -0
- package/all/copy-overwrite/scripts/lisa-lint-staged-preflight.mjs +10 -1
- package/all/copy-overwrite/scripts/lisa-push-timing-report.mjs +153 -0
- package/all/copy-overwrite/scripts/lisa-rspec-select.mjs +982 -0
- package/all/copy-overwrite/scripts/lisa-run-gates.mjs +231 -6
- package/all/copy-overwrite/scripts/npm-updater-helper-graph.json +105 -17
- package/all/deletions.json +11 -2
- package/cdk/create-only/vitest.config.local.ts +1 -7
- package/cdk/package-lisa/package.lisa.json +4 -4
- package/dist/cli/admit-cmd.d.ts +21 -0
- package/dist/cli/admit-cmd.d.ts.map +1 -0
- package/dist/cli/admit-cmd.js +142 -0
- package/dist/cli/admit-cmd.js.map +1 -0
- package/dist/cli/check-cmd.d.ts +72 -0
- package/dist/cli/check-cmd.d.ts.map +1 -0
- package/dist/cli/check-cmd.js +316 -0
- package/dist/cli/check-cmd.js.map +1 -0
- package/dist/cli/index.d.ts.map +1 -1
- package/dist/cli/index.js +6 -4
- package/dist/cli/index.js.map +1 -1
- package/dist/cli/lisa-test-run-admission.d.ts +18 -0
- package/dist/cli/lisa-test-run-admission.d.ts.map +1 -0
- package/dist/cli/lisa-test-run-admission.js +62 -0
- package/dist/cli/lisa-test-run-admission.js.map +1 -0
- package/dist/cli/lisa-test-run-payload.d.ts +37 -0
- package/dist/cli/lisa-test-run-payload.d.ts.map +1 -0
- package/dist/cli/lisa-test-run-payload.js +55 -0
- package/dist/cli/lisa-test-run-payload.js.map +1 -0
- package/dist/cli/lisa-test-run-shard-files.d.ts +89 -0
- package/dist/cli/lisa-test-run-shard-files.d.ts.map +1 -0
- package/dist/cli/lisa-test-run-shard-files.js +239 -0
- package/dist/cli/lisa-test-run-shard-files.js.map +1 -0
- package/dist/cli/lisa-test-run-shard.d.ts +6 -2
- package/dist/cli/lisa-test-run-shard.d.ts.map +1 -1
- package/dist/cli/lisa-test-run-shard.js +25 -13
- package/dist/cli/lisa-test-run-shard.js.map +1 -1
- package/dist/cli/lisa-test-run.d.ts +1 -1
- package/dist/cli/lisa-test-run.d.ts.map +1 -1
- package/dist/cli/lisa-test-run.js +47 -10
- package/dist/cli/lisa-test-run.js.map +1 -1
- package/dist/cli/update-check-hook.d.ts.map +1 -1
- package/dist/cli/update-check-hook.js +3 -0
- package/dist/cli/update-check-hook.js.map +1 -1
- package/dist/configs/vitest/base.d.ts +58 -135
- package/dist/configs/vitest/base.d.ts.map +1 -1
- package/dist/configs/vitest/base.js +76 -228
- package/dist/configs/vitest/base.js.map +1 -1
- package/dist/configs/vitest/cdk.d.ts.map +1 -1
- package/dist/configs/vitest/cdk.js +3 -2
- package/dist/configs/vitest/cdk.js.map +1 -1
- package/dist/configs/vitest/coverage-include-global-setup.d.ts.map +1 -1
- package/dist/configs/vitest/coverage-include-global-setup.js +3 -4
- package/dist/configs/vitest/coverage-include-global-setup.js.map +1 -1
- package/dist/configs/vitest/coverage-reports-directory.d.ts +27 -5
- package/dist/configs/vitest/coverage-reports-directory.d.ts.map +1 -1
- package/dist/configs/vitest/coverage-reports-directory.js +47 -10
- package/dist/configs/vitest/coverage-reports-directory.js.map +1 -1
- package/dist/configs/vitest/harper-fabric.d.ts.map +1 -1
- package/dist/configs/vitest/harper-fabric.js +3 -2
- package/dist/configs/vitest/harper-fabric.js.map +1 -1
- package/dist/configs/vitest/nestjs.d.ts.map +1 -1
- package/dist/configs/vitest/nestjs.js +3 -2
- package/dist/configs/vitest/nestjs.js.map +1 -1
- package/dist/configs/vitest/phaser.d.ts.map +1 -1
- package/dist/configs/vitest/phaser.js +3 -2
- package/dist/configs/vitest/phaser.js.map +1 -1
- package/dist/configs/vitest/refusal-announcement.d.ts +51 -0
- package/dist/configs/vitest/refusal-announcement.d.ts.map +1 -0
- package/dist/configs/vitest/refusal-announcement.js +97 -0
- package/dist/configs/vitest/refusal-announcement.js.map +1 -0
- package/dist/configs/vitest/socket-safe-temp-base.d.ts +3 -4
- package/dist/configs/vitest/socket-safe-temp-base.d.ts.map +1 -1
- package/dist/configs/vitest/socket-safe-temp-base.js +7 -6
- package/dist/configs/vitest/socket-safe-temp-base.js.map +1 -1
- package/dist/configs/vitest/typescript.d.ts.map +1 -1
- package/dist/configs/vitest/typescript.js +3 -2
- package/dist/configs/vitest/typescript.js.map +1 -1
- package/dist/core/admission-decision.d.ts +110 -0
- package/dist/core/admission-decision.d.ts.map +1 -0
- package/dist/core/admission-decision.js +91 -0
- package/dist/core/admission-decision.js.map +1 -0
- package/dist/core/admission-lock.d.ts +69 -0
- package/dist/core/admission-lock.d.ts.map +1 -0
- package/dist/core/admission-lock.js +278 -0
- package/dist/core/admission-lock.js.map +1 -0
- package/dist/core/admission-settings.d.ts +69 -0
- package/dist/core/admission-settings.d.ts.map +1 -0
- package/dist/core/admission-settings.js +204 -0
- package/dist/core/admission-settings.js.map +1 -0
- package/dist/core/admission-state.d.ts +50 -0
- package/dist/core/admission-state.d.ts.map +1 -0
- package/dist/core/admission-state.js +168 -0
- package/dist/core/admission-state.js.map +1 -0
- package/dist/core/admission.d.ts +70 -0
- package/dist/core/admission.d.ts.map +1 -0
- package/dist/core/admission.js +205 -0
- package/dist/core/admission.js.map +1 -0
- package/dist/core/lisa-owned-hash-ledger.d.ts.map +1 -1
- package/dist/core/lisa-owned-hash-ledger.js +318 -0
- package/dist/core/lisa-owned-hash-ledger.js.map +1 -1
- package/dist/core/nightly-e2e-guard-behavior-certificate.js +2 -2
- package/dist/core/project-config-push-gate.d.ts +66 -0
- package/dist/core/project-config-push-gate.d.ts.map +1 -0
- package/dist/core/project-config-push-gate.js +82 -0
- package/dist/core/project-config-push-gate.js.map +1 -0
- package/dist/core/project-config.d.ts +4 -0
- package/dist/core/project-config.d.ts.map +1 -1
- package/dist/core/project-config.js +14 -9
- package/dist/core/project-config.js.map +1 -1
- package/dist/core/upstream-evidence-manifest.d.ts.map +1 -1
- package/dist/core/upstream-evidence-manifest.js +197 -123
- package/dist/core/upstream-evidence-manifest.js.map +1 -1
- package/expo/package-lisa/package.lisa.json +2 -2
- package/harper-fabric/package-lisa/package.lisa.json +4 -4
- package/nestjs/create-only/vitest.config.local.ts +1 -7
- package/nestjs/package-lisa/package.lisa.json +4 -4
- package/npm-package/package-lisa/package.lisa.json +4 -4
- package/package.json +12 -11
- package/phaser/package-lisa/package.lisa.json +4 -4
- package/plugins/lisa/.claude-plugin/plugin.json +1 -1
- package/plugins/lisa/.codex-plugin/plugin.json +1 -1
- package/plugins/lisa/.codex-plugin/skills/lisa-drive-pr-to-merge/SKILL.md +16 -3
- package/plugins/lisa/.codex-plugin/skills/lisa-git-submit-pr/SKILL.md +1 -1
- package/plugins/lisa/.codex-plugin/skills/lisa-implement/SKILL.md +1 -1
- package/plugins/lisa/skills/lisa-drive-pr-to-merge/SKILL.md +16 -3
- package/plugins/lisa/skills/lisa-git-submit-pr/SKILL.md +1 -1
- package/plugins/lisa/skills/lisa-implement/SKILL.md +1 -1
- package/plugins/lisa-agy/plugin.json +1 -1
- package/plugins/lisa-agy/skills/lisa-drive-pr-to-merge/SKILL.md +16 -3
- package/plugins/lisa-agy/skills/lisa-git-submit-pr/SKILL.md +1 -1
- package/plugins/lisa-agy/skills/lisa-implement/SKILL.md +1 -1
- package/plugins/lisa-cdk/.claude-plugin/plugin.json +1 -1
- package/plugins/lisa-cdk/.codex-plugin/plugin.json +1 -1
- package/plugins/lisa-cdk-agy/plugin.json +1 -1
- package/plugins/lisa-cdk-copilot/.claude-plugin/plugin.json +1 -1
- package/plugins/lisa-cdk-cursor/.claude-plugin/plugin.json +1 -1
- package/plugins/lisa-cdk-devin/.claude-plugin/plugin.json +1 -1
- package/plugins/lisa-cdk-devin/.devin-plugin/plugin.json +1 -1
- package/plugins/lisa-copilot/.claude-plugin/plugin.json +1 -1
- package/plugins/lisa-copilot/skills/lisa-drive-pr-to-merge/SKILL.md +16 -3
- package/plugins/lisa-copilot/skills/lisa-git-submit-pr/SKILL.md +1 -1
- package/plugins/lisa-copilot/skills/lisa-implement/SKILL.md +1 -1
- package/plugins/lisa-cursor/.claude-plugin/plugin.json +1 -1
- package/plugins/lisa-cursor/skills/lisa-drive-pr-to-merge/SKILL.md +16 -3
- package/plugins/lisa-cursor/skills/lisa-git-submit-pr/SKILL.md +1 -1
- package/plugins/lisa-cursor/skills/lisa-implement/SKILL.md +1 -1
- package/plugins/lisa-devin/.claude-plugin/plugin.json +1 -1
- package/plugins/lisa-devin/.devin-plugin/plugin.json +1 -1
- package/plugins/lisa-devin/skills/lisa-drive-pr-to-merge/SKILL.md +16 -3
- package/plugins/lisa-devin/skills/lisa-git-submit-pr/SKILL.md +1 -1
- package/plugins/lisa-devin/skills/lisa-implement/SKILL.md +1 -1
- package/plugins/lisa-expo/.claude-plugin/plugin.json +1 -1
- package/plugins/lisa-expo/.codex-plugin/plugin.json +1 -1
- package/plugins/lisa-expo-agy/plugin.json +1 -1
- package/plugins/lisa-expo-copilot/.claude-plugin/plugin.json +1 -1
- package/plugins/lisa-expo-cursor/.claude-plugin/plugin.json +1 -1
- package/plugins/lisa-expo-devin/.claude-plugin/plugin.json +1 -1
- package/plugins/lisa-expo-devin/.devin-plugin/plugin.json +1 -1
- package/plugins/lisa-harper-fabric/.claude-plugin/plugin.json +1 -1
- package/plugins/lisa-harper-fabric/.codex-plugin/plugin.json +1 -1
- package/plugins/lisa-harper-fabric-agy/plugin.json +1 -1
- package/plugins/lisa-harper-fabric-copilot/.claude-plugin/plugin.json +1 -1
- package/plugins/lisa-harper-fabric-cursor/.claude-plugin/plugin.json +1 -1
- package/plugins/lisa-harper-fabric-devin/.claude-plugin/plugin.json +1 -1
- package/plugins/lisa-harper-fabric-devin/.devin-plugin/plugin.json +1 -1
- package/plugins/lisa-nestjs/.claude-plugin/plugin.json +1 -1
- package/plugins/lisa-nestjs/.codex-plugin/plugin.json +1 -1
- package/plugins/lisa-nestjs-agy/plugin.json +1 -1
- package/plugins/lisa-nestjs-copilot/.claude-plugin/plugin.json +1 -1
- package/plugins/lisa-nestjs-cursor/.claude-plugin/plugin.json +1 -1
- package/plugins/lisa-nestjs-devin/.claude-plugin/plugin.json +1 -1
- package/plugins/lisa-nestjs-devin/.devin-plugin/plugin.json +1 -1
- package/plugins/lisa-phaser/.claude-plugin/plugin.json +1 -1
- package/plugins/lisa-phaser/.codex-plugin/plugin.json +1 -1
- package/plugins/lisa-phaser-agy/plugin.json +1 -1
- package/plugins/lisa-phaser-copilot/.claude-plugin/plugin.json +1 -1
- package/plugins/lisa-phaser-cursor/.claude-plugin/plugin.json +1 -1
- package/plugins/lisa-phaser-devin/.claude-plugin/plugin.json +1 -1
- package/plugins/lisa-phaser-devin/.devin-plugin/plugin.json +1 -1
- package/plugins/lisa-rails/.claude-plugin/plugin.json +1 -1
- package/plugins/lisa-rails/.codex-plugin/plugin.json +1 -1
- package/plugins/lisa-rails-agy/plugin.json +1 -1
- package/plugins/lisa-rails-copilot/.claude-plugin/plugin.json +1 -1
- package/plugins/lisa-rails-cursor/.claude-plugin/plugin.json +1 -1
- package/plugins/lisa-rails-devin/.claude-plugin/plugin.json +1 -1
- package/plugins/lisa-rails-devin/.devin-plugin/plugin.json +1 -1
- package/plugins/lisa-typescript/.claude-plugin/plugin.json +1 -1
- package/plugins/lisa-typescript/.codex-plugin/plugin.json +1 -1
- package/plugins/lisa-typescript-agy/plugin.json +1 -1
- package/plugins/lisa-typescript-copilot/.claude-plugin/plugin.json +1 -1
- package/plugins/lisa-typescript-cursor/.claude-plugin/plugin.json +1 -1
- package/plugins/lisa-typescript-devin/.claude-plugin/plugin.json +1 -1
- package/plugins/lisa-typescript-devin/.devin-plugin/plugin.json +1 -1
- package/plugins/lisa-wiki/.claude-plugin/plugin.json +1 -1
- package/plugins/lisa-wiki/.codex-plugin/plugin.json +1 -1
- package/plugins/lisa-wiki-agy/plugin.json +1 -1
- package/plugins/lisa-wiki-copilot/.claude-plugin/plugin.json +1 -1
- package/plugins/lisa-wiki-cursor/.claude-plugin/plugin.json +1 -1
- package/plugins/lisa-wiki-devin/.claude-plugin/plugin.json +1 -1
- package/plugins/lisa-wiki-devin/.devin-plugin/plugin.json +1 -1
- package/plugins/src/base/skills/lisa-drive-pr-to-merge/SKILL.md +16 -3
- package/plugins/src/base/skills/lisa-git-submit-pr/SKILL.md +1 -1
- package/plugins/src/base/skills/lisa-implement/SKILL.md +1 -1
- package/rails/copy-overwrite/Gemfile.lisa +8 -0
- package/rails/copy-overwrite/lefthook.yml +25 -11
- package/rails/copy-overwrite/scripts/lisa-rails-gates.mjs +686 -0
- package/rails/copy-overwrite/scripts/lisa-rspec-shards.mjs +2 -2
- package/rails/copy-overwrite/scripts/lisa_crystalball_recorder.rb +239 -0
- package/rails/copy-overwrite/scripts/lisa_rspec_partial_coverage.rb +83 -0
- package/scripts/build-unless-marked.mjs +83 -0
- package/scripts/check-plugins-sync.sh +22 -5
- package/scripts/classify-markdown-assertions.mjs +141 -0
- package/scripts/integration-shard-build.mjs +143 -0
- package/scripts/lib/history-scanner-suites.mjs +19 -0
- package/scripts/lib/markdown-assertions/classify.mjs +289 -0
- package/scripts/lib/markdown-assertions/context.mjs +53 -0
- package/scripts/lib/markdown-assertions/corpus.mjs +222 -0
- package/scripts/lib/markdown-assertions/manifest-cull.mjs +86 -0
- package/scripts/lib/markdown-assertions/record-setup.mjs +265 -0
- package/scripts/lib/markdown-assertions/record.mjs +115 -0
- package/scripts/lib/markdown-assertions/record.vitest.config.mjs +24 -0
- package/scripts/lib/markdown-assertions/sites.mjs +273 -0
- package/scripts/lib/markdown-assertions/test-cull.mjs +768 -0
- package/scripts/lib/markdown-assertions/tokens.mjs +158 -0
- package/scripts/lib/shell-guard-trace.mjs +6 -0
- package/scripts/lib/test-access-map-setup.mjs +40 -0
- package/scripts/lib/test-access-map-tracer.mjs +205 -0
- package/scripts/lib/test-access-map.d.mts +72 -0
- package/scripts/lib/test-access-map.mjs +395 -0
- package/scripts/lib/test-timings-reporter.d.mts +17 -0
- package/scripts/lib/test-timings-reporter.mjs +99 -0
- package/scripts/plan-integration-shards.mjs +300 -0
- package/scripts/test-timing-report.d.mts +41 -0
- package/scripts/test-timing-report.mjs +361 -0
- package/scripts/two-channel-couplings.json +132 -36
- package/scripts/verify-npm-advisories-4333.mjs +3 -12
- package/typescript/copy-overwrite/.prettierignore +12 -0
- package/typescript/create-only/vitest.config.local.ts +1 -7
- package/typescript/package-lisa/package.lisa.json +4 -4
- package/all/copy-overwrite/scripts/lisa-scratch-run.sh +0 -1078
- package/dist/cli/lisa-test-run-bootstrap.d.ts +0 -3
- package/dist/cli/lisa-test-run-bootstrap.d.ts.map +0 -1
- package/dist/cli/lisa-test-run-bootstrap.js +0 -229
- package/dist/cli/lisa-test-run-bootstrap.js.map +0 -1
- package/dist/cli/lisa-test-run-ipc.d.ts +0 -49
- package/dist/cli/lisa-test-run-ipc.d.ts.map +0 -1
- package/dist/cli/lisa-test-run-ipc.js +0 -226
- package/dist/cli/lisa-test-run-ipc.js.map +0 -1
- package/dist/cli/lisa-test-run-process-group.d.ts +0 -30
- package/dist/cli/lisa-test-run-process-group.d.ts.map +0 -1
- package/dist/cli/lisa-test-run-process-group.js +0 -140
- package/dist/cli/lisa-test-run-process-group.js.map +0 -1
- package/dist/cli/lisa-test-run-reaper.d.ts +0 -3
- package/dist/cli/lisa-test-run-reaper.d.ts.map +0 -1
- package/dist/cli/lisa-test-run-reaper.js +0 -195
- package/dist/cli/lisa-test-run-reaper.js.map +0 -1
- package/dist/cli/lisa-test-run-runtime.d.ts +0 -46
- package/dist/cli/lisa-test-run-runtime.d.ts.map +0 -1
- package/dist/cli/lisa-test-run-runtime.js +0 -123
- package/dist/cli/lisa-test-run-runtime.js.map +0 -1
- package/dist/cli/lisa-test-run-supervisor.d.ts +0 -13
- package/dist/cli/lisa-test-run-supervisor.d.ts.map +0 -1
- package/dist/cli/lisa-test-run-supervisor.js +0 -265
- package/dist/cli/lisa-test-run-supervisor.js.map +0 -1
- package/dist/configs/vitest/fleet-admission-global-setup.d.ts +0 -34
- package/dist/configs/vitest/fleet-admission-global-setup.d.ts.map +0 -1
- package/dist/configs/vitest/fleet-admission-global-setup.js +0 -123
- package/dist/configs/vitest/fleet-admission-global-setup.js.map +0 -1
- package/dist/configs/vitest/fleet-admission.d.ts +0 -129
- package/dist/configs/vitest/fleet-admission.d.ts.map +0 -1
- package/dist/configs/vitest/fleet-admission.js +0 -239
- package/dist/configs/vitest/fleet-admission.js.map +0 -1
- package/dist/configs/vitest/scratch-authority.d.ts +0 -25
- package/dist/configs/vitest/scratch-authority.d.ts.map +0 -1
- package/dist/configs/vitest/scratch-authority.js +0 -107
- package/dist/configs/vitest/scratch-authority.js.map +0 -1
- package/dist/configs/vitest/scratch-bound-cleanup-programs.d.ts +0 -5
- package/dist/configs/vitest/scratch-bound-cleanup-programs.d.ts.map +0 -1
- package/dist/configs/vitest/scratch-bound-cleanup-programs.js +0 -219
- package/dist/configs/vitest/scratch-bound-cleanup-programs.js.map +0 -1
- package/dist/configs/vitest/scratch-bound-cleanup.d.ts +0 -28
- package/dist/configs/vitest/scratch-bound-cleanup.d.ts.map +0 -1
- package/dist/configs/vitest/scratch-bound-cleanup.js +0 -155
- package/dist/configs/vitest/scratch-bound-cleanup.js.map +0 -1
- package/dist/configs/vitest/scratch-bound-root-cleanup.d.ts +0 -17
- package/dist/configs/vitest/scratch-bound-root-cleanup.d.ts.map +0 -1
- package/dist/configs/vitest/scratch-bound-root-cleanup.js +0 -149
- package/dist/configs/vitest/scratch-bound-root-cleanup.js.map +0 -1
- package/dist/configs/vitest/scratch-global-setup.d.ts +0 -258
- package/dist/configs/vitest/scratch-global-setup.d.ts.map +0 -1
- package/dist/configs/vitest/scratch-global-setup.js +0 -505
- package/dist/configs/vitest/scratch-global-setup.js.map +0 -1
- package/dist/configs/vitest/scratch-leak-setup.d.ts +0 -2
- package/dist/configs/vitest/scratch-leak-setup.d.ts.map +0 -1
- package/dist/configs/vitest/scratch-leak-setup.js +0 -108
- package/dist/configs/vitest/scratch-leak-setup.js.map +0 -1
- package/dist/configs/vitest/scratch-namespace-authority.d.ts +0 -80
- package/dist/configs/vitest/scratch-namespace-authority.d.ts.map +0 -1
- package/dist/configs/vitest/scratch-namespace-authority.js +0 -291
- package/dist/configs/vitest/scratch-namespace-authority.js.map +0 -1
- package/dist/configs/vitest/scratch-owner.d.ts +0 -131
- package/dist/configs/vitest/scratch-owner.d.ts.map +0 -1
- package/dist/configs/vitest/scratch-owner.js +0 -297
- package/dist/configs/vitest/scratch-owner.js.map +0 -1
- package/dist/configs/vitest/scratch-route-profile.d.ts +0 -46
- package/dist/configs/vitest/scratch-route-profile.d.ts.map +0 -1
- package/dist/configs/vitest/scratch-route-profile.js +0 -233
- package/dist/configs/vitest/scratch-route-profile.js.map +0 -1
- package/dist/configs/vitest/scratch-run-root-compatibility.d.ts +0 -33
- package/dist/configs/vitest/scratch-run-root-compatibility.d.ts.map +0 -1
- package/dist/configs/vitest/scratch-run-root-compatibility.js +0 -137
- package/dist/configs/vitest/scratch-run-root-compatibility.js.map +0 -1
- package/dist/configs/vitest/scratch-run-root-intent.d.ts +0 -66
- package/dist/configs/vitest/scratch-run-root-intent.d.ts.map +0 -1
- package/dist/configs/vitest/scratch-run-root-intent.js +0 -183
- package/dist/configs/vitest/scratch-run-root-intent.js.map +0 -1
- package/dist/configs/vitest/scratch-setup.d.ts +0 -46
- package/dist/configs/vitest/scratch-setup.d.ts.map +0 -1
- package/dist/configs/vitest/scratch-setup.js +0 -226
- package/dist/configs/vitest/scratch-setup.js.map +0 -1
- package/dist/configs/vitest/scratch-supervision-intent.d.ts +0 -8
- package/dist/configs/vitest/scratch-supervision-intent.d.ts.map +0 -1
- package/dist/configs/vitest/scratch-supervision-intent.js +0 -125
- package/dist/configs/vitest/scratch-supervision-intent.js.map +0 -1
- package/dist/configs/vitest/scratch-supervision-protocol.d.ts +0 -12
- package/dist/configs/vitest/scratch-supervision-protocol.d.ts.map +0 -1
- package/dist/configs/vitest/scratch-supervision-protocol.js +0 -230
- package/dist/configs/vitest/scratch-supervision-protocol.js.map +0 -1
- package/dist/configs/vitest/scratch-supervision.d.ts +0 -69
- package/dist/configs/vitest/scratch-supervision.d.ts.map +0 -1
- package/dist/configs/vitest/scratch-supervision.js +0 -244
- package/dist/configs/vitest/scratch-supervision.js.map +0 -1
- package/dist/configs/vitest/scratch-sweep.d.ts +0 -66
- package/dist/configs/vitest/scratch-sweep.d.ts.map +0 -1
- package/dist/configs/vitest/scratch-sweep.js +0 -82
- package/dist/configs/vitest/scratch-sweep.js.map +0 -1
- package/dist/configs/vitest/scratch-tmpdir-trust.d.ts +0 -48
- package/dist/configs/vitest/scratch-tmpdir-trust.d.ts.map +0 -1
- package/dist/configs/vitest/scratch-tmpdir-trust.js +0 -194
- package/dist/configs/vitest/scratch-tmpdir-trust.js.map +0 -1
- package/dist/configs/vitest/scratch.d.ts +0 -19
- package/dist/configs/vitest/scratch.d.ts.map +0 -1
- package/dist/configs/vitest/scratch.js +0 -34
- package/dist/configs/vitest/scratch.js.map +0 -1
- package/dist/configs/vitest/synthesis-scratch-reclaim.d.ts +0 -86
- package/dist/configs/vitest/synthesis-scratch-reclaim.d.ts.map +0 -1
- package/dist/configs/vitest/synthesis-scratch-reclaim.js +0 -226
- package/dist/configs/vitest/synthesis-scratch-reclaim.js.map +0 -1
|
@@ -0,0 +1,158 @@
|
|
|
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
|
+
* Route the push gate's heavy steps through headroom admission
|
|
6
|
+
* (CodySwannGT/lisa#4596).
|
|
7
|
+
*
|
|
8
|
+
* When `.lisa.config.json` sets `pushGate.admission: true`, the gate runner
|
|
9
|
+
* runs `code-style-slow` (`lint:slow`), `type-correctness` (`typecheck`) and the
|
|
10
|
+
* build-once step through `lisa admit`, which starts them only when the machine
|
|
11
|
+
* has headroom for them and refuses — never silently starts — once the wait
|
|
12
|
+
* bound expires (5 minutes inside `git push`). Test suites are admitted by
|
|
13
|
+
* `lisa-test-run` itself, so test gates are not wrapped here.
|
|
14
|
+
*
|
|
15
|
+
* With the switch off nothing here changes a command, and heavy steps start
|
|
16
|
+
* immediately exactly as before.
|
|
17
|
+
*
|
|
18
|
+
* Windows is not wrapped: the admitted command is handed over as one
|
|
19
|
+
* POSIX-quoted shell string, and the gate runner's Windows route runs commands
|
|
20
|
+
* through `cmd.exe`. The gap is printed when the switch is on there.
|
|
21
|
+
* @module lib/push-admission
|
|
22
|
+
*/
|
|
23
|
+
import { existsSync, readFileSync } from "node:fs";
|
|
24
|
+
import { join } from "node:path";
|
|
25
|
+
|
|
26
|
+
/** Gates, by id, that are heavy enough to admit, and the workers each declares. */
|
|
27
|
+
export const ADMITTED_GATES = Object.freeze({
|
|
28
|
+
"code-style-slow": 2,
|
|
29
|
+
"type-correctness": 1,
|
|
30
|
+
"build-once": 2,
|
|
31
|
+
});
|
|
32
|
+
|
|
33
|
+
/** Value of `LISA_ADMISSION_CONTEXT` that tells admission it is inside a push. */
|
|
34
|
+
export const PUSH_CONTEXT = "push";
|
|
35
|
+
|
|
36
|
+
/**
|
|
37
|
+
* Read and validate `pushGate.admission` from a parsed `.lisa.config.json`.
|
|
38
|
+
*
|
|
39
|
+
* Refused rather than defaulted on a wrong type, exactly as `lisa apply`
|
|
40
|
+
* refuses it, so apply and push cannot disagree.
|
|
41
|
+
* @param {Record<string, unknown>|null|undefined} config Parsed config.
|
|
42
|
+
* @returns {boolean} Whether admission is on (default `false`).
|
|
43
|
+
* @throws {Error} When `pushGate` or `pushGate.admission` has the wrong type.
|
|
44
|
+
*/
|
|
45
|
+
export function admissionEnabled(config) {
|
|
46
|
+
const pushGate = config?.pushGate;
|
|
47
|
+
if (pushGate === undefined) return false;
|
|
48
|
+
if (
|
|
49
|
+
pushGate === null ||
|
|
50
|
+
typeof pushGate !== "object" ||
|
|
51
|
+
Array.isArray(pushGate)
|
|
52
|
+
) {
|
|
53
|
+
throw new Error(
|
|
54
|
+
`pushGate is ${JSON.stringify(pushGate)}; expected an object such as ` +
|
|
55
|
+
`{ "admission": true }.`
|
|
56
|
+
);
|
|
57
|
+
}
|
|
58
|
+
const { admission } = pushGate;
|
|
59
|
+
if (admission === undefined) return false;
|
|
60
|
+
if (typeof admission !== "boolean") {
|
|
61
|
+
throw new Error(
|
|
62
|
+
`pushGate.admission is ${JSON.stringify(admission)}; expected true or false.`
|
|
63
|
+
);
|
|
64
|
+
}
|
|
65
|
+
return admission;
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
/**
|
|
69
|
+
* The installed Lisa CLI, as a shell prefix.
|
|
70
|
+
*
|
|
71
|
+
* Lisa itself runs its own build (`node dist/index.js`); a host runs the
|
|
72
|
+
* package it installed (`node_modules/.bin/lisa`).
|
|
73
|
+
* @param {string} cwd Project root.
|
|
74
|
+
* @returns {string|null} The prefix, or null when no CLI is installed.
|
|
75
|
+
*/
|
|
76
|
+
export function lisaCliPrefix(cwd) {
|
|
77
|
+
try {
|
|
78
|
+
const manifest = JSON.parse(
|
|
79
|
+
readFileSync(join(cwd, "package.json"), "utf8")
|
|
80
|
+
);
|
|
81
|
+
if (
|
|
82
|
+
manifest?.name === "@codyswann/lisa" &&
|
|
83
|
+
existsSync(join(cwd, "dist", "index.js"))
|
|
84
|
+
) {
|
|
85
|
+
return "node dist/index.js";
|
|
86
|
+
}
|
|
87
|
+
} catch {
|
|
88
|
+
// No readable manifest: fall through to the installed binary.
|
|
89
|
+
}
|
|
90
|
+
const bin = join(cwd, "node_modules", ".bin", "lisa");
|
|
91
|
+
return existsSync(bin) ? "node_modules/.bin/lisa" : null;
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
/**
|
|
95
|
+
* Quote one string for a POSIX shell.
|
|
96
|
+
* @param {string} text Text to quote.
|
|
97
|
+
* @returns {string} Single-quoted text.
|
|
98
|
+
*/
|
|
99
|
+
export function shellQuote(text) {
|
|
100
|
+
const escaped = text.replaceAll("'", "'\\''");
|
|
101
|
+
return `'${escaped}'`;
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
/**
|
|
105
|
+
* The command a heavy gate runs under admission.
|
|
106
|
+
* @param {string} prefix Lisa CLI prefix.
|
|
107
|
+
* @param {number} workers Declared workers.
|
|
108
|
+
* @param {string} command The gate's own command.
|
|
109
|
+
* @returns {string} The admitted command.
|
|
110
|
+
*/
|
|
111
|
+
export function admittedCommand(prefix, workers, command) {
|
|
112
|
+
return `${prefix} admit --workers ${workers} -- ${shellQuote(command)}`;
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
/**
|
|
116
|
+
* Wrap a gate executor so heavy gates run through `lisa admit`.
|
|
117
|
+
* @param {(command: string, gate?: {id?: string}) => object} exec Executor.
|
|
118
|
+
* @param {object} options Options.
|
|
119
|
+
* @param {boolean} options.enabled Whether `pushGate.admission` is on.
|
|
120
|
+
* @param {string} [options.cwd] Project root.
|
|
121
|
+
* @param {string} [options.platform] Platform, for the Windows gap.
|
|
122
|
+
* @param {(line: string) => void} [options.out] Where notices go.
|
|
123
|
+
* @param {(cwd: string) => string|null} [options.cli] CLI resolver.
|
|
124
|
+
* @returns {(command: string, gate?: {id?: string}) => object} The executor to use.
|
|
125
|
+
*/
|
|
126
|
+
export function withAdmission(
|
|
127
|
+
exec,
|
|
128
|
+
{
|
|
129
|
+
enabled,
|
|
130
|
+
cwd = process.cwd(),
|
|
131
|
+
platform = process.platform,
|
|
132
|
+
out = line => console.log(line),
|
|
133
|
+
cli = lisaCliPrefix,
|
|
134
|
+
}
|
|
135
|
+
) {
|
|
136
|
+
if (!enabled) return exec;
|
|
137
|
+
if (platform === "win32") {
|
|
138
|
+
out(
|
|
139
|
+
"⚠️ pushGate.admission is on, but the gate runner does not admit heavy " +
|
|
140
|
+
"steps on Windows; they start immediately."
|
|
141
|
+
);
|
|
142
|
+
return exec;
|
|
143
|
+
}
|
|
144
|
+
const prefix = cli(cwd);
|
|
145
|
+
if (prefix === null) {
|
|
146
|
+
out(
|
|
147
|
+
"⚠️ pushGate.admission is on, but no Lisa CLI is installed here " +
|
|
148
|
+
"(node_modules/.bin/lisa); heavy steps start without admission."
|
|
149
|
+
);
|
|
150
|
+
return exec;
|
|
151
|
+
}
|
|
152
|
+
return (command, gate) => {
|
|
153
|
+
const workers = ADMITTED_GATES[gate?.id ?? ""];
|
|
154
|
+
return workers === undefined || !command
|
|
155
|
+
? exec(command, gate)
|
|
156
|
+
: exec(admittedCommand(prefix, workers, command), gate);
|
|
157
|
+
};
|
|
158
|
+
}
|
|
@@ -0,0 +1,34 @@
|
|
|
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
|
+
/** What a TypeScript project gets when it does not say. */
|
|
5
|
+
export declare const TYPESCRIPT_PUSH_GATE_DEFAULTS: Readonly<{
|
|
6
|
+
cache: true;
|
|
7
|
+
admission: true;
|
|
8
|
+
affectedTests: true;
|
|
9
|
+
affectedCoverage: "changed-files";
|
|
10
|
+
}>;
|
|
11
|
+
/** What a Rails project gets when it does not say. */
|
|
12
|
+
export declare const RAILS_PUSH_GATE_DEFAULTS: Readonly<{
|
|
13
|
+
cache: true;
|
|
14
|
+
admission: true;
|
|
15
|
+
affectedTests: true;
|
|
16
|
+
affectedCoverage: "changed-files";
|
|
17
|
+
}>;
|
|
18
|
+
export declare function isRailsProject(root: string): boolean;
|
|
19
|
+
export declare function isTypeScriptProject(root: string): boolean;
|
|
20
|
+
export declare function pushGateDefaultsFor(
|
|
21
|
+
root: string
|
|
22
|
+
): Readonly<Record<string, unknown>>;
|
|
23
|
+
export declare function withPushGateDefaults<
|
|
24
|
+
T extends Readonly<Record<string, unknown>>,
|
|
25
|
+
>(
|
|
26
|
+
config: T | null | undefined,
|
|
27
|
+
root: string
|
|
28
|
+
): T & { readonly pushGate?: unknown };
|
|
29
|
+
export declare function withDefaults<
|
|
30
|
+
T extends Readonly<Record<string, unknown>>,
|
|
31
|
+
>(
|
|
32
|
+
config: T | null | undefined,
|
|
33
|
+
defaults: Readonly<Record<string, unknown>>
|
|
34
|
+
): T & { readonly pushGate?: unknown };
|
|
@@ -0,0 +1,147 @@
|
|
|
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
|
+
* The `pushGate` defaults a project gets without writing them
|
|
6
|
+
* (CodySwannGT/lisa#4611).
|
|
7
|
+
*
|
|
8
|
+
* Lisa proved the smart push gate on itself behind explicit `pushGate`
|
|
9
|
+
* switches, all off by default. TypeScript hosts get it switched on through
|
|
10
|
+
* this file. The default depends on the project's stack and is worked out when
|
|
11
|
+
* the push runs, so `lisa apply` writes nothing into a host's
|
|
12
|
+
* `.lisa.config.json` and an existing host needs no migration. Anything the
|
|
13
|
+
* host sets explicitly wins, `false` included.
|
|
14
|
+
*
|
|
15
|
+
* TypeScript defaults:
|
|
16
|
+
*
|
|
17
|
+
* - `cache: true`: an unchanged tree re-pushes from remembered passes.
|
|
18
|
+
* - `admission: true`: heavy runs wait for machine headroom.
|
|
19
|
+
* - `affectedTests: true`: the unit run narrows to the tests a change can
|
|
20
|
+
* reach, and runs everything whenever that could be wrong.
|
|
21
|
+
* - `affectedCoverage: "changed-files"`: a narrowed run with coverage on
|
|
22
|
+
* holds every changed source file to the coverage floors on its own. That
|
|
23
|
+
* keeps coverage enforced at push. It falls back to the full measured suite
|
|
24
|
+
* when it cannot hold the files, for example when there is no
|
|
25
|
+
* `vitest.thresholds.json` or no test reaches a changed file.
|
|
26
|
+
* - `buildOnce` is NOT defaulted on. In Lisa a push built two or three times,
|
|
27
|
+
* and build-once removes the repeats. A host's push gates do not build at
|
|
28
|
+
* all, so a build-once step would add a full build to every push, a fully
|
|
29
|
+
* cached re-push included. A host whose push steps do build can still set
|
|
30
|
+
* `buildOnce: true`.
|
|
31
|
+
*
|
|
32
|
+
* Rails defaults (CodySwannGT/lisa#4612, #4613) are the same four switches:
|
|
33
|
+
* the pass cache and admission for `scripts/lisa-rails-gates.mjs`, and
|
|
34
|
+
* affected-spec selection with `changed-files` coverage for
|
|
35
|
+
* `scripts/lisa-rspec-select.mjs`. A Rails project is one with `bin/rails` or
|
|
36
|
+
* `config/application.rb`, as `src/detection/detectors/rails.ts` judges it.
|
|
37
|
+
* Rails is checked first, so a Rails app that also carries a `tsconfig.json`
|
|
38
|
+
* gets the Rails table; the two tables agree today.
|
|
39
|
+
*
|
|
40
|
+
* Other stacks get no defaults here. This file is the one place every stack's
|
|
41
|
+
* `pushGate` defaults live; the TypeScript and Rails runners, `lisa check` and
|
|
42
|
+
* `lisa-test-run`'s admission all read them through it.
|
|
43
|
+
*
|
|
44
|
+
* This file is plain `.mjs` and runs before any build, so it cannot import
|
|
45
|
+
* `src/detection/`. It mirrors `src/detection/detectors/typescript.ts`: a
|
|
46
|
+
* TypeScript project has a root `tsconfig.json`, or `typescript` in
|
|
47
|
+
* `package.json` dependencies or devDependencies. `src/core/push-gate-defaults.ts`
|
|
48
|
+
* holds the same table for the CLI, and a unit test keeps the two in step.
|
|
49
|
+
* @module push-gate-defaults
|
|
50
|
+
*/
|
|
51
|
+
import { existsSync, readFileSync } from "node:fs";
|
|
52
|
+
import { join } from "node:path";
|
|
53
|
+
|
|
54
|
+
/** What a TypeScript project gets when it does not say. */
|
|
55
|
+
export const TYPESCRIPT_PUSH_GATE_DEFAULTS = Object.freeze({
|
|
56
|
+
cache: true,
|
|
57
|
+
admission: true,
|
|
58
|
+
affectedTests: true,
|
|
59
|
+
affectedCoverage: "changed-files",
|
|
60
|
+
});
|
|
61
|
+
|
|
62
|
+
/** What a Rails project gets when it does not say. */
|
|
63
|
+
export const RAILS_PUSH_GATE_DEFAULTS = Object.freeze({
|
|
64
|
+
cache: true,
|
|
65
|
+
admission: true,
|
|
66
|
+
affectedTests: true,
|
|
67
|
+
affectedCoverage: "changed-files",
|
|
68
|
+
});
|
|
69
|
+
|
|
70
|
+
/**
|
|
71
|
+
* Whether `root` is a Rails project: `bin/rails`, else `config/application.rb`.
|
|
72
|
+
* @param {string} root Project root.
|
|
73
|
+
* @returns {boolean} True for a Rails project.
|
|
74
|
+
*/
|
|
75
|
+
export function isRailsProject(root) {
|
|
76
|
+
return (
|
|
77
|
+
existsSync(join(root, "bin", "rails")) ||
|
|
78
|
+
existsSync(join(root, "config", "application.rb"))
|
|
79
|
+
);
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
/**
|
|
83
|
+
* Whether `root` is a TypeScript project, judged as `src/detection` judges it.
|
|
84
|
+
* @param {string} root Project root.
|
|
85
|
+
* @returns {boolean} True for a TypeScript project.
|
|
86
|
+
*/
|
|
87
|
+
export function isTypeScriptProject(root) {
|
|
88
|
+
if (existsSync(join(root, "tsconfig.json"))) return true;
|
|
89
|
+
let manifest;
|
|
90
|
+
try {
|
|
91
|
+
manifest = JSON.parse(readFileSync(join(root, "package.json"), "utf8"));
|
|
92
|
+
} catch {
|
|
93
|
+
return false;
|
|
94
|
+
}
|
|
95
|
+
return (
|
|
96
|
+
manifest?.dependencies?.typescript !== undefined ||
|
|
97
|
+
manifest?.devDependencies?.typescript !== undefined
|
|
98
|
+
);
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
/**
|
|
102
|
+
* The defaults for the project at `root`.
|
|
103
|
+
* @param {string} root Project root.
|
|
104
|
+
* @returns {Readonly<Record<string, unknown>>} Defaults (empty when none apply).
|
|
105
|
+
*/
|
|
106
|
+
export function pushGateDefaultsFor(root) {
|
|
107
|
+
if (isRailsProject(root)) return RAILS_PUSH_GATE_DEFAULTS;
|
|
108
|
+
return isTypeScriptProject(root) ? TYPESCRIPT_PUSH_GATE_DEFAULTS : {};
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
/**
|
|
112
|
+
* A parsed `.lisa.config.json` with the stack's `pushGate` defaults filled in
|
|
113
|
+
* under the project's own keys.
|
|
114
|
+
*
|
|
115
|
+
* A malformed `pushGate` (null, an array, a string) is returned untouched, so
|
|
116
|
+
* the readers still refuse it with their own message rather than having a
|
|
117
|
+
* default hide the typo. The input is never modified.
|
|
118
|
+
* @param {Record<string, unknown>|null|undefined} config Parsed config.
|
|
119
|
+
* @param {string} root Project root.
|
|
120
|
+
* @returns {Record<string, unknown>} The config the push gate should read.
|
|
121
|
+
*/
|
|
122
|
+
export function withPushGateDefaults(config, root) {
|
|
123
|
+
return withDefaults(config, pushGateDefaultsFor(root));
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
/**
|
|
127
|
+
* A parsed `.lisa.config.json` with the given `pushGate` defaults filled in
|
|
128
|
+
* under the project's own keys, by the same rules as
|
|
129
|
+
* {@link withPushGateDefaults}. For a caller that already knows the stack.
|
|
130
|
+
* @param {Record<string, unknown>|null|undefined} config Parsed config.
|
|
131
|
+
* @param {Readonly<Record<string, unknown>>} defaults The stack's defaults.
|
|
132
|
+
* @returns {Record<string, unknown>} The config with defaults applied.
|
|
133
|
+
*/
|
|
134
|
+
export function withDefaults(config, defaults) {
|
|
135
|
+
const base = config && typeof config === "object" ? config : {};
|
|
136
|
+
const declared = base.pushGate;
|
|
137
|
+
const malformed =
|
|
138
|
+
declared !== undefined &&
|
|
139
|
+
(declared === null ||
|
|
140
|
+
typeof declared !== "object" ||
|
|
141
|
+
Array.isArray(declared));
|
|
142
|
+
if (malformed) return base;
|
|
143
|
+
if (Object.keys(defaults).length === 0) return base;
|
|
144
|
+
// Spreading an absent block adds nothing, so no `?? {}` is needed (and the
|
|
145
|
+
// shipped fixer would strip one).
|
|
146
|
+
return { ...base, pushGate: { ...defaults, ...declared } };
|
|
147
|
+
}
|
|
@@ -0,0 +1,323 @@
|
|
|
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
|
+
* Per-gate push timing report (CodySwannGT/lisa#4591).
|
|
6
|
+
*
|
|
7
|
+
* A push that is "too slow" is not something anyone can fix until it is
|
|
8
|
+
* measured: which gate took the time, and how loaded the machine was while it
|
|
9
|
+
* ran. Each push run of the gate runner leaves one JSON report under
|
|
10
|
+
* `.lisa/push-timing/`, and `lisa-push-timing-report.mjs` summarises them.
|
|
11
|
+
*
|
|
12
|
+
* The report is a MEASUREMENT, never a verdict. Nothing here may throw into the
|
|
13
|
+
* runner or change its exit code: a report that cannot be written prints one
|
|
14
|
+
* warning and the push proceeds exactly as it would have.
|
|
15
|
+
* @module lib/push-timing
|
|
16
|
+
*/
|
|
17
|
+
|
|
18
|
+
import {
|
|
19
|
+
existsSync,
|
|
20
|
+
mkdirSync,
|
|
21
|
+
readdirSync,
|
|
22
|
+
rmSync,
|
|
23
|
+
writeFileSync,
|
|
24
|
+
} from "node:fs";
|
|
25
|
+
import { availableParallelism, freemem, loadavg } from "node:os";
|
|
26
|
+
import { join } from "node:path";
|
|
27
|
+
|
|
28
|
+
import { boundedSpawnSync } from "./bounded-spawn.mjs";
|
|
29
|
+
|
|
30
|
+
/** Where reports live, relative to the project root. */
|
|
31
|
+
export const TIMING_DIR = ".lisa/push-timing";
|
|
32
|
+
|
|
33
|
+
/** How many reports to keep; older ones are pruned on every write. */
|
|
34
|
+
export const KEEP_REPORTS = 200;
|
|
35
|
+
|
|
36
|
+
/** A report file name: ISO start, colons replaced, optional collision suffix. */
|
|
37
|
+
const REPORT_NAME = /^\d{4}-\d{2}-\d{2}T\d{2}-\d{2}-\d{2}Z(?:-\d+)?\.json$/u;
|
|
38
|
+
|
|
39
|
+
/**
|
|
40
|
+
* @typedef {object} GateTiming
|
|
41
|
+
* @property {string} id Gate id.
|
|
42
|
+
* @property {string|null} level Declared level.
|
|
43
|
+
* @property {string|null} command Command that proved it.
|
|
44
|
+
* @property {string} state PASSED, CACHED, FAILED, UNPROVABLE, KILLED, SKIPPED or NOT_RUN.
|
|
45
|
+
* @property {number|null} exitCode Exit code, when one exists.
|
|
46
|
+
* @property {string|null} startedAt ISO-8601 start, null when never reached.
|
|
47
|
+
* @property {number} durationMs Time spent; 0 when proved by a sibling's run.
|
|
48
|
+
* @property {string|null} provedBy The gate whose run proved this one.
|
|
49
|
+
*/
|
|
50
|
+
|
|
51
|
+
/**
|
|
52
|
+
* @typedef {object} TimingReport
|
|
53
|
+
* @property {string} startedAt ISO-8601 run start.
|
|
54
|
+
* @property {string} finishedAt ISO-8601 run end.
|
|
55
|
+
* @property {number} wallMs Run wall time.
|
|
56
|
+
* @property {string} moment The moment that ran.
|
|
57
|
+
* @property {number} cores `os.availableParallelism()`.
|
|
58
|
+
* @property {number[]} loadavgStart `os.loadavg()` at start.
|
|
59
|
+
* @property {number[]} loadavgEnd `os.loadavg()` at end.
|
|
60
|
+
* @property {number} freeMemStart `os.freemem()` at start.
|
|
61
|
+
* @property {number} freeMemEnd `os.freemem()` at end.
|
|
62
|
+
* @property {string|null} node Node version.
|
|
63
|
+
* @property {string|null} bun Bun version.
|
|
64
|
+
* @property {string|null} head HEAD commit.
|
|
65
|
+
* @property {string|null} tree HEAD tree.
|
|
66
|
+
* @property {GateTiming[]} gates Per-gate records, in run order.
|
|
67
|
+
*/
|
|
68
|
+
|
|
69
|
+
/**
|
|
70
|
+
* The host's load and free memory right now.
|
|
71
|
+
* @returns {{loadavg: number[], freeMem: number}} One reading.
|
|
72
|
+
*/
|
|
73
|
+
export function hostReading() {
|
|
74
|
+
return { loadavg: loadavg(), freeMem: freemem() };
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
/**
|
|
78
|
+
* The file name a report started at `startedAtMs` is written under.
|
|
79
|
+
* @param {number} startedAtMs Run start, epoch milliseconds.
|
|
80
|
+
* @returns {string} e.g. `2026-11-02T10-15-03Z.json`.
|
|
81
|
+
*/
|
|
82
|
+
export function reportFileName(startedAtMs) {
|
|
83
|
+
const iso = new Date(startedAtMs).toISOString();
|
|
84
|
+
return `${iso.slice(0, 19).replaceAll(":", "-")}Z.json`;
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
/**
|
|
88
|
+
* Render milliseconds the way the summary line does: `4m12s`, `1h2m3s`, `9s`.
|
|
89
|
+
* @param {number} ms Duration in milliseconds.
|
|
90
|
+
* @returns {string} The compact duration.
|
|
91
|
+
*/
|
|
92
|
+
export function formatDuration(ms) {
|
|
93
|
+
const total = Math.round(Math.max(0, ms) / 1000);
|
|
94
|
+
const hours = Math.floor(total / 3600);
|
|
95
|
+
const minutes = Math.floor((total % 3600) / 60);
|
|
96
|
+
const seconds = total % 60;
|
|
97
|
+
if (hours) return `${hours}h${minutes}m${seconds}s`;
|
|
98
|
+
if (minutes) return `${minutes}m${seconds}s`;
|
|
99
|
+
return `${seconds}s`;
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
/**
|
|
103
|
+
* One gate's timing record.
|
|
104
|
+
* @param {object} entry A `runGates` result entry (or a pre-gate step).
|
|
105
|
+
* @returns {GateTiming} The record.
|
|
106
|
+
*/
|
|
107
|
+
function gateRecord(entry) {
|
|
108
|
+
return {
|
|
109
|
+
id: entry.id,
|
|
110
|
+
level: entry.level ?? null,
|
|
111
|
+
command: entry.command ?? null,
|
|
112
|
+
// A remembered pass (#4594) did not run, so it is reported as CACHED
|
|
113
|
+
// rather than as a PASSED gate that happened to take no time.
|
|
114
|
+
state:
|
|
115
|
+
entry.cached === true
|
|
116
|
+
? "CACHED"
|
|
117
|
+
: String(entry.state ?? "unknown")
|
|
118
|
+
.toUpperCase()
|
|
119
|
+
.replaceAll("-", "_"),
|
|
120
|
+
exitCode: typeof entry.code === "number" ? entry.code : null,
|
|
121
|
+
startedAt: entry.startedAt ?? null,
|
|
122
|
+
durationMs: typeof entry.durationMs === "number" ? entry.durationMs : 0,
|
|
123
|
+
provedBy: entry.provedBy ?? null,
|
|
124
|
+
};
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
/**
|
|
128
|
+
* The whole report for one run.
|
|
129
|
+
* @param {object} options Inputs, all stated so the shape is testable.
|
|
130
|
+
* @param {string} options.moment The moment that ran.
|
|
131
|
+
* @param {number} options.startedAtMs Run start, epoch ms.
|
|
132
|
+
* @param {number} options.finishedAtMs Run end, epoch ms.
|
|
133
|
+
* @param {number} options.cores `os.availableParallelism()`.
|
|
134
|
+
* @param {{loadavg: number[], freeMem: number}} options.start Reading at start.
|
|
135
|
+
* @param {{loadavg: number[], freeMem: number}} options.end Reading at end.
|
|
136
|
+
* @param {{node: string|null, bun: string|null}} options.versions Runtimes.
|
|
137
|
+
* @param {string|null} options.head HEAD commit.
|
|
138
|
+
* @param {string|null} options.tree HEAD tree.
|
|
139
|
+
* @param {{results: object[]}} options.result What `runGates` produced.
|
|
140
|
+
* @param {object[]} [options.preGates] Steps run before the gates, recorded first.
|
|
141
|
+
* @returns {TimingReport} The report document.
|
|
142
|
+
*/
|
|
143
|
+
export function timingReport({
|
|
144
|
+
moment,
|
|
145
|
+
startedAtMs,
|
|
146
|
+
finishedAtMs,
|
|
147
|
+
cores,
|
|
148
|
+
start,
|
|
149
|
+
end,
|
|
150
|
+
versions,
|
|
151
|
+
head,
|
|
152
|
+
tree,
|
|
153
|
+
result,
|
|
154
|
+
preGates = [],
|
|
155
|
+
}) {
|
|
156
|
+
return {
|
|
157
|
+
startedAt: new Date(startedAtMs).toISOString(),
|
|
158
|
+
finishedAt: new Date(finishedAtMs).toISOString(),
|
|
159
|
+
wallMs: Math.max(0, finishedAtMs - startedAtMs),
|
|
160
|
+
moment,
|
|
161
|
+
cores,
|
|
162
|
+
loadavgStart: start.loadavg,
|
|
163
|
+
loadavgEnd: end.loadavg,
|
|
164
|
+
freeMemStart: start.freeMem,
|
|
165
|
+
freeMemEnd: end.freeMem,
|
|
166
|
+
node: versions.node ?? null,
|
|
167
|
+
bun: versions.bun ?? null,
|
|
168
|
+
head: head ?? null,
|
|
169
|
+
tree: tree ?? null,
|
|
170
|
+
gates: [...preGates, ...(result?.results ?? [])].map(gateRecord),
|
|
171
|
+
};
|
|
172
|
+
}
|
|
173
|
+
|
|
174
|
+
/**
|
|
175
|
+
* A load average rendered to one decimal place, without a trailing `.0`.
|
|
176
|
+
* @param {number|undefined} value One-minute load.
|
|
177
|
+
* @returns {string} The rendering.
|
|
178
|
+
*/
|
|
179
|
+
export function formatLoad(value) {
|
|
180
|
+
return typeof value === "number" ? String(Number(value.toFixed(1))) : "?";
|
|
181
|
+
}
|
|
182
|
+
|
|
183
|
+
/**
|
|
184
|
+
* The one line printed after the runner's own summary.
|
|
185
|
+
* @param {TimingReport} report A `timingReport` document.
|
|
186
|
+
* @param {string} path Where it was written (or a note that it was not).
|
|
187
|
+
* @returns {string} The `⏱` line.
|
|
188
|
+
*/
|
|
189
|
+
export function formatTimingLine(report, path) {
|
|
190
|
+
const slowest = report.gates.reduce(
|
|
191
|
+
(best, gate) => (!best || gate.durationMs > best.durationMs ? gate : best),
|
|
192
|
+
null
|
|
193
|
+
);
|
|
194
|
+
const slow = slowest
|
|
195
|
+
? ` · slowest ${slowest.id} ${formatDuration(slowest.durationMs)}`
|
|
196
|
+
: "";
|
|
197
|
+
return (
|
|
198
|
+
`⏱ ${report.moment} ${formatDuration(report.wallMs)} · ` +
|
|
199
|
+
`${report.gates.length} gates${slow} · ` +
|
|
200
|
+
`load ${formatLoad(report.loadavgStart?.[0])}→` +
|
|
201
|
+
`${formatLoad(report.loadavgEnd?.[0])}/${report.cores} cores · ${path}`
|
|
202
|
+
);
|
|
203
|
+
}
|
|
204
|
+
|
|
205
|
+
/**
|
|
206
|
+
* Delete all but the newest `keep` reports. Other files are left alone.
|
|
207
|
+
* @param {string} dir Report directory.
|
|
208
|
+
* @param {number} keep How many to keep.
|
|
209
|
+
*/
|
|
210
|
+
function prune(dir, keep) {
|
|
211
|
+
const reports = readdirSync(dir)
|
|
212
|
+
.filter(name => REPORT_NAME.test(name))
|
|
213
|
+
.sort();
|
|
214
|
+
for (const name of reports.slice(0, Math.max(0, reports.length - keep))) {
|
|
215
|
+
rmSync(join(dir, name), { force: true });
|
|
216
|
+
}
|
|
217
|
+
}
|
|
218
|
+
|
|
219
|
+
/**
|
|
220
|
+
* Write a report and prune old ones. Never throws.
|
|
221
|
+
* @param {object} report A `timingReport` document.
|
|
222
|
+
* @param {object} [options] Where and how.
|
|
223
|
+
* @param {string} [options.dir] Report directory.
|
|
224
|
+
* @param {number} [options.keep] How many reports to keep.
|
|
225
|
+
* @param {(line: string) => void} [options.warn] Warning sink.
|
|
226
|
+
* @returns {string|null} The written path, or null when nothing was written.
|
|
227
|
+
*/
|
|
228
|
+
export function writeTimingReport(
|
|
229
|
+
report,
|
|
230
|
+
{ dir = TIMING_DIR, keep = KEEP_REPORTS, warn = console.warn } = {}
|
|
231
|
+
) {
|
|
232
|
+
try {
|
|
233
|
+
mkdirSync(dir, { recursive: true });
|
|
234
|
+
const base = reportFileName(Date.parse(report.startedAt));
|
|
235
|
+
const stem = base.slice(0, -".json".length);
|
|
236
|
+
const name =
|
|
237
|
+
[
|
|
238
|
+
base,
|
|
239
|
+
...Array.from({ length: 99 }, (_, i) => `${stem}-${i + 1}.json`),
|
|
240
|
+
].find(candidate => !existsSync(join(dir, candidate))) ?? base;
|
|
241
|
+
const path = join(dir, name);
|
|
242
|
+
writeFileSync(path, `${JSON.stringify(report, null, 2)}\n`);
|
|
243
|
+
prune(dir, keep);
|
|
244
|
+
return path;
|
|
245
|
+
} catch (err) {
|
|
246
|
+
warn(
|
|
247
|
+
`⚠️ Could not write the push timing report: ${err.message}. ` +
|
|
248
|
+
`The gate verdict is unaffected.`
|
|
249
|
+
);
|
|
250
|
+
return null;
|
|
251
|
+
}
|
|
252
|
+
}
|
|
253
|
+
|
|
254
|
+
/**
|
|
255
|
+
* Ask a command for one line of output, or null.
|
|
256
|
+
* @param {string} command Executable.
|
|
257
|
+
* @param {string[]} args Arguments.
|
|
258
|
+
* @returns {string|null} Trimmed stdout, or null on any failure.
|
|
259
|
+
*/
|
|
260
|
+
function probe(command, args) {
|
|
261
|
+
try {
|
|
262
|
+
const child = boundedSpawnSync(command, args, {
|
|
263
|
+
encoding: "utf8",
|
|
264
|
+
stdio: ["ignore", "pipe", "ignore"],
|
|
265
|
+
});
|
|
266
|
+
// probe-direction: neutral — a recorded field in a timing report; no gate reads it.
|
|
267
|
+
if (child.error || child.status !== 0) return null;
|
|
268
|
+
return String(child.stdout ?? "").trim() || null;
|
|
269
|
+
} catch {
|
|
270
|
+
// probe-direction: neutral — an unknown version or revision is recorded as null.
|
|
271
|
+
return null;
|
|
272
|
+
}
|
|
273
|
+
}
|
|
274
|
+
|
|
275
|
+
/**
|
|
276
|
+
* Build, write, and announce the report for one gate run. Never throws.
|
|
277
|
+
* @param {object} options Inputs.
|
|
278
|
+
* @param {string} options.moment The moment that ran.
|
|
279
|
+
* @param {number} options.startedAtMs When the run began, epoch ms.
|
|
280
|
+
* @param {{loadavg: number[], freeMem: number}} options.start Reading at start.
|
|
281
|
+
* @param {{results: object[]}} options.result What `runGates` produced.
|
|
282
|
+
* @param {object[]} [options.preGates] Steps run before the gates.
|
|
283
|
+
* @param {(line: string) => void} [options.out] Line sink for the `⏱` line.
|
|
284
|
+
* @param {string} [options.dir] Report directory.
|
|
285
|
+
* @returns {string|null} The written path, or null.
|
|
286
|
+
*/
|
|
287
|
+
export function recordPushTiming({
|
|
288
|
+
moment,
|
|
289
|
+
startedAtMs,
|
|
290
|
+
start,
|
|
291
|
+
result,
|
|
292
|
+
preGates = [],
|
|
293
|
+
out = line => console.log(line),
|
|
294
|
+
dir = TIMING_DIR,
|
|
295
|
+
}) {
|
|
296
|
+
try {
|
|
297
|
+
const report = timingReport({
|
|
298
|
+
moment,
|
|
299
|
+
startedAtMs,
|
|
300
|
+
finishedAtMs: Date.now(),
|
|
301
|
+
cores: availableParallelism(),
|
|
302
|
+
start,
|
|
303
|
+
end: hostReading(),
|
|
304
|
+
versions: {
|
|
305
|
+
node: process.versions.node ?? null,
|
|
306
|
+
bun: process.versions.bun ?? probe("bun", ["--version"]),
|
|
307
|
+
},
|
|
308
|
+
head: probe("git", ["rev-parse", "HEAD"]),
|
|
309
|
+
tree: probe("git", ["rev-parse", "HEAD^{tree}"]),
|
|
310
|
+
result,
|
|
311
|
+
preGates,
|
|
312
|
+
});
|
|
313
|
+
const path = writeTimingReport(report, { dir, warn: out });
|
|
314
|
+
out(formatTimingLine(report, path ?? "(report not written)"));
|
|
315
|
+
return path;
|
|
316
|
+
} catch (err) {
|
|
317
|
+
out(
|
|
318
|
+
`⚠️ Could not build the push timing report: ${err.message}. ` +
|
|
319
|
+
`The gate verdict is unaffected.`
|
|
320
|
+
);
|
|
321
|
+
return null;
|
|
322
|
+
}
|
|
323
|
+
}
|