harness-everything 1.2.2 → 1.3.1
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/.claude-plugin/marketplace.json +1 -1
- package/.claude-plugin/plugin.json +1 -1
- package/CHANGELOG.md +29 -0
- package/ci/archive/325-prep/README.md +9 -2
- package/ci/archive/325-prep/doc-reconciliation-red.js +34 -8
- package/ci/fixtures/468-dispatch/agy-quota-PROVENANCE.md +19 -0
- package/ci/fixtures/468-dispatch/agy-quota-direct-individual.stderr +2 -0
- package/ci/fixtures/468-dispatch/agy-quota-direct-third-party.stderr +2 -0
- package/ci/fixtures/468-dispatch/agy-quota-exec-individual.log +3 -0
- package/ci/fixtures/553-t2a/body-edit/base/.agents/harness-everything/project-docs.json +11 -0
- package/ci/fixtures/553-t2a/body-edit/base/docs/a.md +6 -0
- package/ci/fixtures/553-t2a/body-edit/base/docs/b.md +1 -0
- package/ci/fixtures/553-t2a/body-edit/candidate/docs/a.md +6 -0
- package/ci/fixtures/553-t2c/derived-regenerate-must/base/docs/adr/EVID-001-verify-all-evidence.md +11 -0
- package/ci/fixtures/553-t2c/derived-regenerate-must/base/docs/governed-index.md +19 -0
- package/ci/fixtures/553-t2c/derived-regenerate-must/candidate/docs/adr/EVID-001-verify-all-evidence.md +11 -0
- package/ci/fixtures/553-t2c/derived-regenerate-must/candidate/docs/governed-index.md +19 -0
- package/ci/fixtures/553-t2c/derived-regenerate-must/config.json +17 -0
- package/ci/fixtures/doc-obligations/derive/regression-pins.json +153 -0
- package/ci/fixtures/state-persist-post-tool-use/harness.js +206 -0
- package/ci/fixtures/state-persist-post-tool-use/off-handoff-golden.json +16 -0
- package/ci/fixtures/state-persist-post-tool-use/payload-post-tool-use-success.json +13 -0
- package/ci/fixtures/stop/fail-session-writes.js +109 -0
- package/ci/fixtures/workflow-contract/cases.json +3355 -0
- package/ci/fixtures/workflow-contract/wiring-cases.json +560 -0
- package/ci/lib/doc-reconciliation-prep-fixtures.js +4 -9
- package/ci/mechanism-2an-workflow-replay.test.js +324 -0
- package/ci/mechanism-2ax-doc-lifecycle.test.js +132 -0
- package/ci/mechanism-325-3a-doc-evidence.test.js +73 -0
- package/ci/mechanism-325-3a-doc-obligations.test.js +61 -0
- package/ci/mechanism-325-3b-preparation.test.js +208 -49
- package/ci/mechanism-325-3b-s1-review.test.js +20 -828
- package/ci/mechanism-325-3b-s3-providers.test.js +59 -0
- package/ci/mechanism-325-f3-derived-views.test.js +140 -0
- package/ci/mechanism-341-opencode-lane.test.js +164 -284
- package/ci/mechanism-35-verification-contract.test.js +246 -0
- package/ci/mechanism-365-step-edit-accounting.test.js +5 -6
- package/ci/mechanism-383-doc-glob-line-terminators.test.js +0 -30
- package/ci/mechanism-397-opencode-observations.test.js +151 -18
- package/ci/mechanism-468-dispatch-cli.test.js +1496 -4
- package/ci/mechanism-548-bigint-identity.test.js +531 -0
- package/ci/mechanism-553-e1-unhook-credit.test.js +328 -0
- package/ci/mechanism-553-p2a-claude-hooks.test.js +98 -0
- package/ci/mechanism-553-p3-plan-start.test.js +212 -0
- package/ci/mechanism-553-state-persist-post-tool-use.test.js +307 -0
- package/ci/mechanism-553-stop.test.js +427 -0
- package/ci/mechanism-553-t2a-derive.test.js +110 -0
- package/ci/mechanism-553-t2c-derive.test.js +94 -0
- package/ci/mechanism-e1-derived-regenerate.test.js +45 -206
- package/ci/mechanism-error-ledger-oracle.test.js +786 -3
- package/ci/mechanism-error-ledger-scan.test.js +981 -0
- package/ci/mechanism-outline-sanitizer.test.js +0 -8
- package/ci/mechanism-pr-a-conflict-check.test.js +38 -305
- package/ci/mechanism-prb-outline-review.test.js +101 -3283
- package/ci/mechanism-report-writer.test.js +45 -0
- package/docs/adr/DOCS-006-reconciliation-pilot.md +4 -2
- package/docs/adr/DOCS-008-obligation-abstraction-bounded-consumer.md +3 -3
- package/docs/doc-workflow-reconciliation.md +17 -2
- package/docs/document-lifecycle.md +6 -2
- package/docs/error-handling/details/c8-dispatch-cli.md +109 -13
- package/docs/platform-capabilities.md +35 -5
- package/error-ledger-bootstrap/SKILL.md +1 -1
- package/error-ledger-bootstrap/references/workflow.md +42 -7
- package/error-ledger-bootstrap/scripts/promote.js +8 -6
- package/error-ledger-bootstrap/scripts/scan.js +525 -12
- package/hooks/hooks.json +0 -46
- package/hooks/scripts/lib/workflow-obligations.js +0 -55
- package/hooks/scripts/state-persist.js +7 -95
- package/hooks/scripts/workflow-disposition.js +0 -2
- package/hooks/scripts/workflow-stop-gate.js +17 -30
- package/opencode-plugin/index.mjs +6 -70
- package/opencode-plugin/plugin.json +1 -1
- package/package.json +1 -1
- package/plugins/harness-everything/.antigravity-plugin/plugin.json +1 -1
- package/plugins/harness-everything/.codex-plugin/plugin.json +1 -1
- package/plugins/harness-everything/hooks/scripts/lib/workflow-obligations.js +0 -55
- package/plugins/harness-everything/hooks/scripts/state-persist.js +7 -95
- package/plugins/harness-everything/hooks/scripts/workflow-disposition.js +0 -2
- package/plugins/harness-everything/hooks/scripts/workflow-stop-gate.js +17 -30
- package/plugins/harness-everything/plugin.json +1 -1
- package/plugins/harness-everything/skills/error-ledger-bootstrap/SKILL.md +1 -1
- package/plugins/harness-everything/skills/error-ledger-bootstrap/references/workflow.md +42 -7
- package/plugins/harness-everything/skills/error-ledger-bootstrap/scripts/promote.js +8 -6
- package/plugins/harness-everything/skills/error-ledger-bootstrap/scripts/scan.js +525 -12
- package/sbom.cdx.json +7 -7
- package/scripts/dispatch.js +499 -87
- package/scripts/error-ledger-oracle.js +521 -27
- package/scripts/errors-sync.js +4 -3
- package/scripts/report-writer.js +4 -3
- package/ci/fixtures/doc-obligations/reconciliation-s1/cases.json +0 -6854
- package/ci/fixtures/doc-obligations/reconciliation-s1/fail-session-writes.js +0 -116
- package/ci/fixtures/doc-obligations/reconciliation-s2a/harness.js +0 -507
- package/ci/fixtures/doc-obligations/reconciliation-s2a/run13-workflow-requirements.json +0 -42
- package/ci/fixtures/doc-obligations/reconciliation-s2a/vectors.json +0 -617
- package/ci/fixtures/doc-obligations/reconciliation-s2b/capture/harness.js +0 -415
- package/ci/fixtures/doc-obligations/reconciliation-s2b/capture/payload-post-tool-use-success-minimal.json +0 -9
- package/ci/fixtures/doc-obligations/reconciliation-s2b/capture/payload-subagent-start.json +0 -7
- package/ci/fixtures/doc-obligations/reconciliation-s2b/capture/payload-subagent-stop-freetext-reject.json +0 -11
- package/ci/fixtures/doc-obligations/reconciliation-s2b/capture/payload-subagent-stop-reject.json +0 -11
- package/ci/fixtures/doc-obligations/reconciliation-s2b/capture/payload-subagent-stop.json +0 -11
- package/ci/fixtures/doc-obligations/reconciliation-s2b/capture/payload-task-result.json +0 -19
- package/ci/fixtures/doc-obligations/reconciliation-s2b/corpus/off-capture-only.json +0 -99
- package/ci/fixtures/doc-obligations/reconciliation-s2b/corpus/off-legacy.json +0 -67
- package/ci/fixtures/doc-obligations/reconciliation-s2b/corpus/on-concurrent-writers.json +0 -62
- package/ci/fixtures/doc-obligations/reconciliation-s2b/corpus/on-lookalikes-runtime-mutations.json +0 -67
- package/ci/fixtures/doc-obligations/reconciliation-s2b/corpus/on-malformed.json +0 -85
- package/ci/fixtures/doc-obligations/reconciliation-s2b/corpus/on-normal-session.json +0 -74
- package/ci/fixtures/doc-obligations/reconciliation-s2b/corpus/on-runtime-drift-later-npm-test.json +0 -58
- package/ci/fixtures/doc-obligations/reconciliation-s2b/corpus/on-valid-direct-quoted-review.json +0 -85
- package/ci/fixtures/doc-obligations/reconciliation-s2b/f4/cases.json +0 -2267
- package/ci/fixtures/doc-obligations/reconciliation-s2b/wiring/cases.json +0 -1110
- package/ci/lib/doc-reconciliation-file-spy.js +0 -23
- package/ci/lib/doc-reconciliation-qualification-preload.js +0 -37
- package/ci/lib/doc-reconciliation-replay.js +0 -104
- package/ci/lib/doc-reconciliation-staged-tree.js +0 -102
- package/ci/mechanism-325-3b-h1-qualification.test.js +0 -206
- package/ci/mechanism-325-3b-s1.test.js +0 -188
- package/ci/mechanism-325-3b-s2a-core.test.js +0 -840
- package/ci/mechanism-325-3b-s2a-producer.test.js +0 -564
- package/ci/mechanism-325-3b-s2b-capture.test.js +0 -566
- package/ci/mechanism-325-3b-s2b-wiring.test.js +0 -679
- package/ci/mechanism-325-f4-invariants.test.js +0 -606
- package/ci/mechanism-325-f4-projections.test.js +0 -392
- package/ci/mechanism-325-f4-qualification.test.js +0 -228
- package/ci/mechanism-325-f4-trust-boundary.test.js +0 -880
- package/ci/mechanism-e1-dependency-artifact-scope.test.js +0 -657
- package/hooks/scripts/lib/doc-reconciliation-capture.sanitized.jsonl +0 -26
- package/hooks/scripts/lib/doc-reconciliation-core.js +0 -336
- package/hooks/scripts/lib/doc-reconciliation-events.js +0 -292
- package/hooks/scripts/lib/doc-reconciliation-outline-capture.sanitized.jsonl +0 -24
- package/hooks/scripts/lib/doc-reconciliation-pilot.js +0 -482
- package/hooks/scripts/lib/doc-reconciliation-producer.js +0 -468
- package/hooks/scripts/lib/doc-reconciliation-provider.js +0 -3304
- package/hooks/scripts/lib/doc-reconciliation-qualification.json +0 -54
- package/hooks/scripts/w6-state-operations.js +0 -239
- package/plugins/harness-everything/hooks/scripts/lib/doc-reconciliation-capture.sanitized.jsonl +0 -26
- package/plugins/harness-everything/hooks/scripts/lib/doc-reconciliation-core.js +0 -336
- package/plugins/harness-everything/hooks/scripts/lib/doc-reconciliation-events.js +0 -292
- package/plugins/harness-everything/hooks/scripts/lib/doc-reconciliation-outline-capture.sanitized.jsonl +0 -24
- package/plugins/harness-everything/hooks/scripts/lib/doc-reconciliation-pilot.js +0 -482
- package/plugins/harness-everything/hooks/scripts/lib/doc-reconciliation-producer.js +0 -468
- package/plugins/harness-everything/hooks/scripts/lib/doc-reconciliation-provider.js +0 -3304
- package/plugins/harness-everything/hooks/scripts/lib/doc-reconciliation-qualification.json +0 -54
- package/plugins/harness-everything/hooks/scripts/w6-state-operations.js +0 -239
- package/scripts/system-one-eval-laya.js +0 -112
- /package/ci/fixtures/{doc-obligations/reconciliation-s2b/capture → state-persist-post-tool-use}/payload-post-tool-use-failure.json +0 -0
- /package/ci/fixtures/{doc-obligations/reconciliation-s2b/wiring → workflow-contract}/legacy-off-golden.json +0 -0
|
@@ -0,0 +1,324 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
'use strict';
|
|
3
|
+
|
|
4
|
+
// Issue #553 T2-W: surviving CLI, hook, and Stop workflow replay controls across source and packaged legs.
|
|
5
|
+
//
|
|
6
|
+
// Migrated from ci/mechanism-325-3b-s1.test.js and ci/mechanism-325-3b-s2b-wiring.test.js onto surviving
|
|
7
|
+
// fixtures under ci/fixtures/workflow-contract/. Every case replays through real source and packaged
|
|
8
|
+
// entry points (kernel-router, workflow-disposition, workflow-stop-gate, stop-gate, state-persist)
|
|
9
|
+
// with zero dependency on E1 reconciliation runtime modules.
|
|
10
|
+
|
|
11
|
+
const fs = require('fs');
|
|
12
|
+
const path = require('path');
|
|
13
|
+
const fx = require('./lib/doc-reconciliation-prep-fixtures');
|
|
14
|
+
|
|
15
|
+
const FIXTURE_DIR = path.join(__dirname, 'fixtures', 'workflow-contract');
|
|
16
|
+
const WORKFLOW_CORPUS_FILE = path.join(FIXTURE_DIR, 'cases.json');
|
|
17
|
+
const WIRING_CORPUS_FILE = path.join(FIXTURE_DIR, 'wiring-cases.json');
|
|
18
|
+
const LEGACY_GOLDEN_FILE = path.join(FIXTURE_DIR, 'legacy-off-golden.json');
|
|
19
|
+
|
|
20
|
+
const LEGS = ['source', 'packaged'];
|
|
21
|
+
const S1_MODES = ['off', 'on'];
|
|
22
|
+
const ALLOWED_OPERATORS = new Set(['equals', 'notEquals', 'includes', 'absent']);
|
|
23
|
+
const S1_KINDS = new Set(['control', 'additional']);
|
|
24
|
+
const REQUIRED_CASE_FIELDS = ['id', 'family', 'description', 'topology', 'requirements', 'input', 'actions', 'expectations'];
|
|
25
|
+
|
|
26
|
+
const WIRING_MODES = {
|
|
27
|
+
'W-off-legacy': ['off'],
|
|
28
|
+
'W-ctrl-nondoc-on': ['on'],
|
|
29
|
+
'W-strict-oldpass-governed': ['off'],
|
|
30
|
+
'W-strict-f3-pin': ['off'],
|
|
31
|
+
'W-strict-f5-gitdiag': ['off'],
|
|
32
|
+
};
|
|
33
|
+
|
|
34
|
+
const WIRING_PLAN = {
|
|
35
|
+
'W-off-legacy': {
|
|
36
|
+
off: [
|
|
37
|
+
{ id: 'w-off.route-exit', path: ['actions', 'route', 'exitCode'], operator: 'equals', expected: 0 },
|
|
38
|
+
{ id: 'w-off.plan-exit', path: ['actions', 'plan', 'exitCode'], operator: 'equals', expected: 0 },
|
|
39
|
+
{ id: 'w-off.start-exit', path: ['actions', 'start', 'exitCode'], operator: 'equals', expected: 0 },
|
|
40
|
+
{ id: 'w-off.doc-pass-exit', path: ['actions', 'doc-pass', 'exitCode'], operator: 'equals', expected: 0 },
|
|
41
|
+
{ id: 'w-off.review-pass-exit', path: ['actions', 'review-pass', 'exitCode'], operator: 'equals', expected: 0 },
|
|
42
|
+
{ id: 'w-off.verify-bind-exit', path: ['actions', 'verify-bind', 'exitCode'], operator: 'equals', expected: 0 },
|
|
43
|
+
{ id: 'w-off.verify-pass-exit', path: ['actions', 'verify-pass', 'exitCode'], operator: 'equals', expected: 0 },
|
|
44
|
+
{ id: 'w-off.stop-exit', path: ['actions', 'stop', 'exitCode'], operator: 'equals', expected: 0 },
|
|
45
|
+
{ id: 'w-off.stop-satisfied', path: ['actions', 'stop', 'state', 'workflow', 'state'], operator: 'equals', expected: 'satisfied' },
|
|
46
|
+
{ id: 'w-off.stop-unresolved', path: ['actions', 'stop', 'state', 'workflow', 'unresolved'], operator: 'equals', expected: [] },
|
|
47
|
+
{ id: 'w-off.stop-generic-exit', path: ['actions', 'stop-generic', 'exitCode'], operator: 'equals', expected: 0 },
|
|
48
|
+
{ id: 'w-off.stop-generic-satisfied', path: ['actions', 'stop-generic', 'state', 'workflow', 'state'], operator: 'equals', expected: 'satisfied' },
|
|
49
|
+
{ id: 'w-off.pilot-null', path: ['pilot'], operator: 'equals', expected: null },
|
|
50
|
+
{ id: 'w-off.pilot-report-origin', path: ['pilotReportOrigin'], operator: 'equals', expected: 'harness' },
|
|
51
|
+
{ id: 'w-off.no-baseline-captured', path: ['actions', 'stop', 'state', 'workflow', 'docReconciliationBaseline'], operator: 'absent' },
|
|
52
|
+
],
|
|
53
|
+
},
|
|
54
|
+
'W-ctrl-nondoc-on': {
|
|
55
|
+
on: [
|
|
56
|
+
{ id: 'w-nondoc.route-exit', path: ['actions', 'route', 'exitCode'], operator: 'equals', expected: 0 },
|
|
57
|
+
{ id: 'w-nondoc.plan-exit', path: ['actions', 'plan', 'exitCode'], operator: 'equals', expected: 0 },
|
|
58
|
+
{ id: 'w-nondoc.start-exit', path: ['actions', 'start', 'exitCode'], operator: 'equals', expected: 0 },
|
|
59
|
+
{ id: 'w-nondoc.direct-execute-exit', path: ['actions', 'direct-execute', 'exitCode'], operator: 'equals', expected: 0 },
|
|
60
|
+
{ id: 'w-nondoc.code-pass-exit', path: ['actions', 'code-pass', 'exitCode'], operator: 'equals', expected: 0 },
|
|
61
|
+
{ id: 'w-nondoc.verify-pass-exit', path: ['actions', 'verify-pass', 'exitCode'], operator: 'equals', expected: 0 },
|
|
62
|
+
{ id: 'w-nondoc.stop-satisfied', path: ['actions', 'stop', 'state', 'workflow', 'state'], operator: 'equals', expected: 'satisfied' },
|
|
63
|
+
{ id: 'w-nondoc.stop-unresolved', path: ['actions', 'stop', 'state', 'workflow', 'unresolved'], operator: 'equals', expected: [] },
|
|
64
|
+
{ id: 'w-nondoc.stop-generic-satisfied', path: ['actions', 'stop-generic', 'state', 'workflow', 'state'], operator: 'equals', expected: 'satisfied' },
|
|
65
|
+
{ id: 'w-nondoc.stop-generic-exit', path: ['actions', 'stop-generic', 'exitCode'], operator: 'equals', expected: 0 },
|
|
66
|
+
],
|
|
67
|
+
},
|
|
68
|
+
'W-strict-oldpass-governed': {
|
|
69
|
+
off: [
|
|
70
|
+
{ id: 'w-oldpass.stop-satisfied-state', path: ['actions', 'stop-satisfied', 'state', 'workflow', 'state'], operator: 'equals', expected: 'satisfied' },
|
|
71
|
+
{ id: 'w-oldpass.add-governed-exit', path: ['actions', 'add-governed-adr', 'exitCode'], operator: 'equals', expected: 0 },
|
|
72
|
+
{ id: 'w-oldpass.stop-recheck-exit', path: ['actions', 'stop-recheck', 'exitCode'], operator: 'equals', expected: 0 },
|
|
73
|
+
],
|
|
74
|
+
},
|
|
75
|
+
'W-strict-f3-pin': {
|
|
76
|
+
off: [
|
|
77
|
+
{ id: 'w-f3.doc-pass-exit', path: ['actions', 'doc-pass', 'exitCode'], operator: 'equals', expected: 0 },
|
|
78
|
+
{ id: 'w-f3.review-pass-exit', path: ['actions', 'review-pass', 'exitCode'], operator: 'equals', expected: 0 },
|
|
79
|
+
{ id: 'w-f3.verify-pass-exit', path: ['actions', 'verify-pass', 'exitCode'], operator: 'equals', expected: 0 },
|
|
80
|
+
{ id: 'w-f3.commit-mid-exit', path: ['actions', 'commit-mid', 'exitCode'], operator: 'equals', expected: 0 },
|
|
81
|
+
{ id: 'w-f3.stop-exit', path: ['actions', 'stop', 'exitCode'], operator: 'equals', expected: 0 },
|
|
82
|
+
{ id: 'w-f3.stop-satisfied', path: ['actions', 'stop', 'state', 'workflow', 'state'], operator: 'equals', expected: 'satisfied' },
|
|
83
|
+
{ id: 'w-f3.stop-unresolved', path: ['actions', 'stop', 'state', 'workflow', 'unresolved'], operator: 'equals', expected: [] },
|
|
84
|
+
],
|
|
85
|
+
},
|
|
86
|
+
'W-strict-f5-gitdiag': {
|
|
87
|
+
off: [
|
|
88
|
+
{ id: 'w-f5.off.plan-exit', path: ['actions', 'plan', 'exitCode'], operator: 'equals', expected: 0 },
|
|
89
|
+
{ id: 'w-f5.off.verify-pass-exit', path: ['actions', 'verify-pass', 'exitCode'], operator: 'equals', expected: 0 },
|
|
90
|
+
{ id: 'w-f5.off.pilot-null', path: ['pilot'], operator: 'equals', expected: null },
|
|
91
|
+
{ id: 'w-f5.off.stop-satisfied', path: ['actions', 'stop', 'state', 'workflow', 'state'], operator: 'equals', expected: 'satisfied' },
|
|
92
|
+
],
|
|
93
|
+
},
|
|
94
|
+
};
|
|
95
|
+
|
|
96
|
+
let passed = 0;
|
|
97
|
+
let failed = 0;
|
|
98
|
+
let infra = 0;
|
|
99
|
+
const failures = [];
|
|
100
|
+
const infrastructure = [];
|
|
101
|
+
|
|
102
|
+
const show = value => (value === undefined ? 'undefined' : JSON.stringify(value));
|
|
103
|
+
|
|
104
|
+
function reasonFor(assertion, actual) {
|
|
105
|
+
const last = assertion.path[assertion.path.length - 1];
|
|
106
|
+
const label = ({
|
|
107
|
+
exitCode: 'exit',
|
|
108
|
+
state: 'state',
|
|
109
|
+
unresolved: 'unresolved',
|
|
110
|
+
pilotStatus: 'pilot status',
|
|
111
|
+
pilotReportOrigin: 'pilot origin',
|
|
112
|
+
pilot: 'pilot',
|
|
113
|
+
})[last]
|
|
114
|
+
|| (assertion.path.includes('obligations') && last === 'status' ? 'obligation status' : null)
|
|
115
|
+
|| (assertion.path.includes('requirements') && last === 'status' ? 'step status' : null)
|
|
116
|
+
|| assertion.path.slice(-2).join('.');
|
|
117
|
+
const absent = actual && typeof actual === 'object' && actual.kind === 'absent';
|
|
118
|
+
if (assertion.operator === 'includes') {
|
|
119
|
+
return absent ? `${label} absent where ${show(assertion.expected)} desired`
|
|
120
|
+
: `${label} ${show(actual)} lacks ${show(assertion.expected)}`;
|
|
121
|
+
}
|
|
122
|
+
if (assertion.operator === 'notEquals') return `${label} ${show(actual)} where a value other than ${show(assertion.expected)} desired`;
|
|
123
|
+
if (assertion.operator === 'absent') return `${label} present where absent desired`;
|
|
124
|
+
if (absent) return `${label} absent where ${show(assertion.expected)} desired`;
|
|
125
|
+
return `${label} ${show(actual)} where ${show(assertion.expected)} desired`;
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
function record(status, id, detail) {
|
|
129
|
+
if (status === 'PASS') passed += 1;
|
|
130
|
+
else if (status === 'FAIL') { failed += 1; failures.push(id); }
|
|
131
|
+
else { infra += 1; infrastructure.push(id); }
|
|
132
|
+
console.log(` ${status} ${id}${detail ? ` — ${detail}` : ''}`);
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
function comparable(root) {
|
|
136
|
+
const entries = Object.entries(root.actions).map(([id, action]) => [id, {
|
|
137
|
+
exitCode: action.exitCode,
|
|
138
|
+
signal: action.signal,
|
|
139
|
+
stdout: action.json === null ? action.stdout : null,
|
|
140
|
+
json: action.json,
|
|
141
|
+
stderr: action.stderr,
|
|
142
|
+
state: action.state,
|
|
143
|
+
}]);
|
|
144
|
+
return fx.normalize(Object.fromEntries([...entries, ['$final', root.state]]));
|
|
145
|
+
}
|
|
146
|
+
|
|
147
|
+
function checkInventory(corpus) {
|
|
148
|
+
const problems = [];
|
|
149
|
+
const caseIds = corpus.cases.map(item => item.id);
|
|
150
|
+
if (new Set(caseIds).size !== caseIds.length) problems.push('case ids are not unique');
|
|
151
|
+
for (const item of corpus.cases) {
|
|
152
|
+
for (const field of REQUIRED_CASE_FIELDS) {
|
|
153
|
+
if (item[field] === undefined) problems.push(`${item.id} lacks ${field}`);
|
|
154
|
+
}
|
|
155
|
+
const actionIds = item.actions.map(action => action.id);
|
|
156
|
+
if (new Set(actionIds).size !== actionIds.length) problems.push(`${item.id} action ids are not unique`);
|
|
157
|
+
for (const action of item.actions) {
|
|
158
|
+
if (!fx.ALL_OPS.has(action.op)) problems.push(`${item.id}.${action.id} op ${action.op} is not allowed`);
|
|
159
|
+
for (const mode of S1_MODES) {
|
|
160
|
+
try { fx.exitPolicy(action, mode); } catch (error) { problems.push(error.message); }
|
|
161
|
+
}
|
|
162
|
+
}
|
|
163
|
+
for (const mode of S1_MODES) {
|
|
164
|
+
const ids = item.expectations[mode].map(assertion => assertion.id);
|
|
165
|
+
if (new Set(ids).size !== ids.length) problems.push(`${item.id}.${mode} assertion ids are not unique`);
|
|
166
|
+
for (const assertion of item.expectations[mode]) {
|
|
167
|
+
if (!ALLOWED_OPERATORS.has(assertion.operator)) problems.push(`${item.id}.${assertion.id} operator ${assertion.operator}`);
|
|
168
|
+
if (!Array.isArray(assertion.path) || assertion.path.length === 0) problems.push(`${item.id}.${assertion.id} has no path`);
|
|
169
|
+
if (!S1_KINDS.has(assertion.s1Kind)) problems.push(`${item.id}.${assertion.id} lacks a valid s1Kind`);
|
|
170
|
+
}
|
|
171
|
+
}
|
|
172
|
+
}
|
|
173
|
+
if (problems.length) record('FAIL', 'inventory: workflow-contract corpus rows are well formed', problems.join('; '));
|
|
174
|
+
else record('PASS', 'inventory: workflow-contract corpus rows are well formed');
|
|
175
|
+
}
|
|
176
|
+
|
|
177
|
+
function scrubTextPathControls() {
|
|
178
|
+
const roots = { repo: '/private/tmp/harness', tmp: ['/private/tmp'] };
|
|
179
|
+
const macosSkill = fx.scrubText('/private/tmp/harness/plugins/harness-everything/skills/verification-loop/SKILL.md', roots);
|
|
180
|
+
const unrelatedPath = fx.scrubText('/private/tmp/unrelated/verification-loop/SKILL.md', roots);
|
|
181
|
+
const ordinaryTmp = fx.scrubText('/tmp/unrelated/workflow-run.json', roots);
|
|
182
|
+
record(macosSkill === '<skill:verification-loop>' ? 'PASS' : 'FAIL', 'w-scrub.macos-private-tmp-skill', macosSkill === '<skill:verification-loop>' ? '' : `expected <skill:verification-loop>, got ${macosSkill}`);
|
|
183
|
+
record(unrelatedPath === '<tmp>' ? 'PASS' : 'FAIL', 'w-scrub.unrelated-private-tmp', unrelatedPath === '<tmp>' ? '' : `expected <tmp>, got ${unrelatedPath}`);
|
|
184
|
+
record(ordinaryTmp === '<tmp>' ? 'PASS' : 'FAIL', 'w-scrub.ordinary-tmp', ordinaryTmp === '<tmp>' ? '' : `expected <tmp>, got ${ordinaryTmp}`);
|
|
185
|
+
}
|
|
186
|
+
|
|
187
|
+
function replayWorkflowCorpus(corpus) {
|
|
188
|
+
console.log('\n== Part 1: workflow-contract CLI/Stop controls (both legs, parity) ==');
|
|
189
|
+
for (const item of corpus.cases) {
|
|
190
|
+
for (const mode of S1_MODES) {
|
|
191
|
+
const roots = {};
|
|
192
|
+
for (const leg of LEGS) {
|
|
193
|
+
let root;
|
|
194
|
+
try {
|
|
195
|
+
root = fx.scrubReplay(fx.replayCase(item, leg, mode === 'on' ? { pilot: '1' } : undefined));
|
|
196
|
+
} catch (error) {
|
|
197
|
+
record('INFRA', `${item.id}.${mode} [${leg}]`, `replay failed: ${error.message.split('\n')[0]}`);
|
|
198
|
+
continue;
|
|
199
|
+
}
|
|
200
|
+
roots[leg] = root;
|
|
201
|
+
const faults = fx.infrastructureFaults(item, root, mode);
|
|
202
|
+
if (faults.length) {
|
|
203
|
+
record('INFRA', `${item.id}.${mode} [${leg}]`, faults.map(f => `${f.actionId}: ${f.message}`).join('; '));
|
|
204
|
+
continue;
|
|
205
|
+
}
|
|
206
|
+
for (const assertion of item.expectations[mode]) {
|
|
207
|
+
const result = fx.evaluateAssertion(root, assertion);
|
|
208
|
+
const id = `${item.id}.${mode}.${assertion.id} [${leg}]`;
|
|
209
|
+
const tag = `(${assertion.s1Kind})`;
|
|
210
|
+
if (result.pass) record('PASS', id, tag);
|
|
211
|
+
else record('FAIL', id, `${tag} ${reasonFor(assertion, result.actual)}`);
|
|
212
|
+
}
|
|
213
|
+
}
|
|
214
|
+
if (roots.source && roots.packaged && !fx.infrastructureFaults(item, roots.source, mode).length
|
|
215
|
+
&& !fx.infrastructureFaults(item, roots.packaged, mode).length) {
|
|
216
|
+
const same = JSON.stringify(comparable(roots.source)) === JSON.stringify(comparable(roots.packaged));
|
|
217
|
+
record(same ? 'PASS' : 'FAIL', `${item.id}.${mode}.parity [source=packaged]`, same ? '(control)' : '(control) source and packaged legs disagree');
|
|
218
|
+
}
|
|
219
|
+
}
|
|
220
|
+
}
|
|
221
|
+
}
|
|
222
|
+
|
|
223
|
+
function wiringCustomChecks(item, root, leg) {
|
|
224
|
+
if (item.id === 'W-strict-oldpass-governed') {
|
|
225
|
+
const requirements = (root.actions['stop-recheck'].state.obligations || {}).requirements || [];
|
|
226
|
+
const retained = requirements.some(step => step.id === 'req-code' && step.status === 'pass');
|
|
227
|
+
record(retained ? 'PASS' : 'FAIL', `w-oldpass.history-retained@${leg}`, retained ? '' : 'earlier non-document PASS history was not retained after post-satisfaction edit');
|
|
228
|
+
}
|
|
229
|
+
}
|
|
230
|
+
|
|
231
|
+
function replayWiringCorpus(wiringCorpus) {
|
|
232
|
+
console.log('\n== Part 2: wiring workflow controls (both legs, parity) ==');
|
|
233
|
+
let offLegacyRoots = null;
|
|
234
|
+
for (const item of wiringCorpus.cases) {
|
|
235
|
+
const planByMode = WIRING_PLAN[item.id];
|
|
236
|
+
if (!planByMode) {
|
|
237
|
+
record('INFRA', item.id, 'wiring case has no retained-control plan');
|
|
238
|
+
continue;
|
|
239
|
+
}
|
|
240
|
+
for (const mode of WIRING_MODES[item.id] || ['off']) {
|
|
241
|
+
const roots = {};
|
|
242
|
+
for (const leg of LEGS) {
|
|
243
|
+
let root;
|
|
244
|
+
try {
|
|
245
|
+
root = fx.replayCase(item, leg, mode === 'off' ? {} : { pilot: '1' });
|
|
246
|
+
} catch (error) {
|
|
247
|
+
record('INFRA', `${item.id}.${mode}@${leg}`, `replay crash: ${error.message}`);
|
|
248
|
+
continue;
|
|
249
|
+
}
|
|
250
|
+
roots[leg] = root;
|
|
251
|
+
const faults = fx.infrastructureFaults(item, root, mode);
|
|
252
|
+
if (faults.length) {
|
|
253
|
+
record('INFRA', `${item.id}.${mode}@${leg}`, faults.map(f => `${f.actionId}: ${f.message}`).join('; '));
|
|
254
|
+
continue;
|
|
255
|
+
}
|
|
256
|
+
const assertions = planByMode[mode] || [];
|
|
257
|
+
const results = fx.evaluateAll(root, assertions);
|
|
258
|
+
results.forEach((result, index) => {
|
|
259
|
+
const entry = assertions[index];
|
|
260
|
+
record(result.pass ? 'PASS' : 'FAIL', `${entry.id}@${leg}`, result.pass ? '' : `expected ${JSON.stringify(entry.expected)} at ${entry.path.join('.')}, got ${JSON.stringify(result.actual)}`);
|
|
261
|
+
});
|
|
262
|
+
wiringCustomChecks(item, root, leg);
|
|
263
|
+
}
|
|
264
|
+
if (roots.source && roots.packaged && !fx.infrastructureFaults(item, roots.source, mode).length
|
|
265
|
+
&& !fx.infrastructureFaults(item, roots.packaged, mode).length) {
|
|
266
|
+
const same = JSON.stringify(comparable(fx.scrubReplay(roots.source))) === JSON.stringify(comparable(fx.scrubReplay(roots.packaged)));
|
|
267
|
+
record(same ? 'PASS' : 'FAIL', `${item.id}.${mode}.parity [source=packaged]`, same ? '(control)' : '(control) source and packaged legs disagree');
|
|
268
|
+
}
|
|
269
|
+
if (item.id === 'W-off-legacy' && mode === 'off') offLegacyRoots = roots;
|
|
270
|
+
}
|
|
271
|
+
}
|
|
272
|
+
return offLegacyRoots;
|
|
273
|
+
}
|
|
274
|
+
|
|
275
|
+
function verifyLegacyGolden(offLegacyRoots) {
|
|
276
|
+
console.log('\n== Part 3: W-off-legacy two-leg byte-equivalence (frozen golden) ==');
|
|
277
|
+
let golden;
|
|
278
|
+
try {
|
|
279
|
+
golden = JSON.parse(fs.readFileSync(LEGACY_GOLDEN_FILE, 'utf8'));
|
|
280
|
+
} catch (error) {
|
|
281
|
+
record('INFRA', 'w-golden.load', `golden unreadable: ${error.message}`);
|
|
282
|
+
return;
|
|
283
|
+
}
|
|
284
|
+
for (const leg of LEGS) {
|
|
285
|
+
const root = offLegacyRoots && offLegacyRoots[leg];
|
|
286
|
+
if (!root) {
|
|
287
|
+
record('INFRA', `w-golden.replay@${leg}`, 'W-off-legacy replay result unavailable');
|
|
288
|
+
continue;
|
|
289
|
+
}
|
|
290
|
+
const actual = {
|
|
291
|
+
workflow: fx.normalize((root.actions.stop.state || {}).workflow),
|
|
292
|
+
obligations: fx.normalize((root.actions.stop.state || {}).obligations),
|
|
293
|
+
};
|
|
294
|
+
const expected = golden[leg];
|
|
295
|
+
const same = JSON.stringify(actual.workflow) === JSON.stringify(expected.workflow)
|
|
296
|
+
&& JSON.stringify(actual.obligations) === JSON.stringify(expected.obligations);
|
|
297
|
+
record(same ? 'PASS' : 'FAIL', `w-golden.byte-equivalence@${leg}`, same ? '' : 'OFF replay diverged from the frozen legacy golden');
|
|
298
|
+
record(root.actions['stop-generic'].exitCode === expected.stopGeneric.exitCode ? 'PASS' : 'FAIL', `w-golden.stop-generic-exit@${leg}`);
|
|
299
|
+
}
|
|
300
|
+
}
|
|
301
|
+
|
|
302
|
+
console.log('=== Issue #553 T2-W: workflow-contract replay suite ===');
|
|
303
|
+
const workflowCorpus = fx.readCaseCorpus(WORKFLOW_CORPUS_FILE);
|
|
304
|
+
const wiringCorpus = fx.readCaseCorpus(WIRING_CORPUS_FILE);
|
|
305
|
+
|
|
306
|
+
checkInventory(workflowCorpus);
|
|
307
|
+
scrubTextPathControls();
|
|
308
|
+
replayWorkflowCorpus(workflowCorpus);
|
|
309
|
+
const offLegacyRoots = replayWiringCorpus(wiringCorpus);
|
|
310
|
+
verifyLegacyGolden(offLegacyRoots);
|
|
311
|
+
|
|
312
|
+
console.log(`\nWorkflow replay summary: ${passed} PASS, ${failed} FAIL, ${infra} INFRA across ${workflowCorpus.cases.length} S1 + ${wiringCorpus.cases.length} wiring cases`);
|
|
313
|
+
if (failures.length) console.log(`FAILED assertions (${failures.length}):\n ${failures.join('\n ')}`);
|
|
314
|
+
if (infrastructure.length) console.log(`INFRASTRUCTURE (${infrastructure.length}):\n ${infrastructure.join('\n ')}`);
|
|
315
|
+
|
|
316
|
+
if (infra > 0) {
|
|
317
|
+
console.error('Workflow replay suite: infrastructure faults present.');
|
|
318
|
+
process.exitCode = 2;
|
|
319
|
+
} else if (failed > 0) {
|
|
320
|
+
console.error('Workflow replay suite: assertion FAIL present.');
|
|
321
|
+
process.exitCode = 1;
|
|
322
|
+
} else {
|
|
323
|
+
console.log('Workflow replay suite: all assertions PASS.');
|
|
324
|
+
}
|
|
@@ -2315,4 +2315,136 @@ checkCase('2ax. frozen Git-object guard with bootstrap and tamper controls', ()
|
|
|
2315
2315
|
});
|
|
2316
2316
|
});
|
|
2317
2317
|
|
|
2318
|
+
// Moved from 325-3b-s2a-{core,producer} and e1-dependency-artifact-scope (#553 T2-D):
|
|
2319
|
+
// resolver capture/copy parity, A03 resolver-only capture controls, and narrow dependency-artifact root validation.
|
|
2320
|
+
|
|
2321
|
+
const RESOLVER_LEGS = [
|
|
2322
|
+
{
|
|
2323
|
+
name: 'source',
|
|
2324
|
+
file: path.join(REPOSITORY_ROOT, 'harness-everything', 'scripts', 'project-docs-resolver.js')
|
|
2325
|
+
},
|
|
2326
|
+
{
|
|
2327
|
+
name: 'packaged',
|
|
2328
|
+
file: path.join(REPOSITORY_ROOT, 'plugins', 'harness-everything', 'skills', 'harness-everything', 'scripts', 'project-docs-resolver.js')
|
|
2329
|
+
}
|
|
2330
|
+
];
|
|
2331
|
+
const DERIVE_FIXTURE_ROOT = path.join(__dirname, 'fixtures', 'doc-obligations', 'derive');
|
|
2332
|
+
const RESOLVER_DERIVE_CONFIG = JSON.parse(fs.readFileSync(path.join(DERIVE_FIXTURE_ROOT, 'config.json'), 'utf8'));
|
|
2333
|
+
const RESOLVER_CONFIG_REL = '.agents/harness-everything/project-docs.json';
|
|
2334
|
+
const RESOLVER_HOST_MANIFEST = '.claude/harness-everything/manifest.json';
|
|
2335
|
+
const RESOLVER_EXPECTED_ROOTS = ['.husky/_', 'node_modules'];
|
|
2336
|
+
|
|
2337
|
+
function readFixtureTree(root) {
|
|
2338
|
+
const files = {};
|
|
2339
|
+
if (!fs.existsSync(root)) return files;
|
|
2340
|
+
const walk = dir => {
|
|
2341
|
+
for (const entry of fs.readdirSync(dir, { withFileTypes: true })) {
|
|
2342
|
+
const full = path.join(dir, entry.name);
|
|
2343
|
+
if (entry.isDirectory()) walk(full);
|
|
2344
|
+
else files[path.relative(root, full).split(path.sep).join('/')] = fs.readFileSync(full, 'utf8');
|
|
2345
|
+
}
|
|
2346
|
+
};
|
|
2347
|
+
walk(root);
|
|
2348
|
+
return files;
|
|
2349
|
+
}
|
|
2350
|
+
|
|
2351
|
+
function writeResolverFixture(name, baseFiles, candidateFiles = {}) {
|
|
2352
|
+
const root = workspace(`resolver-${name}-${Math.random().toString(16).slice(2, 8)}`);
|
|
2353
|
+
const writeMap = files => {
|
|
2354
|
+
for (const [rel, content] of Object.entries(files)) {
|
|
2355
|
+
const target = path.join(root, ...rel.split('/'));
|
|
2356
|
+
if (content === null) { fs.rmSync(target, { force: true }); continue; }
|
|
2357
|
+
fs.mkdirSync(path.dirname(target), { recursive: true });
|
|
2358
|
+
fs.writeFileSync(target, content, 'utf8');
|
|
2359
|
+
}
|
|
2360
|
+
};
|
|
2361
|
+
writeMap({ [RESOLVER_CONFIG_REL]: `${JSON.stringify(RESOLVER_DERIVE_CONFIG, null, 2)}\n`, ...baseFiles });
|
|
2362
|
+
writeMap(candidateFiles);
|
|
2363
|
+
return root;
|
|
2364
|
+
}
|
|
2365
|
+
|
|
2366
|
+
function normativeResolverFiles() {
|
|
2367
|
+
const dir = path.join(DERIVE_FIXTURE_ROOT, 'missing-approval');
|
|
2368
|
+
return {
|
|
2369
|
+
base: readFixtureTree(path.join(dir, 'base')),
|
|
2370
|
+
candidate: readFixtureTree(path.join(dir, 'candidate'))
|
|
2371
|
+
};
|
|
2372
|
+
}
|
|
2373
|
+
|
|
2374
|
+
for (const leg of RESOLVER_LEGS) {
|
|
2375
|
+
checkCase(`resolver:captured-export-and-copies-synchronized [${leg.name}]`, () => {
|
|
2376
|
+
const resolverMod = require(leg.file);
|
|
2377
|
+
assert.strictEqual(typeof resolverMod.resolveDocsConfigCaptured, 'function', `${leg.name} resolver exports resolveDocsConfigCaptured`);
|
|
2378
|
+
const canonical = crypto.createHash('sha256').update(fs.readFileSync(RESOLVER_LEGS[0].file)).digest('hex');
|
|
2379
|
+
const copies = [
|
|
2380
|
+
'to-spec/scripts/project-docs-resolver.js',
|
|
2381
|
+
'multi-agent-workspace/scripts/project-docs-resolver.js',
|
|
2382
|
+
'plugins/harness-everything/skills/harness-everything/scripts/project-docs-resolver.js'
|
|
2383
|
+
];
|
|
2384
|
+
for (const copy of copies) {
|
|
2385
|
+
const digest = crypto.createHash('sha256').update(fs.readFileSync(path.join(REPOSITORY_ROOT, copy))).digest('hex');
|
|
2386
|
+
assert.strictEqual(digest, canonical, `${copy} matches the canonical resolver`);
|
|
2387
|
+
}
|
|
2388
|
+
});
|
|
2389
|
+
|
|
2390
|
+
checkCase(`A03:captured-resolution-equals-existing-resolver-project-config [${leg.name}]`, () => {
|
|
2391
|
+
const resolverMod = require(leg.file);
|
|
2392
|
+
const files = normativeResolverFiles();
|
|
2393
|
+
const root = writeResolverFixture(`a03-project-${leg.name}`, files.base, files.candidate);
|
|
2394
|
+
const captured = resolverMod.resolveDocsConfigCaptured(root, { activeHost: 'claude' });
|
|
2395
|
+
const existing = resolverMod.resolveDocsConfig(root, { activeHost: 'claude' });
|
|
2396
|
+
assert.strictEqual(sortedJson(captured.resolution), sortedJson(existing), 'captured resolution equals the existing resolver result');
|
|
2397
|
+
});
|
|
2398
|
+
|
|
2399
|
+
checkCase(`A03:project-overrides-host-positive-equals-existing-resolver [${leg.name}]`, () => {
|
|
2400
|
+
const resolverMod = require(leg.file);
|
|
2401
|
+
const host = {
|
|
2402
|
+
...normativeResolverFiles().base,
|
|
2403
|
+
[RESOLVER_HOST_MANIFEST]: `${JSON.stringify({ projectDocs: { governed: [{ path: 'docs/host/**', role: 'reference' }] } }, null, 2)}\n`
|
|
2404
|
+
};
|
|
2405
|
+
const root = writeResolverFixture(`a03-override-${leg.name}`, host);
|
|
2406
|
+
const captured = resolverMod.resolveDocsConfigCaptured(root, { activeHost: 'claude' });
|
|
2407
|
+
const existing = resolverMod.resolveDocsConfig(root, { activeHost: 'claude' });
|
|
2408
|
+
assert.strictEqual(sortedJson(captured.resolution), sortedJson(existing), 'project-overrides-host resolution');
|
|
2409
|
+
});
|
|
2410
|
+
|
|
2411
|
+
checkCase(`A03:equal-host-positive-equals-existing-resolver [${leg.name}]`, () => {
|
|
2412
|
+
const resolverMod = require(leg.file);
|
|
2413
|
+
const host = {
|
|
2414
|
+
...normativeResolverFiles().base,
|
|
2415
|
+
[RESOLVER_HOST_MANIFEST]: `${JSON.stringify({ projectDocs: RESOLVER_DERIVE_CONFIG }, null, 2)}\n`
|
|
2416
|
+
};
|
|
2417
|
+
const root = writeResolverFixture(`a03-equal-host-${leg.name}`, host);
|
|
2418
|
+
const captured = resolverMod.resolveDocsConfigCaptured(root, { activeHost: 'claude' });
|
|
2419
|
+
const existing = resolverMod.resolveDocsConfig(root, { activeHost: 'claude' });
|
|
2420
|
+
assert.strictEqual(sortedJson(captured.resolution), sortedJson(existing), 'equal-host resolution');
|
|
2421
|
+
});
|
|
2422
|
+
|
|
2423
|
+
checkCase(`A03:capture-binds-exact-config-bytes-and-selection [${leg.name}]`, () => {
|
|
2424
|
+
const resolverMod = require(leg.file);
|
|
2425
|
+
const files = normativeResolverFiles();
|
|
2426
|
+
const root = writeResolverFixture(`a03-bytes-${leg.name}`, files.base, files.candidate);
|
|
2427
|
+
const captured = resolverMod.resolveDocsConfigCaptured(root, { activeHost: 'claude' });
|
|
2428
|
+
const bytes = fs.readFileSync(path.join(root, RESOLVER_CONFIG_REL));
|
|
2429
|
+
const digest = crypto.createHash('sha256').update(bytes).digest('hex');
|
|
2430
|
+
assert.ok(JSON.stringify(captured.capture && captured.capture.sources).includes(digest),
|
|
2431
|
+
'the capture must carry the SHA256 of the exact config bytes that were parsed');
|
|
2432
|
+
assert.ok(captured.capture && Array.isArray(captured.capture.selectionInputs), 'capture.selectionInputs must be an array');
|
|
2433
|
+
});
|
|
2434
|
+
|
|
2435
|
+
checkCase(`config-validator-accepts-only-the-two-exact-optional-roots [${leg.name}]`, () => {
|
|
2436
|
+
const resolverMod = require(leg.file);
|
|
2437
|
+
for (const roots of [[], ['node_modules'], ['.husky/_'], RESOLVER_EXPECTED_ROOTS]) {
|
|
2438
|
+
assert.strictEqual(resolverMod.validateDocsConfig({ inventory: { dependencyArtifactRoots: roots } }).valid, true,
|
|
2439
|
+
`valid roots: ${JSON.stringify(roots)}`);
|
|
2440
|
+
}
|
|
2441
|
+
for (const roots of [['vendor'], ['node_modules', 'node_modules'], ['node_modules/child'], ['../node_modules'], ['/node_modules'], ['node_modules/']]) {
|
|
2442
|
+
assert.strictEqual(resolverMod.validateDocsConfig({ inventory: { dependencyArtifactRoots: roots } }).valid, false,
|
|
2443
|
+
`invalid roots: ${JSON.stringify(roots)}`);
|
|
2444
|
+
}
|
|
2445
|
+
assert.strictEqual(resolverMod.validateDocsConfig({ inventory: { dependencyArtifactRoots: ['node_modules'], exclusions: ['tmp'] } }).valid, false,
|
|
2446
|
+
'the narrow policy rejects extra exclusion controls');
|
|
2447
|
+
});
|
|
2448
|
+
}
|
|
2449
|
+
|
|
2318
2450
|
helper.finish();
|
|
@@ -1169,4 +1169,77 @@ checkCase('325-3a S3 absent reqUpdates with a valid-looking waiver and matching
|
|
|
1169
1169
|
'absent update data makes the obligation unknown: no pass and no absence fail');
|
|
1170
1170
|
});
|
|
1171
1171
|
|
|
1172
|
+
// T2-C (#553): surviving outline-confirmation evidence controls moved from
|
|
1173
|
+
// ci/mechanism-prb-outline-review.test.js (source + packaged legs).
|
|
1174
|
+
const EVIDENCE_LEGS = [
|
|
1175
|
+
{ name: 'source', modulePath: path.join(__dirname, '..', 'harness-everything', 'scripts', 'doc-evidence.js') },
|
|
1176
|
+
{ name: 'packaged', modulePath: path.join(__dirname, '..', 'plugins', 'harness-everything', 'skills', 'harness-everything', 'scripts', 'doc-evidence.js') },
|
|
1177
|
+
];
|
|
1178
|
+
|
|
1179
|
+
for (const leg of EVIDENCE_LEGS) {
|
|
1180
|
+
checkCase(`325-3a T2-C [${leg.name}] PR-B generic successful execution or waiver cannot pass outline-confirmation`, () => {
|
|
1181
|
+
const { checkDocObligations: checkLeg } = require(leg.modulePath);
|
|
1182
|
+
const target = 'docs/adr/DOCS-001.md';
|
|
1183
|
+
const digest = sha256('final D bytes');
|
|
1184
|
+
const baselineDigest = sha256('original B');
|
|
1185
|
+
const outlineObligation = {
|
|
1186
|
+
id: 'outline-confirmation', capability: 'outline-confirmation', strength: 'MUST',
|
|
1187
|
+
applicability: 'applicable', scope: { paths: [target] },
|
|
1188
|
+
};
|
|
1189
|
+
const genericExecution = {
|
|
1190
|
+
id: 'generic-exec', obligationId: 'outline-confirmation', kind: 'execution',
|
|
1191
|
+
command: 'echo done', exitCode: 0, paths: [target], artifactDigests: { [target]: digest },
|
|
1192
|
+
baseDigest: baselineDigest, provenance: 'ordinary shell command',
|
|
1193
|
+
};
|
|
1194
|
+
const genericWaiver = {
|
|
1195
|
+
id: 'generic-waiver', obligationId: 'outline-confirmation', kind: 'waiver', reason: 'approved',
|
|
1196
|
+
citedRecordIds: ['generic-exec'], paths: [target], artifactDigests: { [target]: digest }, baseDigest: baselineDigest,
|
|
1197
|
+
};
|
|
1198
|
+
const output = checkLeg({
|
|
1199
|
+
obligations: [outlineObligation], artifacts: { [target]: { digest } }, baseline: { digest: baselineDigest },
|
|
1200
|
+
executionRecords: [genericExecution], reviewRecords: [genericWaiver],
|
|
1201
|
+
});
|
|
1202
|
+
assert.notStrictEqual(output.results[0].outcome, 'pass', 'outline-confirmation must bypass generic execution and waiver lanes');
|
|
1203
|
+
assert.strictEqual(output.results[0].observation, 'unresolved');
|
|
1204
|
+
});
|
|
1205
|
+
|
|
1206
|
+
checkCase(`325-3a T2-C [${leg.name}] PR-B outline checker reports validated O/D and missing D remains incomplete`, () => {
|
|
1207
|
+
const { checkDocObligations: checkLeg } = require(leg.modulePath);
|
|
1208
|
+
const target = 'docs/adr/DOCS-001.md';
|
|
1209
|
+
const digest = sha256('final D bytes');
|
|
1210
|
+
const baselineDigest = sha256('original B');
|
|
1211
|
+
const evidence = {
|
|
1212
|
+
schema: 'harness.outline-confirmation.v1', state: 'validated',
|
|
1213
|
+
taskId: 'task-prb', attemptId: 'attempt-1', inventoryRowId: '20', domain: 'DOCS',
|
|
1214
|
+
inventoryPinDigest: sha256('pin'), inventoryArtifactDigest: sha256('inventory'),
|
|
1215
|
+
baselineCommit: 'a'.repeat(40), outlineCommit: 'b'.repeat(40), draftCommit: 'c'.repeat(40), mergedCommit: 'c'.repeat(40),
|
|
1216
|
+
handoffDigest: sha256('handoff'), reviewDigest: sha256('review'), seamDigest: sha256('seam'),
|
|
1217
|
+
reviewCaptureDigest: sha256('review-capture'), dispatchInputDigest: sha256('dispatch'), writerLeaseDigest: sha256('lease'),
|
|
1218
|
+
dispatchToolUseId: 'dispatch-1',
|
|
1219
|
+
ancestry: 'strict-descendant', targetPaths: [target],
|
|
1220
|
+
mergeCorrespondence: null,
|
|
1221
|
+
outlineArtifactDigests: { [target]: sha256('outline O bytes') },
|
|
1222
|
+
draftArtifactDigests: { [target]: digest },
|
|
1223
|
+
reviewerPrincipal: 'reviewer-agent', coordinatorPrincipal: 'author-session', workerPrincipal: 'worker-agent',
|
|
1224
|
+
};
|
|
1225
|
+
const output = checkLeg({
|
|
1226
|
+
obligations: [{ id: 'outline-confirmation', capability: 'outline-confirmation', strength: 'MUST',
|
|
1227
|
+
applicability: 'applicable', scope: { paths: [target] } }],
|
|
1228
|
+
artifacts: { [target]: { digest } }, baseline: { digest: baselineDigest }, executionRecords: [],
|
|
1229
|
+
reviewRecords: [{ id: 'outline-event', obligationId: 'outline-confirmation', kind: 'outline-confirmation',
|
|
1230
|
+
provenance: 'validated pre-draft outline evidence', paths: [target], baseDigest: baselineDigest,
|
|
1231
|
+
artifactDigests: { [target]: digest }, outlineEvidence: evidence }],
|
|
1232
|
+
});
|
|
1233
|
+
assert.strictEqual(output.results[0].outcome, 'pass', JSON.stringify({ result: output.results[0], diagnostics: output.diagnostics }));
|
|
1234
|
+
assert.strictEqual(output.results[0].observation, 'observed');
|
|
1235
|
+
const incomplete = checkLeg({
|
|
1236
|
+
obligations: [{ id: 'outline-confirmation', capability: 'outline-confirmation', strength: 'MUST',
|
|
1237
|
+
applicability: 'applicable', scope: { paths: [target] } }],
|
|
1238
|
+
artifacts: { [target]: { digest } }, baseline: { digest: baselineDigest }, executionRecords: [], reviewRecords: [],
|
|
1239
|
+
});
|
|
1240
|
+
assert.strictEqual(incomplete.results[0].outcome, 'none');
|
|
1241
|
+
assert.strictEqual(incomplete.results[0].observation, 'unresolved', 'missing D remains incomplete');
|
|
1242
|
+
});
|
|
1243
|
+
}
|
|
1244
|
+
|
|
1172
1245
|
helper.finish();
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
3
|
const assert = require('assert');
|
|
4
|
+
const crypto = require('crypto');
|
|
4
5
|
const fs = require('fs');
|
|
5
6
|
const path = require('path');
|
|
6
7
|
const helper = require('./test-helper');
|
|
@@ -739,4 +740,64 @@ checkCase('325-3a C1 coverage: title-only rename of a REQ-citing test with the s
|
|
|
739
740
|
'a title-only rename does not trigger requirement-sync');
|
|
740
741
|
});
|
|
741
742
|
|
|
743
|
+
// Moved from 325-3b-s2a-core (#553 T2-D): regression pins and exported-signature controls on both source and packaged legs.
|
|
744
|
+
|
|
745
|
+
const REGRESSION_PINS = JSON.parse(fs.readFileSync(path.join(fixtureDir, 'regression-pins.json'), 'utf8'));
|
|
746
|
+
const REGRESSION_LEGS = [
|
|
747
|
+
{
|
|
748
|
+
name: 'source',
|
|
749
|
+
scripts: path.join(__dirname, '..', 'harness-everything', 'scripts')
|
|
750
|
+
},
|
|
751
|
+
{
|
|
752
|
+
name: 'packaged',
|
|
753
|
+
scripts: path.join(__dirname, '..', 'plugins', 'harness-everything', 'skills', 'harness-everything', 'scripts')
|
|
754
|
+
}
|
|
755
|
+
];
|
|
756
|
+
|
|
757
|
+
function stableJson(value) {
|
|
758
|
+
if (Array.isArray(value)) return `[${value.map(stableJson).join(',')}]`;
|
|
759
|
+
if (value && typeof value === 'object') {
|
|
760
|
+
return `{${Object.keys(value).sort().map(key => `${JSON.stringify(key)}:${stableJson(value[key])}`).join(',')}}`;
|
|
761
|
+
}
|
|
762
|
+
return JSON.stringify(value);
|
|
763
|
+
}
|
|
764
|
+
|
|
765
|
+
function sha256Hex(text) {
|
|
766
|
+
return crypto.createHash('sha256').update(text).digest('hex');
|
|
767
|
+
}
|
|
768
|
+
|
|
769
|
+
function loadPinnedVector(key) {
|
|
770
|
+
const vec = REGRESSION_PINS.vectors[key];
|
|
771
|
+
if (!vec) throw new Error(`unknown regression pin vector ${key}`);
|
|
772
|
+
if (vec.deriveCase) return loadCase(vec.deriveCase);
|
|
773
|
+
return {
|
|
774
|
+
base: { files: JSON.parse(JSON.stringify(vec.files.base)) },
|
|
775
|
+
candidate: { files: JSON.parse(JSON.stringify(vec.files.candidate)) }
|
|
776
|
+
};
|
|
777
|
+
}
|
|
778
|
+
|
|
779
|
+
for (const leg of REGRESSION_LEGS) {
|
|
780
|
+
for (const key of ['normative', 'nonnormative', 'code-only', 'nondocument']) {
|
|
781
|
+
const pin = REGRESSION_PINS.pins[key];
|
|
782
|
+
checkCase(`regression:derive-and-checker-pins-${key} [${leg.name}]`, () => {
|
|
783
|
+
const deriveMod = require(path.join(leg.scripts, 'doc-obligations.js'));
|
|
784
|
+
const checkerMod = require(path.join(leg.scripts, 'doc-evidence.js'));
|
|
785
|
+
const input = loadPinnedVector(key);
|
|
786
|
+
const facts = deriveMod.deriveDocFacts({ base: input.base, candidate: input.candidate, config: CONFIG });
|
|
787
|
+
const obligations = deriveMod.deriveDocObligations(facts.facts);
|
|
788
|
+
const checker = checkerMod.checkDocObligations({ obligations, artifacts: {}, baseline: {}, executionRecords: [], reviewRecords: [] });
|
|
789
|
+
assert.strictEqual(sha256Hex(stableJson(facts)), pin.deriveFactsSha256, 'deriveDocFacts output digest');
|
|
790
|
+
assert.strictEqual(sha256Hex(stableJson(obligations)), pin.deriveObligationsSha256, 'deriveDocObligations output digest');
|
|
791
|
+
assert.strictEqual(sha256Hex(stableJson(checker)), pin.checkerResultsSha256, 'checkDocObligations output digest');
|
|
792
|
+
});
|
|
793
|
+
}
|
|
794
|
+
|
|
795
|
+
checkCase(`regression:exported-signatures-unchanged [${leg.name}]`, () => {
|
|
796
|
+
const deriveMod = require(path.join(leg.scripts, 'doc-obligations.js'));
|
|
797
|
+
const checkerMod = require(path.join(leg.scripts, 'doc-evidence.js'));
|
|
798
|
+
assert.deepStrictEqual(Object.keys(deriveMod).sort(), ['deriveDocFacts', 'deriveDocObligations'], 'doc-obligations exports');
|
|
799
|
+
assert.deepStrictEqual(Object.keys(checkerMod).sort(), ['checkDocObligations'], 'doc-evidence exports');
|
|
800
|
+
});
|
|
801
|
+
}
|
|
802
|
+
|
|
742
803
|
helper.finish();
|