@aibyzero/cm-workflow 0.16.8 → 0.17.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/.codex-plugin/plugin.json +1 -1
- package/CHANGELOG.md +31 -0
- package/README.md +22 -3
- package/VERSION +1 -1
- package/compat/claude-commands/cm-notify.md +3 -0
- package/docs/cm-control-policy-v2.md +331 -0
- package/docs/execution-optimizations.md +1 -1
- package/docs/external-models.md +3 -3
- package/docs/human-correction.md +5 -5
- package/docs/installation.md +1 -1
- package/docs/js-workflow-control.md +119 -78
- package/docs/next-steps.md +19 -2
- package/docs/untested-branches.md +2 -3
- package/docs/user-guide.md +105 -5
- package/package.json +2 -1
- package/runtime/js/cm-ai/claude-review-stream.mjs +49 -13
- package/runtime/js/cm-ai/cm-ai-conversation-entry.mjs +103 -68
- package/runtime/js/cm-ai/cm-ai-qa-log.mjs +79 -27
- package/runtime/js/cm-ai/code-projects.mjs +4 -1
- package/runtime/js/cm-ai/control-policy.mjs +111 -0
- package/runtime/js/cm-ai/developer-adapter.mjs +7 -0
- package/runtime/js/cm-ai/drive-bootstrap.mjs +11 -8
- package/runtime/js/cm-ai/drive-core.mjs +9 -0
- package/runtime/js/cm-ai/durable-runner-state.mjs +883 -69
- package/runtime/js/cm-ai/effect-abandon-log.mjs +5 -2
- package/runtime/js/cm-ai/effect-contract.mjs +6 -1
- package/runtime/js/cm-ai/external-run-guard.mjs +18 -7
- package/runtime/js/cm-ai/gate-bridge.mjs +4 -4
- package/runtime/js/cm-ai/host-check.mjs +4 -1
- package/runtime/js/cm-ai/host-conversation-execution.mjs +33 -24
- package/runtime/js/cm-ai/host-documentation.mjs +53 -12
- package/runtime/js/cm-ai/host-project-execution.mjs +2 -2
- package/runtime/js/cm-ai/host-qa-executor.mjs +49 -4
- package/runtime/js/cm-ai/host-qa-fix-owner.mjs +53 -9
- package/runtime/js/cm-ai/host-qa-policy.mjs +63 -21
- package/runtime/js/cm-ai/host-review-authority.mjs +2 -2
- package/runtime/js/cm-ai/host-review-file.mjs +1 -1
- package/runtime/js/cm-ai/host-session.mjs +1 -1
- package/runtime/js/cm-ai/host-tool-bridge.mjs +43 -3
- package/runtime/js/cm-ai/host-workflow-capabilities.mjs +21 -10
- package/runtime/js/cm-ai/host.mjs +1 -2
- package/runtime/js/cm-ai/operator-guidance.mjs +89 -3
- package/runtime/js/cm-ai/provider-review-observation.mjs +50 -0
- package/runtime/js/cm-ai/qa-resource-release.mjs +46 -0
- package/runtime/js/cm-ai/qa-round-budget.mjs +13 -0
- package/runtime/js/cm-ai/review-package.mjs +26 -5
- package/runtime/js/cm-ai/reviewed-deliveries.mjs +1 -1
- package/runtime/js/cm-ai/reviewed-evidence-supersede.mjs +1 -1
- package/runtime/js/cm-ai/task-commit.mjs +39 -0
- package/runtime/js/cm-ai/task-runner.mjs +629 -121
- package/runtime/js/cm-ai/worker-claude-developer.mjs +9 -0
- package/runtime/js/cm-ai/worker-claude.mjs +10 -3
- package/runtime/js/cm-ai/worker-process-identity.mjs +43 -0
- package/runtime/js/cm-fix/execution.mjs +176 -48
- package/runtime/js/cm-fix/host.mjs +2 -1
- package/runtime/js/cm-fix/pinned-baseline.mjs +24 -0
- package/runtime/js/cm-fix/progress.mjs +13 -3
- package/runtime/js/cm-fix/protected-edits.mjs +10 -3
- package/runtime/js/cm-fix/repair.mjs +11 -3
- package/runtime/js/cm-fix/test-author.mjs +10 -3
- package/runtime/js/cm-idea/session.mjs +67 -4
- package/runtime/js/cm-init/review-evidence.mjs +3 -1
- package/runtime/js/cm-prd/review-correction.mjs +10 -4
- package/runtime/js/cm-prd/review-host.mjs +1 -1
- package/runtime/js/cm-prd/review-publication.mjs +5 -3
- package/runtime/js/cm-prd/session.mjs +43 -0
- package/runtime/js/cm-refactor/records.mjs +98 -8
- package/runtime/js/cm-refactor/workflow.mjs +80 -10
- package/runtime/js/cm-test/host.mjs +10 -3
- package/runtime/js/cm-test/session.mjs +45 -6
- package/runtime/js/notify-safe-read.mjs +49 -0
- package/runtime/js/notify-send.mjs +313 -0
- package/runtime/js/notify.mjs +164 -37
- package/runtime/js/policy-binding-compat.mjs +55 -0
- package/runtime/review.md +52 -7
- package/runtime/task-gates.md +107 -9
- package/scripts/ci-test-shards.mjs +67 -0
- package/scripts/ci-test-shards.test.mjs +64 -0
- package/scripts/ci-test-weights.json +222 -0
- package/scripts/cm-ai-abandon-effect-position.test.mjs +71 -10
- package/scripts/cm-ai-answer-gap-dispatch.test.mjs +86 -0
- package/scripts/cm-ai-answer-gap-driver.test.mjs +51 -0
- package/scripts/cm-ai-answer-gap-fixture.mjs +89 -0
- package/scripts/cm-ai-answer-gap-recheck.test.mjs +70 -0
- package/scripts/cm-ai-answer-gap-redo.test.mjs +103 -0
- package/scripts/cm-ai-batch-drive.mjs +98 -34
- package/scripts/cm-ai-batch-drive.test.mjs +124 -16
- package/scripts/cm-ai-batch-host.mjs +167 -29
- package/scripts/cm-ai-batch-host.test.mjs +303 -31
- package/scripts/cm-ai-batch-run-fixture.mjs +452 -0
- package/scripts/cm-ai-batch-run-member-stops.test.mjs +26 -0
- package/scripts/cm-ai-batch-run-parallel.test.mjs +7 -0
- package/scripts/cm-ai-batch-run-reschedule.test.mjs +17 -0
- package/scripts/cm-ai-batch-run.mjs +213 -25
- package/scripts/cm-ai-batch-run.test.mjs +21 -341
- package/scripts/cm-ai-bootstrap-flow.test.mjs +1 -7
- package/scripts/cm-ai-bootstrap.test.mjs +2 -3
- package/scripts/cm-ai-control-launch.test.mjs +219 -0
- package/scripts/cm-ai-control-policy.test.mjs +124 -0
- package/scripts/cm-ai-control-v2-drive.test.mjs +270 -0
- package/scripts/cm-ai-develop-answer-invalid.test.mjs +97 -0
- package/scripts/cm-ai-develop-call-timeout.test.mjs +146 -0
- package/scripts/cm-ai-develop-driver-gaps.test.mjs +37 -23
- package/scripts/cm-ai-direct-review.test.mjs +348 -0
- package/scripts/cm-ai-documentation-sync-gap.test.mjs +424 -0
- package/scripts/cm-ai-drive-bootstrap-rules.test.mjs +54 -25
- package/scripts/cm-ai-drive.mjs +142 -58
- package/scripts/cm-ai-drive.test.mjs +70 -84
- package/scripts/cm-ai-fix-integration.test.mjs +3 -5
- package/scripts/cm-ai-fix-later-delivery.test.mjs +3 -6
- package/scripts/cm-ai-fix-run-delivery.test.mjs +3 -6
- package/scripts/cm-ai-host-cli-workflow.test.mjs +267 -0
- package/scripts/cm-ai-host-fixture.mjs +296 -0
- package/scripts/cm-ai-host-protected.test.mjs +253 -0
- package/scripts/cm-ai-host.mjs +122 -100
- package/scripts/cm-ai-host.test.mjs +35 -776
- package/scripts/cm-ai-launch-diagnostics.test.mjs +5 -3
- package/scripts/cm-ai-legacy-history.test.mjs +53 -0
- package/scripts/cm-ai-light-modules.test.mjs +54 -0
- package/scripts/cm-ai-multi-root.test.mjs +4 -4
- package/scripts/cm-ai-nested-execution.test.mjs +16 -19
- package/scripts/cm-ai-operator-guidance.test.mjs +30 -5
- package/scripts/cm-ai-progress.test.mjs +10 -8
- package/scripts/cm-ai-project-qa-gate.test.mjs +37 -10
- package/scripts/cm-ai-protected-scope.test.mjs +8 -5
- package/scripts/cm-ai-qa-answer-gaps.test.mjs +99 -0
- package/scripts/cm-ai-qa-config-revision.test.mjs +1 -9
- package/scripts/cm-ai-qa-fingerprint-config.test.mjs +12 -9
- package/scripts/cm-ai-qa-fix-cross-session.test.mjs +95 -13
- package/scripts/cm-ai-qa-fixed-log.test.mjs +41 -0
- package/scripts/cm-ai-qa-recovery-args.test.mjs +7 -0
- package/scripts/cm-ai-qa-rerun-timeouts.test.mjs +59 -14
- package/scripts/cm-ai-review-drift-precedence.test.mjs +1 -1
- package/scripts/cm-ai-review-failure.test.mjs +137 -32
- package/scripts/cm-ai-review-timeout-config.test.mjs +3 -1
- package/scripts/cm-ai-review-timeout.test.mjs +132 -67
- package/scripts/cm-ai-run.mjs +91 -28
- package/scripts/cm-ai-run.test.mjs +11 -38
- package/scripts/cm-ai-selection-guard.test.mjs +2 -2
- package/scripts/cm-ai-session-chain.test.mjs +18 -15
- package/scripts/cm-ai-spec-rebind.test.mjs +14 -18
- package/scripts/cm-ai-supersede.test.mjs +489 -51
- package/scripts/cm-blocked-reason.test.mjs +2 -3
- package/scripts/cm-capability-gate.test.mjs +33 -1
- package/scripts/cm-check-drive-files.mjs +8 -0
- package/scripts/cm-check-drive.test.mjs +2 -5
- package/scripts/cm-check-runtime.sh +4 -2
- package/scripts/cm-claude-developer-worker.test.mjs +15 -0
- package/scripts/cm-claude-review-stream.test.mjs +21 -16
- package/scripts/cm-claude-review-synthetic.test.mjs +155 -0
- package/scripts/cm-claude-worker.test.mjs +23 -5
- package/scripts/cm-controlled-correction.test.mjs +469 -0
- package/scripts/cm-external-batch-host.test.mjs +30 -11
- package/scripts/cm-external-model-host.test.mjs +1 -1
- package/scripts/cm-external-model-recovery.test.mjs +32 -12
- package/scripts/cm-external-qa-fix.test.mjs +1 -1
- package/scripts/cm-external-review-reconciliation.test.mjs +6 -24
- package/scripts/cm-fix-abandon.test.mjs +163 -10
- package/scripts/cm-fix-drive-unprotected.test.mjs +37 -0
- package/scripts/cm-fix-drive.mjs +25 -7
- package/scripts/cm-fix-host.mjs +8 -7
- package/scripts/cm-fix-review-budget.test.mjs +13 -0
- package/scripts/cm-fix-review-recovery.test.mjs +36 -1
- package/scripts/cm-host-answer-timeout.test.mjs +65 -0
- package/scripts/cm-host-call-kinds.test.mjs +28 -0
- package/scripts/cm-host-documentation.test.mjs +49 -0
- package/scripts/cm-host-qa-executor.test.mjs +23 -12
- package/scripts/cm-host-qa-policy.test.mjs +43 -16
- package/scripts/cm-host-review-authority.test.mjs +0 -31
- package/scripts/cm-idea-answer-gaps.test.mjs +164 -0
- package/scripts/cm-idea-drive.mjs +49 -11
- package/scripts/cm-idea-drive.test.mjs +66 -0
- package/scripts/cm-idea-host.mjs +106 -16
- package/scripts/cm-init-answer-gaps.test.mjs +258 -0
- package/scripts/cm-init-drive.mjs +41 -7
- package/scripts/cm-init-host.mjs +61 -12
- package/scripts/cm-knowledge-closeout.test.mjs +3 -3
- package/scripts/cm-log-event.mjs +21 -10
- package/scripts/cm-notify-command.test.mjs +936 -0
- package/scripts/cm-notify-read-drift.test.mjs +270 -0
- package/scripts/cm-notify.mjs +481 -0
- package/scripts/cm-notify.test.mjs +312 -23
- package/scripts/cm-patrol.test.mjs +3 -2
- package/scripts/cm-prd-answer-gaps.test.mjs +216 -0
- package/scripts/cm-prd-drive.mjs +18 -5
- package/scripts/cm-prd-drive.test.mjs +15 -0
- package/scripts/cm-prd-host.mjs +37 -4
- package/scripts/cm-prd-review-disposition.test.mjs +6 -1
- package/scripts/cm-prd-review-gate.mjs +56 -0
- package/scripts/cm-refactor-answer-gaps.test.mjs +206 -0
- package/scripts/cm-refactor-drive.mjs +52 -8
- package/scripts/cm-refactor-drive.test.mjs +44 -0
- package/scripts/cm-refactor-host.test.mjs +10 -6
- package/scripts/cm-release-smoke.sh +2 -0
- package/scripts/cm-task-gate-correction.test.mjs +69 -16
- package/scripts/cm-task-gate.mjs +368 -34
- package/scripts/cm-task-gate.py +2 -0
- package/scripts/cm-task-gate.test.mjs +252 -4
- package/scripts/cm-test-answer-gaps.test.mjs +151 -0
- package/scripts/cm-test-drive.mjs +21 -5
- package/scripts/fixtures/bootstrap-review-runner.mjs +1 -7
- package/scripts/fixtures/claude-review-process.mjs +1 -1
- package/scripts/fixtures/native-gate-fixture.mjs +18 -0
- package/scripts/policy-binding-compat.test.mjs +103 -0
- package/scripts/scan-public-safety.py +4 -0
- package/scripts/validate-public-repo.py +4 -0
- package/skills/cm-ai/SKILL.md +8 -6
- package/skills/cm-ai/references/N3-execute-task.md +17 -2
- package/skills/cm-ai/references/N4-review.md +11 -21
- package/skills/cm-ai/references/N5-mark-done.md +1 -1
- package/skills/cm-ai/references/N6-qa-eval.md +49 -21
- package/skills/cm-ai/references/js-host-modes.md +35 -14
- package/skills/cm-ai/references/js-host-qa-recovery.md +85 -11
- package/skills/cm-ai/references/js-host-recovery.md +181 -21
- package/skills/cm-ai/references/js-host.md +76 -32
- package/skills/cm-check/SKILL.md +3 -3
- package/skills/cm-fix/SKILL.md +12 -0
- package/skills/cm-fix/references/js-host.md +44 -5
- package/skills/cm-idea/references/js-host.md +27 -2
- package/skills/cm-init/references/js-host.md +17 -4
- package/skills/cm-notify/SKILL.md +34 -0
- package/skills/cm-prd/references/js-change-recovery.md +35 -1
- package/skills/cm-prd/references/js-host.md +1 -1
- package/skills/cm-refactor/SKILL.md +12 -0
- package/skills/cm-refactor/references/js-host.md +17 -0
- package/skills/cm-test/references/js-host.md +14 -1
package/scripts/cm-fix-host.mjs
CHANGED
|
@@ -7,7 +7,7 @@ import {fileURLToPath} from 'node:url';
|
|
|
7
7
|
import {openFixExecution} from '../runtime/js/cm-fix/execution.mjs';
|
|
8
8
|
import {createFixHost} from '../runtime/js/cm-fix/host.mjs';
|
|
9
9
|
import {createFixLearningPreparation} from '../runtime/js/cm-fix/learning.mjs';
|
|
10
|
-
import {createHostToolBridge} from '../runtime/js/cm-ai/host-tool-bridge.mjs';
|
|
10
|
+
import {createHostToolBridge,HOST_ANSWER_BACKSTOP_MS} from '../runtime/js/cm-ai/host-tool-bridge.mjs';
|
|
11
11
|
import {serveCmAiHost,parseHostInputLimit,inputLimitReason} from '../runtime/js/cm-ai/host-session.mjs';
|
|
12
12
|
import {id,json,need,shape,digest} from '../runtime/js/cm-ai/effect-contract.mjs';
|
|
13
13
|
import {readConversationReviewConfiguration} from './cm-ai-host.mjs';
|
|
@@ -21,10 +21,11 @@ export async function main(argv=process.argv.slice(2),{input=process.stdin,outpu
|
|
|
21
21
|
if(argv.length===1&&['--help','-h'].includes(argv[0]))output.write('Omit specsRoot or use null for a bare project: the same owner stores archives in docs/fixes and reviews in docs/fixes/.reviews, uses the original no-specs log mode, and skips METRICS. No specs skeleton is created. Visual-only reproduction/redTest may use kind:visual with cwd, timeoutMs, before:{path,sha256,kind:screenshot|video,description}, reason explaining why automated red cannot be written, environment, steps and expected; redTest also has testFiles:[]. No testAuthor or fake red/green command. Repair/regression/review/finish permissions remain mandatory. qa_browser returns actual after carrier metadata; missing evidence blocks.\n');
|
|
22
22
|
if(argv.length===1&&['--help','-h'].includes(argv[0]))output.write('Optional startup configuration protectSpecs:true uses the existing Codex native sandbox for reproduction, red/baseline/regression/walkthrough commands and fixed text edits, without a model call. Requires the local sandbox executable; it does not change the current Codex/Claude host or reviewer identity. Original action permissions remain required. fix_test_author/fix_repair with editMode=protected-text-v1 require {outcome,edits:[{path,beforeSha256,content}]} using the supplied scope/expected hashes; never write directly. Content is full UTF-8 text or null for deletion, blocked requires edits:[]. Default 64KiB response limit applies; --input-limit may explicitly raise transport to 4MiB, while protected text proposal limits remain 1MiB. Drift or failed writes retain the original unknown boundary; no automatic retry/rollback or protection-mode switching on resume.\n');
|
|
23
23
|
if(argv.length===1&&['--help','-h'].includes(argv[0]))output.write('completion_evidence is read-only and available only after the original finish has completed and current evidence still validates. It returns the selected attempt, original reviewed package, handoff/review digests, completion event IDs and optional qaSource from the original owner. It does not complete or resume a parent task; JSON evidence alone is not authority.\n');
|
|
24
|
-
if(argv.length===1&&['--help','-h'].includes(argv[0]))output.write('recover_final_review requires --allow-final-review-recovery and exact latest invocationId/packageDigest, previousInvocationStopped:true, and a nonempty reason. The legacy first continuation remains once-only. A further continuation additionally requires a fresh startup --final-review-recovery-invocation ID matching the latest unknown invocation, authorizing exactly one new call. Confirm the previous process stopped; this is a trusted host acknowledgment, not an automatic liveness check. Preparation dispatches nothing. Later final_review requires recovery permission and --allow-final-review; additional cycles require the same invocation binding after restart. Old records, task attempt, reviewed package and the original Review/N5/finish remain unchanged. No automatic retry, cancelled/complete-verdict recovery,
|
|
25
|
-
if(argv.length===1&&['--help','-h'].includes(argv[0]))output.write('rediagnose requires --allow-rediagnosis, the original resumed run at rediagnosis_required and a nonempty single-line reason up to 1000 UTF-8 bytes. It appends one history-bound diagnosis without repeating reproduction or overwriting cause-r1. A fresh cause review must publish cause-r2 even for a revised single-layer cause. Second rejection reaches rediagnosis_review_limit_reached. Interrupted rediagnosis or its review is not automatically retried or abandoned.
|
|
26
|
-
if(argv.length===1&&['--help','-h'].includes(argv[0]))output.write('abandon_step requires --allow-abandon, stage unknown, an eligible local pending kind, and a nonempty single-line reason up to 1000 UTF-8 bytes. It records the abandoned intent and returns to the required stage; a later separate action redoes the step. At most eight abandonments per run. Review, Learning writeback and handoff remain unavailable.\n');
|
|
27
|
-
if(argv.length===1&&['--help','-h'].includes(argv[0]))output.write('
|
|
24
|
+
if(argv.length===1&&['--help','-h'].includes(argv[0]))output.write('recover_final_review requires --allow-final-review-recovery and exact latest invocationId/packageDigest, previousInvocationStopped:true, and a nonempty reason. The legacy first continuation remains once-only. A further continuation additionally requires a fresh startup --final-review-recovery-invocation ID matching the latest unknown invocation, authorizing exactly one new call. Confirm the previous process stopped; this is a trusted host acknowledgment, not an automatic liveness check. Preparation dispatches nothing. Later final_review requires recovery permission and --allow-final-review; additional cycles require the same invocation binding after restart. Old records, task attempt, reviewed package and the original Review/N5/finish remain unchanged. A first final review whose worker never opened a thread may be recovered at most twice in total. No automatic retry, cancelled/complete-verdict recovery, business-revision recovery or source-drift bypass. status adds a read-only progress projection, not authorization or current-source verification.\n');
|
|
25
|
+
if(argv.length===1&&['--help','-h'].includes(argv[0]))output.write('rediagnose requires --allow-rediagnosis, the original resumed run at rediagnosis_required and a nonempty single-line reason up to 1000 UTF-8 bytes. It appends one history-bound diagnosis without repeating reproduction or overwriting cause-r1. A fresh cause review must publish cause-r2 even for a revised single-layer cause. Second rejection reaches rediagnosis_review_limit_reached. Interrupted rediagnosis or its review is not automatically retried or abandoned. A QA-fix child reaches the same operation through the parent cm-ai-host fix_action with --allow-qa-fix-rediagnosis.\n');
|
|
26
|
+
if(argv.length===1&&['--help','-h'].includes(argv[0]))output.write('abandon_step requires --allow-abandon, stage unknown, an eligible local pending kind, and a nonempty single-line reason up to 1000 UTF-8 bytes. It records the abandoned intent and returns to the required stage; a later separate action redoes the step. At most eight abandonments per run. Review, Learning writeback and handoff remain unavailable. A redone test author or repair keeps the baseline its first intent captured (baselinePinned), so the residue of the abandoned attempt is reviewed; in protected mode the scope must first be restored to that baseline (fix_protected_residue lists the paths).\n');
|
|
27
|
+
if(argv.length===1&&['--help','-h'].includes(argv[0]))output.write('rerun_blocked_step requires --allow-rerun-blocked-step and a nonempty single-line reason up to 1000 UTF-8 bytes. Only for a legitimate blocked verdict of test_author, repair, regression (including visual BLOCKED/inconclusive), post-review regression or walkthrough (and their revision_ forms): it records fix-blocked-rerun-N, keeps the blocked result as history and returns to the required stage; at most two reruns per step kind.\n');
|
|
28
|
+
if(argv.length===1&&['--help','-h'].includes(argv[0]))output.write('abandon_review requires its own --allow-abandon-review flag (not --allow-abandon) and the same reason rules. Each run may abandon each cause review round twice (the first round and the post-rediagnosis round 2 separately) and the second-round final review twice, only while that registered review has no review result (interrupted, timed out, disconnected or cancelled); confirm the old reviewer stopped first. It records the abandoned invocation and returns to the review stage; the retry needs the original review flag, a fresh grant and a new reviewer thread. Reviews wait for the review configuration timeoutMs (default 900000), not the reproduction timeout.\n');
|
|
28
29
|
if(argv.length===1&&['--help','-h'].includes(argv[0]))output.write('N6 child configuration may include qaSource {feature, identity, packageDigest, testRunId, handoffDigest}; derive the separate fixed child identity with qaFixIdentity. It requires --allow-qa-fix in addition to existing action flags. Close the parent host first: the original specs-wide owner lock is shared. Creation/resume rechecks the current failed round, project, report and policy; the source is bound to the original fix configuration. This does not resume the parent or automatically rerun QA, and does not authorize provider calls, installation or Git.\n');
|
|
29
30
|
if(argv.length===1&&['--help','-h'].includes(argv[0]))output.write('Second-round retrospective uses the cumulative original baseline, including previously authored tests and Learning scope. It persists the current round reflection and reaches revision_handoff_ready or revision_learning_writeback_required; neither state completes the task or publishes a new handoff. From revision_handoff_ready, handoff publishes a separate a2 handoff containing cumulative changes, current reflection, original red evidence and prior review/Learning history; final_review_package then reads that bound package. Pending Learning blocks publication. final_review requires --allow-final-review, uses fresh-thread exclusions and carries prior findings; publish_review writes the original r2 evidence and review log, and check_n5 runs the original Learning-aware gate. Approval reaches revision_post_review_regression_required, not completion.\n');
|
|
30
31
|
if(argv.length===1&&['--help','-h'].includes(argv[0]))output.write('prepare_revision requires --allow-repair and either a published first-round changes_requested review or an approved first-round review followed by a package-bound walkthrough result of failed. The latter preserves the approved verdict and carries separate walkthrough failure evidence; passed, blocked, unknown, or drifted evidence cannot authorize this repair. An approved first-round review followed by package-bound post-review regression defect_remaining or regressed can also prepare the second repair when all baseline commands produced complete results. The regression commands must match the first reviewed handoff; passed, inconclusive, unavailable or partial evidence is refused. Regression and walkthrough failure feedback are mutually exclusive and neither replaces the next independent review. It rereads project Learning and persists the second-round preparation in the original store, preserving first-round evidence. repair then uses the original business scope and findings with separate second-round records. regression requires --allow-regression and reruns the original test commands against the second repair, preserving the original red evidence. Success reaches revision_handoff_required, not completion; handoff and final_review use the second-round package; review evidence publication and N5 are connected; post_review_regression requires --allow-regression and reaches revision_closeout_required after the original checks; walkthrough requires --allow-walkthrough and binds the second-round package and identity; finish reuses the original closeout with --allow-finish, preserving first-round history and recording completion for attempt 2. Second-round learning_writeback requires --allow-learning-writeback, includes the resulting AGENTS.md in the cumulative review package and preserves prior Learning history; pending or unknown writeback cannot advance to handoff. A lost repair or regression result stays unknown and is not redispatched.\n');
|
|
@@ -36,7 +37,7 @@ export async function main(argv=process.argv.slice(2),{input=process.stdin,outpu
|
|
|
36
37
|
need(['create','resume'].includes(argv[4]),'invalid_arguments');id(argv[6]);
|
|
37
38
|
const extra=new Map();
|
|
38
39
|
for(let index=8;index<argv.length;index++){
|
|
39
|
-
const flag=argv[index];need(!extra.has(flag)&&['--execution-optimizations','--external-models','--external-models-config','--runtime','--input-limit','--review-config','--original-host-context','--final-review-recovery-invocation','--allow-qa-fix','--allow-rediagnosis','--allow-cause-review','--allow-final-review','--allow-final-review-recovery','--allow-abandon','--allow-abandon-review','--allow-red-test','--allow-baseline','--allow-test-author','--allow-repair','--allow-regression','--allow-learning-writeback','--allow-walkthrough','--allow-finish'].includes(flag),'invalid_arguments');
|
|
40
|
+
const flag=argv[index];need(!extra.has(flag)&&['--execution-optimizations','--external-models','--external-models-config','--runtime','--input-limit','--review-config','--original-host-context','--final-review-recovery-invocation','--allow-qa-fix','--allow-rediagnosis','--allow-cause-review','--allow-final-review','--allow-final-review-recovery','--allow-abandon','--allow-abandon-review','--allow-rerun-blocked-step','--allow-red-test','--allow-baseline','--allow-test-author','--allow-repair','--allow-regression','--allow-learning-writeback','--allow-walkthrough','--allow-finish'].includes(flag),'invalid_arguments');
|
|
40
41
|
if(flag.startsWith('--allow-')||flag==='--external-models'||flag==='--execution-optimizations')extra.set(flag,true);
|
|
41
42
|
else{need(typeof argv[index+1]==='string'&&!argv[index+1].startsWith('--'),'invalid_arguments');extra.set(flag,argv[++index]);}
|
|
42
43
|
}
|
|
@@ -76,7 +77,7 @@ export async function main(argv=process.argv.slice(2),{input=process.stdin,outpu
|
|
|
76
77
|
const {reviewer,authority,finalAuthority,execution:reviewExecution}=createFixReviewHost({
|
|
77
78
|
codeProject:config.reproduction.cwd,hostContextId:argv[6],runtime,review,
|
|
78
79
|
permissions:[...extra.keys()],workerFactory:reviewWorkerFactory,externalModels,executionPolicy,specsDir:config.specsRoot??null});
|
|
79
|
-
bridge=createHostToolBridge({responseLimit:inputLimit});
|
|
80
|
+
bridge=createHostToolBridge({responseLimit:inputLimit,answerTimeoutMs:HOST_ANSWER_BACKSTOP_MS});
|
|
80
81
|
owner=openFixExecution({specsRoot:config.specsRoot??null,identity:config.identity,create:argv[4]==='create',
|
|
81
82
|
hostContextId:argv[6],
|
|
82
83
|
configuration:{...(executionPolicy?{executionPolicy}:{}),...(externalModels?{externalModels}:{}),hostContextId:originalHostContext??argv[6],defect:config.defect,reproduction:config.reproduction,
|
|
@@ -145,3 +145,16 @@ test('#15 the cm-ai driver forwards the QA-fix abandon_review reason inside fix_
|
|
|
145
145
|
assert.deepEqual(buildCmAiDriveRequest('fix_action',plan,{identity}),{version:1,identity,packageDigest:plan.packageDigest,
|
|
146
146
|
testRunId:plan.testRunId,fixOperation:'abandon_review',reason:plan.reason});
|
|
147
147
|
});
|
|
148
|
+
|
|
149
|
+
test('Q23 the cm-ai driver forwards the new QA-fix recovery fields inside fix_action',()=>{
|
|
150
|
+
const identity={repositoryId:'r',runId:'run',taskId:'T-1',attempt:1},base={packageDigest:'a'.repeat(64),testRunId:'qa-run'};
|
|
151
|
+
for(const fixOperation of ['rediagnose','rerun_blocked_step'])
|
|
152
|
+
assert.deepEqual(buildCmAiDriveRequest('fix_action',{...base,fixOperation,reason:'理由'},{identity}),
|
|
153
|
+
{version:1,identity,...base,fixOperation,reason:'理由'});
|
|
154
|
+
const recover={...base,fixOperation:'recover_final_review',invocationId:'final-1',reviewPackageDigest:'b'.repeat(64),
|
|
155
|
+
previousInvocationStopped:true,reason:'旧审查已停'};
|
|
156
|
+
assert.deepEqual(buildCmAiDriveRequest('fix_action',recover,{identity}),{version:1,identity,...base,fixOperation:'recover_final_review',
|
|
157
|
+
reason:'旧审查已停',invocationId:'final-1',reviewPackageDigest:'b'.repeat(64),previousInvocationStopped:true});
|
|
158
|
+
assert.deepEqual(buildCmAiDriveRequest('fix_action',{...base,fixOperation:'revision_test_check'},{identity}),
|
|
159
|
+
{version:1,identity,...base,fixOperation:'revision_test_check'});
|
|
160
|
+
});
|
|
@@ -35,6 +35,7 @@ async function fixture(t,mode){
|
|
|
35
35
|
const workerFactory=()=>async({prompt},{onEvent})=>{
|
|
36
36
|
calls++;const data=JSON.parse(prompt.split('<cm-review-data-json>\n')[1]);
|
|
37
37
|
const thread=calls===1||mode==='reuse-thread'||['reuse-first-thread','revision-reuses-lost-thread'].includes(mode)&&calls===3?'old-thread':`new-thread-${calls}`;
|
|
38
|
+
if(mode==='no-thread-always'||mode==='no-thread'&&calls===1)throw Error('Synthetic loss before any thread');
|
|
38
39
|
onEvent({event:'thread.started',provider_thread:thread});
|
|
39
40
|
if(calls===1&&!['approved','changes_requested'].includes(mode)||mode==='loss-again'
|
|
40
41
|
||['twice-then-success','reuse-first-thread'].includes(mode)&&calls<=2)throw Error('Synthetic lost result');
|
|
@@ -179,7 +180,7 @@ test('one authorized CLI continuation preserves old history and reaches the orig
|
|
|
179
180
|
await resumed.reviewFinal();assert.equal(f.calls(),2);assert.equal(f.repairs(),1);
|
|
180
181
|
});
|
|
181
182
|
|
|
182
|
-
for(const mode of ['loss-again','reuse-thread','approved','changes_requested'])test(`continuation refuses unsafe reuse: ${mode}`,{timeout:
|
|
183
|
+
for(const mode of ['loss-again','reuse-thread','approved','changes_requested'])test(`continuation refuses unsafe reuse: ${mode}`,{timeout:FIXTURE_TIMEOUT_MS},async t=>{
|
|
183
184
|
const f=await fixture(t,mode);
|
|
184
185
|
if(['approved','changes_requested'].includes(mode)){
|
|
185
186
|
await f.cli([f.request],['--allow-final-review-recovery']).then(rows=>assert.equal(rows[0].error.code,'host_request_failed'));
|
|
@@ -196,3 +197,37 @@ for(const mode of ['loss-again','reuse-thread','approved','changes_requested'])t
|
|
|
196
197
|
assert.equal(f.reopen().status().stage,'unknown');assert.equal((await f.owner().reviewFinal()).stage,'unknown');
|
|
197
198
|
assert.equal(f.calls(),2);assert.equal(f.repairs(),1);
|
|
198
199
|
});
|
|
200
|
+
|
|
201
|
+
// V5 (F24): a worker that never opened a thread leaves nothing to exclude; the
|
|
202
|
+
// first final review is still recoverable, at most twice in total.
|
|
203
|
+
test('F24 a first final review lost before any thread is recovered and approved',{timeout:FIXTURE_TIMEOUT_MS},async t=>{
|
|
204
|
+
const f=await fixture(t,'no-thread');
|
|
205
|
+
const lost=f.reopen().status();assert.equal(lost.stage,'unknown');
|
|
206
|
+
assert(!JSON.parse(fs.readFileSync(f.statePath)).records.some(r=>r.id==='fix-final-started'));
|
|
207
|
+
assert.match((await f.cli([op('status')]))[0].result.progress.nextAction,/recover_final_review/);
|
|
208
|
+
const rows=await f.cli([f.request,op('final_review')],['--allow-final-review','--allow-final-review-recovery']);
|
|
209
|
+
for(const row of rows)assert(!row.error,JSON.stringify(row));
|
|
210
|
+
assert.equal(rows.at(-1).result.stage,'final_review_evidence_required');assert.equal(f.calls(),2);
|
|
211
|
+
const authorized=JSON.parse(fs.readFileSync(f.statePath)).records.find(r=>r.id==='fix-final-recovery-authorized').payload;
|
|
212
|
+
assert.equal(authorized.providerThreadId,null);
|
|
213
|
+
});
|
|
214
|
+
test('F24 thread-less recovery stops after two recoveries without changing the store',{timeout:FIXTURE_TIMEOUT_MS},async t=>{
|
|
215
|
+
const f=await fixture(t,'no-thread-always');
|
|
216
|
+
await f.cli([f.request,op('final_review')],['--allow-final-review','--allow-final-review-recovery']);
|
|
217
|
+
assert.equal(f.calls(),2);
|
|
218
|
+
const bound=()=>{const latest=f.reopen().status().finalReviewInvocation;
|
|
219
|
+
return {request:{...f.request,invocationId:latest.invocationId,packageDigest:latest.packageDigest},
|
|
220
|
+
flags:['--allow-final-review-recovery','--final-review-recovery-invocation',latest.invocationId]};};
|
|
221
|
+
const second=bound();
|
|
222
|
+
const rows=await f.cli([second.request,op('final_review')],[...second.flags,'--allow-final-review']);
|
|
223
|
+
assert(!rows[0].error,JSON.stringify(rows[0]));assert.equal(f.calls(),3);assert.equal(f.reopen().status().stage,'unknown');
|
|
224
|
+
const third=bound(),before=fs.readFileSync(f.statePath);
|
|
225
|
+
const refused=await f.cli([third.request],third.flags);
|
|
226
|
+
assert(refused[0].error);assert.deepEqual(fs.readFileSync(f.statePath),before);assert.equal(f.calls(),3);
|
|
227
|
+
const {requestId,operation,...fields}=third.request;
|
|
228
|
+
assert.throws(()=>f.reopen().recoverFinalReview({authorized:true,recoveryInvocationId:third.request.invocationId,...fields}),
|
|
229
|
+
{code:'fix_review_recovery_limit',reason:/无线程恢复已用满 2 次/});
|
|
230
|
+
const status=(await f.cli([op('status')]))[0].result;
|
|
231
|
+
assert.equal(status.progress.blocker,'fix_review_recovery_limit');assert.match(status.progress.nextAction,/新的 runId/);
|
|
232
|
+
assert.deepEqual(fs.readFileSync(f.statePath),before);
|
|
233
|
+
});
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
// R0: every bridge call has a deadline. A call without its own timeoutMs stops
|
|
2
|
+
// at the host answer limit; an answer that arrives after a call was stopped is
|
|
3
|
+
// refused as host_response_late with one diagnostic line.
|
|
4
|
+
import test from 'node:test';
|
|
5
|
+
import assert from 'node:assert/strict';
|
|
6
|
+
import {createHostToolBridge,hostAnswerTimeoutMs,HOST_ANSWER_TIMEOUT_DEFAULT_MS,HOST_ANSWER_TIMEOUT_MAX_MS,
|
|
7
|
+
HOST_ANSWER_BACKSTOP_MS} from '../runtime/js/cm-ai/host-tool-bridge.mjs';
|
|
8
|
+
|
|
9
|
+
test('host answer limit: default 30 minutes, 1-60 minutes from CM_HOST_ANSWER_TIMEOUT_MINUTES, backstop above 60',()=>{
|
|
10
|
+
assert.equal(hostAnswerTimeoutMs({}),HOST_ANSWER_TIMEOUT_DEFAULT_MS);
|
|
11
|
+
assert.equal(HOST_ANSWER_TIMEOUT_DEFAULT_MS,30*60000);
|
|
12
|
+
assert.equal(hostAnswerTimeoutMs({CM_HOST_ANSWER_TIMEOUT_MINUTES:'5'}),5*60000);
|
|
13
|
+
assert.equal(hostAnswerTimeoutMs({CM_HOST_ANSWER_TIMEOUT_MINUTES:'60'}),HOST_ANSWER_TIMEOUT_MAX_MS);
|
|
14
|
+
for(const bad of ['0','61','1.5','x','-1',' 5'])
|
|
15
|
+
assert.throws(()=>hostAnswerTimeoutMs({CM_HOST_ANSWER_TIMEOUT_MINUTES:bad}),{code:'host_answer_timeout_invalid'},bad);
|
|
16
|
+
assert.ok(HOST_ANSWER_BACKSTOP_MS>HOST_ANSWER_TIMEOUT_MAX_MS);
|
|
17
|
+
assert.throws(()=>createHostToolBridge({answerTimeoutMs:HOST_ANSWER_BACKSTOP_MS+1}),{code:'host_answer_timeout_invalid'});
|
|
18
|
+
});
|
|
19
|
+
|
|
20
|
+
test('a call without its own timeout stops at the host answer limit and a late answer is refused with one diagnostic',async()=>{
|
|
21
|
+
const bridge=createHostToolBridge({answerTimeoutMs:1000}),sent=[];
|
|
22
|
+
bridge.attach(value=>{sent.push(value);});
|
|
23
|
+
// The default deadline is unref'd; keep this test process alive while it runs.
|
|
24
|
+
const keep=setInterval(()=>{},100);
|
|
25
|
+
try{
|
|
26
|
+
const started=Date.now();
|
|
27
|
+
await assert.rejects(bridge.call('prd_generate',{fixture:true},new AbortController().signal),{code:'host_request_timeout'});
|
|
28
|
+
assert.ok(Date.now()-started>=900);
|
|
29
|
+
const request=sent.find(row=>row.type==='host_request');assert.ok(request);
|
|
30
|
+
const lines=[],write=process.stderr.write;
|
|
31
|
+
process.stderr.write=(chunk,...rest)=>{lines.push(String(chunk));return true;};
|
|
32
|
+
let late;
|
|
33
|
+
try{late=bridge.accept({type:'host_result',sessionId:request.sessionId,callId:request.callId,
|
|
34
|
+
requestDigest:request.requestDigest,result:{status:'late'}});}
|
|
35
|
+
finally{process.stderr.write=write;}
|
|
36
|
+
assert.deepEqual(late,{accepted:false,code:'host_response_late'});
|
|
37
|
+
const diagnostics=lines.filter(line=>line.includes('host_response_late'));
|
|
38
|
+
assert.equal(diagnostics.length,1);
|
|
39
|
+
assert.deepEqual(JSON.parse(diagnostics[0]),{diagnostic:'host_response_late',kind:'prd_generate',
|
|
40
|
+
callId:request.callId,stoppedBy:'host_request_timeout'});
|
|
41
|
+
// An answer for a call this bridge never issued stays a plain mismatch.
|
|
42
|
+
assert.deepEqual(bridge.accept({type:'host_result',sessionId:request.sessionId,callId:'other',
|
|
43
|
+
requestDigest:request.requestDigest,result:{}}),{accepted:false,code:'host_response_mismatch'});
|
|
44
|
+
}finally{clearInterval(keep);bridge.close();}
|
|
45
|
+
});
|
|
46
|
+
|
|
47
|
+
test('an explicit per-call timeout still wins over the host answer limit',async()=>{
|
|
48
|
+
const bridge=createHostToolBridge({answerTimeoutMs:60000});bridge.attach(()=>{});
|
|
49
|
+
const started=Date.now();
|
|
50
|
+
await assert.rejects(bridge.call('qa_assess',{},new AbortController().signal,{timeoutMs:50}),{code:'host_request_timeout'});
|
|
51
|
+
assert.ok(Date.now()-started<5000);bridge.close();
|
|
52
|
+
});
|
|
53
|
+
|
|
54
|
+
test('a request that first runs project commands waits for the 60-minute maximum, not the general limit',async()=>{
|
|
55
|
+
const bridge=createHostToolBridge({answerTimeoutMs:1000}),sent=[];bridge.attach(value=>{sent.push(value);});
|
|
56
|
+
const keep=setInterval(()=>{},100);
|
|
57
|
+
try{
|
|
58
|
+
const pending=bridge.call('init_verify',{},new AbortController().signal);
|
|
59
|
+
await new Promise(resolve=>setTimeout(resolve,1300));
|
|
60
|
+
const request=sent.find(row=>row.type==='host_request');
|
|
61
|
+
assert.deepEqual(bridge.accept({type:'host_result',sessionId:request.sessionId,callId:request.callId,
|
|
62
|
+
requestDigest:request.requestDigest,result:{ok:true}}),{accepted:true,callId:request.callId});
|
|
63
|
+
assert.deepEqual(await pending,{ok:true});
|
|
64
|
+
}finally{clearInterval(keep);bridge.close();}
|
|
65
|
+
});
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
// O20: every kind a workflow host asks through the real bridge must be on its
|
|
2
|
+
// whitelist; refactor_revise_tests (round-2 judge revision) was missing, so the
|
|
3
|
+
// second refactor round threw host_operation_invalid on every attempt.
|
|
4
|
+
import test from 'node:test';
|
|
5
|
+
import assert from 'node:assert/strict';
|
|
6
|
+
import fs from 'node:fs';
|
|
7
|
+
import path from 'node:path';
|
|
8
|
+
import {fileURLToPath} from 'node:url';
|
|
9
|
+
import {createHostToolBridge,HOST_CALL_KINDS} from '../runtime/js/cm-ai/host-tool-bridge.mjs';
|
|
10
|
+
|
|
11
|
+
const root=path.resolve(path.dirname(fileURLToPath(import.meta.url)),'..');
|
|
12
|
+
test('the real bridge accepts refactor_revise_tests and answers it',async()=>{
|
|
13
|
+
const bridge=createHostToolBridge(),sent=[];bridge.attach(value=>{sent.push(value);});
|
|
14
|
+
try{
|
|
15
|
+
const pending=bridge.call('refactor_revise_tests',{attempt:2},new AbortController().signal);
|
|
16
|
+
await new Promise(resolve=>setImmediate(resolve));
|
|
17
|
+
const request=sent.find(row=>row.type==='host_request');
|
|
18
|
+
assert.equal(request?.kind,'refactor_revise_tests');
|
|
19
|
+
bridge.accept({type:'host_result',sessionId:request.sessionId,callId:request.callId,requestDigest:request.requestDigest,result:{files:[]}});
|
|
20
|
+
assert.deepEqual(await pending,{files:[]});
|
|
21
|
+
}finally{bridge.close();}
|
|
22
|
+
});
|
|
23
|
+
test('every refactor invoke kind in the workflow is a bridge kind',()=>{
|
|
24
|
+
const source=fs.readFileSync(path.join(root,'runtime/js/cm-refactor/workflow.mjs'),'utf8');
|
|
25
|
+
const kinds=[...new Set([...source.matchAll(/invoke\([^,]+,'([a-z_]+)'/g)].map(match=>match[1]))];
|
|
26
|
+
assert.ok(kinds.includes('refactor_revise_tests'),kinds.join(','));
|
|
27
|
+
assert.deepEqual(kinds.filter(kind=>!HOST_CALL_KINDS.includes(kind)),[]);
|
|
28
|
+
});
|
|
@@ -43,3 +43,52 @@ test(`pre-review documentation uses only the final approved task: ${mode}`,async
|
|
|
43
43
|
assert.equal(writes,['later-feature','unapproved-path','cancel'].includes(mode)?0:1);
|
|
44
44
|
}finally{fs.rmSync(root,{recursive:true,force:true});}
|
|
45
45
|
});
|
|
46
|
+
|
|
47
|
+
// Q16/Q17: the adapter reports the developer answer and the documentation start
|
|
48
|
+
// before it asks the sync, names out-of-scope paths, tells an invalid answer from
|
|
49
|
+
// a blocked one, and a documentation-only redo never calls the developer.
|
|
50
|
+
for(const mode of ['journal','invalid','blocked','out-of-scope','redo'])
|
|
51
|
+
test(`documentation sync recovery contract: ${mode}`,async()=>{
|
|
52
|
+
const root=fs.realpathSync(fs.mkdtempSync(path.join(os.tmpdir(),'cm-docs-')));
|
|
53
|
+
try{
|
|
54
|
+
const codeProject=path.join(root,'code'),specsDir=path.join(root,'specs');
|
|
55
|
+
fs.mkdirSync(codeProject);fs.mkdirSync(path.join(specsDir,'1.feature'),{recursive:true});
|
|
56
|
+
fs.writeFileSync(path.join(codeProject,'requirements.md'),'# Requirements\n');
|
|
57
|
+
fs.writeFileSync(path.join(codeProject,'README.md'),'# Before\n');
|
|
58
|
+
fs.writeFileSync(path.join(codeProject,'a.js'),'one\n');
|
|
59
|
+
for(const name of ['requirements.md','design.md'])fs.writeFileSync(path.join(specsDir,'1.feature',name),'# Fixture\n');
|
|
60
|
+
fs.writeFileSync(path.join(specsDir,'1.feature','tasks.md'),'- [ ] T-001: implement\n');
|
|
61
|
+
fs.writeFileSync(path.join(specsDir,'.cm-specs-status'),JSON.stringify({status:'approved',features:['1.feature']}));
|
|
62
|
+
const identity={repositoryId:'docs',runId:'docs-test',taskId:'T-001',attempt:1};
|
|
63
|
+
const request=requestFor({invocationId:'docs-1',identity,role:'developer',provider:'codex',
|
|
64
|
+
requestedModel:'fixture',contextId:'author',payload:{scope:['README.md','a.js'],requirements:[{path:'requirements.md'}],priorReview:null}});
|
|
65
|
+
let developerCalls=0;const events=[];
|
|
66
|
+
const developer={provider:'codex',requestedModel:'fixture',contextId:'author',run:async()=>{
|
|
67
|
+
developerCalls++;
|
|
68
|
+
return {version:1,invocationId:request.invocationId,contextId:'author',provider:'codex',
|
|
69
|
+
effectiveModel:'model-x',status:'succeeded',accepted:true,result:{outcome:'implemented'}};
|
|
70
|
+
}};
|
|
71
|
+
const adapter=withHostDocumentation({developer,specsDir,codeProject,feature:'1.feature',scope:['README.md','a.js'],
|
|
72
|
+
documentationSync:{paths:['README.md'],run:async()=>{
|
|
73
|
+
fs.writeFileSync(path.join(codeProject,'README.md'),'# After\n');
|
|
74
|
+
if(mode==='out-of-scope')fs.writeFileSync(path.join(codeProject,'a.js'),'two\n');
|
|
75
|
+
return mode==='invalid'?{status:'done'}:mode==='blocked'?{status:'blocked'}:{status:'completed'};
|
|
76
|
+
}}});
|
|
77
|
+
const control={signal:new AbortController().signal,onDocumentationSync:event=>events.push(event),
|
|
78
|
+
...(mode==='redo'?{documentationRedo:{result:{outcome:'implemented'},effectiveModel:'model-y'}}:{})};
|
|
79
|
+
if(['journal','redo'].includes(mode)){
|
|
80
|
+
const response=await adapter.run(request,control);
|
|
81
|
+
assert.equal(response.status,'succeeded');assert.equal(response.effectiveModel,mode==='redo'?'model-y':'model-x');
|
|
82
|
+
}else await assert.rejects(adapter.run(request,control),mode==='out-of-scope'?{code:'out_of_scope',message:'out_of_scope: a.js'}
|
|
83
|
+
:{code:mode==='invalid'?'documentation_sync_answer_invalid':'documentation_sync_blocked'});
|
|
84
|
+
assert.equal(developerCalls,mode==='redo'?0:1);
|
|
85
|
+
assert.equal(events.length,1);
|
|
86
|
+
assert.deepEqual(Object.keys(events[0]).sort(),['documents','effectiveModel','othersDigest','result']);
|
|
87
|
+
assert.equal(events[0].documents.length,1);assert.equal(events[0].documents[0].path,'README.md');
|
|
88
|
+
assert.match(events[0].documents[0].sha256,/^[a-f0-9]{64}$/);assert.match(events[0].othersDigest,/^[a-f0-9]{64}$/);
|
|
89
|
+
const {captureDocumentationState}=await import('../runtime/js/cm-ai/host-documentation.mjs');
|
|
90
|
+
const now=captureDocumentationState({root:codeProject,specsRoot:specsDir,identity,paths:['README.md'],requirements:['requirements.md']});
|
|
91
|
+
assert.notEqual(now.documents[0].sha256,events[0].documents[0].sha256,'the sync wrote README.md after the recorded start');
|
|
92
|
+
assert.equal(now.othersDigest===events[0].othersDigest,mode!=='out-of-scope');
|
|
93
|
+
}finally{fs.rmSync(root,{recursive:true,force:true});}
|
|
94
|
+
});
|
|
@@ -84,8 +84,7 @@ for(const transport of ['synchronous','jsonl','coalesced-jsonl'])test(`incident
|
|
|
84
84
|
const seen=[];
|
|
85
85
|
const answer=row=>{
|
|
86
86
|
seen.push(row.kind==='qa_assess'?row.kind:row.payload.case.id);
|
|
87
|
-
if(row.kind==='qa_assess')return {
|
|
88
|
-
changes:{api:false,migration:false,authentication:false,authorization:false,payment:false}};
|
|
87
|
+
if(row.kind==='qa_assess')return {confirmed:true};
|
|
89
88
|
if(row.kind==='qa_logic')return {verdict:'SUPPORTED',evidence:['Synthetic static observation']};
|
|
90
89
|
const artifact=path.join(f.configuration.specsDir,'.reviews',`${row.payload.case.id}.txt`);
|
|
91
90
|
fs.writeFileSync(artifact,'Synthetic browser evidence; no real browser');
|
|
@@ -858,7 +857,9 @@ for(const name of ['evidence','cleanup','environment','timeout','logic','command
|
|
|
858
857
|
'FAIL','mixed-failure','round-limit','superseded-crash','one-shot','metadata-command',
|
|
859
858
|
'legacy-product-blocked','needs-confirmation','command-unavailable','command-exit','declared-command-exit','declared-product-fail',
|
|
860
859
|
'declared-contradicted','declared-after-repair','declared-superseded-crash','declared-blocked','declared-unknown-verdict',
|
|
861
|
-
'logic-confirmation-unavailable','logic-confirmation-insufficient','no-browser-capability'
|
|
860
|
+
'logic-confirmation-unavailable','logic-confirmation-insufficient','no-browser-capability',
|
|
861
|
+
// A browser FAIL the host downgraded to BLOCKED for its evidence: complete row recorded, and report only.
|
|
862
|
+
'downgraded-fail','downgraded-fail-incomplete',...Object.keys(FORGED)])
|
|
862
863
|
test(`completed BLOCKED QA explicit rerun: ${name}`,async()=>{
|
|
863
864
|
const scenario=FORGED[name]??name;
|
|
864
865
|
const {createCmAiConversationEntry}=await import('../runtime/js/cm-ai/cm-ai-conversation-entry.mjs');
|
|
@@ -882,7 +883,7 @@ test(`completed BLOCKED QA explicit rerun: ${name}`,async()=>{
|
|
|
882
883
|
const killed=['command-unavailable','logic-confirmation-unavailable'].includes(scenario);
|
|
883
884
|
if([...(killed?[scenario]:[]),...exits].includes(scenario))f.configuration.commands[0].command=[process.execPath,'-e',
|
|
884
885
|
`require('node:fs').existsSync(${JSON.stringify(ready)})||${killed?'process.kill(process.pid,"SIGKILL")':'process.exit(65)'}`];
|
|
885
|
-
const failLike=['FAIL','declared-product-fail'].includes(scenario),contradicted=['mixed-failure','declared-contradicted'].includes(scenario);
|
|
886
|
+
const failLike=['FAIL','declared-product-fail','downgraded-fail','downgraded-fail-incomplete'].includes(scenario),contradicted=['mixed-failure','declared-contradicted'].includes(scenario);
|
|
886
887
|
const hostBlocked=['product-blocked','legacy-product-blocked'].includes(scenario);
|
|
887
888
|
let repaired=false,browserCalls=0,logicCalls=0,corrections=0;
|
|
888
889
|
const executor=createHostQaExecutor({...f.configuration,
|
|
@@ -896,7 +897,7 @@ test(`completed BLOCKED QA explicit rerun: ${name}`,async()=>{
|
|
|
896
897
|
if(!repaired&&scenario==='source-drift')fs.appendFileSync(path.join(f.configuration.codeProject,'source.mjs'),'// drift\n');
|
|
897
898
|
if(!repaired&&scenario==='timeout')throw Object.assign(new Error('timeout'),{code:'host_request_timeout'});
|
|
898
899
|
return {verdict:!repaired&&failLike?'FAIL':!repaired&&hostBlocked?'BLOCKED':'PASS',
|
|
899
|
-
evidence:!repaired&&['evidence','source-drift','round-limit','incomplete','superseded-crash','one-shot','mixed-failure','declared-contradicted','metadata-command','declared-blocked'].includes(scenario)
|
|
900
|
+
evidence:!repaired&&['evidence','source-drift','round-limit','incomplete','superseded-crash','one-shot','mixed-failure','declared-contradicted','metadata-command','declared-blocked','downgraded-fail','downgraded-fail-incomplete'].includes(scenario)
|
|
900
901
|
?['not-an-evidence-file']: [artifact],
|
|
901
902
|
environment:!repaired&&scenario==='environment'?{...request.environment,target:'different-target'}:request.environment,
|
|
902
903
|
cleanup:!repaired&&scenario==='cleanup'?'failed':'completed'};
|
|
@@ -908,7 +909,11 @@ test(`completed BLOCKED QA explicit rerun: ${name}`,async()=>{
|
|
|
908
909
|
const formSlip=['evidence','round-limit','superseded-crash','one-shot','mixed-failure',
|
|
909
910
|
'declared-contradicted','metadata-command','declared-blocked'].includes(scenario);
|
|
910
911
|
assert.equal(corrections,formSlip?1:0,scenario);
|
|
911
|
-
|
|
912
|
+
const reportOnly=['incomplete','downgraded-fail-incomplete'].includes(scenario);
|
|
913
|
+
if(scenario.startsWith('downgraded-fail')){assert.equal(result.failed,0);
|
|
914
|
+
const logged=fs.readFileSync(path.join(binding.specsDir,'运行日志.jsonl'),'utf8').trim().split('\n').map(JSON.parse);
|
|
915
|
+
assert.equal(logged.find(row=>row.phase==='case_blocked').answered_verdict,'FAIL');}
|
|
916
|
+
if(!reportOnly)recordCmAiQaRun({...base,phase:'complete',result});
|
|
912
917
|
// Older executors wrote host-declared BLOCKED rows without the marker; those stay ineligible.
|
|
913
918
|
if(scenario==='legacy-product-blocked')fs.writeFileSync(result.report,
|
|
914
919
|
fs.readFileSync(result.report,'utf8').replace(/,\n\s*"hostDeclaredBlocked": true/g,''));
|
|
@@ -931,16 +936,21 @@ test(`completed BLOCKED QA explicit rerun: ${name}`,async()=>{
|
|
|
931
936
|
// A report row outside PASS/FAIL/BLOCKED no longer matches the recorded counts.
|
|
932
937
|
if(scenario==='declared-unknown-verdict')fs.writeFileSync(result.report,
|
|
933
938
|
fs.readFileSync(result.report,'utf8').replace(/("id": "TC-001",[\s\S]*?"verdict": )"FAIL"/,'$1"SKIPPED"'));
|
|
934
|
-
if(
|
|
939
|
+
if(!reportOnly){
|
|
935
940
|
const state=JSON.parse(fs.readFileSync(path.join(binding.specsDir,'.cm-status.json')));
|
|
936
941
|
assert.equal(state.state,result.failed?'qa_failed':'qa_blocked');assert.equal(state.node,'N6');
|
|
937
942
|
assert.equal(state.detail,`QA 结果 ${result.result}(通过 ${result.passed} / 失败 ${result.failed} / 阻断 ${result.blocked})`);
|
|
938
943
|
}
|
|
939
944
|
const log=path.join(binding.specsDir,'运行日志.jsonl'),rows=()=>fs.readFileSync(log,'utf8').trim().split('\n').map(JSON.parse);
|
|
940
|
-
|
|
945
|
+
// Q14: evidence-gap rounds give back at most two rounds, so the cap is round 5.
|
|
946
|
+
if(scenario==='round-limit')for(let round=1;round<5;round++){
|
|
941
947
|
const previous=round===1?testRunId:`blocked-${round}`;
|
|
942
948
|
recordCmAiQaRun({...base,testRunId:previous,qaRound:round,phase:'superseded'});
|
|
943
949
|
recordCmAiQaRun({...base,testRunId:`blocked-${round+1}`,qaRound:round+1,previousTestRunId:previous,phase:'start'});
|
|
950
|
+
// A real rerun logs its own case rows (the durable session verdicts that
|
|
951
|
+
// recovery_rule 3 reads); this synthetic round mirrors round 1's.
|
|
952
|
+
fs.appendFileSync(log,rows().filter(row=>row.operation_id===testRunId&&['case_start','case_blocked'].includes(row.phase))
|
|
953
|
+
.map(row=>JSON.stringify({...row,operation_id:`blocked-${round+1}`,attempt:round+1})+'\n').join(''));
|
|
944
954
|
recordCmAiQaRun({...base,testRunId:`blocked-${round+1}`,qaRound:round+1,phase:'complete',result});
|
|
945
955
|
}
|
|
946
956
|
if(scenario==='declared-superseded-crash')recordCmAiQaRun({...base,phase:'superseded',
|
|
@@ -957,8 +967,8 @@ test(`completed BLOCKED QA explicit rerun: ${name}`,async()=>{
|
|
|
957
967
|
const operation={version:1,operation:'advance',requestId:'rerun-blocked',identity:binding.identity};
|
|
958
968
|
const before=fs.readFileSync(log);
|
|
959
969
|
const without=await createCmAiConversationEntry(options).handle(operation);
|
|
960
|
-
assert.equal(without.code,
|
|
961
|
-
if(!result.failed
|
|
970
|
+
assert.equal(without.code,reportOnly?'qa_execution_unknown':result.failed?'qa_failed':'qa_result_blocked');
|
|
971
|
+
if(!result.failed&&!reportOnly)assert.equal(without.pendingAction,'none');
|
|
962
972
|
assert.deepEqual(fs.readFileSync(log),before);
|
|
963
973
|
if(scenario==='declared-command-exit'){
|
|
964
974
|
// The declaration only travels with the one-shot rerun grant and a superseded row.
|
|
@@ -974,7 +984,8 @@ test(`completed BLOCKED QA explicit rerun: ${name}`,async()=>{
|
|
|
974
984
|
...(scenario.startsWith('declared-')&&scenario!=='declared-superseded-crash'?{qaEnvironmentFailure:'simulator runtime was missing'}:{})});
|
|
975
985
|
if(['commands','legacy-product-blocked','needs-confirmation','source-drift','FAIL','mixed-failure','round-limit','incomplete',
|
|
976
986
|
'command-exit','declared-product-fail','declared-contradicted','declared-after-repair','declared-blocked',
|
|
977
|
-
'declared-unknown-verdict','logic-confirmation-unavailable','logic-confirmation-insufficient','no-browser-capability'
|
|
987
|
+
'declared-unknown-verdict','logic-confirmation-unavailable','logic-confirmation-insufficient','no-browser-capability',
|
|
988
|
+
'downgraded-fail','downgraded-fail-incomplete'].includes(scenario)){
|
|
978
989
|
const rejected=await entry.handle(operation);
|
|
979
990
|
assert.equal(rejected.code,scenario==='round-limit'?'qa_round_invalid':scenario==='incomplete'?'qa_execution_unknown':'qa_rerun_not_blocked_by_evidence');
|
|
980
991
|
assert.deepEqual(fs.readFileSync(log),before);
|
|
@@ -1025,7 +1036,7 @@ test(`completed BLOCKED QA explicit rerun: ${name}`,async()=>{
|
|
|
1025
1036
|
['report',row=>{delete row.commandUnavailable;},'TC-001'],['report',row=>{row.commandEvidence=[];},'TC-001'],
|
|
1026
1037
|
['report',row=>{row.needsConfirmation=true;},'TC-001'],
|
|
1027
1038
|
['report',row=>{row.staticVerdict='CONTRADICTED';},'TC-001'],
|
|
1028
|
-
['log',list=>{list.find(row=>row.phase==='superseded').recovery_rule=
|
|
1039
|
+
['log',list=>{list.find(row=>row.phase==='superseded').recovery_rule=4;}],
|
|
1029
1040
|
['contract',contract=>{contract.cases=contract.cases.filter(item=>item.id!=='TC-001');}]);
|
|
1030
1041
|
// The host-declared BLOCKED needs both the durable log row and the report mirror.
|
|
1031
1042
|
if(scenario==='product-blocked')precise.push(
|
|
@@ -4,26 +4,38 @@ import fs from 'node:fs';
|
|
|
4
4
|
import os from 'node:os';
|
|
5
5
|
import path from 'node:path';
|
|
6
6
|
import {inspectCmAiQaTaskContext} from '../runtime/js/cm-ai/cm-ai-admission.mjs';
|
|
7
|
-
import {createHostQaDecisionProvider,decideHostQaPolicy} from '../runtime/js/cm-ai/host-qa-policy.mjs';
|
|
7
|
+
import {createHostQaDecisionProvider,decideHostQaPolicy,readQaAssessment} from '../runtime/js/cm-ai/host-qa-policy.mjs';
|
|
8
8
|
|
|
9
|
-
const low=()=>({
|
|
10
|
-
|
|
11
|
-
test('N6
|
|
12
|
-
|
|
13
|
-
|
|
9
|
+
const low=()=>({confirmed:true});
|
|
10
|
+
const basePolicy=()=>({changedFiles:['src/ordinary.mjs'],criticalPaths:{},pending:2,mergeEligible:false,unassessedTasks:1});
|
|
11
|
+
test('N6 no_fixed_trigger is skipped with null score, without model risk inputs',()=>{
|
|
12
|
+
assert.deepEqual(decideHostQaPolicy(basePolicy()),{status:'skipped',score:null,reason:'no_fixed_trigger'});
|
|
13
|
+
const input=basePolicy();
|
|
14
14
|
assert.equal(decideHostQaPolicy({...input,pending:0}).reason,'feature_complete');
|
|
15
15
|
assert.equal(decideHostQaPolicy({...input,unassessedTasks:5}).reason,'five_tasks_without_qa');
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
16
|
+
});
|
|
17
|
+
test('N6 registered path matching triggers all categories and bounds API merge',()=>{
|
|
18
|
+
const input=basePolicy();
|
|
19
|
+
for(const name of ['migration','authentication','authorization','payment','api']){
|
|
20
|
+
const criticalPaths={[name]:['src/**/critical?.mjs']};
|
|
21
|
+
assert.deepEqual(decideHostQaPolicy({...input,criticalPaths,changedFiles:['src/critical1.mjs']}),
|
|
22
|
+
{status:'triggered',score:null,reason:name});
|
|
23
|
+
assert.equal(decideHostQaPolicy({...input,criticalPaths,changedFiles:['src/deep/critical2.mjs']}).reason,name);
|
|
24
|
+
assert.equal(decideHostQaPolicy({...input,criticalPaths,changedFiles:['src/critical12.mjs']}).status,'skipped');
|
|
19
25
|
}
|
|
20
|
-
const
|
|
21
|
-
assert.equal(decideHostQaPolicy({...input,
|
|
22
|
-
|
|
23
|
-
assert.equal(decideHostQaPolicy({...input,
|
|
24
|
-
|
|
25
|
-
assert.
|
|
26
|
-
|
|
26
|
+
const criticalPaths={api:['src/api/*'],payment:['src/pay.mjs'],migration:['db/schema.sql']};
|
|
27
|
+
assert.equal(decideHostQaPolicy({...input,criticalPaths,changedFiles:['src/api/a.mjs'],pending:1,mergeEligible:true}).reason,'merged_to_feature_qa');
|
|
28
|
+
assert.equal(decideHostQaPolicy({...input,criticalPaths,changedFiles:['src/api/deep/a.mjs']}).reason,'no_fixed_trigger');
|
|
29
|
+
assert.equal(decideHostQaPolicy({...input,criticalPaths,changedFiles:['db/schema.sql','src/pay.mjs','src/api/a.mjs'],pending:0,unassessedTasks:5}).reason,
|
|
30
|
+
'feature_complete,migration,payment,five_tasks_without_qa,api');
|
|
31
|
+
assert.equal(decideHostQaPolicy({...input,criticalPaths,changedFiles:['src/pay.mjs','src/api/a.mjs'],pending:1,mergeEligible:true}).reason,'payment');
|
|
32
|
+
});
|
|
33
|
+
test('N6 rejects unsafe registry and paths rather than silently missing triggers',()=>{
|
|
34
|
+
const input=basePolicy();
|
|
35
|
+
for(const criticalPaths of [{unknown:['a']},{api:'a'},{api:['../a']},{api:['/a']},{api:['src/{a,b}.mjs']},{api:['src/[ab].mjs']},{api:['src/**x.mjs']},{api:['src\\a.mjs']}])
|
|
36
|
+
assert.throws(()=>decideHostQaPolicy({...input,criticalPaths}));
|
|
37
|
+
for(const changedFiles of [['../a'],['/a'],['a\\b'],['a','a'],['a//b']])
|
|
38
|
+
assert.throws(()=>decideHostQaPolicy({...input,changedFiles}));
|
|
27
39
|
});
|
|
28
40
|
|
|
29
41
|
test('N6 derives consecutive work from original task inventory and QA log without a counter store',async()=>{
|
|
@@ -53,6 +65,15 @@ test('N6 derives consecutive work from original task inventory and QA log withou
|
|
|
53
65
|
const skips=rows.map(row=>({...row,status:'skipped',score:4}));
|
|
54
66
|
fs.writeFileSync(log,[oldCurrent,...skips].map(row=>JSON.stringify(row)).join('\n')+'\n');
|
|
55
67
|
assert.equal((await decide()).reason,'five_tasks_without_qa');assert.equal(seen.at(-1),5);
|
|
68
|
+
const sourced=createHostQaDecisionProvider({timeoutMs:1000,criticalPaths:{payment:['source.js']},assess:async request=>{
|
|
69
|
+
assert.deepEqual(request.changedFiles,{paths:['source.js'],source:'review_package'});
|
|
70
|
+
assert.deepEqual(request.criticalPaths,{payment:['source.js']});
|
|
71
|
+
assert.equal(Object.hasOwn(request,'scores'),false);assert.equal(Object.hasOwn(request,'changes'),false);
|
|
72
|
+
return {confirmed:true};}});
|
|
73
|
+
const sourceBinding={...binding,changedFiles:{paths:['source.js'],source:'review_package'}};
|
|
74
|
+
const sourcedDecision=await sourced.decide(sourceBinding,new AbortController().signal);
|
|
75
|
+
assert.equal(sourcedDecision.reason,'payment,five_tasks_without_qa');assert.equal(sourcedDecision.changedFilesSource,'review_package');
|
|
76
|
+
await assert.rejects(sourced.decide(binding,new AbortController().signal),{code:'qa_policy_unavailable'});
|
|
56
77
|
const stale=createHostQaDecisionProvider({timeoutMs:1000,assess:async()=>{
|
|
57
78
|
fs.writeFileSync(path.join(specsDir,feature,'tasks.md'),'- [x] T-005: task\n');return low();}});
|
|
58
79
|
await assert.rejects(stale.decide(binding,new AbortController().signal),{code:'stale_qa'});
|
|
@@ -91,3 +112,9 @@ test('step30 unseen excludes closed features, includes other open features, and
|
|
|
91
112
|
await decide();assert.equal(seen.at(-1),2);
|
|
92
113
|
}finally{fs.rmSync(root,{recursive:true,force:true});}
|
|
93
114
|
});
|
|
115
|
+
|
|
116
|
+
test('qa_assess confirms only inventory source and rejects self-reported scores or risk flags',()=>{
|
|
117
|
+
assert.deepEqual(readQaAssessment({confirmed:true}),{confirmed:true});
|
|
118
|
+
for(const value of [{confirmed:false},{confirmed:true,scores:{scope:5}},{confirmed:true,changes:{api:true}},
|
|
119
|
+
{scores:{scope:1,risk:1,accumulation:1,boundary:1},changes:{api:false}}])assert.throws(()=>readQaAssessment(value));
|
|
120
|
+
});
|
|
@@ -1,13 +1,11 @@
|
|
|
1
1
|
import test from 'node:test';
|
|
2
2
|
import assert from 'node:assert/strict';
|
|
3
3
|
import {createHostReviewAuthority} from '../runtime/js/cm-ai/host-review-authority.mjs';
|
|
4
|
-
import {createCmAiConversationEntry} from '../runtime/js/cm-ai/cm-ai-conversation-entry.mjs';
|
|
5
4
|
import {validateReviewDispatchGrant} from '../runtime/js/cm-ai/durable-runner-state.mjs';
|
|
6
5
|
import {requestFor} from '../runtime/js/cm-ai/effect-contract.mjs';
|
|
7
6
|
|
|
8
7
|
const identity={repositoryId:'review-host',runId:'run',taskId:'T-001',attempt:1},packageDigest='a'.repeat(64);
|
|
9
8
|
const binding={specsDir:'/specs',codeProject:'/code',feature:'1.work',identity,packageDigest};
|
|
10
|
-
const operation=name=>({version:1,operation:name,requestId:name,identity,...(name==='decision'?{packageDigest}:{})});
|
|
11
9
|
const request=requestFor({invocationId:'actual-request',identity,role:'reviewer',provider:'codex',
|
|
12
10
|
requestedModel:'fixture',contextId:'review-context',payload:{reviewPackage:{packageDigest},priorReview:null}});
|
|
13
11
|
const authority=decide=>createHostReviewAuthority({hostContextId:'host',reviewerId:'reviewer',adapterId:'codex-review-adapter',decide});
|
|
@@ -29,32 +27,3 @@ test('host decision issues one original grant only after the actual request exis
|
|
|
29
27
|
{status:'denied',code:'permission_denied'},mode);
|
|
30
28
|
}
|
|
31
29
|
});
|
|
32
|
-
|
|
33
|
-
for(const mode of ['approved','awaiting','denied','timeout','cancel','drift'])test(`dynamic review decision: ${mode}`,async()=>{
|
|
34
|
-
let current={state:'awaiting_review',code:null,identity,packageDigest},effects=0,started,release;
|
|
35
|
-
const ready=new Promise(resolve=>{started=resolve;});
|
|
36
|
-
const runner={status:()=>current,run:async()=>current,
|
|
37
|
-
cancel:()=>{current={...current,state:'cancelled',code:'cancelled',cancellationRequested:true};return current;},
|
|
38
|
-
executeEffect:async()=>{effects++;return current;}};
|
|
39
|
-
let decisions=0;
|
|
40
|
-
const entry=createCmAiConversationEntry({specsDir:binding.specsDir,codeProject:binding.codeProject,
|
|
41
|
-
feature:binding.feature,identity,runner,hostDecisionProvider:{timeoutMs:mode==='timeout'?10:1000,
|
|
42
|
-
decide:async(got,signal)=>{
|
|
43
|
-
decisions++;assert.deepEqual(got,binding);assert.equal(signal.aborted,false);started();
|
|
44
|
-
if(mode==='cancel'||mode==='timeout')return new Promise(resolve=>{release=resolve;});
|
|
45
|
-
if(mode==='drift')current={...current,packageDigest:'b'.repeat(64)};
|
|
46
|
-
if(mode==='awaiting')return null;
|
|
47
|
-
return mode==='denied'?{status:'denied',code:'permission_denied'}:{status:'approved'};
|
|
48
|
-
}}});
|
|
49
|
-
const running=entry.handle(operation('decision'));await ready;
|
|
50
|
-
if(mode==='cancel')await entry.handle(operation('cancel'));
|
|
51
|
-
const result=await running;
|
|
52
|
-
if(release){release({status:'approved'});await Promise.resolve();}
|
|
53
|
-
assert.equal(effects,mode==='approved'?1:0);
|
|
54
|
-
const expected={approved:null,awaiting:'decision_required',denied:'permission_denied',
|
|
55
|
-
timeout:'review_decision_timeout',cancel:'cancelled',drift:'stale_decision'};
|
|
56
|
-
assert.equal(result.code,expected[mode]);
|
|
57
|
-
current={state:'unknown',code:'reconciliation_required',identity,packageDigest};
|
|
58
|
-
const historical=await entry.handle(operation('decision'));
|
|
59
|
-
assert.equal(historical.state,'unknown');assert.equal(decisions,1,'unknown review must not ask for another decision');
|
|
60
|
-
});
|