harness-everything 0.52.0 → 0.54.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.
- package/.claude-plugin/marketplace.json +1 -1
- package/.claude-plugin/plugin.json +1 -1
- package/AGENTS.md +3 -1
- package/CHANGELOG.md +38 -0
- package/benchmarks/results/live-host/opencode-2026-11-15-workspace/README.md +7 -0
- package/benchmarks/results/live-host/opencode-2026-11-15-workspace/live-workspace-probe.js +16 -0
- package/benchmarks/results/live-host/opencode-2026-11-15-workspace/live-workspace-trace-2026-11-15.jsonl +4 -0
- package/bin/cli.js +1 -0
- package/ci/invariant-routing.test.js +22 -3
- package/ci/mechanism-2al-codex-hooks-compat.test.js +56 -2
- package/ci/mechanism-2n-opencode-plugin.test.js +1 -1
- package/ci/mechanism-2p-opencode-v2-entrypoint.test.js +18 -3
- package/ci/mechanism-338-opencode-async.test.js +20 -3
- package/ci/mechanism-341-opencode-lane.test.js +7 -1
- package/ci/mechanism-349-ci-change-scope.test.js +78 -57
- package/ci/mechanism-397-cycle-import.test.js +414 -0
- package/ci/mechanism-397-host-acceptance.test.js +119 -0
- package/ci/mechanism-397-opencode-observations.test.js +1922 -0
- package/ci/mechanism-check-packet-write-set.test.js +232 -0
- package/ci/mechanism-codex-prompt-pass-through.test.js +8 -4
- package/ci/mechanism-error-handling-map.test.js +219 -0
- package/ci/mechanism-report-writer.test.js +335 -0
- package/ci/mechanism-system-one-curves.test.js +17 -0
- package/ci/mechanism-system-one-cycle.test.js +621 -2
- package/ci/router-workflow-plan.test.js +50 -7
- package/docs/architecture.md +4 -3
- package/docs/error-handling/README.md +250 -0
- package/docs/error-handling/actions/c1-action-map.md +89 -0
- package/docs/error-handling/actions/c2-action-map.md +22 -0
- package/docs/error-handling/actions/c3-action-map.md +26 -0
- package/docs/error-handling/actions/c5-action-map.md +31 -0
- package/docs/error-handling/actions/c6-action-map.md +37 -0
- package/docs/error-handling/actions/c7-action-map.md +18 -0
- package/docs/error-handling/actions/e0002-action-map.md +101 -0
- package/docs/error-handling/activity.puml +84 -0
- package/docs/error-handling/details/c1-authority-conformance.md +93 -0
- package/docs/error-handling/details/c2-test-root-containment.md +35 -0
- package/docs/error-handling/details/c3-mode-ownership.md +50 -0
- package/docs/error-handling/details/c5-host-replay-contract.md +40 -0
- package/docs/error-handling/details/c6-packet-briefing.md +65 -0
- package/docs/error-handling/details/c7-write-set-check.md +54 -0
- package/docs/error-handling/details/e0002-capture-evidence.md +93 -0
- package/docs/error-handling/details/e0002-report-writer.md +116 -0
- package/docs/error-handling/nodes.yaml +44 -0
- package/docs/error-handling/registry.md +59 -0
- package/docs/error-handling/templates/packet-briefing.md +45 -0
- package/docs/platform-capabilities.md +16 -7
- package/docs/system-one-cycle.md +12 -3
- package/docs/system-one-observations.md +35 -4
- package/hooks/scripts/codex-user-prompt.js +2 -3
- package/hooks/scripts/lib/observations.js +5 -3
- package/opencode-plugin/README.md +22 -8
- package/opencode-plugin/index.mjs +424 -44
- package/opencode-plugin/plugin.json +1 -1
- package/package.json +2 -1
- package/plugins/harness-everything/.codex-plugin/plugin.json +1 -1
- package/plugins/harness-everything/hooks/scripts/codex-user-prompt.js +2 -3
- package/plugins/harness-everything/hooks/scripts/lib/observations.js +5 -3
- package/plugins/harness-everything/plugin.json +1 -1
- package/sbom.cdx.json +7 -7
- package/scripts/check-packet-write-set.js +155 -0
- package/scripts/codex-hooks-compat.js +46 -5
- package/scripts/error-handling-map.js +288 -0
- package/scripts/report-writer.js +261 -0
- package/scripts/system-one-curves.js +154 -14
- package/scripts/system-one-cycle/collect.js +20 -3
- package/scripts/system-one-cycle/common.js +39 -1
- package/scripts/system-one-cycle/evaluate.js +8 -5
- package/scripts/system-one-cycle.js +7 -2
- package/scripts/system-one-observations-export.js +29 -0
- package/scripts/system-one-observations-import-store.js +128 -0
|
@@ -0,0 +1,414 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
const assert = require('node:assert/strict');
|
|
4
|
+
const fs = require('node:fs');
|
|
5
|
+
const os = require('node:os');
|
|
6
|
+
const path = require('node:path');
|
|
7
|
+
const { pathToFileURL } = require('node:url');
|
|
8
|
+
const { test } = require('node:test');
|
|
9
|
+
const { collect } = require('../scripts/system-one-cycle/collect');
|
|
10
|
+
const { importStore } = require('../scripts/system-one-observations-import-store');
|
|
11
|
+
const observations = require('../hooks/scripts/lib/observations');
|
|
12
|
+
|
|
13
|
+
const ROOT = path.resolve(__dirname, '..');
|
|
14
|
+
const PLUGIN = path.join(ROOT, 'opencode-plugin', 'index.mjs');
|
|
15
|
+
function isOutside(root, dir, pathApi = path) {
|
|
16
|
+
const relative = pathApi.relative(root, dir);
|
|
17
|
+
return relative === '..' || relative.startsWith(`..${pathApi.sep}`) || pathApi.isAbsolute(relative);
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
const win32Root = 'D:\\a\\Harness-everything\\Harness-everything';
|
|
21
|
+
test('test-root containment handles Windows path boundaries', () => {
|
|
22
|
+
const win32Parent = path.win32.dirname(win32Root);
|
|
23
|
+
const win32Child = path.win32.join(win32Root, 'ci');
|
|
24
|
+
const win32DotChild = path.win32.join(win32Root, '..cache');
|
|
25
|
+
const win32Sibling = path.win32.join(win32Parent, `${path.win32.basename(win32Root)}-other`);
|
|
26
|
+
const win32CrossDrive = 'C:\\Users\\runner\\AppData\\Local\\Temp\\fixture';
|
|
27
|
+
const crossDriveRelative = path.win32.relative(win32Root, win32CrossDrive);
|
|
28
|
+
|
|
29
|
+
assert.equal(isOutside(win32Root, win32Child, path.win32), false, 'a root child is inside');
|
|
30
|
+
assert.equal(isOutside(win32Root, win32DotChild, path.win32), false, 'a child whose name starts with two dots is still inside');
|
|
31
|
+
assert.equal(win32Sibling.startsWith(win32Root), true, 'the sibling shares the root string prefix');
|
|
32
|
+
assert.equal(isOutside(win32Root, win32Sibling, path.win32), true, 'a similar-prefix sibling is outside');
|
|
33
|
+
assert.equal(isOutside(win32Root, win32Parent, path.win32), true, 'the parent escape is outside');
|
|
34
|
+
assert.equal(path.win32.isAbsolute(crossDriveRelative), true, 'cross-drive relative result is absolute');
|
|
35
|
+
assert.equal(crossDriveRelative.startsWith('..'), false, 'the old prefix-only check misses a cross-drive path');
|
|
36
|
+
assert.equal(isOutside(win32Root, win32CrossDrive, path.win32), true, 'a cross-drive temp path is outside');
|
|
37
|
+
});
|
|
38
|
+
|
|
39
|
+
const LABELS = [
|
|
40
|
+
'<!-- harness-label {"v":1,"validity":"actionable","tier":"tier2","intents":["fix"],"workflow":"iterative-single","skills":[]} -->',
|
|
41
|
+
'<!-- harness-label {"v":1,"validity":"actionable","tier":"tier2","intents":["edit"],"workflow":"iterative-single","skills":[]} -->',
|
|
42
|
+
];
|
|
43
|
+
|
|
44
|
+
function recordList(store) {
|
|
45
|
+
const file = path.join(store, 'observations-index.json');
|
|
46
|
+
return fs.existsSync(file) ? JSON.parse(fs.readFileSync(file, 'utf8')).records : [];
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
function fixture() {
|
|
50
|
+
const dir = fs.mkdtempSync(path.join(os.tmpdir(), 'mechanism-397-cycle-import-'));
|
|
51
|
+
assert.ok(isOutside(ROOT, dir), 'fixture data must stay outside the repository');
|
|
52
|
+
const workspace = path.join(dir, 'workspace');
|
|
53
|
+
const store = path.join(dir, 'live-observations');
|
|
54
|
+
const sessions = path.join(dir, 'codex-sessions');
|
|
55
|
+
const cycle = path.join(dir, 'cycle');
|
|
56
|
+
fs.mkdirSync(workspace, { recursive: true });
|
|
57
|
+
fs.mkdirSync(sessions, { recursive: true });
|
|
58
|
+
|
|
59
|
+
const envKeys = ['HOME', 'USERPROFILE', 'CODEX_HOME', 'HARNESS_STATE_HOME', 'HARNESS_OBSERVATIONS_DIR', 'HARNESS_OBSERVATIONS', 'HARNESS_DOC_RECONCILIATION_PILOT'];
|
|
60
|
+
const oldEnv = Object.fromEntries(envKeys.map(key => [key, process.env[key]]));
|
|
61
|
+
process.env.HOME = dir;
|
|
62
|
+
process.env.USERPROFILE = dir;
|
|
63
|
+
process.env.CODEX_HOME = path.join(dir, 'codex-home');
|
|
64
|
+
process.env.HARNESS_STATE_HOME = path.join(dir, 'harness-state');
|
|
65
|
+
process.env.HARNESS_OBSERVATIONS_DIR = store;
|
|
66
|
+
process.env.HARNESS_OBSERVATIONS = 'on';
|
|
67
|
+
process.env.HARNESS_DOC_RECONCILIATION_PILOT = '0';
|
|
68
|
+
|
|
69
|
+
const sessionHooks = new Map();
|
|
70
|
+
const toolHooks = new Map();
|
|
71
|
+
const events = [];
|
|
72
|
+
const waiters = [];
|
|
73
|
+
let currentTurn = { messageID: null, prompt: '', final: '' };
|
|
74
|
+
const ctx = {
|
|
75
|
+
location: { directory: workspace },
|
|
76
|
+
session: {
|
|
77
|
+
hook: async (name, callback) => {
|
|
78
|
+
sessionHooks.set(name, callback);
|
|
79
|
+
return { dispose: async () => {} };
|
|
80
|
+
},
|
|
81
|
+
prompt: async () => ({}),
|
|
82
|
+
get: async ({ sessionID }) => ({ id: sessionID, location: { directory: workspace } }),
|
|
83
|
+
context: async () => [
|
|
84
|
+
{ info: { role: 'user', id: currentTurn.messageID }, parts: [{ type: 'text', text: currentTurn.prompt }] },
|
|
85
|
+
{ info: { role: 'assistant', id: `assistant-${currentTurn.messageID}` }, parts: [{ type: 'text', text: currentTurn.final }] },
|
|
86
|
+
],
|
|
87
|
+
},
|
|
88
|
+
tool: { hook: async (name, callback) => { toolHooks.set(name, callback); return { dispose: async () => {} }; } },
|
|
89
|
+
event: {
|
|
90
|
+
subscribe: ({ signal }) => ({
|
|
91
|
+
[Symbol.asyncIterator]: () => ({
|
|
92
|
+
next: () => {
|
|
93
|
+
if (events.length) return Promise.resolve({ value: events.shift(), done: false });
|
|
94
|
+
if (signal.aborted) return Promise.resolve({ done: true });
|
|
95
|
+
return new Promise(resolve => {
|
|
96
|
+
waiters.push(resolve);
|
|
97
|
+
signal.addEventListener('abort', () => resolve({ done: true }), { once: true });
|
|
98
|
+
});
|
|
99
|
+
},
|
|
100
|
+
}),
|
|
101
|
+
}),
|
|
102
|
+
},
|
|
103
|
+
};
|
|
104
|
+
const push = event => {
|
|
105
|
+
const waiter = waiters.shift();
|
|
106
|
+
if (waiter) waiter({ value: event, done: false });
|
|
107
|
+
else events.push(event);
|
|
108
|
+
};
|
|
109
|
+
|
|
110
|
+
return {
|
|
111
|
+
dir, workspace, store, sessions, cycle, ctx, sessionHooks, toolHooks, push,
|
|
112
|
+
setTurn(messageID, prompt, final) { currentTurn = { messageID, prompt, final }; },
|
|
113
|
+
restore() {
|
|
114
|
+
for (const [key, value] of Object.entries(oldEnv)) {
|
|
115
|
+
if (value === undefined) delete process.env[key];
|
|
116
|
+
else process.env[key] = value;
|
|
117
|
+
}
|
|
118
|
+
fs.rmSync(dir, { recursive: true, force: true });
|
|
119
|
+
},
|
|
120
|
+
};
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
async function waitFor(predicate) {
|
|
124
|
+
const deadline = Date.now() + 5000;
|
|
125
|
+
while (!predicate()) {
|
|
126
|
+
if (Date.now() >= deadline) throw new Error('OpenCode observations were not captured');
|
|
127
|
+
await new Promise(resolve => setTimeout(resolve, 10));
|
|
128
|
+
}
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
function writeCodexSession(sessions, sessionID = 'codex-backfill-session', turnId = 'codex-backfill-turn') {
|
|
132
|
+
const startedAt = new Date().toISOString();
|
|
133
|
+
const completedAt = new Date(Date.now() + 1).toISOString();
|
|
134
|
+
const rows = [
|
|
135
|
+
{ type: 'session_meta', payload: { session_id: sessionID } },
|
|
136
|
+
{ type: 'event_msg', timestamp: startedAt, payload: { type: 'task_started', turn_id: turnId, started_at: startedAt } },
|
|
137
|
+
{ type: 'response_item', payload: { type: 'message', role: 'user', content: [{ type: 'input_text', text: 'Codex positive control' }] } },
|
|
138
|
+
{ type: 'event_msg', timestamp: completedAt, payload: { type: 'task_complete', turn_id: turnId, last_agent_message: LABELS[0] } },
|
|
139
|
+
];
|
|
140
|
+
fs.writeFileSync(path.join(sessions, `${sessionID}.jsonl`), rows.map(row => JSON.stringify(row)).join('\n') + '\n');
|
|
141
|
+
}
|
|
142
|
+
|
|
143
|
+
function captureTurn(store, { host = 'opencode', sessionID, turnId, prompt, final }) {
|
|
144
|
+
const env = { HARNESS_OBSERVATIONS: 'on', HARNESS_OBSERVATIONS_DIR: store };
|
|
145
|
+
observations.handle({ hook_event_name: 'UserPromptSubmit', host, session_id: sessionID, turn_id: turnId, prompt }, env);
|
|
146
|
+
observations.handle({ hook_event_name: 'Stop', host, session_id: sessionID, turn_id: turnId, last_assistant_message: final }, env);
|
|
147
|
+
}
|
|
148
|
+
|
|
149
|
+
function jsonl(file) {
|
|
150
|
+
return fs.readFileSync(file, 'utf8').split(/\r?\n/).filter(Boolean).map(JSON.parse);
|
|
151
|
+
}
|
|
152
|
+
|
|
153
|
+
function json(file) {
|
|
154
|
+
return JSON.parse(fs.readFileSync(file, 'utf8'));
|
|
155
|
+
}
|
|
156
|
+
|
|
157
|
+
function collectReport(dataDir) {
|
|
158
|
+
return json(path.join(dataDir, 'training/observed/import-report.json'));
|
|
159
|
+
}
|
|
160
|
+
|
|
161
|
+
function snapshotCycle(dataDir) {
|
|
162
|
+
const training = path.join(dataDir, 'training');
|
|
163
|
+
const files = {};
|
|
164
|
+
function walk(directory) {
|
|
165
|
+
for (const entry of fs.readdirSync(directory, { withFileTypes: true }).sort((a, b) => a.name.localeCompare(b.name))) {
|
|
166
|
+
const file = path.join(directory, entry.name);
|
|
167
|
+
if (entry.isDirectory()) walk(file);
|
|
168
|
+
else {
|
|
169
|
+
const relative = path.relative(training, file).split(path.sep).join('/');
|
|
170
|
+
let content = fs.readFileSync(file, 'utf8');
|
|
171
|
+
if (relative === 'observed/import-report.json') {
|
|
172
|
+
const report = JSON.parse(content);
|
|
173
|
+
report.run.startedAt = '<run-time>';
|
|
174
|
+
content = JSON.stringify(report, null, 2) + '\n';
|
|
175
|
+
} else if (relative === 'observed/export-report.json') {
|
|
176
|
+
const report = JSON.parse(content);
|
|
177
|
+
report.exportedAt = '<run-time>';
|
|
178
|
+
content = JSON.stringify(report, null, 2) + '\n';
|
|
179
|
+
}
|
|
180
|
+
files[relative] = content;
|
|
181
|
+
}
|
|
182
|
+
}
|
|
183
|
+
}
|
|
184
|
+
walk(training);
|
|
185
|
+
return files;
|
|
186
|
+
}
|
|
187
|
+
|
|
188
|
+
test('cycle collect imports production OpenCode captures into private prompt/label pairs', { concurrency: false }, async () => {
|
|
189
|
+
const f = fixture();
|
|
190
|
+
let dispose;
|
|
191
|
+
try {
|
|
192
|
+
const plugin = await import(pathToFileURL(PLUGIN).href);
|
|
193
|
+
dispose = await plugin.default.setup(f.ctx);
|
|
194
|
+
assert.ok(f.sessionHooks.has('prompt'), 'the production OpenCode plugin registered prompt capture');
|
|
195
|
+
|
|
196
|
+
const turns = [
|
|
197
|
+
{ sessionID: 'opencode-cycle-session-a', prompt: 'Fix parser. Contact synthetic.user@example.test at /Users/synthetic-owner/private-alpha.txt' },
|
|
198
|
+
{ sessionID: 'opencode-cycle-session-b', prompt: 'Edit response. Contact second.user@example.test at /Users/synthetic-owner/private-beta.txt' },
|
|
199
|
+
];
|
|
200
|
+
for (const [index, turn] of turns.entries()) {
|
|
201
|
+
const messageID = 'shared-turn';
|
|
202
|
+
f.setTurn(messageID, turn.prompt, LABELS[index]);
|
|
203
|
+
await f.sessionHooks.get('prompt')({ sessionID: turn.sessionID, messageID, prompt: { text: turn.prompt } });
|
|
204
|
+
f.push({ type: 'session.execution.succeeded', data: { sessionID: turn.sessionID } });
|
|
205
|
+
await waitFor(() => recordList(f.store).length === index + 1);
|
|
206
|
+
}
|
|
207
|
+
|
|
208
|
+
const openCodeRecords = recordList(f.store).filter(record => record.host === 'opencode');
|
|
209
|
+
assert.equal(openCodeRecords.length, 2, 'both valid OpenCode turns were captured in the isolated live store');
|
|
210
|
+
captureTurn(f.store, { host: 'codex', sessionID: turns[0].sessionID, turnId: 'shared-turn', prompt: 'Codex live overlap', final: LABELS[0] });
|
|
211
|
+
writeCodexSession(f.sessions, turns[0].sessionID, 'shared-turn');
|
|
212
|
+
const result = collect({ dataDir: f.cycle, since: '2026-01-01', sessionsDir: f.sessions });
|
|
213
|
+
assert.equal(result.prompts, 3, 'two OpenCode turns and the production Codex backfill are collected');
|
|
214
|
+
const equivalentCycle = path.join(f.dir, 'equivalent-cycle');
|
|
215
|
+
const equivalentResult = collect({ dataDir: equivalentCycle, since: '2026-01-01', sessionsDir: f.sessions });
|
|
216
|
+
assert.deepEqual(equivalentResult, result);
|
|
217
|
+
assert.deepEqual(snapshotCycle(equivalentCycle), snapshotCycle(f.cycle),
|
|
218
|
+
'clean equivalent collects produce the same files and persistent state apart from per-run timestamps');
|
|
219
|
+
|
|
220
|
+
const prompts = jsonl(path.join(f.cycle, 'training/observed/prompts-observed.jsonl'));
|
|
221
|
+
const labels = jsonl(path.join(f.cycle, 'training/observed/labels-observed.jsonl'));
|
|
222
|
+
for (const record of openCodeRecords) {
|
|
223
|
+
const prompt = prompts.find(row => row.id === record.id);
|
|
224
|
+
const label = labels.find(row => row.id === record.id);
|
|
225
|
+
assert.ok(prompt, 'OpenCode rows are absent because collect never imports the live observations store');
|
|
226
|
+
assert.ok(label, 'every imported OpenCode prompt has its matching label');
|
|
227
|
+
assert.equal(label.host, 'opencode', 'the final label projection preserves the capture host');
|
|
228
|
+
assert.equal(label.tier, record.selfReport.tier);
|
|
229
|
+
assert.deepEqual(label.intents, record.selfReport.intents);
|
|
230
|
+
assert.match(prompt.text, /<email>/);
|
|
231
|
+
assert.match(prompt.text, /<home>/);
|
|
232
|
+
assert.ok(!prompt.text.includes('synthetic.user@example.test') && !prompt.text.includes('second.user@example.test'));
|
|
233
|
+
assert.ok(!prompt.text.includes('/Users/synthetic-owner'));
|
|
234
|
+
}
|
|
235
|
+
|
|
236
|
+
const destinationRecords = recordList(path.join(f.cycle, 'training/observation-store'));
|
|
237
|
+
const sharedTurn = destinationRecords.filter(record => record.writer.turnId === 'shared-turn');
|
|
238
|
+
assert.equal(sharedTurn.length, 3, 'the shared turn id remains distinct across two sessions and two hosts');
|
|
239
|
+
assert.equal(new Set(sharedTurn.map(record => record.id)).size, 3);
|
|
240
|
+
assert.deepEqual(sharedTurn.map(record => record.host).sort(), ['codex', 'opencode', 'opencode']);
|
|
241
|
+
const codexRecord = destinationRecords.find(record => record.host === 'codex');
|
|
242
|
+
assert.equal(codexRecord.captureMethod, 'session-backfill', 'Codex backfill remains the positive control and wins this arrival order');
|
|
243
|
+
assert.equal(labels.find(row => row.id === codexRecord.id).host, 'codex');
|
|
244
|
+
const firstReport = collectReport(f.cycle);
|
|
245
|
+
assert.equal(firstReport.schemaVersion, 1);
|
|
246
|
+
assert.deepEqual(Object.keys(firstReport).sort(), ['byHost', 'run', 'schemaVersion', 'sources']);
|
|
247
|
+
assert.deepEqual(Object.keys(firstReport.sources).sort(), ['codex', 'live']);
|
|
248
|
+
assert.deepEqual(Object.keys(firstReport.sources.live).sort(), ['root', 'status']);
|
|
249
|
+
assert.deepEqual(Object.keys(firstReport.sources.codex).sort(), ['status']);
|
|
250
|
+
assert.ok(Number.isFinite(Date.parse(firstReport.run.startedAt)));
|
|
251
|
+
assert.equal(firstReport.sources.live.root, 'configured-private-store');
|
|
252
|
+
const reportJson = JSON.stringify(firstReport);
|
|
253
|
+
assert.ok(!reportJson.includes(f.dir));
|
|
254
|
+
assert.ok(!reportJson.includes('synthetic.user@example.test') && !reportJson.includes('private-alpha.txt'));
|
|
255
|
+
if (process.platform !== 'win32') {
|
|
256
|
+
assert.equal(fs.statSync(path.join(f.cycle, 'training/observed/import-report.json')).mode & 0o777, 0o600);
|
|
257
|
+
assert.equal(fs.statSync(f.cycle).mode & 0o777, 0o700);
|
|
258
|
+
}
|
|
259
|
+
assert.equal(firstReport.sources.live.status, 'ok');
|
|
260
|
+
assert.equal(firstReport.sources.codex.status, 'ok');
|
|
261
|
+
assert.deepEqual(firstReport.byHost.opencode, { persisted: 2, duplicate: 0, ambiguous: 0, importFailure: 0 });
|
|
262
|
+
assert.deepEqual(firstReport.byHost.codex, { persisted: 0, duplicate: 1, ambiguous: 0, importFailure: 0 });
|
|
263
|
+
|
|
264
|
+
collect({ dataDir: f.cycle, since: '2026-01-01', sessionsDir: f.sessions });
|
|
265
|
+
const repeatReport = collectReport(f.cycle);
|
|
266
|
+
assert.deepEqual(repeatReport.byHost.opencode, { persisted: 0, duplicate: 2, ambiguous: 0, importFailure: 0 });
|
|
267
|
+
assert.deepEqual(repeatReport.byHost.codex, { persisted: 0, duplicate: 1, ambiguous: 0, importFailure: 0 });
|
|
268
|
+
assert.equal(recordList(path.join(f.cycle, 'training/observation-store')).length, 3, 'repeat collect adds no observation rows');
|
|
269
|
+
|
|
270
|
+
const liveFirstCycle = path.join(f.dir, 'live-first-cycle');
|
|
271
|
+
const liveFirstStore = path.join(liveFirstCycle, 'training/observation-store');
|
|
272
|
+
const liveFirst = importStore({ sourceRoot: f.store, store: liveFirstStore, since: '2026-01-01' });
|
|
273
|
+
assert.equal(liveFirst.byHost.opencode.persisted, 2);
|
|
274
|
+
assert.equal(liveFirst.byHost.codex.persisted, 1);
|
|
275
|
+
collect({ dataDir: liveFirstCycle, since: '2026-01-01', sessionsDir: f.sessions });
|
|
276
|
+
const reverseOrderReport = collectReport(liveFirstCycle);
|
|
277
|
+
assert.equal(reverseOrderReport.byHost.opencode.duplicate, 2);
|
|
278
|
+
assert.equal(reverseOrderReport.byHost.codex.duplicate, 1);
|
|
279
|
+
assert.equal(recordList(liveFirstStore).find(record => record.host === 'codex').captureMethod, undefined,
|
|
280
|
+
'live capture wins when it arrives before the Codex backfill');
|
|
281
|
+
} finally {
|
|
282
|
+
if (dispose) await dispose();
|
|
283
|
+
f.restore();
|
|
284
|
+
}
|
|
285
|
+
});
|
|
286
|
+
|
|
287
|
+
test('live-store merge retains unlabeled metadata without reviving unavailable text', () => {
|
|
288
|
+
const f = fixture();
|
|
289
|
+
try {
|
|
290
|
+
captureTurn(f.store, { sessionID: 'unlabeled-session', turnId: 'unlabeled-turn', prompt: 'Unlabeled observation', final: 'No label was emitted.' });
|
|
291
|
+
captureTurn(f.store, { sessionID: 'malformed-session', turnId: 'malformed-turn', prompt: 'Malformed observation', final: '<!-- harness-label {bad json} -->' });
|
|
292
|
+
captureTurn(f.store, { sessionID: 'missing-text-session', turnId: 'missing-text-turn', prompt: 'Missing text observation', final: LABELS[0] });
|
|
293
|
+
captureTurn(f.store, { sessionID: 'expired-text-session', turnId: 'expired-text-turn', prompt: 'Expired text observation', final: LABELS[1] });
|
|
294
|
+
captureTurn(f.store, { sessionID: 'before-cutoff-session', turnId: 'before-cutoff-turn', prompt: 'Before cutoff', final: LABELS[0] });
|
|
295
|
+
|
|
296
|
+
const sourceIndexFile = path.join(f.store, 'observations-index.json');
|
|
297
|
+
const sourceIndex = json(sourceIndexFile);
|
|
298
|
+
const missing = sourceIndex.records.find(record => record.writer.turnId === 'missing-text-turn');
|
|
299
|
+
const expired = sourceIndex.records.find(record => record.writer.turnId === 'expired-text-turn');
|
|
300
|
+
sourceIndex.records.find(record => record.writer.turnId === 'before-cutoff-turn').observedAt = '2025-12-31T23:59:59.000Z';
|
|
301
|
+
const expiredUntil = new Date(Date.now() - 1000).toISOString();
|
|
302
|
+
expired.validUntil = expiredUntil;
|
|
303
|
+
expired.status = 'active';
|
|
304
|
+
fs.writeFileSync(sourceIndexFile, JSON.stringify(sourceIndex));
|
|
305
|
+
fs.unlinkSync(path.join(f.store, 'text', `${missing.contentSha256}.json`));
|
|
306
|
+
|
|
307
|
+
const result = collect({ dataDir: f.cycle, since: '2026-01-01', sessionsDir: f.sessions });
|
|
308
|
+
assert.equal(result.prompts, 0);
|
|
309
|
+
const output = path.join(f.cycle, 'training/observed');
|
|
310
|
+
assert.deepEqual(jsonl(path.join(output, 'prompts-observed.jsonl')), []);
|
|
311
|
+
assert.deepEqual(jsonl(path.join(output, 'labels-observed.jsonl')), []);
|
|
312
|
+
|
|
313
|
+
const destinationStore = path.join(f.cycle, 'training/observation-store');
|
|
314
|
+
const records = recordList(destinationStore);
|
|
315
|
+
assert.equal(records.length, 4, 'unlabeled, malformed, missing-text and expired-text metadata all survive import');
|
|
316
|
+
assert.equal(records.find(record => record.writer.turnId === 'unlabeled-turn').selfReportReason, 'label-missing');
|
|
317
|
+
assert.equal(records.find(record => record.writer.turnId === 'malformed-turn').selfReportReason, 'label-unparseable');
|
|
318
|
+
const storedMissing = records.find(record => record.writer.turnId === 'missing-text-turn');
|
|
319
|
+
const storedExpired = records.find(record => record.writer.turnId === 'expired-text-turn');
|
|
320
|
+
assert.equal(fs.existsSync(path.join(destinationStore, 'text', `${storedMissing.contentSha256}.json`)), false);
|
|
321
|
+
assert.equal(storedExpired.validUntil, expiredUntil, 'import keeps the original expiry deadline');
|
|
322
|
+
assert.equal(storedExpired.status, 'expired');
|
|
323
|
+
assert.equal(storedExpired.textDeleted, true);
|
|
324
|
+
assert.equal(fs.existsSync(path.join(destinationStore, 'text', `${storedExpired.contentSha256}.json`)), false);
|
|
325
|
+
assert.deepEqual(collectReport(f.cycle).byHost.opencode,
|
|
326
|
+
{ persisted: 4, duplicate: 0, ambiguous: 0, importFailure: 0 });
|
|
327
|
+
const exportReport = json(path.join(output, 'export-report.json'));
|
|
328
|
+
assert.equal(exportReport.skippedUnlabeled, 2);
|
|
329
|
+
assert.equal(exportReport.skippedNoText, 2);
|
|
330
|
+
const reportText = fs.readFileSync(path.join(output, 'import-report.json'), 'utf8');
|
|
331
|
+
assert.ok(!reportText.includes(f.dir) && !reportText.includes('Unlabeled observation'));
|
|
332
|
+
} finally {
|
|
333
|
+
f.restore();
|
|
334
|
+
}
|
|
335
|
+
});
|
|
336
|
+
|
|
337
|
+
test('missing live source is explicit and failed live imports never report persistence', () => {
|
|
338
|
+
const f = fixture();
|
|
339
|
+
try {
|
|
340
|
+
const emptyLiveStore = path.join(f.dir, 'empty-live-store');
|
|
341
|
+
fs.mkdirSync(emptyLiveStore);
|
|
342
|
+
process.env.HARNESS_OBSERVATIONS_DIR = emptyLiveStore;
|
|
343
|
+
const omittedSource = importStore({ store: path.join(f.dir, 'omitted-source-cycle'), since: '2026-01-01' });
|
|
344
|
+
assert.equal(omittedSource.source.status, 'absent', 'omitting sourceRoot uses the configured observation store');
|
|
345
|
+
const invalidSince = importStore({ sourceRoot: emptyLiveStore, store: path.join(f.dir, 'invalid-since-cycle'), since: 'not-a-date' });
|
|
346
|
+
assert.equal(invalidSince.source.error, 'invalid-since');
|
|
347
|
+
assert.equal(invalidSince.byHost.unknown.persisted, 0);
|
|
348
|
+
const missingStore = importStore({ sourceRoot: emptyLiveStore, since: '2026-01-01' });
|
|
349
|
+
assert.equal(missingStore.source.error, 'invalid-destination');
|
|
350
|
+
assert.equal(missingStore.byHost.unknown.persisted, 0);
|
|
351
|
+
const wrongTypeStore = importStore({ sourceRoot: emptyLiveStore, store: { path: 'unsafe' }, since: '2026-01-01' });
|
|
352
|
+
assert.equal(wrongTypeStore.source.error, 'invalid-destination');
|
|
353
|
+
const empty = collect({ dataDir: f.cycle, since: '2026-01-01', sessionsDir: f.sessions });
|
|
354
|
+
assert.equal(empty.prompts, 0);
|
|
355
|
+
const absentReport = collectReport(f.cycle);
|
|
356
|
+
assert.equal(absentReport.sources.live.status, 'absent');
|
|
357
|
+
assert.equal(absentReport.sources.codex.status, 'ok');
|
|
358
|
+
assert.deepEqual(absentReport.byHost, {});
|
|
359
|
+
|
|
360
|
+
const brokenCycle = path.join(f.dir, 'broken-cycle');
|
|
361
|
+
process.env.HARNESS_OBSERVATIONS_DIR = f.store;
|
|
362
|
+
fs.mkdirSync(f.store, { recursive: true });
|
|
363
|
+
fs.writeFileSync(path.join(f.store, 'observations-index.json'), '{broken index');
|
|
364
|
+
assert.throws(() => collect({ dataDir: brokenCycle, since: '2026-01-01', sessionsDir: f.sessions }), /observation import incomplete/);
|
|
365
|
+
const failedReport = collectReport(brokenCycle);
|
|
366
|
+
assert.equal(failedReport.sources.live.status, 'error');
|
|
367
|
+
assert.equal(failedReport.sources.live.error, 'source-index-invalid');
|
|
368
|
+
assert.deepEqual(failedReport.byHost.unknown, { persisted: 0, duplicate: 0, ambiguous: 0, importFailure: 1 });
|
|
369
|
+
assert.equal(recordList(path.join(brokenCycle, 'training/observation-store')).length, 0);
|
|
370
|
+
assert.equal(fs.existsSync(path.join(brokenCycle, 'training/observed/prompts-observed.jsonl')), false,
|
|
371
|
+
'failed imports do not proceed to export');
|
|
372
|
+
|
|
373
|
+
const ambiguousStore = path.join(f.dir, 'ambiguous-live-store');
|
|
374
|
+
captureTurn(ambiguousStore, { sessionID: 'ambiguous-session', turnId: 'ambiguous-turn', prompt: 'Ambiguous identity', final: LABELS[0] });
|
|
375
|
+
const ambiguousIndex = json(path.join(ambiguousStore, 'observations-index.json'));
|
|
376
|
+
delete ambiguousIndex.records[0].writer.sessionId;
|
|
377
|
+
fs.writeFileSync(path.join(ambiguousStore, 'observations-index.json'), JSON.stringify(ambiguousIndex));
|
|
378
|
+
const ambiguousCycle = path.join(f.dir, 'ambiguous-cycle');
|
|
379
|
+
process.env.HARNESS_OBSERVATIONS_DIR = ambiguousStore;
|
|
380
|
+
assert.throws(() => collect({ dataDir: ambiguousCycle, since: '2026-01-01', sessionsDir: f.sessions }), /observation import incomplete/);
|
|
381
|
+
const ambiguousReport = collectReport(ambiguousCycle);
|
|
382
|
+
assert.equal(ambiguousReport.sources.live.error, 'ambiguous-records');
|
|
383
|
+
assert.deepEqual(ambiguousReport.byHost.opencode, { persisted: 0, duplicate: 0, ambiguous: 1, importFailure: 0 });
|
|
384
|
+
assert.equal(recordList(path.join(ambiguousCycle, 'training/observation-store')).length, 0);
|
|
385
|
+
|
|
386
|
+
const unsafeHashStore = path.join(f.dir, 'unsafe-hash-live-store');
|
|
387
|
+
captureTurn(unsafeHashStore, { sessionID: 'unsafe-hash-session', turnId: 'unsafe-hash-turn', prompt: 'Unsafe hash', final: LABELS[0] });
|
|
388
|
+
const unsafeIndex = json(path.join(unsafeHashStore, 'observations-index.json'));
|
|
389
|
+
unsafeIndex.records[0].contentSha256 = '../../outside-private-root';
|
|
390
|
+
fs.writeFileSync(path.join(unsafeHashStore, 'observations-index.json'), JSON.stringify(unsafeIndex));
|
|
391
|
+
const unsafeCycle = path.join(f.dir, 'unsafe-hash-cycle');
|
|
392
|
+
process.env.HARNESS_OBSERVATIONS_DIR = unsafeHashStore;
|
|
393
|
+
assert.throws(() => collect({ dataDir: unsafeCycle, since: '2026-01-01', sessionsDir: f.sessions }), /observation import incomplete/);
|
|
394
|
+
const unsafeReport = collectReport(unsafeCycle);
|
|
395
|
+
assert.equal(unsafeReport.sources.live.error, 'source-record-invalid');
|
|
396
|
+
assert.deepEqual(unsafeReport.byHost.opencode, { persisted: 0, duplicate: 0, ambiguous: 0, importFailure: 1 });
|
|
397
|
+
assert.equal(recordList(path.join(unsafeCycle, 'training/observation-store')).length, 0);
|
|
398
|
+
|
|
399
|
+
const lockedStore = path.join(f.dir, 'locked-live-store');
|
|
400
|
+
captureTurn(lockedStore, { sessionID: 'locked-session', turnId: 'locked-turn', prompt: 'Lock failure', final: LABELS[0] });
|
|
401
|
+
const lockedDestination = path.join(f.dir, 'locked-destination');
|
|
402
|
+
fs.mkdirSync(lockedDestination, { recursive: true });
|
|
403
|
+
fs.writeFileSync(path.join(lockedDestination, 'observations-index.json'), JSON.stringify({ schemaVersion: 1, kind: 'system-one-observations', records: [] }));
|
|
404
|
+
fs.writeFileSync(path.join(lockedDestination, '.index.lock'), 'fixture lock');
|
|
405
|
+
const lockFailure = importStore({ sourceRoot: lockedStore, store: lockedDestination, since: '2026-01-01', lockTimeoutMs: 1 });
|
|
406
|
+
assert.equal(lockFailure.source.status, 'error');
|
|
407
|
+
assert.equal(lockFailure.source.error, 'append-failed');
|
|
408
|
+
assert.deepEqual(lockFailure.byHost.opencode, { persisted: 0, duplicate: 0, ambiguous: 0, importFailure: 1 });
|
|
409
|
+
assert.equal(recordList(lockedDestination).length, 0);
|
|
410
|
+
} finally {
|
|
411
|
+
f.restore();
|
|
412
|
+
}
|
|
413
|
+
});
|
|
414
|
+
|
|
@@ -0,0 +1,119 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
const assert = require('node:assert/strict');
|
|
4
|
+
const fs = require('node:fs');
|
|
5
|
+
const os = require('node:os');
|
|
6
|
+
const path = require('node:path');
|
|
7
|
+
const { test } = require('node:test');
|
|
8
|
+
const observations = require('../hooks/scripts/lib/observations');
|
|
9
|
+
const { collect } = require('../scripts/system-one-cycle/collect');
|
|
10
|
+
|
|
11
|
+
const ROOT = path.resolve(__dirname, '..');
|
|
12
|
+
const VALID = '<!-- harness-label {"v":1,"validity":"actionable","tier":"tier2","intents":["fix"],"workflow":"iterative-single","skills":[]} -->';
|
|
13
|
+
const VALID_INVALID = '<!-- harness-label {"v":1,"validity":"invalid","tier":null,"intents":[],"workflow":null,"skills":[]} -->';
|
|
14
|
+
const MALFORMED = '<!-- harness-label {"v":1,"validity":"unknown","tier":"tier2","intents":[],"workflow":null,"skills":[]} -->';
|
|
15
|
+
|
|
16
|
+
function capture(store, host, session, prompt, final, turnId = `${session}-turn`) {
|
|
17
|
+
const env = {
|
|
18
|
+
HARNESS_OBSERVATIONS: 'on',
|
|
19
|
+
HARNESS_OBSERVATIONS_DIR: store,
|
|
20
|
+
};
|
|
21
|
+
const base = { host, session_id: session, turn_id: turnId, cwd: store };
|
|
22
|
+
observations.handle({ ...base, hook_event_name: 'UserPromptSubmit', prompt }, env);
|
|
23
|
+
observations.handle({ ...base, hook_event_name: 'Stop', last_assistant_message: final }, env);
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
function atTime(timestamp, callback) {
|
|
27
|
+
const NativeDate = global.Date;
|
|
28
|
+
global.Date = class extends NativeDate {
|
|
29
|
+
constructor(...args) { super(...(args.length ? args : [timestamp])); }
|
|
30
|
+
static now() { return timestamp; }
|
|
31
|
+
};
|
|
32
|
+
try { callback(); } finally { global.Date = NativeDate; }
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
function jsonl(file) {
|
|
36
|
+
return fs.readFileSync(file, 'utf8').split(/\r?\n/).filter(Boolean).map(JSON.parse);
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
test('collect retains unique, date-scoped per-host label acceptance before training filters', { concurrency: false }, () => {
|
|
40
|
+
const dir = fs.mkdtempSync(path.join(process.env.TMPDIR || os.tmpdir(), 'system-one-host-acceptance-'));
|
|
41
|
+
const relative = path.relative(fs.realpathSync.native(ROOT), fs.realpathSync.native(dir));
|
|
42
|
+
assert.ok(relative === '..' || relative.startsWith(`..${path.sep}`) || path.isAbsolute(relative), 'fixtures stay outside the checkout');
|
|
43
|
+
const dataDir = path.join(dir, 'cycle');
|
|
44
|
+
const training = path.join(dataDir, 'training');
|
|
45
|
+
const store = path.join(training, 'observation-store');
|
|
46
|
+
const sessions = path.join(dir, 'empty-codex-sessions');
|
|
47
|
+
const tmp = path.join(dir, 'tmp');
|
|
48
|
+
fs.mkdirSync(sessions, { recursive: true });
|
|
49
|
+
fs.mkdirSync(tmp);
|
|
50
|
+
|
|
51
|
+
const envKeys = ['HOME', 'USERPROFILE', 'CODEX_HOME', 'HARNESS_STATE_HOME', 'HARNESS_OBSERVATIONS_DIR', 'HARNESS_OBSERVATIONS', 'TMPDIR', 'TEMP', 'TMP'];
|
|
52
|
+
const previousEnv = Object.fromEntries(envKeys.map(key => [key, process.env[key]]));
|
|
53
|
+
const home = path.join(dir, 'home');
|
|
54
|
+
fs.mkdirSync(home);
|
|
55
|
+
Object.assign(process.env, {
|
|
56
|
+
HOME: home,
|
|
57
|
+
USERPROFILE: home,
|
|
58
|
+
CODEX_HOME: path.join(home, '.codex'),
|
|
59
|
+
HARNESS_STATE_HOME: path.join(home, '.harness-state'),
|
|
60
|
+
HARNESS_OBSERVATIONS_DIR: store,
|
|
61
|
+
HARNESS_OBSERVATIONS: 'on',
|
|
62
|
+
TMPDIR: tmp,
|
|
63
|
+
TEMP: tmp,
|
|
64
|
+
TMP: tmp,
|
|
65
|
+
});
|
|
66
|
+
|
|
67
|
+
try {
|
|
68
|
+
const since = new Date().toISOString().slice(0, 10);
|
|
69
|
+
const cutoff = Date.parse(`${since}T00:00:00.000Z`);
|
|
70
|
+
atTime(cutoff - 1000, () => capture(store, 'codex', 'before-cutoff', 'PRE_CUTOFF_PROMPT_397', VALID));
|
|
71
|
+
|
|
72
|
+
capture(store, 'opencode', 'valid-one', 'PROMPT_SENTINEL_397', `FINAL_MESSAGE_SENTINEL_397 SECRET_SENTINEL_397\n${VALID}`, 'valid-one-turn');
|
|
73
|
+
capture(store, 'opencode', 'valid-two', 'accepted-invalid-validity', VALID_INVALID);
|
|
74
|
+
capture(store, 'opencode', 'malformed', 'malformed-label-prompt', MALFORMED);
|
|
75
|
+
capture(store, 'opencode', 'missing', 'missing-label-prompt', 'FINAL_MESSAGE_SENTINEL_397 without a label');
|
|
76
|
+
capture(store, 'opencode', 'valid-one', 'PROMPT_SENTINEL_397 replay', `FINAL_MESSAGE_SENTINEL_397 SECRET_SENTINEL_397\n${VALID}`, 'valid-one-turn');
|
|
77
|
+
capture(store, 'claude', 'claude-missing-one', 'claude-missing-one-prompt', 'No label');
|
|
78
|
+
capture(store, 'claude', 'claude-missing-two', 'claude-missing-two-prompt', 'No label');
|
|
79
|
+
|
|
80
|
+
const index = JSON.parse(fs.readFileSync(path.join(store, 'observations-index.json'), 'utf8'));
|
|
81
|
+
assert.equal(index.records.length, 7, 'replaying a turn does not create a second stored row');
|
|
82
|
+
|
|
83
|
+
const sinceNextDay = new Date(cutoff + 86_400_000).toISOString().slice(0, 10);
|
|
84
|
+
const result = collect({ dataDir, since, sessionsDir: sessions });
|
|
85
|
+
const observed = path.join(training, 'observed');
|
|
86
|
+
const reportBytes = fs.readFileSync(path.join(observed, 'export-report.json'), 'utf8');
|
|
87
|
+
const report = JSON.parse(reportBytes);
|
|
88
|
+
const expected = {
|
|
89
|
+
opencode: { eligible: 4, valid: 2, invalid: 1, missing: 1, acceptanceRate: 0.5 },
|
|
90
|
+
claude: { eligible: 2, valid: 0, invalid: 0, missing: 2, acceptanceRate: 0 },
|
|
91
|
+
codex: { eligible: 0, valid: 0, invalid: 0, missing: 0, acceptanceRate: null },
|
|
92
|
+
};
|
|
93
|
+
|
|
94
|
+
assert.deepEqual(report.hostAcceptance, { population: 'stored-observations', byHost: expected });
|
|
95
|
+
assert.equal(result.prompts, 2, 'only the two labeled, text-available OpenCode rows enter training');
|
|
96
|
+
assert.equal(jsonl(path.join(observed, 'prompts-observed.jsonl')).length, 2);
|
|
97
|
+
assert.doesNotMatch(reportBytes, /PROMPT_SENTINEL_397|PRE_CUTOFF_PROMPT_397|FINAL_MESSAGE_SENTINEL_397|SECRET_SENTINEL_397/);
|
|
98
|
+
|
|
99
|
+
const validRecord = index.records.find(record => record.writer.sessionId === 'valid-one');
|
|
100
|
+
fs.unlinkSync(path.join(store, 'text', `${validRecord.contentSha256}.json`));
|
|
101
|
+
const afterTextRemoval = collect({ dataDir, since, sessionsDir: sessions });
|
|
102
|
+
const retained = JSON.parse(fs.readFileSync(path.join(observed, 'export-report.json'), 'utf8'));
|
|
103
|
+
assert.deepEqual(retained.hostAcceptance, report.hostAcceptance, 'coverage remains independent of text availability');
|
|
104
|
+
assert.equal(afterTextRemoval.prompts, 1, 'training rows fall when one prompt text is unavailable');
|
|
105
|
+
assert.equal(retained.exported, 1);
|
|
106
|
+
|
|
107
|
+
const emptySince = collect({ dataDir, since: sinceNextDay, sessionsDir: sessions });
|
|
108
|
+
assert.equal(emptySince.prompts, 0);
|
|
109
|
+
const emptyReport = JSON.parse(fs.readFileSync(path.join(observed, 'export-report.json'), 'utf8'));
|
|
110
|
+
assert.deepEqual(emptyReport.hostAcceptance.byHost.opencode,
|
|
111
|
+
{ eligible: 0, valid: 0, invalid: 0, missing: 0, acceptanceRate: null }, 'zero eligible rows produce a null acceptance rate');
|
|
112
|
+
} finally {
|
|
113
|
+
for (const [key, value] of Object.entries(previousEnv)) {
|
|
114
|
+
if (value === undefined) delete process.env[key];
|
|
115
|
+
else process.env[key] = value;
|
|
116
|
+
}
|
|
117
|
+
fs.rmSync(dir, { recursive: true, force: true });
|
|
118
|
+
}
|
|
119
|
+
});
|