harness-everything 1.4.0 → 1.5.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.claude-plugin/marketplace.json +1 -1
- package/.claude-plugin/plugin.json +1 -1
- package/.github/workflows/ci.yml +16 -0
- package/.github/workflows/release.yml +16 -5
- package/CHANGELOG.md +33 -0
- package/benchmarks/results/error-ledger-oracle-484-pilot/README.md +57 -0
- package/benchmarks/results/error-ledger-oracle-484-pilot/candidates.json +22802 -0
- package/benchmarks/results/error-ledger-oracle-484-pilot/labels.json +131 -0
- package/benchmarks/results/error-ledger-oracle-484-pilot/oracle.json +362 -0
- package/benchmarks/results/error-ledger-oracle-484-pilot/rows.json +648 -0
- package/benchmarks/results/error-ledger-oracle-484-pilot/sample.json +215 -0
- package/benchmarks/results/error-ledger-oracle-484-pilot/select.js +127 -0
- package/ci/fixtures/system-one-colab-fit-layer-sitecustomize.py +72 -0
- package/ci/mechanism-2x-release-automation.test.js +17 -0
- package/ci/mechanism-349-ci-change-scope.test.js +69 -1
- package/ci/mechanism-548-bigint-identity.test.js +1 -1
- package/ci/mechanism-571-fit-guard.test.js +165 -0
- package/ci/mechanism-571-nll-labels.test.js +79 -0
- package/ci/mechanism-system-one-colab.test.js +83 -5
- package/ci/mechanism-system-one-contract.test.js +30 -0
- package/ci/mechanism-system-one-curves.test.js +91 -0
- package/ci/mechanism-system-one-cycle.test.js +417 -34
- package/ci/mechanism-system-one-install.test.js +47 -0
- package/ci/mechanism-system-one-provider.test.js +2 -0
- package/ci/mechanism-system-one-resident.test.js +69 -0
- package/ci/system-one-adapter-test.py +86 -0
- package/ci/system-one-fit-layer-test.py +371 -0
- package/ci/system-one-layer-test.py +122 -0
- package/harness-everything/SKILL.md +1 -1
- package/harness-everything/scripts/system-one/cua_adapter.py +36 -1
- package/harness-everything/scripts/system-one/install.js +10 -0
- package/harness-everything/scripts/system-one/layer.py +188 -0
- package/harness-everything/scripts/system-one/manifest.js +8 -1
- package/harness-everything/scripts/system-one/provider.js +12 -2
- package/opencode-plugin/plugin.json +1 -1
- package/package.json +1 -1
- package/plugins/harness-everything/.antigravity-plugin/plugin.json +1 -1
- package/plugins/harness-everything/.codex-plugin/plugin.json +1 -1
- package/plugins/harness-everything/plugin.json +1 -1
- package/plugins/harness-everything/skills/harness-everything/SKILL.md +1 -1
- package/plugins/harness-everything/skills/harness-everything/scripts/system-one/cua_adapter.py +36 -1
- package/plugins/harness-everything/skills/harness-everything/scripts/system-one/install.js +10 -0
- package/plugins/harness-everything/skills/harness-everything/scripts/system-one/layer.py +188 -0
- package/plugins/harness-everything/skills/harness-everything/scripts/system-one/manifest.js +8 -1
- package/plugins/harness-everything/skills/harness-everything/scripts/system-one/provider.js +12 -2
- package/sbom.cdx.json +7 -7
- package/scripts/system-one-colab.js +6 -4
- package/scripts/system-one-curves.js +114 -13
- package/scripts/system-one-cycle/evaluate.js +72 -9
- package/scripts/system-one-cycle/package.js +61 -3
- package/scripts/system-one-cycle/score.py +23 -2
- package/scripts/system-one-cycle/train.js +254 -20
- package/scripts/system-one-fit-layer.py +379 -0
|
@@ -0,0 +1,215 @@
|
|
|
1
|
+
{
|
|
2
|
+
"seed": 484,
|
|
3
|
+
"method": "proportional largest-remainder allocation per link group (15 path-linked, 15 unmatched); deterministic SHA-256(seed:stratum:candidateId) ranking within each stratum",
|
|
4
|
+
"reportPath": "candidates.json",
|
|
5
|
+
"reportSha256": "b70289fa09c00402b7ce211a18f2e338fba078ac545d75ced98f8142e527a6c0",
|
|
6
|
+
"populationTotal": 491,
|
|
7
|
+
"sampleTotal": 30,
|
|
8
|
+
"strata": [
|
|
9
|
+
{
|
|
10
|
+
"stratum": "path-linked × git",
|
|
11
|
+
"population": 33,
|
|
12
|
+
"sampled": 13
|
|
13
|
+
},
|
|
14
|
+
{
|
|
15
|
+
"stratum": "path-linked × doc",
|
|
16
|
+
"population": 4,
|
|
17
|
+
"sampled": 2
|
|
18
|
+
},
|
|
19
|
+
{
|
|
20
|
+
"stratum": "unmatched × git",
|
|
21
|
+
"population": 357,
|
|
22
|
+
"sampled": 12
|
|
23
|
+
},
|
|
24
|
+
{
|
|
25
|
+
"stratum": "unmatched × doc",
|
|
26
|
+
"population": 97,
|
|
27
|
+
"sampled": 3
|
|
28
|
+
}
|
|
29
|
+
],
|
|
30
|
+
"selected": [
|
|
31
|
+
{
|
|
32
|
+
"candidateId": "45d051e778e4a8dd8708",
|
|
33
|
+
"stratum": "path-linked × git",
|
|
34
|
+
"linkedRecords": [
|
|
35
|
+
"E-0011"
|
|
36
|
+
]
|
|
37
|
+
},
|
|
38
|
+
{
|
|
39
|
+
"candidateId": "478a08b6ba1dc1cf50d1",
|
|
40
|
+
"stratum": "path-linked × git",
|
|
41
|
+
"linkedRecords": [
|
|
42
|
+
"E-0008"
|
|
43
|
+
]
|
|
44
|
+
},
|
|
45
|
+
{
|
|
46
|
+
"candidateId": "62cfa74becdfe79f89b5",
|
|
47
|
+
"stratum": "path-linked × git",
|
|
48
|
+
"linkedRecords": [
|
|
49
|
+
"E-0025"
|
|
50
|
+
]
|
|
51
|
+
},
|
|
52
|
+
{
|
|
53
|
+
"candidateId": "69914bbebe41099cc716",
|
|
54
|
+
"stratum": "path-linked × git",
|
|
55
|
+
"linkedRecords": [
|
|
56
|
+
"E-0019"
|
|
57
|
+
]
|
|
58
|
+
},
|
|
59
|
+
{
|
|
60
|
+
"candidateId": "6d6e5944548fb0a96f50",
|
|
61
|
+
"stratum": "path-linked × git",
|
|
62
|
+
"linkedRecords": [
|
|
63
|
+
"E-0018"
|
|
64
|
+
]
|
|
65
|
+
},
|
|
66
|
+
{
|
|
67
|
+
"candidateId": "6f2e567c16cebeef896b",
|
|
68
|
+
"stratum": "path-linked × git",
|
|
69
|
+
"linkedRecords": [
|
|
70
|
+
"E-0015"
|
|
71
|
+
]
|
|
72
|
+
},
|
|
73
|
+
{
|
|
74
|
+
"candidateId": "78ce8199ae9a54ce3a89",
|
|
75
|
+
"stratum": "path-linked × git",
|
|
76
|
+
"linkedRecords": [
|
|
77
|
+
"E-0027",
|
|
78
|
+
"E-0030"
|
|
79
|
+
]
|
|
80
|
+
},
|
|
81
|
+
{
|
|
82
|
+
"candidateId": "8e9585a2d2ddb90bb769",
|
|
83
|
+
"stratum": "path-linked × git",
|
|
84
|
+
"linkedRecords": [
|
|
85
|
+
"E-0033"
|
|
86
|
+
]
|
|
87
|
+
},
|
|
88
|
+
{
|
|
89
|
+
"candidateId": "9160683c3b0e52c21e10",
|
|
90
|
+
"stratum": "path-linked × git",
|
|
91
|
+
"linkedRecords": [
|
|
92
|
+
"E-0027",
|
|
93
|
+
"E-0028"
|
|
94
|
+
]
|
|
95
|
+
},
|
|
96
|
+
{
|
|
97
|
+
"candidateId": "aa89e5143ab82b6916d4",
|
|
98
|
+
"stratum": "path-linked × git",
|
|
99
|
+
"linkedRecords": [
|
|
100
|
+
"E-0021"
|
|
101
|
+
]
|
|
102
|
+
},
|
|
103
|
+
{
|
|
104
|
+
"candidateId": "beeb0fa4e47a37509580",
|
|
105
|
+
"stratum": "path-linked × git",
|
|
106
|
+
"linkedRecords": [
|
|
107
|
+
"E-0001",
|
|
108
|
+
"E-0005"
|
|
109
|
+
]
|
|
110
|
+
},
|
|
111
|
+
{
|
|
112
|
+
"candidateId": "c984088a317ec58c3de8",
|
|
113
|
+
"stratum": "path-linked × git",
|
|
114
|
+
"linkedRecords": [
|
|
115
|
+
"E-0007"
|
|
116
|
+
]
|
|
117
|
+
},
|
|
118
|
+
{
|
|
119
|
+
"candidateId": "e61a37c27572f5069b29",
|
|
120
|
+
"stratum": "path-linked × git",
|
|
121
|
+
"linkedRecords": [
|
|
122
|
+
"E-0011"
|
|
123
|
+
]
|
|
124
|
+
},
|
|
125
|
+
{
|
|
126
|
+
"candidateId": "50ffd71f8ff5182e630b",
|
|
127
|
+
"stratum": "path-linked × doc",
|
|
128
|
+
"linkedRecords": [
|
|
129
|
+
"E-0005"
|
|
130
|
+
]
|
|
131
|
+
},
|
|
132
|
+
{
|
|
133
|
+
"candidateId": "9da2bae6b84ba193e58b",
|
|
134
|
+
"stratum": "path-linked × doc",
|
|
135
|
+
"linkedRecords": [
|
|
136
|
+
"E-0005"
|
|
137
|
+
]
|
|
138
|
+
},
|
|
139
|
+
{
|
|
140
|
+
"candidateId": "0c8f33d06ee587e50f40",
|
|
141
|
+
"stratum": "unmatched × git",
|
|
142
|
+
"linkedRecords": []
|
|
143
|
+
},
|
|
144
|
+
{
|
|
145
|
+
"candidateId": "1d2dcb41e9c9effe0153",
|
|
146
|
+
"stratum": "unmatched × git",
|
|
147
|
+
"linkedRecords": []
|
|
148
|
+
},
|
|
149
|
+
{
|
|
150
|
+
"candidateId": "4793e1ba321f1eaf61fc",
|
|
151
|
+
"stratum": "unmatched × git",
|
|
152
|
+
"linkedRecords": []
|
|
153
|
+
},
|
|
154
|
+
{
|
|
155
|
+
"candidateId": "4ed3a55659580a9cfacc",
|
|
156
|
+
"stratum": "unmatched × git",
|
|
157
|
+
"linkedRecords": []
|
|
158
|
+
},
|
|
159
|
+
{
|
|
160
|
+
"candidateId": "58867ac2fb868297d2ee",
|
|
161
|
+
"stratum": "unmatched × git",
|
|
162
|
+
"linkedRecords": []
|
|
163
|
+
},
|
|
164
|
+
{
|
|
165
|
+
"candidateId": "642fb0dce2c044d55dec",
|
|
166
|
+
"stratum": "unmatched × git",
|
|
167
|
+
"linkedRecords": []
|
|
168
|
+
},
|
|
169
|
+
{
|
|
170
|
+
"candidateId": "6f597dd3781996ac7163",
|
|
171
|
+
"stratum": "unmatched × git",
|
|
172
|
+
"linkedRecords": []
|
|
173
|
+
},
|
|
174
|
+
{
|
|
175
|
+
"candidateId": "6f7c48d023be8ad0c2a1",
|
|
176
|
+
"stratum": "unmatched × git",
|
|
177
|
+
"linkedRecords": []
|
|
178
|
+
},
|
|
179
|
+
{
|
|
180
|
+
"candidateId": "89a06536ca2df52ae75a",
|
|
181
|
+
"stratum": "unmatched × git",
|
|
182
|
+
"linkedRecords": []
|
|
183
|
+
},
|
|
184
|
+
{
|
|
185
|
+
"candidateId": "c51c52ee604590858cd3",
|
|
186
|
+
"stratum": "unmatched × git",
|
|
187
|
+
"linkedRecords": []
|
|
188
|
+
},
|
|
189
|
+
{
|
|
190
|
+
"candidateId": "d7f7d99b6733c0040302",
|
|
191
|
+
"stratum": "unmatched × git",
|
|
192
|
+
"linkedRecords": []
|
|
193
|
+
},
|
|
194
|
+
{
|
|
195
|
+
"candidateId": "f8bc9347d5d53dee97f2",
|
|
196
|
+
"stratum": "unmatched × git",
|
|
197
|
+
"linkedRecords": []
|
|
198
|
+
},
|
|
199
|
+
{
|
|
200
|
+
"candidateId": "9120f29cf0711398d4af",
|
|
201
|
+
"stratum": "unmatched × doc",
|
|
202
|
+
"linkedRecords": []
|
|
203
|
+
},
|
|
204
|
+
{
|
|
205
|
+
"candidateId": "b6311421eb778e728eb3",
|
|
206
|
+
"stratum": "unmatched × doc",
|
|
207
|
+
"linkedRecords": []
|
|
208
|
+
},
|
|
209
|
+
{
|
|
210
|
+
"candidateId": "e2a835a2fe9918dc86f1",
|
|
211
|
+
"stratum": "unmatched × doc",
|
|
212
|
+
"linkedRecords": []
|
|
213
|
+
}
|
|
214
|
+
]
|
|
215
|
+
}
|
|
@@ -0,0 +1,127 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
'use strict';
|
|
3
|
+
|
|
4
|
+
const crypto = require('node:crypto');
|
|
5
|
+
const fs = require('node:fs');
|
|
6
|
+
|
|
7
|
+
const SEED = 484;
|
|
8
|
+
const REPORT_PATH = 'candidates.json';
|
|
9
|
+
const ORACLE_PATH = 'oracle-nolabels.json';
|
|
10
|
+
const OUT_PATH = 'sample.json';
|
|
11
|
+
const GROUP_TARGETS = { 'path-linked': 15, unmatched: 15 };
|
|
12
|
+
|
|
13
|
+
function sha256Hex(bufferOrString) {
|
|
14
|
+
return crypto.createHash('sha256').update(bufferOrString).digest('hex');
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
function allocateProportional(stratumCounts, totalTarget) {
|
|
18
|
+
const entries = Object.entries(stratumCounts).sort((a, b) => a[0].localeCompare(b[0]));
|
|
19
|
+
const totalPop = entries.reduce((sum, [, count]) => sum + count, 0);
|
|
20
|
+
if (totalPop <= totalTarget) {
|
|
21
|
+
return Object.fromEntries(entries.map(([k, count]) => [k, count]));
|
|
22
|
+
}
|
|
23
|
+
const exact = entries.map(([k, count]) => ({
|
|
24
|
+
key: k,
|
|
25
|
+
pop: count,
|
|
26
|
+
exact: (totalTarget * count) / totalPop
|
|
27
|
+
}));
|
|
28
|
+
const alloc = Object.fromEntries(exact.map(item => [item.key, Math.floor(item.exact)]));
|
|
29
|
+
let remaining = totalTarget - Object.values(alloc).reduce((a, b) => a + b, 0);
|
|
30
|
+
// Largest-remainder method, tie-breaking lexicographically by stratum key
|
|
31
|
+
const remainders = exact
|
|
32
|
+
.map(item => ({ key: item.key, rem: item.exact - Math.floor(item.exact), pop: item.pop }))
|
|
33
|
+
.sort((a, b) => (b.rem - a.rem) || a.key.localeCompare(b.key));
|
|
34
|
+
for (const item of remainders) {
|
|
35
|
+
if (remaining <= 0) break;
|
|
36
|
+
if (alloc[item.key] < item.pop) {
|
|
37
|
+
alloc[item.key] += 1;
|
|
38
|
+
remaining -= 1;
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
return alloc;
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
function main() {
|
|
45
|
+
const reportBytes = fs.readFileSync(REPORT_PATH);
|
|
46
|
+
const reportSha256 = sha256Hex(reportBytes);
|
|
47
|
+
const report = JSON.parse(reportBytes.toString('utf8'));
|
|
48
|
+
const oracle = JSON.parse(fs.readFileSync(ORACLE_PATH, 'utf8'));
|
|
49
|
+
|
|
50
|
+
const linkedByCandidate = new Map();
|
|
51
|
+
for (const rec of oracle.linked) {
|
|
52
|
+
for (const cid of rec.candidateIds) {
|
|
53
|
+
const list = linkedByCandidate.get(cid) || [];
|
|
54
|
+
list.push(rec.id);
|
|
55
|
+
linkedByCandidate.set(cid, list);
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
for (const list of linkedByCandidate.values()) list.sort();
|
|
59
|
+
|
|
60
|
+
const strata = {
|
|
61
|
+
'path-linked × git': [],
|
|
62
|
+
'path-linked × doc': [],
|
|
63
|
+
'unmatched × git': [],
|
|
64
|
+
'unmatched × doc': []
|
|
65
|
+
};
|
|
66
|
+
|
|
67
|
+
for (const candidate of report.candidates) {
|
|
68
|
+
const linkGroup = linkedByCandidate.has(candidate.id) ? 'path-linked' : 'unmatched';
|
|
69
|
+
const sourceTypes = [...new Set(candidate.sources.map(s => s.type))].sort();
|
|
70
|
+
if (sourceTypes.length !== 1 || !['git', 'doc'].includes(sourceTypes[0])) {
|
|
71
|
+
throw new Error(`Unexpected source types for ${candidate.id}: ${sourceTypes.join(',')}`);
|
|
72
|
+
}
|
|
73
|
+
const key = `${linkGroup} × ${sourceTypes[0]}`;
|
|
74
|
+
strata[key].push(candidate.id);
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
for (const ids of Object.values(strata)) ids.sort();
|
|
78
|
+
|
|
79
|
+
const pathLinkedAlloc = allocateProportional(
|
|
80
|
+
{ 'path-linked × git': strata['path-linked × git'].length, 'path-linked × doc': strata['path-linked × doc'].length },
|
|
81
|
+
GROUP_TARGETS['path-linked']
|
|
82
|
+
);
|
|
83
|
+
const unmatchedAlloc = allocateProportional(
|
|
84
|
+
{ 'unmatched × git': strata['unmatched × git'].length, 'unmatched × doc': strata['unmatched × doc'].length },
|
|
85
|
+
GROUP_TARGETS.unmatched
|
|
86
|
+
);
|
|
87
|
+
const targetByStratum = { ...pathLinkedAlloc, ...unmatchedAlloc };
|
|
88
|
+
|
|
89
|
+
const selected = [];
|
|
90
|
+
const stratumSummary = [];
|
|
91
|
+
for (const stratum of ['path-linked × git', 'path-linked × doc', 'unmatched × git', 'unmatched × doc']) {
|
|
92
|
+
const pool = strata[stratum];
|
|
93
|
+
const k = targetByStratum[stratum];
|
|
94
|
+
const ranked = pool
|
|
95
|
+
.map(id => ({ id, rank: sha256Hex(`${SEED}:${stratum}:${id}`) }))
|
|
96
|
+
.sort((a, b) => a.rank.localeCompare(b.rank) || a.id.localeCompare(b.id));
|
|
97
|
+
const chosen = ranked.slice(0, k).map(item => item.id).sort();
|
|
98
|
+
stratumSummary.push({
|
|
99
|
+
stratum,
|
|
100
|
+
population: pool.length,
|
|
101
|
+
sampled: chosen.length
|
|
102
|
+
});
|
|
103
|
+
for (const id of chosen) {
|
|
104
|
+
selected.push({
|
|
105
|
+
candidateId: id,
|
|
106
|
+
stratum,
|
|
107
|
+
linkedRecords: linkedByCandidate.get(id) || []
|
|
108
|
+
});
|
|
109
|
+
}
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
const output = {
|
|
113
|
+
seed: SEED,
|
|
114
|
+
method: 'proportional largest-remainder allocation per link group (15 path-linked, 15 unmatched); deterministic SHA-256(seed:stratum:candidateId) ranking within each stratum',
|
|
115
|
+
reportPath: REPORT_PATH,
|
|
116
|
+
reportSha256,
|
|
117
|
+
populationTotal: report.candidates.length,
|
|
118
|
+
sampleTotal: selected.length,
|
|
119
|
+
strata: stratumSummary,
|
|
120
|
+
selected
|
|
121
|
+
};
|
|
122
|
+
|
|
123
|
+
fs.writeFileSync(OUT_PATH, `${JSON.stringify(output, null, 2)}\n`);
|
|
124
|
+
process.stdout.write(`${JSON.stringify({ ok: true, out: OUT_PATH, strata: stratumSummary, sampleTotal: selected.length })}\n`);
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
main();
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
"""Controlled fitter output for the System One Colab launcher mechanism test."""
|
|
2
|
+
import hashlib
|
|
3
|
+
import json
|
|
4
|
+
import os
|
|
5
|
+
from pathlib import Path
|
|
6
|
+
import sys
|
|
7
|
+
|
|
8
|
+
_FITTER = os.environ.get('S1_COLAB_FIT_LAYER_SCRIPT')
|
|
9
|
+
if (_FITTER and sys.argv and os.path.normcase(os.path.realpath(sys.argv[0]))
|
|
10
|
+
== os.path.normcase(os.path.realpath(_FITTER))
|
|
11
|
+
and os.environ.get('S1_COLAB_FIT_LAYER_FIXTURE') == '1'):
|
|
12
|
+
try:
|
|
13
|
+
names = ('--run-dir', '--data-dir', '--task', '--holdout')
|
|
14
|
+
args = sys.argv[1:]
|
|
15
|
+
if len(args) != len(names) * 2:
|
|
16
|
+
raise ValueError('expected run-dir, data-dir, task, and holdout exactly once')
|
|
17
|
+
values = {}
|
|
18
|
+
for name, value in zip(args[::2], args[1::2]):
|
|
19
|
+
if name not in names or name in values or not value:
|
|
20
|
+
raise ValueError('expected run-dir, data-dir, task, and holdout exactly once')
|
|
21
|
+
values[name] = value
|
|
22
|
+
if set(values) != set(names):
|
|
23
|
+
raise ValueError('expected run-dir, data-dir, task, and holdout exactly once')
|
|
24
|
+
|
|
25
|
+
run_dir = Path(values['--run-dir'])
|
|
26
|
+
data_dir = Path(values['--data-dir'])
|
|
27
|
+
task = values['--task']
|
|
28
|
+
if task not in ('validity', 'intent', 'tier'):
|
|
29
|
+
raise ValueError('unknown fixture task')
|
|
30
|
+
report_path = run_dir / 'train-report.json'
|
|
31
|
+
report = json.loads(report_path.read_text(encoding='utf-8'))
|
|
32
|
+
if report.get('task') != task or not isinstance(report.get('catalog'), list):
|
|
33
|
+
raise ValueError('fixture trainer report is invalid')
|
|
34
|
+
checkpoint_path = run_dir / 'harness-routing-v1.safetensors'
|
|
35
|
+
scores_path = run_dir / 'val-scores.jsonl'
|
|
36
|
+
for required in (checkpoint_path, scores_path, Path(values['--holdout'])):
|
|
37
|
+
if not required.is_file():
|
|
38
|
+
raise ValueError('fixture fitter input is missing')
|
|
39
|
+
|
|
40
|
+
digest = lambda file: hashlib.sha256(Path(file).read_bytes()).hexdigest()
|
|
41
|
+
label_file = 'labels-intent.jsonl' if task == 'intent' else 'labels.jsonl'
|
|
42
|
+
datasets = {name: digest(data_dir / name) for name in ('prompts.jsonl', label_file)}
|
|
43
|
+
validation = [json.loads(line) for line in scores_path.read_text(encoding='utf-8').splitlines() if line.strip()]
|
|
44
|
+
layered_path = run_dir / 'val-scores-layered.jsonl'
|
|
45
|
+
layered_path.write_text(''.join(json.dumps(row, separators=(',', ':')) + '\n' for row in validation), encoding='utf-8')
|
|
46
|
+
layer_path = run_dir / 'layer.json'
|
|
47
|
+
layer_path.write_text(json.dumps({
|
|
48
|
+
'schemaVersion': 1, 'kind': 'echl-h', 'stage': task, 'options': report['catalog'],
|
|
49
|
+
'temperature': 1, 'bias': None, 'alpha': 0, 'k': 15, 'ngrams': [3, 4, 5],
|
|
50
|
+
'maxChars': 2000, 'index': [],
|
|
51
|
+
'fit': {'candidate': 'H-temp', 'heldOutRows': len(validation), 'nll': 0.2, 'baseNll': 0.3, 'oof': True},
|
|
52
|
+
}, separators=(',', ':')) + '\n', encoding='utf-8')
|
|
53
|
+
outcome = {
|
|
54
|
+
'schemaVersion': 1, 'task': task, 'outcome': 'layer', 'datasetSha256': datasets,
|
|
55
|
+
'checkpointSha256': digest(checkpoint_path), 'checkpointConfigSha256': digest(run_dir / 'harness-routing-v1.json'),
|
|
56
|
+
'trainerReportSha256': digest(report_path),
|
|
57
|
+
'holdoutSha256': digest(values['--holdout']), 'validationIds': [row['id'] for row in validation],
|
|
58
|
+
'folds': [], 'candidate': 'H-temp', 'temperature': 1, 'alpha': 0,
|
|
59
|
+
'baseNll': 0.3, 'selectedNll': 0.2, 'layerSha256': digest(layer_path),
|
|
60
|
+
'calibrationInput': 'val-scores-layered.jsonl', 'calibrationInputSha256': digest(layered_path),
|
|
61
|
+
}
|
|
62
|
+
(run_dir / 'layer-outcome.json').write_text(json.dumps(outcome, indent=2) + '\n', encoding='utf-8')
|
|
63
|
+
with open(os.environ['S1_COLAB_FIT_LAYER_LOG'], 'a', encoding='utf-8') as stream:
|
|
64
|
+
stream.write(json.dumps({'task': task, 'runDir': str(run_dir)}) + '\n')
|
|
65
|
+
except Exception as error:
|
|
66
|
+
sys.stderr.write('S1 Colab fixture fitter: ' + str(error) + '\n')
|
|
67
|
+
sys.stderr.flush()
|
|
68
|
+
sys.stdout.flush()
|
|
69
|
+
os._exit(2)
|
|
70
|
+
sys.stdout.flush()
|
|
71
|
+
sys.stderr.flush()
|
|
72
|
+
os._exit(0)
|
|
@@ -14,6 +14,23 @@ assert.deepStrictEqual(config.branches, ['main']);
|
|
|
14
14
|
assert.ok(config.branches.every(branch => typeof branch === 'string'), 'release branches must not declare prerelease channels');
|
|
15
15
|
assert.strictEqual(config.tagFormat, 'v${version}');
|
|
16
16
|
|
|
17
|
+
// The npm release must authenticate through the trusted workflow identity only.
|
|
18
|
+
const releaseWorkflow = require('js-yaml').load(fs.readFileSync(path.join(ROOT, '.github/workflows/release.yml'), 'utf8'));
|
|
19
|
+
const releaseJob = releaseWorkflow.jobs.release;
|
|
20
|
+
assert.strictEqual(releaseWorkflow.permissions['id-token'], 'none', 'non-publishing jobs must not inherit OIDC permission');
|
|
21
|
+
assert.strictEqual(releaseJob.permissions['id-token'], 'write', 'publish job must have OIDC permission');
|
|
22
|
+
const setupNode = releaseJob.steps.find(step => step.uses && step.uses.startsWith('actions/setup-node@'));
|
|
23
|
+
assert.ok(setupNode, 'release Node setup is required');
|
|
24
|
+
assert.strictEqual(setupNode.with['package-manager-cache'], false, 'release build must not use dependency caching');
|
|
25
|
+
assert.ok(!Object.hasOwn(setupNode.with, 'registry-url'), 'setup-node must not create a token-based npmrc for semantic-release');
|
|
26
|
+
const publish = releaseJob.steps.find(step => step.run && step.run.includes('npx --no-install semantic-release'));
|
|
27
|
+
assert.ok(publish, 'semantic-release publish step is required');
|
|
28
|
+
for (const key of ['NPM_TOKEN', 'NODE_AUTH_TOKEN']) {
|
|
29
|
+
assert.ok(!Object.hasOwn(publish.env || {}, key), `publish must not inject ${key}`);
|
|
30
|
+
assert.ok(!Object.hasOwn(releaseJob.env || {}, key), `release job must not inject ${key}`);
|
|
31
|
+
assert.ok(!Object.hasOwn(releaseWorkflow.env || {}, key), `release workflow must not inject ${key}`);
|
|
32
|
+
}
|
|
33
|
+
|
|
17
34
|
const analyzer = config.plugins.find(plugin => Array.isArray(plugin) && plugin[0] === '@semantic-release/commit-analyzer');
|
|
18
35
|
assert.ok(analyzer, 'commit analyzer configuration missing');
|
|
19
36
|
const rules = new Map(analyzer[1].releaseRules.filter(rule => rule.type).map(rule => [rule.type, rule.release]));
|
|
@@ -12,7 +12,14 @@ const { classifyPaths, classifyChangeSet } = require('../scripts/ci-change-scope
|
|
|
12
12
|
const ROOT = path.resolve(__dirname, '..');
|
|
13
13
|
const SCRIPT = path.join(ROOT, 'scripts', 'ci-change-scope.js');
|
|
14
14
|
const CHANGE_SCOPE_JOB = 'ci-change-scope';
|
|
15
|
+
const SELF_REGRESSION_GATE = 'self-regression-gate';
|
|
15
16
|
const SELF_REGRESSION_IF = "${{ !cancelled() && (needs.ci-change-scope.result != 'success' || needs.ci-change-scope.outputs.scope != 'docs-only') }}";
|
|
17
|
+
const SELF_REGRESSION_GATE_RUN = [
|
|
18
|
+
"printf 'self-regression=%s\\nci-change-scope=%s scope=%s\\n' \"$SELF_REGRESSION_RESULT\" \"$CI_CHANGE_SCOPE_RESULT\" \"$CI_CHANGE_SCOPE\"",
|
|
19
|
+
"if [ \"$SELF_REGRESSION_RESULT\" = 'success' ]; then exit 0; fi",
|
|
20
|
+
"if [ \"$SELF_REGRESSION_RESULT\" = 'skipped' ] && [ \"$CI_CHANGE_SCOPE_RESULT\" = 'success' ] && [ \"$CI_CHANGE_SCOPE\" = 'docs-only' ]; then exit 0; fi",
|
|
21
|
+
'exit 1',
|
|
22
|
+
].join('\n') + '\n';
|
|
16
23
|
|
|
17
24
|
function nulPaths(paths) {
|
|
18
25
|
return paths.length ? Buffer.from(`${paths.join('\0')}\0`) : Buffer.alloc(0);
|
|
@@ -46,6 +53,12 @@ function shouldRunSelfRegression(workflowCancelled, result, scope) {
|
|
|
46
53
|
return !workflowCancelled && (result !== 'success' || scope !== 'docs-only');
|
|
47
54
|
}
|
|
48
55
|
|
|
56
|
+
function shouldPassSelfRegressionGate(selfRegressionResult, classifierResult, scope) {
|
|
57
|
+
return selfRegressionResult === 'success' || (
|
|
58
|
+
selfRegressionResult === 'skipped' && classifierResult === 'success' && scope === 'docs-only'
|
|
59
|
+
);
|
|
60
|
+
}
|
|
61
|
+
|
|
49
62
|
// Assert the intended scope-gating invariants against parsed workflow documents.
|
|
50
63
|
// Taking documents (not git history or whole-file text) keeps unrelated CI edits
|
|
51
64
|
// green and lets the oracle be replayed against mutated copies of the YAML.
|
|
@@ -53,8 +66,10 @@ function assertScopeGating({ ci, release, governance }) {
|
|
|
53
66
|
const jobs = ci.jobs;
|
|
54
67
|
const classifier = jobs[CHANGE_SCOPE_JOB];
|
|
55
68
|
const selfRegression = jobs['self-regression'];
|
|
69
|
+
const selfRegressionGate = jobs[SELF_REGRESSION_GATE];
|
|
56
70
|
assert.ok(classifier, 'the ci-change-scope job exists');
|
|
57
71
|
assert.ok(selfRegression, 'the self-regression job exists');
|
|
72
|
+
assert.ok(selfRegressionGate, 'the self-regression aggregate gate exists');
|
|
58
73
|
|
|
59
74
|
// Every dependency chain that could inherit the docs-only skip has a first
|
|
60
75
|
// job that needs the classifier or self-regression.
|
|
@@ -62,6 +77,15 @@ function assertScopeGating({ ci, release, governance }) {
|
|
|
62
77
|
// Match needs.job and needs['job'] references while skipping quoted strings.
|
|
63
78
|
const needsReference = /'(?:[^']|'')*'|(?<![\w.-])needs\s*(?:\.\s*([\w-]+)|\[\s*'([\w-]+)'\s*\])/gi;
|
|
64
79
|
for (const [jobId, job] of Object.entries(jobs)) {
|
|
80
|
+
if (jobId === SELF_REGRESSION_GATE) {
|
|
81
|
+
// The aggregate gate is the one named consumer allowed to depend on
|
|
82
|
+
// scope-gated jobs; its own condition must run it even after skips.
|
|
83
|
+
assert.deepEqual(job.needs, [CHANGE_SCOPE_JOB, 'self-regression']);
|
|
84
|
+
assert.equal(job.if, '${{ always() }}');
|
|
85
|
+
assert.equal(job['runs-on'], 'ubuntu-latest');
|
|
86
|
+
assert.ok(!String(job.if).includes('scope'), 'the aggregate gate itself is not scope-gated');
|
|
87
|
+
continue;
|
|
88
|
+
}
|
|
65
89
|
if (scopeJobs.includes(jobId)) continue;
|
|
66
90
|
const needs = Array.isArray(job.needs) ? job.needs : [job.needs];
|
|
67
91
|
for (const scopeJob of scopeJobs) {
|
|
@@ -96,6 +120,15 @@ function assertScopeGating({ ci, release, governance }) {
|
|
|
96
120
|
assert.ok(selfRegression.if.includes('!cancelled()'), 'workflow cancellation must disable self-regression');
|
|
97
121
|
assert.ok(!selfRegression.if.includes('always()'), 'always() keeps self-regression eligible during cancellation');
|
|
98
122
|
|
|
123
|
+
const gateStep = selfRegressionGate.steps?.find(step => step.name === 'Aggregate self-regression result');
|
|
124
|
+
assert.ok(gateStep, 'the aggregate gate makes one explicit decision');
|
|
125
|
+
assert.deepEqual(gateStep.env, {
|
|
126
|
+
SELF_REGRESSION_RESULT: '${{ needs.self-regression.result }}',
|
|
127
|
+
CI_CHANGE_SCOPE_RESULT: '${{ needs.ci-change-scope.result }}',
|
|
128
|
+
CI_CHANGE_SCOPE: '${{ needs.ci-change-scope.outputs.scope }}',
|
|
129
|
+
});
|
|
130
|
+
assert.equal(gateStep.run, SELF_REGRESSION_GATE_RUN, 'the shell gate implements the aggregate decision using env inputs');
|
|
131
|
+
|
|
99
132
|
// The three-OS matrix stays complete.
|
|
100
133
|
assert.equal(selfRegression.strategy['fail-fast'], false);
|
|
101
134
|
assert.deepEqual(selfRegression.strategy.matrix.os, ['ubuntu-latest', 'windows-latest', 'macos-latest']);
|
|
@@ -286,6 +319,22 @@ test('the workflow gates only self-regression and fails open on every uncertain
|
|
|
286
319
|
assert.equal(classifyChangeSet('push', 'a'.repeat(40), 'b'.repeat(40), { runGit: unusedGitForWorkflow }), 'full');
|
|
287
320
|
});
|
|
288
321
|
|
|
322
|
+
test('the aggregate status passes only for a successful matrix or a successful docs-only skip', () => {
|
|
323
|
+
const cases = [
|
|
324
|
+
['successful matrix with code changes', 'success', 'success', 'code', true],
|
|
325
|
+
['successful matrix when classifier is skipped on push', 'success', 'skipped', undefined, true],
|
|
326
|
+
['skipped matrix after successful docs-only classification', 'skipped', 'success', 'docs-only', true],
|
|
327
|
+
['skipped matrix after code classification', 'skipped', 'success', 'code', false],
|
|
328
|
+
['skipped matrix when classifier is skipped', 'skipped', 'skipped', undefined, false],
|
|
329
|
+
['skipped matrix when classifier fails', 'skipped', 'failure', undefined, false],
|
|
330
|
+
['failed matrix', 'failure', 'success', 'docs-only', false],
|
|
331
|
+
['cancelled matrix', 'cancelled', 'success', 'docs-only', false],
|
|
332
|
+
];
|
|
333
|
+
for (const [label, matrix, classifier, scope, expected] of cases) {
|
|
334
|
+
assert.equal(shouldPassSelfRegressionGate(matrix, classifier, scope), expected, label);
|
|
335
|
+
}
|
|
336
|
+
});
|
|
337
|
+
|
|
289
338
|
test('the oracle accepts jobs with independent conditions and dependencies', () => {
|
|
290
339
|
const workflows = readScopeWorkflows();
|
|
291
340
|
const jobs = workflows.ci.jobs;
|
|
@@ -333,10 +382,29 @@ test('the oracle retains the existing scope-gating invariants', () => {
|
|
|
333
382
|
}
|
|
334
383
|
});
|
|
335
384
|
|
|
385
|
+
test('the oracle rejects mutations that could make the aggregate required check skip or pass falsely', () => {
|
|
386
|
+
for (const [mutate, expected] of [
|
|
387
|
+
[({ ci }) => { delete ci.jobs[SELF_REGRESSION_GATE].if; }, /always\(\)/],
|
|
388
|
+
[({ ci }) => { ci.jobs[SELF_REGRESSION_GATE].needs = ['self-regression']; }, /deep-equal/],
|
|
389
|
+
[({ ci }) => {
|
|
390
|
+
ci.jobs[SELF_REGRESSION_GATE].steps.find(step => step.name === 'Aggregate self-regression result').run = [
|
|
391
|
+
"printf 'self-regression=%s\\nci-change-scope=%s scope=%s\\n' \"$SELF_REGRESSION_RESULT\" \"$CI_CHANGE_SCOPE_RESULT\" \"$CI_CHANGE_SCOPE\"",
|
|
392
|
+
"if [ \"$SELF_REGRESSION_RESULT\" = 'success' ]; then exit 0; fi",
|
|
393
|
+
"if [ \"$SELF_REGRESSION_RESULT\" = 'skipped' ]; then exit 0; fi",
|
|
394
|
+
'exit 1',
|
|
395
|
+
].join('\n');
|
|
396
|
+
}, /implements the aggregate decision/],
|
|
397
|
+
]) {
|
|
398
|
+
const workflows = readScopeWorkflows();
|
|
399
|
+
mutate(workflows);
|
|
400
|
+
assert.throws(() => assertScopeGating(workflows), expected);
|
|
401
|
+
}
|
|
402
|
+
});
|
|
403
|
+
|
|
336
404
|
function unusedGitForWorkflow() {
|
|
337
405
|
throw new Error('the release caller is a push/dispatch, so no PR diff may authorize a skip');
|
|
338
406
|
}
|
|
339
407
|
|
|
340
408
|
// Exported so the in-report mutant harness can replay the same oracle against
|
|
341
409
|
// parsed copies of the workflow documents without registering these tests.
|
|
342
|
-
module.exports = { assertScopeGating };
|
|
410
|
+
module.exports = { assertScopeGating, shouldPassSelfRegressionGate };
|
|
@@ -249,7 +249,7 @@ test('548 errors-sync detects a swapped index whose 64-bit ino collides as Numbe
|
|
|
249
249
|
// --- Guard: every non-test JS `.ino` access must originate from a `{ bigint: true }` stat call ---
|
|
250
250
|
|
|
251
251
|
const STAT_METHODS = new Set(['statSync', 'lstatSync', 'fstatSync']);
|
|
252
|
-
const EXCLUDED_DIRS = new Set(['.git', '.w', 'node_modules', 'ci', 'evals', 'benchmarks', 'behavioral-evals']);
|
|
252
|
+
const EXCLUDED_DIRS = new Set(['.git', '.worktrees', '.w', 'node_modules', 'ci', 'evals', 'benchmarks', 'behavioral-evals']);
|
|
253
253
|
|
|
254
254
|
function listNonTestJsFiles(dir, out = []) {
|
|
255
255
|
for (const entry of fs.readdirSync(dir, { withFileTypes: true })) {
|