@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
|
@@ -1,505 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Vitest Configuration - Scratch namespace lifecycle (global setup)
|
|
3
|
-
*
|
|
4
|
-
* Runs once in the main Vitest process, on either side of the whole run.
|
|
5
|
-
*
|
|
6
|
-
* `setup` reclaims residue only when a valid owner marker proves the exact root
|
|
7
|
-
* belongs to a dead process. It REFUSES TO START when a root cannot be removed
|
|
8
|
-
* with that authority or when proven-dead residue survives the sweep. That
|
|
9
|
-
* fail-closed distinction prevents a cleanup guard from deleting a live
|
|
10
|
-
* sibling's work. `teardown` reclaims what this run allocated.
|
|
11
|
-
*
|
|
12
|
-
* The check is deliberately a hard failure. A previous version of this problem
|
|
13
|
-
* was invisible for a working day because every instrument that met the
|
|
14
|
-
* saturated directory returned something a caller could mistake for an answer:
|
|
15
|
-
* an empty count, a dead process, a plausible duration. A guard that merely
|
|
16
|
-
* printed a warning would reproduce exactly that.
|
|
17
|
-
*
|
|
18
|
-
* It lives in `setup` for a measured reason, not an aesthetic one. Vitest
|
|
19
|
-
* SWALLOWS a throw from globalSetup teardown: it prints `error during close`
|
|
20
|
-
* and the process still exits 0. The same throw from `setup` exits 1. Measured
|
|
21
|
-
* both ways on vitest 4.1.9 rather than assumed —
|
|
22
|
-
*
|
|
23
|
-
* ```
|
|
24
|
-
* teardown throws -> Test Files 1 passed ... error during close ... exit 0
|
|
25
|
-
* setup throws -> Error: PROBE: setup refused to start the run exit 1
|
|
26
|
-
* ```
|
|
27
|
-
*
|
|
28
|
-
* — because the first draft of this module put the check in `teardown`, where
|
|
29
|
-
* it reported a real overflow into a stream nothing gated on. A guard placed in
|
|
30
|
-
* a hook the runner ignores is the exact defect this file was written to stop,
|
|
31
|
-
* reproduced inside the guard itself.
|
|
32
|
-
*
|
|
33
|
-
* Checking at the start rather than the end costs nothing that matters: the
|
|
34
|
-
* next run reclaims roots whose exact dead ownership it can prove, preserves
|
|
35
|
-
* uncertain paths, and refuses before collection if anything unsafe remains.
|
|
36
|
-
* Accumulation is a trend, and a trend is still visible one run later.
|
|
37
|
-
* @see {@link module:configs/vitest/scratch} for the reclaim rules
|
|
38
|
-
* @module configs/vitest/scratch-global-setup
|
|
39
|
-
*/
|
|
40
|
-
import { lstatSync, realpathSync, writeSync } from "node:fs";
|
|
41
|
-
import * as path from "node:path";
|
|
42
|
-
import { env } from "node:process";
|
|
43
|
-
import { isProcessAlive, liveOwnerBirthProbe, readNamespaceEntries, scratchNamespaceDir, sweepScratchNamespace, } from "./scratch.js";
|
|
44
|
-
import { classifyScratchOwner, processBirthFingerprint, processBirthFingerprintSnapshot, readScratchOwnerRecord, } from "./scratch-owner.js";
|
|
45
|
-
import { describeTmpdirTrustFailure } from "./scratch-tmpdir-trust.js";
|
|
46
|
-
/**
|
|
47
|
-
* Upper bound on entries the namespace may hold that **nobody owns**.
|
|
48
|
-
*
|
|
49
|
-
* A run allocates one root per process — the main process plus one per worker —
|
|
50
|
-
* and several runs share a workstation, so a healthy namespace legitimately
|
|
51
|
-
* holds entries while work is in flight. This ceiling is not a tuning knob for
|
|
52
|
-
* that; it is the point past which the namespace is provably becoming the very
|
|
53
|
-
* thing it replaced.
|
|
54
|
-
*
|
|
55
|
-
* ## Why it counts unowned entries rather than all of them
|
|
56
|
-
*
|
|
57
|
-
* It compared against the total, and a total is a sum over every concurrent run
|
|
58
|
-
* on the box. Measured (CodySwannGT/lisa#3032), six snapshots of the shared
|
|
59
|
-
* namespace between 519 and 3,730 entries: in five of them EVERY root had a
|
|
60
|
-
* live owner that started before it. 24.3% of sampled instants sat above this
|
|
61
|
-
* ceiling, in stretches up to 127 seconds, and a run starting inside one was
|
|
62
|
-
* refused for its siblings' work under a message reading "accumulating rather
|
|
63
|
-
* than being reclaimed" — about a namespace in which nothing was accumulating.
|
|
64
|
-
* Ten full-suite runs at one commit produced 2 PASS and 8 REFUSED that way.
|
|
65
|
-
*
|
|
66
|
-
* Live-owned entries cannot accumulate: they are released when their owner
|
|
67
|
-
* exits, measured as 3,729 becoming reclaimable within 22 seconds when a run's
|
|
68
|
-
* workers ended together. Orphaned and unrecognised entries are the only ones
|
|
69
|
-
* that persist without bound, and they are exactly what the corrected
|
|
70
|
-
* arithmetic still counts — so no leak detection is lost.
|
|
71
|
-
*
|
|
72
|
-
* The number itself is unchanged and is deliberately not re-tuned here. It is a
|
|
73
|
-
* leak detector, not a performance backstop: the directory cost this campaign
|
|
74
|
-
* began with was measured at hundreds of thousands of entries, three orders of
|
|
75
|
-
* magnitude above this line, so a second absolute cap would need calibrating
|
|
76
|
-
* against measured harm and belongs in its own ticket.
|
|
77
|
-
*/
|
|
78
|
-
export const MAX_NAMESPACE_ENTRIES = 512;
|
|
79
|
-
/**
|
|
80
|
-
* Verify that a durable marker names the physical root and namespace inspected.
|
|
81
|
-
* @param dir - Canonical namespace path
|
|
82
|
-
* @param root - Direct child root
|
|
83
|
-
* @param owner - Valid owner marker
|
|
84
|
-
* @returns True when device, inode, and canonical identities all match
|
|
85
|
-
*/
|
|
86
|
-
function markerMatchesInspectedPath(dir, root, owner) {
|
|
87
|
-
const namespaceStat = lstatSync(dir);
|
|
88
|
-
const rootStat = lstatSync(root);
|
|
89
|
-
return (!rootStat.isSymbolicLink() &&
|
|
90
|
-
rootStat.isDirectory() &&
|
|
91
|
-
owner.namespace.canonicalPath === realpathSync(dir) &&
|
|
92
|
-
owner.namespace.dev === namespaceStat.dev &&
|
|
93
|
-
owner.namespace.ino === namespaceStat.ino &&
|
|
94
|
-
owner.root.canonicalPath === realpathSync(root) &&
|
|
95
|
-
owner.root.dev === rootStat.dev &&
|
|
96
|
-
owner.root.ino === rootStat.ino);
|
|
97
|
-
}
|
|
98
|
-
/**
|
|
99
|
-
* Classify one direct namespace child without treating age as authority.
|
|
100
|
-
* @param dir - Canonical namespace path
|
|
101
|
-
* @param name - Direct child basename
|
|
102
|
-
* @param alive - Pid liveness probe
|
|
103
|
-
* @param birth - Process-birth probe
|
|
104
|
-
* @returns Fail-closed entry disposition
|
|
105
|
-
*/
|
|
106
|
-
function classifyNamespaceEntry(dir, name, alive, birth) {
|
|
107
|
-
const root = path.join(dir, name);
|
|
108
|
-
const shape = lstatSync(root, { throwIfNoEntry: false });
|
|
109
|
-
if (shape === undefined || shape.isSymbolicLink() || !shape.isDirectory()) {
|
|
110
|
-
return { kind: "unrecognised", reason: "not-a-directory" };
|
|
111
|
-
}
|
|
112
|
-
try {
|
|
113
|
-
const owner = readScratchOwnerRecord(root);
|
|
114
|
-
if (!markerMatchesInspectedPath(dir, root, owner)) {
|
|
115
|
-
return { kind: "unrecognised", reason: "identity-mismatch" };
|
|
116
|
-
}
|
|
117
|
-
return classifyScratchOwner(owner, {
|
|
118
|
-
isProcessAlive: alive,
|
|
119
|
-
processBirthFingerprint: birth,
|
|
120
|
-
}) === "preserve"
|
|
121
|
-
? { kind: "live" }
|
|
122
|
-
: { kind: "orphaned" };
|
|
123
|
-
}
|
|
124
|
-
catch (error) {
|
|
125
|
-
// ENOENT is the marker being absent, which is a DIFFERENT condition from a
|
|
126
|
-
// marker that exists and cannot be trusted — see `UnrecognisedReason`. The
|
|
127
|
-
// two were one word until now, and separating them is the whole point of
|
|
128
|
-
// this classification.
|
|
129
|
-
return {
|
|
130
|
-
kind: "unrecognised",
|
|
131
|
-
reason: error.code === "ENOENT"
|
|
132
|
-
? "marker-absent"
|
|
133
|
-
: "marker-unreadable",
|
|
134
|
-
};
|
|
135
|
-
}
|
|
136
|
-
}
|
|
137
|
-
/**
|
|
138
|
-
* Classifies what is left in the namespace.
|
|
139
|
-
*
|
|
140
|
-
* `unrecognised` is the interesting bucket. The sweep identifies residue by
|
|
141
|
-
* parsing the owning pid out of a directory's name, so a change to that naming
|
|
142
|
-
* scheme does not break the sweep loudly — it makes the sweep silently match
|
|
143
|
-
* nothing while continuing to report success. Naming that case separately turns
|
|
144
|
-
* that regression into a failure instead of a slow leak.
|
|
145
|
-
* @param dir - Namespace directory to inspect
|
|
146
|
-
* @param alive - Liveness probe, overridable for tests
|
|
147
|
-
* @param birth - Process-birth probe, overridable for tests
|
|
148
|
-
* @returns The classified residue.
|
|
149
|
-
*/
|
|
150
|
-
export const inspectNamespace = (dir = scratchNamespaceDir(), alive = isProcessAlive, birth = processBirthFingerprint) => {
|
|
151
|
-
const entries = readNamespaceEntries(dir);
|
|
152
|
-
const classified = entries.map(name => ({
|
|
153
|
-
name,
|
|
154
|
-
disposition: classifyNamespaceEntry(dir, name, alive, birth),
|
|
155
|
-
}));
|
|
156
|
-
const unrecognisedDetail = classified.flatMap(entry => entry.disposition.kind === "unrecognised"
|
|
157
|
-
? [{ name: entry.name, reason: entry.disposition.reason }]
|
|
158
|
-
: []);
|
|
159
|
-
return {
|
|
160
|
-
orphaned: classified
|
|
161
|
-
.filter(entry => entry.disposition.kind === "orphaned")
|
|
162
|
-
.map(entry => entry.name),
|
|
163
|
-
unrecognised: unrecognisedDetail.map(entry => entry.name),
|
|
164
|
-
unrecognisedDetail,
|
|
165
|
-
total: entries.length,
|
|
166
|
-
};
|
|
167
|
-
};
|
|
168
|
-
/**
|
|
169
|
-
* Renders at most a handful of names for a failure message.
|
|
170
|
-
* @param names - Offending entry names
|
|
171
|
-
* @returns A comma-separated sample, elided beyond five.
|
|
172
|
-
*/
|
|
173
|
-
const sample = (names) => names.slice(0, 5).join(", ") + (names.length > 5 ? ", …" : "");
|
|
174
|
-
/**
|
|
175
|
-
* What each reason means, and what it points the reader at.
|
|
176
|
-
*
|
|
177
|
-
* Written as consequences rather than as restatements of the enum, because the
|
|
178
|
-
* failure is read by someone deciding what to do next. Each line names a cause
|
|
179
|
-
* that produces it and separates the transient case from the durable one — the
|
|
180
|
-
* distinction the single word `unrecognised` used to hide.
|
|
181
|
-
*/
|
|
182
|
-
const UNRECOGNISED_EXPLANATIONS = {
|
|
183
|
-
"marker-absent": "no owner marker at all. A root is briefly in this state while a run " +
|
|
184
|
-
"allocates it, so a few here during concurrent activity are a race with " +
|
|
185
|
-
"an allocation in flight; the same roots still present on a later run " +
|
|
186
|
-
"were written by something that never wrote a marker — a Lisa older than " +
|
|
187
|
-
"the owner-marker contract, or another tool sharing this directory",
|
|
188
|
-
"marker-unreadable": "a marker is present but cannot be trusted — unparseable, oversized, a " +
|
|
189
|
-
"symlink, or failing schema validation. Suspect a partially written " +
|
|
190
|
-
"marker or a writer disagreeing about the format",
|
|
191
|
-
"identity-mismatch": "a valid marker describes a different path, device, or inode than the one " +
|
|
192
|
-
"inspected. Suspect a moved, restored, or recreated directory",
|
|
193
|
-
"not-a-directory": "the entry is a symlink or not a directory, so it cannot be a run root " +
|
|
194
|
-
"at all. Suspect something other than Lisa writing into this namespace",
|
|
195
|
-
};
|
|
196
|
-
/**
|
|
197
|
-
* Group unrecognised entries by cause so the reader sees which one applies.
|
|
198
|
-
* @param detail - Unrecognised entries paired with their reasons
|
|
199
|
-
* @returns One indented line per reason present, each with a bounded sample.
|
|
200
|
-
*/
|
|
201
|
-
const describeUnrecognisedReasons = (detail) => {
|
|
202
|
-
const order = [
|
|
203
|
-
"marker-absent",
|
|
204
|
-
"marker-unreadable",
|
|
205
|
-
"identity-mismatch",
|
|
206
|
-
"not-a-directory",
|
|
207
|
-
];
|
|
208
|
-
return order
|
|
209
|
-
.flatMap(reason => {
|
|
210
|
-
const names = detail
|
|
211
|
-
.filter(entry => entry.reason === reason)
|
|
212
|
-
.map(entry => entry.name);
|
|
213
|
-
return names.length === 0
|
|
214
|
-
? []
|
|
215
|
-
: [
|
|
216
|
-
` ${reason} (${String(names.length)}): ${sample(names)} — ` +
|
|
217
|
-
`${UNRECOGNISED_EXPLANATIONS[reason]}.`,
|
|
218
|
-
];
|
|
219
|
-
})
|
|
220
|
-
.join("\n");
|
|
221
|
-
};
|
|
222
|
-
/** Safe operator recovery when automatic deletion authority is unavailable. */
|
|
223
|
-
const MANUAL_RECOVERY_GUIDANCE = "Remove only an exact entry whose dead owner you can independently verify. " +
|
|
224
|
-
"Do not clear the shared namespace or remove a live sibling's root.";
|
|
225
|
-
/**
|
|
226
|
-
* Builds the failure message for a namespace that is accumulating.
|
|
227
|
-
*
|
|
228
|
-
* Every branch names the directory and the offending entries, because the
|
|
229
|
-
* failure this replaces was a 60-second timeout that named nothing.
|
|
230
|
-
*
|
|
231
|
-
* `unrecognised` is deliberately a fail-closed refusal. A foreign, malformed,
|
|
232
|
-
* or identity-mismatched entry is preserved because age and naming are not
|
|
233
|
-
* deletion authority; proceeding would silently permit unbounded residue, and
|
|
234
|
-
* deleting it could destroy a live sibling's work. The diagnostic therefore
|
|
235
|
-
* names the bounded entries and gives the only safe manual recovery rule.
|
|
236
|
-
* @param dir - Namespace directory inspected
|
|
237
|
-
* @param residue - What the inspection found
|
|
238
|
-
* @returns The message, or `undefined` when the namespace is healthy.
|
|
239
|
-
*/
|
|
240
|
-
export const describeResidueFailure = (dir, residue) => {
|
|
241
|
-
if (residue.orphaned.length > 0) {
|
|
242
|
-
return (`Test scratch namespace ${dir} still holds ${String(residue.orphaned.length)} ` +
|
|
243
|
-
`root(s) whose owning process is gone, after a sweep that should have ` +
|
|
244
|
-
`removed them: ${sample(residue.orphaned)}. Reclaim-on-start is not ` +
|
|
245
|
-
`working, so a killed run's residue is now permanent. ${MANUAL_RECOVERY_GUIDANCE}`);
|
|
246
|
-
}
|
|
247
|
-
if (residue.unrecognised.length > 0) {
|
|
248
|
-
return (`Test scratch namespace ${dir} holds ${String(residue.unrecognised.length)} ` +
|
|
249
|
-
`root(s) without valid owner-marker authority. ` +
|
|
250
|
-
`Lisa preserved the uncertain residue instead of deleting a path that ` +
|
|
251
|
-
`cannot be bound to a token and process-birth fingerprint.\n` +
|
|
252
|
-
`${describeUnrecognisedReasons(residue.unrecognisedDetail)}\n` +
|
|
253
|
-
`There are ${String(residue.total)} entries in total; the historical ` +
|
|
254
|
-
`accumulating-residue ceiling is ${String(MAX_NAMESPACE_ENTRIES)}. ${MANUAL_RECOVERY_GUIDANCE}`);
|
|
255
|
-
}
|
|
256
|
-
// Entries no live process owns. Written as the general expression rather
|
|
257
|
-
// than as `unrecognised` alone: the orphaned branch above returns first
|
|
258
|
-
// today, so the term is zero here — and hard-coding that would make this
|
|
259
|
-
// line silently wrong the moment the branch above stops being terminal.
|
|
260
|
-
const unowned = residue.orphaned.length + residue.unrecognised.length;
|
|
261
|
-
if (unowned > MAX_NAMESPACE_ENTRIES) {
|
|
262
|
-
return (`Test scratch namespace ${dir} holds ${String(unowned)} entries that no ` +
|
|
263
|
-
`live process owns, past the ceiling of ${String(MAX_NAMESPACE_ENTRIES)} ` +
|
|
264
|
-
`(${String(residue.total)} entries in total, the rest being work in ` +
|
|
265
|
-
`flight). Scratch space is accumulating rather than being reclaimed — ` +
|
|
266
|
-
`the condition this guard exists to prevent. ${MANUAL_RECOVERY_GUIDANCE}`);
|
|
267
|
-
}
|
|
268
|
-
return undefined;
|
|
269
|
-
};
|
|
270
|
-
/**
|
|
271
|
-
* Sweeps the namespace and reports what survived.
|
|
272
|
-
* @param alive - Process liveness probe shared by both phases
|
|
273
|
-
* @param snapshot - One bulk process-birth snapshot provider
|
|
274
|
-
* @returns The residue remaining after the sweep.
|
|
275
|
-
*/
|
|
276
|
-
export const sweepThenInspect = (alive = isProcessAlive, snapshot = processBirthFingerprintSnapshot) => {
|
|
277
|
-
const dir = scratchNamespaceDir();
|
|
278
|
-
const birth = liveOwnerBirthProbe(dir, alive, snapshot);
|
|
279
|
-
sweepScratchNamespace({
|
|
280
|
-
isProcessAlive: alive,
|
|
281
|
-
processBirthFingerprint: birth,
|
|
282
|
-
});
|
|
283
|
-
return inspectNamespace(dir, alive, birth);
|
|
284
|
-
};
|
|
285
|
-
/**
|
|
286
|
-
* Audits the namespace, tolerating a sibling run's worker exiting mid-audit.
|
|
287
|
-
*
|
|
288
|
-
* That worker's root becomes orphaned in the window between the sweep and the
|
|
289
|
-
* inspection, through no fault of this run. Sweeping once more before treating
|
|
290
|
-
* an orphan as a defect keeps a guard built to catch a permanent leak from
|
|
291
|
-
* failing on a transient one.
|
|
292
|
-
* @returns The residue to judge.
|
|
293
|
-
*/
|
|
294
|
-
const auditNamespace = () => {
|
|
295
|
-
const first = sweepThenInspect();
|
|
296
|
-
return first.orphaned.length > 0 ? sweepThenInspect() : first;
|
|
297
|
-
};
|
|
298
|
-
/**
|
|
299
|
-
* Renders the banner printed at the moment of refusal.
|
|
300
|
-
*
|
|
301
|
-
* A throw from `setup` exits 1, which is the half of the contract that works.
|
|
302
|
-
* The other half did not: Vitest reports the throw as an unhandled error AFTER
|
|
303
|
-
* the run summary, so what an operator actually saw, in order, was
|
|
304
|
-
*
|
|
305
|
-
* ```
|
|
306
|
-
* line 5: No test files found, exiting with code 1
|
|
307
|
-
* lines 11-390: a full coverage report, every file at 0%
|
|
308
|
-
* line 397: Error: Test scratch namespace ... past the ceiling of 512
|
|
309
|
-
* ```
|
|
310
|
-
*
|
|
311
|
-
* measured on vitest 4.1.9 over a 416-line output. The guard bit correctly and
|
|
312
|
-
* was still PRESENTED as a coverage failure — "no tests" and an all-zero
|
|
313
|
-
* coverage table are the first and largest things on the page, and the reason
|
|
314
|
-
* is 392 lines below the verdict. Anything reading the top of the output, or
|
|
315
|
-
* reading the coverage numbers, gets the wrong story; that is a silent
|
|
316
|
-
* degradation inside a guard written to abolish silent degradation.
|
|
317
|
-
*
|
|
318
|
-
* So the reason is printed HERE, before the throw, from a hook that runs before
|
|
319
|
-
* collection — which puts it above every line of that output instead of below
|
|
320
|
-
* it. The throw is kept exactly as it was: this changes where the reason is
|
|
321
|
-
* read, not whether the run fails.
|
|
322
|
-
*
|
|
323
|
-
* The banner says what the zeroes below it mean, because the operator standing
|
|
324
|
-
* at this gate is not necessarily an engineer and "0% coverage" reads as a
|
|
325
|
-
* verdict on the code rather than as the absence of a measurement.
|
|
326
|
-
* @param failure - The residue failure being reported
|
|
327
|
-
* @returns Operator-readable banner text.
|
|
328
|
-
*/
|
|
329
|
-
export const renderRefusalNotice = (failure) => [
|
|
330
|
-
"",
|
|
331
|
-
"═".repeat(78),
|
|
332
|
-
"TEST RUN REFUSED TO START — this is NOT a coverage failure.",
|
|
333
|
-
"",
|
|
334
|
-
failure,
|
|
335
|
-
"",
|
|
336
|
-
"No test ran, so nothing below this line measured anything. Vitest will",
|
|
337
|
-
'print "No test files found" and a coverage table reading 0% for every',
|
|
338
|
-
"file; both are what a refused run looks like, not a verdict on the code.",
|
|
339
|
-
"Fix the reason named above and run again.",
|
|
340
|
-
"═".repeat(78),
|
|
341
|
-
"",
|
|
342
|
-
].join("\n");
|
|
343
|
-
/** The file descriptor a refusal writes to. `2` is stderr. */
|
|
344
|
-
const STDERR_FD = 2;
|
|
345
|
-
/**
|
|
346
|
-
* Renders the ONE line a refused run ends on.
|
|
347
|
-
*
|
|
348
|
-
* The banner {@link renderRefusalNotice} produces is read by an operator who
|
|
349
|
-
* starts at the top. Nobody does that with a long transcript, and the tail was
|
|
350
|
-
* measured to be a stack trace through vitest's `_initializeGlobalSetup` — no
|
|
351
|
-
* line anywhere said what the run had concluded. Every other run puts its
|
|
352
|
-
* verdict at the end, so the end is where a reader looks, and a refused run
|
|
353
|
-
* gave them a frame in somebody else's internals instead.
|
|
354
|
-
*
|
|
355
|
-
* That absence has a name in this campaign: NO-RESULT, one of the three
|
|
356
|
-
* distinct outcomes fourteen runs of one unchanged commit produced
|
|
357
|
-
* (CodySwannGT/lisa#3032). "Every run emits a summary line" is the clause it
|
|
358
|
-
* violates, and it violates it by emitting nothing at all rather than by
|
|
359
|
-
* emitting the wrong thing.
|
|
360
|
-
*
|
|
361
|
-
* One line, deliberately. A second banner at the foot of the page would be a
|
|
362
|
-
* wall a reader skips exactly as they skipped the first one.
|
|
363
|
-
* @param failure - The residue failure being reported
|
|
364
|
-
* @returns A single newline-terminated summary line.
|
|
365
|
-
*/
|
|
366
|
-
export const renderRefusalSummary = (failure) => `❌ NO VERDICT — the run was refused before collection, so 0 test files ` +
|
|
367
|
-
`ran: nothing passed, nothing failed, and no coverage was measured. ` +
|
|
368
|
-
`Reason: ${failure}\n`;
|
|
369
|
-
/**
|
|
370
|
-
* Vitest's marker for a pool worker. Absent in the process that runs
|
|
371
|
-
* `globalSetup`, present in every process that runs a test file — measured on
|
|
372
|
-
* vitest 4.1.9 rather than assumed, and pinned by a test so a rename cannot
|
|
373
|
-
* silently disarm {@link announceRefusal}.
|
|
374
|
-
*/
|
|
375
|
-
export const POOL_WORKER_ENV = "VITEST_POOL_ID";
|
|
376
|
-
/**
|
|
377
|
-
* Whether this process is a pool worker rather than the run's main process.
|
|
378
|
-
* @returns True inside a worker running a test file.
|
|
379
|
-
*/
|
|
380
|
-
const inPoolWorker = () => env[POOL_WORKER_ENV] !== undefined;
|
|
381
|
-
/**
|
|
382
|
-
* Arms the summary line to be written when the process finally exits.
|
|
383
|
-
*
|
|
384
|
-
* At exit rather than inline, because inline is where the banner already is and
|
|
385
|
-
* the whole point is to reach the reader who starts at the other end. Vitest
|
|
386
|
-
* prints its unhandled-error report after `setup` throws, so anything written
|
|
387
|
-
* before the throw lands above it; an exit hook lands below.
|
|
388
|
-
*
|
|
389
|
-
* `writeSync` on the descriptor, never `process.stderr.write`. On a POSIX pipe
|
|
390
|
-
* Node's stderr is asynchronous, and an asynchronous write issued from an exit
|
|
391
|
-
* handler can be discarded when the process tears down — which would leave this
|
|
392
|
-
* fix passing its own tests while changing no transcript anywhere. The writer
|
|
393
|
-
* is a parameter so a test can observe the line without redefining an ESM
|
|
394
|
-
* module namespace, which is not permitted.
|
|
395
|
-
*
|
|
396
|
-
* Unguarded on purpose: {@link announceRefusal} is the only caller and holds
|
|
397
|
-
* the single guard. Two copies of one condition is one condition that can go
|
|
398
|
-
* inert without any test noticing.
|
|
399
|
-
* @param failure - The residue failure being reported
|
|
400
|
-
* @param write - Where the line goes; defaults to a synchronous stderr write
|
|
401
|
-
*/
|
|
402
|
-
export const armRefusalSummary = (failure, write = text => {
|
|
403
|
-
writeSync(STDERR_FD, text);
|
|
404
|
-
}) => {
|
|
405
|
-
process.once("exit", () => {
|
|
406
|
-
write(renderRefusalSummary(failure));
|
|
407
|
-
});
|
|
408
|
-
};
|
|
409
|
-
/**
|
|
410
|
-
* Says a run was refused — at the top of the transcript and again at the foot —
|
|
411
|
-
* and says nothing at all from a process that cannot refuse a run.
|
|
412
|
-
*
|
|
413
|
-
* ## Why a worker announces nothing
|
|
414
|
-
*
|
|
415
|
-
* This project has tests that invoke the real {@link setup} against a
|
|
416
|
-
* deliberately overfull namespace, and both halves of an announcement outlive
|
|
417
|
-
* the call that made it: the banner is already on the run's stderr, and the
|
|
418
|
-
* summary is a handler that fires whenever that process exits. Announced
|
|
419
|
-
* unconditionally, each such test contributed to a transcript that was not its
|
|
420
|
-
* own.
|
|
421
|
-
*
|
|
422
|
-
* Measured on ten consecutive runs of 64 files and 893 tests, every one green
|
|
423
|
-
* and exiting 0: **two** "TEST RUN REFUSED TO START" banners in each, naming
|
|
424
|
-
* the tests' own fixture directories, and — until this guard — two matching
|
|
425
|
-
* "❌ NO VERDICT" lines. A green run that says it was refused is the same class
|
|
426
|
-
* of lie as a killed gate that says FAILED, in the same transcript, and it is
|
|
427
|
-
* the one the "repeated runs agree" scenario trips over: two readers of the
|
|
428
|
-
* same passing run can reasonably disagree about what it concluded.
|
|
429
|
-
*
|
|
430
|
-
* The banner half predates the summary half and shipped with #3027; the summary
|
|
431
|
-
* half was introduced by #3032's own first attempt at this fix. Both are cured
|
|
432
|
-
* here by one condition rather than two.
|
|
433
|
-
*
|
|
434
|
-
* The guard is structural rather than a rule each test must remember: only the
|
|
435
|
-
* process vitest runs `globalSetup` in can refuse a run, and that process is
|
|
436
|
-
* the one WITHOUT {@link POOL_WORKER_ENV}. A test calling `setup` runs in a
|
|
437
|
-
* worker and therefore announces nothing, whatever it does to the namespace.
|
|
438
|
-
* @param failure - The residue failure being reported
|
|
439
|
-
* @param writeNotice - Where the banner goes; defaults to the run's stderr
|
|
440
|
-
*/
|
|
441
|
-
export const announceRefusal = (failure, writeNotice = text => {
|
|
442
|
-
process.stderr.write(text);
|
|
443
|
-
}) => {
|
|
444
|
-
if (inPoolWorker())
|
|
445
|
-
return;
|
|
446
|
-
// Before the throw, so it lands above every line vitest goes on to print —
|
|
447
|
-
// see renderRefusalNotice for the measured ordering that fixes.
|
|
448
|
-
writeNotice(renderRefusalNotice(failure));
|
|
449
|
-
armRefusalSummary(failure);
|
|
450
|
-
};
|
|
451
|
-
/**
|
|
452
|
-
* Why the namespace must be refused, or `undefined` when it is usable.
|
|
453
|
-
* @returns Refusal text, or undefined
|
|
454
|
-
*/
|
|
455
|
-
const describeNamespaceFailure = () => {
|
|
456
|
-
// The namespace directory is not created here. `createRunRoot` makes it
|
|
457
|
-
// recursively in whichever worker allocates first, and both the sweep and the
|
|
458
|
-
// inspection treat an absent namespace as an empty one — so creating it would
|
|
459
|
-
// be a side effect ahead of the audit that buys nothing.
|
|
460
|
-
const dir = scratchNamespaceDir();
|
|
461
|
-
return describeResidueFailure(dir, auditNamespace());
|
|
462
|
-
};
|
|
463
|
-
/**
|
|
464
|
-
* Refuses to start into an untrusted temp root or an accumulating namespace.
|
|
465
|
-
*
|
|
466
|
-
* A refusal speaks twice — a banner before collection and a summary line at
|
|
467
|
-
* exit — and the two are not redundant. They are the top and the bottom of a
|
|
468
|
-
* transcript nobody reads in full.
|
|
469
|
-
*
|
|
470
|
-
* The TMPDIR trust check runs FIRST, and the order is load-bearing rather than
|
|
471
|
-
* arbitrary. An untrusted root is the more fundamental fault: it is a property
|
|
472
|
-
* of the environment the run was launched in, it is what every rung of the
|
|
473
|
-
* namespace audit is then inspected THROUGH, and it is the one whose absence
|
|
474
|
-
* of a message cost four separate investigations (CodySwannGT/lisa#3691).
|
|
475
|
-
* Reporting a namespace symptom first would name the second-order fact.
|
|
476
|
-
* @throws {Error} When the temp root is untrusted, or residue the sweep cannot or did not reclaim is present.
|
|
477
|
-
*/
|
|
478
|
-
export const setup = () => {
|
|
479
|
-
const failure = describeTmpdirTrustFailure() ?? describeNamespaceFailure();
|
|
480
|
-
if (failure !== undefined) {
|
|
481
|
-
// Both halves of the announcement happen before the throw, because the
|
|
482
|
-
// throw is what ends this function.
|
|
483
|
-
announceRefusal(failure);
|
|
484
|
-
throw new Error(failure);
|
|
485
|
-
}
|
|
486
|
-
};
|
|
487
|
-
/**
|
|
488
|
-
* Reclaims what this run allocated.
|
|
489
|
-
*
|
|
490
|
-
* This hook cannot fail a run — see the module header: Vitest swallows a throw
|
|
491
|
-
* from here. So it does the one thing it can do reliably, which is the cleanup;
|
|
492
|
-
* the judgement is made by {@link setup} on the next run, where a throw is
|
|
493
|
-
* actually honoured.
|
|
494
|
-
*
|
|
495
|
-
* The namespace directory itself is deliberately left in place. Creating a name
|
|
496
|
-
* inside a saturated shared temp root is the expensive operation this whole
|
|
497
|
-
* module exists to stop paying repeatedly; keeping one directory forever means
|
|
498
|
-
* the cost is paid once on a machine rather than once per run, and it is what
|
|
499
|
-
* makes "one entry in the shared temp root, ever" literally true rather than
|
|
500
|
-
* approximately true.
|
|
501
|
-
*/
|
|
502
|
-
export const teardown = () => {
|
|
503
|
-
sweepScratchNamespace();
|
|
504
|
-
};
|
|
505
|
-
//# sourceMappingURL=scratch-global-setup.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"scratch-global-setup.js","sourceRoot":"","sources":["../../../src/configs/vitest/scratch-global-setup.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAsCG;AACH,OAAO,EAAE,SAAS,EAAE,YAAY,EAAE,SAAS,EAAE,MAAM,SAAS,CAAC;AAC7D,OAAO,KAAK,IAAI,MAAM,WAAW,CAAC;AAElC,OAAO,EAAE,GAAG,EAAE,MAAM,cAAc,CAAC;AAEnC,OAAO,EACL,cAAc,EACd,mBAAmB,EACnB,oBAAoB,EACpB,mBAAmB,EACnB,qBAAqB,GACtB,MAAM,cAAc,CAAC;AACtB,OAAO,EACL,oBAAoB,EACpB,uBAAuB,EACvB,+BAA+B,EAC/B,sBAAsB,GAEvB,MAAM,oBAAoB,CAAC;AAC5B,OAAO,EAAE,0BAA0B,EAAE,MAAM,2BAA2B,CAAC;AAEvE;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA+BG;AACH,MAAM,CAAC,MAAM,qBAAqB,GAAG,GAAG,CAAC;AAiDzC;;;;;;GAMG;AACH,SAAS,0BAA0B,CACjC,GAAW,EACX,IAAY,EACZ,KAA2B;IAE3B,MAAM,aAAa,GAAG,SAAS,CAAC,GAAG,CAAC,CAAC;IACrC,MAAM,QAAQ,GAAG,SAAS,CAAC,IAAI,CAAC,CAAC;IACjC,OAAO,CACL,CAAC,QAAQ,CAAC,cAAc,EAAE;QAC1B,QAAQ,CAAC,WAAW,EAAE;QACtB,KAAK,CAAC,SAAS,CAAC,aAAa,KAAK,YAAY,CAAC,GAAG,CAAC;QACnD,KAAK,CAAC,SAAS,CAAC,GAAG,KAAK,aAAa,CAAC,GAAG;QACzC,KAAK,CAAC,SAAS,CAAC,GAAG,KAAK,aAAa,CAAC,GAAG;QACzC,KAAK,CAAC,IAAI,CAAC,aAAa,KAAK,YAAY,CAAC,IAAI,CAAC;QAC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AG,GAAS,EAAE;IAC9B,MAAM,OAAO,GAAG,0BAA0B,EAAE,IAAI,wBAAwB,EAAE,CAAC;IAE3E,IAAI,OAAO,KAAK,SAAS,EAAE,CAAC;QAC1B,uEAAuE;QACvE,oCAAoC;QACpC,eAAe,CAAC,OAAO,CAAC,CAAC;QACzB,MAAM,IAAI,KAAK,CAAC,OAAO,CAAC,CAAC;IAC3B,CAAC;AACH,CAAC,CAAC;AAEF;;;;;;;;;;;;;;GAcG;AACH,MAAM,CAAC,MAAM,QAAQ,GAAG,GAAS,EAAE;IACjC,qBAAqB,EAAE,CAAC;AAC1B,CAAC,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"scratch-leak-setup.d.ts","sourceRoot":"","sources":["../../../src/configs/vitest/scratch-leak-setup.ts"],"names":[],"mappings":""}
|
|
@@ -1,108 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Per-suite backstop that makes a leaked fixture fail the suite that leaked it.
|
|
3
|
-
*
|
|
4
|
-
* The worker-wide run root is still removed wholesale on exit and reclaimed by
|
|
5
|
-
* a successor after SIGKILL. This hook is the attribution layer: it snapshots
|
|
6
|
-
* the run-root children before collection, runs last after every user
|
|
7
|
-
* `afterAll`, removes anything added by the suite, and fails on additions whose
|
|
8
|
-
* prefix was not registered before collection.
|
|
9
|
-
* @module configs/vitest/scratch-leak-setup
|
|
10
|
-
*/
|
|
11
|
-
import * as fs from "node:fs";
|
|
12
|
-
import { tmpdir } from "node:os";
|
|
13
|
-
import * as path from "node:path";
|
|
14
|
-
import { afterAll } from "vitest";
|
|
15
|
-
import { readBoundedScratchNames, removeAuthorizedScratchChildren, } from "./scratch-authority.js";
|
|
16
|
-
import { SCRATCH_OWNER_FILE, readScratchOwnerRecord } from "./scratch-owner.js";
|
|
17
|
-
/** Run root whose children this suite owns. */
|
|
18
|
-
const runRoot = tmpdir();
|
|
19
|
-
/** Fail immediately if the setup order did not install scratch first. */
|
|
20
|
-
if (!path.basename(runRoot).startsWith("worker-")) {
|
|
21
|
-
throw new Error(`Scratch leak guard started before scratch redirection: ${runRoot}`);
|
|
22
|
-
}
|
|
23
|
-
/** Owner record binds the prefix registry and path identity to this root. */
|
|
24
|
-
const owner = readScratchOwnerRecord(runRoot);
|
|
25
|
-
/** Direct children present before this suite imports any test module. */
|
|
26
|
-
const baseline = new Set([
|
|
27
|
-
...readBoundedScratchNames(runRoot),
|
|
28
|
-
SCRATCH_OWNER_FILE,
|
|
29
|
-
]);
|
|
30
|
-
/**
|
|
31
|
-
* Render the prefix a mkdtemp-shaped basename came from.
|
|
32
|
-
* @param name - Direct scratch child basename
|
|
33
|
-
* @returns Display prefix
|
|
34
|
-
*/
|
|
35
|
-
function displayedPrefix(name) {
|
|
36
|
-
return /^[\s\S]*[A-Za-z0-9]{6}$/u.test(name) ? `${name.slice(0, -6)}*` : name;
|
|
37
|
-
}
|
|
38
|
-
/**
|
|
39
|
-
* Remove every classified addition through one inode-bound cleanup process.
|
|
40
|
-
* @param names - Direct scratch child basenames
|
|
41
|
-
*/
|
|
42
|
-
function removeInternalChildren(names) {
|
|
43
|
-
for (const name of names) {
|
|
44
|
-
if (path.basename(name) !== name || name === "." || name === "..") {
|
|
45
|
-
throw new Error(`Scratch leak guard refused non-basename child: ${name}`);
|
|
46
|
-
}
|
|
47
|
-
}
|
|
48
|
-
const before = fs.lstatSync(runRoot);
|
|
49
|
-
if (before.dev !== owner.root.dev ||
|
|
50
|
-
before.ino !== owner.root.ino ||
|
|
51
|
-
fs.realpathSync(runRoot) !== owner.root.canonicalPath) {
|
|
52
|
-
throw new Error("Scratch run-root identity changed before leak cleanup");
|
|
53
|
-
}
|
|
54
|
-
const marker = readScratchOwnerRecord(runRoot);
|
|
55
|
-
if (marker.token !== owner.token) {
|
|
56
|
-
throw new Error("Scratch owner marker changed before leak cleanup");
|
|
57
|
-
}
|
|
58
|
-
removeAuthorizedScratchChildren({
|
|
59
|
-
parent: owner.root,
|
|
60
|
-
basenames: names,
|
|
61
|
-
});
|
|
62
|
-
if (readScratchOwnerRecord(runRoot).token !== owner.token) {
|
|
63
|
-
throw new Error("Scratch owner marker changed during leak cleanup");
|
|
64
|
-
}
|
|
65
|
-
}
|
|
66
|
-
/**
|
|
67
|
-
* Read the run root or throw a suite-attributed diagnostic.
|
|
68
|
-
* @returns Current direct-child basenames
|
|
69
|
-
*/
|
|
70
|
-
function readRunRootNames() {
|
|
71
|
-
try {
|
|
72
|
-
return readBoundedScratchNames(runRoot);
|
|
73
|
-
}
|
|
74
|
-
catch (error) {
|
|
75
|
-
throw new Error(`Scratch leak guard could not read suite root ${runRoot}: ${String(error)}`);
|
|
76
|
-
}
|
|
77
|
-
}
|
|
78
|
-
/**
|
|
79
|
-
* Whether one addition belongs to a prefix registered before collection.
|
|
80
|
-
* @param name - Added direct-child basename
|
|
81
|
-
* @returns Whether the stack registered ownership
|
|
82
|
-
*/
|
|
83
|
-
function isRegisteredAddition(name) {
|
|
84
|
-
return owner.registeredPrefixes.some(prefix => name.startsWith(prefix));
|
|
85
|
-
}
|
|
86
|
-
/**
|
|
87
|
-
* Audit direct additions after user hooks, clean every one, and fail on any
|
|
88
|
-
* prefix the stack did not register before collection.
|
|
89
|
-
*/
|
|
90
|
-
afterAll(() => {
|
|
91
|
-
const names = readRunRootNames();
|
|
92
|
-
const additions = names.filter(name => !baseline.has(name));
|
|
93
|
-
const unregistered = additions.filter(name => !isRegisteredAddition(name));
|
|
94
|
-
try {
|
|
95
|
-
removeInternalChildren(additions);
|
|
96
|
-
}
|
|
97
|
-
catch (error) {
|
|
98
|
-
throw new Error(`Scratch leak guard could not clean ${additions.join(", ")} for suite ${owner.suiteLabel}: ${String(error)}`);
|
|
99
|
-
}
|
|
100
|
-
if (unregistered.length > 0) {
|
|
101
|
-
const details = [...unregistered]
|
|
102
|
-
.sort((left, right) => left.localeCompare(right))
|
|
103
|
-
.map(name => `${name} (${displayedPrefix(name)})`)
|
|
104
|
-
.join(", ");
|
|
105
|
-
throw new Error(`Suite ${owner.suiteLabel} leaked ${String(unregistered.length)} unregistered scratch fixture(s): ${details}`);
|
|
106
|
-
}
|
|
107
|
-
});
|
|
108
|
-
//# sourceMappingURL=scratch-leak-setup.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"scratch-leak-setup.js","sourceRoot":"","sources":["../../../src/configs/vitest/scratch-leak-setup.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AACH,OAAO,KAAK,EAAE,MAAM,SAAS,CAAC;AAC9B,OAAO,EAAE,MAAM,EAAE,MAAM,SAAS,CAAC;AACjC,OAAO,KAAK,IAAI,MAAM,WAAW,CAAC;AAElC,OAAO,EAAE,QAAQ,EAAE,MAAM,QAAQ,CAAC;AAElC,OAAO,EACL,uBAAuB,EACvB,+BAA+B,GAChC,MAAM,wBAAwB,CAAC;AAChC,OAAO,EAAE,kBAAkB,EAAE,sBAAsB,EAAE,MAAM,oBAAoB,CAAC;AAEhF,+CAA+C;AAC/C,MAAM,OAAO,GAAG,MAAM,EAAE,CAAC;AAEzB,yEAAyE;AACzE,IAAI,CAAC,IAAI,CAAC,QAAQ,CAAC,OAAO,CAAC,CAAC,UAAU,CAAC,SAAS,CAAC,EAAE,CAAC;IAClD,MAAM,IAAI,KAAK,CACb,0DAA0D,OAAO,EAAE,CACpE,CAAC;AACJ,CAAC;AAED,6EAA6E;AAC7E,MAAM,KAAK,GAAG,sBAAsB,CAAC,OAAO,CAAC,CAAC;AAE9C,yEAAyE;AACzE,MAAM,QAAQ,GAAG,IAAI,GAAG,CAAC;IACvB,GAAG,uBAAuB,CAAC,OAAO,CAAC;IACnC,kBAAkB;CACnB,CAAC,CAAC;AAEH;;;;GAIG;AACH,SAAS,eAAe,CAAC,IAAY;IACnC,OAAO,0BAA0B,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,GAAG,IAAI,CAAC,KAAK,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,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