@aibyzero/cm-workflow 0.16.7 → 0.16.9
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 +37 -0
- package/README.md +39 -3
- package/VERSION +1 -1
- package/assets/readme/workflow-recovery-detailed.png +0 -0
- package/assets/readme/workflow-stages-detailed.png +0 -0
- package/compat/claude-commands/cm-notify.md +3 -0
- package/docs/installation.md +1 -1
- package/docs/js-workflow-control.md +61 -4
- package/docs/next-steps.md +8 -2
- package/docs/user-guide.md +204 -0
- package/package.json +2 -1
- package/runtime/js/cm-ai/claude-review-stream.mjs +49 -13
- package/runtime/js/cm-ai/cm-ai-admission.mjs +3 -1
- package/runtime/js/cm-ai/cm-ai-conversation-entry.mjs +138 -26
- package/runtime/js/cm-ai/cm-ai-qa-log.mjs +142 -21
- package/runtime/js/cm-ai/code-projects.mjs +4 -1
- package/runtime/js/cm-ai/codex-review-adapter.mjs +2 -1
- package/runtime/js/cm-ai/developer-adapter.mjs +7 -0
- package/runtime/js/cm-ai/drive-core.mjs +26 -4
- package/runtime/js/cm-ai/durable-runner-state.mjs +951 -43
- 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/execution-store.mjs +4 -2
- package/runtime/js/cm-ai/external-run-guard.mjs +18 -7
- package/runtime/js/cm-ai/host-check.mjs +4 -1
- package/runtime/js/cm-ai/host-conversation-execution.mjs +11 -4
- 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 +86 -17
- package/runtime/js/cm-ai/host-qa-fix-owner.mjs +44 -9
- package/runtime/js/cm-ai/host-session.mjs +47 -7
- package/runtime/js/cm-ai/host-tool-bridge.mjs +55 -6
- package/runtime/js/cm-ai/host-workflow-capabilities.mjs +4 -2
- package/runtime/js/cm-ai/operator-guidance.mjs +112 -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-dispatch-limits.mjs +18 -0
- package/runtime/js/cm-ai/review-package.mjs +10 -1
- package/runtime/js/cm-ai/reviewed-deliveries.mjs +29 -6
- 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 +636 -65
- 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/cause-package.mjs +37 -8
- package/runtime/js/cm-fix/diagnosis.mjs +43 -0
- package/runtime/js/cm-fix/execution.mjs +356 -187
- package/runtime/js/cm-fix/host.mjs +2 -1
- package/runtime/js/cm-fix/investigation.mjs +25 -9
- package/runtime/js/cm-fix/pinned-baseline.mjs +24 -0
- package/runtime/js/cm-fix/progress.mjs +15 -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-prd/review-correction.mjs +10 -4
- 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 +79 -9
- package/runtime/js/cm-test/host.mjs +10 -3
- package/runtime/js/cm-test/session.mjs +45 -6
- package/runtime/js/notify-run.mjs +26 -0
- package/runtime/js/notify-safe-read.mjs +49 -0
- package/runtime/js/notify-send.mjs +312 -0
- package/runtime/js/notify.mjs +492 -0
- package/runtime/js/policy-binding-compat.mjs +54 -0
- package/runtime/model-efficiency.md +17 -0
- 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 +70 -2
- 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 +96 -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 +55 -10
- package/scripts/cm-ai-batch-drive.test.mjs +65 -0
- package/scripts/cm-ai-batch-host.mjs +132 -13
- package/scripts/cm-ai-batch-host.test.mjs +255 -7
- package/scripts/cm-ai-batch-run-fixture.mjs +499 -0
- package/scripts/cm-ai-batch-run-member-stops.test.mjs +38 -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 +189 -22
- package/scripts/cm-ai-batch-run.test.mjs +22 -334
- package/scripts/cm-ai-develop-answer-invalid.test.mjs +104 -0
- package/scripts/cm-ai-develop-call-timeout.test.mjs +153 -0
- package/scripts/cm-ai-develop-driver-gaps.test.mjs +4 -3
- package/scripts/cm-ai-documentation-sync-gap.test.mjs +424 -0
- package/scripts/cm-ai-drive.mjs +68 -23
- package/scripts/cm-ai-drive.test.mjs +37 -2
- package/scripts/cm-ai-fix-run-delivery.test.mjs +138 -0
- package/scripts/cm-ai-host-cli-workflow.test.mjs +271 -0
- package/scripts/cm-ai-host-fixture.mjs +268 -0
- package/scripts/cm-ai-host-protected.test.mjs +251 -0
- package/scripts/cm-ai-host.mjs +28 -16
- package/scripts/cm-ai-host.test.mjs +17 -759
- package/scripts/cm-ai-light-modules.test.mjs +57 -0
- package/scripts/cm-ai-operator-guidance.test.mjs +30 -5
- package/scripts/cm-ai-project-qa-gate.test.mjs +71 -4
- package/scripts/cm-ai-protected-scope.test.mjs +7 -3
- package/scripts/cm-ai-qa-answer-gaps.test.mjs +99 -0
- package/scripts/cm-ai-qa-fix-cross-session.test.mjs +78 -11
- package/scripts/cm-ai-qa-rerun-timeouts.test.mjs +127 -8
- package/scripts/cm-ai-review-dispatch-exit.test.mjs +475 -0
- package/scripts/cm-ai-review-failure.test.mjs +124 -13
- package/scripts/cm-ai-review-timeout.test.mjs +188 -10
- package/scripts/cm-ai-run.mjs +15 -6
- package/scripts/cm-ai-supersede.test.mjs +486 -41
- 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 +18 -2
- package/scripts/cm-external-model-recovery.test.mjs +29 -3
- package/scripts/cm-fix-abandon.test.mjs +249 -10
- package/scripts/cm-fix-cause-package.test.mjs +33 -0
- package/scripts/cm-fix-drive-unprotected.test.mjs +37 -0
- package/scripts/cm-fix-drive.mjs +34 -8
- package/scripts/cm-fix-host.mjs +8 -7
- package/scripts/cm-fix-rediagnosis.test.mjs +71 -4
- package/scripts/cm-fix-review-budget.test.mjs +13 -0
- package/scripts/cm-fix-review-recovery.test.mjs +35 -0
- 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 +143 -10
- 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-log-event.mjs +49 -12
- package/scripts/cm-notify-command.test.mjs +900 -0
- package/scripts/cm-notify-read-drift.test.mjs +205 -0
- package/scripts/cm-notify.mjs +469 -0
- package/scripts/cm-notify.test.mjs +685 -0
- package/scripts/cm-patrol.mjs +83 -0
- package/scripts/cm-patrol.test.mjs +161 -0
- 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-test-answer-gaps.test.mjs +151 -0
- package/scripts/cm-test-drive.mjs +21 -5
- package/scripts/cm-token-report.mjs +497 -0
- package/scripts/cm-token-report.test.mjs +346 -0
- package/scripts/fixtures/claude-review-process.mjs +1 -1
- package/scripts/policy-binding-compat.test.mjs +99 -0
- package/scripts/scan-public-safety.py +4 -0
- package/scripts/validate-public-repo.py +4 -0
- package/skills/cm-ai/SKILL.md +7 -3
- package/skills/cm-ai/references/N6-qa-eval.md +2 -2
- package/skills/cm-ai/references/js-host-modes.md +90 -0
- package/skills/cm-ai/references/js-host-qa-recovery.md +136 -0
- package/skills/cm-ai/references/js-host-recovery.md +311 -0
- package/skills/cm-ai/references/js-host.md +76 -331
- package/skills/cm-check/SKILL.md +3 -3
- package/skills/cm-fix/SKILL.md +2 -0
- package/skills/cm-fix/references/js-host.md +56 -10
- package/skills/cm-idea/references/js-host.md +27 -2
- package/skills/cm-init/references/js-host.md +16 -3
- package/skills/cm-notify/SKILL.md +34 -0
- package/skills/cm-prd/SKILL.md +2 -0
- package/skills/cm-prd/references/js-change-recovery.md +35 -1
- package/skills/cm-refactor/references/js-host.md +17 -0
- package/skills/cm-test/references/js-host.md +14 -1
|
@@ -50,9 +50,10 @@ function fixture(t,{browser=false}={}){
|
|
|
50
50
|
fs.writeFileSync(path.join(specsDir,feature,'requirements.md'),'# Fixture\n\n- [AC-001] tab bar shows four tabs\n');
|
|
51
51
|
fs.writeFileSync(path.join(specsDir,feature,'design.md'),'# Fixture\n');
|
|
52
52
|
fs.writeFileSync(path.join(specsDir,feature,'tasks.md'),'- [ ] T-001: fixture\n');
|
|
53
|
-
if(browser)fs.writeFileSync(path.join(specsDir,feature,'test-cases.json'),JSON.stringify({schemaVersion:'1.0',feature:'work',
|
|
54
|
-
{id
|
|
55
|
-
|
|
53
|
+
if(browser)fs.writeFileSync(path.join(specsDir,feature,'test-cases.json'),JSON.stringify({schemaVersion:'1.0',feature:'work',
|
|
54
|
+
cases:Array.from({length:browser===true?1:browser},(_,index)=>({id:`TC-00${index+1}`,origin:'generated',kind:'browser',
|
|
55
|
+
blocking:true,acIds:['AC-001'],taskIds:['T-001'],title:'four tabs',
|
|
56
|
+
preconditions:['UI test'],steps:['launch on simulator'],expected:['four tabs visible'],cleanup:[]}))}));
|
|
56
57
|
const manifest=buildManifest(specsDir);
|
|
57
58
|
fs.writeFileSync(path.join(specsDir,'.cm-specs-status'),JSON.stringify({status:'approved',features:[feature],specFiles:manifest,
|
|
58
59
|
...(browser?{testCases:manifest.filter(item=>item.path.endsWith('/test-cases.json'))}:{})}));
|
|
@@ -109,7 +110,8 @@ function failingStartShim(f){
|
|
|
109
110
|
return dir;
|
|
110
111
|
}
|
|
111
112
|
|
|
112
|
-
// answers[kind] may be a value, a function(row) or 'IGNORE' (never answered)
|
|
113
|
+
// answers[kind] may be a value, a function(row) or 'IGNORE' (never answered);
|
|
114
|
+
// a function may also return 'IGNORE', or 'KILL' to SIGKILL the host mid-call.
|
|
113
115
|
function launch(f,{mode='resume',operation='advance',workflow=null,extra=[],answers={},review=true,pathPrefix=null}={}){
|
|
114
116
|
return new Promise((resolve,reject)=>{
|
|
115
117
|
const args=['serve','--config',f.config,'--mode',mode,'--host-context','session-A','--allow-development',
|
|
@@ -136,6 +138,8 @@ function launch(f,{mode='resume',operation='advance',workflow=null,extra=[],answ
|
|
|
136
138
|
let result;
|
|
137
139
|
try{result=configured===undefined?defaultAnswer(f,row):typeof configured==='function'?configured(row):configured;}
|
|
138
140
|
catch(error){child.kill('SIGKILL');clearTimeout(timer);reject(error);return;}
|
|
141
|
+
if(result==='IGNORE')continue;
|
|
142
|
+
if(result==='KILL'){child.kill('SIGKILL');continue;}
|
|
139
143
|
send({type:'host_result',sessionId:row.sessionId,callId:row.callId,requestDigest:row.requestDigest,result});
|
|
140
144
|
}
|
|
141
145
|
if(row.requestId==='request'&&(row.result||row.error))send({type:'host_close',sessionId});
|
|
@@ -246,19 +250,21 @@ test('#13 a host-declared BLOCKED simulator case re-runs on unchanged code with
|
|
|
246
250
|
assert.deepEqual(testRuns(f,'complete').map(row=>row.result),['BLOCKED','PASS']);
|
|
247
251
|
});
|
|
248
252
|
|
|
249
|
-
|
|
253
|
+
// Q14: rounds ended by a host or environment gap (here a killed command) do not
|
|
254
|
+
// count toward the three-round budget, but at most two are given back per run.
|
|
255
|
+
test('#13 an unavailable QA command (killed, no exit code) re-runs; host-caused rounds give back at most two',POSIX,async t=>{
|
|
250
256
|
const f=fixture(t),workflow=f.workflow('workflow',probeQa());
|
|
251
257
|
f.environment('killed');
|
|
252
258
|
const first=done(await launch(f,{mode:'create',workflow}));
|
|
253
259
|
assert.equal(first.code,'qa_result_blocked',JSON.stringify(first));
|
|
254
|
-
for(let round=2;round<=
|
|
260
|
+
for(let round=2;round<=5;round++){
|
|
255
261
|
const again=done(await launch(f,{workflow,extra:['--rerun-blocked-qa']}));
|
|
256
262
|
assert.equal(again.code,'qa_result_blocked',JSON.stringify(again));
|
|
257
263
|
}
|
|
258
264
|
const exhausted=done(await launch(f,{workflow,extra:['--rerun-blocked-qa']}));
|
|
259
265
|
assert.equal(exhausted.code,'qa_round_invalid',JSON.stringify(exhausted));
|
|
260
|
-
assert.deepEqual(testRuns(f,'start').map(row=>row.attempt),[1,2,3]);
|
|
261
|
-
assert.deepEqual(testRuns(f,'superseded').map(row=>row.blocked_cases),[['probe'],['probe']]);
|
|
266
|
+
assert.deepEqual(testRuns(f,'start').map(row=>row.attempt),[1,2,3,4,5]);
|
|
267
|
+
assert.deepEqual(testRuns(f,'superseded').map(row=>row.blocked_cases),[['probe'],['probe'],['probe'],['probe']]);
|
|
262
268
|
});
|
|
263
269
|
|
|
264
270
|
test('#13 the environment recovers: an unavailable command reaches run_done on the same approved code',POSIX,async t=>{
|
|
@@ -398,3 +404,116 @@ test('#7 decision chain: one linked supersession of a timeout decision, read by
|
|
|
398
404
|
assert.throws(()=>inspectFixQaSource({specsRoot:specsDir,identity:qaFixIdentity(qaSource),configuration}),label);
|
|
399
405
|
}
|
|
400
406
|
});
|
|
407
|
+
|
|
408
|
+
// A QA call stopped as a whole (qa_execution_timeout, or the host gone) leaves no
|
|
409
|
+
// complete and no report. Here the probe command passes and TC-001 gets no session
|
|
410
|
+
// answer within qa.timeoutMs. Q07: the session may still drive the device, so the
|
|
411
|
+
// host stops the call (qa_device_unverified) and never dispatches TC-002.
|
|
412
|
+
async function timedOutCall(t){
|
|
413
|
+
const f=fixture(t,{browser:2}),workflow=f.workflow('workflow',probeQa({environment:simulator,timeoutMs:1500}));
|
|
414
|
+
const browserQa=['--browser-qa','available'];
|
|
415
|
+
const aborted=await launch(f,{mode:'create',workflow,extra:browserQa,
|
|
416
|
+
answers:{qa_browser:row=>row.payload.case.id==='TC-001'?'IGNORE':'KILL'}});
|
|
417
|
+
assert.equal(aborted.asked.filter(kind=>kind==='qa_browser').length,1);
|
|
418
|
+
assert.match(JSON.stringify(aborted),/qa_device_unverified/);
|
|
419
|
+
const recorded=testRuns(f).map(row=>[row.phase,row.case_id]);
|
|
420
|
+
assert.deepEqual(recorded,[['start',undefined],['case_start','TC-001'],['case_blocked','TC-001']]);
|
|
421
|
+
assert.equal(testRuns(f,'case_blocked')[0].host_request_timeout,true);
|
|
422
|
+
return {f,workflow,browserQa};
|
|
423
|
+
}
|
|
424
|
+
const pass=f=>row=>{const file=path.join(f.specsDir,'.reviews',`${row.payload.case.id}.png`);fs.writeFileSync(file,'png');
|
|
425
|
+
return {verdict:'PASS',evidence:[file],environment:row.payload.environment,cleanup:'not_needed'};};
|
|
426
|
+
|
|
427
|
+
test('#26c --rerun-unknown-qa supersedes a call stopped as a whole whose only non-PASS case is a host request timeout',POSIX,async t=>{
|
|
428
|
+
const {f,workflow,browserQa}=await timedOutCall(t);
|
|
429
|
+
const unknown=done(await launch(f,{workflow,extra:browserQa}));
|
|
430
|
+
assert.equal(unknown.code,'qa_execution_unknown');assert.equal(unknown.pendingAction,'reconcile');
|
|
431
|
+
const logBefore=fs.readFileSync(f.log),oldRun=testRuns(f,'start')[0].operation_id;
|
|
432
|
+
// --rerun-blocked-qa needs a completed call; its refusal names the flag that applies.
|
|
433
|
+
const wrong=done(await launch(f,{workflow,extra:[...browserQa,'--rerun-blocked-qa']}));
|
|
434
|
+
assert.equal(wrong.code,'qa_rerun_unknown_qa_required',JSON.stringify(wrong));
|
|
435
|
+
assert(fs.readFileSync(f.log).equals(logBefore));
|
|
436
|
+
const rerun=await launch(f,{workflow,extra:[...browserQa,'--rerun-unknown-qa'],answers:{qa_browser:pass(f)}});
|
|
437
|
+
const result=done(rerun);
|
|
438
|
+
assert.equal(result.state,'run_done',JSON.stringify(result));
|
|
439
|
+
assert(fs.readFileSync(f.log).subarray(0,logBefore.length).equals(logBefore),'history bytes are kept');
|
|
440
|
+
// Every case and command runs again at qaRound+1; no PASS is carried forward.
|
|
441
|
+
assert.deepEqual(rerun.asked.filter(kind=>kind==='qa_browser'),['qa_browser','qa_browser']);
|
|
442
|
+
const [superseded]=testRuns(f,'superseded');
|
|
443
|
+
assert.equal(superseded.operation_id,oldRun);assert.equal(superseded.reason,'host_request_timeout');
|
|
444
|
+
assert.deepEqual([superseded.timed_out_cases,superseded.partial_pass_cases,superseded.request_timeout_ms],[['TC-001'],[],1500]);
|
|
445
|
+
const starts=testRuns(f,'start');
|
|
446
|
+
assert.deepEqual(starts.map(row=>[row.attempt,row.previous_test_run_id]),[[1,undefined],[2,oldRun]]);
|
|
447
|
+
assert.equal(f.rows().filter(row=>row.event==='resource'&&row.phase==='released'&&row.operation_id===starts[1].operation_id).length,1);
|
|
448
|
+
assert.deepEqual(testRuns(f,'complete').map(row=>[row.attempt,row.result]),[[2,'PASS']]);
|
|
449
|
+
assert.equal(done(await launch(f,{workflow,extra:browserQa})).state,'run_done');
|
|
450
|
+
});
|
|
451
|
+
|
|
452
|
+
// Q06/Q11: the call stopped as a whole after the session itself declared a case
|
|
453
|
+
// BLOCKED (or the host judged an evidence gap). That is a host or answer problem,
|
|
454
|
+
// not a product verdict: --rerun-unknown-qa supersedes it with host_blocked_cases
|
|
455
|
+
// and the next round does not count toward the three-round budget (Q14).
|
|
456
|
+
test('#26c a stopped call with a session-declared BLOCKED is superseded and rerun',POSIX,async t=>{
|
|
457
|
+
const {f,workflow,browserQa}=await timedOutCall(t);
|
|
458
|
+
const original=fs.readFileSync(f.log,'utf8');
|
|
459
|
+
fs.writeFileSync(f.log,original.trim().split('\n').map(line=>{const row=JSON.parse(line);
|
|
460
|
+
return JSON.stringify(row.event==='test_run'&&row.phase==='case_blocked'
|
|
461
|
+
?{...row,host_declared_blocked:true,host_request_timeout:false,answered_verdict:'BLOCKED'}:row);}).join('\n')+'\n');
|
|
462
|
+
const unknown=done(await launch(f,{workflow,extra:browserQa}));
|
|
463
|
+
assert.equal(unknown.code,'qa_execution_unknown');
|
|
464
|
+
const rerun=done(await launch(f,{workflow,extra:[...browserQa,'--rerun-unknown-qa'],answers:{qa_browser:pass(f)}}));
|
|
465
|
+
assert.equal(rerun.state,'run_done',JSON.stringify(rerun));
|
|
466
|
+
const [superseded]=testRuns(f,'superseded');
|
|
467
|
+
assert.equal(superseded.reason,'host_request_timeout');
|
|
468
|
+
assert.deepEqual([superseded.timed_out_cases,superseded.host_blocked_cases,superseded.partial_pass_cases],[[],['TC-001'],[]]);
|
|
469
|
+
assert.deepEqual(testRuns(f,'start').map(row=>row.attempt),[1,2]);
|
|
470
|
+
});
|
|
471
|
+
|
|
472
|
+
// The approved contract, not the row, decides [需确认]: an unresolved expectation
|
|
473
|
+
// refuses even when the row claims a host-judged cleanup gap.
|
|
474
|
+
test('#26c the approved contract refuses an unresolved [需确认] case before host-fault eligibility',POSIX,async t=>{
|
|
475
|
+
const {f}=await timedOutCall(t);
|
|
476
|
+
const {inspectCmAiQaRecovery}=await import('../runtime/js/cm-ai/cm-ai-qa-log.mjs');
|
|
477
|
+
const original=fs.readFileSync(f.log,'utf8');
|
|
478
|
+
fs.writeFileSync(f.log,original.trim().split('\n').map(line=>{const row=JSON.parse(line);
|
|
479
|
+
return JSON.stringify(row.event==='test_run'&&row.phase==='case_blocked'
|
|
480
|
+
?{...row,host_request_timeout:false,blocked_reason:'cleanup',answered_verdict:'PASS'}:row);}).join('\n')+'\n');
|
|
481
|
+
const start=testRuns(f,'start')[0];
|
|
482
|
+
const binding={specsDir:f.specsDir,feature:start.feature,packageDigest:start.package_digest,
|
|
483
|
+
identity:{repositoryId:start.repository_id,runId:start.run_id,taskId:start.task,attempt:1}};
|
|
484
|
+
const recovery=inspectCmAiQaRecovery(binding,{timedOut:true,requestTimeoutMs:1500});
|
|
485
|
+
assert.deepEqual([recovery.timedOutCases,recovery.hostBlockedCases],[[],['TC-001']]);
|
|
486
|
+
const source=path.join(f.specsDir,start.feature,'test-cases.json'),contract=JSON.parse(fs.readFileSync(source,'utf8'));
|
|
487
|
+
contract.cases.find(item=>item.id==='TC-001').expected=['[需确认] synthetic expectation'];fs.writeFileSync(source,JSON.stringify(contract));
|
|
488
|
+
assert.throws(()=>inspectCmAiQaRecovery(binding,{timedOut:true,requestTimeoutMs:1500}),{code:'qa_execution_unknown'});
|
|
489
|
+
});
|
|
490
|
+
|
|
491
|
+
test('#26c an undistinguished BLOCKED, a FAIL or an unattested older timeout row still refuses --rerun-unknown-qa',POSIX,async t=>{
|
|
492
|
+
const {f,workflow,browserQa}=await timedOutCall(t);
|
|
493
|
+
const original=fs.readFileSync(f.log,'utf8');
|
|
494
|
+
const variant=edit=>original.trim().split('\n').map(line=>{const row=JSON.parse(line);
|
|
495
|
+
return JSON.stringify(row.event==='test_run'&&row.phase==='case_blocked'?edit(row):row);}).join('\n')+'\n';
|
|
496
|
+
const legacy=(seconds)=>row=>{const {host_request_timeout,...rest}=row;
|
|
497
|
+
const start=testRuns(f,'case_start')[0].at;return {...rest,at:new Date(Date.parse(start)+seconds*1000).toISOString().replace(/\.\d{3}Z$/,'Z')};};
|
|
498
|
+
const attest=['--qa-environment-failure','session gave no TC-001 answer before the deadline'];
|
|
499
|
+
for(const [name,edit,code,extra] of [
|
|
500
|
+
['other BLOCKED',row=>({...row,host_request_timeout:false}),'qa_execution_unknown',attest],
|
|
501
|
+
['unresolved expectation',row=>({...row,host_request_timeout:false,blocked_reason:'needs_confirmation'}),'qa_execution_unknown',attest],
|
|
502
|
+
// A browser FAIL the host downgraded for its evidence stays a product verdict.
|
|
503
|
+
['downgraded FAIL',row=>({...row,host_request_timeout:false,blocked_reason:'evidence',answered_verdict:'FAIL'}),'qa_execution_unknown',attest],
|
|
504
|
+
['host-judged without the session verdict',row=>({...row,host_request_timeout:false,blocked_reason:'cleanup'}),'qa_execution_unknown',attest],
|
|
505
|
+
['FAIL',row=>({...row,phase:'case_complete',result:'FAIL',host_request_timeout:undefined}),'qa_execution_unknown',attest],
|
|
506
|
+
['older row, window not elapsed',legacy(0),'qa_execution_unknown',attest],
|
|
507
|
+
// An older host also wrote this row for a PASS answered near the deadline but
|
|
508
|
+
// downgraded to BLOCKED (cleanup failed, other environment): the time span
|
|
509
|
+
// cannot tell them apart, so only the operator's attestation can.
|
|
510
|
+
['older row, full window, no attestation',legacy(2),'qa_environment_failure_required',[]]]){
|
|
511
|
+
fs.writeFileSync(f.log,variant(edit));const before=fs.readFileSync(f.log);
|
|
512
|
+
const refused=done(await launch(f,{workflow,extra:[...browserQa,'--rerun-unknown-qa',...extra]}));
|
|
513
|
+
assert.equal(refused.code,code,`${name}: ${JSON.stringify(refused)}`);
|
|
514
|
+
assert(fs.readFileSync(f.log).equals(before),name);
|
|
515
|
+
}
|
|
516
|
+
const rerun=done(await launch(f,{workflow,extra:[...browserQa,'--rerun-unknown-qa',...attest],answers:{qa_browser:pass(f)}}));
|
|
517
|
+
assert.equal(rerun.state,'run_done',JSON.stringify(rerun));
|
|
518
|
+
assert.deepEqual(testRuns(f,'superseded').map(row=>[row.timed_out_cases,row.legacy_timeout_attestation]),[[['TC-001'],attest[1]]]);
|
|
519
|
+
});
|