@aibyzero/cm-workflow 0.16.4 → 0.16.6
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 +22 -0
- package/CHANGELOG.md +57 -0
- package/README.md +22 -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 +48 -7
- package/docs/js-workflow-control.md +293 -33
- package/docs/live-evidence-drivers.md +62 -0
- package/docs/next-steps.md +15 -10
- package/docs/runtime-failover.md +1 -1
- 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/accepted-fix.mjs +23 -5
- package/runtime/js/cm-ai/bootstrap-feature.mjs +15 -0
- package/runtime/js/cm-ai/claude-review-adapter.mjs +7 -4
- package/runtime/js/cm-ai/claude-review-stream.mjs +12 -0
- package/runtime/js/cm-ai/claude-tool-preview.mjs +4 -4
- package/runtime/js/cm-ai/cm-ai-admission.mjs +115 -41
- package/runtime/js/cm-ai/cm-ai-context-refresh.mjs +3 -2
- package/runtime/js/cm-ai/cm-ai-conversation-entry.mjs +208 -34
- package/runtime/js/cm-ai/cm-ai-learning-handoff-writer.mjs +11 -9
- package/runtime/js/cm-ai/cm-ai-learning-writer.mjs +22 -5
- package/runtime/js/cm-ai/cm-ai-qa-log.mjs +181 -57
- package/runtime/js/cm-ai/cm-ai-run-finalizer.mjs +15 -58
- package/runtime/js/cm-ai/codex-config.mjs +3 -2
- package/runtime/js/cm-ai/codex-review-adapter.mjs +56 -17
- package/runtime/js/cm-ai/committed-rule-basis.mjs +76 -0
- package/runtime/js/cm-ai/developer-adapter.mjs +6 -2
- package/runtime/js/cm-ai/diagnostic-reason.mjs +10 -0
- package/runtime/js/cm-ai/drive-bootstrap.mjs +315 -0
- package/runtime/js/cm-ai/drive-core.mjs +47 -9
- package/runtime/js/cm-ai/durable-runner-state.mjs +413 -56
- package/runtime/js/cm-ai/effect-abandon-log.mjs +19 -0
- package/runtime/js/cm-ai/effect-contract.mjs +44 -2
- package/runtime/js/cm-ai/execution-policy.mjs +58 -0
- package/runtime/js/cm-ai/execution-store-limits.mjs +18 -0
- package/runtime/js/cm-ai/execution-store.mjs +6 -4
- 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/fix-code-association.mjs +171 -18
- package/runtime/js/cm-ai/host-bootstrap.mjs +126 -29
- package/runtime/js/cm-ai/host-check.mjs +30 -4
- package/runtime/js/cm-ai/host-conversation-execution.mjs +66 -20
- package/runtime/js/cm-ai/host-handoff.mjs +13 -6
- 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 +23 -9
- package/runtime/js/cm-ai/host-qa-fix-owner.mjs +23 -6
- package/runtime/js/cm-ai/host-qa-policy.mjs +16 -7
- package/runtime/js/cm-ai/host-session.mjs +12 -4
- package/runtime/js/cm-ai/host-tool-bridge.mjs +1 -1
- package/runtime/js/cm-ai/host-workflow-capabilities.mjs +16 -5
- package/runtime/js/cm-ai/host.mjs +1 -1
- package/runtime/js/cm-ai/knowledge-closeout.mjs +56 -0
- package/runtime/js/cm-ai/launch-mismatch.mjs +42 -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 +21 -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 +86 -0
- package/runtime/js/cm-ai/owned-process-cleanup.mjs +22 -0
- package/runtime/js/cm-ai/project-qa-gate.mjs +84 -0
- package/runtime/js/cm-ai/provider-review-observation.mjs +68 -9
- package/runtime/js/cm-ai/provider-usage.mjs +39 -0
- package/runtime/js/cm-ai/qa-config-revision.mjs +44 -10
- package/runtime/js/cm-ai/review-abandon-log.mjs +21 -0
- package/runtime/js/cm-ai/review-package.mjs +438 -31
- 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/review-runner.mjs +47 -1
- package/runtime/js/cm-ai/reviewed-deliveries.mjs +97 -0
- package/runtime/js/cm-ai/reviewed-evidence-supersede.mjs +104 -10
- package/runtime/js/cm-ai/reviewed-evidence-supersession-record.mjs +42 -3
- package/runtime/js/cm-ai/specification-material.mjs +154 -12
- package/runtime/js/cm-ai/status-projection.mjs +93 -0
- package/runtime/js/cm-ai/task-commit.mjs +2 -2
- package/runtime/js/cm-ai/task-runner.mjs +658 -75
- 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 +279 -52
- package/runtime/js/cm-fix/final-review.mjs +18 -10
- package/runtime/js/cm-fix/host-review.mjs +32 -9
- package/runtime/js/cm-fix/host.mjs +6 -1
- package/runtime/js/cm-fix/layout.mjs +1 -1
- package/runtime/js/cm-fix/progress.mjs +5 -0
- package/runtime/js/cm-fix/protected-edits.mjs +15 -4
- package/runtime/js/cm-fix/qa-source.mjs +6 -4
- package/runtime/js/cm-fix/review-reconciliation.mjs +64 -0
- package/runtime/js/cm-prd/analysis.mjs +2 -1
- package/runtime/js/cm-prd/change.mjs +28 -10
- package/runtime/js/cm-prd/draft.mjs +5 -2
- package/runtime/js/cm-prd/response-recovery.mjs +23 -0
- package/runtime/js/cm-prd/review-preparation.mjs +10 -3
- package/runtime/js/cm-prd/review-publication.mjs +27 -15
- package/runtime/js/cm-prd/review-time.mjs +29 -0
- package/runtime/js/cm-prd/self-check.mjs +6 -3
- package/runtime/js/cm-prd/session.mjs +53 -6
- package/runtime/js/cm-prd/summary.mjs +3 -1
- package/runtime/js/cm-prd/validation-reason.mjs +20 -0
- package/runtime/js/cm-security/finalize.mjs +32 -0
- package/runtime/js/spec-task-line.mjs +117 -0
- package/runtime/js/specs-status.mjs +10 -3
- package/runtime/review.md +5 -0
- package/runtime/task-gates.md +6 -0
- package/runtime/workflow-config.md +10 -1
- package/scripts/cm-ai-abandon-effect-position.test.mjs +201 -0
- package/scripts/cm-ai-admission.mjs +18 -11
- package/scripts/cm-ai-admission.test.mjs +65 -1
- package/scripts/cm-ai-batch-drive.mjs +135 -34
- package/scripts/cm-ai-batch-drive.test.mjs +209 -3
- package/scripts/cm-ai-batch-host.mjs +63 -24
- package/scripts/cm-ai-batch-host.test.mjs +2 -1
- package/scripts/cm-ai-batch-run.mjs +101 -34
- package/scripts/cm-ai-batch-run.test.mjs +56 -5
- package/scripts/cm-ai-bootstrap-driver-preflight.test.mjs +45 -0
- package/scripts/cm-ai-bootstrap-flow.test.mjs +159 -0
- package/scripts/cm-ai-bootstrap-merge.test.mjs +162 -0
- package/scripts/cm-ai-bootstrap.test.mjs +174 -89
- package/scripts/cm-ai-conversation-entry-ops.test.mjs +97 -2
- package/scripts/cm-ai-develop-driver-gaps.test.mjs +924 -0
- package/scripts/cm-ai-drive-bootstrap-rules.test.mjs +468 -0
- package/scripts/cm-ai-drive-timeout.test.mjs +17 -0
- package/scripts/cm-ai-drive.mjs +526 -60
- package/scripts/cm-ai-drive.test.mjs +336 -10
- package/scripts/cm-ai-fix-later-delivery.test.mjs +383 -0
- package/scripts/cm-ai-host.mjs +142 -43
- package/scripts/cm-ai-host.test.mjs +232 -12
- package/scripts/cm-ai-launch-diagnostics.test.mjs +142 -0
- package/scripts/cm-ai-multi-root.test.mjs +9 -3
- package/scripts/cm-ai-operator-guidance.test.mjs +94 -0
- package/scripts/cm-ai-progress.test.mjs +521 -0
- package/scripts/cm-ai-project-qa-gate.test.mjs +308 -0
- package/scripts/cm-ai-qa-config-revision.test.mjs +187 -15
- package/scripts/cm-ai-qa-fingerprint-config.test.mjs +157 -0
- package/scripts/cm-ai-qa-fix-cross-session.test.mjs +27 -2
- package/scripts/cm-ai-qa-rerun-timeouts.test.mjs +400 -0
- package/scripts/cm-ai-review-drift-precedence.test.mjs +90 -0
- package/scripts/cm-ai-review-failure.test.mjs +977 -0
- package/scripts/cm-ai-review-timeout-config.test.mjs +29 -7
- package/scripts/cm-ai-review-timeout.test.mjs +199 -4
- package/scripts/cm-ai-run.mjs +206 -62
- package/scripts/cm-ai-run.test.mjs +6 -4
- package/scripts/cm-ai-runner-error-code-regression.test.mjs +219 -0
- package/scripts/cm-ai-selection-guard.test.mjs +100 -0
- package/scripts/cm-ai-session-chain.test.mjs +7 -3
- package/scripts/cm-ai-spec-rebind.test.mjs +481 -0
- package/scripts/cm-ai-supersede.test.mjs +571 -17
- package/scripts/cm-ai-verification-gate.test.mjs +2 -1
- package/scripts/cm-bootstrap-review-recovery.test.mjs +70 -0
- package/scripts/cm-capability-gate.test.mjs +21 -2
- package/scripts/cm-check-drive.test.mjs +2 -1
- package/scripts/cm-check-host.test.mjs +1 -1
- package/scripts/cm-check-runtime.sh +12 -1
- package/scripts/cm-claude-developer-worker.test.mjs +3 -1
- package/scripts/cm-claude-install-layout.test.mjs +26 -0
- package/scripts/cm-claude-probe.test.mjs +10 -2
- package/scripts/cm-claude-review-stream.test.mjs +25 -0
- package/scripts/cm-claude-worker.test.mjs +11 -4
- package/scripts/cm-codex-developer-worker.test.mjs +4 -2
- 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-failover.mjs +8 -8
- package/scripts/cm-fix-abandon.test.mjs +123 -5
- package/scripts/cm-fix-cause-package.test.mjs +2 -0
- package/scripts/cm-fix-drive.mjs +70 -23
- package/scripts/cm-fix-drive.test.mjs +36 -1
- package/scripts/cm-fix-final-review.test.mjs +11 -6
- package/scripts/cm-fix-host.mjs +24 -14
- 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 +147 -0
- package/scripts/cm-fixture-process-cleanup.test.mjs +95 -0
- package/scripts/cm-host-check.test.mjs +6 -3
- package/scripts/cm-host-qa-executor.test.mjs +213 -17
- package/scripts/cm-host-session-diagnostic.test.mjs +10 -0
- package/scripts/cm-interactive-qa-diagnostic.test.mjs +53 -0
- package/scripts/cm-knowledge-closeout.test.mjs +160 -0
- package/scripts/cm-live-evidence.test.mjs +64 -0
- package/scripts/cm-log-event.mjs +25 -2
- package/scripts/cm-log-event.py +15 -0
- package/scripts/cm-log-event.test.mjs +31 -0
- package/scripts/cm-model-setup.mjs +79 -0
- package/scripts/cm-prd-completion.test.mjs +75 -0
- package/scripts/cm-prd-draft.test.mjs +14 -0
- package/scripts/cm-prd-drive.mjs +32 -11
- package/scripts/cm-prd-drive.test.mjs +15 -0
- package/scripts/cm-prd-gate-diagnostic.test.mjs +100 -0
- package/scripts/cm-prd-host.mjs +13 -4
- package/scripts/cm-prd-review-gate.mjs +126 -81
- package/scripts/cm-prd-review-gate.test.mjs +105 -1
- package/scripts/cm-prd-review-preparation.test.mjs +15 -0
- package/scripts/cm-prd-review-publication.test.mjs +6 -0
- package/scripts/cm-prd-self-check.test.mjs +6 -0
- package/scripts/cm-prd-summary.test.mjs +9 -0
- package/scripts/cm-release-smoke.sh +5 -1
- package/scripts/cm-review-dependency-snapshot.test.mjs +15 -0
- package/scripts/cm-review-inventory.test.mjs +253 -1
- 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-spec-manifest.mjs +28 -10
- package/scripts/cm-spec-manifest.test.mjs +8 -4
- package/scripts/cm-spec-task-line.test.mjs +138 -0
- package/scripts/cm-specs-status.test.mjs +12 -1
- package/scripts/cm-task-gate-correction.test.mjs +117 -0
- package/scripts/cm-task-gate.mjs +164 -20
- package/scripts/cm-task-gate.py +2 -1
- package/scripts/cm-test-branch-impact.test.mjs +6 -3
- 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/claude-review-process.mjs +1 -0
- package/scripts/fixtures/live-evidence-driver.mjs +35 -0
- package/scripts/fixtures/process-cleanup.mjs +101 -0
- package/scripts/test-cm-log-event.py +2 -0
- package/scripts/test-cm-native-usage.py +62 -0
- package/scripts/test-cm-prd-review-gate.py +2 -1
- package/scripts/test-external-model-setup.py +91 -0
- package/scripts/test-model-configuration-write.py +201 -0
- package/scripts/test-npm-install.py +11 -2
- package/scripts/test-scan-public-safety.py +1 -1
- package/scripts/test-spec-manifest.py +16 -8
- package/scripts/test-task-gate.py +2 -2
- package/scripts/test-workflow-config.py +1 -0
- package/scripts/validate-public-repo.py +1 -0
- 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 +270 -43
- 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 +52 -3
- package/skills/cm-prd/references/js-change-recovery.md +1 -1
- package/skills/cm-prd/references/js-host.md +6 -0
- 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
|
@@ -5,9 +5,27 @@ import {validateHostWorkflowConfiguration} from './host-workflow-capabilities.mj
|
|
|
5
5
|
import {preQaConfigurations,readQaAttachment} from './qa-attachment.mjs';
|
|
6
6
|
|
|
7
7
|
const workflow=material=>material.execution?.workflow?.configuration??material.execution?.workflow;
|
|
8
|
+
const BUILT_IN='cm-host-qa-executor-v1';
|
|
9
|
+
// Store fingerprint form of a QA executor. The built-in executor's plan (the
|
|
10
|
+
// loaded project/user CM config and the mode, case count, cases, commands and
|
|
11
|
+
// stage order derived from it) follows .cm-workflow.yml, ~/.cm-workflow/
|
|
12
|
+
// runtimes.yml and the plugin's built-in defaults, all of which legitimately
|
|
13
|
+
// change during a project. Version 2 binds only the host's QA inputs; each QA
|
|
14
|
+
// round freezes its own plan at N6 (prepare) and records mode/case_count in its
|
|
15
|
+
// test_run rows. Version 1 is the historical form: stores created with it keep
|
|
16
|
+
// opening only while their original configuration is unchanged.
|
|
17
|
+
export function hasLegacyQaPlanFingerprint(executor){return executor?.configuration?.kind===BUILT_IN;}
|
|
18
|
+
export function qaExecutorMaterial(executor,legacy=false){
|
|
19
|
+
if(legacy||!hasLegacyQaPlanFingerprint(executor))return {version:1,mode:executor.mode,caseCount:executor.caseCount,
|
|
20
|
+
timeoutMs:executor.timeoutMs,...(Object.hasOwn(executor,'configuration')?{configuration:executor.configuration}:{})};
|
|
21
|
+
const {plan,...configuration}=executor.configuration;
|
|
22
|
+
return {version:2,timeoutMs:executor.timeoutMs,configuration};
|
|
23
|
+
}
|
|
8
24
|
export function qaConfigurationSlice(material){
|
|
9
25
|
const qa=workflow(material)?.qa,executor=material.qaExecutor,c=executor?.configuration;
|
|
10
|
-
need(qa&&c?.kind===
|
|
26
|
+
need(qa&&c?.kind===BUILT_IN,'qa_revision_configuration_required');
|
|
27
|
+
if(executor.version===2)return json({qa,timeoutMs:executor.timeoutMs,
|
|
28
|
+
executor:{commands:c.commands,environment:c.environment,timeoutMs:c.timeoutMs}});
|
|
11
29
|
return json({qa,mode:executor.mode,caseCount:executor.caseCount,timeoutMs:executor.timeoutMs,
|
|
12
30
|
executor:{commands:c.commands,environment:c.environment,timeoutMs:c.timeoutMs,
|
|
13
31
|
commandsPlan:c.plan.commands,modes:c.plan.modes}});
|
|
@@ -15,12 +33,15 @@ export function qaConfigurationSlice(material){
|
|
|
15
33
|
function withQaConfiguration(material,slice){
|
|
16
34
|
const result=structuredClone(json(material)),c=result.qaExecutor.configuration;
|
|
17
35
|
workflow(result).qa=slice.qa;
|
|
18
|
-
Object.assign(result.qaExecutor,{mode:slice.mode,caseCount:slice.caseCount,timeoutMs:slice.timeoutMs});
|
|
19
36
|
Object.assign(c,{commands:slice.executor.commands,environment:slice.executor.environment,timeoutMs:slice.executor.timeoutMs});
|
|
37
|
+
if(result.qaExecutor.version===2){result.qaExecutor.timeoutMs=slice.timeoutMs;return result;}
|
|
38
|
+
Object.assign(result.qaExecutor,{mode:slice.mode,caseCount:slice.caseCount,timeoutMs:slice.timeoutMs});
|
|
20
39
|
Object.assign(c.plan,{commands:slice.executor.commandsPlan,modes:slice.executor.modes});
|
|
21
40
|
return result;
|
|
22
41
|
}
|
|
23
42
|
export function qaInvariantDigest(material){
|
|
43
|
+
if(material.qaExecutor?.version===2)return digest(withQaConfiguration(material,{qa:null,timeoutMs:null,
|
|
44
|
+
executor:{commands:null,environment:null,timeoutMs:null}}));
|
|
24
45
|
return digest(withQaConfiguration(material,{qa:null,mode:null,caseCount:null,timeoutMs:null,
|
|
25
46
|
executor:{commands:null,environment:null,timeoutMs:null,commandsPlan:null,modes:null}}));
|
|
26
47
|
}
|
|
@@ -30,30 +51,43 @@ export function previousQaMaterial(material,previousWorkflow){
|
|
|
30
51
|
need(prior.qa!==null,'qa_revision_configuration_required');
|
|
31
52
|
need(digest({...prior,qa:null})===digest({...current,qa:null}),'fingerprint_mismatch');
|
|
32
53
|
const result=structuredClone(json(material)),{kind,plan,capabilities,...configuration}=result.qaExecutor.configuration;
|
|
33
|
-
need(kind===
|
|
34
|
-
// Rebuild the old
|
|
35
|
-
//
|
|
54
|
+
need(kind===BUILT_IN,'qa_revision_configuration_required');
|
|
55
|
+
// Rebuild the old executor with the same validator. A version 2 fingerprint
|
|
56
|
+
// carries no plan, so the current CM config cannot make the previous one
|
|
57
|
+
// irreproducible; version 1 still rebuilds its plan from the current policy.
|
|
58
|
+
// These callbacks are capability markers and are never dispatched.
|
|
36
59
|
const executor=createHostQaExecutor({...configuration,commands:prior.qa.commands,environment:prior.qa.environment,
|
|
37
60
|
...(capabilities.logic?{logic:()=>{}}:{}),...(capabilities.browser?{browser:()=>{}}:{})});
|
|
38
|
-
result.qaExecutor=
|
|
61
|
+
result.qaExecutor=qaExecutorMaterial(executor,result.qaExecutor.version!==2);
|
|
39
62
|
workflow(result).qa=prior.qa;
|
|
40
63
|
need(qaInvariantDigest(result)===qaInvariantDigest(material),'fingerprint_mismatch');
|
|
41
64
|
return result;
|
|
42
65
|
}
|
|
66
|
+
// qaRound 0 with testRunId null records a revision made before any QA round
|
|
67
|
+
// ran: nothing is superseded and no round is consumed. packageDigest is the
|
|
68
|
+
// task's current review package, or null before one exists.
|
|
69
|
+
export const beforeFirstQaRound=r=>r.qaRound===0;
|
|
43
70
|
export function readQaConfigRevision(raw){
|
|
44
71
|
const r=json(raw);
|
|
45
72
|
shape(r,['version','fromFingerprint','toFingerprint','invariantDigest','previousQaDigest','qaDigest','reason','hostContextId',
|
|
46
73
|
'revisedAt','packageDigest','testRunId','qaRound','taskAttempt']);
|
|
47
74
|
need(r.version===1,'qa_revision_invalid');
|
|
48
|
-
for(const key of ['fromFingerprint','toFingerprint','invariantDigest','
|
|
75
|
+
for(const key of ['fromFingerprint','toFingerprint','invariantDigest','previousQaDigest','qaDigest'])hex(r[key]);
|
|
76
|
+
if(!(beforeFirstQaRound(r)&&r.packageDigest===null))hex(r.packageDigest);
|
|
49
77
|
need(r.fromFingerprint!==r.toFingerprint&&r.previousQaDigest!==r.qaDigest,'qa_revision_unchanged');
|
|
50
|
-
id(r.hostContextId);
|
|
78
|
+
id(r.hostContextId);
|
|
79
|
+
if(beforeFirstQaRound(r))need(r.testRunId===null,'qa_revision_invalid');else id(r.testRunId);
|
|
80
|
+
text(r.reason);
|
|
51
81
|
need(r.reason.trim().length>0&&r.reason.length<=500&&!/[\r\n\0]/.test(r.reason),'qa_revision_authorization_required');
|
|
52
82
|
need(/^\d{4}-\d\d-\d\dT\d\d:\d\d:\d\dZ$/.test(r.revisedAt)&&Number.isFinite(Date.parse(r.revisedAt)),'qa_revision_invalid');
|
|
53
83
|
need([1,2].includes(r.taskAttempt),'qa_revision_invalid');
|
|
54
|
-
need(Number.isInteger(r.qaRound)&&r.qaRound>=
|
|
84
|
+
need(Number.isInteger(r.qaRound)&&r.qaRound>=0&&r.qaRound<3,'qa_round_invalid');
|
|
55
85
|
return r;
|
|
56
86
|
}
|
|
87
|
+
// Rounds strictly increase once QA has run; any number of revisions may
|
|
88
|
+
// precede the first round, and none may follow a completed round at round 0.
|
|
89
|
+
export const qaRevisionFollows=(next,previous)=>next.qaRound>previous.qaRound
|
|
90
|
+
||beforeFirstQaRound(next)&&beforeFirstQaRound(previous);
|
|
57
91
|
export function qaRevisionChain(snapshot){
|
|
58
92
|
let fingerprint=snapshot.fingerprints.config,invariant=null,attached=false;const revisions=[];
|
|
59
93
|
for(const row of snapshot.records){
|
|
@@ -65,7 +99,7 @@ export function qaRevisionChain(snapshot){
|
|
|
65
99
|
const r=readQaConfigRevision(row.payload.record);
|
|
66
100
|
need(r.fromFingerprint===fingerprint&&(invariant===null||r.invariantDigest===invariant)
|
|
67
101
|
&&(!revisions.length||(r.previousQaDigest===revisions.at(-1).qaDigest
|
|
68
|
-
&&r
|
|
102
|
+
&&qaRevisionFollows(r,revisions.at(-1)))),'qa_revision_chain_invalid');
|
|
69
103
|
fingerprint=r.toFingerprint;invariant=r.invariantDigest;revisions.push(r);
|
|
70
104
|
}
|
|
71
105
|
return {fingerprint,revisions};
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
// Repeating this projection on resume repairs a crash after the journal append.
|
|
2
|
+
import {spawnSync} from 'node:child_process';
|
|
3
|
+
import {fileURLToPath} from 'node:url';
|
|
4
|
+
import {digest,need} from './effect-contract.mjs';
|
|
5
|
+
|
|
6
|
+
const writer=fileURLToPath(new URL('../../../scripts/cm-log-event.py',import.meta.url));
|
|
7
|
+
export function recordReviewAbandonment({specsDir,codeProject,feature,identity,record,logHome,runtime='codex'}){
|
|
8
|
+
const p=record.payload;
|
|
9
|
+
const data={node:'N4',feature,task:identity.taskId,effect_id:p.effectId,
|
|
10
|
+
invocation_id:p.invocationId,registered_digest:p.registeredDigest,
|
|
11
|
+
started_digest:p.startedDigest,...(Object.hasOwn(p,'resultDigest')?{result_digest:p.resultDigest}:{}),
|
|
12
|
+
record_digest:record.digest,reason:p.reason};
|
|
13
|
+
const args=[writer,'--workflow','cm-ai','--event','review_abandoned','--runtime',runtime,
|
|
14
|
+
'--project-root',codeProject,'--specs-dir',specsDir,'--run-id',identity.runId,
|
|
15
|
+
'--at',p.at,'--detail',Object.hasOwn(p,'resultDigest')?'显式放弃结论未被接收的独立审查调用':'显式放弃无结果的独立审查调用',
|
|
16
|
+
'--data-json',JSON.stringify(data)];
|
|
17
|
+
const result=spawnSync('python3',args,{timeout:10000,maxBuffer:1024*1024,
|
|
18
|
+
...(logHome?{env:{...process.env,CM_WORKFLOW_LOG_HOME:logHome}}:{})});
|
|
19
|
+
need(!result.error&&result.status===0,'review_abandon_log_failed');
|
|
20
|
+
return digest(data);
|
|
21
|
+
}
|