@aibyzero/cm-workflow 0.16.5 → 0.16.7
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/AGENTS.md +14 -0
- package/CHANGELOG.md +19 -1
- package/README.md +17 -4
- package/THIRD_PARTY_NOTICES.md +9 -0
- package/VERSION +1 -1
- package/docs/architecture.md +43 -0
- package/docs/execution-optimizations.md +33 -0
- package/docs/external-models.md +114 -0
- package/docs/fixes/.reviews/20260929-bootstrap-unchanged-review-r1.md +7 -0
- package/docs/fixes/.reviews/20260930-develop-package-limit-recovery-r4.md +9 -0
- package/docs/fixes/20260929-bootstrap-rule-refresh-conflict.md +22 -0
- package/docs/fixes/20260929-bootstrap-unchanged-review.md +26 -0
- package/docs/fixes/20260930-develop-package-limit-recovery.md +65 -0
- package/docs/human-correction.md +31 -0
- package/docs/installation.md +28 -7
- package/docs/js-workflow-control.md +96 -6
- package/docs/live-evidence-drivers.md +62 -0
- package/docs/next-steps.md +15 -10
- package/docs/untested-branches.md +27 -4
- package/docs/user-guide.md +23 -8
- package/install-codex.sh +28 -11
- package/package.json +1 -1
- package/runtime/js/cm-ai/claude-review-adapter.mjs +7 -4
- package/runtime/js/cm-ai/claude-tool-preview.mjs +4 -4
- package/runtime/js/cm-ai/cm-ai-admission.mjs +34 -10
- package/runtime/js/cm-ai/cm-ai-context-refresh.mjs +9 -5
- package/runtime/js/cm-ai/cm-ai-conversation-entry.mjs +111 -34
- package/runtime/js/cm-ai/cm-ai-qa-log.mjs +93 -31
- package/runtime/js/cm-ai/cm-ai-run-finalizer.mjs +13 -57
- package/runtime/js/cm-ai/codex-config.mjs +3 -2
- package/runtime/js/cm-ai/codex-review-adapter.mjs +34 -15
- package/runtime/js/cm-ai/committed-rule-basis.mjs +76 -0
- package/runtime/js/cm-ai/developer-adapter.mjs +8 -5
- package/runtime/js/cm-ai/drive-bootstrap.mjs +22 -12
- package/runtime/js/cm-ai/drive-core.mjs +9 -3
- package/runtime/js/cm-ai/durable-runner-state.mjs +146 -14
- package/runtime/js/cm-ai/effect-contract.mjs +1 -1
- package/runtime/js/cm-ai/execution-policy.mjs +58 -0
- package/runtime/js/cm-ai/external-group-models.mjs +53 -0
- package/runtime/js/cm-ai/external-model-launch.mjs +23 -0
- package/runtime/js/cm-ai/external-models.mjs +52 -0
- package/runtime/js/cm-ai/external-run-guard.mjs +96 -0
- package/runtime/js/cm-ai/host-bootstrap.mjs +70 -20
- package/runtime/js/cm-ai/host-check.mjs +30 -4
- package/runtime/js/cm-ai/host-conversation-execution.mjs +59 -17
- package/runtime/js/cm-ai/host-documentation.mjs +2 -2
- package/runtime/js/cm-ai/host-progress.mjs +80 -0
- package/runtime/js/cm-ai/host-project-execution.mjs +16 -11
- package/runtime/js/cm-ai/host-qa-executor.mjs +54 -8
- package/runtime/js/cm-ai/host-qa-fix-owner.mjs +22 -5
- package/runtime/js/cm-ai/host-session.mjs +1 -1
- package/runtime/js/cm-ai/host-workflow-capabilities.mjs +3 -1
- package/runtime/js/cm-ai/knowledge-closeout.mjs +56 -0
- package/runtime/js/cm-ai/legacy-model-run-preview.mjs +24 -0
- package/runtime/js/cm-ai/legacy-model-settings.mjs +59 -0
- package/runtime/js/cm-ai/live-evidence.mjs +96 -0
- package/runtime/js/cm-ai/log-rows.mjs +36 -0
- package/runtime/js/cm-ai/model-configuration-file.mjs +63 -0
- package/runtime/js/cm-ai/model_configuration_write.py +214 -0
- package/runtime/js/cm-ai/native-usage-log.mjs +26 -0
- package/runtime/js/cm-ai/operator-guidance.mjs +89 -0
- package/runtime/js/cm-ai/owned-process-cleanup.mjs +22 -0
- package/runtime/js/cm-ai/provider-review-observation.mjs +15 -0
- package/runtime/js/cm-ai/provider-usage.mjs +39 -0
- package/runtime/js/cm-ai/review-package.mjs +11 -0
- package/runtime/js/cm-ai/review-presentation.mjs +45 -0
- package/runtime/js/cm-ai/review-reconciliation.mjs +20 -0
- package/runtime/js/cm-ai/status-projection.mjs +93 -0
- package/runtime/js/cm-ai/task-runner.mjs +176 -25
- package/runtime/js/cm-ai/tool-preview.mjs +8 -4
- package/runtime/js/cm-ai/worker-claude-developer.mjs +16 -7
- package/runtime/js/cm-ai/worker-claude.mjs +63 -19
- package/runtime/js/cm-ai/worker-codex-developer.mjs +15 -9
- package/runtime/js/cm-ai/worker-codex.mjs +45 -19
- package/runtime/js/cm-fix/cause-evidence.mjs +5 -3
- package/runtime/js/cm-fix/cause-invocation.mjs +6 -3
- package/runtime/js/cm-fix/cause-package.mjs +10 -1
- package/runtime/js/cm-fix/execution.mjs +183 -40
- package/runtime/js/cm-fix/final-review.mjs +18 -10
- package/runtime/js/cm-fix/finish.mjs +2 -19
- package/runtime/js/cm-fix/host-review.mjs +25 -6
- package/runtime/js/cm-fix/host.mjs +4 -1
- package/runtime/js/cm-fix/layout.mjs +1 -1
- package/runtime/js/cm-fix/log-events.mjs +29 -0
- package/runtime/js/cm-fix/metrics.mjs +3 -2
- package/runtime/js/cm-fix/progress.mjs +4 -0
- package/runtime/js/cm-fix/review-reconciliation.mjs +64 -0
- package/runtime/js/cm-prd/analysis.mjs +5 -2
- package/runtime/js/cm-prd/response-recovery.mjs +23 -0
- package/runtime/js/cm-prd/review-host.mjs +2 -1
- package/runtime/js/cm-prd/review-publication.mjs +23 -13
- package/runtime/js/cm-prd/review-time.mjs +29 -0
- package/runtime/js/cm-prd/session.mjs +53 -6
- package/runtime/js/cm-security/finalize.mjs +32 -0
- package/runtime/js/cm-test/recovery.mjs +4 -4
- package/runtime/review.md +5 -0
- package/runtime/task-gates.md +6 -0
- package/runtime/workflow-config.md +10 -1
- package/scripts/cm-ai-admission.mjs +14 -3
- package/scripts/cm-ai-batch-drive.mjs +52 -23
- package/scripts/cm-ai-batch-drive.test.mjs +47 -2
- package/scripts/cm-ai-batch-host.mjs +44 -16
- package/scripts/cm-ai-batch-run.mjs +77 -29
- package/scripts/cm-ai-bootstrap-flow.test.mjs +3 -2
- package/scripts/cm-ai-bootstrap-merge.test.mjs +118 -1
- package/scripts/cm-ai-bootstrap.test.mjs +80 -87
- package/scripts/cm-ai-conversation-entry-ops.test.mjs +15 -0
- package/scripts/cm-ai-develop-driver-gaps.test.mjs +102 -0
- package/scripts/cm-ai-drive-bootstrap-rules.test.mjs +2 -2
- package/scripts/cm-ai-drive.mjs +73 -28
- package/scripts/cm-ai-drive.test.mjs +119 -1
- package/scripts/cm-ai-feature-selection.test.mjs +178 -0
- package/scripts/cm-ai-host.mjs +79 -27
- package/scripts/cm-ai-host.test.mjs +88 -0
- package/scripts/cm-ai-operator-guidance.test.mjs +94 -0
- package/scripts/cm-ai-progress.test.mjs +521 -0
- package/scripts/cm-ai-protected-scope.test.mjs +194 -0
- package/scripts/cm-ai-qa-config-revision.test.mjs +21 -0
- package/scripts/cm-ai-review-failure.test.mjs +71 -11
- package/scripts/cm-ai-run.mjs +94 -19
- package/scripts/cm-ai-run.test.mjs +2 -1
- package/scripts/cm-bootstrap-review-recovery.test.mjs +70 -0
- package/scripts/cm-check-drive.test.mjs +1 -0
- package/scripts/cm-check-runtime.sh +11 -0
- package/scripts/cm-claude-install-layout.test.mjs +26 -0
- package/scripts/cm-claude-probe.test.mjs +1 -1
- package/scripts/cm-codex-plugin-metadata.py +83 -0
- package/scripts/cm-codex-plugin-metadata.test.mjs +55 -0
- package/scripts/cm-efficiency-checks.test.mjs +37 -0
- package/scripts/cm-efficiency-diagnostics.test.mjs +74 -0
- package/scripts/cm-efficiency-offline.mjs +35 -0
- package/scripts/cm-efficiency-policy.test.mjs +48 -0
- package/scripts/cm-efficiency-presentation.test.mjs +35 -0
- package/scripts/cm-efficiency-response.test.mjs +117 -0
- package/scripts/cm-efficiency-usage.test.mjs +148 -0
- package/scripts/cm-external-batch-host.test.mjs +157 -0
- package/scripts/cm-external-fix-host.test.mjs +281 -0
- package/scripts/cm-external-fix-reconciliation.test.mjs +105 -0
- package/scripts/cm-external-group-models.test.mjs +60 -0
- package/scripts/cm-external-model-host.test.mjs +180 -0
- package/scripts/cm-external-model-recovery.test.mjs +108 -0
- package/scripts/cm-external-models.test.mjs +89 -0
- package/scripts/cm-external-process-cleanup.test.mjs +71 -0
- package/scripts/cm-external-qa-fix.test.mjs +170 -0
- package/scripts/cm-external-review-reconciliation.test.mjs +314 -0
- package/scripts/cm-fix-drive.mjs +28 -13
- package/scripts/cm-fix-final-review.test.mjs +11 -6
- package/scripts/cm-fix-host.mjs +17 -10
- package/scripts/cm-fix-large-log.test.mjs +113 -0
- package/scripts/cm-fix-protected-edits.test.mjs +12 -0
- package/scripts/cm-fix-rediagnosis.test.mjs +168 -0
- package/scripts/cm-fix-review-budget.test.mjs +7 -1
- package/scripts/cm-host-qa-executor.test.mjs +329 -3
- package/scripts/cm-knowledge-closeout.test.mjs +160 -0
- package/scripts/cm-live-evidence.test.mjs +64 -0
- package/scripts/cm-log-event.mjs +34 -7
- package/scripts/cm-log-event.py +15 -0
- package/scripts/cm-model-setup.mjs +79 -0
- package/scripts/cm-prd-drive.mjs +32 -11
- package/scripts/cm-prd-drive.test.mjs +15 -0
- package/scripts/cm-prd-host.mjs +26 -6
- package/scripts/cm-prd-host.test.mjs +4 -0
- package/scripts/cm-prd-review-host.test.mjs +17 -0
- package/scripts/cm-prd-session-recovery.test.mjs +44 -2
- package/scripts/cm-prd-task-grouping.test.mjs +206 -0
- package/scripts/cm-release-smoke.sh +5 -1
- package/scripts/cm-review-scope-recovery.test.mjs +5 -3
- package/scripts/cm-runtime-i18n.mjs +15 -4
- package/scripts/cm-runtime-install.mjs +8 -4
- package/scripts/cm-runtime.mjs +116 -23
- package/scripts/cm-runtime.test.mjs +121 -12
- package/scripts/cm-security.test.mjs +32 -0
- package/scripts/cm-task-gate-correction.test.mjs +117 -0
- package/scripts/cm-task-gate.mjs +146 -10
- package/scripts/cm-task-gate.py +1 -0
- package/scripts/cm-test-branch-impact.test.mjs +11 -0
- package/scripts/cm-test-drive.mjs +10 -4
- package/scripts/cm-test-drive.test.mjs +14 -1
- package/scripts/cm-tool-preview-context.test.mjs +12 -0
- package/scripts/cm-usage-report.py +22 -3
- package/scripts/cm-workflow-config.mjs +10 -1
- package/scripts/fixtures/bootstrap-review-runner.mjs +102 -0
- package/scripts/fixtures/live-evidence-driver.mjs +35 -0
- package/scripts/fixtures/process-cleanup.mjs +3 -1
- package/scripts/test-cm-native-usage.py +62 -0
- package/scripts/test-external-model-setup.py +91 -0
- package/scripts/test-model-configuration-write.py +201 -0
- package/scripts/test-npm-install.py +10 -1
- package/skills/cm-ai/SKILL.md +2 -2
- package/skills/cm-ai/references/N1-init.md +1 -1
- package/skills/cm-ai/references/N8-finish.md +5 -0
- package/skills/cm-ai/references/js-host.md +16 -7
- package/skills/cm-ai/references/knowledge-closeout.md +90 -0
- package/skills/cm-fix/SKILL.md +1 -1
- package/skills/cm-fix/references/js-host.md +30 -2
- package/skills/cm-prd/SKILL.md +5 -4
- package/skills/cm-prd/references/spec-self-check.md +3 -1
- package/skills/cm-runtime/SKILL.md +29 -6
- package/skills/cm-security/SKILL.md +4 -2
- package/skills/cm-security/references/scan-contract.md +1 -0
- package/templates/cm-workflow.yml +1 -1
|
@@ -0,0 +1,194 @@
|
|
|
1
|
+
// A task scope with project rules or workflow evidence (AGENTS.md, .claude/,
|
|
2
|
+
// tasks.md, .cm-*) can never be developed: the developer adapter refuses it
|
|
3
|
+
// before any provider runs. Regression for the 2026-10-06 dogfood T-006 run,
|
|
4
|
+
// which a pre-gate host stranded at unknown/execution_error with no exit.
|
|
5
|
+
import nodeTest from 'node:test';
|
|
6
|
+
import assert from 'node:assert/strict';
|
|
7
|
+
import fs from 'node:fs';
|
|
8
|
+
import os from 'node:os';
|
|
9
|
+
import path from 'node:path';
|
|
10
|
+
import {digest,requestFor} from '../runtime/js/cm-ai/effect-contract.mjs';
|
|
11
|
+
import {protectedScopePaths,validateDeveloperScope} from '../runtime/js/cm-ai/developer-adapter.mjs';
|
|
12
|
+
import {readRunnerHistory,runnerStatus} from '../runtime/js/cm-ai/durable-runner-state.mjs';
|
|
13
|
+
import {assertNoUnrecordedPriorCode,prepareReviewedEvidenceSupersession} from '../runtime/js/cm-ai/reviewed-evidence-supersede.mjs';
|
|
14
|
+
import {assertCreatableScope,openControlRun,validateRunDefinition} from './cm-ai-run.mjs';
|
|
15
|
+
import {createCmAiBatch} from './cm-ai-batch-run.mjs';
|
|
16
|
+
import {operatorGuidance} from '../runtime/js/cm-ai/operator-guidance.mjs';
|
|
17
|
+
import {isSupportedExecutionPlatform} from '../runtime/js/cm-ai/execution-platform.mjs';
|
|
18
|
+
|
|
19
|
+
const skip=!isSupportedExecutionPlatform();
|
|
20
|
+
const test=(name,fn)=>nodeTest(name,{skip},fn);
|
|
21
|
+
const PROTECTED=['AGENTS.md','.claude/rules/security.md'];
|
|
22
|
+
// The T-006 production shape: a task-learning (V3) run of a numbered feature.
|
|
23
|
+
const FEATURE='6.api-native-reading';
|
|
24
|
+
|
|
25
|
+
test('protected scope paths are listed by the same rule the developer adapter enforces',()=>{
|
|
26
|
+
const scope=['src/app.js',...PROTECTED,'docs/CLAUDE.md','specs/tasks.md','.cm-workflow.yml','.codex/config.toml'];
|
|
27
|
+
assert.deepEqual(protectedScopePaths(scope),[...PROTECTED,'docs/CLAUDE.md','specs/tasks.md','.cm-workflow.yml','.codex/config.toml']);
|
|
28
|
+
assert.deepEqual(protectedScopePaths(['src/app.js','docs/agents-guide.md']),[]);
|
|
29
|
+
for(const file of protectedScopePaths(scope))assert.throws(()=>validateDeveloperScope(['src/app.js',file]),{code:'protected_scope'});
|
|
30
|
+
assert.doesNotThrow(()=>validateDeveloperScope(['src/app.js','docs/agents-guide.md']));
|
|
31
|
+
});
|
|
32
|
+
|
|
33
|
+
function projectFixture(t){
|
|
34
|
+
const root=fs.realpathSync(fs.mkdtempSync(path.join(os.tmpdir(),'cm-protected-create-')));
|
|
35
|
+
t.after(()=>fs.rmSync(root,{recursive:true,force:true}));
|
|
36
|
+
const specsDir=path.join(root,'specs'),codeProject=path.join(root,'code');
|
|
37
|
+
fs.mkdirSync(path.join(specsDir,FEATURE),{recursive:true});fs.mkdirSync(codeProject);
|
|
38
|
+
fs.writeFileSync(path.join(specsDir,FEATURE,'tasks.md'),'- [ ] T-006: fixture\n');
|
|
39
|
+
fs.writeFileSync(path.join(codeProject,'AGENTS.md'),'# rules\n');
|
|
40
|
+
return {root,specsDir,codeProject};
|
|
41
|
+
}
|
|
42
|
+
const reviewsAbsent=f=>assert.equal(fs.existsSync(path.join(f.specsDir,'.reviews')),false,'a refused create must leave no .reviews/.execution');
|
|
43
|
+
|
|
44
|
+
test('create refuses a scope with AGENTS.md before any journal, listing only the protected paths',async t=>{
|
|
45
|
+
const f=projectFixture(t);
|
|
46
|
+
const definition=validateRunDefinition({version:1,specsDir:f.specsDir,codeProject:f.codeProject,feature:FEATURE,
|
|
47
|
+
identity:{repositoryId:'fixture',runId:'api-native-reading-T-006',taskId:'T-006',attempt:1},
|
|
48
|
+
scope:['src/app.js',...PROTECTED],requirements:[]});
|
|
49
|
+
assert.throws(()=>assertCreatableScope(definition.scope),error=>error.code==='protected_scope'
|
|
50
|
+
&&error.paths.join()===PROTECTED.join()&&error.reason.includes('AGENTS.md、.claude/rules/security.md')&&!error.reason.includes('src/app.js'));
|
|
51
|
+
await assert.rejects(openControlRun(definition,'create'),error=>error.code==='protected_scope'&&error.reason.includes('AGENTS.md'));
|
|
52
|
+
reviewsAbsent(f);
|
|
53
|
+
assert.doesNotThrow(()=>assertCreatableScope(['src/app.js','docs/agents-guide.md']));
|
|
54
|
+
});
|
|
55
|
+
|
|
56
|
+
test('a batch refuses a member to be created with a protected scope before it locks, logs or opens any run',t=>{
|
|
57
|
+
const f=projectFixture(t);let opened=0;
|
|
58
|
+
const configuration={version:1,repositoryId:'fixture',batchId:'protected-scope-batch',specsDir:f.specsDir,codeProject:f.codeProject,
|
|
59
|
+
tasks:[{feature:FEATURE,taskId:'T-005',scope:['src/app.js'],requirements:[]},
|
|
60
|
+
{feature:FEATURE,taskId:'T-006',scope:['src/tab.js',...PROTECTED],requirements:[]}]};
|
|
61
|
+
assert.throws(()=>createCmAiBatch({configuration,executionFor:async()=>{opened++;return {};},logHome:path.join(f.root,'logs')}),
|
|
62
|
+
error=>error.code==='protected_scope'&&error.reason.startsWith(`${FEATURE}/T-006: `)&&error.reason.includes('.claude/rules/security.md'));
|
|
63
|
+
assert.equal(opened,0);reviewsAbsent(f);
|
|
64
|
+
assert.equal(fs.existsSync(path.join(f.specsDir,'运行日志.jsonl')),false);assert.equal(fs.existsSync(path.join(f.root,'logs')),false);
|
|
65
|
+
// A bootstrap rule task keeps its own instruction targets (host-bootstrap checks its business scope).
|
|
66
|
+
assert.doesNotThrow(()=>createCmAiBatch({configuration,executionFor:async()=>({}),logHome:path.join(f.root,'logs'),
|
|
67
|
+
bootstrapKeys:[`${FEATURE}/T-006`]}));
|
|
68
|
+
});
|
|
69
|
+
|
|
70
|
+
async function runnerFixture(t,scope){
|
|
71
|
+
const {createTaskRunner}=await import('../runtime/js/cm-ai/task-runner.mjs');
|
|
72
|
+
const {openTaskExecutionStore}=await import('../runtime/js/cm-ai/task-owner.mjs');
|
|
73
|
+
const temp=fs.realpathSync(fs.mkdtempSync(path.join(os.tmpdir(),'cm-protected-scope-')));
|
|
74
|
+
const root=path.join(temp,'code'),specsRoot=path.join(temp,'specs'),reviewsDir=path.join(specsRoot,'.reviews');
|
|
75
|
+
fs.mkdirSync(path.join(root,'.claude','rules'),{recursive:true});fs.mkdirSync(reviewsDir,{recursive:true});
|
|
76
|
+
fs.mkdirSync(path.join(specsRoot,FEATURE));
|
|
77
|
+
const tasksPath=path.join(specsRoot,FEATURE,'tasks.md');fs.writeFileSync(tasksPath,'- [ ] T-006: fixture\n');
|
|
78
|
+
for(const [file,content] of Object.entries({'code.js':'old\n','requirements.md':'fixture\n','AGENTS.md':'# rules\n',
|
|
79
|
+
'.claude/rules/security.md':'# security\n'}))fs.writeFileSync(path.join(root,file),content);
|
|
80
|
+
const identity={repositoryId:'fixture',runId:'api-native-reading-T-006',taskId:'T-006',attempt:1};
|
|
81
|
+
const owner={tasksPath,feature:'api-native-reading',specsRoot,identity:{repositoryId:identity.repositoryId,runId:identity.runId},
|
|
82
|
+
fingerprints:{workflow:digest('protected-scope'),config:digest('fixture'),inputs:digest('original')},create:true};
|
|
83
|
+
let store=openTaskExecutionStore(owner),developerCalls=0,developerRun=()=>{throw new Error('developer must not run');};
|
|
84
|
+
const options={root,identity,scope,requirements:['requirements.md'],excludedContexts:['main'],timeoutMs:1000,
|
|
85
|
+
developer:{provider:'claude',requestedModel:'current-session',contextId:'cm-conversation-author',
|
|
86
|
+
run:(...args)=>{developerCalls++;return developerRun(...args);}},
|
|
87
|
+
reviewers:[{id:'reviewer',adapterId:'claude-review-adapter',provider:'claude',requestedModel:'fixture',allowed:true,
|
|
88
|
+
available:true,contexts:['review-1','review-2'],run:()=>{throw new Error('reviewer must not run');}}],
|
|
89
|
+
check:()=>{throw new Error('checks must not run');},
|
|
90
|
+
taskCompletion:{reviewsDir,handoffs:[1,2].map(n=>path.join(reviewsDir,`api-native-reading-T-006-a${n}-handoff.json`))},
|
|
91
|
+
taskLearning:{feature:FEATURE,hostHandoff:true},
|
|
92
|
+
reviewInvocation:{developerThreadId:'actual-developer',excludedThreadIds:['actual-main'],
|
|
93
|
+
authorize:()=>{throw new Error('review must not be authorized');}}};
|
|
94
|
+
const make=mode=>createTaskRunner({...options,persistence:{store,mode,version:3}});
|
|
95
|
+
const statePath=path.join(reviewsDir,'.execution',identity.runId,'state.json');
|
|
96
|
+
const reopen=()=>{store.close();store=openTaskExecutionStore({...owner,create:false});return make('resume');};
|
|
97
|
+
t.after(()=>{store.close();fs.rmSync(temp,{recursive:true,force:true});});
|
|
98
|
+
const files=[{scope:'project',path:'AGENTS.md',sha256:digest('agents')}];
|
|
99
|
+
const learningInput={version:1,workflow:'cm-ai',phase:'task_learning_input',feature:FEATURE,identity,
|
|
100
|
+
learningDigest:digest({version:1,feature:FEATURE,identity,files}),learningFiles:files};
|
|
101
|
+
const develop=(id='develop-1')=>({version:1,id,identity,kind:'develop',learningInput});
|
|
102
|
+
return {identity,options,statePath,root,specsRoot,tasksPath,develop,make:()=>make('create'),resume:()=>make('resume'),reopen,records:()=>store.snapshot().records,
|
|
103
|
+
developerCalls:()=>developerCalls,setDeveloper:fn=>{developerRun=fn;},close:()=>store.close(),
|
|
104
|
+
reopenStore:()=>{store=openTaskExecutionStore({...owner,create:false});}};
|
|
105
|
+
}
|
|
106
|
+
function rechain(records){
|
|
107
|
+
let previousDigest=null;
|
|
108
|
+
for(const row of records){row.previousDigest=previousDigest;const {digest:old,...body}=row;row.digest=digest(body);previousDigest=row.digest;}
|
|
109
|
+
return records;
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
test('a protected scope blocks before dispatch as a definite blocked/protected_scope, never unknown',async t=>{
|
|
113
|
+
const f=await runnerFixture(t,['code.js',...PROTECTED]);
|
|
114
|
+
const result=await f.make().executeEffect(f.develop());
|
|
115
|
+
assert.equal(result.state,'blocked');assert.equal(result.code,'protected_scope');
|
|
116
|
+
for(const file of PROTECTED)assert(result.reason.includes(file),result.reason);
|
|
117
|
+
assert.equal(f.developerCalls(),0);assert.deepEqual(result.calls,[]);
|
|
118
|
+
assert.deepEqual(f.records().map(row=>row.payload.type),['init','effect-intent','effect-checkpoint']);
|
|
119
|
+
// The block replays as recorded, is terminal, and a later develop is refused without dispatch.
|
|
120
|
+
const resumed=f.reopen();
|
|
121
|
+
assert.equal(resumed.status().state,'blocked');assert.equal(resumed.status().code,'protected_scope');
|
|
122
|
+
const retry=await resumed.executeEffect(f.develop('develop-2'));
|
|
123
|
+
assert.equal(retry.outcome,'rejected');assert.equal(retry.code,'stage_mismatch');assert.equal(f.developerCalls(),0);
|
|
124
|
+
const guidance=operatorGuidance({workflow:'cm-ai',identity:f.identity,state:'blocked',code:'protected_scope',pendingAction:'none'});
|
|
125
|
+
assert.equal(guidance.recoveryOperation,null);assert.match(guidance.nextStep,/新 runId/);
|
|
126
|
+
});
|
|
127
|
+
|
|
128
|
+
// Rewrite the new checkpoint into the exact shape a pre-gate host journaled for
|
|
129
|
+
// T-006: the adapter's refusal escaped as unknown/execution_error with one
|
|
130
|
+
// started developer call that never returned (state.json of 2026-10-05).
|
|
131
|
+
function strandLikeT006(f){
|
|
132
|
+
const state=JSON.parse(fs.readFileSync(f.statePath,'utf8')),records=state.records;
|
|
133
|
+
const init=records[0].payload,intent=records[1].payload.effect,last=records[2];
|
|
134
|
+
const session=init.session,original=init.baseline,config=init.config;
|
|
135
|
+
const request=requestFor({invocationId:`${session}.1`,identity:{...config.identity,attempt:1},role:'developer',
|
|
136
|
+
provider:config.developer.provider,requestedModel:config.developer.requestedModel,contextId:config.developer.contextId,
|
|
137
|
+
payload:{scope:config.scope,requirements:original.files.filter(file=>config.requirements.includes(file.path)),priorReview:null,
|
|
138
|
+
learningInput:intent.learningInput}});
|
|
139
|
+
const call={invocationId:request.invocationId,contextId:config.developer.contextId,provider:config.developer.provider,
|
|
140
|
+
requestedModel:config.developer.requestedModel,effectiveModel:'unknown',channel:'fixture',started:true,terminal:'unknown',
|
|
141
|
+
requestDigest:request.requestDigest,resultDigest:null};
|
|
142
|
+
const checkpoint={...last.payload.checkpoint,state:'unknown',code:'execution_error',reason:null,sequence:1,calls:[call]};
|
|
143
|
+
checkpoint.cache=[{effect:intent,digest:digest(intent),result:runnerStatus(checkpoint,config)}];
|
|
144
|
+
records[2]={...last,payload:{...last.payload,checkpoint}};
|
|
145
|
+
const {revision,...body}=state;body.records=rechain(records);
|
|
146
|
+
f.close();fs.writeFileSync(f.statePath,JSON.stringify({...body,revision:digest(body)})+'\n',{mode:0o600});f.reopenStore();
|
|
147
|
+
return call;
|
|
148
|
+
}
|
|
149
|
+
|
|
150
|
+
test('a stranded T-006 journal replays as blocked/protected_scope and its records stay byte for byte',async t=>{
|
|
151
|
+
const f=await runnerFixture(t,['code.js',...PROTECTED]);
|
|
152
|
+
await f.make().executeEffect(f.develop());
|
|
153
|
+
const call=strandLikeT006(f);
|
|
154
|
+
const legacyBytes=fs.readFileSync(f.statePath);
|
|
155
|
+
const records=JSON.parse(legacyBytes).records;
|
|
156
|
+
assert.deepEqual(records.map(row=>row.payload.type),['init','effect-intent','effect-checkpoint']);
|
|
157
|
+
assert.equal(records[2].payload.checkpoint.state,'unknown');assert.equal(records[2].payload.checkpoint.code,'execution_error');
|
|
158
|
+
// Before this fix the same records had no exit: unknown, reconcile, and no pending intent to abandon.
|
|
159
|
+
const history=readRunnerHistory(records,records[0].payload.config,3);
|
|
160
|
+
assert.equal(history.pending,null);assert.equal(history.pendingAbandonable,false);
|
|
161
|
+
assert.equal(history.state.state,'blocked');assert.equal(history.state.code,'protected_scope');
|
|
162
|
+
for(const file of PROTECTED)assert(history.state.reason.includes(file),history.state.reason);
|
|
163
|
+
const resumed=f.resume();
|
|
164
|
+
const status=resumed.status();
|
|
165
|
+
assert.equal(status.state,'blocked');assert.equal(status.code,'protected_scope');
|
|
166
|
+
assert.deepEqual(status.calls,[call]);
|
|
167
|
+
const retry=await resumed.executeEffect(f.develop('develop-2'));
|
|
168
|
+
assert.equal(retry.outcome,'rejected');assert.equal(f.developerCalls(),0);
|
|
169
|
+
// abandon_effect is not needed and still refuses: there is no pending intent.
|
|
170
|
+
assert.equal(resumed.abandonEffect({allowed:true,reason:'protected scope'}).outcome,'rejected');
|
|
171
|
+
assert.equal(records[2].payload.checkpoint.learningResult,null);
|
|
172
|
+
// The exit: a new run by the original gates. Both read the stranded journal and admit it.
|
|
173
|
+
f.close();
|
|
174
|
+
const next={specsDir:f.specsRoot,codeProject:f.root,feature:FEATURE,tasksPath:f.tasksPath,
|
|
175
|
+
identity:{...f.identity,runId:'api-native-reading-T-006-r2'}};
|
|
176
|
+
assert.doesNotThrow(()=>assertNoUnrecordedPriorCode(next));
|
|
177
|
+
const supersession=prepareReviewedEvidenceSupersession({...next,reason:'scope 移除受保护规则文件后重建'});
|
|
178
|
+
assert.deepEqual(supersession.previousRunIds,[f.identity.runId]);
|
|
179
|
+
f.reopenStore();
|
|
180
|
+
assert.deepEqual(fs.readFileSync(f.statePath),legacyBytes);
|
|
181
|
+
});
|
|
182
|
+
|
|
183
|
+
test('the same unknown developer shape without a protected scope is still unknown',async t=>{
|
|
184
|
+
const f=await runnerFixture(t,['code.js']);
|
|
185
|
+
f.setDeveloper(()=>{throw new Error('adapter failure');});
|
|
186
|
+
const result=await f.make().executeEffect(f.develop());
|
|
187
|
+
assert.equal(result.state,'unknown');assert.equal(result.code,'execution_error');assert.equal(f.developerCalls(),1);
|
|
188
|
+
// The genuine pre-gate shape has the same call fields the T-006 rewrite uses.
|
|
189
|
+
assert.deepEqual(Object.keys(result.calls[0]),['invocationId','contextId','provider','requestedModel','effectiveModel',
|
|
190
|
+
'channel','started','terminal','requestDigest','resultDigest']);
|
|
191
|
+
assert.equal(result.calls[0].terminal,'unknown');assert.equal(result.calls[0].resultDigest,null);
|
|
192
|
+
const resumed=f.reopen();
|
|
193
|
+
assert.equal(resumed.status().state,'unknown');assert.equal(resumed.status().code,'execution_error');
|
|
194
|
+
});
|
|
@@ -128,6 +128,27 @@ const snapshot=f=>JSON.parse(fs.readFileSync(statePath(f)));
|
|
|
128
128
|
const fixedQa=qa=>({...qa,commands:[{id:'version',command:[process.execPath,'--version'],caseIds:[]}]});
|
|
129
129
|
const revision=qa=>({qaConfigRevision:{previousWorkflow:{qa,documentationPaths:[],applicableAgentFiles:[]},reason:'Correct missing project QA command'}});
|
|
130
130
|
|
|
131
|
+
for(const missingMirror of [false,true])test(`progress R1: resume/status preserves a newer task card while replaying QA revision; missingMirror=${missingMirror}`,()=>fixture(async f=>{
|
|
132
|
+
const {writeStatusProjection}=await import('../runtime/js/cm-ai/status-projection.mjs');
|
|
133
|
+
const {execution,configure,qa,counts}=await completed(f);configure(fixedQa(qa));
|
|
134
|
+
let run=await openControlRun(f.definition,'resume',execution,revision(qa));run.close();
|
|
135
|
+
const log=path.join(f.specsDir,'运行日志.jsonl');
|
|
136
|
+
if(missingMirror)fs.writeFileSync(log,fs.readFileSync(log,'utf8').split('\n')
|
|
137
|
+
.filter(line=>!line||JSON.parse(line).reason!=='qa_configuration_revision').join('\n'));
|
|
138
|
+
writeStatusProjection({specsDir:f.specsDir,feature:'2.newer',identity:{...identity,runId:'newer-run',taskId:'T-002'},
|
|
139
|
+
node:'N3',state:'checking',detail:'newer task checking',claim:true});
|
|
140
|
+
const statusPath=path.join(f.specsDir,'.cm-status.json'),before=fs.readFileSync(statusPath),journal=fs.readFileSync(statePath(f));
|
|
141
|
+
run=await openControlRun(f.definition,'resume',execution);
|
|
142
|
+
try{
|
|
143
|
+
assert.deepEqual(fs.readFileSync(statusPath),before,'opening the old owner must not claim the newer card');
|
|
144
|
+
assert.equal((await run.host.handle(request('status'))).state,'fixture_completed');
|
|
145
|
+
assert.deepEqual(fs.readFileSync(statusPath),before);
|
|
146
|
+
}finally{run.close();}
|
|
147
|
+
assert.deepEqual(fs.readFileSync(statePath(f)),journal);assert.deepEqual(counts(),{calls:1,reviews:1});
|
|
148
|
+
assert.equal(fs.readFileSync(log,'utf8').trim().split('\n').map(JSON.parse)
|
|
149
|
+
.filter(row=>row.reason==='qa_configuration_revision').length,1,'missing history still recovers exactly once');
|
|
150
|
+
}));
|
|
151
|
+
|
|
131
152
|
test('F7 revision resumes N6, preserves N5 and history, replays without authorization flag',()=>fixture(async f=>{
|
|
132
153
|
const {execution,configure,qa,counts}=await completed(f),before=snapshot(f);
|
|
133
154
|
const review=path.join(f.specsDir,'.reviews','login-T-001-r1.md'),receipt=fs.readFileSync(review);
|
|
@@ -1,15 +1,20 @@
|
|
|
1
|
-
// Reviewer failures,
|
|
2
|
-
//
|
|
3
|
-
//
|
|
1
|
+
// Reviewer failures, verdict rules and review race bounds use native
|
|
2
|
+
// driver/host fixtures or production worker/runner fixtures with in-memory
|
|
3
|
+
// transport. Prompt checks build packages directly. No model service is contacted.
|
|
4
4
|
import nodeTest from 'node:test';
|
|
5
5
|
import assert from 'node:assert/strict';
|
|
6
6
|
import fs from 'node:fs';
|
|
7
7
|
import os from 'node:os';
|
|
8
8
|
import path from 'node:path';
|
|
9
|
+
import {EventEmitter} from 'node:events';
|
|
10
|
+
import {PassThrough} from 'node:stream';
|
|
9
11
|
import {spawnSync} from 'node:child_process';
|
|
10
12
|
import {fileURLToPath} from 'node:url';
|
|
11
13
|
import {buildManifest} from './cm-spec-manifest.mjs';
|
|
12
|
-
import {claudeReviewFingerprint} from '../runtime/js/cm-ai/worker-claude.mjs';
|
|
14
|
+
import {claudeReviewFingerprint,claudeWorker} from '../runtime/js/cm-ai/worker-claude.mjs';
|
|
15
|
+
import {createClaudeReviewRun} from '../runtime/js/cm-ai/claude-review-adapter.mjs';
|
|
16
|
+
import {reviewRetryable} from '../runtime/js/cm-ai/cm-ai-conversation-entry.mjs';
|
|
17
|
+
import {captureReviewBaseline,createReviewPackage} from '../runtime/js/cm-ai/review-package.mjs';
|
|
13
18
|
import {digest,requestFor} from '../runtime/js/cm-ai/effect-contract.mjs';
|
|
14
19
|
import {readRunnerHistory,runnerStatus} from '../runtime/js/cm-ai/durable-runner-state.mjs';
|
|
15
20
|
import {inspectProviderReview,inspectProviderReviewFailure} from '../runtime/js/cm-ai/provider-review-observation.mjs';
|
|
@@ -18,8 +23,8 @@ import {reviewPaths} from '../runtime/js/cm-ai/review-runner.mjs';
|
|
|
18
23
|
import {isSupportedExecutionPlatform} from '../runtime/js/cm-ai/execution-platform.mjs';
|
|
19
24
|
import {guardFixtureSource,killFixtureProcesses} from './fixtures/process-cleanup.mjs';
|
|
20
25
|
|
|
21
|
-
//
|
|
22
|
-
//
|
|
26
|
+
// Native V3 runner fixtures require Node 24.14+ on macOS/Linux. Preserve the
|
|
27
|
+
// suite's existing explicit platform gate; only CLI fixtures spawn POSIX shims.
|
|
23
28
|
const skip=!isSupportedExecutionPlatform();
|
|
24
29
|
const test=(name,fn)=>nodeTest(name,{skip},fn);
|
|
25
30
|
|
|
@@ -115,7 +120,55 @@ const apiErrors=[
|
|
|
115
120
|
['model_not_found',404,'model: claude-opus-5 not found','reviewer_model_not_found'],
|
|
116
121
|
];
|
|
117
122
|
for(const [error,status,text,failure] of apiErrors)
|
|
118
|
-
test(`#8 real Claude CLI ${error} ends in a retryable review that names ${failure}`,t=>{
|
|
123
|
+
test(`#8 ${error==='authentication_failed'?'real Claude CLI':'in-process Claude worker'} ${error} ends in a retryable review that names ${failure}`,t=>{
|
|
124
|
+
// The authentication case retains the real driver/host/CLI round trip.
|
|
125
|
+
// These variants still traverse the production worker, adapter and durable
|
|
126
|
+
// runner, but only the transport is in memory; no child or process cleanup.
|
|
127
|
+
if(error!=='authentication_failed')return runnerFixture(t,async f=>{
|
|
128
|
+
const spawned=[],signals=[];
|
|
129
|
+
f.state.review=(request,control)=>{
|
|
130
|
+
const config={cwd:f.root,model:'fixture',cli:'never-run-review-cli'};
|
|
131
|
+
const worker=claudeWorker({...config,timeoutMs:5000,
|
|
132
|
+
preflight:{passed:true,provider:'claude',prompt_transport:'stdin',config_fingerprint:claudeReviewFingerprint(config)},
|
|
133
|
+
killProcess:(pid,signal)=>signals.push({pid,signal}),
|
|
134
|
+
spawnProcess:(cli,args,{stdio,detached})=>{
|
|
135
|
+
const child=new EventEmitter();child.pid=12345;
|
|
136
|
+
child.stdin=new PassThrough();child.stdout=new PassThrough();child.stderr=new PassThrough();
|
|
137
|
+
child.kill=signal=>{signals.push({pid:child.pid,signal});return true;};
|
|
138
|
+
let prompt='';child.stdin.on('data',chunk=>prompt+=chunk);
|
|
139
|
+
spawned.push({cli,args,stdio,detached});
|
|
140
|
+
child.stdin.once('finish',()=>queueMicrotask(()=>{
|
|
141
|
+
const marker='<cm-review-data-json>\n',data=JSON.parse(prompt.slice(prompt.indexOf(marker)+marker.length));
|
|
142
|
+
assert.equal(data.reviewPackage.packageDigest,request.payload.reviewPackage.packageDigest);
|
|
143
|
+
const session_id='in-memory-review';
|
|
144
|
+
const messages=[{type:'system',subtype:'init',session_id},
|
|
145
|
+
{type:'assistant',session_id,parent_tool_use_id:null,error,is_api_error_message:true,
|
|
146
|
+
message:{role:'assistant',content:[{type:'text',text}]}},
|
|
147
|
+
{type:'result',subtype:'success',session_id,is_error:true,num_turns:1,result:text,
|
|
148
|
+
terminal_reason:'api_error',api_error_status:status}];
|
|
149
|
+
child.stdout.write(messages.map(JSON.stringify).join('\n')+'\n');
|
|
150
|
+
child.stdout.end();child.stderr.end();child.emit('close',1,null);
|
|
151
|
+
}));
|
|
152
|
+
return child;
|
|
153
|
+
}});
|
|
154
|
+
return createClaudeReviewRun(worker)(request,control);
|
|
155
|
+
};
|
|
156
|
+
const runner=f.make();
|
|
157
|
+
assert.equal((await runner.executeEffect(f.effect('develop'))).state,'awaiting_review');
|
|
158
|
+
const failed=await runner.executeEffect(f.effect('review'));
|
|
159
|
+
assert.equal(failed.state,'pending_review');assert.equal(failed.code,'review_provider_failed');
|
|
160
|
+
assert.equal(reviewRetryable(failed),true);assert.match(failed.reason,new RegExp(`^${failure}: `));
|
|
161
|
+
const result=f.records().findLast(row=>row.payload.type==='review-invocation-result').payload;
|
|
162
|
+
assert.equal(result.outcome,'failed');assert.equal(result.reconciliationRequired,false);
|
|
163
|
+
assert.equal(result.inspection.kind,'cm-provider-review-failure');assert.equal(result.inspection.category,'provider');
|
|
164
|
+
assert.equal(result.inspection.failure,failure);assert.equal(result.observation.result.code,failure);
|
|
165
|
+
assert.deepEqual(result.observation.events.map(event=>event.event),['thread.started','turn.started','process_closed']);
|
|
166
|
+
const history=f.replay();assert.equal(history.state.state,'pending_review');assert.equal(history.state.code,'review_provider_failed');
|
|
167
|
+
assert.equal(history.state.receipts.length,0);assert.deepEqual(f.reopen().status(),failed);
|
|
168
|
+
assert.equal(spawned.length,1);assert.equal(spawned[0].cli,'never-run-review-cli');
|
|
169
|
+
assert.equal(spawned[0].detached,true);assert.deepEqual(spawned[0].stdio,['pipe','pipe','pipe']);
|
|
170
|
+
assert(signals.every(row=>row.pid===-12345),'signals must target only the injected transport');
|
|
171
|
+
},{reviewerProvider:'claude',reviewTimeoutMs:5000});
|
|
119
172
|
const f=fixture(t),packageDigest=f.awaitingReview();
|
|
120
173
|
f.behave({mode:'api_error',error,status,text});
|
|
121
174
|
const failed=f.decide(packageDigest);
|
|
@@ -203,8 +256,15 @@ test('#9 a blocked verdict stays terminal and says why instead of a bare code',t
|
|
|
203
256
|
});
|
|
204
257
|
|
|
205
258
|
test('#9 every reviewer prompt states the verdict rules and what blocked means',t=>{
|
|
206
|
-
|
|
207
|
-
const
|
|
259
|
+
// Prompt content requires a valid package, not a running driver or reviewer.
|
|
260
|
+
const root=fs.realpathSync(fs.mkdtempSync(path.join(os.tmpdir(),'cm-review-prompt-')));
|
|
261
|
+
t.after(()=>fs.rmSync(root,{recursive:true,force:true}));
|
|
262
|
+
fs.writeFileSync(path.join(root,'target.mjs'),'export const value = 1;\n');
|
|
263
|
+
fs.writeFileSync(path.join(root,'requirements.md'),'# Synthetic requirement\n');
|
|
264
|
+
const baseline=captureReviewBaseline({root,identity,scope:['target.mjs'],requirements:['requirements.md']});
|
|
265
|
+
fs.writeFileSync(path.join(root,'target.mjs'),'export const value = 42;\n');
|
|
266
|
+
const reviewPackage=createReviewPackage({root,baseline,
|
|
267
|
+
checks:[{id:'synthetic',command:['synthetic'],outcome:'passed',exitCode:0,evidence:'Synthetic check'}]});
|
|
208
268
|
for(const provider of ['codex','claude']){
|
|
209
269
|
const request=requestFor({invocationId:'prompt-check',identity,role:'reviewer',provider,requestedModel:'fixture',
|
|
210
270
|
contextId:'cm-conversation-review-1',payload:{reviewPackage,priorReview:null}});
|
|
@@ -327,7 +387,7 @@ const reviewEvents=(onEvent,request,{result=true,close=true}={})=>{
|
|
|
327
387
|
};
|
|
328
388
|
const verdict=(request,value,findings=[])=>({status:'succeeded',value:{verdict:value,packageDigest:request.payload.reviewPackage.packageDigest,
|
|
329
389
|
examinedPaths:reviewPaths(request.payload.reviewPackage),findings,summary:'Synthetic'}});
|
|
330
|
-
async function runnerFixture(t,fn,{timeoutMs=1000,reviewTimeoutMs}={}){
|
|
390
|
+
async function runnerFixture(t,fn,{timeoutMs=1000,reviewTimeoutMs,reviewerProvider='codex'}={}){
|
|
331
391
|
const {createTaskRunner}=await import('../runtime/js/cm-ai/task-runner.mjs');
|
|
332
392
|
const {openTaskExecutionStore}=await import('../runtime/js/cm-ai/task-owner.mjs');
|
|
333
393
|
const temp=fs.realpathSync(fs.mkdtempSync(path.join(os.tmpdir(),'cm-review-failure-runner-')));
|
|
@@ -346,7 +406,7 @@ async function runnerFixture(t,fn,{timeoutMs=1000,reviewTimeoutMs}={}){
|
|
|
346
406
|
fs.writeFileSync(path.join(root,'code.js'),state.content(request.identity.attempt));return {version:1,invocationId:request.invocationId,
|
|
347
407
|
contextId:request.contextId,provider:request.provider,effectiveModel:'fixture',status:'succeeded',accepted:true,
|
|
348
408
|
result:{outcome:'implemented'}};}},
|
|
349
|
-
reviewers:[{id:'reviewer',adapterId
|
|
409
|
+
reviewers:[{id:'reviewer',adapterId:`${reviewerProvider}-review-adapter`,provider:reviewerProvider,requestedModel:'fixture',allowed:true,
|
|
350
410
|
available:true,contexts:['review-logical-1','review-logical-2'],run:(request,control)=>{dispatches++;return state.review(request,control);}}],
|
|
351
411
|
check:request=>checks(request),
|
|
352
412
|
taskCompletion:{reviewsDir,handoffs:[path.join(reviewsDir,'a1.json'),path.join(reviewsDir,'a2.json')]},
|
package/scripts/cm-ai-run.mjs
CHANGED
|
@@ -8,6 +8,7 @@ import {digest as sha} from '../runtime/js/cm-ai/contracts.mjs';
|
|
|
8
8
|
import {resolveCodeProjects,codeProjectPaths,assertCodeProjectSelections} from '../runtime/js/cm-ai/code-projects.mjs';
|
|
9
9
|
import {preQaConfigurations,readQaAttachment} from '../runtime/js/cm-ai/qa-attachment.mjs';
|
|
10
10
|
import {recordCmAiQaAttachment} from '../runtime/js/cm-ai/cm-ai-qa-log.mjs';
|
|
11
|
+
import {writeCmAiQaStatus} from '../runtime/js/cm-ai/cm-ai-run-finalizer.mjs';
|
|
11
12
|
import {isSupportedExecutionPlatform} from '../runtime/js/cm-ai/execution-platform.mjs';
|
|
12
13
|
import {readExecutionSnapshot} from '../runtime/js/cm-ai/execution-snapshot.mjs';
|
|
13
14
|
import {hasLegacyQaPlanFingerprint,previousQaMaterial,qaConfigurationSlice,qaExecutorMaterial,qaInvariantDigest,qaRevisionChain,verifyQaRevisionMaterial} from '../runtime/js/cm-ai/qa-config-revision.mjs';
|
|
@@ -19,6 +20,8 @@ import {recordEffectAbandonment} from '../runtime/js/cm-ai/effect-abandon-log.mj
|
|
|
19
20
|
import {reviewConsumedHandoff,reviewedHandoffConflict} from '../runtime/js/cm-ai/host-handoff.mjs';
|
|
20
21
|
import {RUN_ID_RULE,validRunId} from './cm-log-event.mjs';
|
|
21
22
|
import {JOURNAL_PAYLOAD_LIMIT,boundedReason} from '../runtime/js/cm-ai/effect-contract.mjs';
|
|
23
|
+
import {protectedScopePaths} from '../runtime/js/cm-ai/developer-adapter.mjs';
|
|
24
|
+
import {closeoutPolicyCandidates} from '../runtime/js/cm-ai/knowledge-closeout.mjs';
|
|
22
25
|
|
|
23
26
|
const usage='cm-ai-run.mjs serve --config RUN_DEFINITION.json --mode create|resume (no provider dispatch)\nNew runs bind approved specification material from specsDir; requirements may be [] or supplemental code-project files. Manifest drift blocks as spec_drift; legacy journals retain their original format.';
|
|
24
27
|
const fail=code=>{throw Object.assign(new Error(code),{code});};
|
|
@@ -112,7 +115,7 @@ export async function createCodexExecution(configuration,authority){
|
|
|
112
115
|
// original checks/handoff/Review. The semantic bridge never writes it.
|
|
113
116
|
const {isFinalCmAiTask}=await import('../runtime/js/cm-ai/cm-ai-admission.mjs');
|
|
114
117
|
const sync=documentationPaths.length>0&&isFinalCmAiTask({specsDir:specsRoot,codeProject:config.codeProject,
|
|
115
|
-
feature:workflowDefinition.feature,taskId:bound.identity.taskId});
|
|
118
|
+
feature:workflowDefinition.feature,taskId:bound.identity.taskId,featureSelection:workflowDefinition.featureSelection?.feature});
|
|
116
119
|
const protectedWorker=sync?(request,control)=>worker({...request,prompt:
|
|
117
120
|
'Before returning, inspect and synchronize these already-approved ordinary documentation paths with the implemented behavior. '
|
|
118
121
|
+'Keep accurate unchanged documents unchanged. No extra scope or protected instruction writes. '
|
|
@@ -148,6 +151,7 @@ export function validateRunDefinition(input){
|
|
|
148
151
|
const keys=['version','specsDir','codeProject','feature','identity','scope','requirements'];
|
|
149
152
|
if(value&&Object.hasOwn(value,'codeProjects'))keys.push('codeProjects');
|
|
150
153
|
if(value&&Object.hasOwn(value,'taskSelection'))keys.push('taskSelection');
|
|
154
|
+
if(value&&Object.hasOwn(value,'featureSelection'))keys.push('featureSelection');
|
|
151
155
|
if(!value||typeof value!=='object')fail('invalid_config: expected an object');
|
|
152
156
|
const unexpected=Object.keys(value).filter(key=>!keys.includes(key));
|
|
153
157
|
const missing=keys.filter(key=>!Object.hasOwn(value,key));
|
|
@@ -170,6 +174,11 @@ export function validateRunDefinition(input){
|
|
|
170
174
|
if(Object.hasOwn(value,'taskSelection')&&(!value.taskSelection||value.taskSelection.version!==1
|
|
171
175
|
||Object.keys(value.taskSelection).sort().join(',')!=='taskId,version'
|
|
172
176
|
||value.taskSelection.taskId!==value.identity.taskId))fail('invalid_task_selection');
|
|
177
|
+
// Explicit batch choice: run this approved feature even while an earlier one
|
|
178
|
+
// has pending tasks. Bound into the definition, so it is part of the run.
|
|
179
|
+
if(Object.hasOwn(value,'featureSelection')&&(!value.featureSelection||value.featureSelection.version!==1
|
|
180
|
+
||Object.keys(value.featureSelection).sort().join(',')!=='feature,version'
|
|
181
|
+
||value.featureSelection.feature!==value.feature))fail('invalid_feature_selection');
|
|
173
182
|
for(const key of ['scope','requirements']){
|
|
174
183
|
if(!Array.isArray(value[key])||(!value[key].length&&!(key==='requirements'))||value[key].length>256
|
|
175
184
|
||value[key].some(p=>typeof p!=='string'||!p||p.includes('\\')||p.includes('\0')
|
|
@@ -183,6 +192,18 @@ export function validateRunDefinition(input){
|
|
|
183
192
|
}
|
|
184
193
|
return value;
|
|
185
194
|
}
|
|
195
|
+
// Read-only, shared by every create entry before it locks, logs or builds an
|
|
196
|
+
// execution: the single-task host, openControlRun and the batch owner.
|
|
197
|
+
export function assertCreatableScope(scope){
|
|
198
|
+
const paths=protectedScopePaths(scope);
|
|
199
|
+
if(paths.length)throw Object.assign(new Error('protected_scope'),{code:'protected_scope',paths,reason:protectedScopeReason(paths)});
|
|
200
|
+
}
|
|
201
|
+
export function protectedScopeReason(paths){
|
|
202
|
+
const listed=paths.slice(0,20).join('、')+(paths.length>20?` 等 ${paths.length} 个`:'');
|
|
203
|
+
return `任务 scope 含受保护路径:${listed}。开发者不能写项目规则(AGENTS.md、CLAUDE.md、.claude/、.codex/)、`
|
|
204
|
+
+'tasks.md、.cm-* 或审查记录;未建运行,未写任何运行记录。从 scope 移除这些路径后重新生成运行定义再 create;'
|
|
205
|
+
+'规则文件的修改走 docs/js-workflow-control.md「项目规则文件的修改通道」。';
|
|
206
|
+
}
|
|
186
207
|
// Create-time only: an existing journal keeps resuming (and can be abandoned)
|
|
187
208
|
// exactly as before, while a new run can no longer strand its first develop
|
|
188
209
|
// effect on a run ID the run log refuses.
|
|
@@ -193,9 +214,10 @@ export function assertCreatableRunId(identity){
|
|
|
193
214
|
// Definition is data, never an import path, command, grant or executable callback.
|
|
194
215
|
// legacyQa rebuilds the historical QA executor form for stores created before
|
|
195
216
|
// the built-in plan left the fingerprint; it is never used to create a store.
|
|
196
|
-
export function runConfigMaterial(definition,execution,{parallelSelection=null,bootstrapConfig=null,legacyQa=false}={}){
|
|
217
|
+
export function runConfigMaterial(definition,execution,{parallelSelection=null,bootstrapConfig=null,legacyQa=false,knowledgeCloseout=null}={}){
|
|
197
218
|
if(execution===null)return parallelSelection===null?definition:{definition,parallelSelection};
|
|
198
219
|
return {definition,...(parallelSelection===null?{}:{parallelSelection}),execution:execution.configuration,
|
|
220
|
+
...(knowledgeCloseout===null?{}:{knowledgeCloseout}),
|
|
199
221
|
...(bootstrapConfig?{bootstrap:bootstrapConfig}:{}),
|
|
200
222
|
...(Object.hasOwn(execution,'developmentAttempt')?{developmentAuthorization:'per-attempt-v1'}:{}),
|
|
201
223
|
...(execution.hostDecisionProvider?{hostDecisionProvider:{version:1,timeoutMs:execution.hostDecisionProvider.timeoutMs}}:{}),
|
|
@@ -210,14 +232,36 @@ const LEGACY_QA_FINGERPRINT_REASON='运行指纹与当前配置不符。若此
|
|
|
210
232
|
+'(项目 .cm-workflow.yml、~/.cm-workflow/runtimes.yml 与插件内置默认值):把这些配置恢复为创建时的内容即可恢复;'
|
|
211
233
|
+'现在新建的运行不再把这些可变配置写进指纹。否则请核对 run.json、--workflow-config、宿主身份及授权参数是否与创建时一致。';
|
|
212
234
|
|
|
213
|
-
export async function openControlRun(definition,mode,execution=null,
|
|
235
|
+
export async function openControlRun(definition,mode,execution=null,options={}){
|
|
236
|
+
if(!isSupportedExecutionPlatform())fail('unsupported_runner_platform');
|
|
237
|
+
if(!['create','resume'].includes(mode))fail('invalid_mode');
|
|
238
|
+
let guard;
|
|
239
|
+
try{
|
|
240
|
+
const acquire=async()=>{
|
|
241
|
+
const {acquireExternalRunGuard,externalRunGuardExists}=await import('../runtime/js/cm-ai/external-run-guard.mjs');
|
|
242
|
+
const strict=Boolean(execution?.configuration?.externalModels||execution?.configuration?.executionPolicy);
|
|
243
|
+
// Switching this binary to a legacy launch must not bypass an existing strict attempt.
|
|
244
|
+
if(strict||externalRunGuardExists(definition.specsDir,definition.codeProject))guard=acquireExternalRunGuard(definition,{strictOnly:!strict});
|
|
245
|
+
};
|
|
246
|
+
const result=await openControlRunOwned(definition,mode,execution,options,acquire);
|
|
247
|
+
const close=result.close;
|
|
248
|
+
return {...result,close:()=>{try{close();}finally{guard?.close();}}};
|
|
249
|
+
}catch(error){guard?.close();throw error;}
|
|
250
|
+
}
|
|
251
|
+
async function openControlRunOwned(definition,mode,execution=null,{rerunUnknownQa=false,rerunBlockedQa=false,qaEnvironmentFailure=null,parallelSelection=null,qaConfigRevision=null,supersedeReason=null,acceptSupersededCodeDrift=false,allowAbandonReview=false,allowAbandonEffect=false,allowBootstrapReviewRecovery=false,holdRevision=false,specRebindReason=null}={},acquireGuard=async()=>{}){
|
|
214
252
|
// Check before importing node:sqlite: legacy Node users get a useful error.
|
|
215
253
|
if(!isSupportedExecutionPlatform())fail('unsupported_runner_platform');
|
|
216
|
-
const {conversationProtection}=await import('../runtime/js/cm-ai/host-conversation-execution.mjs');
|
|
254
|
+
const {conversationProtection,externalConversationDefinition}=await import('../runtime/js/cm-ai/host-conversation-execution.mjs');
|
|
217
255
|
if(!['create','resume'].includes(mode))fail('invalid_mode');
|
|
218
256
|
if(mode==='create')assertCreatableRunId(definition?.identity);
|
|
257
|
+
// The developer adapter refuses these paths on every dispatch. Refuse the
|
|
258
|
+
// run here, before any journal, intent or execution directory exists, so it
|
|
259
|
+
// cannot strand its first develop effect. A bootstrap run's own instruction
|
|
260
|
+
// paths are checked by createHostBootstrap against its business scope.
|
|
261
|
+
if(mode==='create'&&!execution?.bootstrap)assertCreatableScope(definition?.scope);
|
|
219
262
|
if(supersedeReason!==null&&mode!=='create')fail('supersede_unavailable');
|
|
220
263
|
if(allowAbandonEffect&&mode!=='resume')fail('effect_abandon_unavailable');
|
|
264
|
+
if(allowBootstrapReviewRecovery&&mode!=='resume')fail('bootstrap_review_recovery_unavailable');
|
|
221
265
|
if(typeof holdRevision!=='boolean')fail('invalid_input');
|
|
222
266
|
if(specRebindReason!==null&&(mode!=='resume'||execution===null||typeof specRebindReason!=='string'||!specRebindReason.trim()
|
|
223
267
|
||Buffer.byteLength(specRebindReason,'utf8')>500||/[\r\n\0]/.test(specRebindReason)))fail('spec_rebind_unavailable');
|
|
@@ -230,7 +274,7 @@ export async function openControlRun(definition,mode,execution=null,{rerunUnknow
|
|
|
230
274
|
||(rerunUnknownQa||rerunBlockedQa)&&(mode!=='resume'||!execution?.qaExecutor))fail('qa_recovery_authorization_required');
|
|
231
275
|
const {openTaskExecutionStore}=await import('../runtime/js/cm-ai/task-owner.mjs');
|
|
232
276
|
const {createCmAiHost}=await import('../runtime/js/cm-ai/host.mjs');
|
|
233
|
-
const {inspectCmAiAdmission,matchesCmAiTaskSelection,explainCmAiTaskSelection}=await import('../runtime/js/cm-ai/cm-ai-admission.mjs');
|
|
277
|
+
const {inspectCmAiAdmission,matchesCmAiTaskSelection,explainCmAiTaskSelection,selectedFeature}=await import('../runtime/js/cm-ai/cm-ai-admission.mjs');
|
|
234
278
|
const {captureReviewBaseline}=await import('../runtime/js/cm-ai/review-package.mjs');
|
|
235
279
|
if(execution!==null){
|
|
236
280
|
const {shape,json,validCallTimeout}=await import('../runtime/js/cm-ai/effect-contract.mjs');
|
|
@@ -242,6 +286,11 @@ export async function openControlRun(definition,mode,execution=null,{rerunUnknow
|
|
|
242
286
|
if(Object.hasOwn(execution.configuration,'workflow')&&protectedExecutions.has(execution)
|
|
243
287
|
&&sha(execution.configuration.workflow.definition)!==sha(definition))fail('execution_definition_mismatch');
|
|
244
288
|
const conversation=conversationProtection(execution);
|
|
289
|
+
if(execution.configuration.externalModels||execution.configuration.executionPolicy){
|
|
290
|
+
const bound=externalConversationDefinition(execution);
|
|
291
|
+
if(bound===null)fail('external_execution_factory_required');
|
|
292
|
+
if(bound!==sha(definition))fail('execution_definition_mismatch');
|
|
293
|
+
}
|
|
245
294
|
const protection=protectedExecutions.get(execution)??conversation;
|
|
246
295
|
if(conversation&&conversation.definitionDigest!==sha(definition))fail('execution_definition_mismatch');
|
|
247
296
|
if(protection){
|
|
@@ -274,15 +323,21 @@ export async function openControlRun(definition,mode,execution=null,{rerunUnknow
|
|
|
274
323
|
if(selectedRoots){
|
|
275
324
|
if(!execution||conversationProtection(execution)===null)fail('multi_root_protection_required');
|
|
276
325
|
for(const root of definition.codeProjects){
|
|
277
|
-
const selected=inspectCmAiAdmission({specsDir,codeProject:root});
|
|
326
|
+
const selected=inspectCmAiAdmission({specsDir,codeProject:root,...selectedFeature(definition.featureSelection?.feature)});
|
|
278
327
|
if(mode==='create'&&!matchesCmAiTaskSelection(selected,feature,identity.taskId,selection))
|
|
279
328
|
return {blocked:selected,close:()=>{}};
|
|
280
329
|
}
|
|
281
330
|
}
|
|
282
331
|
const developer=execution?.documentationSync
|
|
283
332
|
?(await import('../runtime/js/cm-ai/host-documentation.mjs')).withHostDocumentation({developer:execution.developer,
|
|
284
|
-
documentationSync:execution.documentationSync,specsDir,codeProject,feature,scope,parallelSelection:selection
|
|
285
|
-
|
|
333
|
+
documentationSync:execution.documentationSync,specsDir,codeProject,feature,scope,parallelSelection:selection,
|
|
334
|
+
featureSelection:definition.featureSelection?.feature}):execution?.developer;
|
|
335
|
+
const admission=inspectCmAiAdmission({specsDir,codeProject,...selectedFeature(definition.featureSelection?.feature)});
|
|
336
|
+
// An explicitly selected feature with nothing left never creates a run, even
|
|
337
|
+
// when the project as a whole is complete.
|
|
338
|
+
if(mode==='create'&&definition.featureSelection&&admission.requestedFeatureComplete===feature)
|
|
339
|
+
throw Object.assign(new Error('task_selection_mismatch'),{code:'task_selection_mismatch',
|
|
340
|
+
reason:explainCmAiTaskSelection({...admission,state:'ready'},{feature,taskId:identity.taskId,selection})});
|
|
286
341
|
if(mode==='create'&&admission.state!=='ready')return {blocked:admission,close:()=>{}};
|
|
287
342
|
if(mode==='create'&&!matchesCmAiTaskSelection(admission,feature,identity.taskId,selection))
|
|
288
343
|
throw Object.assign(new Error('task_selection_mismatch'),{code:'task_selection_mismatch',
|
|
@@ -312,6 +367,8 @@ export async function openControlRun(definition,mode,execution=null,{rerunUnknow
|
|
|
312
367
|
}
|
|
313
368
|
}
|
|
314
369
|
const storeIdentity={repositoryId:identity.repositoryId,runId:identity.runId};
|
|
370
|
+
// Publish new ownership only after execution, admission, selection and baseline validation.
|
|
371
|
+
await acquireGuard();
|
|
315
372
|
// Every fingerprint check below runs against one candidate material and
|
|
316
373
|
// closes its store before the next candidate is tried.
|
|
317
374
|
const openFor=material=>{
|
|
@@ -356,18 +413,27 @@ export async function openControlRun(definition,mode,execution=null,{rerunUnknow
|
|
|
356
413
|
return {material,fingerprints,store,attaching,priorMaterial,chain,attached};
|
|
357
414
|
}catch(error){store.close();throw error;}
|
|
358
415
|
};
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
try{opened=openFor(runConfigMaterial(definition,execution,
|
|
365
|
-
catch(
|
|
366
|
-
if(
|
|
367
|
-
|
|
416
|
+
const snapshot=mode==='resume'&&(execution?.documentationProvider||execution?.documentationResult)
|
|
417
|
+
?readExecutionSnapshot({specsRoot:specsDir,identity:storeIdentity}):null;
|
|
418
|
+
let opened,lastMismatch;
|
|
419
|
+
for(const knowledgeCloseout of closeoutPolicyCandidates(execution,mode,snapshot)){
|
|
420
|
+
const materialOptions={parallelSelection,bootstrapConfig,knowledgeCloseout};
|
|
421
|
+
try{opened=openFor(runConfigMaterial(definition,execution,materialOptions));break;}
|
|
422
|
+
catch(error){
|
|
423
|
+
if(mode!=='resume'||error.code!=='fingerprint_mismatch')throw error;
|
|
424
|
+
lastMismatch=error;
|
|
425
|
+
if(!hasLegacyQaPlanFingerprint(execution?.qaExecutor))continue;
|
|
426
|
+
// Preserve the original exact historical QA fingerprint fallback.
|
|
427
|
+
try{opened=openFor(runConfigMaterial(definition,execution,{...materialOptions,legacyQa:true}));break;}
|
|
428
|
+
catch(cause){
|
|
429
|
+
if(cause.code!=='fingerprint_mismatch')throw cause;
|
|
430
|
+
lastMismatch=Object.assign(error,{reason:error.reason?`${error.reason}。${LEGACY_QA_FINGERPRINT_REASON}`:LEGACY_QA_FINGERPRINT_REASON});
|
|
431
|
+
}
|
|
368
432
|
}
|
|
369
433
|
}
|
|
434
|
+
if(!opened)throw lastMismatch;
|
|
370
435
|
const {material:configMaterial,fingerprints,store,attaching,priorMaterial,chain,attached}=opened;
|
|
436
|
+
const knowledgeCloseout=configMaterial.knowledgeCloseout??null;
|
|
371
437
|
try{
|
|
372
438
|
let runnerMode=mode;
|
|
373
439
|
if(mode==='resume'&&store.snapshot().records.length===0){
|
|
@@ -380,7 +446,10 @@ export async function openControlRun(definition,mode,execution=null,{rerunUnknow
|
|
|
380
446
|
}
|
|
381
447
|
const unavailable=()=>fail('execution_adapter_required');
|
|
382
448
|
const host=createCmAiHost({
|
|
383
|
-
runner:{root:codeProject,identity,scope,requirements,specification,...(selectedRoots?{codeProjectPaths:selectedRoots}:{}),
|
|
449
|
+
runner:{root:codeProject,identity,scope,requirements,specification,...(selectedRoots?{codeProjectPaths:selectedRoots}:{}),
|
|
450
|
+
...(knowledgeCloseout===null?{}:{knowledgeCloseout}),
|
|
451
|
+
...(execution?.configuration.executionPolicy?{executionPolicy:execution.configuration.executionPolicy}:{}),
|
|
452
|
+
...(execution?.configuration.externalModels?{externalModels:execution.configuration.externalModels}:{}),excludedContexts:['control-host'],
|
|
384
453
|
developer:{provider:'codex',requestedModel:'unconfigured',contextId:'control-developer',run:unavailable},
|
|
385
454
|
reviewers:[],check:unavailable,taskCompletion:{reviewsDir,handoffs},taskLearning:{feature},
|
|
386
455
|
persistence:{store,mode:runnerMode,version:execution===null?2:3},
|
|
@@ -393,7 +462,10 @@ export async function openControlRun(definition,mode,execution=null,{rerunUnknow
|
|
|
393
462
|
...(Object.hasOwn(execution,'verificationGate')?{verificationGate:execution.verificationGate}:{}),
|
|
394
463
|
taskLearning:{feature,hostHandoff:true}})},
|
|
395
464
|
// The entry validates the declaration (single line, with --rerun-blocked-qa) before any durable write.
|
|
396
|
-
entry:{specsDir,codeProject,feature,identity,rerunUnknownQa,rerunBlockedQa
|
|
465
|
+
entry:{specsDir,codeProject,feature,identity,rerunUnknownQa,rerunBlockedQa,
|
|
466
|
+
...(definition.featureSelection?{featureSelection:definition.featureSelection.feature}:{}),
|
|
467
|
+
...(knowledgeCloseout===null?{}:{knowledgeCloseout,...(definition.codeProjects?{codeProjects:definition.codeProjects}:{})}),
|
|
468
|
+
...(qaEnvironmentFailure===null?{}:{qaEnvironmentFailure}),allowAbandonReview,allowAbandonEffect,allowBootstrapReviewRecovery,...(holdRevision?{holdRevision}:{}),...(selection===null?{}:{parallelSelection:selection}),...(execution===null?{}:{hostDecision:execution.hostDecision,
|
|
397
469
|
...Object.fromEntries(['developmentAttempt','hostDecisionProvider','qaDecisionProvider','qaLogHome','qaExecutor','applicableAgentFiles','documentationProvider','documentationResult'].filter(key=>Object.hasOwn(execution,key)).map(key=>[key,execution[key]]))})},
|
|
398
470
|
});
|
|
399
471
|
const logAbandonments=()=>{
|
|
@@ -445,6 +517,9 @@ export async function openControlRun(definition,mode,execution=null,{rerunUnknow
|
|
|
445
517
|
revisedAt:new Date().toISOString().replace(/\.\d{3}Z$/,'Z'),packageDigest:current.packageDigest??null,
|
|
446
518
|
testRunId:target.testRunId,qaRound:target.qaRound,taskAttempt:current.identity.attempt});
|
|
447
519
|
recordCmAiQaConfigurationRevision(binding,record);
|
|
520
|
+
// Only the newly authorized revision projects a new pending QA phase.
|
|
521
|
+
// Replaying or repairing its audit mirror above is not new execution.
|
|
522
|
+
if(!beforeQa)writeCmAiQaStatus({specsDir,feature,identity:current.identity,phase:'configuration_revised'});
|
|
448
523
|
}
|
|
449
524
|
return {host:{async handle(request){
|
|
450
525
|
if(execution===null&&!['status','cancel'].includes(request.operation)){
|
|
@@ -15,7 +15,7 @@ const request=(operation,requestId=operation)=>({version:1,operation,requestId,i
|
|
|
15
15
|
const platform=process.platform==='darwin'&&Number(process.versions.node.split('.')[0])>=24;
|
|
16
16
|
test('QA attachment projections preserve every non-workflow fingerprint input and validate the immutable record',async()=>{
|
|
17
17
|
const {preQaConfigurations,readQaAttachment}=await import('../runtime/js/cm-ai/qa-attachment.mjs');
|
|
18
|
-
const material={definition:{identity,scope:['a.js'],requirements:['requirements.md']},
|
|
18
|
+
const material={definition:{identity,scope:['a.js'],requirements:['requirements.md']},knowledgeCloseout:{version:1,enabled:true},
|
|
19
19
|
execution:{kind:'cm-current-conversation-v1',hostContextId:'host',review:{model:'fixture'},
|
|
20
20
|
workflow:{qa:{commands:[],environment:{}},documentationPaths:['README.md'],applicableAgentFiles:[]}},
|
|
21
21
|
qaExecutor:{version:1,mode:'commands'},qaDecisionProvider:'host-v1',qaTimeoutMs:60000,
|
|
@@ -28,6 +28,7 @@ test('QA attachment projections preserve every non-workflow fingerprint input an
|
|
|
28
28
|
assert(!Object.hasOwn(withoutWorkflow.execution,'workflow'));
|
|
29
29
|
assert(!Object.hasOwn(withoutWorkflow,'documentationSync'));
|
|
30
30
|
for(const projection of [withoutQa,withoutWorkflow]){
|
|
31
|
+
assert.deepEqual(projection.knowledgeCloseout,material.knowledgeCloseout);
|
|
31
32
|
assert.deepEqual(projection.definition,material.definition);
|
|
32
33
|
assert.deepEqual(projection.execution.review,material.execution.review);
|
|
33
34
|
assert.equal(projection.execution.hostContextId,'host');
|