@aibyzero/cm-workflow 0.10.5
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/.codex-plugin/plugin.json +30 -0
- package/AGENTS.md +74 -0
- package/CONTRIBUTING.md +62 -0
- package/LICENSE +21 -0
- package/README.md +263 -0
- package/SECURITY.md +49 -0
- package/THIRD_PARTY_NOTICES.md +29 -0
- package/VERSION +1 -0
- package/agents/cm-backend-agent.md +34 -0
- package/agents/cm-contract-agent.md +34 -0
- package/agents/cm-database-agent.md +34 -0
- package/agents/cm-frontend-agent.md +33 -0
- package/agents/cm-miniprogram-agent.md +33 -0
- package/agents/cm-ui-agent.md +34 -0
- package/assets/docs/command-picker-mobile.svg +56 -0
- package/assets/docs/command-picker.svg +56 -0
- package/assets/docs/user-guide-hero-mobile.svg +35 -0
- package/assets/docs/user-guide-hero.svg +36 -0
- package/assets/readme/delivery-flow.svg +86 -0
- package/assets/readme/hero.svg +77 -0
- package/assets/readme/recovery-record.svg +73 -0
- package/assets/readme/test-evidence.svg +64 -0
- package/compat/claude-commands/cm-ai.md +3 -0
- package/compat/claude-commands/cm-check.md +3 -0
- package/compat/claude-commands/cm-fix.md +3 -0
- package/compat/claude-commands/cm-idea.md +3 -0
- package/compat/claude-commands/cm-init.md +3 -0
- package/compat/claude-commands/cm-prd.md +3 -0
- package/compat/claude-commands/cm-refactor.md +3 -0
- package/compat/claude-commands/cm-test.md +3 -0
- package/docs/architecture.md +155 -0
- package/docs/fixes/.reviews/fix-cancel-throw-T-FIX-cancel-throw-a1-handoff.json +57 -0
- package/docs/fixes/.reviews/fix-cancel-throw-T-FIX-cancel-throw-a2-handoff.json +58 -0
- package/docs/fixes/.reviews/fix-cancel-throw-T-FIX-cancel-throw-r1.md +121 -0
- package/docs/fixes/.reviews/fix-cancel-throw-v2-T-FIX-cancel-throw-v2-a1-handoff.json +56 -0
- package/docs/fixes/.reviews/fix-cancel-throw-v2-T-FIX-cancel-throw-v2-r1.md +100 -0
- package/docs/fixes/.reviews/fix-cm-js-n1n2-admission-successor-T-FIX-cm-js-n1n2-admission-successor-a1-handoff.json +61 -0
- package/docs/fixes/.reviews/fix-cm-js-n1n2-admission-successor-T-FIX-cm-js-n1n2-admission-successor-a2-handoff.json +63 -0
- package/docs/fixes/.reviews/fix-cm-js-n1n2-admission-successor-T-FIX-cm-js-n1n2-admission-successor-r1.md +58 -0
- package/docs/fixes/.reviews/fix-cm-js-n1n2-admission-successor-T-FIX-cm-js-n1n2-admission-successor-r2.md +55 -0
- package/docs/fixes/.reviews/fix-f01-dual-failure-terminal-T-FIX-f01-dual-failure-terminal-a1-handoff.json +65 -0
- package/docs/fixes/.reviews/fix-f01-dual-failure-terminal-T-FIX-f01-dual-failure-terminal-r1.md +88 -0
- package/docs/fixes/.reviews/fix-manifest-runtime-checkbox-drift-r1.md +33 -0
- package/docs/fixes/.reviews/fix-manifest-runtime-checkbox-drift-r2.md +31 -0
- package/docs/fixes/.reviews/fix-model-call-boundary-identity-T-FIX-model-call-boundary-identity-a1-handoff.json +56 -0
- package/docs/fixes/.reviews/fix-model-call-boundary-identity-T-FIX-model-call-boundary-identity-a2-handoff.json +85 -0
- package/docs/fixes/.reviews/fix-model-call-boundary-identity-T-FIX-model-call-boundary-identity-r1.md +53 -0
- package/docs/fixes/.reviews/fix-model-call-boundary-identity-T-FIX-model-call-boundary-identity-r2.md +80 -0
- package/docs/fixes/.reviews/fix-review-evidence-scope-honesty-T-FIX-review-evidence-scope-honesty-a1-handoff.json +35 -0
- package/docs/fixes/.reviews/fix-review-evidence-scope-honesty-T-FIX-review-evidence-scope-honesty-r1.md +33 -0
- package/docs/fixes/.reviews/fix-windows-cp1252-log-output-r1.md +30 -0
- package/docs/fixes/.reviews/fix-windows-cp1252-log-output-r2.md +16 -0
- package/docs/fixes/.reviews/openai-compatible-depth-fixture-T-FIX-openai-compatible-depth-fixture-a1-handoff.json +40 -0
- package/docs/fixes/.reviews/openai-compatible-depth-fixture-T-FIX-openai-compatible-depth-fixture-r1.md +30 -0
- package/docs/fixes/20260729-windows-cp1252-log-output.md +65 -0
- package/docs/fixes/20260804-manifest-runtime-checkbox-drift.md +67 -0
- package/docs/fixes/20260806-model-call-boundary-identity.md +80 -0
- package/docs/fixes/20260807-prelanding-integrity.md +58 -0
- package/docs/fixes/20260826-openai-compatible-depth-fixture.md +39 -0
- package/docs/fixes/20260903-cm-js-n1n2-admission-r1.md +64 -0
- package/docs/fixes/20260903-cm-js-n1n2-admission-successor.md +83 -0
- package/docs/fixes/20260903-s4c1b-v3-cancel-throw.md +89 -0
- package/docs/fixes/20260904-f01-codex-dual-failure-terminal.md +89 -0
- package/docs/fixes/20260907-wip-triage-log.md +44 -0
- package/docs/installation.md +202 -0
- package/docs/js-workflow-control.md +1010 -0
- package/docs/sample-prd/prd-funding-rate-alert.md +42 -0
- package/docs/sample-specs/docs//351/234/200/346/261/202/347/244/272/344/276/213.md +24 -0
- package/docs/user-guide.md +526 -0
- package/docs//351/207/215/346/236/204/346/265/201/347/250/213/350/256/276/350/256/241/README.md +19 -0
- package/docs//351/207/215/346/236/204/346/265/201/347/250/213/350/256/276/350/256/241/refactor-flow.excalidraw +3650 -0
- package/docs//351/207/215/346/236/204/346/265/201/347/250/213/350/256/276/350/256/241/refactor-flow.mp4 +0 -0
- package/docs//351/207/215/346/236/204/346/265/201/347/250/213/350/256/276/350/256/241/refactor-flow.png +0 -0
- package/docs//351/207/215/346/236/204/346/265/201/347/250/213/350/256/276/350/256/241/refactor-flow.spec.json +223 -0
- package/install-codex.sh +184 -0
- package/install.ps1 +206 -0
- package/install.sh +244 -0
- package/package.json +58 -0
- package/runtime/external-expert.md +302 -0
- package/runtime/js/cm-ai/accepted-fix.mjs +28 -0
- package/runtime/js/cm-ai/claude-developer-adapter.mjs +6 -0
- package/runtime/js/cm-ai/claude-review-adapter.mjs +16 -0
- package/runtime/js/cm-ai/claude-review-stream.mjs +53 -0
- package/runtime/js/cm-ai/claude-tool-preview.mjs +107 -0
- package/runtime/js/cm-ai/cm-ai-admission.mjs +353 -0
- package/runtime/js/cm-ai/cm-ai-context-refresh.mjs +217 -0
- package/runtime/js/cm-ai/cm-ai-conversation-entry.mjs +538 -0
- package/runtime/js/cm-ai/cm-ai-learning-handoff-writer.mjs +119 -0
- package/runtime/js/cm-ai/cm-ai-learning-writer.mjs +172 -0
- package/runtime/js/cm-ai/cm-ai-qa-log.mjs +320 -0
- package/runtime/js/cm-ai/cm-ai-run-finalizer.mjs +107 -0
- package/runtime/js/cm-ai/code-projects.mjs +85 -0
- package/runtime/js/cm-ai/codex-config.mjs +48 -0
- package/runtime/js/cm-ai/codex-developer-adapter.mjs +5 -0
- package/runtime/js/cm-ai/codex-developer-basic-output.schema.json +6 -0
- package/runtime/js/cm-ai/codex-developer-output.schema.json +37 -0
- package/runtime/js/cm-ai/codex-review-adapter.mjs +73 -0
- package/runtime/js/cm-ai/contracts.mjs +156 -0
- package/runtime/js/cm-ai/developer-adapter.mjs +93 -0
- package/runtime/js/cm-ai/durable-runner-state.mjs +504 -0
- package/runtime/js/cm-ai/effect-contract.mjs +102 -0
- package/runtime/js/cm-ai/execution-platform.mjs +7 -0
- package/runtime/js/cm-ai/execution-store.mjs +211 -0
- package/runtime/js/cm-ai/fix-code-association.mjs +40 -0
- package/runtime/js/cm-ai/gate-bridge.mjs +25 -0
- package/runtime/js/cm-ai/host-bootstrap.mjs +170 -0
- package/runtime/js/cm-ai/host-check.mjs +89 -0
- package/runtime/js/cm-ai/host-conversation-execution.mjs +125 -0
- package/runtime/js/cm-ai/host-documentation.mjs +40 -0
- package/runtime/js/cm-ai/host-handoff.mjs +71 -0
- package/runtime/js/cm-ai/host-project-execution.mjs +58 -0
- package/runtime/js/cm-ai/host-qa-executor.mjs +238 -0
- package/runtime/js/cm-ai/host-qa-fix-owner.mjs +131 -0
- package/runtime/js/cm-ai/host-qa-fix.mjs +30 -0
- package/runtime/js/cm-ai/host-qa-policy.mjs +70 -0
- package/runtime/js/cm-ai/host-review-authority.mjs +36 -0
- package/runtime/js/cm-ai/host-review-file.mjs +56 -0
- package/runtime/js/cm-ai/host-role-routing.mjs +41 -0
- package/runtime/js/cm-ai/host-session.mjs +96 -0
- package/runtime/js/cm-ai/host-tool-bridge.mjs +53 -0
- package/runtime/js/cm-ai/host-workflow-capabilities.mjs +45 -0
- package/runtime/js/cm-ai/host.mjs +20 -0
- package/runtime/js/cm-ai/index.mjs +7 -0
- package/runtime/js/cm-ai/provider-review-observation.mjs +86 -0
- package/runtime/js/cm-ai/qa-fix-definition.mjs +21 -0
- package/runtime/js/cm-ai/review-evidence-file.mjs +38 -0
- package/runtime/js/cm-ai/review-package.mjs +426 -0
- package/runtime/js/cm-ai/review-result.schema.json +40 -0
- package/runtime/js/cm-ai/review-runner.mjs +35 -0
- package/runtime/js/cm-ai/task-commit-codec.mjs +54 -0
- package/runtime/js/cm-ai/task-commit.mjs +201 -0
- package/runtime/js/cm-ai/task-owner.mjs +97 -0
- package/runtime/js/cm-ai/task-runner.mjs +766 -0
- package/runtime/js/cm-ai/tool-preview.mjs +205 -0
- package/runtime/js/cm-ai/worker-claude.mjs +104 -0
- package/runtime/js/cm-ai/worker-codex-developer.mjs +124 -0
- package/runtime/js/cm-ai/worker-codex.mjs +143 -0
- package/runtime/js/cm-check/host.mjs +101 -0
- package/runtime/js/cm-fix/baseline.mjs +70 -0
- package/runtime/js/cm-fix/cause-evidence.mjs +24 -0
- package/runtime/js/cm-fix/cause-invocation.mjs +40 -0
- package/runtime/js/cm-fix/cause-package.mjs +68 -0
- package/runtime/js/cm-fix/dossier.mjs +140 -0
- package/runtime/js/cm-fix/execution.mjs +1549 -0
- package/runtime/js/cm-fix/final-review-evidence.mjs +20 -0
- package/runtime/js/cm-fix/final-review.mjs +156 -0
- package/runtime/js/cm-fix/finish.mjs +124 -0
- package/runtime/js/cm-fix/handoff.mjs +64 -0
- package/runtime/js/cm-fix/host-review.mjs +38 -0
- package/runtime/js/cm-fix/host.mjs +96 -0
- package/runtime/js/cm-fix/investigation.mjs +25 -0
- package/runtime/js/cm-fix/layout.mjs +17 -0
- package/runtime/js/cm-fix/learning-writeback.mjs +86 -0
- package/runtime/js/cm-fix/learning.mjs +31 -0
- package/runtime/js/cm-fix/metrics.mjs +75 -0
- package/runtime/js/cm-fix/progress.mjs +64 -0
- package/runtime/js/cm-fix/protected-edits.mjs +95 -0
- package/runtime/js/cm-fix/qa-source.mjs +58 -0
- package/runtime/js/cm-fix/red-test.mjs +92 -0
- package/runtime/js/cm-fix/regression-evidence.mjs +64 -0
- package/runtime/js/cm-fix/regression.mjs +41 -0
- package/runtime/js/cm-fix/repair.mjs +95 -0
- package/runtime/js/cm-fix/reproduce.mjs +54 -0
- package/runtime/js/cm-fix/retrospective.mjs +41 -0
- package/runtime/js/cm-fix/review-baseline.mjs +47 -0
- package/runtime/js/cm-fix/start.mjs +49 -0
- package/runtime/js/cm-fix/test-author.mjs +63 -0
- package/runtime/js/cm-fix/visual.mjs +72 -0
- package/runtime/js/cm-fix/walkthrough.mjs +126 -0
- package/runtime/js/cm-idea/session.mjs +79 -0
- package/runtime/js/cm-init/draft-generation.mjs +66 -0
- package/runtime/js/cm-init/draft-inspection.mjs +70 -0
- package/runtime/js/cm-init/project-analysis.mjs +60 -0
- package/runtime/js/cm-init/project-scan.mjs +55 -0
- package/runtime/js/cm-init/review-evidence.mjs +80 -0
- package/runtime/js/cm-prd/accepted-design.mjs +46 -0
- package/runtime/js/cm-prd/analysis.mjs +260 -0
- package/runtime/js/cm-prd/change.mjs +268 -0
- package/runtime/js/cm-prd/correction-check.mjs +49 -0
- package/runtime/js/cm-prd/design-risk.mjs +30 -0
- package/runtime/js/cm-prd/disposition-plan.mjs +33 -0
- package/runtime/js/cm-prd/draft-save.mjs +122 -0
- package/runtime/js/cm-prd/draft.mjs +70 -0
- package/runtime/js/cm-prd/materials.mjs +48 -0
- package/runtime/js/cm-prd/review-correction.mjs +158 -0
- package/runtime/js/cm-prd/review-disposition.mjs +96 -0
- package/runtime/js/cm-prd/review-findings.mjs +36 -0
- package/runtime/js/cm-prd/review-host.mjs +48 -0
- package/runtime/js/cm-prd/review-preparation.mjs +49 -0
- package/runtime/js/cm-prd/review-publication.mjs +56 -0
- package/runtime/js/cm-prd/self-check.mjs +75 -0
- package/runtime/js/cm-prd/session.mjs +74 -0
- package/runtime/js/cm-prd/summary.mjs +133 -0
- package/runtime/js/cm-refactor/host.mjs +2 -0
- package/runtime/js/cm-refactor/records.mjs +86 -0
- package/runtime/js/cm-refactor/workflow.mjs +478 -0
- package/runtime/js/cm-test/declared-command.mjs +32 -0
- package/runtime/js/cm-test/host.mjs +319 -0
- package/runtime/js/cm-test/logic-results.mjs +39 -0
- package/runtime/js/cm-test/recovery.mjs +58 -0
- package/runtime/js/cm-test/session.mjs +56 -0
- package/runtime/js/cm-test/source-snapshot.mjs +136 -0
- package/runtime/logging.md +207 -0
- package/runtime/model-efficiency.md +201 -0
- package/runtime/orchestration.md +113 -0
- package/runtime/project-context.md +43 -0
- package/runtime/project-learning.md +49 -0
- package/runtime/review.md +140 -0
- package/runtime/steelman-review.md +111 -0
- package/runtime/task-gates.md +283 -0
- package/runtime/task-handoff.schema.json +103 -0
- package/runtime/test-contract.md +212 -0
- package/runtime/workflow-config.md +118 -0
- package/runtime/workflow-routing.md +82 -0
- package/scripts/cm-ai-admission.mjs +50 -0
- package/scripts/cm-ai-admission.test.mjs +38 -0
- package/scripts/cm-ai-batch-host.mjs +77 -0
- package/scripts/cm-ai-batch-host.test.mjs +155 -0
- package/scripts/cm-ai-batch-run.mjs +136 -0
- package/scripts/cm-ai-batch-run.test.mjs +128 -0
- package/scripts/cm-ai-bootstrap.test.mjs +228 -0
- package/scripts/cm-ai-fix-integration.test.mjs +233 -0
- package/scripts/cm-ai-host.mjs +175 -0
- package/scripts/cm-ai-host.test.mjs +368 -0
- package/scripts/cm-ai-multi-root.test.mjs +289 -0
- package/scripts/cm-ai-nested-execution.test.mjs +313 -0
- package/scripts/cm-ai-run.mjs +293 -0
- package/scripts/cm-ai-run.test.mjs +336 -0
- package/scripts/cm-check-entry.mjs +120 -0
- package/scripts/cm-check-host.mjs +29 -0
- package/scripts/cm-check-host.test.mjs +71 -0
- package/scripts/cm-check-runtime.ps1 +69 -0
- package/scripts/cm-check-runtime.sh +910 -0
- package/scripts/cm-claude-probe.test.mjs +54 -0
- package/scripts/cm-claude-review-stream.test.mjs +45 -0
- package/scripts/cm-claude-worker.test.mjs +92 -0
- package/scripts/cm-codex-developer-adapter.test.mjs +85 -0
- package/scripts/cm-codex-developer-worker.test.mjs +128 -0
- package/scripts/cm-codex-review-progress.test.mjs +96 -0
- package/scripts/cm-execution-platform.test.mjs +47 -0
- package/scripts/cm-fix-cause-invocation.test.mjs +72 -0
- package/scripts/cm-fix-cause-package.test.mjs +68 -0
- package/scripts/cm-fix-code-association.test.mjs +55 -0
- package/scripts/cm-fix-entry.mjs +132 -0
- package/scripts/cm-fix-execution.test.mjs +63 -0
- package/scripts/cm-fix-final-review.test.mjs +124 -0
- package/scripts/cm-fix-host-review-assembly.test.mjs +34 -0
- package/scripts/cm-fix-host-review.test.mjs +261 -0
- package/scripts/cm-fix-host-sequence.test.mjs +26 -0
- package/scripts/cm-fix-host.mjs +89 -0
- package/scripts/cm-fix-host.test.mjs +105 -0
- package/scripts/cm-fix-learning-writeback.test.mjs +73 -0
- package/scripts/cm-fix-learning.test.mjs +66 -0
- package/scripts/cm-fix-metrics.test.mjs +58 -0
- package/scripts/cm-fix-no-existing-tests.test.mjs +92 -0
- package/scripts/cm-fix-observation-dossier.test.mjs +452 -0
- package/scripts/cm-fix-progress.test.mjs +45 -0
- package/scripts/cm-fix-protected-edits.test.mjs +54 -0
- package/scripts/cm-fix-qa-source.test.mjs +206 -0
- package/scripts/cm-fix-red-owner.test.mjs +143 -0
- package/scripts/cm-fix-red-test.test.mjs +38 -0
- package/scripts/cm-fix-regression.test.mjs +57 -0
- package/scripts/cm-fix-repair-owner.test.mjs +370 -0
- package/scripts/cm-fix-repair.test.mjs +68 -0
- package/scripts/cm-fix-reproduce.test.mjs +31 -0
- package/scripts/cm-fix-retrospective.test.mjs +46 -0
- package/scripts/cm-fix-review-baseline.test.mjs +54 -0
- package/scripts/cm-fix-review-recovery.test.mjs +197 -0
- package/scripts/cm-fix-test-author.test.mjs +105 -0
- package/scripts/cm-fix-visual-bare.test.mjs +171 -0
- package/scripts/cm-fix-walkthrough.test.mjs +45 -0
- package/scripts/cm-host-check.test.mjs +113 -0
- package/scripts/cm-host-documentation.test.mjs +45 -0
- package/scripts/cm-host-handoff.test.mjs +58 -0
- package/scripts/cm-host-qa-executor.test.mjs +156 -0
- package/scripts/cm-host-qa-policy.test.mjs +59 -0
- package/scripts/cm-host-review-authority.test.mjs +60 -0
- package/scripts/cm-host-role-routing.test.mjs +33 -0
- package/scripts/cm-idea-entry.mjs +104 -0
- package/scripts/cm-idea-host.mjs +144 -0
- package/scripts/cm-idea-host.test.mjs +75 -0
- package/scripts/cm-idea-recovery.test.mjs +90 -0
- package/scripts/cm-init-analysis-host.test.mjs +50 -0
- package/scripts/cm-init-draft-generation.test.mjs +52 -0
- package/scripts/cm-init-draft-inspection.test.mjs +41 -0
- package/scripts/cm-init-entry.mjs +170 -0
- package/scripts/cm-init-host.mjs +284 -0
- package/scripts/cm-init-host.test.mjs +231 -0
- package/scripts/cm-init-project-analysis.test.mjs +47 -0
- package/scripts/cm-init-project-scan.test.mjs +41 -0
- package/scripts/cm-init-revision-host.test.mjs +61 -0
- package/scripts/cm-init-session.test.mjs +122 -0
- package/scripts/cm-log-event.mjs +538 -0
- package/scripts/cm-log-event.py +133 -0
- package/scripts/cm-log-event.test.mjs +70 -0
- package/scripts/cm-openai-compatible-call.py +661 -0
- package/scripts/cm-prd-analysis.test.mjs +67 -0
- package/scripts/cm-prd-completion.test.mjs +190 -0
- package/scripts/cm-prd-design-phase.test.mjs +296 -0
- package/scripts/cm-prd-draft-save.test.mjs +63 -0
- package/scripts/cm-prd-draft.test.mjs +39 -0
- package/scripts/cm-prd-entry.mjs +245 -0
- package/scripts/cm-prd-host.mjs +273 -0
- package/scripts/cm-prd-host.test.mjs +169 -0
- package/scripts/cm-prd-materials.test.mjs +41 -0
- package/scripts/cm-prd-review-claim.test.mjs +42 -0
- package/scripts/cm-prd-review-disposition.test.mjs +196 -0
- package/scripts/cm-prd-review-gate.mjs +194 -0
- package/scripts/cm-prd-review-gate.py +26 -0
- package/scripts/cm-prd-review-host.test.mjs +30 -0
- package/scripts/cm-prd-review-preparation.test.mjs +69 -0
- package/scripts/cm-prd-review-publication.test.mjs +95 -0
- package/scripts/cm-prd-revision.test.mjs +32 -0
- package/scripts/cm-prd-self-check.test.mjs +23 -0
- package/scripts/cm-prd-sources.test.mjs +76 -0
- package/scripts/cm-prd-timing.py +272 -0
- package/scripts/cm-refactor-entry.mjs +145 -0
- package/scripts/cm-refactor-host.mjs +26 -0
- package/scripts/cm-refactor-host.test.mjs +201 -0
- package/scripts/cm-review-dependency-snapshot.test.mjs +67 -0
- package/scripts/cm-review-inventory.test.mjs +109 -0
- package/scripts/cm-spec-manifest.mjs +104 -0
- package/scripts/cm-spec-manifest.py +26 -0
- package/scripts/cm-task-gate.mjs +879 -0
- package/scripts/cm-task-gate.py +312 -0
- package/scripts/cm-task-gate.test.mjs +202 -0
- package/scripts/cm-test-declared-command.test.mjs +18 -0
- package/scripts/cm-test-entry.mjs +231 -0
- package/scripts/cm-test-host.mjs +40 -0
- package/scripts/cm-test-host.test.mjs +169 -0
- package/scripts/cm-test-logic-results.test.mjs +26 -0
- package/scripts/cm-test-session.test.mjs +138 -0
- package/scripts/cm-usage-report.py +516 -0
- package/scripts/cm-workflow-config.mjs +463 -0
- package/scripts/cm-workflow-config.test.mjs +181 -0
- package/scripts/cm-workflow.mjs +36 -0
- package/scripts/cm-workflow.test.mjs +51 -0
- package/scripts/cm_workflow_config.py +52 -0
- package/scripts/fixtures/claude-review-process.mjs +35 -0
- package/scripts/fixtures/codex-review-process.mjs +22 -0
- package/scripts/fixtures/prd-review-gate-python-oracle.py +320 -0
- package/scripts/fixtures/spec-manifest-python-oracle.py +172 -0
- package/scripts/scan-public-safety.py +117 -0
- package/scripts/test-cm-log-event.py +1213 -0
- package/scripts/test-cm-openai-compatible-call.py +1185 -0
- package/scripts/test-cm-prd-review-gate.py +272 -0
- package/scripts/test-cm-prd-timing.py +168 -0
- package/scripts/test-cm-usage-report.py +584 -0
- package/scripts/test-npm-install.py +171 -0
- package/scripts/test-scan-public-safety.py +76 -0
- package/scripts/test-shell-compat.sh +365 -0
- package/scripts/test-spec-manifest.py +263 -0
- package/scripts/test-task-gate.py +46 -0
- package/scripts/test-workflow-config.py +30 -0
- package/scripts/validate-public-repo.py +245 -0
- package/scripts/validate-test-cases.mjs +71 -0
- package/scripts/validate-test-cases.py +27 -0
- package/scripts/validate-test-cases.test.mjs +36 -0
- package/skills/cm-ai/SKILL.md +137 -0
- package/skills/cm-ai/references/N1-init.md +108 -0
- package/skills/cm-ai/references/N2-enter-feature.md +38 -0
- package/skills/cm-ai/references/N3-execute-task.md +123 -0
- package/skills/cm-ai/references/N4-review.md +103 -0
- package/skills/cm-ai/references/N5-mark-done.md +117 -0
- package/skills/cm-ai/references/N6-qa-eval.md +102 -0
- package/skills/cm-ai/references/N7-context.md +23 -0
- package/skills/cm-ai/references/N8-finish.md +103 -0
- package/skills/cm-ai/references/js-host.md +126 -0
- package/skills/cm-backend-engineer/SKILL.md +100 -0
- package/skills/cm-check/SKILL.md +52 -0
- package/skills/cm-check/references/js-host.md +44 -0
- package/skills/cm-contract-engineer/SKILL.md +136 -0
- package/skills/cm-database-engineer/SKILL.md +89 -0
- package/skills/cm-devops-engineer/SKILL.md +137 -0
- package/skills/cm-doc-syncer/SKILL.md +150 -0
- package/skills/cm-finance-expert/SKILL.md +85 -0
- package/skills/cm-fix/SKILL.md +199 -0
- package/skills/cm-fix/references/cross-boundary-debugging.md +44 -0
- package/skills/cm-fix/references/js-host.md +135 -0
- package/skills/cm-frontend-engineer/SKILL.md +127 -0
- package/skills/cm-idea/SKILL.md +55 -0
- package/skills/cm-idea/references/domains/trading.md +97 -0
- package/skills/cm-idea/references/example-prd.md +92 -0
- package/skills/cm-idea/references/idea-to-prd.md +282 -0
- package/skills/cm-idea/references/js-host.md +63 -0
- package/skills/cm-init/SKILL.md +191 -0
- package/skills/cm-init/references/js-host.md +123 -0
- package/skills/cm-miniprogram-engineer/SKILL.md +141 -0
- package/skills/cm-miniprogram-engineer/references/platform-readiness.md +58 -0
- package/skills/cm-miniprogram-engineer/references/release-checklist.md +59 -0
- package/skills/cm-prd/SKILL.md +548 -0
- package/skills/cm-prd/references/brownfield.md +13 -0
- package/skills/cm-prd/references/change-mode.md +145 -0
- package/skills/cm-prd/references/context-scope.md +62 -0
- package/skills/cm-prd/references/greenfield.md +80 -0
- package/skills/cm-prd/references/js-change-recovery.md +57 -0
- package/skills/cm-prd/references/js-host.md +98 -0
- package/skills/cm-prd/references/phase-timing.md +68 -0
- package/skills/cm-prd/references/spec-self-check.md +22 -0
- package/skills/cm-product-manager/SKILL.md +83 -0
- package/skills/cm-qa-engineer/SKILL.md +142 -0
- package/skills/cm-refactor/SKILL.md +236 -0
- package/skills/cm-refactor/references/js-batch.md +75 -0
- package/skills/cm-refactor/references/js-host.md +78 -0
- package/skills/cm-test/SKILL.md +288 -0
- package/skills/cm-test/references/js-host.md +118 -0
- package/skills/cm-ui-engineer/SKILL.md +105 -0
- package/skills/codebase-context/SKILL.md +489 -0
- package/skills/darwin-skill/NOTICE.md +26 -0
- package/skills/darwin-skill/README.md +272 -0
- package/skills/darwin-skill/SKILL.md +492 -0
- package/skills/darwin-skill/references/runtime-neutrality.md +68 -0
- package/skills/darwin-skill/references/skilllens-evidence.md +142 -0
- package/skills/darwin-skill/scripts/screenshot.mjs +71 -0
- package/skills/darwin-skill/templates/result-card-dark.html +698 -0
- package/skills/darwin-skill/templates/result-card-white.html +444 -0
- package/skills/darwin-skill/templates/result-card.html +616 -0
- package/skills/external-expert/SKILL.md +250 -0
- package/templates/arch-reference.md +68 -0
- package/templates/auto-update/cm-announce.sh +19 -0
- package/templates/auto-update/cm-update.sh +274 -0
- package/templates/cm-workflow.yml +52 -0
- package/templates/dashboard/dashboard.html +153 -0
- package/templates/dashboard/serve.sh +10 -0
- package/templates/hooks/pre-commit-cm-task-check +67 -0
- package/templates/pixel/cm-pixel.html +388 -0
- package/templates/pixel/cm-pixel.sh +212 -0
- package/templates/pixel/dev/README.md +20 -0
- package/templates/pixel/dev/atlas-preview.png +0 -0
- package/templates/pixel/dev/build.py +55 -0
- package/templates/pixel/dev/sheets/roguelikeChar_transparent.png +0 -0
- package/templates/pixel/dev/sheets/roguelikeCity_tilemap.png +0 -0
- package/templates/pixel/dev/sheets/roguelikeIndoor_transparent.png +0 -0
- package/templates/pixel/dev/template.html +388 -0
- package/templates/pixel/serve.sh +12 -0
- package/templates/refactor/cm-refactor-denies.json +14 -0
- package/templates/rules/backend-api.md +36 -0
- package/templates/rules/coding-style.md +44 -0
- package/templates/rules/database.md +27 -0
- package/templates/rules/finance.md +32 -0
- package/templates/rules/frontend.md +32 -0
- package/templates/rules/git-workflow.md +25 -0
- package/templates/rules/miniprogram.md +31 -0
- package/templates/rules/security.md +31 -0
- package/templates/rules/smart-contract.md +28 -0
- package/templates/rules/testing.md +36 -0
- package/templates/statusline/cm-statusline.sh +73 -0
- package/templates/ui-lens/cm-ui-lens-extract.mjs +55 -0
|
@@ -0,0 +1,206 @@
|
|
|
1
|
+
import test from 'node:test';
|
|
2
|
+
import assert from 'node:assert/strict';
|
|
3
|
+
import fs from 'node:fs';
|
|
4
|
+
import os from 'node:os';
|
|
5
|
+
import path from 'node:path';
|
|
6
|
+
import {PassThrough,Writable} from 'node:stream';
|
|
7
|
+
import {recordCmAiQaDecision,recordCmAiQaRun} from '../runtime/js/cm-ai/cm-ai-qa-log.mjs';
|
|
8
|
+
import {readHostQaFixHandoff} from '../runtime/js/cm-ai/host-qa-fix.mjs';
|
|
9
|
+
import {openExecutionStore} from '../runtime/js/cm-ai/execution-store.mjs';
|
|
10
|
+
import {createQaFixOwnerHost} from '../runtime/js/cm-ai/host-qa-fix-owner.mjs';
|
|
11
|
+
import {openFixExecution} from '../runtime/js/cm-fix/execution.mjs';
|
|
12
|
+
import {qaFixIdentity,inspectFixQaSource} from '../runtime/js/cm-fix/qa-source.mjs';
|
|
13
|
+
import {main} from './cm-fix-host.mjs';
|
|
14
|
+
import {digest} from '../runtime/js/cm-ai/effect-contract.mjs';
|
|
15
|
+
import {bindQaFixDefinition} from '../runtime/js/cm-ai/qa-fix-definition.mjs';
|
|
16
|
+
|
|
17
|
+
for(const mode of ['normal','diagnosis drift','parent dispatch','parent cancel','parent observation'])
|
|
18
|
+
test(`QA child uses original owner lock, bound failure and explicit CLI authority: ${mode}`,async()=>{
|
|
19
|
+
const drift=mode==='diagnosis drift';
|
|
20
|
+
const root=fs.realpathSync(fs.mkdtempSync(path.join(os.tmpdir(),'fix-qa-source-')));
|
|
21
|
+
const specsRoot=path.join(root,'specs'),cwd=path.join(root,'code'),logHome=path.join(root,'logs');
|
|
22
|
+
fs.mkdirSync(path.join(specsRoot,'.reviews'),{recursive:true});fs.mkdirSync(cwd);
|
|
23
|
+
const parent={repositoryId:'qa-parent',runId:'qa-parent-run',taskId:'T-001',attempt:2};
|
|
24
|
+
const binding={specsDir:specsRoot,codeProject:cwd,feature:'1.work',identity:parent,packageDigest:'a'.repeat(64)};
|
|
25
|
+
const report=path.join(specsRoot,'.reviews','qa-failure.md');fs.writeFileSync(report,'Synthetic QA FAIL');
|
|
26
|
+
recordCmAiQaDecision({...binding,logHome,decision:{decisionId:'qa-decision',identity:parent,
|
|
27
|
+
packageDigest:binding.packageDigest,status:'triggered',reason:'fixture',score:null,at:'2026-09-08T01:00:00Z'}});
|
|
28
|
+
const qa={...binding,mode:'commands',caseCount:1,testRunId:'qa-round-1',logHome};
|
|
29
|
+
recordCmAiQaRun({...qa,phase:'start'});
|
|
30
|
+
recordCmAiQaRun({...qa,phase:'complete',result:{result:'FAIL',passed:0,failed:1,blocked:0,report}});
|
|
31
|
+
const handoff=readHostQaFixHandoff({...binding,testRunId:qa.testRunId});
|
|
32
|
+
const qaSource={feature:binding.feature,identity:parent,packageDigest:binding.packageDigest,
|
|
33
|
+
testRunId:qa.testRunId,handoffDigest:handoff.handoffDigest};
|
|
34
|
+
const identity=qaFixIdentity(qaSource);
|
|
35
|
+
const configuration={hostContextId:'qa-host',qaSource,defect:'Synthetic failure',
|
|
36
|
+
reproduction:{cwd,command:[process.execPath,'-e',"console.error('BUG');process.exit(1)"],
|
|
37
|
+
expectedFailure:{exitCode:1,outputIncludes:'BUG'},timeoutMs:2000}};
|
|
38
|
+
if(mode.startsWith('parent ')){
|
|
39
|
+
if(mode==='parent observation')configuration.reproduction.command=[process.execPath,'-e','process.exit(0)'];
|
|
40
|
+
fs.writeFileSync(path.join(cwd,'red.mjs'),"console.error('BUG');process.exit(1)");
|
|
41
|
+
fs.writeFileSync(path.join(cwd,'existing.mjs'),'process.exit(0)');
|
|
42
|
+
configuration.redTest={cwd,testFiles:['red.mjs'],command:[process.execPath,'red.mjs'],expectedFailure:{exitCode:1,outputIncludes:'BUG'},timeoutMs:2000};
|
|
43
|
+
configuration.baseline={cwd,testFiles:['existing.mjs'],commands:[{id:'existing',command:[process.execPath,'existing.mjs']}],timeoutMs:2000};
|
|
44
|
+
}
|
|
45
|
+
const options={specsRoot,identity,configuration,create:true};let parentOwner,child;
|
|
46
|
+
try{
|
|
47
|
+
const {qaSource:ignored,...templateConfiguration}=configuration;
|
|
48
|
+
const template={specsRoot,feature:binding.feature,identity:parent,configuration:templateConfiguration};
|
|
49
|
+
const bind=testRunId=>bindQaFixDefinition({template,identity:parent,packageDigest:binding.packageDigest,testRunId});
|
|
50
|
+
const logSnapshot=fs.readFileSync(path.join(specsRoot,'运行日志.jsonl'));
|
|
51
|
+
assert.deepEqual(bind(qa.testRunId),{specsRoot,identity,configuration});
|
|
52
|
+
assert.deepEqual(bindQaFixDefinition({template:{...template,identity:{...parent,attempt:1}},
|
|
53
|
+
identity:parent,packageDigest:binding.packageDigest,testRunId:qa.testRunId}),{specsRoot,identity,configuration});
|
|
54
|
+
assert.deepEqual(fs.readFileSync(path.join(specsRoot,'运行日志.jsonl')),logSnapshot);
|
|
55
|
+
assert.equal(fs.existsSync(path.join(specsRoot,'.reviews','.execution',identity.runId)),false);
|
|
56
|
+
assert.throws(()=>bindQaFixDefinition({template,identity:{...parent,runId:'wrong'},packageDigest:binding.packageDigest,testRunId:qa.testRunId}),{code:'qa_fix_source_mismatch'});
|
|
57
|
+
const other=path.join(root,'other');fs.mkdirSync(other);
|
|
58
|
+
assert.throws(()=>inspectFixQaSource({...options,configuration:{...configuration,
|
|
59
|
+
reproduction:{...configuration.reproduction,cwd:other}}}),{code:'fix_qa_project_mismatch'});
|
|
60
|
+
assert.equal(identity.attempt,1);assert.notEqual(identity.runId,parent.runId);
|
|
61
|
+
assert.deepEqual(qaFixIdentity({...qaSource,handoffDigest:'b'.repeat(64)}),identity);
|
|
62
|
+
assert.throws(()=>openFixExecution({...options,identity:{...identity,runId:'replacement'}}),{code:'fix_qa_identity_mismatch'});
|
|
63
|
+
parentOwner=openExecutionStore({specsRoot,identity:{repositoryId:parent.repositoryId,runId:parent.runId},create:true,
|
|
64
|
+
fingerprints:{workflow:'a'.repeat(64),config:'b'.repeat(64),inputs:'c'.repeat(64)}});
|
|
65
|
+
assert.throws(()=>openFixExecution(options));
|
|
66
|
+
assert.equal(fs.existsSync(path.join(specsRoot,'.reviews','.execution',identity.runId)),false);
|
|
67
|
+
parentOwner.close();parentOwner=null;
|
|
68
|
+
const file=path.join(root,'fix.json');
|
|
69
|
+
const {hostContextId,...data}=configuration;fs.writeFileSync(file,JSON.stringify({specsRoot,identity,...data}));
|
|
70
|
+
const args=['serve','--config',file,'--mode','create','--host-context',hostContextId,'--allow-reproduction'];
|
|
71
|
+
const quiet=new Writable({write(c,e,cb){cb();}});
|
|
72
|
+
assert.equal(await main(args,{error:quiet}),1);
|
|
73
|
+
assert.equal(fs.existsSync(path.join(specsRoot,'.reviews','.execution',identity.runId)),false);
|
|
74
|
+
if(mode.startsWith('parent ')){
|
|
75
|
+
let calls=0,reopens=0;
|
|
76
|
+
const openParent=()=>{
|
|
77
|
+
parentOwner=openExecutionStore({specsRoot,identity:{repositoryId:parent.repositoryId,runId:parent.runId},create:false,
|
|
78
|
+
fingerprints:{workflow:'a'.repeat(64),config:'b'.repeat(64),inputs:'c'.repeat(64)}});
|
|
79
|
+
const store=parentOwner;
|
|
80
|
+
return {host:{handle:async()=>({state:'fixture_completed',identity:parent,packageDigest:binding.packageDigest})},close:()=>store.close()};
|
|
81
|
+
};
|
|
82
|
+
const request={version:1,requestId:'start-fix',operation:'fix_advance',identity:parent,
|
|
83
|
+
packageDigest:binding.packageDigest,testRunId:qa.testRunId};
|
|
84
|
+
const denied=createQaFixOwnerHost({parent:openParent(),reopenParent:openParent,fix:{specsRoot,identity,configuration}});
|
|
85
|
+
await assert.rejects(denied.handle(request),{code:'qa_fix_start_authorization_required'});
|
|
86
|
+
assert.equal(fs.existsSync(path.join(specsRoot,'.reviews','.execution',identity.runId)),false);
|
|
87
|
+
denied.close();parentOwner=null;
|
|
88
|
+
const serial=createQaFixOwnerHost({parent:openParent(),reopenParent:()=>{reopens++;return openParent();},
|
|
89
|
+
fix:{specsRoot,identity,configuration},allowStart:true,fixPermissions:['--allow-red-test','--allow-baseline','--allow-finish'],fixExecution:{
|
|
90
|
+
prepare:async()=>({files:[],contextDigest:digest([]),application:{contextDigest:digest([]),status:'no_relevant_lesson',summary:'Fixture'}}),
|
|
91
|
+
bridge:{async call(kind,payload){
|
|
92
|
+
assert.equal(kind,'fix_diagnose');calls++;
|
|
93
|
+
await assert.rejects(serial.handle({operation:'cancel'}));
|
|
94
|
+
await assert.rejects(serial.handle({version:1,requestId:'wrong',operation:'cancel',
|
|
95
|
+
identity:{...parent,runId:'wrong-run'}}),{code:'qa_fix_source_mismatch'});
|
|
96
|
+
const control={version:1,requestId:'control',operation:'status',identity:parent};
|
|
97
|
+
assert.equal((await serial.handle(control)).code,'qa_fix_active');
|
|
98
|
+
if(mode==='parent cancel')assert.equal((await serial.handle({...control,operation:'cancel'})).fix.stage,'cancelled');
|
|
99
|
+
assert.equal(Buffer.from(payload.qaFailure.report.contentBase64,'base64').toString(),'Synthetic QA FAIL');
|
|
100
|
+
return {status:'diagnosed',rootCause:'Synthetic failure',affectedPaths:['value.mjs'],affectedModules:['value'],
|
|
101
|
+
plan:'Repair after original red test',crossLayer:false};
|
|
102
|
+
}}}});
|
|
103
|
+
try{
|
|
104
|
+
const expected=mode==='parent cancel'?'cancelled':mode==='parent observation'?'observation':'red_test_required';
|
|
105
|
+
assert.equal((await serial.handle(request)).fixStage,expected);
|
|
106
|
+
assert.equal((await serial.handle(request)).fixStage,expected);
|
|
107
|
+
assert.equal(calls,mode==='parent observation'?0:1);assert.equal(reopens,2);
|
|
108
|
+
if(mode==='parent observation'){
|
|
109
|
+
const result=await serial.handle({...request,operation:'fix_action',fixOperation:'finish'});
|
|
110
|
+
assert.equal(result.code,'qa_fix_incomplete');assert.equal(result.actionResult.observationRunEnded,true);
|
|
111
|
+
assert.equal(result.evidence,undefined);assert.equal(reopens,3);
|
|
112
|
+
const events=fs.readFileSync(path.join(specsRoot,'运行日志.jsonl'),'utf8').trim().split('\n').map(JSON.parse);
|
|
113
|
+
assert.equal(events.filter(row=>row.workflow==='cm-fix'&&row.event==='run_done'&&row.result==='observing').length,1);
|
|
114
|
+
}
|
|
115
|
+
if(mode==='parent dispatch'){
|
|
116
|
+
const action={...request,operation:'fix_action',fixOperation:'red_test'};
|
|
117
|
+
await assert.rejects(serial.handle({...action,authorized:true}));
|
|
118
|
+
assert.equal((await serial.handle(action)).fixStage,'baseline_required');
|
|
119
|
+
assert.equal((await serial.handle({...action,fixOperation:'baseline'})).fixStage,'repair_required');
|
|
120
|
+
assert.equal(reopens,4);
|
|
121
|
+
await assert.rejects(serial.handle({...action,fixOperation:'repair'}));
|
|
122
|
+
}
|
|
123
|
+
const events=fs.readFileSync(path.join(specsRoot,'运行日志.jsonl'),'utf8').trim().split('\n').map(JSON.parse);
|
|
124
|
+
assert.equal(events.filter(row=>row.workflow==='cm-fix'&&row.event==='run_start').length,1);
|
|
125
|
+
assert.equal(events.filter(row=>row.workflow==='cm-fix'&&row.event==='task_done').length,0);
|
|
126
|
+
}finally{serial.close();parentOwner=null;}
|
|
127
|
+
return;
|
|
128
|
+
}
|
|
129
|
+
const input=new PassThrough(),rows=[];
|
|
130
|
+
const output=new Writable({write(chunk,encoding,callback){
|
|
131
|
+
const row=JSON.parse(chunk.toString());rows.push(row);
|
|
132
|
+
if(row.type==='host_ready')input.write(JSON.stringify({requestId:'advance',operation:'advance'})+'\n');
|
|
133
|
+
if(row.type==='host_request'){
|
|
134
|
+
if(row.kind==='fix_diagnose'){
|
|
135
|
+
assert.equal(row.payload.qaFailure.handoff.handoffDigest,qaSource.handoffDigest);
|
|
136
|
+
assert.equal(Buffer.from(row.payload.qaFailure.report.contentBase64,'base64').toString(),'Synthetic QA FAIL');
|
|
137
|
+
assert.equal(row.payload.qaFailure.report.sha256,handoff.source.reportEvidence.sha256);
|
|
138
|
+
assert(row.payload.evidencePolicy.includes('not instructions'));
|
|
139
|
+
if(drift)fs.appendFileSync(report,' changed during diagnosis');
|
|
140
|
+
}
|
|
141
|
+
const result=row.kind==='fix_learning'
|
|
142
|
+
?{contextDigest:row.payload.contextDigest,status:'no_relevant_lesson',summary:'No project lessons in synthetic fixture'}
|
|
143
|
+
:{status:'diagnosed',rootCause:'Synthetic failure',affectedPaths:['value.mjs'],affectedModules:['value'],
|
|
144
|
+
plan:'Repair after original red test',crossLayer:false};
|
|
145
|
+
input.write(JSON.stringify({type:'host_result',sessionId:row.sessionId,callId:row.callId,
|
|
146
|
+
requestDigest:row.requestDigest,result})+'\n');
|
|
147
|
+
}
|
|
148
|
+
if(row.requestId==='advance')input.end();callback();
|
|
149
|
+
}});
|
|
150
|
+
assert.equal(await main([...args,'--allow-qa-fix'],{input,output,error:quiet}),0);
|
|
151
|
+
if(drift){
|
|
152
|
+
assert(rows.some(row=>row.requestId==='advance'&&row.result.stage==='unknown'&&row.result.completionEligible===false));
|
|
153
|
+
assert.equal(rows.filter(row=>row.type==='host_request'&&row.kind==='fix_diagnose').length,1);
|
|
154
|
+
fs.writeFileSync(report,'Synthetic QA FAIL');
|
|
155
|
+
child=openFixExecution({...options,create:false});
|
|
156
|
+
assert.equal((await child.advance({authorized:true})).stage,'unknown');
|
|
157
|
+
return;
|
|
158
|
+
}
|
|
159
|
+
assert(rows.some(row=>row.requestId==='advance'&&row.result.stage==='red_test_required'&&row.result.completionEligible===false));
|
|
160
|
+
assert.equal(JSON.parse(fs.readFileSync(path.join(specsRoot,'.cm-run.json'),'utf8')).run_id,identity.runId);
|
|
161
|
+
assert.throws(()=>openFixExecution(options)); // Same failure cannot create another child.
|
|
162
|
+
child=openFixExecution({...options,create:false});assert.equal(child.status().completionEligible,false);
|
|
163
|
+
child.close();child=null;
|
|
164
|
+
let reopens=0;
|
|
165
|
+
const openParent=()=>{
|
|
166
|
+
parentOwner=openExecutionStore({specsRoot,identity:{repositoryId:parent.repositoryId,runId:parent.runId},create:false,
|
|
167
|
+
fingerprints:{workflow:'a'.repeat(64),config:'b'.repeat(64),inputs:'c'.repeat(64)}});
|
|
168
|
+
const store=parentOwner;
|
|
169
|
+
// Synthetic parent status; both writer locks and child owner are real.
|
|
170
|
+
return {host:{handle:async()=>({state:'fixture_completed',identity:parent,packageDigest:binding.packageDigest})},close:()=>store.close()};
|
|
171
|
+
};
|
|
172
|
+
const serial=createQaFixOwnerHost({parent:openParent(),fix:{specsRoot,identity,configuration},
|
|
173
|
+
reopenParent:()=>{reopens++;return openParent();}});
|
|
174
|
+
const check={version:1,requestId:'fix-status',operation:'fix_status',identity:parent,
|
|
175
|
+
packageDigest:binding.packageDigest,testRunId:qa.testRunId};
|
|
176
|
+
const logBefore=fs.readFileSync(path.join(specsRoot,'运行日志.jsonl'));
|
|
177
|
+
assert.deepEqual(await serial.handle(check),{outcome:'blocked',code:'qa_fix_incomplete',fixStage:'red_test_required'});
|
|
178
|
+
assert.equal(reopens,1);
|
|
179
|
+
await assert.rejects(serial.handle({...check,testRunId:'different-qa'}),{code:'qa_fix_source_mismatch'});
|
|
180
|
+
assert.equal(reopens,1);
|
|
181
|
+
fs.appendFileSync(report,' stale');
|
|
182
|
+
await assert.rejects(serial.handle(check),{code:'fix_qa_source_changed'});
|
|
183
|
+
assert.equal(reopens,2); // Failure also restores the parent writer.
|
|
184
|
+
fs.writeFileSync(report,'Synthetic QA FAIL');
|
|
185
|
+
assert.equal((await serial.handle({operation:'status'})).state,'fixture_completed');
|
|
186
|
+
assert.deepEqual(fs.readFileSync(path.join(specsRoot,'运行日志.jsonl')),logBefore);
|
|
187
|
+
serial.close();parentOwner=null;
|
|
188
|
+
fs.appendFileSync(report,' changed');
|
|
189
|
+
assert.throws(()=>inspectFixQaSource(options),{code:'fix_qa_source_changed'});
|
|
190
|
+
assert.throws(()=>openFixExecution({...options,create:false}),{code:'fix_qa_source_changed'});
|
|
191
|
+
fs.writeFileSync(report,'Synthetic QA FAIL');
|
|
192
|
+
recordCmAiQaRun({...qa,testRunId:'qa-round-2',qaRound:2,phase:'start'});
|
|
193
|
+
// Historical reads are for completed children, never an unfinished repair.
|
|
194
|
+
assert.throws(()=>openFixExecution({...options,create:false}),{code:'qa_result_stale'});
|
|
195
|
+
assert.throws(()=>bind(qa.testRunId),{code:'qa_result_stale'});
|
|
196
|
+
assert.throws(()=>bind('qa-round-2'),{code:'qa_result_incomplete'});
|
|
197
|
+
recordCmAiQaRun({...qa,testRunId:'qa-round-2',qaRound:2,phase:'complete',result:{result:'FAIL',passed:0,failed:1,blocked:0,report}});
|
|
198
|
+
const second=bind('qa-round-2');
|
|
199
|
+
assert.notEqual(second.identity.runId,identity.runId);
|
|
200
|
+
const {qaSource:secondSource,...secondConfiguration}=second.configuration;
|
|
201
|
+
assert.deepEqual(secondConfiguration,templateConfiguration);assert.equal(secondSource.testRunId,'qa-round-2');
|
|
202
|
+
recordCmAiQaRun({...qa,testRunId:'qa-round-3',qaRound:3,phase:'start'});
|
|
203
|
+
recordCmAiQaRun({...qa,testRunId:'qa-round-3',qaRound:3,phase:'complete',result:{result:'FAIL',passed:0,failed:1,blocked:0,report}});
|
|
204
|
+
assert.throws(()=>bind('qa-round-3'),{code:'fix_qa_source_blocked'});
|
|
205
|
+
}finally{child?.close();parentOwner?.close();fs.rmSync(root,{recursive:true,force:true});}
|
|
206
|
+
});
|
|
@@ -0,0 +1,143 @@
|
|
|
1
|
+
import test from 'node:test';
|
|
2
|
+
import assert from 'node:assert/strict';
|
|
3
|
+
import fs from 'node:fs';
|
|
4
|
+
import os from 'node:os';
|
|
5
|
+
import path from 'node:path';
|
|
6
|
+
import {openFixExecution} from '../runtime/js/cm-fix/execution.mjs';
|
|
7
|
+
import {openExecutionStore} from '../runtime/js/cm-ai/execution-store.mjs';
|
|
8
|
+
import {redTestFiles} from '../runtime/js/cm-fix/red-test.mjs';
|
|
9
|
+
import {createFixLearningPreparation} from '../runtime/js/cm-fix/learning.mjs';
|
|
10
|
+
import {createHostToolBridge} from '../runtime/js/cm-ai/host-tool-bridge.mjs';
|
|
11
|
+
import {digest} from '../runtime/js/cm-ai/effect-contract.mjs';
|
|
12
|
+
|
|
13
|
+
async function fixture(fn){
|
|
14
|
+
const root=fs.realpathSync(fs.mkdtempSync(path.join(os.tmpdir(),'fix-red-owner-')));
|
|
15
|
+
const cwd=path.join(root,'code'),specsRoot=path.join(root,'specs');fs.mkdirSync(cwd);fs.mkdirSync(specsRoot);
|
|
16
|
+
const identity={repositoryId:'fixture',runId:'red-owner',taskId:'T-FIX-demo',attempt:1};
|
|
17
|
+
fs.writeFileSync(path.join(cwd,'regression.mjs'),"import fs from 'node:fs';fs.appendFileSync('calls','1');console.error('EXPECTED BUG');process.exit(1)");
|
|
18
|
+
const options={specsRoot,identity,create:true,configuration:{hostContextId:'fixture-host',defect:'Synthetic bug',
|
|
19
|
+
reproduction:{cwd,command:[process.execPath,'-e',"console.error('BUG');process.exit(1)"],expectedFailure:{exitCode:1,outputIncludes:'BUG'},timeoutMs:2000},
|
|
20
|
+
redTest:{cwd,testFiles:['regression.mjs'],command:[process.execPath,'regression.mjs'],expectedFailure:{exitCode:1,outputIncludes:'EXPECTED BUG'},timeoutMs:2000}}};
|
|
21
|
+
const bridge={call:async()=>({status:'diagnosed',rootCause:'Wrong constant',affectedPaths:['regression.mjs'],
|
|
22
|
+
plan:'Fix constant',crossLayer:false,affectedModules:['one']})};
|
|
23
|
+
try{await fn(options,bridge,cwd);}finally{fs.rmSync(root,{recursive:true,force:true});}
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
test('red owner persists real execution and verifies restored evidence without re-running',()=>fixture(async(options,bridge,cwd)=>{
|
|
27
|
+
let owner=openFixExecution(options,{bridge});
|
|
28
|
+
try{
|
|
29
|
+
await owner.advance({authorized:true});
|
|
30
|
+
await assert.rejects(owner.runRedTest(),{code:'red_test_authorization_required'});
|
|
31
|
+
assert.equal(fs.existsSync(path.join(cwd,'calls')),false);
|
|
32
|
+
assert.equal((await owner.runRedTest({authorized:true})).stage,'baseline_required');
|
|
33
|
+
const saved=owner.status().redTest;assert.equal(owner.status().completionEligible,false);owner.close();
|
|
34
|
+
owner=openFixExecution({...options,create:false});
|
|
35
|
+
assert.equal((await owner.runRedTest({authorized:true})).stage,'baseline_required');
|
|
36
|
+
assert.equal(fs.readFileSync(path.join(cwd,'calls'),'utf8'),'1');
|
|
37
|
+
const output=path.join(options.specsRoot,saved.output.path),bytes=fs.readFileSync(output);
|
|
38
|
+
fs.unlinkSync(output);assert.equal(owner.status().stage,'red_test_evidence_required');
|
|
39
|
+
assert.equal((await owner.runRedTest({authorized:true})).stage,'red_test_evidence_required');
|
|
40
|
+
fs.writeFileSync(output,bytes,{mode:0o600});assert.equal(owner.status().stage,'baseline_required');
|
|
41
|
+
fs.chmodSync(output,0o644);assert.equal(owner.status().stage,'red_test_evidence_required');fs.chmodSync(output,0o600);
|
|
42
|
+
fs.writeFileSync(output,'tampered');assert.equal(owner.status().stage,'red_test_evidence_required');fs.writeFileSync(output,bytes);
|
|
43
|
+
const source=fs.readFileSync(path.join(cwd,'regression.mjs'));fs.appendFileSync(path.join(cwd,'regression.mjs'),'\n// drift');
|
|
44
|
+
assert.equal(owner.status().stage,'red_test_evidence_required');assert.deepEqual(owner.status().redTest,saved);
|
|
45
|
+
fs.writeFileSync(path.join(cwd,'regression.mjs'),source);assert.equal(owner.status().stage,'baseline_required');
|
|
46
|
+
assert.equal(fs.readFileSync(path.join(cwd,'calls'),'utf8'),'1');
|
|
47
|
+
}finally{owner.close();}
|
|
48
|
+
}));
|
|
49
|
+
|
|
50
|
+
test('red intent without result reopens unknown and never executes again',()=>fixture(async(options,bridge,cwd)=>{
|
|
51
|
+
let owner=openFixExecution(options,{bridge});await owner.advance({authorized:true});owner.close();
|
|
52
|
+
const state=JSON.parse(fs.readFileSync(path.join(options.specsRoot,'.reviews','.execution',options.identity.runId,'state.json')));
|
|
53
|
+
const store=openExecutionStore({specsRoot:options.specsRoot,identity:state.identity,fingerprints:state.fingerprints,create:false});
|
|
54
|
+
store.append({id:'fix-red-test-intent',kind:'intent',payload:{testFiles:redTestFiles(options.configuration.redTest)},expectedRevision:store.snapshot().revision});store.close();
|
|
55
|
+
owner=openFixExecution({...options,create:false});
|
|
56
|
+
try{
|
|
57
|
+
assert.equal((await owner.runRedTest({authorized:true})).stage,'unknown');assert.equal(owner.status().pending,'red_test');
|
|
58
|
+
assert.equal(fs.existsSync(path.join(cwd,'calls')),false);
|
|
59
|
+
}finally{owner.close();}
|
|
60
|
+
}));
|
|
61
|
+
|
|
62
|
+
test('green and unrelated failure never advance red owner to baseline',async()=>{
|
|
63
|
+
for(const command of [[process.execPath,'-e',"console.log('ok')"],[process.execPath,'-e',"console.error('other');process.exit(1)"]]){
|
|
64
|
+
await fixture(async(options,bridge)=>{
|
|
65
|
+
options.configuration.redTest.command=command;const owner=openFixExecution(options,{bridge});
|
|
66
|
+
try{await owner.advance({authorized:true});assert.equal((await owner.runRedTest({authorized:true})).stage,'red_test_not_confirmed');}
|
|
67
|
+
finally{owner.close();}
|
|
68
|
+
});
|
|
69
|
+
}
|
|
70
|
+
});
|
|
71
|
+
|
|
72
|
+
test('red Learning timeout is explicit, cancellation stays cancelled, neither registers or runs',async()=>{
|
|
73
|
+
for(const mode of ['timeout','cancel'])await fixture(async(options,bridge,cwd)=>{
|
|
74
|
+
options.configuration.redTest.timeoutMs=100;
|
|
75
|
+
const learningBridge=createHostToolBridge();let answer=true,requestSeen;
|
|
76
|
+
const pending=new Promise(resolve=>{requestSeen=resolve;});
|
|
77
|
+
learningBridge.attach(row=>{
|
|
78
|
+
if(row.type!=='host_request')return;
|
|
79
|
+
if(!answer){requestSeen();return;}
|
|
80
|
+
learningBridge.accept({type:'host_result',sessionId:row.sessionId,callId:row.callId,requestDigest:row.requestDigest,
|
|
81
|
+
result:{contextDigest:row.payload.contextDigest,status:'no_relevant_lesson',summary:'No relevant lesson'}});
|
|
82
|
+
});
|
|
83
|
+
let owner=openFixExecution(options,{bridge,prepare:createFixLearningPreparation({bridge:learningBridge,codeProject:cwd})});
|
|
84
|
+
try{
|
|
85
|
+
await owner.advance({authorized:true});answer=false;
|
|
86
|
+
const running=owner.runRedTest({authorized:true});await pending;
|
|
87
|
+
if(mode==='cancel'){
|
|
88
|
+
owner.cancel();assert.equal((await running).stage,'cancelled');
|
|
89
|
+
}else await assert.rejects(running,{code:'fix_learning_interrupted'});
|
|
90
|
+
assert.equal(fs.existsSync(path.join(cwd,'calls')),false);
|
|
91
|
+
owner.close();owner=openFixExecution({...options,create:false});
|
|
92
|
+
assert.equal(owner.status().stage,mode==='cancel'?'cancelled':'red_test_required');
|
|
93
|
+
assert.equal(owner.status().pending,null);
|
|
94
|
+
}finally{owner.close();learningBridge.close();}
|
|
95
|
+
});
|
|
96
|
+
});
|
|
97
|
+
|
|
98
|
+
function addBaseline(options,cwd,missing=false){
|
|
99
|
+
fs.writeFileSync(path.join(cwd,'existing.mjs'),"import fs from 'node:fs';fs.appendFileSync('baseline-calls',process.argv[2]);process.exit(Number(process.argv[2]))");
|
|
100
|
+
options.configuration.baseline={cwd,testFiles:['existing.mjs'],timeoutMs:2000,commands:[
|
|
101
|
+
{id:'existing-failure',command:missing?['/nonexistent/cm-fixture']:[process.execPath,'existing.mjs','1']},
|
|
102
|
+
{id:'existing-pass',command:[process.execPath,'existing.mjs','0']}]};
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
test('baseline records existing failure and later passing suite, persists without rerun and checks drift',()=>fixture(async(options,bridge,cwd)=>{
|
|
106
|
+
addBaseline(options,cwd);let owner=openFixExecution(options,{bridge});
|
|
107
|
+
try{
|
|
108
|
+
assert.equal((await owner.captureBaseline({authorized:true})).stage,'reproduce');
|
|
109
|
+
await owner.advance({authorized:true});await owner.runRedTest({authorized:true});
|
|
110
|
+
await assert.rejects(owner.captureBaseline(),{code:'baseline_authorization_required'});
|
|
111
|
+
assert.equal(fs.existsSync(path.join(cwd,'baseline-calls')),false);
|
|
112
|
+
assert.equal((await owner.captureBaseline({authorized:true})).stage,'repair_required');
|
|
113
|
+
const baseline=owner.status().baseline;
|
|
114
|
+
assert.deepEqual(baseline.observations.map(row=>row.outcome),['failed','passed']);
|
|
115
|
+
assert.equal(owner.status().completionEligible,false);owner.close();
|
|
116
|
+
owner=openFixExecution({...options,create:false});
|
|
117
|
+
assert.equal((await owner.captureBaseline({authorized:true})).stage,'repair_required');
|
|
118
|
+
assert.equal(fs.readFileSync(path.join(cwd,'baseline-calls'),'utf8'),'10');
|
|
119
|
+
fs.appendFileSync(path.join(cwd,'existing.mjs'),'\n// drift');
|
|
120
|
+
assert.equal(owner.status().stage,'baseline_evidence_required');assert.deepEqual(owner.status().baseline,baseline);
|
|
121
|
+
}finally{owner.close();}
|
|
122
|
+
}));
|
|
123
|
+
|
|
124
|
+
test('baseline unavailable blocks, and interrupted registered baseline never redispatches',async()=>{
|
|
125
|
+
for(const mode of ['missing','intent'])await fixture(async(options,bridge,cwd)=>{
|
|
126
|
+
addBaseline(options,cwd,mode==='missing');let owner=openFixExecution(options,{bridge});
|
|
127
|
+
await owner.advance({authorized:true});await owner.runRedTest({authorized:true});
|
|
128
|
+
if(mode==='missing'){
|
|
129
|
+
const state=await owner.captureBaseline({authorized:true});assert.equal(state.stage,'baseline_blocked');
|
|
130
|
+
assert.equal(state.baseline.observations.length,1);owner.close();
|
|
131
|
+
}else{
|
|
132
|
+
const redDigest=digest(owner.status().redTest);owner.close();
|
|
133
|
+
const state=JSON.parse(fs.readFileSync(path.join(options.specsRoot,'.reviews','.execution',options.identity.runId,'state.json')));
|
|
134
|
+
const store=openExecutionStore({specsRoot:options.specsRoot,identity:state.identity,fingerprints:state.fingerprints,create:false});
|
|
135
|
+
store.append({id:'fix-baseline-intent',kind:'intent',payload:{testFiles:redTestFiles(options.configuration.baseline),redDigest},expectedRevision:store.snapshot().revision});store.close();
|
|
136
|
+
}
|
|
137
|
+
owner=openFixExecution({...options,create:false});
|
|
138
|
+
try{
|
|
139
|
+
assert.equal((await owner.captureBaseline({authorized:true})).stage,mode==='missing'?'baseline_blocked':'unknown');
|
|
140
|
+
assert.equal(fs.existsSync(path.join(cwd,'baseline-calls')),false);
|
|
141
|
+
}finally{owner.close();}
|
|
142
|
+
});
|
|
143
|
+
});
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import test from 'node:test';
|
|
2
|
+
import assert from 'node:assert/strict';
|
|
3
|
+
import fs from 'node:fs';
|
|
4
|
+
import path from 'node:path';
|
|
5
|
+
import os from 'node:os';
|
|
6
|
+
import {createFixRedTest} from '../runtime/js/cm-fix/red-test.mjs';
|
|
7
|
+
|
|
8
|
+
test('red test executes real regression, saves bounded private output and rejects unrelated failure',async()=>{
|
|
9
|
+
for(const kind of ['red','green','other','missing','oversized']){
|
|
10
|
+
const root=fs.realpathSync(fs.mkdtempSync(path.join(os.tmpdir(),'fix-red-')));
|
|
11
|
+
const cwd=path.join(root,'code'),specsRoot=path.join(root,'specs');fs.mkdirSync(cwd);fs.mkdirSync(specsRoot);fs.mkdirSync(path.join(specsRoot,'.reviews'));
|
|
12
|
+
const identity={repositoryId:'fixture',runId:'red-test-run',taskId:'T-FIX-red',attempt:1};
|
|
13
|
+
const source=kind==='red'?"console.error('AssertionError: expected 2, got 1');process.exit(1)":kind==='green'?"console.log('passed')":
|
|
14
|
+
kind==='oversized'?"process.stderr.write('x'.repeat(200000),()=>process.exit(1))":"console.error('unrelated configuration error');process.exit(1)";
|
|
15
|
+
fs.writeFileSync(path.join(cwd,'regression.mjs'),source);
|
|
16
|
+
const command=kind==='missing'?['/nonexistent/cm-fixture']: [process.execPath,'regression.mjs'];
|
|
17
|
+
const run=createFixRedTest({cwd,testFiles:['regression.mjs'],command,
|
|
18
|
+
expectedFailure:{exitCode:1,outputIncludes:'AssertionError: expected 2, got 1'},timeoutMs:2000},{specsRoot,identity});
|
|
19
|
+
try{
|
|
20
|
+
await assert.rejects(run({identity},{signal:new AbortController().signal,authorized:false}),{code:'red_test_authorization_required'});
|
|
21
|
+
const result=await run({identity},{signal:new AbortController().signal,authorized:true});
|
|
22
|
+
assert.equal(result.status,kind==='red'?'red_confirmed':['missing','oversized'].includes(kind)?'blocked':'not_red');
|
|
23
|
+
assert.equal(result.output.complete,!['missing','oversized'].includes(kind));
|
|
24
|
+
const artifact=path.join(specsRoot,result.output.path),captured=JSON.parse(fs.readFileSync(artifact,'utf8'));
|
|
25
|
+
if(kind==='red')assert.equal(Buffer.from(captured.stderrBase64,'base64').toString(),'AssertionError: expected 2, got 1\n');
|
|
26
|
+
assert(!JSON.stringify(result).includes('stderrBase64'));assert.equal(result.completionEligible,false);
|
|
27
|
+
assert.equal(fs.statSync(artifact).mode&0o777,0o600);
|
|
28
|
+
if(kind==='red'){
|
|
29
|
+
fs.chmodSync(artifact,0o644);
|
|
30
|
+
const repeat=createFixRedTest({cwd,testFiles:['regression.mjs'],command,
|
|
31
|
+
expectedFailure:{exitCode:1,outputIncludes:'AssertionError: expected 2, got 1'},timeoutMs:2000},{specsRoot,identity});
|
|
32
|
+
await assert.rejects(repeat({identity},{signal:new AbortController().signal,authorized:true}),{code:'red_output_permissions'});
|
|
33
|
+
assert.equal(fs.statSync(artifact).mode&0o777,0o644);
|
|
34
|
+
}
|
|
35
|
+
await assert.rejects(run({identity},{signal:new AbortController().signal,authorized:true}),{code:'red_test_already_attempted'});
|
|
36
|
+
}finally{fs.rmSync(root,{recursive:true,force:true});}
|
|
37
|
+
}
|
|
38
|
+
});
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
import test from 'node:test';
|
|
2
|
+
import assert from 'node:assert/strict';
|
|
3
|
+
import fs from 'node:fs';
|
|
4
|
+
import os from 'node:os';
|
|
5
|
+
import path from 'node:path';
|
|
6
|
+
import {createFixRedTest} from '../runtime/js/cm-fix/red-test.mjs';
|
|
7
|
+
import {createFixBaseline} from '../runtime/js/cm-fix/baseline.mjs';
|
|
8
|
+
import {createFixRegression,compareFixBaseline} from '../runtime/js/cm-fix/regression.mjs';
|
|
9
|
+
import {inspectFixRegressionFailure} from '../runtime/js/cm-fix/regression-evidence.mjs';
|
|
10
|
+
|
|
11
|
+
test('real repaired target and existing suites distinguish pass, regression, unresolved failure and unfixed defect',async()=>{
|
|
12
|
+
for(const mode of ['passed','regressed','unresolved','improved','unfixed']){
|
|
13
|
+
const root=fs.realpathSync(fs.mkdtempSync(path.join(os.tmpdir(),'fix-regression-')));
|
|
14
|
+
const cwd=path.join(root,'code'),specsRoot=path.join(root,'specs');fs.mkdirSync(cwd);fs.mkdirSync(specsRoot);fs.mkdirSync(path.join(specsRoot,'.reviews'));
|
|
15
|
+
const identity={repositoryId:'fixture',runId:'regression-run',taskId:'T-FIX-demo',attempt:1};
|
|
16
|
+
const control={authorized:true,signal:new AbortController().signal},request={identity};
|
|
17
|
+
fs.writeFileSync(path.join(cwd,'value.json'),'1');
|
|
18
|
+
fs.writeFileSync(path.join(cwd,'suite-exit.json'),['unresolved','improved'].includes(mode)?'1':'0');
|
|
19
|
+
fs.writeFileSync(path.join(cwd,'red.mjs'),"import fs from 'node:fs';if(JSON.parse(fs.readFileSync('value.json'))!==2){console.error('TARGET BUG');process.exit(1)}");
|
|
20
|
+
fs.writeFileSync(path.join(cwd,'existing.mjs'),"import fs from 'node:fs';process.exit(JSON.parse(fs.readFileSync('suite-exit.json')))");
|
|
21
|
+
const redTest={cwd,testFiles:['red.mjs'],command:[process.execPath,'red.mjs'],expectedFailure:{exitCode:1,outputIncludes:'TARGET BUG'},timeoutMs:2000};
|
|
22
|
+
const baseline={cwd,testFiles:['existing.mjs'],commands:[{id:'existing',command:[process.execPath,'existing.mjs']}],timeoutMs:2000};
|
|
23
|
+
try{
|
|
24
|
+
const redEvidence=await createFixRedTest(redTest,{identity,specsRoot})(request,control);
|
|
25
|
+
const beforeBaseline=await createFixBaseline(baseline)(request,control);
|
|
26
|
+
fs.writeFileSync(path.join(cwd,'value.json'),mode==='unfixed'?'1':'2');
|
|
27
|
+
fs.writeFileSync(path.join(cwd,'suite-exit.json'),['regressed','unresolved'].includes(mode)?'1':'0');
|
|
28
|
+
const run=createFixRegression({identity,specsRoot,redTest,baseline,redEvidence,beforeBaseline});
|
|
29
|
+
await assert.rejects(run(request,{...control,authorized:false}),{code:'regression_authorization_required'});
|
|
30
|
+
const result=await run(request,control);
|
|
31
|
+
assert.equal(result.status,mode==='unresolved'?'inconclusive':mode==='improved'?'passed':mode==='unfixed'?'defect_remaining':mode);
|
|
32
|
+
assert.equal(result.completionEligible,false);
|
|
33
|
+
const failure={identity,packageDigest:'1'.repeat(64),redTest,baseline,beforeBaseline,result};
|
|
34
|
+
const binding={identity,packageDigest:failure.packageDigest,priorHandoff:{status:'ready_for_review',
|
|
35
|
+
verification:[redTest.command,...baseline.commands.map(row=>row.command)].map(command=>({command:JSON.stringify(command),status:'passed'}))}};
|
|
36
|
+
if(['regressed','unfixed'].includes(mode)){
|
|
37
|
+
assert.deepEqual(inspectFixRegressionFailure(failure,binding),failure);
|
|
38
|
+
assert.throws(()=>inspectFixRegressionFailure({...failure,packageDigest:'2'.repeat(64)},binding),{code:'fix_regression_failure_mismatch'});
|
|
39
|
+
const unavailable=structuredClone(failure);
|
|
40
|
+
unavailable.result.baseline.status='blocked';
|
|
41
|
+
Object.assign(unavailable.result.baseline.observations[0],{outcome:'unavailable',exitCode:null});
|
|
42
|
+
unavailable.result.comparison=compareFixBaseline(beforeBaseline,unavailable.result.baseline,baseline);
|
|
43
|
+
unavailable.result.status=mode==='unfixed'?'defect_remaining':'blocked';
|
|
44
|
+
assert.throws(()=>inspectFixRegressionFailure(unavailable,binding),{code:'fix_regression_failure_unavailable'});
|
|
45
|
+
}else assert.throws(()=>inspectFixRegressionFailure(failure,binding),{code:'fix_regression_failure_unavailable'});
|
|
46
|
+
assert.equal(result.comparison.comparisons[0].status,mode==='regressed'?'regressed':mode==='unresolved'?'unresolved_failure':mode==='improved'?'now_passed':'still_passed');
|
|
47
|
+
await assert.rejects(run(request,control),{code:'regression_already_attempted'});
|
|
48
|
+
if(mode==='passed'){
|
|
49
|
+
const changed=structuredClone(result.baseline);changed.observations[0].command.push('different-command');
|
|
50
|
+
assert.throws(()=>compareFixBaseline(beforeBaseline,changed,baseline),{code:'baseline_mismatch'});
|
|
51
|
+
const guarded=createFixRegression({identity,specsRoot,redTest,baseline,redEvidence,beforeBaseline});
|
|
52
|
+
fs.appendFileSync(path.join(cwd,'red.mjs'),'\n// modified test');
|
|
53
|
+
await assert.rejects(guarded(request,control),{code:'red_test_files_changed'});
|
|
54
|
+
}
|
|
55
|
+
}finally{fs.rmSync(root,{recursive:true,force:true});}
|
|
56
|
+
}
|
|
57
|
+
});
|