@codyswann/lisa 5.4.0 → 5.6.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +60 -3
- package/all/copy-contents/gitignore +16 -0
- package/all/copy-contents/scripts/lisa-mutation.sh +4 -6
- package/all/copy-overwrite/scripts/fetch-test-access-map.d.mts +71 -0
- package/all/copy-overwrite/scripts/fetch-test-access-map.mjs +674 -0
- package/all/copy-overwrite/scripts/lib/affected-tests.mjs +818 -0
- package/all/copy-overwrite/scripts/lib/automation-provenance-local.mjs +48 -3
- package/all/copy-overwrite/scripts/lib/build-marker.mjs +410 -0
- package/all/copy-overwrite/scripts/lib/gate-pass-cache.mjs +537 -0
- package/all/copy-overwrite/scripts/lib/github-attestation-provider.mjs +68 -0
- package/all/copy-overwrite/scripts/lib/github-attestation-recovery.mjs +25 -10
- package/all/copy-overwrite/scripts/lib/github-attestation-verifier.mjs +4 -1
- package/all/copy-overwrite/scripts/lib/kill-marks.mjs +1 -2
- package/all/copy-overwrite/scripts/lib/lisa-cleanup-sweep-processes.mjs +3 -4
- package/all/copy-overwrite/scripts/lib/npm-update-allocate.mjs +1 -6
- package/all/copy-overwrite/scripts/lib/npm-update-authorization.mjs +25 -14
- package/all/copy-overwrite/scripts/lib/npm-update-cancel-origin.mjs +45 -11
- package/all/copy-overwrite/scripts/lib/npm-update-cancellation-proof.mjs +22 -11
- package/all/copy-overwrite/scripts/lib/npm-update-cancellation.mjs +29 -17
- package/all/copy-overwrite/scripts/lib/npm-update-controller-broker.mjs +1 -1
- package/all/copy-overwrite/scripts/lib/npm-update-controller-factory.mjs +19 -1
- package/all/copy-overwrite/scripts/lib/npm-update-gate-hooks.mjs +2 -1
- package/all/copy-overwrite/scripts/lib/npm-update-gate.mjs +5 -0
- package/all/copy-overwrite/scripts/lib/npm-update-gh-requests.mjs +57 -30
- package/all/copy-overwrite/scripts/lib/npm-update-helper-inventory.mjs +9 -1
- package/all/copy-overwrite/scripts/lib/npm-update-hosted-hook.mjs +1 -1
- package/all/copy-overwrite/scripts/lib/npm-update-leaf.mjs +6 -1
- package/all/copy-overwrite/scripts/lib/npm-update-policy.mjs +38 -0
- package/all/copy-overwrite/scripts/lib/npm-update-publication.mjs +21 -3
- package/all/copy-overwrite/scripts/lib/npm-update-publish.mjs +13 -1
- package/all/copy-overwrite/scripts/lib/npm-update-recovery.mjs +29 -4
- package/all/copy-overwrite/scripts/lib/npm-update-supersession.mjs +21 -7
- package/all/copy-overwrite/scripts/lib/npm-update-tool-launcher.mjs +1 -1
- package/all/copy-overwrite/scripts/lib/npm-update-tracker-cancel.mjs +139 -0
- package/all/copy-overwrite/scripts/lib/npm-update-tracker-jira.mjs +149 -19
- package/all/copy-overwrite/scripts/lib/npm-update-tracker-linear.mjs +72 -17
- package/all/copy-overwrite/scripts/lib/npm-update-tracker-wire.mjs +102 -12
- package/all/copy-overwrite/scripts/lib/npm-update-tracker.mjs +91 -13
- package/all/copy-overwrite/scripts/lib/push-admission.mjs +158 -0
- package/all/copy-overwrite/scripts/lib/push-gate-defaults.d.mts +34 -0
- package/all/copy-overwrite/scripts/lib/push-gate-defaults.mjs +147 -0
- package/all/copy-overwrite/scripts/lib/push-timing.mjs +323 -0
- package/all/copy-overwrite/scripts/lib/rspec-selection.mjs +672 -0
- package/all/copy-overwrite/scripts/lisa-affected-tests.mjs +566 -0
- package/all/copy-overwrite/scripts/lisa-automation-provenance.mjs +35 -8
- package/all/copy-overwrite/scripts/lisa-gates.mjs +29 -0
- package/all/copy-overwrite/scripts/lisa-lint-staged-preflight.mjs +10 -1
- package/all/copy-overwrite/scripts/lisa-npm-updater.mjs +8 -5
- package/all/copy-overwrite/scripts/lisa-push-timing-report.mjs +153 -0
- package/all/copy-overwrite/scripts/lisa-rspec-select.mjs +982 -0
- package/all/copy-overwrite/scripts/lisa-run-gates.mjs +231 -6
- package/all/copy-overwrite/scripts/npm-updater-helper-graph.json +148 -41
- package/all/deletions.json +11 -2
- package/cdk/create-only/vitest.config.local.ts +1 -7
- package/cdk/package-lisa/package.lisa.json +4 -4
- package/dist/cli/admit-cmd.d.ts +21 -0
- package/dist/cli/admit-cmd.d.ts.map +1 -0
- package/dist/cli/admit-cmd.js +142 -0
- package/dist/cli/admit-cmd.js.map +1 -0
- package/dist/cli/check-cmd.d.ts +72 -0
- package/dist/cli/check-cmd.d.ts.map +1 -0
- package/dist/cli/check-cmd.js +316 -0
- package/dist/cli/check-cmd.js.map +1 -0
- package/dist/cli/index.d.ts.map +1 -1
- package/dist/cli/index.js +6 -4
- package/dist/cli/index.js.map +1 -1
- package/dist/cli/lisa-test-run-admission.d.ts +18 -0
- package/dist/cli/lisa-test-run-admission.d.ts.map +1 -0
- package/dist/cli/lisa-test-run-admission.js +62 -0
- package/dist/cli/lisa-test-run-admission.js.map +1 -0
- package/dist/cli/lisa-test-run-payload.d.ts +37 -0
- package/dist/cli/lisa-test-run-payload.d.ts.map +1 -0
- package/dist/cli/lisa-test-run-payload.js +55 -0
- package/dist/cli/lisa-test-run-payload.js.map +1 -0
- package/dist/cli/lisa-test-run-shard-files.d.ts +89 -0
- package/dist/cli/lisa-test-run-shard-files.d.ts.map +1 -0
- package/dist/cli/lisa-test-run-shard-files.js +239 -0
- package/dist/cli/lisa-test-run-shard-files.js.map +1 -0
- package/dist/cli/lisa-test-run-shard.d.ts +6 -2
- package/dist/cli/lisa-test-run-shard.d.ts.map +1 -1
- package/dist/cli/lisa-test-run-shard.js +25 -13
- package/dist/cli/lisa-test-run-shard.js.map +1 -1
- package/dist/cli/lisa-test-run.d.ts +1 -1
- package/dist/cli/lisa-test-run.d.ts.map +1 -1
- package/dist/cli/lisa-test-run.js +47 -10
- package/dist/cli/lisa-test-run.js.map +1 -1
- package/dist/cli/update-check-hook.d.ts.map +1 -1
- package/dist/cli/update-check-hook.js +3 -0
- package/dist/cli/update-check-hook.js.map +1 -1
- package/dist/configs/vitest/base.d.ts +58 -135
- package/dist/configs/vitest/base.d.ts.map +1 -1
- package/dist/configs/vitest/base.js +76 -228
- package/dist/configs/vitest/base.js.map +1 -1
- package/dist/configs/vitest/cdk.d.ts.map +1 -1
- package/dist/configs/vitest/cdk.js +3 -2
- package/dist/configs/vitest/cdk.js.map +1 -1
- package/dist/configs/vitest/coverage-include-global-setup.d.ts.map +1 -1
- package/dist/configs/vitest/coverage-include-global-setup.js +3 -4
- package/dist/configs/vitest/coverage-include-global-setup.js.map +1 -1
- package/dist/configs/vitest/coverage-reports-directory.d.ts +27 -5
- package/dist/configs/vitest/coverage-reports-directory.d.ts.map +1 -1
- package/dist/configs/vitest/coverage-reports-directory.js +47 -10
- package/dist/configs/vitest/coverage-reports-directory.js.map +1 -1
- package/dist/configs/vitest/harper-fabric.d.ts.map +1 -1
- package/dist/configs/vitest/harper-fabric.js +3 -2
- package/dist/configs/vitest/harper-fabric.js.map +1 -1
- package/dist/configs/vitest/nestjs.d.ts.map +1 -1
- package/dist/configs/vitest/nestjs.js +3 -2
- package/dist/configs/vitest/nestjs.js.map +1 -1
- package/dist/configs/vitest/phaser.d.ts.map +1 -1
- package/dist/configs/vitest/phaser.js +3 -2
- package/dist/configs/vitest/phaser.js.map +1 -1
- package/dist/configs/vitest/refusal-announcement.d.ts +51 -0
- package/dist/configs/vitest/refusal-announcement.d.ts.map +1 -0
- package/dist/configs/vitest/refusal-announcement.js +97 -0
- package/dist/configs/vitest/refusal-announcement.js.map +1 -0
- package/dist/configs/vitest/socket-safe-temp-base.d.ts +3 -4
- package/dist/configs/vitest/socket-safe-temp-base.d.ts.map +1 -1
- package/dist/configs/vitest/socket-safe-temp-base.js +7 -6
- package/dist/configs/vitest/socket-safe-temp-base.js.map +1 -1
- package/dist/configs/vitest/typescript.d.ts.map +1 -1
- package/dist/configs/vitest/typescript.js +3 -2
- package/dist/configs/vitest/typescript.js.map +1 -1
- package/dist/core/admission-decision.d.ts +110 -0
- package/dist/core/admission-decision.d.ts.map +1 -0
- package/dist/core/admission-decision.js +91 -0
- package/dist/core/admission-decision.js.map +1 -0
- package/dist/core/admission-lock.d.ts +69 -0
- package/dist/core/admission-lock.d.ts.map +1 -0
- package/dist/core/admission-lock.js +278 -0
- package/dist/core/admission-lock.js.map +1 -0
- package/dist/core/admission-settings.d.ts +69 -0
- package/dist/core/admission-settings.d.ts.map +1 -0
- package/dist/core/admission-settings.js +204 -0
- package/dist/core/admission-settings.js.map +1 -0
- package/dist/core/admission-state.d.ts +50 -0
- package/dist/core/admission-state.d.ts.map +1 -0
- package/dist/core/admission-state.js +168 -0
- package/dist/core/admission-state.js.map +1 -0
- package/dist/core/admission.d.ts +70 -0
- package/dist/core/admission.d.ts.map +1 -0
- package/dist/core/admission.js +205 -0
- package/dist/core/admission.js.map +1 -0
- package/dist/core/lisa-owned-hash-ledger.d.ts.map +1 -1
- package/dist/core/lisa-owned-hash-ledger.js +440 -0
- package/dist/core/lisa-owned-hash-ledger.js.map +1 -1
- package/dist/core/nightly-e2e-guard-behavior-certificate.js +2 -2
- package/dist/core/project-config-push-gate.d.ts +66 -0
- package/dist/core/project-config-push-gate.d.ts.map +1 -0
- package/dist/core/project-config-push-gate.js +82 -0
- package/dist/core/project-config-push-gate.js.map +1 -0
- package/dist/core/project-config.d.ts +4 -0
- package/dist/core/project-config.d.ts.map +1 -1
- package/dist/core/project-config.js +14 -9
- package/dist/core/project-config.js.map +1 -1
- package/dist/core/upstream-evidence-manifest.d.ts.map +1 -1
- package/dist/core/upstream-evidence-manifest.js +234 -146
- package/dist/core/upstream-evidence-manifest.js.map +1 -1
- package/expo/package-lisa/package.lisa.json +2 -2
- package/harper-fabric/package-lisa/package.lisa.json +4 -4
- package/nestjs/create-only/vitest.config.local.ts +1 -7
- package/nestjs/package-lisa/package.lisa.json +4 -4
- package/npm-package/package-lisa/package.lisa.json +4 -4
- package/package.json +12 -11
- package/phaser/package-lisa/package.lisa.json +4 -4
- package/plugins/lisa/.claude-plugin/plugin.json +1 -1
- package/plugins/lisa/.codex-plugin/plugin.json +1 -1
- package/plugins/lisa/.codex-plugin/skills/lisa-drive-pr-to-merge/SKILL.md +16 -3
- package/plugins/lisa/.codex-plugin/skills/lisa-git-submit-pr/SKILL.md +1 -1
- package/plugins/lisa/.codex-plugin/skills/lisa-implement/SKILL.md +1 -1
- package/plugins/lisa/skills/lisa-drive-pr-to-merge/SKILL.md +16 -3
- package/plugins/lisa/skills/lisa-git-submit-pr/SKILL.md +1 -1
- package/plugins/lisa/skills/lisa-implement/SKILL.md +1 -1
- package/plugins/lisa-agy/plugin.json +1 -1
- package/plugins/lisa-agy/skills/lisa-drive-pr-to-merge/SKILL.md +16 -3
- package/plugins/lisa-agy/skills/lisa-git-submit-pr/SKILL.md +1 -1
- package/plugins/lisa-agy/skills/lisa-implement/SKILL.md +1 -1
- package/plugins/lisa-cdk/.claude-plugin/plugin.json +1 -1
- package/plugins/lisa-cdk/.codex-plugin/plugin.json +1 -1
- package/plugins/lisa-cdk-agy/plugin.json +1 -1
- package/plugins/lisa-cdk-copilot/.claude-plugin/plugin.json +1 -1
- package/plugins/lisa-cdk-cursor/.claude-plugin/plugin.json +1 -1
- package/plugins/lisa-cdk-devin/.claude-plugin/plugin.json +1 -1
- package/plugins/lisa-cdk-devin/.devin-plugin/plugin.json +1 -1
- package/plugins/lisa-copilot/.claude-plugin/plugin.json +1 -1
- package/plugins/lisa-copilot/skills/lisa-drive-pr-to-merge/SKILL.md +16 -3
- package/plugins/lisa-copilot/skills/lisa-git-submit-pr/SKILL.md +1 -1
- package/plugins/lisa-copilot/skills/lisa-implement/SKILL.md +1 -1
- package/plugins/lisa-cursor/.claude-plugin/plugin.json +1 -1
- package/plugins/lisa-cursor/skills/lisa-drive-pr-to-merge/SKILL.md +16 -3
- package/plugins/lisa-cursor/skills/lisa-git-submit-pr/SKILL.md +1 -1
- package/plugins/lisa-cursor/skills/lisa-implement/SKILL.md +1 -1
- package/plugins/lisa-devin/.claude-plugin/plugin.json +1 -1
- package/plugins/lisa-devin/.devin-plugin/plugin.json +1 -1
- package/plugins/lisa-devin/skills/lisa-drive-pr-to-merge/SKILL.md +16 -3
- package/plugins/lisa-devin/skills/lisa-git-submit-pr/SKILL.md +1 -1
- package/plugins/lisa-devin/skills/lisa-implement/SKILL.md +1 -1
- package/plugins/lisa-expo/.claude-plugin/plugin.json +1 -1
- package/plugins/lisa-expo/.codex-plugin/plugin.json +1 -1
- package/plugins/lisa-expo-agy/plugin.json +1 -1
- package/plugins/lisa-expo-copilot/.claude-plugin/plugin.json +1 -1
- package/plugins/lisa-expo-cursor/.claude-plugin/plugin.json +1 -1
- package/plugins/lisa-expo-devin/.claude-plugin/plugin.json +1 -1
- package/plugins/lisa-expo-devin/.devin-plugin/plugin.json +1 -1
- package/plugins/lisa-harper-fabric/.claude-plugin/plugin.json +1 -1
- package/plugins/lisa-harper-fabric/.codex-plugin/plugin.json +1 -1
- package/plugins/lisa-harper-fabric-agy/plugin.json +1 -1
- package/plugins/lisa-harper-fabric-copilot/.claude-plugin/plugin.json +1 -1
- package/plugins/lisa-harper-fabric-cursor/.claude-plugin/plugin.json +1 -1
- package/plugins/lisa-harper-fabric-devin/.claude-plugin/plugin.json +1 -1
- package/plugins/lisa-harper-fabric-devin/.devin-plugin/plugin.json +1 -1
- package/plugins/lisa-nestjs/.claude-plugin/plugin.json +1 -1
- package/plugins/lisa-nestjs/.codex-plugin/plugin.json +1 -1
- package/plugins/lisa-nestjs-agy/plugin.json +1 -1
- package/plugins/lisa-nestjs-copilot/.claude-plugin/plugin.json +1 -1
- package/plugins/lisa-nestjs-cursor/.claude-plugin/plugin.json +1 -1
- package/plugins/lisa-nestjs-devin/.claude-plugin/plugin.json +1 -1
- package/plugins/lisa-nestjs-devin/.devin-plugin/plugin.json +1 -1
- package/plugins/lisa-phaser/.claude-plugin/plugin.json +1 -1
- package/plugins/lisa-phaser/.codex-plugin/plugin.json +1 -1
- package/plugins/lisa-phaser-agy/plugin.json +1 -1
- package/plugins/lisa-phaser-copilot/.claude-plugin/plugin.json +1 -1
- package/plugins/lisa-phaser-cursor/.claude-plugin/plugin.json +1 -1
- package/plugins/lisa-phaser-devin/.claude-plugin/plugin.json +1 -1
- package/plugins/lisa-phaser-devin/.devin-plugin/plugin.json +1 -1
- package/plugins/lisa-rails/.claude-plugin/plugin.json +1 -1
- package/plugins/lisa-rails/.codex-plugin/plugin.json +1 -1
- package/plugins/lisa-rails-agy/plugin.json +1 -1
- package/plugins/lisa-rails-copilot/.claude-plugin/plugin.json +1 -1
- package/plugins/lisa-rails-cursor/.claude-plugin/plugin.json +1 -1
- package/plugins/lisa-rails-devin/.claude-plugin/plugin.json +1 -1
- package/plugins/lisa-rails-devin/.devin-plugin/plugin.json +1 -1
- package/plugins/lisa-typescript/.claude-plugin/plugin.json +1 -1
- package/plugins/lisa-typescript/.codex-plugin/plugin.json +1 -1
- package/plugins/lisa-typescript-agy/plugin.json +1 -1
- package/plugins/lisa-typescript-copilot/.claude-plugin/plugin.json +1 -1
- package/plugins/lisa-typescript-cursor/.claude-plugin/plugin.json +1 -1
- package/plugins/lisa-typescript-devin/.claude-plugin/plugin.json +1 -1
- package/plugins/lisa-typescript-devin/.devin-plugin/plugin.json +1 -1
- package/plugins/lisa-wiki/.claude-plugin/plugin.json +1 -1
- package/plugins/lisa-wiki/.codex-plugin/plugin.json +1 -1
- package/plugins/lisa-wiki-agy/plugin.json +1 -1
- package/plugins/lisa-wiki-copilot/.claude-plugin/plugin.json +1 -1
- package/plugins/lisa-wiki-cursor/.claude-plugin/plugin.json +1 -1
- package/plugins/lisa-wiki-devin/.claude-plugin/plugin.json +1 -1
- package/plugins/lisa-wiki-devin/.devin-plugin/plugin.json +1 -1
- package/plugins/src/base/skills/lisa-drive-pr-to-merge/SKILL.md +16 -3
- package/plugins/src/base/skills/lisa-git-submit-pr/SKILL.md +1 -1
- package/plugins/src/base/skills/lisa-implement/SKILL.md +1 -1
- package/rails/copy-overwrite/Gemfile.lisa +8 -0
- package/rails/copy-overwrite/lefthook.yml +25 -11
- package/rails/copy-overwrite/scripts/lisa-rails-gates.mjs +686 -0
- package/rails/copy-overwrite/scripts/lisa-rspec-shards.mjs +2 -2
- package/rails/copy-overwrite/scripts/lisa_crystalball_recorder.rb +239 -0
- package/rails/copy-overwrite/scripts/lisa_rspec_partial_coverage.rb +83 -0
- package/scripts/build-unless-marked.mjs +83 -0
- package/scripts/check-plugins-sync.sh +22 -5
- package/scripts/classify-markdown-assertions.mjs +141 -0
- package/scripts/integration-shard-build.mjs +143 -0
- package/scripts/lib/history-scanner-suites.mjs +19 -0
- package/scripts/lib/markdown-assertions/classify.mjs +289 -0
- package/scripts/lib/markdown-assertions/context.mjs +53 -0
- package/scripts/lib/markdown-assertions/corpus.mjs +222 -0
- package/scripts/lib/markdown-assertions/manifest-cull.mjs +86 -0
- package/scripts/lib/markdown-assertions/record-setup.mjs +265 -0
- package/scripts/lib/markdown-assertions/record.mjs +115 -0
- package/scripts/lib/markdown-assertions/record.vitest.config.mjs +24 -0
- package/scripts/lib/markdown-assertions/sites.mjs +273 -0
- package/scripts/lib/markdown-assertions/test-cull.mjs +768 -0
- package/scripts/lib/markdown-assertions/tokens.mjs +158 -0
- package/scripts/lib/shell-guard-trace.mjs +6 -0
- package/scripts/lib/test-access-map-setup.mjs +40 -0
- package/scripts/lib/test-access-map-tracer.mjs +205 -0
- package/scripts/lib/test-access-map.d.mts +72 -0
- package/scripts/lib/test-access-map.mjs +395 -0
- package/scripts/lib/test-timings-reporter.d.mts +17 -0
- package/scripts/lib/test-timings-reporter.mjs +99 -0
- package/scripts/plan-integration-shards.mjs +300 -0
- package/scripts/test-timing-report.d.mts +41 -0
- package/scripts/test-timing-report.mjs +361 -0
- package/scripts/two-channel-couplings.json +132 -36
- package/scripts/verify-npm-advisories-4333.mjs +3 -12
- package/typescript/copy-overwrite/.prettierignore +13 -0
- package/typescript/create-only/vitest.config.local.ts +1 -7
- package/typescript/package-lisa/package.lisa.json +4 -4
- package/all/copy-overwrite/scripts/lisa-scratch-run.sh +0 -1078
- package/dist/cli/lisa-test-run-bootstrap.d.ts +0 -3
- package/dist/cli/lisa-test-run-bootstrap.d.ts.map +0 -1
- package/dist/cli/lisa-test-run-bootstrap.js +0 -229
- package/dist/cli/lisa-test-run-bootstrap.js.map +0 -1
- package/dist/cli/lisa-test-run-ipc.d.ts +0 -49
- package/dist/cli/lisa-test-run-ipc.d.ts.map +0 -1
- package/dist/cli/lisa-test-run-ipc.js +0 -226
- package/dist/cli/lisa-test-run-ipc.js.map +0 -1
- package/dist/cli/lisa-test-run-process-group.d.ts +0 -30
- package/dist/cli/lisa-test-run-process-group.d.ts.map +0 -1
- package/dist/cli/lisa-test-run-process-group.js +0 -140
- package/dist/cli/lisa-test-run-process-group.js.map +0 -1
- package/dist/cli/lisa-test-run-reaper.d.ts +0 -3
- package/dist/cli/lisa-test-run-reaper.d.ts.map +0 -1
- package/dist/cli/lisa-test-run-reaper.js +0 -195
- package/dist/cli/lisa-test-run-reaper.js.map +0 -1
- package/dist/cli/lisa-test-run-runtime.d.ts +0 -46
- package/dist/cli/lisa-test-run-runtime.d.ts.map +0 -1
- package/dist/cli/lisa-test-run-runtime.js +0 -123
- package/dist/cli/lisa-test-run-runtime.js.map +0 -1
- package/dist/cli/lisa-test-run-supervisor.d.ts +0 -13
- package/dist/cli/lisa-test-run-supervisor.d.ts.map +0 -1
- package/dist/cli/lisa-test-run-supervisor.js +0 -265
- package/dist/cli/lisa-test-run-supervisor.js.map +0 -1
- package/dist/configs/vitest/fleet-admission-global-setup.d.ts +0 -34
- package/dist/configs/vitest/fleet-admission-global-setup.d.ts.map +0 -1
- package/dist/configs/vitest/fleet-admission-global-setup.js +0 -123
- package/dist/configs/vitest/fleet-admission-global-setup.js.map +0 -1
- package/dist/configs/vitest/fleet-admission.d.ts +0 -129
- package/dist/configs/vitest/fleet-admission.d.ts.map +0 -1
- package/dist/configs/vitest/fleet-admission.js +0 -239
- package/dist/configs/vitest/fleet-admission.js.map +0 -1
- package/dist/configs/vitest/scratch-authority.d.ts +0 -25
- package/dist/configs/vitest/scratch-authority.d.ts.map +0 -1
- package/dist/configs/vitest/scratch-authority.js +0 -107
- package/dist/configs/vitest/scratch-authority.js.map +0 -1
- package/dist/configs/vitest/scratch-bound-cleanup-programs.d.ts +0 -5
- package/dist/configs/vitest/scratch-bound-cleanup-programs.d.ts.map +0 -1
- package/dist/configs/vitest/scratch-bound-cleanup-programs.js +0 -219
- package/dist/configs/vitest/scratch-bound-cleanup-programs.js.map +0 -1
- package/dist/configs/vitest/scratch-bound-cleanup.d.ts +0 -28
- package/dist/configs/vitest/scratch-bound-cleanup.d.ts.map +0 -1
- package/dist/configs/vitest/scratch-bound-cleanup.js +0 -155
- package/dist/configs/vitest/scratch-bound-cleanup.js.map +0 -1
- package/dist/configs/vitest/scratch-bound-root-cleanup.d.ts +0 -17
- package/dist/configs/vitest/scratch-bound-root-cleanup.d.ts.map +0 -1
- package/dist/configs/vitest/scratch-bound-root-cleanup.js +0 -149
- package/dist/configs/vitest/scratch-bound-root-cleanup.js.map +0 -1
- package/dist/configs/vitest/scratch-global-setup.d.ts +0 -258
- package/dist/configs/vitest/scratch-global-setup.d.ts.map +0 -1
- package/dist/configs/vitest/scratch-global-setup.js +0 -505
- package/dist/configs/vitest/scratch-global-setup.js.map +0 -1
- package/dist/configs/vitest/scratch-leak-setup.d.ts +0 -2
- package/dist/configs/vitest/scratch-leak-setup.d.ts.map +0 -1
- package/dist/configs/vitest/scratch-leak-setup.js +0 -108
- package/dist/configs/vitest/scratch-leak-setup.js.map +0 -1
- package/dist/configs/vitest/scratch-namespace-authority.d.ts +0 -80
- package/dist/configs/vitest/scratch-namespace-authority.d.ts.map +0 -1
- package/dist/configs/vitest/scratch-namespace-authority.js +0 -291
- package/dist/configs/vitest/scratch-namespace-authority.js.map +0 -1
- package/dist/configs/vitest/scratch-owner.d.ts +0 -131
- package/dist/configs/vitest/scratch-owner.d.ts.map +0 -1
- package/dist/configs/vitest/scratch-owner.js +0 -297
- package/dist/configs/vitest/scratch-owner.js.map +0 -1
- package/dist/configs/vitest/scratch-route-profile.d.ts +0 -46
- package/dist/configs/vitest/scratch-route-profile.d.ts.map +0 -1
- package/dist/configs/vitest/scratch-route-profile.js +0 -233
- package/dist/configs/vitest/scratch-route-profile.js.map +0 -1
- package/dist/configs/vitest/scratch-run-root-compatibility.d.ts +0 -33
- package/dist/configs/vitest/scratch-run-root-compatibility.d.ts.map +0 -1
- package/dist/configs/vitest/scratch-run-root-compatibility.js +0 -137
- package/dist/configs/vitest/scratch-run-root-compatibility.js.map +0 -1
- package/dist/configs/vitest/scratch-run-root-intent.d.ts +0 -66
- package/dist/configs/vitest/scratch-run-root-intent.d.ts.map +0 -1
- package/dist/configs/vitest/scratch-run-root-intent.js +0 -183
- package/dist/configs/vitest/scratch-run-root-intent.js.map +0 -1
- package/dist/configs/vitest/scratch-setup.d.ts +0 -46
- package/dist/configs/vitest/scratch-setup.d.ts.map +0 -1
- package/dist/configs/vitest/scratch-setup.js +0 -226
- package/dist/configs/vitest/scratch-setup.js.map +0 -1
- package/dist/configs/vitest/scratch-supervision-intent.d.ts +0 -8
- package/dist/configs/vitest/scratch-supervision-intent.d.ts.map +0 -1
- package/dist/configs/vitest/scratch-supervision-intent.js +0 -125
- package/dist/configs/vitest/scratch-supervision-intent.js.map +0 -1
- package/dist/configs/vitest/scratch-supervision-protocol.d.ts +0 -12
- package/dist/configs/vitest/scratch-supervision-protocol.d.ts.map +0 -1
- package/dist/configs/vitest/scratch-supervision-protocol.js +0 -230
- package/dist/configs/vitest/scratch-supervision-protocol.js.map +0 -1
- package/dist/configs/vitest/scratch-supervision.d.ts +0 -69
- package/dist/configs/vitest/scratch-supervision.d.ts.map +0 -1
- package/dist/configs/vitest/scratch-supervision.js +0 -244
- package/dist/configs/vitest/scratch-supervision.js.map +0 -1
- package/dist/configs/vitest/scratch-sweep.d.ts +0 -66
- package/dist/configs/vitest/scratch-sweep.d.ts.map +0 -1
- package/dist/configs/vitest/scratch-sweep.js +0 -82
- package/dist/configs/vitest/scratch-sweep.js.map +0 -1
- package/dist/configs/vitest/scratch-tmpdir-trust.d.ts +0 -48
- package/dist/configs/vitest/scratch-tmpdir-trust.d.ts.map +0 -1
- package/dist/configs/vitest/scratch-tmpdir-trust.js +0 -194
- package/dist/configs/vitest/scratch-tmpdir-trust.js.map +0 -1
- package/dist/configs/vitest/scratch.d.ts +0 -19
- package/dist/configs/vitest/scratch.d.ts.map +0 -1
- package/dist/configs/vitest/scratch.js +0 -34
- package/dist/configs/vitest/scratch.js.map +0 -1
- package/dist/configs/vitest/synthesis-scratch-reclaim.d.ts +0 -86
- package/dist/configs/vitest/synthesis-scratch-reclaim.d.ts.map +0 -1
- package/dist/configs/vitest/synthesis-scratch-reclaim.js +0 -226
- package/dist/configs/vitest/synthesis-scratch-reclaim.js.map +0 -1
|
@@ -1,155 +0,0 @@
|
|
|
1
|
-
/** Kernel-bound deletion programs for scratch roots and their direct children. */
|
|
2
|
-
import { spawnSync } from "node:child_process";
|
|
3
|
-
import * as fs from "node:fs";
|
|
4
|
-
import * as path from "node:path";
|
|
5
|
-
import { scratchPathIdentity, } from "./scratch-owner.js";
|
|
6
|
-
import { BOUND_CHILDREN_CLEANUP_PROGRAM } from "./scratch-bound-cleanup-programs.js";
|
|
7
|
-
export { BOUND_DIRECTORY_CLEANUP_PROGRAM } from "./scratch-bound-cleanup-programs.js";
|
|
8
|
-
/** Exit status used when the child cwd does not match the expected inode. */
|
|
9
|
-
const BOUND_CLEANUP_IDENTITY_EXIT = 73;
|
|
10
|
-
/**
|
|
11
|
-
* Demand one inert direct basename, never a path.
|
|
12
|
-
* @param basename - Candidate direct-child name
|
|
13
|
-
*/
|
|
14
|
-
function validateBasename(basename) {
|
|
15
|
-
if (basename === "" ||
|
|
16
|
-
basename === "." ||
|
|
17
|
-
basename === ".." ||
|
|
18
|
-
path.basename(basename) !== basename ||
|
|
19
|
-
basename.includes("/") ||
|
|
20
|
-
basename.includes("\\")) {
|
|
21
|
-
throw new Error(`Scratch candidate must be a direct basename: ${basename}`);
|
|
22
|
-
}
|
|
23
|
-
if (Buffer.byteLength(basename, "utf8") > 1_024) {
|
|
24
|
-
throw new Error("Scratch candidate basename exceeds 1024 bytes");
|
|
25
|
-
}
|
|
26
|
-
}
|
|
27
|
-
/**
|
|
28
|
-
* Read one candidate without converting absence into an exception.
|
|
29
|
-
* @param candidate - Candidate path
|
|
30
|
-
* @returns Candidate metadata, or undefined when already absent
|
|
31
|
-
*/
|
|
32
|
-
function lstatIfPresent(candidate) {
|
|
33
|
-
try {
|
|
34
|
-
return fs.lstatSync(candidate);
|
|
35
|
-
}
|
|
36
|
-
catch (error) {
|
|
37
|
-
if (error.code === "ENOENT")
|
|
38
|
-
return undefined;
|
|
39
|
-
throw error;
|
|
40
|
-
}
|
|
41
|
-
}
|
|
42
|
-
/**
|
|
43
|
-
* Assert that an already-owned parent still has its pinned identity.
|
|
44
|
-
* @param expected - Pinned parent identity
|
|
45
|
-
*/
|
|
46
|
-
function assertScratchPathIdentity(expected) {
|
|
47
|
-
const current = scratchPathIdentity(expected.canonicalPath);
|
|
48
|
-
if (current.canonicalPath !== expected.canonicalPath ||
|
|
49
|
-
current.dev !== expected.dev ||
|
|
50
|
-
current.ino !== expected.ino) {
|
|
51
|
-
throw new Error("Scratch parent identity changed before child cleanup");
|
|
52
|
-
}
|
|
53
|
-
}
|
|
54
|
-
/**
|
|
55
|
-
* Inspect a direct child after its pinned parent passes revalidation.
|
|
56
|
-
* @param parent - Pinned parent identity
|
|
57
|
-
* @param basename - Direct-child name
|
|
58
|
-
* @param child - Candidate path
|
|
59
|
-
* @returns Candidate metadata, or undefined when already absent
|
|
60
|
-
*/
|
|
61
|
-
function inspectAuthorizedScratchChild(parent, basename, child) {
|
|
62
|
-
validateBasename(basename);
|
|
63
|
-
assertScratchPathIdentity(parent);
|
|
64
|
-
return lstatIfPresent(child);
|
|
65
|
-
}
|
|
66
|
-
/**
|
|
67
|
-
* Capture every present candidate while the parent remains pinned.
|
|
68
|
-
* @param options - Batched child-removal options
|
|
69
|
-
* @returns Bound cleanup descriptions for present children
|
|
70
|
-
*/
|
|
71
|
-
function collectAuthorizedChildren(options) {
|
|
72
|
-
assertScratchPathIdentity(options.parent);
|
|
73
|
-
return options.basenames.flatMap(basename => {
|
|
74
|
-
const child = path.join(options.parent.canonicalPath, basename);
|
|
75
|
-
options.beforeIdentityCheck?.(child);
|
|
76
|
-
const stat = inspectAuthorizedScratchChild(options.parent, basename, child);
|
|
77
|
-
if (stat === undefined)
|
|
78
|
-
return [];
|
|
79
|
-
options.afterIdentityCheck?.(child);
|
|
80
|
-
return [
|
|
81
|
-
{
|
|
82
|
-
basename,
|
|
83
|
-
dev: String(stat.dev),
|
|
84
|
-
ino: String(stat.ino),
|
|
85
|
-
directory: stat.isDirectory(),
|
|
86
|
-
symlink: stat.isSymbolicLink(),
|
|
87
|
-
},
|
|
88
|
-
];
|
|
89
|
-
});
|
|
90
|
-
}
|
|
91
|
-
/**
|
|
92
|
-
* Execute the inode-bound child-cleanup worker.
|
|
93
|
-
* @param options - Batched child-removal options
|
|
94
|
-
* @param input - Validated serialized child descriptions
|
|
95
|
-
* @returns Worker result
|
|
96
|
-
*/
|
|
97
|
-
function executeBoundChildrenCleanup(options, input) {
|
|
98
|
-
options.beforeBoundCleanup?.();
|
|
99
|
-
return spawnSync(process.execPath, [
|
|
100
|
-
"--input-type=commonjs",
|
|
101
|
-
"--eval",
|
|
102
|
-
BOUND_CHILDREN_CLEANUP_PROGRAM,
|
|
103
|
-
String(options.parent.dev),
|
|
104
|
-
String(options.parent.ino),
|
|
105
|
-
], {
|
|
106
|
-
cwd: options.parent.canonicalPath,
|
|
107
|
-
encoding: "utf8",
|
|
108
|
-
input,
|
|
109
|
-
maxBuffer: 64 * 1024,
|
|
110
|
-
});
|
|
111
|
-
}
|
|
112
|
-
/**
|
|
113
|
-
* Remove direct children through one process bound to the parent inode.
|
|
114
|
-
* @param options - Batched child-removal options
|
|
115
|
-
*/
|
|
116
|
-
export function removeAuthorizedScratchChildren(options) {
|
|
117
|
-
if (new Set(options.basenames).size !== options.basenames.length) {
|
|
118
|
-
throw new Error("Scratch child cleanup refuses duplicate basenames");
|
|
119
|
-
}
|
|
120
|
-
const items = collectAuthorizedChildren(options);
|
|
121
|
-
if (items.length === 0)
|
|
122
|
-
return;
|
|
123
|
-
const input = JSON.stringify(items);
|
|
124
|
-
if (Buffer.byteLength(input, "utf8") > 32 * 1024 * 1024) {
|
|
125
|
-
throw new Error("Scratch child cleanup batch exceeds 33554432 bytes");
|
|
126
|
-
}
|
|
127
|
-
const result = executeBoundChildrenCleanup(options, input);
|
|
128
|
-
if (result.error !== undefined)
|
|
129
|
-
throw result.error;
|
|
130
|
-
if (result.status === BOUND_CLEANUP_IDENTITY_EXIT) {
|
|
131
|
-
throw new Error(result.stderr.trim() ||
|
|
132
|
-
"Scratch child identity changed before bound cleanup");
|
|
133
|
-
}
|
|
134
|
-
if (result.status !== 0 || result.signal !== null) {
|
|
135
|
-
throw new Error(`Scratch bound cleanup failed: ${result.stderr.trim() || result.signal || String(result.status)}`);
|
|
136
|
-
}
|
|
137
|
-
assertScratchPathIdentity(options.parent);
|
|
138
|
-
}
|
|
139
|
-
/**
|
|
140
|
-
* Remove one direct child through the batched authority.
|
|
141
|
-
* @param options - Single child-removal options
|
|
142
|
-
*/
|
|
143
|
-
export function removeAuthorizedScratchChild(options) {
|
|
144
|
-
removeAuthorizedScratchChildren({
|
|
145
|
-
parent: options.parent,
|
|
146
|
-
basenames: [options.basename],
|
|
147
|
-
...(options.beforeIdentityCheck === undefined
|
|
148
|
-
? {}
|
|
149
|
-
: { beforeIdentityCheck: options.beforeIdentityCheck }),
|
|
150
|
-
...(options.afterIdentityCheck === undefined
|
|
151
|
-
? {}
|
|
152
|
-
: { afterIdentityCheck: options.afterIdentityCheck }),
|
|
153
|
-
});
|
|
154
|
-
}
|
|
155
|
-
//# sourceMappingURL=scratch-bound-cleanup.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"scratch-bound-cleanup.js","s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,KAAK,CAAC,CAAC;IAC3D,IAAI,MAAM,CAAC,KAAK,KAAK,SAAS;QAAE,MAAM,MAAM,CAAC,KAAK,CAAC;IACnD,IAAI,MAAM,CAAC,MAAM,KAAK,2BAA2B,EAAE,CAAC;QAClD,MAAM,IAAI,KAAK,CACb,MAAM,CAAC,MAAM,CAAC,IAAI,EAAE;YAClB,qDAAqD,CACxD,CAAC;IACJ,CAAC;IACD,IAAI,MAAM,CAAC,MAAM,KAAK,CAAC,IAAI,MAAM,CAAC,MAAM,KAAK,IAAI,EAAE,CAAC;QAClD,MAAM,IAAI,KAAK,CACb,iCAAiC,MAAM,CAAC,MAAM,CAAC,IAAI,EAAE,IAAI,MAAM,CAAC,MAAM,IAAI,MAAM,CAAC,MAAM,CAAC,MAAM,CAAC,EAAE,CAClG,CAAC;IACJ,CAAC;IACD,yBAAyB,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC;AAC5C,CAAC;AAED;;;GAGG;AACH,MAAM,UAAU,4BAA4B,CAC1C,OAA4C;IAE5C,+BAA+B,CAAC;QAC9B,MAAM,EAAE,OAAO,CAAC,MAAM;QACtB,SAAS,EAAE,CAAC,OAAO,CAAC,QAAQ,CAAC;QAC7B,GAAG,CAAC,OAAO,CAAC,mBAAmB,KAAK,SAAS;YAC3C,CAAC,CAAC,EAAE;YACJ,CAAC,CAAC,EAAE,mBAAmB,EAAE,OAAO,CAAC,mBAAmB,EAAE,CAAC;QACzD,GAAG,CAAC,OAAO,CAAC,kBAAkB,KAAK,SAAS;YAC1C,CAAC,CAAC,EAAE;YACJ,CAAC,CAAC,EAAE,kBAAkB,EAAE,OAAO,CAAC,kBAAkB,EAAE,CAAC;KACxD,CAAC,CAAC;AACL,CAAC"}
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
import { type ScratchNamespaceAuthority } from "./scratch-namespace-authority.js";
|
|
2
|
-
import { type ScratchPathIdentity } from "./scratch-owner.js";
|
|
3
|
-
/** Options for an authorised root removal. */
|
|
4
|
-
export interface RemoveAuthorizedScratchRootOptions {
|
|
5
|
-
readonly authority: ScratchNamespaceAuthority;
|
|
6
|
-
readonly basename: string;
|
|
7
|
-
readonly expectedToken?: string;
|
|
8
|
-
readonly expectedIdentity?: ScratchPathIdentity;
|
|
9
|
-
readonly afterIdentityCheck?: (candidate: string) => void;
|
|
10
|
-
}
|
|
11
|
-
/**
|
|
12
|
-
* Quarantine and delete one direct owned root.
|
|
13
|
-
* @param options - Authorized root-removal options
|
|
14
|
-
* @returns Whether an existing root was removed
|
|
15
|
-
*/
|
|
16
|
-
export declare function removeAuthorizedScratchRoot(options: RemoveAuthorizedScratchRootOptions): boolean;
|
|
17
|
-
//# sourceMappingURL=scratch-bound-root-cleanup.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"scratch-bound-root-cleanup.d.ts","sourceRoot":"","sources":["../../../src/configs/vitest/scratch-bound-root-cleanup.ts"],"names":[],"mappings":"AAMA,OAAO,EAGL,KAAK,yBAAyB,EAC/B,MAAM,kCAAkC,CAAC;AAE1C,OAAO,EAEL,KAAK,mBAAmB,EACzB,MAAM,oBAAoB,CAAC;AAE5B,8CAA8C;AAC9C,MAAM,WAAW,kCAAkC;IACjD,QAAQ,CAAC,SAAS,EAAE,yBAAyB,CAAC;IAC9C,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAC;IAC1B,QAAQ,CAAC,aAAa,CAAC,EAAE,MAAM,CAAC;IAChC,QAAQ,CAAC,gBAAgB,CAAC,EAAE,mBAAmB,CAAC;IAChD,QAAQ,CAAC,kBAAkB,CAAC,EAAE,CAAC,SAAS,EAAE,MAAM,KAAK,IAAI,CAAC;CAC3D;AAsJD;;;;GAIG;AACH,wBAAgB,2BAA2B,CACzC,OAAO,EAAE,kCAAkC,GAC1C,OAAO,CA8BT"}
|
|
@@ -1,149 +0,0 @@
|
|
|
1
|
-
/** Kernel-bound removal of one token-authorized scratch run root. */
|
|
2
|
-
import { randomBytes } from "node:crypto";
|
|
3
|
-
import { spawnSync } from "node:child_process";
|
|
4
|
-
import * as fs from "node:fs";
|
|
5
|
-
import * as path from "node:path";
|
|
6
|
-
import { SCRATCH_QUARANTINE_PREFIX, assertScratchNamespaceAuthority, } from "./scratch-namespace-authority.js";
|
|
7
|
-
import { BOUND_DIRECTORY_CLEANUP_PROGRAM } from "./scratch-bound-cleanup-programs.js";
|
|
8
|
-
import { readScratchOwnerRecord, } from "./scratch-owner.js";
|
|
9
|
-
/** Exit status used when a child cwd does not match its expected inode. */
|
|
10
|
-
const BOUND_CLEANUP_IDENTITY_EXIT = 73;
|
|
11
|
-
/**
|
|
12
|
-
* Demand one inert direct basename, never a path.
|
|
13
|
-
* @param basename - Candidate direct-child name
|
|
14
|
-
*/
|
|
15
|
-
function validateBasename(basename) {
|
|
16
|
-
if (basename === "" ||
|
|
17
|
-
basename === "." ||
|
|
18
|
-
basename === ".." ||
|
|
19
|
-
path.basename(basename) !== basename ||
|
|
20
|
-
basename.includes("/") ||
|
|
21
|
-
basename.includes("\\")) {
|
|
22
|
-
throw new Error(`Scratch candidate must be a direct basename: ${basename}`);
|
|
23
|
-
}
|
|
24
|
-
}
|
|
25
|
-
/**
|
|
26
|
-
* Read one candidate without converting absence into an exception.
|
|
27
|
-
* @param candidate - Candidate path
|
|
28
|
-
* @returns Candidate metadata, or undefined when already absent
|
|
29
|
-
*/
|
|
30
|
-
function lstatIfPresent(candidate) {
|
|
31
|
-
try {
|
|
32
|
-
return fs.lstatSync(candidate);
|
|
33
|
-
}
|
|
34
|
-
catch (error) {
|
|
35
|
-
if (error.code === "ENOENT")
|
|
36
|
-
return undefined;
|
|
37
|
-
throw error;
|
|
38
|
-
}
|
|
39
|
-
}
|
|
40
|
-
/**
|
|
41
|
-
* Clear a directory through a cwd bound to the inspected inode.
|
|
42
|
-
* @param candidate - Directory path
|
|
43
|
-
* @param expected - Pinned directory identity
|
|
44
|
-
*/
|
|
45
|
-
function clearDirectoryThroughBoundCwd(candidate, expected) {
|
|
46
|
-
const result = spawnSync(process.execPath, [
|
|
47
|
-
"--input-type=commonjs",
|
|
48
|
-
"--eval",
|
|
49
|
-
BOUND_DIRECTORY_CLEANUP_PROGRAM,
|
|
50
|
-
String(expected.dev),
|
|
51
|
-
String(expected.ino),
|
|
52
|
-
], { cwd: candidate, encoding: "utf8", maxBuffer: 64 * 1024 });
|
|
53
|
-
if (result.error !== undefined)
|
|
54
|
-
throw result.error;
|
|
55
|
-
if (result.status === BOUND_CLEANUP_IDENTITY_EXIT) {
|
|
56
|
-
throw new Error("Scratch directory identity changed before bound cleanup");
|
|
57
|
-
}
|
|
58
|
-
if (result.status !== 0 || result.signal !== null) {
|
|
59
|
-
throw new Error(`Scratch bound cleanup failed: ${result.stderr.trim() || result.signal || String(result.status)}`);
|
|
60
|
-
}
|
|
61
|
-
}
|
|
62
|
-
/**
|
|
63
|
-
* Bind an optional armed inode identity to the inspected candidate.
|
|
64
|
-
* @param options - Authorized root-removal options
|
|
65
|
-
* @param stat - Candidate metadata when present
|
|
66
|
-
* @returns Validated metadata, or undefined when already absent
|
|
67
|
-
*/
|
|
68
|
-
function validateExpectedRootIdentity(options, stat) {
|
|
69
|
-
if (stat !== undefined &&
|
|
70
|
-
options.expectedIdentity !== undefined &&
|
|
71
|
-
(stat.dev !== options.expectedIdentity.dev ||
|
|
72
|
-
stat.ino !== options.expectedIdentity.ino)) {
|
|
73
|
-
throw new Error("Scratch root identity does not match armed intent");
|
|
74
|
-
}
|
|
75
|
-
return stat;
|
|
76
|
-
}
|
|
77
|
-
/**
|
|
78
|
-
* Validate authority before reading a destructive candidate.
|
|
79
|
-
* @param options - Authorized root-removal options
|
|
80
|
-
* @param candidate - Candidate path
|
|
81
|
-
* @returns Candidate metadata, or undefined when already absent
|
|
82
|
-
*/
|
|
83
|
-
function inspectAuthorizedCandidate(options, candidate) {
|
|
84
|
-
validateBasename(options.basename);
|
|
85
|
-
assertScratchNamespaceAuthority(options.authority);
|
|
86
|
-
return validateExpectedRootIdentity(options, lstatIfPresent(candidate));
|
|
87
|
-
}
|
|
88
|
-
/**
|
|
89
|
-
* Revalidate an expected marker token at a specific path.
|
|
90
|
-
* @param candidate - Candidate path
|
|
91
|
-
* @param expectedToken - Token authorized by the caller
|
|
92
|
-
* @param phase - Whether validation occurs before or after quarantine
|
|
93
|
-
*/
|
|
94
|
-
function assertOwnerToken(candidate, expectedToken, phase) {
|
|
95
|
-
if (expectedToken === undefined)
|
|
96
|
-
return;
|
|
97
|
-
const owner = readScratchOwnerRecord(candidate);
|
|
98
|
-
if (owner.token !== expectedToken) {
|
|
99
|
-
throw new Error(`Scratch owner token changed ${phase} quarantine`);
|
|
100
|
-
}
|
|
101
|
-
}
|
|
102
|
-
/**
|
|
103
|
-
* Revalidate and unlink the renamed candidate.
|
|
104
|
-
* @param quarantine - Quarantined path
|
|
105
|
-
* @param before - Pinned pre-rename metadata
|
|
106
|
-
* @param expectedToken - Token authorized by the caller
|
|
107
|
-
* @param afterIdentityCheck - Optional adversarial test hook
|
|
108
|
-
* @returns True after successful removal
|
|
109
|
-
*/
|
|
110
|
-
function removeVerifiedQuarantine(quarantine, before, expectedToken, afterIdentityCheck) {
|
|
111
|
-
const after = fs.lstatSync(quarantine);
|
|
112
|
-
if (after.isSymbolicLink() ||
|
|
113
|
-
after.dev !== before.dev ||
|
|
114
|
-
after.ino !== before.ino) {
|
|
115
|
-
throw new Error("Scratch root identity changed during quarantine");
|
|
116
|
-
}
|
|
117
|
-
afterIdentityCheck?.(quarantine);
|
|
118
|
-
assertOwnerToken(quarantine, expectedToken, "after");
|
|
119
|
-
clearDirectoryThroughBoundCwd(quarantine, after);
|
|
120
|
-
fs.rmdirSync(quarantine);
|
|
121
|
-
return true;
|
|
122
|
-
}
|
|
123
|
-
/**
|
|
124
|
-
* Quarantine and delete one direct owned root.
|
|
125
|
-
* @param options - Authorized root-removal options
|
|
126
|
-
* @returns Whether an existing root was removed
|
|
127
|
-
*/
|
|
128
|
-
export function removeAuthorizedScratchRoot(options) {
|
|
129
|
-
const candidate = path.join(options.authority.namespace.canonicalPath, options.basename);
|
|
130
|
-
const quarantineName = `${SCRATCH_QUARANTINE_PREFIX}${randomBytes(16).toString("hex")}`;
|
|
131
|
-
const quarantine = path.join(options.authority.namespace.canonicalPath, quarantineName);
|
|
132
|
-
const before = inspectAuthorizedCandidate(options, candidate);
|
|
133
|
-
if (before === undefined)
|
|
134
|
-
return false;
|
|
135
|
-
if (before.isSymbolicLink() || !before.isDirectory()) {
|
|
136
|
-
throw new Error(`Scratch root authority refuses non-directory or symlink: ${candidate}`);
|
|
137
|
-
}
|
|
138
|
-
assertOwnerToken(candidate, options.expectedToken, "before");
|
|
139
|
-
try {
|
|
140
|
-
fs.renameSync(candidate, quarantine);
|
|
141
|
-
}
|
|
142
|
-
catch (error) {
|
|
143
|
-
if (error.code === "ENOENT")
|
|
144
|
-
return false;
|
|
145
|
-
throw error;
|
|
146
|
-
}
|
|
147
|
-
return removeVerifiedQuarantine(quarantine, before, options.expectedToken, options.afterIdentityCheck);
|
|
148
|
-
}
|
|
149
|
-
//# sourceMappingURL=scratch-bound-root-cleanup.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"scratch-bound-root-cleanup.js","sourceRoot":"","sources":["../../../src/configs/vitest/scratch-bound-root-cleanup.ts"],"names":[],"mappings":"AAAA,qEAAqE;AACrE,OAAO,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAC1C,OAAO,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAC;AAC/C,OAAO,KAAK,EAAE,MAAM,SAAS,CAAC;AAC9B,OAAO,KAAK,IAAI,MAAM,WAAW,CAAC;AAElC,OAAO,EACL,yBAAyB,EACzB,+BAA+B,GAEhC,MAAM,kCAAkC,CAAC;AAC1C,OAAO,EAAE,+BAA+B,EAAE,MAAM,qCAAqC,CAAC;AACtF,OAAO,EACL,sBAAsB,GAEvB,MAAM,oBAAoB,CAAC;AAW5B,2EAA2E;AAC3E,MAAM,2BA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,SAAS,EAAE,CACxE,CAAC;IACJ,CAAC;IACD,gBAAgB,CAAC,SAAS,EAAE,OAAO,CAAC,aAAa,EAAE,QAAQ,CAAC,CAAC;IAC7D,IAAI,CAAC;QACH,EAAE,CAAC,UAAU,CAAC,SAAS,EAAE,UAAU,CAAC,CAAC;IACvC,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,IAAK,KAA+B,CAAC,IAAI,KAAK,QAAQ;YAAE,OAAO,KAAK,CAAC;QACrE,MAAM,KAAK,CAAC;IACd,CAAC;IACD,OAAO,wBAAwB,CAC7B,UAAU,EACV,MAAM,EACN,OAAO,CAAC,aAAa,EACrB,OAAO,CAAC,kBAAkB,CAC3B,CAAC;AACJ,CAAC"}
|
|
@@ -1,258 +0,0 @@
|
|
|
1
|
-
import { processBirthFingerprintSnapshot } from "./scratch-owner.js";
|
|
2
|
-
/**
|
|
3
|
-
* Upper bound on entries the namespace may hold that **nobody owns**.
|
|
4
|
-
*
|
|
5
|
-
* A run allocates one root per process — the main process plus one per worker —
|
|
6
|
-
* and several runs share a workstation, so a healthy namespace legitimately
|
|
7
|
-
* holds entries while work is in flight. This ceiling is not a tuning knob for
|
|
8
|
-
* that; it is the point past which the namespace is provably becoming the very
|
|
9
|
-
* thing it replaced.
|
|
10
|
-
*
|
|
11
|
-
* ## Why it counts unowned entries rather than all of them
|
|
12
|
-
*
|
|
13
|
-
* It compared against the total, and a total is a sum over every concurrent run
|
|
14
|
-
* on the box. Measured (CodySwannGT/lisa#3032), six snapshots of the shared
|
|
15
|
-
* namespace between 519 and 3,730 entries: in five of them EVERY root had a
|
|
16
|
-
* live owner that started before it. 24.3% of sampled instants sat above this
|
|
17
|
-
* ceiling, in stretches up to 127 seconds, and a run starting inside one was
|
|
18
|
-
* refused for its siblings' work under a message reading "accumulating rather
|
|
19
|
-
* than being reclaimed" — about a namespace in which nothing was accumulating.
|
|
20
|
-
* Ten full-suite runs at one commit produced 2 PASS and 8 REFUSED that way.
|
|
21
|
-
*
|
|
22
|
-
* Live-owned entries cannot accumulate: they are released when their owner
|
|
23
|
-
* exits, measured as 3,729 becoming reclaimable within 22 seconds when a run's
|
|
24
|
-
* workers ended together. Orphaned and unrecognised entries are the only ones
|
|
25
|
-
* that persist without bound, and they are exactly what the corrected
|
|
26
|
-
* arithmetic still counts — so no leak detection is lost.
|
|
27
|
-
*
|
|
28
|
-
* The number itself is unchanged and is deliberately not re-tuned here. It is a
|
|
29
|
-
* leak detector, not a performance backstop: the directory cost this campaign
|
|
30
|
-
* began with was measured at hundreds of thousands of entries, three orders of
|
|
31
|
-
* magnitude above this line, so a second absolute cap would need calibrating
|
|
32
|
-
* against measured harm and belongs in its own ticket.
|
|
33
|
-
*/
|
|
34
|
-
export declare const MAX_NAMESPACE_ENTRIES = 512;
|
|
35
|
-
/**
|
|
36
|
-
* Why one entry could not be bound to an owner.
|
|
37
|
-
*
|
|
38
|
-
* `unrecognised` used to be a single word covering four different conditions,
|
|
39
|
-
* and the refusal reported none of them. That mattered because the conditions
|
|
40
|
-
* have opposite causes and opposite remedies: `marker-absent` on a root that
|
|
41
|
-
* acquires a marker moments later is a run allocating right now, while the same
|
|
42
|
-
* word on a root that keeps it is a writer that never wrote one at all. An
|
|
43
|
-
* operator — and the next person to read the failure — cannot tell those apart
|
|
44
|
-
* from a count.
|
|
45
|
-
*/
|
|
46
|
-
export type UnrecognisedReason =
|
|
47
|
-
/** No owner marker exists at the expected path */
|
|
48
|
-
"marker-absent"
|
|
49
|
-
/** A marker exists but is unreadable, oversized, a symlink, or invalid */
|
|
50
|
-
| "marker-unreadable"
|
|
51
|
-
/** A valid marker describes a different path, device, or inode */
|
|
52
|
-
| "identity-mismatch"
|
|
53
|
-
/** The entry is a symlink or is not a directory */
|
|
54
|
-
| "not-a-directory";
|
|
55
|
-
/** One unrecognised entry, paired with the reason it could not be bound. */
|
|
56
|
-
export interface UnrecognisedEntry {
|
|
57
|
-
/** Direct child basename */
|
|
58
|
-
readonly name: string;
|
|
59
|
-
/** Why the entry could not be bound to an owner */
|
|
60
|
-
readonly reason: UnrecognisedReason;
|
|
61
|
-
}
|
|
62
|
-
/** What an inspection of the namespace found. */
|
|
63
|
-
export interface NamespaceResidue {
|
|
64
|
-
/** Entries whose owning process is gone but which were not removed */
|
|
65
|
-
readonly orphaned: readonly string[];
|
|
66
|
-
/** Entries whose exact dead ownership cannot be established */
|
|
67
|
-
readonly unrecognised: readonly string[];
|
|
68
|
-
/** The same entries, each carrying why it could not be bound */
|
|
69
|
-
readonly unrecognisedDetail: readonly UnrecognisedEntry[];
|
|
70
|
-
/** Total entries present */
|
|
71
|
-
readonly total: number;
|
|
72
|
-
}
|
|
73
|
-
/**
|
|
74
|
-
* Classifies what is left in the namespace.
|
|
75
|
-
*
|
|
76
|
-
* `unrecognised` is the interesting bucket. The sweep identifies residue by
|
|
77
|
-
* parsing the owning pid out of a directory's name, so a change to that naming
|
|
78
|
-
* scheme does not break the sweep loudly — it makes the sweep silently match
|
|
79
|
-
* nothing while continuing to report success. Naming that case separately turns
|
|
80
|
-
* that regression into a failure instead of a slow leak.
|
|
81
|
-
* @param dir - Namespace directory to inspect
|
|
82
|
-
* @param alive - Liveness probe, overridable for tests
|
|
83
|
-
* @param birth - Process-birth probe, overridable for tests
|
|
84
|
-
* @returns The classified residue.
|
|
85
|
-
*/
|
|
86
|
-
export declare const inspectNamespace: (dir?: string, alive?: (pid: number) => boolean, birth?: (pid: number) => string | undefined) => NamespaceResidue;
|
|
87
|
-
/**
|
|
88
|
-
* Builds the failure message for a namespace that is accumulating.
|
|
89
|
-
*
|
|
90
|
-
* Every branch names the directory and the offending entries, because the
|
|
91
|
-
* failure this replaces was a 60-second timeout that named nothing.
|
|
92
|
-
*
|
|
93
|
-
* `unrecognised` is deliberately a fail-closed refusal. A foreign, malformed,
|
|
94
|
-
* or identity-mismatched entry is preserved because age and naming are not
|
|
95
|
-
* deletion authority; proceeding would silently permit unbounded residue, and
|
|
96
|
-
* deleting it could destroy a live sibling's work. The diagnostic therefore
|
|
97
|
-
* names the bounded entries and gives the only safe manual recovery rule.
|
|
98
|
-
* @param dir - Namespace directory inspected
|
|
99
|
-
* @param residue - What the inspection found
|
|
100
|
-
* @returns The message, or `undefined` when the namespace is healthy.
|
|
101
|
-
*/
|
|
102
|
-
export declare const describeResidueFailure: (dir: string, residue: NamespaceResidue) => string | undefined;
|
|
103
|
-
/**
|
|
104
|
-
* Sweeps the namespace and reports what survived.
|
|
105
|
-
* @param alive - Process liveness probe shared by both phases
|
|
106
|
-
* @param snapshot - One bulk process-birth snapshot provider
|
|
107
|
-
* @returns The residue remaining after the sweep.
|
|
108
|
-
*/
|
|
109
|
-
export declare const sweepThenInspect: (alive?: (pid: number) => boolean, snapshot?: typeof processBirthFingerprintSnapshot) => NamespaceResidue;
|
|
110
|
-
/**
|
|
111
|
-
* Renders the banner printed at the moment of refusal.
|
|
112
|
-
*
|
|
113
|
-
* A throw from `setup` exits 1, which is the half of the contract that works.
|
|
114
|
-
* The other half did not: Vitest reports the throw as an unhandled error AFTER
|
|
115
|
-
* the run summary, so what an operator actually saw, in order, was
|
|
116
|
-
*
|
|
117
|
-
* ```
|
|
118
|
-
* line 5: No test files found, exiting with code 1
|
|
119
|
-
* lines 11-390: a full coverage report, every file at 0%
|
|
120
|
-
* line 397: Error: Test scratch namespace ... past the ceiling of 512
|
|
121
|
-
* ```
|
|
122
|
-
*
|
|
123
|
-
* measured on vitest 4.1.9 over a 416-line output. The guard bit correctly and
|
|
124
|
-
* was still PRESENTED as a coverage failure — "no tests" and an all-zero
|
|
125
|
-
* coverage table are the first and largest things on the page, and the reason
|
|
126
|
-
* is 392 lines below the verdict. Anything reading the top of the output, or
|
|
127
|
-
* reading the coverage numbers, gets the wrong story; that is a silent
|
|
128
|
-
* degradation inside a guard written to abolish silent degradation.
|
|
129
|
-
*
|
|
130
|
-
* So the reason is printed HERE, before the throw, from a hook that runs before
|
|
131
|
-
* collection — which puts it above every line of that output instead of below
|
|
132
|
-
* it. The throw is kept exactly as it was: this changes where the reason is
|
|
133
|
-
* read, not whether the run fails.
|
|
134
|
-
*
|
|
135
|
-
* The banner says what the zeroes below it mean, because the operator standing
|
|
136
|
-
* at this gate is not necessarily an engineer and "0% coverage" reads as a
|
|
137
|
-
* verdict on the code rather than as the absence of a measurement.
|
|
138
|
-
* @param failure - The residue failure being reported
|
|
139
|
-
* @returns Operator-readable banner text.
|
|
140
|
-
*/
|
|
141
|
-
export declare const renderRefusalNotice: (failure: string) => string;
|
|
142
|
-
/**
|
|
143
|
-
* Renders the ONE line a refused run ends on.
|
|
144
|
-
*
|
|
145
|
-
* The banner {@link renderRefusalNotice} produces is read by an operator who
|
|
146
|
-
* starts at the top. Nobody does that with a long transcript, and the tail was
|
|
147
|
-
* measured to be a stack trace through vitest's `_initializeGlobalSetup` — no
|
|
148
|
-
* line anywhere said what the run had concluded. Every other run puts its
|
|
149
|
-
* verdict at the end, so the end is where a reader looks, and a refused run
|
|
150
|
-
* gave them a frame in somebody else's internals instead.
|
|
151
|
-
*
|
|
152
|
-
* That absence has a name in this campaign: NO-RESULT, one of the three
|
|
153
|
-
* distinct outcomes fourteen runs of one unchanged commit produced
|
|
154
|
-
* (CodySwannGT/lisa#3032). "Every run emits a summary line" is the clause it
|
|
155
|
-
* violates, and it violates it by emitting nothing at all rather than by
|
|
156
|
-
* emitting the wrong thing.
|
|
157
|
-
*
|
|
158
|
-
* One line, deliberately. A second banner at the foot of the page would be a
|
|
159
|
-
* wall a reader skips exactly as they skipped the first one.
|
|
160
|
-
* @param failure - The residue failure being reported
|
|
161
|
-
* @returns A single newline-terminated summary line.
|
|
162
|
-
*/
|
|
163
|
-
export declare const renderRefusalSummary: (failure: string) => string;
|
|
164
|
-
/**
|
|
165
|
-
* Vitest's marker for a pool worker. Absent in the process that runs
|
|
166
|
-
* `globalSetup`, present in every process that runs a test file — measured on
|
|
167
|
-
* vitest 4.1.9 rather than assumed, and pinned by a test so a rename cannot
|
|
168
|
-
* silently disarm {@link announceRefusal}.
|
|
169
|
-
*/
|
|
170
|
-
export declare const POOL_WORKER_ENV = "VITEST_POOL_ID";
|
|
171
|
-
/**
|
|
172
|
-
* Arms the summary line to be written when the process finally exits.
|
|
173
|
-
*
|
|
174
|
-
* At exit rather than inline, because inline is where the banner already is and
|
|
175
|
-
* the whole point is to reach the reader who starts at the other end. Vitest
|
|
176
|
-
* prints its unhandled-error report after `setup` throws, so anything written
|
|
177
|
-
* before the throw lands above it; an exit hook lands below.
|
|
178
|
-
*
|
|
179
|
-
* `writeSync` on the descriptor, never `process.stderr.write`. On a POSIX pipe
|
|
180
|
-
* Node's stderr is asynchronous, and an asynchronous write issued from an exit
|
|
181
|
-
* handler can be discarded when the process tears down — which would leave this
|
|
182
|
-
* fix passing its own tests while changing no transcript anywhere. The writer
|
|
183
|
-
* is a parameter so a test can observe the line without redefining an ESM
|
|
184
|
-
* module namespace, which is not permitted.
|
|
185
|
-
*
|
|
186
|
-
* Unguarded on purpose: {@link announceRefusal} is the only caller and holds
|
|
187
|
-
* the single guard. Two copies of one condition is one condition that can go
|
|
188
|
-
* inert without any test noticing.
|
|
189
|
-
* @param failure - The residue failure being reported
|
|
190
|
-
* @param write - Where the line goes; defaults to a synchronous stderr write
|
|
191
|
-
*/
|
|
192
|
-
export declare const armRefusalSummary: (failure: string, write?: (text: string) => void) => void;
|
|
193
|
-
/**
|
|
194
|
-
* Says a run was refused — at the top of the transcript and again at the foot —
|
|
195
|
-
* and says nothing at all from a process that cannot refuse a run.
|
|
196
|
-
*
|
|
197
|
-
* ## Why a worker announces nothing
|
|
198
|
-
*
|
|
199
|
-
* This project has tests that invoke the real {@link setup} against a
|
|
200
|
-
* deliberately overfull namespace, and both halves of an announcement outlive
|
|
201
|
-
* the call that made it: the banner is already on the run's stderr, and the
|
|
202
|
-
* summary is a handler that fires whenever that process exits. Announced
|
|
203
|
-
* unconditionally, each such test contributed to a transcript that was not its
|
|
204
|
-
* own.
|
|
205
|
-
*
|
|
206
|
-
* Measured on ten consecutive runs of 64 files and 893 tests, every one green
|
|
207
|
-
* and exiting 0: **two** "TEST RUN REFUSED TO START" banners in each, naming
|
|
208
|
-
* the tests' own fixture directories, and — until this guard — two matching
|
|
209
|
-
* "❌ NO VERDICT" lines. A green run that says it was refused is the same class
|
|
210
|
-
* of lie as a killed gate that says FAILED, in the same transcript, and it is
|
|
211
|
-
* the one the "repeated runs agree" scenario trips over: two readers of the
|
|
212
|
-
* same passing run can reasonably disagree about what it concluded.
|
|
213
|
-
*
|
|
214
|
-
* The banner half predates the summary half and shipped with #3027; the summary
|
|
215
|
-
* half was introduced by #3032's own first attempt at this fix. Both are cured
|
|
216
|
-
* here by one condition rather than two.
|
|
217
|
-
*
|
|
218
|
-
* The guard is structural rather than a rule each test must remember: only the
|
|
219
|
-
* process vitest runs `globalSetup` in can refuse a run, and that process is
|
|
220
|
-
* the one WITHOUT {@link POOL_WORKER_ENV}. A test calling `setup` runs in a
|
|
221
|
-
* worker and therefore announces nothing, whatever it does to the namespace.
|
|
222
|
-
* @param failure - The residue failure being reported
|
|
223
|
-
* @param writeNotice - Where the banner goes; defaults to the run's stderr
|
|
224
|
-
*/
|
|
225
|
-
export declare const announceRefusal: (failure: string, writeNotice?: (text: string) => void) => void;
|
|
226
|
-
/**
|
|
227
|
-
* Refuses to start into an untrusted temp root or an accumulating namespace.
|
|
228
|
-
*
|
|
229
|
-
* A refusal speaks twice — a banner before collection and a summary line at
|
|
230
|
-
* exit — and the two are not redundant. They are the top and the bottom of a
|
|
231
|
-
* transcript nobody reads in full.
|
|
232
|
-
*
|
|
233
|
-
* The TMPDIR trust check runs FIRST, and the order is load-bearing rather than
|
|
234
|
-
* arbitrary. An untrusted root is the more fundamental fault: it is a property
|
|
235
|
-
* of the environment the run was launched in, it is what every rung of the
|
|
236
|
-
* namespace audit is then inspected THROUGH, and it is the one whose absence
|
|
237
|
-
* of a message cost four separate investigations (CodySwannGT/lisa#3691).
|
|
238
|
-
* Reporting a namespace symptom first would name the second-order fact.
|
|
239
|
-
* @throws {Error} When the temp root is untrusted, or residue the sweep cannot or did not reclaim is present.
|
|
240
|
-
*/
|
|
241
|
-
export declare const setup: () => void;
|
|
242
|
-
/**
|
|
243
|
-
* Reclaims what this run allocated.
|
|
244
|
-
*
|
|
245
|
-
* This hook cannot fail a run — see the module header: Vitest swallows a throw
|
|
246
|
-
* from here. So it does the one thing it can do reliably, which is the cleanup;
|
|
247
|
-
* the judgement is made by {@link setup} on the next run, where a throw is
|
|
248
|
-
* actually honoured.
|
|
249
|
-
*
|
|
250
|
-
* The namespace directory itself is deliberately left in place. Creating a name
|
|
251
|
-
* inside a saturated shared temp root is the expensive operation this whole
|
|
252
|
-
* module exists to stop paying repeatedly; keeping one directory forever means
|
|
253
|
-
* the cost is paid once on a machine rather than once per run, and it is what
|
|
254
|
-
* makes "one entry in the shared temp root, ever" literally true rather than
|
|
255
|
-
* approximately true.
|
|
256
|
-
*/
|
|
257
|
-
export declare const teardown: () => void;
|
|
258
|
-
//# sourceMappingURL=scratch-global-setup.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"scratch-global-setup.d.ts","sourceRoot":"","sources":["../../../src/configs/vitest/scratch-global-setup.ts"],"names":[],"mappings":"AAmDA,OAAO,EAGL,+BAA+B,EAGhC,MAAM,oBAAoB,CAAC;AAG5B;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA+BG;AACH,eAAO,MAAM,qBAAqB,MAAM,CAAC;AAEzC;;;;;;;;;;GAUG;AACH,MAAM,MAAM,kBAAkB;AAC5B,kDAAkD;AAChD,eAAe;AACjB,0EAA0E;GACxE,mBAAmB;AACrB,kEAAkE;GAChE,mBAAmB;AACrB,mDAAmD;GACjD,iBAAiB,CAAC;AAEtB,4EAA4E;AAC5E,MAAM,WAAW,iBAAiB;IAChC,4BAA4B;IAC5B,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,mDAAmD;IACnD,QAAQ,CAAC,MAAM,EAAE,kBAAkB,CAAC;CACrC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