harness-everything 0.12.3 → 0.14.0

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 (53) hide show
  1. package/.claude-plugin/marketplace.json +1 -1
  2. package/.claude-plugin/plugin.json +1 -1
  3. package/.github/workflows/ci.yml +2 -0
  4. package/CHANGELOG.md +30 -0
  5. package/ci/mechanism-2aj-waza-reference-adapter.test.js +223 -0
  6. package/ci/mechanism-2ak-contract-probe-adapter.test.js +207 -0
  7. package/ci/openai-plugin-package.test.js +10 -0
  8. package/contract-integrity/ADAPTERS.md +37 -0
  9. package/contract-integrity/fixtures/node-probe-project/package.json +8 -0
  10. package/contract-integrity/fixtures/node-probe-project/probe-plan.json +27 -0
  11. package/contract-integrity/fixtures/node-probe-project/src/limit.js +8 -0
  12. package/contract-integrity/fixtures/node-probe-project/test/contract.test.js +14 -0
  13. package/contract-integrity/scripts/node-probe-adapter.js +390 -0
  14. package/docs/repository-contract.md +1 -1
  15. package/evals/multi-agent-workspace/tasks/positive-trigger.yaml +1 -1
  16. package/fable-mode/SKILL.md +1 -1
  17. package/fable-mode/execution-guardrails/SKILL.md +1 -1
  18. package/fable-mode/fable-haiku/SKILL.md +1 -1
  19. package/fable-mode/fable-opus/SKILL.md +1 -1
  20. package/fable-mode/fable-sonnet/SKILL.md +1 -1
  21. package/fable-mode/references/model-matrix.md +2 -0
  22. package/harness-everything/SKILL.md +1 -1
  23. package/harness-everything/references/triage-and-tiers.md +2 -0
  24. package/multi-agent-workspace/SKILL.md +2 -2
  25. package/multi-agent-workspace/references/orchestration.md +2 -0
  26. package/opencode-plugin/plugin.json +1 -1
  27. package/package.json +4 -2
  28. package/plugins/harness-everything/.codex-plugin/plugin.json +1 -1
  29. package/plugins/harness-everything/contract-integrity/ADAPTERS.md +37 -0
  30. package/plugins/harness-everything/contract-integrity/scripts/node-probe-adapter.js +390 -0
  31. package/plugins/harness-everything/plugin.json +1 -1
  32. package/plugins/harness-everything/skills/fable-mode/SKILL.md +1 -1
  33. package/plugins/harness-everything/skills/fable-mode/execution-guardrails/SKILL.md +1 -1
  34. package/plugins/harness-everything/skills/fable-mode/fable-haiku/SKILL.md +1 -1
  35. package/plugins/harness-everything/skills/fable-mode/fable-opus/SKILL.md +1 -1
  36. package/plugins/harness-everything/skills/fable-mode/fable-sonnet/SKILL.md +1 -1
  37. package/plugins/harness-everything/skills/fable-mode/references/model-matrix.md +2 -0
  38. package/plugins/harness-everything/skills/harness-everything/SKILL.md +1 -1
  39. package/plugins/harness-everything/skills/harness-everything/references/triage-and-tiers.md +2 -0
  40. package/plugins/harness-everything/skills/multi-agent-workspace/SKILL.md +2 -2
  41. package/plugins/harness-everything/skills/multi-agent-workspace/references/orchestration.md +2 -0
  42. package/plugins/harness-everything/skills/skill-creator/SKILL.md +1 -1
  43. package/plugins/harness-everything/skills/skill-creator/references/quality-checklist.md +2 -0
  44. package/plugins/harness-everything/skills/tdd/SKILL.md +1 -1
  45. package/plugins/harness-everything/skills/tdd/references/core-discipline.md +1 -1
  46. package/plugins/harness-everything/skills/tdd/references/quality-model.md +2 -2
  47. package/scripts/sync-openai-plugin.js +4 -1
  48. package/scripts/waza-harness-check.js +361 -0
  49. package/skill-creator/SKILL.md +1 -1
  50. package/skill-creator/references/quality-checklist.md +2 -0
  51. package/tdd/SKILL.md +1 -1
  52. package/tdd/references/core-discipline.md +1 -1
  53. package/tdd/references/quality-model.md +2 -2
@@ -10,7 +10,7 @@
10
10
  "name": "harness-everything",
11
11
  "source": "./",
12
12
  "description": "Harness OS: an orchestrated agent operating system — tier routing, circuit breaker guardrails, verification gates, WAL session memory, and self-evolving workspace rules.",
13
- "version": "0.12.3",
13
+ "version": "0.14.0",
14
14
  "author": {
15
15
  "name": "Miya Daniel"
16
16
  },
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "harness-everything",
3
3
  "description": "Harness OS: an orchestrated agent operating system — tier routing, circuit breaker guardrails, verification gates, WAL session memory, and self-evolving workspace rules.",
4
- "version": "0.12.3",
4
+ "version": "0.14.0",
5
5
  "author": {
6
6
  "name": "Miya Daniel"
7
7
  },
@@ -82,6 +82,8 @@ jobs:
82
82
  chmod +x "$HOME/bin/waza"
83
83
  echo "$HOME/bin" >> "$GITHUB_PATH"
84
84
  "$HOME/bin/waza" --version
85
+ - name: Run Harness Waza adapter against canonical skills
86
+ run: npm run waza:check
85
87
  - name: Check every canonical SKILL.md passes waza readiness gates
86
88
  run: |
87
89
  fail=0
package/CHANGELOG.md CHANGED
@@ -2,6 +2,36 @@
2
2
 
3
3
  All notable changes to this project are documented in this file.
4
4
 
5
+ ## [0.14.0](https://github.com/dyphn1/Harness-everything/compare/v0.13.0...v0.14.0) (2026-09-20)
6
+
7
+ ### Features
8
+
9
+ * **contract:** add node npm probe adapter ([02f4044](https://github.com/dyphn1/Harness-everything/commit/02f4044c82a6cb082d4b8e4fe810071afe064c21))
10
+ * **contract:** add packaged node probe adapter ([de72904](https://github.com/dyphn1/Harness-everything/commit/de7290434346cdc358ea119845c72ddca3ea0090))
11
+ * **contract:** package node probe adapter runtime ([783dc8f](https://github.com/dyphn1/Harness-everything/commit/783dc8f891a3244461f3dfe154542bad15125f15))
12
+
13
+ ### Bug Fixes
14
+
15
+ * **contract:** close linked-workspace isolation gap ([574ea2f](https://github.com/dyphn1/Harness-everything/commit/574ea2f299ae02aa93785cca7aa5b4a829e9f961))
16
+ * **contract:** launch npm probes cross-platform ([b39b2c0](https://github.com/dyphn1/Harness-everything/commit/b39b2c09a223c64d3665d383852a6313fff888fc))
17
+ * **contract:** launch npm probes cross-platform ([723bae1](https://github.com/dyphn1/Harness-everything/commit/723bae19ac4a05bfefe44ad0d61bd5dfb8b0ba50))
18
+ * **contract:** reject symlink probe escapes ([bf577a5](https://github.com/dyphn1/Harness-everything/commit/bf577a5b58dec2a4779709402146073f0fd0ce29))
19
+ * **contract:** reject symlink probe escapes ([5e3c569](https://github.com/dyphn1/Harness-everything/commit/5e3c569b1b7b883490e40fd66a64385f2d24d717))
20
+
21
+ ## [0.13.0](https://github.com/dyphn1/Harness-everything/compare/v0.12.3...v0.13.0) (2026-09-19)
22
+
23
+ ### Features
24
+
25
+ * **waza:** expose non-link readiness failures ([f9c7d24](https://github.com/dyphn1/Harness-everything/commit/f9c7d242eece2af76fd68a6686eaa9521dcce443))
26
+
27
+ ### Bug Fixes
28
+
29
+ * **waza:** add Harness reference adapter ([5223690](https://github.com/dyphn1/Harness-everything/commit/52236905be8a3660b89bf43396ea3d7bca984126))
30
+ * **waza:** align reference adapter with main ([87b634d](https://github.com/dyphn1/Harness-everything/commit/87b634df1d5d7de57b1c5ca45e8505423764e240))
31
+ * **waza:** normalize template and repo-scope links ([25558ca](https://github.com/dyphn1/Harness-everything/commit/25558caaa39b8bafb4a825c1299ff746ffbae91b))
32
+ * **waza:** preserve Harness placeholder delimiters ([f697ae8](https://github.com/dyphn1/Harness-everything/commit/f697ae83b6de54718b2e969041adfaa20b5e8efc))
33
+ * **waza:** scope checks to canonical skills ([de7b78b](https://github.com/dyphn1/Harness-everything/commit/de7b78b1702b412466337a1ea84ec524cf864e60))
34
+
5
35
  ## [0.12.3](https://github.com/dyphn1/Harness-everything/compare/v0.12.2...v0.12.3) (2026-09-19)
6
36
 
7
37
  ### Bug Fixes
@@ -0,0 +1,223 @@
1
+ #!/usr/bin/env node
2
+ 'use strict';
3
+
4
+ const assert = require('assert');
5
+ const fs = require('fs');
6
+ const path = require('path');
7
+ const ROOT = path.resolve(__dirname, '..');
8
+ const { discoverSkills, extractCandidates } = require('./reference-check');
9
+ const {
10
+ harnessReachableReferenceFiles,
11
+ classifyReportedLink,
12
+ normalizeSkillReport,
13
+ normalizeReport,
14
+ runCanonicalWazaChecks,
15
+ } = require('../scripts/waza-harness-check');
16
+
17
+ let passed = 0;
18
+ function check(value, message) {
19
+ assert.ok(value, message);
20
+ passed++;
21
+ console.log('PASS ' + message);
22
+ }
23
+
24
+ const skills = discoverSkills(ROOT);
25
+ check(skills.length >= 20, 'discovers the canonical Harness skill set');
26
+
27
+ const invoked = [];
28
+ const fakeSpawn = (command, args, options) => {
29
+ invoked.push({ command, args, cwd: options.cwd });
30
+ const skillPath = args[1];
31
+ const name = path.basename(skillPath);
32
+ return {
33
+ status: 0,
34
+ stdout: JSON.stringify({
35
+ timestamp: new Date(0).toISOString(),
36
+ skills: [{
37
+ name,
38
+ path: path.join(skillPath, 'SKILL.md'),
39
+ ready: true,
40
+ compliance: { level: 'High' },
41
+ tokenBudget: { exceeded: false },
42
+ specCompliance: [],
43
+ links: { passed: true },
44
+ }],
45
+ }),
46
+ stderr: '',
47
+ };
48
+ };
49
+ const scoped = runCanonicalWazaChecks(ROOT, 'waza', fakeSpawn);
50
+ check(scoped.skills.length === skills.length && invoked.length === skills.length,
51
+ 'adapter invokes Waza exactly once per canonical top-level skill');
52
+ check(invoked.every((call, index) =>
53
+ call.command === 'waza' &&
54
+ call.args[0] === 'check' &&
55
+ call.args[1] === path.join(ROOT, skills[index]) &&
56
+ call.args[2] === '--format' &&
57
+ call.args[3] === 'json' &&
58
+ call.cwd === ROOT),
59
+ 'Waza receives explicit canonical skill paths instead of recursive workspace discovery');
60
+
61
+ let skillsWithPlaceholderReferences = 0;
62
+ let totalResolved = 0;
63
+ for (const skill of skills) {
64
+ const skillFile = path.join(ROOT, skill, 'SKILL.md');
65
+ const text = fs.readFileSync(skillFile, 'utf8');
66
+ const directReferenceTargets = extractCandidates(text)
67
+ .filter(value => /^<this-skill-dir>\/references\//.test(value))
68
+ .map(value => value.replace(/^<this-skill-dir>\//, ''));
69
+ if (!directReferenceTargets.length) continue;
70
+
71
+ skillsWithPlaceholderReferences++;
72
+ const reachable = harnessReachableReferenceFiles(ROOT, skill);
73
+ for (const target of directReferenceTargets) {
74
+ check(reachable.has(target), skill + ' placeholder reference is reachable: ' + target);
75
+ }
76
+
77
+ const simulated = {
78
+ name: skill,
79
+ path: path.join(ROOT, skill),
80
+ ready: false,
81
+ compliance: { level: 'High' },
82
+ tokenBudget: { exceeded: false },
83
+ specCompliance: [{ name: 'spec-frontmatter', passed: true }],
84
+ schema: { valid: true },
85
+ links: {
86
+ passed: false,
87
+ orphanedFiles: [...new Set(directReferenceTargets)],
88
+ },
89
+ };
90
+ const normalized = normalizeSkillReport(ROOT, simulated);
91
+ check(normalized.harnessCompatibility.remainingOrphanedFiles.length === 0,
92
+ skill + ' removes Waza orphan advisories for Harness-reachable references');
93
+ check(normalized.harnessCompatibility.resolvedPlaceholderOrphans.length === new Set(directReferenceTargets).size,
94
+ skill + ' reports the suppressed advisories explicitly');
95
+ check(normalized.harnessCompatibility.harnessReady === true,
96
+ skill + ' recomputes readiness without false local-orphan failures');
97
+ totalResolved += normalized.harnessCompatibility.resolvedPlaceholderOrphans.length;
98
+ }
99
+
100
+ check(skillsWithPlaceholderReferences > 0, 'at least one canonical skill uses the Harness placeholder reference contract');
101
+ check(totalResolved > 0, 'adapter resolves canonical placeholder-orphan advisories');
102
+
103
+ const nestedReferenceContract = {
104
+ 'fable-mode': ['references/execution-phases.md'],
105
+ 'harness-everything': ['references/router-workflow-plan.md', 'references/skill-registry.md'],
106
+ 'multi-agent-workspace': ['references/agency-agents.md'],
107
+ 'skill-creator': [
108
+ 'references/authoring-workflow.md',
109
+ 'references/testing-workflow.md',
110
+ 'references/quality-principles.md',
111
+ 'references/dynamic-generation-contract.md',
112
+ ],
113
+ tdd: ['references/quality-model.md', 'references/unit-testing.md', 'references/integration-testing.md'],
114
+ };
115
+ for (const [skill, expected] of Object.entries(nestedReferenceContract)) {
116
+ const reachable = harnessReachableReferenceFiles(ROOT, skill);
117
+ for (const reference of expected) {
118
+ check(reachable.has(reference), skill + ' nested reference remains reachable: ' + reference);
119
+ }
120
+ const normalized = normalizeSkillReport(ROOT, {
121
+ name: skill,
122
+ path: path.join(ROOT, skill),
123
+ ready: false,
124
+ compliance: { level: 'High' },
125
+ tokenBudget: { exceeded: false },
126
+ specCompliance: [],
127
+ links: { passed: false, orphanedFiles: expected },
128
+ });
129
+ check(normalized.harnessCompatibility.remainingOrphanedFiles.length === 0,
130
+ skill + ' nested reference advisories are resolved through the reachable reference graph');
131
+ }
132
+
133
+ const fableContract = classifyReportedLink(ROOT, 'fable-mode', {
134
+ source: 'SKILL.md',
135
+ target: '<skills-repo-root>/harness-everything/scripts/verify-gate.js',
136
+ reason: 'link escapes skill directory',
137
+ });
138
+ check(fableContract.category === 'resolved-contract',
139
+ '<skills-repo-root> existing target is a resolved Harness contract link');
140
+
141
+ const genericTemplate = classifyReportedLink(ROOT, 'repo-docs', {
142
+ source: 'SKILL.md',
143
+ target: '<workspace>/docs/generated.md',
144
+ reason: 'target does not exist',
145
+ });
146
+ check(genericTemplate.category === 'template',
147
+ 'generic runtime placeholder is classified as a template advisory');
148
+
149
+ const badPlaceholder = classifyReportedLink(ROOT, 'repo-docs', {
150
+ source: 'SKILL.md',
151
+ target: '<this-folder>/references/missing.md',
152
+ reason: 'target does not exist',
153
+ });
154
+ check(badPlaceholder.category === 'local',
155
+ 'unknown placeholder remains a real local-link problem');
156
+
157
+ const repoScopeLink = classifyReportedLink(ROOT, 'multi-agent-workspace', {
158
+ source: 'workflows/01-init.md',
159
+ target: '../../README.md#supported-ai-ides--tools',
160
+ reason: 'link escapes skill directory',
161
+ });
162
+ check(repoScopeLink.category === 'resolved-contract' && repoScopeLink.issue.resolved === 'README.md',
163
+ 'existing repo-scope relative link is resolved by the Harness repository contract');
164
+
165
+ const missingRepoScopeLink = classifyReportedLink(ROOT, 'multi-agent-workspace', {
166
+ source: 'workflows/01-init.md',
167
+ target: '../../definitely-missing.md',
168
+ reason: 'link escapes skill directory',
169
+ });
170
+ check(missingRepoScopeLink.category === 'local',
171
+ 'missing repo-scope relative link remains a hard local-link problem');
172
+
173
+ const templateLink = classifyReportedLink(ROOT, 'repo-docs', {
174
+ source: 'templates/multi-skills-readme-template.md',
175
+ target: './skills/category/{skill-name}/SKILL.md',
176
+ reason: 'target does not exist',
177
+ });
178
+ check(templateLink.category === 'template',
179
+ 'links inside generated-document templates remain visible template advisories');
180
+
181
+ const synthetic = normalizeReport(ROOT, {
182
+ timestamp: new Date(0).toISOString(),
183
+ skills: [{
184
+ name: 'harness-everything',
185
+ path: path.join(ROOT, 'harness-everything'),
186
+ ready: false,
187
+ compliance: { level: 'High' },
188
+ tokenBudget: { exceeded: false },
189
+ specCompliance: [{ name: 'spec-frontmatter', passed: true }],
190
+ links: {
191
+ passed: false,
192
+ orphanedFiles: ['references/triage-and-tiers.md'],
193
+ deadURLs: [{ source: 'SKILL.md', target: 'https://example.invalid', reason: 'DNS lookup failed' }],
194
+ brokenLinks: [{ source: 'SKILL.md', target: '<workspace>/generated.md', reason: 'target does not exist' }],
195
+ },
196
+ }],
197
+ });
198
+ const compatibility = synthetic.skills[0].harnessCompatibility;
199
+ check(compatibility.localLinksPassed === true,
200
+ 'network and generic-template findings do not masquerade as broken local links');
201
+ check(compatibility.networkAdvisories.length === 1 && compatibility.templateAdvisories.length === 1,
202
+ 'network and template findings are retained in separate advisory categories');
203
+ check(compatibility.harnessReady === true,
204
+ 'normalized readiness remains green when only false-orphan/network/template advisories remain');
205
+
206
+ const nonLinkFailure = normalizeSkillReport(ROOT, {
207
+ name: 'repo-docs',
208
+ path: path.join(ROOT, 'repo-docs'),
209
+ ready: false,
210
+ compliance: { level: 'Medium' },
211
+ tokenBudget: { exceeded: true },
212
+ specCompliance: [{ name: 'frontmatter', passed: false }],
213
+ schema: { valid: false },
214
+ links: { passed: true },
215
+ });
216
+ check(nonLinkFailure.harnessCompatibility.harnessReady === false &&
217
+ nonLinkFailure.harnessCompatibility.nonLinkFailures.includes('compliance:Medium') &&
218
+ nonLinkFailure.harnessCompatibility.nonLinkFailures.includes('token-budget-exceeded') &&
219
+ nonLinkFailure.harnessCompatibility.nonLinkFailures.includes('spec:frontmatter') &&
220
+ nonLinkFailure.harnessCompatibility.nonLinkFailures.includes('schema-invalid'),
221
+ 'non-link readiness failures remain explicit machine-readable blockers');
222
+
223
+ console.log('PASS: Waza/Harness reference adapter (' + passed + ' assertions across ' + skills.length + ' skills)');
@@ -0,0 +1,207 @@
1
+ #!/usr/bin/env node
2
+ 'use strict';
3
+
4
+ const assert = require('assert');
5
+ const fs = require('fs');
6
+ const os = require('os');
7
+ const path = require('path');
8
+ const { spawnSync } = require('child_process');
9
+
10
+ const ROOT = path.resolve(__dirname, '..');
11
+ const FIXTURE = path.join(ROOT, 'contract-integrity', 'fixtures', 'node-probe-project');
12
+ const ADAPTER = path.join(ROOT, 'contract-integrity', 'scripts', 'node-probe-adapter.js');
13
+ const { applyProbe, executePlan, validatePlan } = require(ADAPTER);
14
+ const { evaluateTrace } = require(path.join(ROOT, 'contract-integrity', 'scripts', 'audit.js'));
15
+
16
+ let failed = 0;
17
+ function check(condition, message, detail = '') {
18
+ if (condition) console.log(' PASS ' + message);
19
+ else {
20
+ console.error(' FAIL ' + message + (detail ? ' — ' + detail : ''));
21
+ failed++;
22
+ }
23
+ }
24
+ function clone(value) {
25
+ return JSON.parse(JSON.stringify(value));
26
+ }
27
+ function json(file) {
28
+ return JSON.parse(fs.readFileSync(file, 'utf8'));
29
+ }
30
+ function digest(file) {
31
+ return require('crypto').createHash('sha256').update(fs.readFileSync(file)).digest('hex');
32
+ }
33
+
34
+ console.log('=== Contract Integrity Phase 3 Node Probe Adapter (#84) ===');
35
+
36
+ const plan = json(path.join(FIXTURE, 'probe-plan.json'));
37
+ check(validatePlan(plan).length === 0, 'declared node-npm-v1 probe plan validates');
38
+
39
+ const beforeSource = digest(path.join(FIXTURE, 'src', 'limit.js'));
40
+ const beforeTest = digest(path.join(FIXTURE, 'test', 'contract.test.js'));
41
+ const protectedReport = executePlan(FIXTURE, plan);
42
+ check(protectedReport.result === 'PROTECTED', 'green baseline plus both explicit probes produces PROTECTED evidence');
43
+ check(protectedReport.probes.length === 2 && protectedReport.probes.every(probe =>
44
+ probe.status === 'KILLED' && probe.failureClass === 'contract' && probe.workspaceIsolation === 'isolated'),
45
+ 'env and exact-replace probes are killed only by expected contract failures');
46
+ check(digest(path.join(FIXTURE, 'src', 'limit.js')) === beforeSource &&
47
+ digest(path.join(FIXTURE, 'test', 'contract.test.js')) === beforeTest,
48
+ 'adapter never mutates the source workspace');
49
+ check(!JSON.stringify(protectedReport).includes('out-of-range input must be rejected'),
50
+ 'probe report retains output hashes/evidence refs instead of project test output');
51
+
52
+ const trace = json(path.join(ROOT, 'contract-integrity', 'fixtures', 'consistent-trace.json'));
53
+ trace.probes = protectedReport.probes.filter(probe => probe.probeId === 'PROBE-001').map(probe => ({
54
+ probeId: probe.probeId,
55
+ requirementId: probe.requirementId,
56
+ status: probe.status,
57
+ sourceSection: probe.sourceSection,
58
+ evidenceRef: probe.evidenceRef,
59
+ workspaceIsolation: probe.workspaceIsolation,
60
+ failureClass: probe.failureClass,
61
+ }));
62
+ const tdd = json(path.join(ROOT, 'tdd', 'fixtures', 'pass-evidence.json'));
63
+ tdd.requirements[0].source.path = 'docs/specs/api.md';
64
+ tdd.requirements[0].source.section = 'REQ-001';
65
+ const integrated = evaluateTrace(trace, { tddEvidence: tdd });
66
+ check(integrated.result === 'PASS' && integrated.scores.protectionScore === 100,
67
+ 'derived adapter evidence feeds the existing #84/#58 strict integrity gate');
68
+
69
+ const survivingPlan = clone(plan);
70
+ survivingPlan.probes = [clone(plan.probes[0])];
71
+ survivingPlan.probes[0].env.HARNESS_CONTRACT_PROBE = 'noop';
72
+ const surviving = executePlan(FIXTURE, survivingPlan);
73
+ check(surviving.result === 'SURVIVED' && surviving.probes[0].status === 'SURVIVED',
74
+ 'green test run under a required probe is explicitly SURVIVED, never PASS');
75
+ const weakTrace = clone(trace);
76
+ weakTrace.probes[0] = {
77
+ probeId: surviving.probes[0].probeId,
78
+ requirementId: surviving.probes[0].requirementId,
79
+ status: surviving.probes[0].status,
80
+ sourceSection: surviving.probes[0].sourceSection,
81
+ evidenceRef: surviving.probes[0].evidenceRef,
82
+ workspaceIsolation: surviving.probes[0].workspaceIsolation,
83
+ failureClass: surviving.probes[0].failureClass,
84
+ };
85
+ const weakAudit = evaluateTrace(weakTrace, { tddEvidence: tdd });
86
+ check(weakAudit.result === 'FAIL' && weakAudit.scores.completenessScore === 100 &&
87
+ weakAudit.scores.protectionScore === 0,
88
+ 'green but weak suite cannot compensate 100 completeness with a surviving contract probe');
89
+
90
+ const unrelatedPlan = clone(plan);
91
+ unrelatedPlan.probes = [clone(plan.probes[0])];
92
+ unrelatedPlan.probes[0].expectedFailureContains = 'THIS-MARKER-DOES-NOT-EXIST';
93
+ const unrelated = executePlan(FIXTURE, unrelatedPlan);
94
+ check(unrelated.probes[0].status === 'INVALID' && unrelated.probes[0].failureClass === 'unknown',
95
+ 'unrelated failing test output is INVALID and cannot be credited as a kill');
96
+
97
+ const ambiguousReplace = clone(plan);
98
+ ambiguousReplace.probes = [clone(plan.probes[1])];
99
+ ambiguousReplace.probes[0].find = 'return';
100
+ const ambiguous = executePlan(FIXTURE, ambiguousReplace);
101
+ check(ambiguous.probes[0].status === 'NOT_EVALUATED' &&
102
+ /exactly once/.test(ambiguous.probes[0].adapterReason),
103
+ 'ambiguous exact-replace fallback fails closed without mutating source');
104
+
105
+ const temp = fs.mkdtempSync(path.join(os.tmpdir(), 'harness-contract-adapter-test-'));
106
+ try {
107
+ const symlinkWorkspace = path.join(temp, 'symlink-workspace');
108
+ fs.mkdirSync(symlinkWorkspace, { recursive: true });
109
+ const outsideDir = path.join(temp, 'outside-dir');
110
+ fs.mkdirSync(outsideDir, { recursive: true });
111
+ const outsideTarget = path.join(outsideDir, 'outside.txt');
112
+ fs.writeFileSync(outsideTarget, 'SAFE', 'utf8');
113
+ fs.symlinkSync(outsideDir, path.join(symlinkWorkspace, 'linked-dir'),
114
+ process.platform === 'win32' ? 'junction' : 'dir');
115
+ let symlinkRejected = false;
116
+ try {
117
+ applyProbe(symlinkWorkspace, {
118
+ strategy: 'replace',
119
+ target: path.join('linked-dir', 'outside.txt'),
120
+ find: 'SAFE',
121
+ replace: 'MUTATED',
122
+ });
123
+ } catch (error) {
124
+ symlinkRejected = /symbolic link|reparse-point|outside isolated workspace/.test(String(error.message || error));
125
+ }
126
+ check(symlinkRejected && fs.readFileSync(outsideTarget, 'utf8') === 'SAFE',
127
+ 'replace probe rejects symlink/junction escape without mutating outside the isolated workspace');
128
+
129
+ const linkedProject = path.join(temp, 'linked-project');
130
+ fs.mkdirSync(linkedProject, { recursive: true });
131
+ fs.writeFileSync(path.join(linkedProject, 'package.json'), JSON.stringify({
132
+ name: 'linked-project',
133
+ scripts: { contract: 'node test.js' },
134
+ }), 'utf8');
135
+ fs.writeFileSync(path.join(linkedProject, 'test.js'), [
136
+ "const fs = require('fs');",
137
+ "const path = require('path');",
138
+ "fs.writeFileSync(path.join(__dirname, 'linked-dir', 'outside.txt'), 'MUTATED', 'utf8');",
139
+ ].join('\n'), 'utf8');
140
+ fs.symlinkSync(outsideDir, path.join(linkedProject, 'linked-dir'),
141
+ process.platform === 'win32' ? 'junction' : 'dir');
142
+ const linkedPlan = {
143
+ schemaVersion: '1.0.0',
144
+ adapter: 'node-npm-v1',
145
+ script: 'contract',
146
+ probes: [{
147
+ probeId: 'PROBE-LINK',
148
+ requirementId: 'REQ-LINK',
149
+ sourceSection: 'Linked workspace',
150
+ strategy: 'env',
151
+ expectedFailureContains: 'unused',
152
+ env: { HARNESS_CONTRACT_PROBE: 'link' },
153
+ }],
154
+ };
155
+ const linkedReport = executePlan(linkedProject, linkedPlan);
156
+ check(linkedReport.result === 'NOT_EVALUATED' &&
157
+ linkedReport.baseline.workspaceIsolation === 'not-isolated' &&
158
+ linkedReport.probes.every(probe => probe.workspaceIsolation === 'not-isolated') &&
159
+ fs.readFileSync(outsideTarget, 'utf8') === 'SAFE',
160
+ 'workspace copy rejects source symlinks/junctions before project code can mutate an outside target');
161
+
162
+ const dependent = path.join(temp, 'dependent');
163
+ fs.cpSync(FIXTURE, dependent, { recursive: true });
164
+ const pkg = json(path.join(dependent, 'package.json'));
165
+ pkg.dependencies = { leftpad: '1.0.0' };
166
+ fs.writeFileSync(path.join(dependent, 'package.json'), JSON.stringify(pkg, null, 2), 'utf8');
167
+ const dependencyReport = executePlan(dependent, plan);
168
+ check(dependencyReport.result === 'NOT_EVALUATED' &&
169
+ dependencyReport.discovery.reason === 'external-dependencies-not-supported-v1',
170
+ 'v1 adapter refuses to infer/install external dependencies');
171
+
172
+ const broken = path.join(temp, 'broken');
173
+ fs.cpSync(FIXTURE, broken, { recursive: true });
174
+ fs.appendFileSync(path.join(broken, 'test', 'contract.test.js'), "\nthrow new Error('baseline fixture failure');\n", 'utf8');
175
+ const baselineFailure = executePlan(broken, plan);
176
+ check(baselineFailure.result === 'NOT_EVALUATED' &&
177
+ baselineFailure.baseline.status === 'FAIL' &&
178
+ baselineFailure.probes.every(probe => probe.status === 'NOT_EVALUATED'),
179
+ 'non-green baseline blocks all protection claims');
180
+ } finally {
181
+ fs.rmSync(temp, { recursive: true, force: true });
182
+ }
183
+
184
+ const invalidPlan = clone(plan);
185
+ invalidPlan.probes[0].target = '../escape.js';
186
+ invalidPlan.probes[0].strategy = 'replace';
187
+ invalidPlan.probes[0].find = 'x';
188
+ invalidPlan.probes[0].replace = 'y';
189
+ delete invalidPlan.probes[0].env;
190
+ check(validatePlan(invalidPlan).some(error => /repo-relative/.test(error)),
191
+ 'probe plan rejects replace targets that escape the isolated workspace');
192
+
193
+ const protectedCli = spawnSync(process.execPath, [
194
+ ADAPTER, '--workspace', FIXTURE, '--plan', path.join(FIXTURE, 'probe-plan.json'),
195
+ ], { encoding: 'utf8' });
196
+ check(protectedCli.status === 0 && /"result": "PROTECTED"/.test(protectedCli.stdout),
197
+ 'CLI returns exit 0 only for fully killed declared probes', protectedCli.stderr);
198
+
199
+ const docs = fs.readFileSync(path.join(ROOT, 'contract-integrity', 'ADAPTERS.md'), 'utf8');
200
+ check(/does \*\*not\*\* claim generic mutation-testing support/.test(docs) &&
201
+ /zero external npm dependencies/.test(docs) &&
202
+ /Not yet supported/.test(docs),
203
+ 'adapter documentation states exact supported scope and explicit non-support');
204
+
205
+ console.log('\n' + (failed === 0 ? 'PASS' : 'FAIL') +
206
+ ': #84 contract protection node adapter (' + failed + ' failure' + (failed === 1 ? '' : 's') + ')');
207
+ process.exit(failed === 0 ? 0 : 1);
@@ -120,6 +120,16 @@ assert.doesNotMatch(packagedAuditSource, /\.\.\/\.\.\/tdd\/scripts\/quality-gate
120
120
  const packagedAudit = require(packagedContractAudit);
121
121
  assert.strictEqual(typeof packagedAudit.runCli, 'function', 'packaged contract audit runtime must load and export runCli');
122
122
 
123
+ const packagedProbeAdapter = path.join(PLUGIN, 'contract-integrity', 'scripts', 'node-probe-adapter.js');
124
+ const packagedAdapterDocs = path.join(PLUGIN, 'contract-integrity', 'ADAPTERS.md');
125
+ assert.ok(fs.existsSync(packagedProbeAdapter) && fs.existsSync(packagedAdapterDocs),
126
+ 'OpenAI package must include shared contract-probe adapter runtime and support boundary docs');
127
+ const packagedAdapter = require(packagedProbeAdapter);
128
+ assert.strictEqual(packagedAdapter.ADAPTER, 'node-npm-v1',
129
+ 'packaged contract-probe adapter must load without becoming a routed skill');
130
+ assert.match(fs.readFileSync(packagedAdapterDocs, 'utf8'), /does \*\*not\*\* claim generic mutation-testing support/,
131
+ 'packaged adapter docs must preserve the narrow support boundary');
132
+
123
133
  const verificationContractWrapper = path.join(PLUGIN, 'skills', 'verification-loop', 'scripts', 'contract-integrity-audit.js');
124
134
  assert.ok(fs.existsSync(verificationContractWrapper), 'verification-loop must package its contract audit wrapper');
125
135
  const verificationWrapper = require(verificationContractWrapper);
@@ -0,0 +1,37 @@
1
+ # Contract Protection Adapters
2
+
3
+ This directory does **not** claim generic mutation-testing support.
4
+
5
+ ## Supported in Phase 3
6
+
7
+ ### `node-npm-v1`
8
+
9
+ Supported project shape:
10
+
11
+ - Node.js project with a `package.json`;
12
+ - one explicitly selected npm script used as the contract-test command;
13
+ - **zero external npm dependencies** for this first adapter revision;
14
+ - probes are predeclared in a local JSON plan and tied to stable `REQ-*` IDs and authoritative source sections;
15
+ - every baseline and probe run executes in a fresh temporary copy; the source workspace is never mutated.
16
+
17
+ Source workspaces containing symbolic-link or junction entries are rejected before project code runs. The v1 adapter does not claim isolation when a copied path could retain an external filesystem target.
18
+
19
+ Supported probe strategies:
20
+
21
+ 1. **`env`** — explicit project-owned fault injection via environment variables.
22
+ 2. **`replace`** — exact one-occurrence text replacement in the isolated copy only. This is the fallback when the project has no built-in fault-injection seam.
23
+
24
+ A probe is `KILLED` only when the selected npm script fails **and** its output contains the predeclared requirement-specific observable marker. A green run is `SURVIVED`. Timeout/spawn failures, baseline failures, unsafe/ambiguous replacement, missing dependencies, or unrelated failures are `NOT_EVALUATED` / `INVALID`; none of those earn protection credit.
25
+
26
+ The adapter does not install dependencies, access the network, infer mutation locations, rewrite source documents, or commit generated probes.
27
+
28
+ ## Not yet supported
29
+
30
+ - arbitrary Jest/Vitest/Mocha/Pytest/Go/Rust/.NET adapter discovery;
31
+ - projects that require dependency installation inside the isolated copy;
32
+ - automatic source-derived mutation synthesis;
33
+ - compiler-failure-as-kill;
34
+ - flaky-test attribution;
35
+ - dirty-worktree mutation or in-place production changes.
36
+
37
+ Those remain future adapters/slices. Phase 3 intentionally proves one narrow real runner plus an explicit isolated fault-injection fallback.
@@ -0,0 +1,8 @@
1
+ {
2
+ "name": "contract-probe-fixture",
3
+ "private": true,
4
+ "version": "1.0.0",
5
+ "scripts": {
6
+ "test:contract": "node --test test/contract.test.js"
7
+ }
8
+ }
@@ -0,0 +1,27 @@
1
+ {
2
+ "schemaVersion": "1.0.0",
3
+ "adapter": "node-npm-v1",
4
+ "script": "test:contract",
5
+ "probes": [
6
+ {
7
+ "probeId": "PROBE-001",
8
+ "requirementId": "REQ-001",
9
+ "sourceSection": "docs/specs/api.md#REQ-001",
10
+ "strategy": "env",
11
+ "env": {
12
+ "HARNESS_CONTRACT_PROBE": "accept-invalid"
13
+ },
14
+ "expectedFailureContains": "[REQ-001]"
15
+ },
16
+ {
17
+ "probeId": "PROBE-REPLACE",
18
+ "requirementId": "REQ-001",
19
+ "sourceSection": "docs/specs/api.md#REQ-001",
20
+ "strategy": "replace",
21
+ "target": "src/limit.js",
22
+ "find": "return Number.isInteger(value) && value >= 1 && value <= 10;",
23
+ "replace": "return true;",
24
+ "expectedFailureContains": "[REQ-001]"
25
+ }
26
+ ]
27
+ }
@@ -0,0 +1,8 @@
1
+ 'use strict';
2
+
3
+ function acceptsLimit(value) {
4
+ if (process.env.HARNESS_CONTRACT_PROBE === 'accept-invalid') return true;
5
+ return Number.isInteger(value) && value >= 1 && value <= 10;
6
+ }
7
+
8
+ module.exports = { acceptsLimit };
@@ -0,0 +1,14 @@
1
+ 'use strict';
2
+
3
+ const test = require('node:test');
4
+ const assert = require('node:assert/strict');
5
+ const { acceptsLimit } = require('../src/limit');
6
+
7
+ test('[REQ-001] accepts supported boundary', () => {
8
+ assert.equal(acceptsLimit(1), true);
9
+ assert.equal(acceptsLimit(10), true);
10
+ });
11
+
12
+ test('[REQ-001] rejects out-of-range input', () => {
13
+ assert.equal(acceptsLimit(0), false, '[REQ-001] out-of-range input must be rejected');
14
+ });