harness-everything 1.3.0 → 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.
Files changed (125) hide show
  1. package/.claude-plugin/marketplace.json +1 -1
  2. package/.claude-plugin/plugin.json +1 -1
  3. package/CHANGELOG.md +6 -0
  4. package/ci/archive/325-prep/README.md +9 -2
  5. package/ci/archive/325-prep/doc-reconciliation-red.js +34 -8
  6. package/ci/fixtures/553-t2a/body-edit/base/.agents/harness-everything/project-docs.json +11 -0
  7. package/ci/fixtures/553-t2a/body-edit/base/docs/a.md +6 -0
  8. package/ci/fixtures/553-t2a/body-edit/base/docs/b.md +1 -0
  9. package/ci/fixtures/553-t2a/body-edit/candidate/docs/a.md +6 -0
  10. package/ci/fixtures/553-t2c/derived-regenerate-must/base/docs/adr/EVID-001-verify-all-evidence.md +11 -0
  11. package/ci/fixtures/553-t2c/derived-regenerate-must/base/docs/governed-index.md +19 -0
  12. package/ci/fixtures/553-t2c/derived-regenerate-must/candidate/docs/adr/EVID-001-verify-all-evidence.md +11 -0
  13. package/ci/fixtures/553-t2c/derived-regenerate-must/candidate/docs/governed-index.md +19 -0
  14. package/ci/fixtures/553-t2c/derived-regenerate-must/config.json +17 -0
  15. package/ci/fixtures/doc-obligations/derive/regression-pins.json +153 -0
  16. package/ci/fixtures/state-persist-post-tool-use/harness.js +206 -0
  17. package/ci/fixtures/state-persist-post-tool-use/off-handoff-golden.json +16 -0
  18. package/ci/fixtures/state-persist-post-tool-use/payload-post-tool-use-success.json +13 -0
  19. package/ci/fixtures/stop/fail-session-writes.js +109 -0
  20. package/ci/fixtures/workflow-contract/cases.json +3355 -0
  21. package/ci/fixtures/workflow-contract/wiring-cases.json +560 -0
  22. package/ci/lib/doc-reconciliation-prep-fixtures.js +4 -9
  23. package/ci/mechanism-2an-workflow-replay.test.js +324 -0
  24. package/ci/mechanism-2ax-doc-lifecycle.test.js +132 -0
  25. package/ci/mechanism-325-3a-doc-evidence.test.js +73 -0
  26. package/ci/mechanism-325-3a-doc-obligations.test.js +61 -0
  27. package/ci/mechanism-325-3b-preparation.test.js +208 -49
  28. package/ci/mechanism-325-3b-s1-review.test.js +20 -828
  29. package/ci/mechanism-325-3b-s3-providers.test.js +59 -0
  30. package/ci/mechanism-325-f3-derived-views.test.js +140 -0
  31. package/ci/mechanism-341-opencode-lane.test.js +164 -284
  32. package/ci/mechanism-35-verification-contract.test.js +246 -0
  33. package/ci/mechanism-365-step-edit-accounting.test.js +5 -6
  34. package/ci/mechanism-383-doc-glob-line-terminators.test.js +0 -30
  35. package/ci/mechanism-397-opencode-observations.test.js +151 -18
  36. package/ci/mechanism-553-e1-unhook-credit.test.js +328 -0
  37. package/ci/mechanism-553-p2a-claude-hooks.test.js +98 -0
  38. package/ci/mechanism-553-p3-plan-start.test.js +212 -0
  39. package/ci/mechanism-553-state-persist-post-tool-use.test.js +307 -0
  40. package/ci/mechanism-553-stop.test.js +427 -0
  41. package/ci/mechanism-553-t2a-derive.test.js +110 -0
  42. package/ci/mechanism-553-t2c-derive.test.js +94 -0
  43. package/ci/mechanism-e1-derived-regenerate.test.js +45 -206
  44. package/ci/mechanism-outline-sanitizer.test.js +0 -8
  45. package/ci/mechanism-pr-a-conflict-check.test.js +38 -305
  46. package/ci/mechanism-prb-outline-review.test.js +101 -3283
  47. package/docs/adr/DOCS-006-reconciliation-pilot.md +4 -2
  48. package/docs/adr/DOCS-008-obligation-abstraction-bounded-consumer.md +3 -3
  49. package/docs/doc-workflow-reconciliation.md +17 -2
  50. package/docs/document-lifecycle.md +6 -2
  51. package/docs/platform-capabilities.md +35 -5
  52. package/hooks/hooks.json +0 -46
  53. package/hooks/scripts/lib/workflow-obligations.js +0 -55
  54. package/hooks/scripts/state-persist.js +7 -95
  55. package/hooks/scripts/workflow-disposition.js +0 -2
  56. package/hooks/scripts/workflow-stop-gate.js +17 -30
  57. package/opencode-plugin/index.mjs +6 -70
  58. package/opencode-plugin/plugin.json +1 -1
  59. package/package.json +1 -1
  60. package/plugins/harness-everything/.antigravity-plugin/plugin.json +1 -1
  61. package/plugins/harness-everything/.codex-plugin/plugin.json +1 -1
  62. package/plugins/harness-everything/hooks/scripts/lib/workflow-obligations.js +0 -55
  63. package/plugins/harness-everything/hooks/scripts/state-persist.js +7 -95
  64. package/plugins/harness-everything/hooks/scripts/workflow-disposition.js +0 -2
  65. package/plugins/harness-everything/hooks/scripts/workflow-stop-gate.js +17 -30
  66. package/plugins/harness-everything/plugin.json +1 -1
  67. package/sbom.cdx.json +7 -7
  68. package/ci/fixtures/doc-obligations/reconciliation-s1/cases.json +0 -6854
  69. package/ci/fixtures/doc-obligations/reconciliation-s1/fail-session-writes.js +0 -116
  70. package/ci/fixtures/doc-obligations/reconciliation-s2a/harness.js +0 -507
  71. package/ci/fixtures/doc-obligations/reconciliation-s2a/run13-workflow-requirements.json +0 -42
  72. package/ci/fixtures/doc-obligations/reconciliation-s2a/vectors.json +0 -617
  73. package/ci/fixtures/doc-obligations/reconciliation-s2b/capture/harness.js +0 -415
  74. package/ci/fixtures/doc-obligations/reconciliation-s2b/capture/payload-post-tool-use-success-minimal.json +0 -9
  75. package/ci/fixtures/doc-obligations/reconciliation-s2b/capture/payload-subagent-start.json +0 -7
  76. package/ci/fixtures/doc-obligations/reconciliation-s2b/capture/payload-subagent-stop-freetext-reject.json +0 -11
  77. package/ci/fixtures/doc-obligations/reconciliation-s2b/capture/payload-subagent-stop-reject.json +0 -11
  78. package/ci/fixtures/doc-obligations/reconciliation-s2b/capture/payload-subagent-stop.json +0 -11
  79. package/ci/fixtures/doc-obligations/reconciliation-s2b/capture/payload-task-result.json +0 -19
  80. package/ci/fixtures/doc-obligations/reconciliation-s2b/corpus/off-capture-only.json +0 -99
  81. package/ci/fixtures/doc-obligations/reconciliation-s2b/corpus/off-legacy.json +0 -67
  82. package/ci/fixtures/doc-obligations/reconciliation-s2b/corpus/on-concurrent-writers.json +0 -62
  83. package/ci/fixtures/doc-obligations/reconciliation-s2b/corpus/on-lookalikes-runtime-mutations.json +0 -67
  84. package/ci/fixtures/doc-obligations/reconciliation-s2b/corpus/on-malformed.json +0 -85
  85. package/ci/fixtures/doc-obligations/reconciliation-s2b/corpus/on-normal-session.json +0 -74
  86. package/ci/fixtures/doc-obligations/reconciliation-s2b/corpus/on-runtime-drift-later-npm-test.json +0 -58
  87. package/ci/fixtures/doc-obligations/reconciliation-s2b/corpus/on-valid-direct-quoted-review.json +0 -85
  88. package/ci/fixtures/doc-obligations/reconciliation-s2b/f4/cases.json +0 -2267
  89. package/ci/fixtures/doc-obligations/reconciliation-s2b/wiring/cases.json +0 -1110
  90. package/ci/lib/doc-reconciliation-file-spy.js +0 -23
  91. package/ci/lib/doc-reconciliation-qualification-preload.js +0 -37
  92. package/ci/lib/doc-reconciliation-replay.js +0 -104
  93. package/ci/lib/doc-reconciliation-staged-tree.js +0 -102
  94. package/ci/mechanism-325-3b-h1-qualification.test.js +0 -206
  95. package/ci/mechanism-325-3b-s1.test.js +0 -188
  96. package/ci/mechanism-325-3b-s2a-core.test.js +0 -840
  97. package/ci/mechanism-325-3b-s2a-producer.test.js +0 -564
  98. package/ci/mechanism-325-3b-s2b-capture.test.js +0 -566
  99. package/ci/mechanism-325-3b-s2b-wiring.test.js +0 -679
  100. package/ci/mechanism-325-f4-invariants.test.js +0 -606
  101. package/ci/mechanism-325-f4-projections.test.js +0 -392
  102. package/ci/mechanism-325-f4-qualification.test.js +0 -228
  103. package/ci/mechanism-325-f4-trust-boundary.test.js +0 -880
  104. package/ci/mechanism-e1-dependency-artifact-scope.test.js +0 -657
  105. package/hooks/scripts/lib/doc-reconciliation-capture.sanitized.jsonl +0 -26
  106. package/hooks/scripts/lib/doc-reconciliation-core.js +0 -336
  107. package/hooks/scripts/lib/doc-reconciliation-events.js +0 -292
  108. package/hooks/scripts/lib/doc-reconciliation-outline-capture.sanitized.jsonl +0 -24
  109. package/hooks/scripts/lib/doc-reconciliation-pilot.js +0 -482
  110. package/hooks/scripts/lib/doc-reconciliation-producer.js +0 -468
  111. package/hooks/scripts/lib/doc-reconciliation-provider.js +0 -3304
  112. package/hooks/scripts/lib/doc-reconciliation-qualification.json +0 -54
  113. package/hooks/scripts/w6-state-operations.js +0 -239
  114. package/plugins/harness-everything/hooks/scripts/lib/doc-reconciliation-capture.sanitized.jsonl +0 -26
  115. package/plugins/harness-everything/hooks/scripts/lib/doc-reconciliation-core.js +0 -336
  116. package/plugins/harness-everything/hooks/scripts/lib/doc-reconciliation-events.js +0 -292
  117. package/plugins/harness-everything/hooks/scripts/lib/doc-reconciliation-outline-capture.sanitized.jsonl +0 -24
  118. package/plugins/harness-everything/hooks/scripts/lib/doc-reconciliation-pilot.js +0 -482
  119. package/plugins/harness-everything/hooks/scripts/lib/doc-reconciliation-producer.js +0 -468
  120. package/plugins/harness-everything/hooks/scripts/lib/doc-reconciliation-provider.js +0 -3304
  121. package/plugins/harness-everything/hooks/scripts/lib/doc-reconciliation-qualification.json +0 -54
  122. package/plugins/harness-everything/hooks/scripts/w6-state-operations.js +0 -239
  123. package/scripts/system-one-eval-laya.js +0 -112
  124. /package/ci/fixtures/{doc-obligations/reconciliation-s2b/capture → state-persist-post-tool-use}/payload-post-tool-use-failure.json +0 -0
  125. /package/ci/fixtures/{doc-obligations/reconciliation-s2b/wiring → workflow-contract}/legacy-off-golden.json +0 -0
@@ -1,188 +0,0 @@
1
- #!/usr/bin/env node
2
- 'use strict';
3
-
4
- // #325 Phase 3b S1 strict suite: switch, trusted scope and fail-closed no-credit gate (RED).
5
- //
6
- // Every assertion in reconciliation-s1/cases.json is a strict S1 contract assertion, run against the real CLI, hook and
7
- // Stop entry points on both legs (source and packaged) and both modes (OFF and ON with the switch set to exactly "1").
8
- // Each assertion is tagged s1Kind:
9
- // retired one of the 26 S1 retire IDs in docs/doc-workflow-reconciliation.md; expected to FAIL on the current base
10
- // control behaviour that must PASS now and after GREEN (P06, P07u, P02d, OFF legacy, Stop exit 0, switch values)
11
- // additional a named S1 contract case beyond the retire table (governed scope, direct aggregate, OFF-seeded, ON->OFF->ON)
12
- // This suite grants no pilot credit and never consults the prep registry: a FAIL here is a real gap, not a qualified one.
13
- // Infrastructure faults (spawn error, deadline, output bound, exit outside the declared policy, malformed output) are
14
- // reported as INFRA and are distinct from assertion FAIL. Exit 1 means at least one assertion FAILED; exit 2 means
15
- // infrastructure. The suite cannot pass until GREEN lands; that is the RED contract.
16
-
17
- const path = require('path');
18
- const fx = require('./lib/doc-reconciliation-prep-fixtures');
19
-
20
- const CORPUS_FILE = path.join(__dirname, 'fixtures', 'doc-obligations', 'reconciliation-s1', 'cases.json');
21
- const corpus = fx.readCaseCorpus(CORPUS_FILE);
22
- const LEGS = ['source', 'packaged'];
23
- const MODES = ['off', 'on'];
24
- const ALLOWED_OPERATORS = new Set(['equals', 'notEquals', 'includes', 'absent']);
25
- const S1_KINDS = new Set(['retired', 'control', 'additional']);
26
- const REQUIRED_CASE_FIELDS = ['id', 'family', 'description', 'topology', 'requirements', 'input', 'actions', 'expectations'];
27
-
28
- // The doc's "S1 retire" table: 26 IDs × 2 legs, by case. Any drift between this list and the corpus is a failure.
29
- const RETIRED_BY_CASE = {
30
- P01: ['verify-exit-refused', 'verify-obligation-pending', 'stop-unsatisfied', 'stop-reports-verification'],
31
- P04: ['direct-execute-refused', 'direct-verify-refused', 'verify-obligation-pending'],
32
- P02a: ['verify-pass-exit', 'stop-state', 'stop-reports'],
33
- P02b: ['verify-pass-exit', 'stop-state', 'stop-reports'],
34
- P02c: ['verify-pass-exit', 'stop-state', 'stop-reports'],
35
- P02g: ['verify-pass-exit', 'stop-state', 'stop-reports'],
36
- P02f: ['verify-pass-exit', 'stop-state', 'stop-reports'],
37
- P03: ['verify-pass-exit'],
38
- 'P07-fable-staged': ['pilot-status-unavailable'],
39
- 'P07-fable-parallel': ['pilot-status-unavailable'],
40
- 'P07-fable-multi-agent-workspace': ['pilot-status-unavailable']
41
- };
42
- const RETIRED_COUNT = Object.values(RETIRED_BY_CASE).reduce((total, ids) => total + ids.length, 0);
43
-
44
- let passed = 0;
45
- let failed = 0;
46
- let infra = 0;
47
- const failures = [];
48
- const infrastructure = [];
49
-
50
- const show = value => (value === undefined ? 'undefined' : JSON.stringify(value));
51
-
52
- // The reason a FAIL names, in the terms the doc uses: "exit 0 where 2 desired", "state satisfied where running desired".
53
- function reasonFor(assertion, actual) {
54
- const last = assertion.path[assertion.path.length - 1];
55
- const label = ({ exitCode: 'exit', state: 'state', unresolved: 'unresolved', pilotStatus: 'pilot status',
56
- pilotReportOrigin: 'pilot origin', pilot: 'pilot' })[last]
57
- || (assertion.path.includes('obligations') && last === 'status' ? 'obligation status' : null)
58
- || (assertion.path.includes('requirements') && last === 'status' ? 'step status' : null)
59
- || assertion.path.slice(-2).join('.');
60
- const absent = actual && typeof actual === 'object' && actual.kind === 'absent';
61
- if (assertion.operator === 'includes') {
62
- return absent ? `${label} absent where ${show(assertion.expected)} desired`
63
- : `${label} ${show(actual)} lacks ${show(assertion.expected)}`;
64
- }
65
- if (assertion.operator === 'notEquals') return `${label} ${show(actual)} where a value other than ${show(assertion.expected)} desired`;
66
- if (assertion.operator === 'absent') return `${label} present where absent desired`;
67
- if (absent) return `${label} absent where ${show(assertion.expected)} desired`;
68
- return `${label} ${show(actual)} where ${show(assertion.expected)} desired`;
69
- }
70
-
71
- function record(status, id, detail) {
72
- if (status === 'PASS') passed += 1;
73
- else if (status === 'FAIL') { failed += 1; failures.push(id); }
74
- else { infra += 1; infrastructure.push(id); }
75
- console.log(` ${status} ${id}${detail ? ` — ${detail}` : ''}`);
76
- }
77
-
78
- // Parity between the two legs for one replay, mirroring the prep runner's comparable() view.
79
- function comparable(root) {
80
- const entries = Object.entries(root.actions).map(([id, action]) => [id, {
81
- exitCode: action.exitCode,
82
- signal: action.signal,
83
- stdout: action.json === null ? action.stdout : null,
84
- json: action.json,
85
- stderr: action.stderr,
86
- state: action.state
87
- }]);
88
- return fx.normalize(Object.fromEntries([...entries, ['$final', root.state]]));
89
- }
90
-
91
- console.log('=== #325 3b S1: strict switch, trusted scope and fail-closed no-credit suite (RED) ===');
92
-
93
- // ---- Inventory: the corpus is well formed and marks exactly the doc's retire table -----------------------------
94
- {
95
- const problems = [];
96
- const caseIds = corpus.cases.map(item => item.id);
97
- if (new Set(caseIds).size !== caseIds.length) problems.push('case ids are not unique');
98
- for (const item of corpus.cases) {
99
- for (const field of REQUIRED_CASE_FIELDS) {
100
- if (item[field] === undefined) problems.push(`${item.id} lacks ${field}`);
101
- }
102
- const actionIds = item.actions.map(action => action.id);
103
- if (new Set(actionIds).size !== actionIds.length) problems.push(`${item.id} action ids are not unique`);
104
- for (const action of item.actions) {
105
- if (!fx.ALL_OPS.has(action.op)) problems.push(`${item.id}.${action.id} op ${action.op} is not allowed`);
106
- for (const mode of MODES) {
107
- try { fx.exitPolicy(action, mode); } catch (error) { problems.push(error.message); }
108
- }
109
- }
110
- for (const mode of MODES) {
111
- const ids = item.expectations[mode].map(assertion => assertion.id);
112
- if (new Set(ids).size !== ids.length) problems.push(`${item.id}.${mode} assertion ids are not unique`);
113
- for (const assertion of item.expectations[mode]) {
114
- if (!ALLOWED_OPERATORS.has(assertion.operator)) problems.push(`${item.id}.${assertion.id} operator ${assertion.operator}`);
115
- if (!Array.isArray(assertion.path) || assertion.path.length === 0) problems.push(`${item.id}.${assertion.id} has no path`);
116
- if (!S1_KINDS.has(assertion.s1Kind)) problems.push(`${item.id}.${assertion.id} lacks a valid s1Kind`);
117
- }
118
- }
119
- }
120
- const retired = [];
121
- for (const item of corpus.cases) {
122
- for (const assertion of item.expectations.on) {
123
- if (assertion.s1Kind === 'retired') retired.push(`${item.id}:${assertion.id}`);
124
- }
125
- }
126
- const expected = Object.entries(RETIRED_BY_CASE).flatMap(([caseId, ids]) => ids.map(id => `${caseId}:${id}`));
127
- const missing = expected.filter(entry => !retired.includes(entry));
128
- const extra = retired.filter(entry => !expected.includes(entry));
129
- if (missing.length || extra.length) problems.push(`retired set differs from the doc table: missing ${show(missing)} extra ${show(extra)}`);
130
- if (expected.length !== RETIRED_COUNT || RETIRED_COUNT !== 26) problems.push(`the doc table names ${RETIRED_COUNT} IDs, not 26`);
131
- if (problems.length) record('FAIL', 'inventory: corpus is well formed and marks the 26 S1 retire IDs', problems.join('; '));
132
- else record('PASS', `inventory: corpus is well formed and marks the ${RETIRED_COUNT} S1 retire IDs`);
133
- }
134
-
135
- // ---- Replays: every case, both legs, both modes ----------------------------------------------------------------
136
- for (const item of corpus.cases) {
137
- for (const mode of MODES) {
138
- const roots = {};
139
- for (const leg of LEGS) {
140
- let root;
141
- try {
142
- root = fx.scrubReplay(fx.replayCase(item, leg, mode === 'on' ? { pilot: '1' } : undefined));
143
- } catch (error) {
144
- infrastructure.push(`${item.id}.${mode} [${leg}]`);
145
- infra += 1;
146
- console.log(` INFRA ${item.id}.${mode} [${leg}] — replay failed: ${error.message.split('\n')[0]}`);
147
- continue;
148
- }
149
- roots[leg] = root;
150
- const faults = fx.infrastructureFaults(item, root, mode);
151
- if (faults.length) {
152
- infra += 1;
153
- infrastructure.push(`${item.id}.${mode} [${leg}]`);
154
- for (const fault of faults) console.log(` INFRA ${item.id}.${mode} [${leg}] ${fault.actionId}: ${fault.message}`);
155
- continue;
156
- }
157
- for (const assertion of item.expectations[mode]) {
158
- const result = fx.evaluateAssertion(root, assertion);
159
- const id = `${item.id}.${mode}.${assertion.id} [${leg}]`;
160
- const tag = `(${assertion.s1Kind})`;
161
- if (result.pass) record('PASS', id, tag);
162
- else record('FAIL', id, `${tag} ${reasonFor(assertion, result.actual)}`);
163
- }
164
- }
165
- if (roots.source && roots.packaged && !fx.infrastructureFaults(item, roots.source, mode).length
166
- && !fx.infrastructureFaults(item, roots.packaged, mode).length) {
167
- const same = JSON.stringify(comparable(roots.source)) === JSON.stringify(comparable(roots.packaged));
168
- const id = `${item.id}.${mode}.parity [source=packaged]`;
169
- if (same) record('PASS', id, '(control)');
170
- else record('FAIL', id, '(control) source and packaged legs disagree');
171
- }
172
- }
173
- }
174
-
175
- // ---- Summary -----------------------------------------------------------------------------------------------------
176
- console.log(`\nS1 strict summary: ${passed} PASS, ${failed} FAIL, ${infra} INFRA across ${corpus.cases.length} cases (pilotCredit: false)`);
177
- if (failures.length) console.log(`FAILED assertions (${failures.length}):\n ${failures.join('\n ')}`);
178
- if (infrastructure.length) console.log(`INFRASTRUCTURE (${infrastructure.length}):\n ${infrastructure.join('\n ')}`);
179
-
180
- if (infra > 0) {
181
- console.error('S1 suite: infrastructure faults present; these are not assertion results.');
182
- process.exitCode = 2;
183
- } else if (failed > 0) {
184
- console.error('S1 suite: assertion FAIL present (expected on the RED base; GREEN must clear every FAIL).');
185
- process.exitCode = 1;
186
- } else {
187
- console.log('S1 suite: all assertions PASS.');
188
- }