@aibyzero/cm-workflow 0.16.8 → 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 +19 -0
- package/README.md +14 -3
- package/VERSION +1 -1
- package/compat/claude-commands/cm-notify.md +3 -0
- package/docs/installation.md +1 -1
- package/docs/js-workflow-control.md +25 -1
- package/docs/next-steps.md +8 -2
- 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 +111 -20
- package/runtime/js/cm-ai/cm-ai-qa-log.mjs +69 -22
- package/runtime/js/cm-ai/code-projects.mjs +4 -1
- package/runtime/js/cm-ai/developer-adapter.mjs +7 -0
- package/runtime/js/cm-ai/drive-core.mjs +9 -0
- 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/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 +49 -4
- package/runtime/js/cm-ai/host-qa-fix-owner.mjs +44 -9
- package/runtime/js/cm-ai/host-session.mjs +1 -1
- package/runtime/js/cm-ai/host-tool-bridge.mjs +40 -3
- 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-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/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-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-safe-read.mjs +49 -0
- package/runtime/js/notify-send.mjs +312 -0
- package/runtime/js/notify.mjs +137 -33
- package/runtime/js/policy-binding-compat.mjs +54 -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 +184 -22
- package/scripts/cm-ai-batch-run.test.mjs +21 -341
- 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 +64 -22
- package/scripts/cm-ai-drive.test.mjs +29 -2
- 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 +27 -15
- 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-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 +56 -10
- 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 +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 +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 +22 -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 +21 -10
- 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 +221 -4
- 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/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/references/js-host-qa-recovery.md +27 -1
- package/skills/cm-ai/references/js-host-recovery.md +120 -8
- package/skills/cm-ai/references/js-host.md +14 -7
- package/skills/cm-check/SKILL.md +3 -3
- 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 +16 -3
- package/skills/cm-notify/SKILL.md +34 -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
|
@@ -0,0 +1,151 @@
|
|
|
1
|
+
// External answer gaps, batch 3 (O21): in --session-dir mode a refused or lost
|
|
2
|
+
// change_impact/test_cases answer is discarded and asked again (V1); qa_logic and
|
|
3
|
+
// qa_browser also need cleanup:"completed" (V4). Main paths drive cm-test-host.mjs.
|
|
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 os from 'node:os';
|
|
9
|
+
import {spawn,spawnSync} from 'node:child_process';
|
|
10
|
+
import {once} from 'node:events';
|
|
11
|
+
import {createInterface} from 'node:readline';
|
|
12
|
+
import {fileURLToPath} from 'node:url';
|
|
13
|
+
import {openTestSession} from '../runtime/js/cm-test/session.mjs';
|
|
14
|
+
import {digest} from '../runtime/js/cm-ai/effect-contract.mjs';
|
|
15
|
+
const root=fileURLToPath(new URL('..',import.meta.url));
|
|
16
|
+
const item=(id,kind)=>({id,kind,origin:'user',blocking:true,acIds:[],taskIds:[],title:'Synthetic behavior',preconditions:[],steps:['Observe'],expected:['Expected result'],cleanup:[]});
|
|
17
|
+
function fixture(t,{generate=false}={}){
|
|
18
|
+
const temp=fs.realpathSync(fs.mkdtempSync(path.join(os.tmpdir(),'cm-test-gaps-'))),project=path.join(temp,'project');
|
|
19
|
+
fs.mkdirSync(project);t.after(()=>fs.rmSync(temp,{recursive:true,force:true}));
|
|
20
|
+
fs.writeFileSync(path.join(project,'input.mjs'),'export const valid = value => value !== null;\n');
|
|
21
|
+
fs.writeFileSync(path.join(project,'AGENTS.md'),'Synthetic project\n');
|
|
22
|
+
const cases=path.join(temp,'cases.json'),contract={schemaVersion:'1.0',feature:'example',cases:[item('TC-001','logic'),item('TC-002','browser')]};
|
|
23
|
+
fs.writeFileSync(cases,JSON.stringify(contract));
|
|
24
|
+
const config={skillDir:path.join(root,'skills/cm-test'),project,runtime:'codex',
|
|
25
|
+
arguments:generate?{description:'Validation',generateCases:true}:{cases,logic:true,browser:true},sources:['input.mjs','AGENTS.md'],commands:[],
|
|
26
|
+
environment:{scope:'local',kind:'web',carrier:'browser',target:'http://127.0.0.1:3000'},logHome:path.join(temp,'logs')};
|
|
27
|
+
const configPath=path.join(temp,'config.json');fs.writeFileSync(configPath,JSON.stringify(config));
|
|
28
|
+
return {temp,project,config,configPath,contract,directory:path.join(temp,'session')};
|
|
29
|
+
}
|
|
30
|
+
async function client(t,f,respond){
|
|
31
|
+
const child=spawn(process.execPath,[path.join(root,'scripts/cm-test-host.mjs'),'serve','--config',f.configPath,'--session-dir',f.directory],{stdio:['pipe','pipe','pipe']});
|
|
32
|
+
t.after(()=>{if(child.exitCode===null&&!child.killed)child.kill();});
|
|
33
|
+
let sessionId,seq=0,stderr='';const pending=new Map(),closed=once(child,'close'),asked=[];
|
|
34
|
+
let acceptReady,rejectReady;const ready=new Promise((yes,no)=>{acceptReady=yes;rejectReady=no;});
|
|
35
|
+
const send=value=>child.stdin.write(JSON.stringify(value)+'\n');child.stderr.on('data',bytes=>stderr+=bytes);
|
|
36
|
+
createInterface({input:child.stdout}).on('line',line=>{
|
|
37
|
+
const message=JSON.parse(line);
|
|
38
|
+
if(message.type==='host_ready'){sessionId=message.sessionId;acceptReady();}
|
|
39
|
+
else if(message.type==='host_request'){asked.push(message);Promise.resolve().then(()=>respond(message,child)).then(result=>{
|
|
40
|
+
if(result!==undefined)send({type:'host_result',sessionId,callId:message.callId,requestDigest:message.requestDigest,result});
|
|
41
|
+
}).catch(rejectReady);}
|
|
42
|
+
else if(pending.has(message.requestId)){pending.get(message.requestId)(message);pending.delete(message.requestId);}
|
|
43
|
+
});
|
|
44
|
+
child.on('close',code=>{if(!sessionId)rejectReady(Error(stderr));for(const resolve of pending.values())resolve({closed:code});pending.clear();});
|
|
45
|
+
await ready;
|
|
46
|
+
return {child,asked,request:(operation,fields={})=>new Promise(resolve=>{
|
|
47
|
+
const requestId=`request-${++seq}`;pending.set(requestId,resolve);send({requestId,operation,...fields});}),
|
|
48
|
+
close:async()=>{send({type:'host_close',sessionId});const [code]=await closed;assert.equal(code,0,stderr);}};
|
|
49
|
+
}
|
|
50
|
+
const logic=payload=>({contractDigest:payload.contractDigest,results:[{id:'TC-001',verdict:'SUPPORTED',evidence:[{path:'input.mjs',line:1}],explanation:'Synthetic characterization'}]});
|
|
51
|
+
const browser=payload=>{fs.mkdirSync(payload.reportDir,{recursive:true});const evidence=path.join(payload.reportDir,'browser.md');
|
|
52
|
+
fs.writeFileSync(evidence,'Synthetic observation');return {verdict:'PASS',evidence:[evidence],environment:payload.environment,cleanup:'not_needed'};};
|
|
53
|
+
const rows=f=>fs.readFileSync(path.join(f.directory,'execution.jsonl'),'utf8').trimEnd().split('\n').map(JSON.parse);
|
|
54
|
+
|
|
55
|
+
test('real host V1: a refused test_cases answer is discarded and asked again; the run reports GENERATED',{timeout:30000},async t=>{
|
|
56
|
+
const f=fixture(t,{generate:true});let bad=1;
|
|
57
|
+
const respond=()=>bad-->0?{contract:{schemaVersion:'1.0'},report:'x'}:{contract:f.contract,report:'# Generation\nScope: synthetic.'};
|
|
58
|
+
let c=await client(t,f,respond);
|
|
59
|
+
const first=(await c.request('start')).result;assert.equal(first.stage,'interrupted');assert.equal(first.reason,'cm_test_contract_invalid');
|
|
60
|
+
assert.equal(first.recovery.lastAnswer.kind,'test_cases');assert.match(first.guidance.nextStep,/discard:true/);await c.close();
|
|
61
|
+
c=await client(t,f,respond);
|
|
62
|
+
assert.equal((await c.request('resume',{resolution:null})).result.reason,'cm_test_contract_invalid');assert.equal(c.asked.length,0);
|
|
63
|
+
const {key,requestDigest}=(await c.request('status')).result.recovery.lastAnswer;
|
|
64
|
+
const done=(await c.request('resume',{resolution:{key,requestDigest,discard:true,evidence:'contract had no cases'}})).result;
|
|
65
|
+
assert.equal(done.overall,'GENERATED',JSON.stringify(done));assert.equal(c.asked.length,1);await c.close();
|
|
66
|
+
const discard=rows(f).find(row=>row.type==='discard');assert.equal(discard.kind,'test_cases');assert.equal(discard.released,null);
|
|
67
|
+
});
|
|
68
|
+
|
|
69
|
+
test('real host V4: a lost qa_browser answer is re-asked only after cleanup:"completed" is recorded',{timeout:30000},async t=>{
|
|
70
|
+
const f=fixture(t);
|
|
71
|
+
let c=await client(t,f,(message,child)=>{if(message.kind==='qa_logic')return logic(message.payload);setImmediate(()=>child.kill('SIGKILL'));});
|
|
72
|
+
await c.request('start');
|
|
73
|
+
c=await client(t,f,message=>browser(message.payload));
|
|
74
|
+
const status=(await c.request('status')).result;
|
|
75
|
+
const unknown=status.recovery.unknown[0];assert.equal(unknown.callKind,'qa_browser');
|
|
76
|
+
assert.match(status.guidance.nextStep,/设备可能仍在使用/);
|
|
77
|
+
const binding={key:unknown.key,requestDigest:unknown.requestDigest,discard:true,evidence:'session lost the browser case'};
|
|
78
|
+
const refused=(await c.request('resume',{resolution:binding})).result;
|
|
79
|
+
assert.equal(refused.reason,'cm_test_resource_release_required');assert.equal(c.asked.length,0);
|
|
80
|
+
const done=(await c.request('resume',{resolution:{...binding,cleanup:'completed'}})).result;
|
|
81
|
+
// Static logic alone is not execution PASS, so overall stays BLOCKED; the re-asked browser case passed.
|
|
82
|
+
assert.equal(done.stage,'reported',JSON.stringify(done));assert.equal(done.rows.find(row=>row.kind==='browser').verdict,'PASS');
|
|
83
|
+
assert.deepEqual(c.asked.map(item=>item.kind),['qa_browser']);await c.close();
|
|
84
|
+
const discard=rows(f).find(row=>row.type==='discard');
|
|
85
|
+
assert.equal(discard.reason,'answer_missing');assert.equal(discard.released.source,'operator_confirmed');
|
|
86
|
+
});
|
|
87
|
+
|
|
88
|
+
test('a recorded invalid qa_logic answer also needs release before it is asked again; the limit is two',{timeout:30000},async t=>{
|
|
89
|
+
const f=fixture(t);let bad=3;
|
|
90
|
+
const respond=message=>message.kind==='qa_logic'?(bad-->0?{contractDigest:message.payload.contractDigest,results:[]}:logic(message.payload)):browser(message.payload);
|
|
91
|
+
const c=await client(t,f,respond);
|
|
92
|
+
assert.equal((await c.request('start')).result.stage,'interrupted');
|
|
93
|
+
for(let n=1;n<=3;n++){
|
|
94
|
+
const {key,requestDigest}=(await c.request('status')).result.recovery.lastAnswer;
|
|
95
|
+
const result=(await c.request('resume',{resolution:{key,requestDigest,discard:true,evidence:'no results',cleanup:'completed'}})).result;
|
|
96
|
+
assert.equal(result.stage,'interrupted');if(n===3)assert.equal(result.reason,'cm_test_discard_limit');
|
|
97
|
+
}
|
|
98
|
+
assert.equal(c.asked.filter(item=>item.kind==='qa_logic').length,3);await c.close();
|
|
99
|
+
});
|
|
100
|
+
|
|
101
|
+
test('replay refuses a qa discard without a release, a forged digest and a third discard; an old journal is unchanged',{timeout:30000},async t=>{
|
|
102
|
+
const f=fixture(t,{generate:true});
|
|
103
|
+
let c=await client(t,f,()=>({contract:{schemaVersion:'1.0'},report:'x'}));await c.request('start');await c.close();
|
|
104
|
+
const file=path.join(f.directory,'execution.jsonl'),base=fs.readFileSync(file,'utf8'),list=rows(f);
|
|
105
|
+
const intent=list.filter(row=>row.type==='intent').at(-1),result=list.find(row=>row.type==='result'&&row.key===intent.key);
|
|
106
|
+
const append=body=>{const all=rows(f),row={...body,previous:all.at(-1).hash};fs.appendFileSync(file,JSON.stringify({...row,hash:digest(row)})+'\n');};
|
|
107
|
+
const good={type:'discard',key:intent.key,kind:'test_cases',reason:'answer_rejected',attempt:1,requestDigest:digest(intent.input),resultDigest:digest(result.result),
|
|
108
|
+
evidence:{sha256:digest('x'),length:1},released:null,at:'2026-10-09T00:00:00.000Z'};
|
|
109
|
+
const open=()=>{const session=openTestSession(f.directory,f.config);session.close();};
|
|
110
|
+
for(const [name,row] of Object.entries({forgedDigest:{...good,resultDigest:'0'.repeat(64)},
|
|
111
|
+
releaseOnReadOnly:{...good,released:{source:'operator_confirmed',evidence:digest('y')}},qaKind:{...good,kind:'qa_browser'}})){
|
|
112
|
+
fs.writeFileSync(file,base,{mode:0o600});append(row);assert.throws(open,/refactor_journal_invalid/,name);
|
|
113
|
+
}
|
|
114
|
+
fs.writeFileSync(file,base,{mode:0o600});append(good);assert.doesNotThrow(open);
|
|
115
|
+
fs.writeFileSync(file,base,{mode:0o600});
|
|
116
|
+
c=await client(t,f,()=>assert.fail('recorded answers replay'));
|
|
117
|
+
assert.equal((await c.request('resume',{resolution:null})).result.reason,'cm_test_contract_invalid');await c.close();
|
|
118
|
+
assert.equal(fs.readFileSync(file,'utf8'),base);
|
|
119
|
+
// Driver: discarding the recorded test_cases answer re-asks it from the answer file.
|
|
120
|
+
const plan=path.join(f.temp,'plan.json');
|
|
121
|
+
fs.writeFileSync(plan,JSON.stringify({config:'config.json',sessionDir:'session',answers:'answers',
|
|
122
|
+
resolution:{key:intent.key,requestDigest:digest(intent.input),discard:true,evidence:'x'}}));
|
|
123
|
+
fs.mkdirSync(path.join(f.temp,'answers'));fs.writeFileSync(path.join(f.temp,'answers/test-cases.json'),JSON.stringify({contract:f.contract,report:'# r'}));
|
|
124
|
+
const ok=spawnSync(process.execPath,[path.join(root,'scripts/cm-test-drive.mjs'),'--plan',plan,'resume'],{encoding:'utf8',
|
|
125
|
+
env:{...process.env}});
|
|
126
|
+
assert.equal(ok.status,0,ok.stderr);assert.match(ok.stdout,/GENERATED/);
|
|
127
|
+
});
|
|
128
|
+
|
|
129
|
+
test('notify classifies cm-test discard blocks as stuck',async()=>{
|
|
130
|
+
const {classifyDriveResult}=await import('../runtime/js/notify.mjs');
|
|
131
|
+
for(const reason of ['cm_test_resource_release_required','cm_test_discard_limit','cm_test_contract_invalid'])
|
|
132
|
+
assert.equal(classifyDriveResult('cm-test',{result:{stage:'interrupted',reason,recovery:{discards:[],lastAnswer:null,unknown:[]}}}),'stuck',reason);
|
|
133
|
+
});
|
|
134
|
+
|
|
135
|
+
test('real host: after a qa_browser discard, the late receipt of the discarded attempt is refused; the receipt of the new attempt is accepted',{timeout:30000},async t=>{
|
|
136
|
+
const f=fixture(t);let first;
|
|
137
|
+
let c=await client(t,f,(message,child)=>{if(message.kind==='qa_logic')return logic(message.payload);first=message;setImmediate(()=>child.kill('SIGKILL'));});
|
|
138
|
+
await c.request('start');
|
|
139
|
+
c=await client(t,f,(message,child)=>{setImmediate(()=>child.kill('SIGKILL'));});
|
|
140
|
+
const old=(await c.request('status')).result.pending;
|
|
141
|
+
await c.request('resume',{resolution:{key:old.key,requestDigest:old.requestDigest,discard:true,evidence:'lost',cleanup:'completed'}});
|
|
142
|
+
c=await client(t,f,()=>assert.fail('receipts only'));
|
|
143
|
+
const now=(await c.request('status')).result;
|
|
144
|
+
assert.equal(now.recovery.unknown[0].attempt,2);assert.notEqual(now.pending.requestDigest,old.requestDigest);
|
|
145
|
+
const late={key:old.key,requestDigest:old.requestDigest,result:browser(first.payload),evidence:'late receipt of attempt 1',cleanup:'completed'};
|
|
146
|
+
assert.equal((await c.request('resume',{resolution:late})).result.reason,'cm_test_resolution_abandoned');
|
|
147
|
+
const done=(await c.request('resume',{resolution:{...late,requestDigest:now.pending.requestDigest,evidence:'receipt of attempt 2'}})).result;
|
|
148
|
+
assert.equal(done.stage,'reported',JSON.stringify(done));await c.close();
|
|
149
|
+
const reask=rows(f).filter(row=>row.type==='intent'&&row.key===old.key);
|
|
150
|
+
assert.deepEqual(reask.map(row=>row.attempt??1),[1,2]);
|
|
151
|
+
});
|
|
@@ -23,6 +23,7 @@ import {readSourceFiles,snapshotSource,selectReportDirectory,checkSourceEvidence
|
|
|
23
23
|
import {createHostCheck} from '../runtime/js/cm-ai/host-check.mjs';
|
|
24
24
|
import {inspectDeclaredTestCommand} from '../runtime/js/cm-test/declared-command.mjs';
|
|
25
25
|
import {digest} from '../runtime/js/cm-ai/effect-contract.mjs';
|
|
26
|
+
import {effectDigest} from '../runtime/js/cm-refactor/records.mjs';
|
|
26
27
|
import {stderr,stop,readJson,loadPlanFile,requireFields,preflightAnswers,driveHost} from '../runtime/js/cm-ai/drive-core.mjs';
|
|
27
28
|
|
|
28
29
|
import {driverLiveEvidence} from '../runtime/js/cm-ai/live-evidence.mjs';
|
|
@@ -37,7 +38,7 @@ const safeFile=file=>fs.existsSync(file)&&fs.lstatSync(file).isFile()&&!fs.lstat
|
|
|
37
38
|
|
|
38
39
|
function main(){
|
|
39
40
|
if(process.argv.length===3&&['--help','-h'].includes(process.argv[2])){
|
|
40
|
-
process.stdout.write('用法: cm-test-drive.mjs --plan PLAN.json <start|resume|status|cancel>\nPLAN: config, answers, sessionDir (resume), resolution:null
|
|
41
|
+
process.stdout.write('用法: cm-test-drive.mjs --plan PLAN.json <start|resume|status|cancel>\nPLAN: config, answers, sessionDir (resume), resolution:null 或 {key,requestDigest,discard:true,evidence,cleanup?}(作废后重问,qa_* 需 cleanup:"completed")。浏览器执行用 PLAN.liveEvidence {directory,kinds:["qa_browser"],timeoutMs?};未配置时预检拒绝。\n');return;
|
|
41
42
|
}
|
|
42
43
|
const {operation,plan,base}=loadPlanFile({name:'cm-test-drive.mjs',known:KNOWN});
|
|
43
44
|
requireFields(plan,['config']);
|
|
@@ -57,14 +58,29 @@ function main(){
|
|
|
57
58
|
if(admission.operation==='impact')valid(config.commands.length===0&&config.environment===null,'impact 只读配置');
|
|
58
59
|
if(operation==='resume'){
|
|
59
60
|
requireFields(plan,['sessionDir','resolution']);
|
|
60
|
-
|
|
61
|
+
const resolution=plan.resolution;
|
|
62
|
+
// discard: V1/V4 作废最后一个应答(已记录被拒或结果未知)后重问;qa_* 需 cleanup:"completed"(资源已释放)。
|
|
63
|
+
valid(resolution===null||object(resolution)&&resolution.discard===true&&typeof resolution.key==='string'
|
|
64
|
+
&&typeof resolution.requestDigest==='string'&&typeof resolution.evidence==='string'&&resolution.evidence.trim()
|
|
65
|
+
&&Object.keys(resolution).every(key=>['key','requestDigest','discard','evidence','cleanup'].includes(key)),
|
|
66
|
+
'resume 只接受 resolution:null 或 {key,requestDigest,discard:true,evidence,cleanup?};原动作回执不能由静态答案伪造');
|
|
61
67
|
const session=path.resolve(base,plan.sessionDir);
|
|
62
68
|
if(!safeFile(path.join(session,'execution.jsonl')))stop(2,`恢复记录不存在: ${path.join(session,'execution.jsonl')}`);
|
|
63
69
|
const rows=fs.readFileSync(path.join(session,'execution.jsonl'),'utf8').trim().split('\n').map(JSON.parse);
|
|
64
70
|
const context=rows.find(row=>row.type==='context')?.value;
|
|
65
71
|
valid(context?.workflow==='cm-test'&&context.configDigest===digest(config),'resume 配置绑定不匹配');
|
|
66
|
-
const pending=new Map()
|
|
67
|
-
for(const
|
|
72
|
+
const pending=new Map(),inputs=new Map();let last=null;
|
|
73
|
+
for(const row of rows){if(row.type==='intent'){pending.set(row.key,row.kind);inputs.set(row.key,{input:row.input,...(row.attempt?{attempt:row.attempt}:{})});last=row.key;}
|
|
74
|
+
if(row.type==='result')pending.delete(row.key);if(row.type==='discard'){pending.delete(row.key);inputs.delete(row.key);last=null;}}
|
|
75
|
+
if(resolution!==null){
|
|
76
|
+
const entry=inputs.get(resolution.key),input=entry?.input,kind=input?.kind,release=['qa_logic','qa_browser'].includes(kind);
|
|
77
|
+
if(resolution.key!==last||!['change_impact','test_cases','qa_logic','qa_browser'].includes(kind)||effectDigest(entry)!==resolution.requestDigest)
|
|
78
|
+
stop(2,'discard 只能作废最后一个 change_impact/test_cases/qa_logic/qa_browser 应答,key/requestDigest 取自宿主 status');
|
|
79
|
+
if(release&&resolution.cleanup!=='completed')
|
|
80
|
+
stop(2,`${kind} 会操作浏览器或设备:先确认会话已清理或资源已释放(设备可能仍在使用),再带 cleanup:"completed"`);
|
|
81
|
+
pending.delete(resolution.key);
|
|
82
|
+
}
|
|
83
|
+
for(const [key,kind] of pending)if(['host','command'].includes(kind))stop(2,`缺少原执行回执 runner: ${kind} ${key};不能从静态文件恢复。change_impact/test_cases 可用 resolution {key,requestDigest,discard:true,evidence} 作废后重问;qa_* 另需 cleanup:"completed"`);
|
|
68
84
|
}else if(operation==='start'&&plan.sessionDir){
|
|
69
85
|
const session=path.resolve(base,plan.sessionDir);
|
|
70
86
|
valid(!fs.existsSync(path.join(session,'execution.jsonl')),'start 的 sessionDir 已有记录,请用 resume');
|
|
@@ -132,7 +148,7 @@ function main(){
|
|
|
132
148
|
driveHost({host:HOST,args:['serve','--config',configPath,...(plan.sessionDir
|
|
133
149
|
&&(['start','resume'].includes(operation)||operation==='status'&&existingSession)
|
|
134
150
|
?['--session-dir',path.resolve(base,plan.sessionDir)]:[])],
|
|
135
|
-
cwd:admission.project,operation,request:operation==='resume'?{resolution:
|
|
151
|
+
cwd:admission.project,operation,request:operation==='resume'?{resolution:plan.resolution}:{},answers,paths:{},
|
|
136
152
|
answerFor:(row,answers,paths,control)=>live.has(row.kind)?live.answer(row,control):answers[row.kind]??null});
|
|
137
153
|
}
|
|
138
154
|
main();
|
|
@@ -39,5 +39,5 @@ for(const event of [
|
|
|
39
39
|
{type:'system',subtype:'init',session_id},
|
|
40
40
|
{type:'assistant',session_id,parent_tool_use_id:null,
|
|
41
41
|
message:{role:'assistant',content:[{type:'text',text:JSON.stringify(value)}]}},
|
|
42
|
-
{type:'result',subtype:'success',session_id,is_error:false,num_turns:1,result:JSON.stringify(value)},
|
|
42
|
+
{type:'result',subtype:'success',session_id,is_error:false,num_turns:1,structured_output:value,result:JSON.stringify(value)},
|
|
43
43
|
]) process.stdout.write(JSON.stringify(event)+'\n');
|
|
@@ -0,0 +1,99 @@
|
|
|
1
|
+
// Sessions created by origin/main 0b3040e (before batch 3 changed the bound
|
|
2
|
+
// cm-init and cm-test documents) keep working under their original binding;
|
|
3
|
+
// any other drift still refuses. Fixtures carry the exact 0b3040e binding.
|
|
4
|
+
import test from 'node:test';
|
|
5
|
+
import assert from 'node:assert/strict';
|
|
6
|
+
import fs from 'node:fs';
|
|
7
|
+
import os from 'node:os';
|
|
8
|
+
import path from 'node:path';
|
|
9
|
+
import {spawn,spawnSync} from 'node:child_process';
|
|
10
|
+
import {createInterface} from 'node:readline';
|
|
11
|
+
import {once} from 'node:events';
|
|
12
|
+
import {fileURLToPath} from 'node:url';
|
|
13
|
+
import {digest} from '../runtime/js/cm-ai/effect-contract.mjs';
|
|
14
|
+
import {LEGACY_INIT_POLICIES,LEGACY_TEST_POLICIES,POLICY_DOC_SUCCESSORS,legacyInitBindings,sha256} from '../runtime/js/policy-binding-compat.mjs';
|
|
15
|
+
const root=fileURLToPath(new URL('..',import.meta.url));
|
|
16
|
+
const legacyInit=LEGACY_INIT_POLICIES[0],legacyTest=LEGACY_TEST_POLICIES[0];
|
|
17
|
+
|
|
18
|
+
test('legacy digests are exactly the 0b3040e policy documents (when that commit is available)',t=>{
|
|
19
|
+
const show=file=>{const out=spawnSync('git',['show',`0b3040e:${file}`],{cwd:root,encoding:'utf8'});return out.status===0?out.stdout:undefined;};
|
|
20
|
+
if(show('skills/cm-init/SKILL.md')===undefined){t.skip('0b3040e not in this clone');return;}
|
|
21
|
+
const files=Object.keys(legacyInit.files);
|
|
22
|
+
assert.equal(digest(files.map(file=>[file,show(file)])),legacyInit.policyDigest);
|
|
23
|
+
for(const file of files)assert.equal(sha256(show(file)),legacyInit.files[file],file);
|
|
24
|
+
assert.equal(digest(show('skills/cm-test/references/js-host.md')),legacyTest.policy);
|
|
25
|
+
});
|
|
26
|
+
|
|
27
|
+
test('the current bound documents are listed as known successors (update the list when they change)',()=>{
|
|
28
|
+
for(const [file,list] of Object.entries(POLICY_DOC_SUCCESSORS))
|
|
29
|
+
assert.ok(list.includes(sha256(fs.readFileSync(path.join(root,file),'utf8'))),`${file} changed: add its digest to POLICY_DOC_SUCCESSORS`);
|
|
30
|
+
});
|
|
31
|
+
|
|
32
|
+
test('legacy init binding is offered only when every other bound file is byte-identical',()=>{
|
|
33
|
+
const files=Object.keys(legacyInit.files).map(file=>[file,fs.readFileSync(path.join(root,file),'utf8')]);
|
|
34
|
+
assert.equal(legacyInitBindings({project:'/p',workflowRoot:'/w',files}).length,1);
|
|
35
|
+
assert.deepEqual(legacyInitBindings({project:'/p',workflowRoot:'/w',files:files.map(([file,content])=>[file,file.endsWith('testing.md')?content+'x':content])}),[]);
|
|
36
|
+
assert.deepEqual(legacyInitBindings({project:'/p',workflowRoot:'/w',files:files.map(([file,content])=>[file,file===legacyInit.changed?content+'x':content])}),[]);
|
|
37
|
+
assert.deepEqual(legacyInitBindings({project:'/p',workflowRoot:'/w',files:files.slice(1)}),[]);
|
|
38
|
+
});
|
|
39
|
+
|
|
40
|
+
async function serve(args,{cwd,operations}){
|
|
41
|
+
const child=spawn(process.execPath,args,{cwd,stdio:['pipe','pipe','pipe']});let stderr='',sessionId,index=0;const results=[];
|
|
42
|
+
child.stderr.on('data',chunk=>{stderr+=chunk;});const closed=once(child,'close');
|
|
43
|
+
for await(const line of createInterface({input:child.stdout})){const message=JSON.parse(line);
|
|
44
|
+
if(message.type==='host_ready'){sessionId=message.sessionId;}
|
|
45
|
+
else if(message.requestId)results.push(message.result??message.error);
|
|
46
|
+
if(message.type==='host_ready'||message.requestId){
|
|
47
|
+
if(index<operations.length)child.stdin.write(JSON.stringify({requestId:`r${++index}`,...operations[index-1]})+'\n');
|
|
48
|
+
else child.stdin.write(JSON.stringify({type:'host_close',sessionId})+'\n');}
|
|
49
|
+
}
|
|
50
|
+
const [code]=await closed;return {code,results,stderr};
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
test('real cm-init host: a session bound by 0b3040e opens, reports status and keeps its binding; other digests refuse',{timeout:30000},async t=>{
|
|
54
|
+
const dir=fs.realpathSync(fs.mkdtempSync(path.join(os.tmpdir(),'cm-policy-compat-'))),project=path.join(dir,'project'),file=path.join(dir,'init.json');
|
|
55
|
+
t.after(()=>fs.rmSync(dir,{recursive:true,force:true}));fs.mkdirSync(project);fs.writeFileSync(path.join(project,'README.md'),'# Synthetic\n');
|
|
56
|
+
const args=[path.join(root,'scripts/cm-init-host.mjs'),'serve','--skill-dir',path.join(root,'skills/cm-init'),'--project',project,
|
|
57
|
+
'--host-context','author-a','--session-file',file];
|
|
58
|
+
// The fixture is the exact shape 0b3040e wrote for a fresh session at this workflow root.
|
|
59
|
+
const legacy={version:1,workflow:'cm-init',binding:{project,workflowRoot:root.replace(/\/$/,''),policyDigest:legacyInit.policyDigest},
|
|
60
|
+
checkpoint:{stage:'ready',result:null,verification:null,selection:null,confirmation:null,review:null,writeResult:null,reviewPackage:null,
|
|
61
|
+
reviewEvidence:null,analysisResult:null,revisionHistory:[],authorContexts:['author-a'],authorContextId:'author-a'},pending:null,cancelled:false};
|
|
62
|
+
fs.writeFileSync(file,JSON.stringify(legacy),{mode:0o600});
|
|
63
|
+
let run=await serve(args,{cwd:project,operations:[{operation:'status'},{operation:'cancel'}]});
|
|
64
|
+
assert.equal(run.code,0,run.stderr);assert.equal(run.results[0].stage,'ready');assert.equal(run.results[1].stage,'cancelled');
|
|
65
|
+
assert.equal(JSON.parse(fs.readFileSync(file,'utf8')).binding.policyDigest,legacyInit.policyDigest,'the original binding is kept');
|
|
66
|
+
fs.writeFileSync(file,JSON.stringify({...legacy,binding:{...legacy.binding,policyDigest:'0'.repeat(64)}}),{mode:0o600});
|
|
67
|
+
run=await serve(args,{cwd:project,operations:[]});
|
|
68
|
+
assert.notEqual(run.code,0);assert.match(run.stderr,/idea_session_binding_changed/);
|
|
69
|
+
});
|
|
70
|
+
|
|
71
|
+
test('real cm-test host: a journal bound by 0b3040e opens and replays; another policy digest refuses',{timeout:30000},async t=>{
|
|
72
|
+
const temp=fs.realpathSync(fs.mkdtempSync(path.join(os.tmpdir(),'cm-policy-compat-test-'))),project=path.join(temp,'project');
|
|
73
|
+
t.after(()=>fs.rmSync(temp,{recursive:true,force:true}));fs.mkdirSync(project);
|
|
74
|
+
fs.writeFileSync(path.join(project,'input.mjs'),'export const valid = value => value !== null;\n');fs.writeFileSync(path.join(project,'AGENTS.md'),'Synthetic\n');
|
|
75
|
+
const contract={schemaVersion:'1.0',feature:'example',cases:[{id:'TC-001',kind:'logic',origin:'user',blocking:true,acIds:[],taskIds:[],
|
|
76
|
+
title:'Synthetic',preconditions:[],steps:['Observe'],expected:['Expected'],cleanup:[]}]};
|
|
77
|
+
const cases=path.join(temp,'cases.json');fs.writeFileSync(cases,JSON.stringify(contract));
|
|
78
|
+
const config={skillDir:path.join(root,'skills/cm-test'),project,runtime:'codex',arguments:{cases,logic:true},sources:['input.mjs','AGENTS.md'],
|
|
79
|
+
commands:[],environment:{scope:'local',kind:'web',carrier:'browser',target:'http://127.0.0.1:3000'},logHome:path.join(temp,'logs')};
|
|
80
|
+
const configPath=path.join(temp,'config.json'),session=path.join(temp,'session');fs.writeFileSync(configPath,JSON.stringify(config));
|
|
81
|
+
const args=[path.join(root,'scripts/cm-test-host.mjs'),'serve','--config',configPath,'--session-dir',session];
|
|
82
|
+
// Create a run whose qa_logic answer is lost, then rebind its context to the 0b3040e policy (re-chaining hashes).
|
|
83
|
+
const child=spawn(process.execPath,args,{stdio:['pipe','pipe','pipe']});const closed=once(child,'close');
|
|
84
|
+
createInterface({input:child.stdout}).on('line',line=>{const message=JSON.parse(line);
|
|
85
|
+
if(message.type==='host_ready')child.stdin.write(JSON.stringify({requestId:'s',operation:'start'})+'\n');
|
|
86
|
+
if(message.type==='host_request')child.kill('SIGKILL');});
|
|
87
|
+
await closed;
|
|
88
|
+
const journal=path.join(session,'execution.jsonl');
|
|
89
|
+
const rebind=policy=>{let previous=null;const rows=fs.readFileSync(journal,'utf8').trimEnd().split('\n').map(line=>JSON.parse(line)).map(({hash,...row})=>{
|
|
90
|
+
const body={...row,...(row.type==='context'?{value:{...row.value,binding:{...row.value.binding,policy}}}:{}),previous};
|
|
91
|
+
previous=digest(body);return {...body,hash:previous};});
|
|
92
|
+
fs.writeFileSync(journal,rows.map(row=>JSON.stringify(row)).join('\n')+'\n',{mode:0o600});};
|
|
93
|
+
rebind(legacyTest.policy);
|
|
94
|
+
let run=await serve(args,{cwd:temp,operations:[{operation:'status'}]});
|
|
95
|
+
assert.equal(run.code,0,run.stderr);assert.equal(run.results[0].stage,'interrupted');assert.equal(run.results[0].recovery.unknown[0].callKind,'qa_logic');
|
|
96
|
+
rebind('1'.repeat(64));
|
|
97
|
+
run=await serve(args,{cwd:temp,operations:[]});
|
|
98
|
+
assert.notEqual(run.code,0);assert.match(run.stderr,/cm_test_session_binding_changed/);
|
|
99
|
+
});
|
|
@@ -39,14 +39,18 @@ ALLOW_LOOPBACK_ENDPOINT_FILES = {
|
|
|
39
39
|
Path("runtime/js/cm-ai/claude-tool-preview.mjs"),
|
|
40
40
|
Path("scripts/cm-ai-batch-host.test.mjs"),
|
|
41
41
|
Path("scripts/cm-ai-host.test.mjs"),
|
|
42
|
+
Path("scripts/cm-ai-host-cli-workflow.test.mjs"),
|
|
42
43
|
Path("scripts/cm-ai-multi-root.test.mjs"),
|
|
43
44
|
Path("scripts/cm-ai-nested-execution.test.mjs"),
|
|
44
45
|
Path("scripts/cm-claude-probe.test.mjs"),
|
|
45
46
|
Path("scripts/cm-fix-visual-bare.test.mjs"),
|
|
46
47
|
Path("scripts/cm-fix-walkthrough.test.mjs"),
|
|
48
|
+
Path("scripts/cm-notify-command.test.mjs"),
|
|
47
49
|
Path("scripts/cm-host-qa-executor.test.mjs"),
|
|
48
50
|
Path("scripts/cm-test-host.test.mjs"),
|
|
51
|
+
Path("scripts/cm-test-answer-gaps.test.mjs"),
|
|
49
52
|
Path("scripts/cm-test-session.test.mjs"),
|
|
53
|
+
Path("scripts/policy-binding-compat.test.mjs"),
|
|
50
54
|
}
|
|
51
55
|
URL_AUTHORITY = re.compile(r"https?://([^/\s?#'\"`<>]+)")
|
|
52
56
|
LOOPBACK_AUTHORITY = re.compile(
|
|
@@ -21,6 +21,7 @@ CORE_SKILLS = (
|
|
|
21
21
|
"cm-refactor",
|
|
22
22
|
"cm-check",
|
|
23
23
|
"cm-runtime",
|
|
24
|
+
"cm-notify",
|
|
24
25
|
)
|
|
25
26
|
CM_AI_RUNTIME = (
|
|
26
27
|
"cm-ai-admission.mjs",
|
|
@@ -98,6 +99,9 @@ REQUIRED = (
|
|
|
98
99
|
"scripts/cm-runtime-edit.mjs",
|
|
99
100
|
"scripts/cm-runtime-install.mjs",
|
|
100
101
|
"scripts/cm-runtime.test.mjs",
|
|
102
|
+
"scripts/cm-notify.mjs",
|
|
103
|
+
"scripts/cm-notify-command.test.mjs",
|
|
104
|
+
"runtime/js/notify-send.mjs",
|
|
101
105
|
"scripts/cm-workflow-config.mjs",
|
|
102
106
|
"scripts/cm-workflow-config.test.mjs",
|
|
103
107
|
"scripts/cm_workflow_config.py",
|
|
@@ -36,6 +36,32 @@
|
|
|
36
36
|
例外:整轮 `qa_execution_timeout` 中断、无报告、无 FAIL,且每条 case_blocked 都是宿主请求超时(行上 `host_request_timeout: true`;
|
|
37
37
|
旧行无此字段时须 case_start 到 case_blocked 满 `qa.timeoutMs`,且同一命令带 `--qa-environment-failure "原因"` 声明没有应答,否则 `qa_environment_failure_required`)、不是会话自答 BLOCKED,同一 `--rerun-unknown-qa`
|
|
38
38
|
写 `test_run/superseded`(`reason: host_request_timeout`)并在 qaRound+1 重跑全部命令与用例;对它用 `--rerun-blocked-qa` 拒绝为 `qa_rerun_unknown_qa_required`。
|
|
39
|
+
混合情形(整轮超时、宿主死亡或会话答复硬无效让整轮停下,已记录的非 PASS 里还有会话自答 BLOCKED,或宿主按证据、环境、清理问题判的 BLOCKED——新执行器在 case_blocked 行写 `blocked_reason`)同样由 `--rerun-unknown-qa` 处理:
|
|
40
|
+
superseded 行另记 `host_blocked_cases`(`timed_out_cases` 可以为空)。FAIL、未解决的 `[需确认]`、缺浏览器能力,以及分辨不出原因的旧行仍拒绝。
|
|
41
|
+
整轮期限不再固定 30 分钟:按冻结的计划放大——每条命令一个命令超时、每个 logic 用例一个应答期限、每个 browser 用例两个(含一次证据追问),再加 1 分钟,最少 30 分钟、最多 24 小时;不进入指纹。
|
|
42
|
+
|
|
43
|
+
### 浏览器用例请求超时:设备可能仍被占用
|
|
44
|
+
|
|
45
|
+
浏览器用例的宿主请求超时、没有拿到会话应答时(含证据追问超时),会话可能仍在操作浏览器、模拟器或真机。宿主照常写该用例的 `case_blocked`(`host_request_timeout: true`),但只要本轮后面还有浏览器用例,就停下本次调用并拒绝为 `qa_device_unverified`,不再派发下一个浏览器用例,也不写 complete。之后状态为 `qa_execution_unknown`:先确认那个会话已停止、设备已空闲,再用 `--rerun-unknown-qa` 重跑本轮(宿主原因替代的轮次不占三轮预算)。宿主无法自己核实设备是否释放,所以不会自动继续。最后一个浏览器用例超时时没有后续派发,本轮照常以 BLOCKED 结束。
|
|
46
|
+
|
|
47
|
+
### 纯逻辑用例的整轮中断(Q06)
|
|
48
|
+
|
|
49
|
+
逻辑用例(`qa_logic`)只读源码,不写 case 行;整轮因答复格式不合格或宿主退出而中断时,宿主只能凭命令与浏览器行归因。`--rerun-unknown-qa` 能证明的情形照常替代重跑;不能证明的(例如混有原始 FAIL、未解决的 `[需确认]`、无法归因的旧行)按拒绝码停下,指引改用 `--supersede-reviewed-evidence` 新建运行,不写猜测的记录。
|
|
50
|
+
|
|
51
|
+
### 文档核对与同步
|
|
52
|
+
|
|
53
|
+
`documentation_inspect`(`finish`/`run_finalize` 前的只读核对)超时、无效或过期都可直接重发;答 `blocked` 时状态为 `documentation_sync_blocked`,按 `reason` 补齐文档后用原配置 `--mode resume` 重启宿主再发 `finish`(同一宿主进程内结论已缓存,核对只读、可重复)。运行配置里的 `documentationSync`(反问 `documentation_sync`)目前没有接入开发调用,开发阶段不会出现文档同步的等待点。
|
|
54
|
+
|
|
55
|
+
### QA 轮次预算(第 3 轮之后)
|
|
56
|
+
|
|
57
|
+
三轮预算只算产品证据。因会话没应答、宿主中断、证据格式或环境问题而 superseded 的一轮(`reason` 为 `host_request_timeout` 或 `host_evidence_problem`)不计入,每运行最多因此多给 2 轮(第 5 轮为硬上限)。
|
|
58
|
+
声明环境失败(`declared_environment_failure`)、配置修订和产品 FAIL 仍计入;QA 修复链仍按原三轮计。author-column-T-010 这类第 3 轮仍是宿主证据问题的运行,可再 `--rerun-blocked-qa` 跑第 4 轮。
|
|
59
|
+
|
|
60
|
+
### QA 命令资源清理失败
|
|
61
|
+
|
|
62
|
+
整轮超时或取消时正在跑的 QA 命令记 `resource/cleanup_failed`,写入器会一直拒绝放弃、超时替代、`run_done` 与批次交接。
|
|
63
|
+
新执行器在这一行记下命令进程组身份(`pid`、`process_start_time`);宿主在 QA 恢复、`run_finalize` 与批次交接前核对该进程组已退出,就补记 `resource/released`(`released_by: host_verified`、`verification: process_group_gone`),之后流程照常。
|
|
64
|
+
进程仍在、核对不了(Windows、无权限、读不到启动时间)或旧行没有进程身份时保持未关闭,`run_finalize` 报 `qa_resources_open` 并列出资源,批次交接报 `batch_resources_open`,`reason` 同样列出资源及原因;先结束残留进程再重发(批次从原批次入口 `advance`)。浏览器 QA 用例不登记资源(设备与浏览器清理由会话在 `cleanup` 中如实报告),没有可由宿主释放的设备锁。
|
|
39
65
|
|
|
40
66
|
## 已 complete 的宿主证据或环境阻断
|
|
41
67
|
|
|
@@ -60,7 +86,7 @@ taskIds 全部是 `[DROPPED]` 任务的用例不进 QA 计划(不问会话,
|
|
|
60
86
|
`CONTRADICTED`、已接受修复的 FAIL 均拒绝。superseded 行记 `reason=declared_environment_failure`、`environment_failure_reason`、
|
|
61
87
|
`failed_cases` 与 `blocked_cases`。这不是放行:新一轮在同一代码上全部重跑,真有缺陷仍会 FAIL。
|
|
62
88
|
先写 `test_run/superseded`(previous_test_run_id、reason=host_evidence_problem 或上述声明原因、blocked_cases),再以新 testRunId、
|
|
63
|
-
qaRound+1 写带 previous_test_run_id 的 start
|
|
89
|
+
qaRound+1 写带 previous_test_run_id 的 start,全部用例重跑(新写的 superseded 行带 `recovery_rule: 3`:浏览器用例只有 case 行记了会话原始结论 `answered_verdict` 且不是 FAIL 时才算宿主问题,被降级成 BLOCKED 的 FAIL、未解决的 [需确认]、缺能力和没记原始结论的旧行都拒绝;已发布的 `recovery_rule: 2` 和更早的行按原规则回放);`host_evidence_problem` 的一轮按上方「QA 轮次预算」不计入三轮(最多多给 2 轮),声明环境失败仍计入;旧 PASS 仅保留历史,不重做 QA 决策、
|
|
64
90
|
开发或审查,不改 tasks。开关一次性消费且不持久化,不与 --rerun-unknown-qa 合用;仅写 superseded 后中断,
|
|
65
91
|
须重新显式授权恢复。complete 同步 N6 状态镜像为 qa_passed/qa_failed/qa_blocked,并显示本轮通过/失败/阻断数量。
|
|
66
92
|
(事故:宿主把非文件说明混入 browser evidence,导致已完成任务的收尾 QA 无法恢复。)
|