@hailstails/hone 2.0.0-pre.1 → 2.0.0-pre.2
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/ADOPTING.md +24 -190
- package/CHANGELOG.md +11 -0
- package/MIGRATING.md +5 -43
- package/README.md +39 -154
- package/docs/output-contract.md +1 -1
- package/package.json +1 -1
- package/src/hone.js +342 -164
package/src/hone.js
CHANGED
|
@@ -4614,7 +4614,7 @@ var mappingLineOf = (request) => {
|
|
|
4614
4614
|
case "two-engines-on-mechanism":
|
|
4615
4615
|
return `${refusal2.check} could run on ${refusal2.engines.join(" or ")} through the ${refusal2.mechanism} mechanism; the upgrade cannot choose. ${FAULT_IN_HONE}`;
|
|
4616
4616
|
case "record-answers-nothing":
|
|
4617
|
-
return `the file carve-out for ${refusal2.clause} in ${refusal2.file} answers ${refusal2.credited === "nothing" ? "no finding" : "only a suppression"}. Remove it, or fix the file it names, then run the upgrade again.`;
|
|
4617
|
+
return `the file carve-out for ${refusal2.clause} in ${refusal2.file} answers ${refusal2.credited === "nothing" ? "no finding" : "only a suppression no version 2 record can hold"}. Remove it, or fix the file it names, then run the upgrade again.`;
|
|
4618
4618
|
case "records-name-refused":
|
|
4619
4619
|
return `${refusal2.name} is not a name version 2 can file records under. ${FAULT_IN_HONE}`;
|
|
4620
4620
|
}
|
|
@@ -7540,20 +7540,28 @@ var debtRecordOf = (request) => {
|
|
|
7540
7540
|
const answers = checkAddressOf({ check: request.check });
|
|
7541
7541
|
return holdingOf({ record: request.record }) === "carried" ? { answers, file: request.record.file, carried: request.entry } : { answers, file: request.record.file, ...noteOf({ reason: request.record.reason }) };
|
|
7542
7542
|
};
|
|
7543
|
+
var checksCarriedBy = (request) => {
|
|
7544
|
+
const { answer } = request;
|
|
7545
|
+
if (answer.credit === "nothing") {
|
|
7546
|
+
return { outcome: "failed", error: "nothing" };
|
|
7547
|
+
}
|
|
7548
|
+
return answer.credit === "suppression-only" && answer.checks.length === 0 ? { outcome: "failed", error: "suppression-only" } : { outcome: "ok", value: answer.checks };
|
|
7549
|
+
};
|
|
7543
7550
|
var carveOutOutcome = (request) => {
|
|
7544
7551
|
const { record, answer, entry } = request.input;
|
|
7545
|
-
|
|
7552
|
+
const carried = checksCarriedBy({ answer });
|
|
7553
|
+
if (carried.outcome === "failed") {
|
|
7546
7554
|
return refusedWith({
|
|
7547
7555
|
refusal: {
|
|
7548
7556
|
kind: "record-answers-nothing",
|
|
7549
7557
|
clause: clauseAddressText({ address: record.clause }),
|
|
7550
7558
|
file: record.file,
|
|
7551
|
-
credited:
|
|
7559
|
+
credited: carried.error
|
|
7552
7560
|
}
|
|
7553
7561
|
});
|
|
7554
7562
|
}
|
|
7555
7563
|
return outcomeOfPlacements({
|
|
7556
|
-
placements: withoutRepeats({ checks:
|
|
7564
|
+
placements: withoutRepeats({ checks: carried.value }).map(
|
|
7557
7565
|
(check) => placedAt({
|
|
7558
7566
|
origin: originOf({ recordKind: "file-carve-out", record }),
|
|
7559
7567
|
kind: "debt",
|
|
@@ -11091,6 +11099,289 @@ var foundTreeRunReachOf = (request) => ({
|
|
|
11091
11099
|
})
|
|
11092
11100
|
});
|
|
11093
11101
|
|
|
11102
|
+
// src/application/upgrade/proof-writes/proof-writes.ts
|
|
11103
|
+
var parentOf = (request) => {
|
|
11104
|
+
const parent = request.ports.path.directoryOf({ path: request.path });
|
|
11105
|
+
return isAbsolutePath(parent) ? parent : request.path;
|
|
11106
|
+
};
|
|
11107
|
+
var missingDirectoriesOf = (request) => {
|
|
11108
|
+
const parent = parentOf(request);
|
|
11109
|
+
return parent === request.path || request.ports.entryKind.kindOf({ path: parent }) !== "absent" ? [] : [...missingDirectoriesOf({ ports: request.ports, path: parent }), parent];
|
|
11110
|
+
};
|
|
11111
|
+
var uniquePaths = (request) => [...new Set(request.paths)];
|
|
11112
|
+
var alreadyExisting = (request) => {
|
|
11113
|
+
const existing = request.files.find(
|
|
11114
|
+
(file) => request.ports.entryKind.kindOf({ path: file.path }) !== "absent"
|
|
11115
|
+
);
|
|
11116
|
+
return existing === void 0 ? void 0 : { kind: "path-already-exists", path: existing.path };
|
|
11117
|
+
};
|
|
11118
|
+
var stepsOf = (request) => {
|
|
11119
|
+
const directories = uniquePaths({
|
|
11120
|
+
paths: request.files.flatMap(
|
|
11121
|
+
(file) => missingDirectoriesOf({ ports: request.ports, path: file.path })
|
|
11122
|
+
)
|
|
11123
|
+
}).toSorted((left, right) => left.length - right.length);
|
|
11124
|
+
return [
|
|
11125
|
+
...directories.map((path) => ({ kind: "directory", path })),
|
|
11126
|
+
...request.files.map((file) => ({ kind: "file", file })),
|
|
11127
|
+
...request.replacements.map(({ file, original }) => ({
|
|
11128
|
+
kind: "replacement",
|
|
11129
|
+
file,
|
|
11130
|
+
original
|
|
11131
|
+
}))
|
|
11132
|
+
];
|
|
11133
|
+
};
|
|
11134
|
+
var performed = (request) => {
|
|
11135
|
+
const { ports, step } = request;
|
|
11136
|
+
switch (step.kind) {
|
|
11137
|
+
case "directory": {
|
|
11138
|
+
const created = ports.directory.create({ path: step.path });
|
|
11139
|
+
return created.outcome === "ok" ? { outcome: "ok", value: { kind: "directory-created", path: step.path } } : {
|
|
11140
|
+
outcome: "failed",
|
|
11141
|
+
error: { kind: "directory-uncreatable", path: step.path, detail: created.error.detail }
|
|
11142
|
+
};
|
|
11143
|
+
}
|
|
11144
|
+
case "file": {
|
|
11145
|
+
const created = ports.fileCreation.createNew({ path: step.file.path, text: step.file.text });
|
|
11146
|
+
if (created.outcome === "ok") {
|
|
11147
|
+
return { outcome: "ok", value: { kind: "file-created", path: step.file.path } };
|
|
11148
|
+
}
|
|
11149
|
+
return {
|
|
11150
|
+
outcome: "failed",
|
|
11151
|
+
error: created.error.kind === "already-exists" ? { kind: "path-already-exists", path: step.file.path } : { kind: "unwritable", path: step.file.path, detail: created.error.detail }
|
|
11152
|
+
};
|
|
11153
|
+
}
|
|
11154
|
+
case "replacement": {
|
|
11155
|
+
const written = ports.fileText.write({ path: step.file.path, text: step.file.text });
|
|
11156
|
+
return written.outcome === "ok" ? {
|
|
11157
|
+
outcome: "ok",
|
|
11158
|
+
value: { kind: "file-replaced", path: step.file.path, original: step.original }
|
|
11159
|
+
} : {
|
|
11160
|
+
outcome: "failed",
|
|
11161
|
+
error: { kind: "unwritable", path: step.file.path, detail: written.error.detail }
|
|
11162
|
+
};
|
|
11163
|
+
}
|
|
11164
|
+
}
|
|
11165
|
+
};
|
|
11166
|
+
var undoneOf = (request) => {
|
|
11167
|
+
const { ports, write } = request;
|
|
11168
|
+
switch (write.kind) {
|
|
11169
|
+
case "directory-created": {
|
|
11170
|
+
const removed2 = ports.directoryRemoval.removeEmpty({ path: write.path });
|
|
11171
|
+
return removed2.outcome === "ok" ? void 0 : { written: write.kind, path: write.path, detail: removed2.error.detail };
|
|
11172
|
+
}
|
|
11173
|
+
case "file-created": {
|
|
11174
|
+
const removed2 = ports.fileRemoval.remove({ path: write.path });
|
|
11175
|
+
return removed2.outcome === "ok" ? void 0 : { written: write.kind, path: write.path, detail: removed2.error.detail };
|
|
11176
|
+
}
|
|
11177
|
+
case "file-replaced": {
|
|
11178
|
+
const restored = ports.fileText.write({ path: write.path, text: write.original });
|
|
11179
|
+
return restored.outcome === "ok" ? void 0 : { written: write.kind, path: write.path, detail: restored.error.detail };
|
|
11180
|
+
}
|
|
11181
|
+
}
|
|
11182
|
+
};
|
|
11183
|
+
var rolledBackProofWrites = (request) => request.writes.toReversed().flatMap((write) => {
|
|
11184
|
+
const unrestored = undoneOf({ ports: request.ports, write });
|
|
11185
|
+
return unrestored === void 0 ? [] : [unrestored];
|
|
11186
|
+
});
|
|
11187
|
+
var performedAll = (request) => {
|
|
11188
|
+
const [step, ...rest] = request.steps;
|
|
11189
|
+
if (step === void 0) {
|
|
11190
|
+
return { outcome: "ok", value: request.done };
|
|
11191
|
+
}
|
|
11192
|
+
const stepOutcome = performed({ ports: request.ports, step });
|
|
11193
|
+
if (stepOutcome.outcome === "failed") {
|
|
11194
|
+
const attempted = step.kind === "replacement" ? [
|
|
11195
|
+
...request.done,
|
|
11196
|
+
{ kind: "file-replaced", path: step.file.path, original: step.original }
|
|
11197
|
+
] : request.done;
|
|
11198
|
+
return {
|
|
11199
|
+
outcome: "failed",
|
|
11200
|
+
error: {
|
|
11201
|
+
failure: stepOutcome.error,
|
|
11202
|
+
unrestored: rolledBackProofWrites({ ports: request.ports, writes: attempted })
|
|
11203
|
+
}
|
|
11204
|
+
};
|
|
11205
|
+
}
|
|
11206
|
+
return performedAll({
|
|
11207
|
+
ports: request.ports,
|
|
11208
|
+
steps: rest,
|
|
11209
|
+
done: [...request.done, stepOutcome.value]
|
|
11210
|
+
});
|
|
11211
|
+
};
|
|
11212
|
+
var replacementOf = (request) => {
|
|
11213
|
+
const read = request.ports.fileText.read({ path: request.file.path });
|
|
11214
|
+
return read.outcome === "ok" ? { outcome: "ok", value: { file: request.file, original: read.value } } : {
|
|
11215
|
+
outcome: "failed",
|
|
11216
|
+
error: {
|
|
11217
|
+
kind: "replaced-file-unreadable",
|
|
11218
|
+
path: request.file.path,
|
|
11219
|
+
detail: read.error.detail
|
|
11220
|
+
}
|
|
11221
|
+
};
|
|
11222
|
+
};
|
|
11223
|
+
var replacementsOf = (request) => {
|
|
11224
|
+
const read = request.files.map((file) => replacementOf({ ports: request.ports, file }));
|
|
11225
|
+
const unreadable2 = read.find((each) => each.outcome === "failed");
|
|
11226
|
+
return unreadable2 ?? {
|
|
11227
|
+
outcome: "ok",
|
|
11228
|
+
value: read.flatMap((each) => each.outcome === "ok" ? [each.value] : [])
|
|
11229
|
+
};
|
|
11230
|
+
};
|
|
11231
|
+
var refusedBeforeWriting = (request) => ({
|
|
11232
|
+
outcome: "failed",
|
|
11233
|
+
error: { failure: request.failure, unrestored: [] }
|
|
11234
|
+
});
|
|
11235
|
+
var writeProofFiles = (request) => {
|
|
11236
|
+
const existing = alreadyExisting({ ports: request.ports, files: request.files });
|
|
11237
|
+
if (existing !== void 0) {
|
|
11238
|
+
return refusedBeforeWriting({ failure: existing });
|
|
11239
|
+
}
|
|
11240
|
+
const replacements = replacementsOf({ ports: request.ports, files: request.replacements });
|
|
11241
|
+
if (replacements.outcome === "failed") {
|
|
11242
|
+
return refusedBeforeWriting({ failure: replacements.error });
|
|
11243
|
+
}
|
|
11244
|
+
return performedAll({
|
|
11245
|
+
ports: request.ports,
|
|
11246
|
+
steps: stepsOf({
|
|
11247
|
+
ports: request.ports,
|
|
11248
|
+
files: request.files,
|
|
11249
|
+
replacements: replacements.value
|
|
11250
|
+
}),
|
|
11251
|
+
done: []
|
|
11252
|
+
});
|
|
11253
|
+
};
|
|
11254
|
+
|
|
11255
|
+
// src/application/upgrade/patching/version-one-plugin-specifiers.ts
|
|
11256
|
+
var ESLINT_ENGINE_FOLDER = "src/infrastructure/engines/eslint";
|
|
11257
|
+
var pluginSpecifierOf = (request) => {
|
|
11258
|
+
const stem = `cd${request.discipline}`;
|
|
11259
|
+
return {
|
|
11260
|
+
versionOne: `${TOOL_IDENTITY.packageName}/mechanisms/eslint/CD-${request.discipline}/${stem}/${stem}.eslint-plugin.js`,
|
|
11261
|
+
versionTwo: `${TOOL_IDENTITY.packageName}/${ESLINT_ENGINE_FOLDER}/${request.versionTwoFolder}/eslint-plugin.js`
|
|
11262
|
+
};
|
|
11263
|
+
};
|
|
11264
|
+
var PLUGIN_SPECIFIERS = [
|
|
11265
|
+
pluginSpecifierOf({ discipline: 1, versionTwoFolder: "untyped-value/explicit-any" }),
|
|
11266
|
+
pluginSpecifierOf({ discipline: 2, versionTwoFolder: "claimed-type/non-null-assertions" }),
|
|
11267
|
+
pluginSpecifierOf({ discipline: 6, versionTwoFolder: "name-off-its-casing/naming-convention" }),
|
|
11268
|
+
pluginSpecifierOf({ discipline: 7, versionTwoFolder: "name-off-its-casing/filename-case" }),
|
|
11269
|
+
pluginSpecifierOf({ discipline: 10, versionTwoFolder: "thrown-non-error/throw-only-error" }),
|
|
11270
|
+
pluginSpecifierOf({ discipline: 14, versionTwoFolder: "authored-class-or-this/class-keyword" }),
|
|
11271
|
+
pluginSpecifierOf({ discipline: 27, versionTwoFolder: "test-switched-off/focused-tests" }),
|
|
11272
|
+
pluginSpecifierOf({ discipline: 40, versionTwoFolder: "positional-parameters/parameter-count" }),
|
|
11273
|
+
pluginSpecifierOf({ discipline: 41, versionTwoFolder: "tangled-function/cognitive-complexity" }),
|
|
11274
|
+
pluginSpecifierOf({
|
|
11275
|
+
discipline: 42,
|
|
11276
|
+
versionTwoFolder: "work-inside-a-condition/else-after-an-exit"
|
|
11277
|
+
}),
|
|
11278
|
+
pluginSpecifierOf({ discipline: 44, versionTwoFolder: "rebinding/parameter-reassignment" })
|
|
11279
|
+
];
|
|
11280
|
+
var quoted3 = (request) => JSON.stringify(request.text);
|
|
11281
|
+
var projectionWithVersionTwoPlugins = (request) => PLUGIN_SPECIFIERS.reduce(
|
|
11282
|
+
(text, specifier) => text.replaceAll(
|
|
11283
|
+
quoted3({ text: specifier.versionOne }),
|
|
11284
|
+
quoted3({ text: specifier.versionTwo })
|
|
11285
|
+
),
|
|
11286
|
+
request.text
|
|
11287
|
+
);
|
|
11288
|
+
|
|
11289
|
+
// src/application/upgrade/patching/projection-patching.ts
|
|
11290
|
+
var VERSION_ONE_ESLINT_PROJECTION = /(?:^|\/)disciplines\.eslint\.mjs$/;
|
|
11291
|
+
var plannedPatchOf = (request) => {
|
|
11292
|
+
const path = request.ports.path.join({ segments: [request.repoRoot, request.file] });
|
|
11293
|
+
if (!isAbsolutePath(path)) {
|
|
11294
|
+
return {
|
|
11295
|
+
outcome: "failed",
|
|
11296
|
+
error: { kind: "unplaceable-path", file: request.file, removedByVersionOne: [] }
|
|
11297
|
+
};
|
|
11298
|
+
}
|
|
11299
|
+
const read = request.ports.fileText.read({ path });
|
|
11300
|
+
if (read.outcome === "failed") {
|
|
11301
|
+
return {
|
|
11302
|
+
outcome: "failed",
|
|
11303
|
+
error: {
|
|
11304
|
+
kind: "plan-refused",
|
|
11305
|
+
refusal: {
|
|
11306
|
+
kind: "team-config-refused",
|
|
11307
|
+
refusal: {
|
|
11308
|
+
kind: "config-candidate-unreadable",
|
|
11309
|
+
file: request.file,
|
|
11310
|
+
detail: read.error.detail
|
|
11311
|
+
}
|
|
11312
|
+
},
|
|
11313
|
+
removedByVersionOne: []
|
|
11314
|
+
}
|
|
11315
|
+
};
|
|
11316
|
+
}
|
|
11317
|
+
const text = projectionWithVersionTwoPlugins({ text: read.value });
|
|
11318
|
+
return { outcome: "ok", value: text === read.value ? [] : [{ path, text }] };
|
|
11319
|
+
};
|
|
11320
|
+
var plannedPatchesOf = (request) => {
|
|
11321
|
+
const planned = request.trackedPaths.filter((file) => VERSION_ONE_ESLINT_PROJECTION.test(file)).map((file) => plannedPatchOf({ ...request, file }));
|
|
11322
|
+
const refused2 = planned.find((each) => each.outcome === "failed");
|
|
11323
|
+
return refused2 ?? {
|
|
11324
|
+
outcome: "ok",
|
|
11325
|
+
value: planned.flatMap((each) => each.outcome === "ok" ? each.value : [])
|
|
11326
|
+
};
|
|
11327
|
+
};
|
|
11328
|
+
var patchedProjectionsOf = (request) => {
|
|
11329
|
+
const planned = plannedPatchesOf(request);
|
|
11330
|
+
if (planned.outcome === "failed") {
|
|
11331
|
+
return planned;
|
|
11332
|
+
}
|
|
11333
|
+
const written = writeProofFiles({
|
|
11334
|
+
ports: request.ports,
|
|
11335
|
+
files: [],
|
|
11336
|
+
replacements: planned.value
|
|
11337
|
+
});
|
|
11338
|
+
return written.outcome === "failed" ? {
|
|
11339
|
+
outcome: "failed",
|
|
11340
|
+
error: { kind: "write-refused", refusal: written.error, removedByVersionOne: [] }
|
|
11341
|
+
} : written;
|
|
11342
|
+
};
|
|
11343
|
+
var keptAsVersionOneLeftThem = (request) => {
|
|
11344
|
+
const { refusal: refusal2 } = request;
|
|
11345
|
+
const files = [
|
|
11346
|
+
..."removedByVersionOne" in refusal2 ? refusal2.removedByVersionOne : [],
|
|
11347
|
+
...refusal2.kind === "version-one-project-rewrote" ? refusal2.files : []
|
|
11348
|
+
];
|
|
11349
|
+
return files.flatMap((file) => {
|
|
11350
|
+
const path = request.ports.path.join({ segments: [request.repoRoot, file] });
|
|
11351
|
+
return isAbsolutePath(path) ? [path] : [];
|
|
11352
|
+
});
|
|
11353
|
+
};
|
|
11354
|
+
var withUnrestored = (request) => {
|
|
11355
|
+
const { refusal: refusal2, unrestored } = request;
|
|
11356
|
+
switch (refusal2.kind) {
|
|
11357
|
+
case "version-two-run-failed":
|
|
11358
|
+
case "directives-name-no-check":
|
|
11359
|
+
case "differences":
|
|
11360
|
+
return { ...refusal2, unrestored: [...refusal2.unrestored, ...unrestored] };
|
|
11361
|
+
case "write-refused":
|
|
11362
|
+
return {
|
|
11363
|
+
...refusal2,
|
|
11364
|
+
refusal: {
|
|
11365
|
+
...refusal2.refusal,
|
|
11366
|
+
unrestored: [...refusal2.refusal.unrestored, ...unrestored]
|
|
11367
|
+
}
|
|
11368
|
+
};
|
|
11369
|
+
default:
|
|
11370
|
+
return refusal2;
|
|
11371
|
+
}
|
|
11372
|
+
};
|
|
11373
|
+
var restoredOriginalProjections = (request) => {
|
|
11374
|
+
if (request.refusal.kind === "removal-failed") {
|
|
11375
|
+
return request.refusal;
|
|
11376
|
+
}
|
|
11377
|
+
const kept = keptAsVersionOneLeftThem(request);
|
|
11378
|
+
const unrestored = rolledBackProofWrites({
|
|
11379
|
+
ports: request.ports,
|
|
11380
|
+
writes: request.patches.filter((write) => !kept.includes(write.path))
|
|
11381
|
+
});
|
|
11382
|
+
return withUnrestored({ refusal: request.refusal, unrestored });
|
|
11383
|
+
};
|
|
11384
|
+
|
|
11094
11385
|
// src/application/ports/upgrade/proof-outcome.ts
|
|
11095
11386
|
var PROOF_SECTIONS = [
|
|
11096
11387
|
"excluded",
|
|
@@ -11337,159 +11628,6 @@ var proofDifferencesOf = (request) => {
|
|
|
11337
11628
|
return PROOF_SECTIONS.flatMap((section) => differenceIn({ section, before, after }));
|
|
11338
11629
|
};
|
|
11339
11630
|
|
|
11340
|
-
// src/application/upgrade/proof-writes/proof-writes.ts
|
|
11341
|
-
var parentOf = (request) => {
|
|
11342
|
-
const parent = request.ports.path.directoryOf({ path: request.path });
|
|
11343
|
-
return isAbsolutePath(parent) ? parent : request.path;
|
|
11344
|
-
};
|
|
11345
|
-
var missingDirectoriesOf = (request) => {
|
|
11346
|
-
const parent = parentOf(request);
|
|
11347
|
-
return parent === request.path || request.ports.entryKind.kindOf({ path: parent }) !== "absent" ? [] : [...missingDirectoriesOf({ ports: request.ports, path: parent }), parent];
|
|
11348
|
-
};
|
|
11349
|
-
var uniquePaths = (request) => [...new Set(request.paths)];
|
|
11350
|
-
var alreadyExisting = (request) => {
|
|
11351
|
-
const existing = request.files.find(
|
|
11352
|
-
(file) => request.ports.entryKind.kindOf({ path: file.path }) !== "absent"
|
|
11353
|
-
);
|
|
11354
|
-
return existing === void 0 ? void 0 : { kind: "path-already-exists", path: existing.path };
|
|
11355
|
-
};
|
|
11356
|
-
var stepsOf = (request) => {
|
|
11357
|
-
const directories = uniquePaths({
|
|
11358
|
-
paths: request.files.flatMap(
|
|
11359
|
-
(file) => missingDirectoriesOf({ ports: request.ports, path: file.path })
|
|
11360
|
-
)
|
|
11361
|
-
}).toSorted((left, right) => left.length - right.length);
|
|
11362
|
-
return [
|
|
11363
|
-
...directories.map((path) => ({ kind: "directory", path })),
|
|
11364
|
-
...request.files.map((file) => ({ kind: "file", file })),
|
|
11365
|
-
...request.replacements.map(({ file, original }) => ({
|
|
11366
|
-
kind: "replacement",
|
|
11367
|
-
file,
|
|
11368
|
-
original
|
|
11369
|
-
}))
|
|
11370
|
-
];
|
|
11371
|
-
};
|
|
11372
|
-
var performed = (request) => {
|
|
11373
|
-
const { ports, step } = request;
|
|
11374
|
-
switch (step.kind) {
|
|
11375
|
-
case "directory": {
|
|
11376
|
-
const created = ports.directory.create({ path: step.path });
|
|
11377
|
-
return created.outcome === "ok" ? { outcome: "ok", value: { kind: "directory-created", path: step.path } } : {
|
|
11378
|
-
outcome: "failed",
|
|
11379
|
-
error: { kind: "directory-uncreatable", path: step.path, detail: created.error.detail }
|
|
11380
|
-
};
|
|
11381
|
-
}
|
|
11382
|
-
case "file": {
|
|
11383
|
-
const created = ports.fileCreation.createNew({ path: step.file.path, text: step.file.text });
|
|
11384
|
-
if (created.outcome === "ok") {
|
|
11385
|
-
return { outcome: "ok", value: { kind: "file-created", path: step.file.path } };
|
|
11386
|
-
}
|
|
11387
|
-
return {
|
|
11388
|
-
outcome: "failed",
|
|
11389
|
-
error: created.error.kind === "already-exists" ? { kind: "path-already-exists", path: step.file.path } : { kind: "unwritable", path: step.file.path, detail: created.error.detail }
|
|
11390
|
-
};
|
|
11391
|
-
}
|
|
11392
|
-
case "replacement": {
|
|
11393
|
-
const written = ports.fileText.write({ path: step.file.path, text: step.file.text });
|
|
11394
|
-
return written.outcome === "ok" ? {
|
|
11395
|
-
outcome: "ok",
|
|
11396
|
-
value: { kind: "file-replaced", path: step.file.path, original: step.original }
|
|
11397
|
-
} : {
|
|
11398
|
-
outcome: "failed",
|
|
11399
|
-
error: { kind: "unwritable", path: step.file.path, detail: written.error.detail }
|
|
11400
|
-
};
|
|
11401
|
-
}
|
|
11402
|
-
}
|
|
11403
|
-
};
|
|
11404
|
-
var undoneOf = (request) => {
|
|
11405
|
-
const { ports, write } = request;
|
|
11406
|
-
switch (write.kind) {
|
|
11407
|
-
case "directory-created": {
|
|
11408
|
-
const removed2 = ports.directoryRemoval.removeEmpty({ path: write.path });
|
|
11409
|
-
return removed2.outcome === "ok" ? void 0 : { written: write.kind, path: write.path, detail: removed2.error.detail };
|
|
11410
|
-
}
|
|
11411
|
-
case "file-created": {
|
|
11412
|
-
const removed2 = ports.fileRemoval.remove({ path: write.path });
|
|
11413
|
-
return removed2.outcome === "ok" ? void 0 : { written: write.kind, path: write.path, detail: removed2.error.detail };
|
|
11414
|
-
}
|
|
11415
|
-
case "file-replaced": {
|
|
11416
|
-
const restored = ports.fileText.write({ path: write.path, text: write.original });
|
|
11417
|
-
return restored.outcome === "ok" ? void 0 : { written: write.kind, path: write.path, detail: restored.error.detail };
|
|
11418
|
-
}
|
|
11419
|
-
}
|
|
11420
|
-
};
|
|
11421
|
-
var rolledBackProofWrites = (request) => request.writes.toReversed().flatMap((write) => {
|
|
11422
|
-
const unrestored = undoneOf({ ports: request.ports, write });
|
|
11423
|
-
return unrestored === void 0 ? [] : [unrestored];
|
|
11424
|
-
});
|
|
11425
|
-
var performedAll = (request) => {
|
|
11426
|
-
const [step, ...rest] = request.steps;
|
|
11427
|
-
if (step === void 0) {
|
|
11428
|
-
return { outcome: "ok", value: request.done };
|
|
11429
|
-
}
|
|
11430
|
-
const stepOutcome = performed({ ports: request.ports, step });
|
|
11431
|
-
if (stepOutcome.outcome === "failed") {
|
|
11432
|
-
const attempted = step.kind === "replacement" ? [
|
|
11433
|
-
...request.done,
|
|
11434
|
-
{ kind: "file-replaced", path: step.file.path, original: step.original }
|
|
11435
|
-
] : request.done;
|
|
11436
|
-
return {
|
|
11437
|
-
outcome: "failed",
|
|
11438
|
-
error: {
|
|
11439
|
-
failure: stepOutcome.error,
|
|
11440
|
-
unrestored: rolledBackProofWrites({ ports: request.ports, writes: attempted })
|
|
11441
|
-
}
|
|
11442
|
-
};
|
|
11443
|
-
}
|
|
11444
|
-
return performedAll({
|
|
11445
|
-
ports: request.ports,
|
|
11446
|
-
steps: rest,
|
|
11447
|
-
done: [...request.done, stepOutcome.value]
|
|
11448
|
-
});
|
|
11449
|
-
};
|
|
11450
|
-
var replacementOf = (request) => {
|
|
11451
|
-
const read = request.ports.fileText.read({ path: request.file.path });
|
|
11452
|
-
return read.outcome === "ok" ? { outcome: "ok", value: { file: request.file, original: read.value } } : {
|
|
11453
|
-
outcome: "failed",
|
|
11454
|
-
error: {
|
|
11455
|
-
kind: "replaced-file-unreadable",
|
|
11456
|
-
path: request.file.path,
|
|
11457
|
-
detail: read.error.detail
|
|
11458
|
-
}
|
|
11459
|
-
};
|
|
11460
|
-
};
|
|
11461
|
-
var replacementsOf = (request) => {
|
|
11462
|
-
const read = request.files.map((file) => replacementOf({ ports: request.ports, file }));
|
|
11463
|
-
const unreadable2 = read.find((each) => each.outcome === "failed");
|
|
11464
|
-
return unreadable2 ?? {
|
|
11465
|
-
outcome: "ok",
|
|
11466
|
-
value: read.flatMap((each) => each.outcome === "ok" ? [each.value] : [])
|
|
11467
|
-
};
|
|
11468
|
-
};
|
|
11469
|
-
var refusedBeforeWriting = (request) => ({
|
|
11470
|
-
outcome: "failed",
|
|
11471
|
-
error: { failure: request.failure, unrestored: [] }
|
|
11472
|
-
});
|
|
11473
|
-
var writeProofFiles = (request) => {
|
|
11474
|
-
const existing = alreadyExisting({ ports: request.ports, files: request.files });
|
|
11475
|
-
if (existing !== void 0) {
|
|
11476
|
-
return refusedBeforeWriting({ failure: existing });
|
|
11477
|
-
}
|
|
11478
|
-
const replacements = replacementsOf({ ports: request.ports, files: request.replacements });
|
|
11479
|
-
if (replacements.outcome === "failed") {
|
|
11480
|
-
return refusedBeforeWriting({ failure: replacements.error });
|
|
11481
|
-
}
|
|
11482
|
-
return performedAll({
|
|
11483
|
-
ports: request.ports,
|
|
11484
|
-
steps: stepsOf({
|
|
11485
|
-
ports: request.ports,
|
|
11486
|
-
files: request.files,
|
|
11487
|
-
replacements: replacements.value
|
|
11488
|
-
}),
|
|
11489
|
-
done: []
|
|
11490
|
-
});
|
|
11491
|
-
};
|
|
11492
|
-
|
|
11493
11631
|
// src/application/upgrade/proof-writes/version-one-removal.ts
|
|
11494
11632
|
var PATH_SEPARATOR = /[\\/]/;
|
|
11495
11633
|
var segmentsBelowRoot = (request) => {
|
|
@@ -12306,7 +12444,7 @@ var afterReading = async (request) => {
|
|
|
12306
12444
|
removed: removed2.value
|
|
12307
12445
|
});
|
|
12308
12446
|
};
|
|
12309
|
-
var
|
|
12447
|
+
var provenOver = async (request) => {
|
|
12310
12448
|
const answered = await request.oracle.answer({
|
|
12311
12449
|
records: request.reading.heads.map(({ record }) => record)
|
|
12312
12450
|
});
|
|
@@ -12345,6 +12483,23 @@ var upgradeProof = async (request) => {
|
|
|
12345
12483
|
}
|
|
12346
12484
|
return projectedOver({ ...request, plan: plan.value, before: before.value });
|
|
12347
12485
|
};
|
|
12486
|
+
var upgradeProof = async (request) => {
|
|
12487
|
+
const { ports, repoRoot, trackedPaths } = request;
|
|
12488
|
+
const patches = patchedProjectionsOf({ ports, repoRoot, trackedPaths });
|
|
12489
|
+
if (patches.outcome === "failed") {
|
|
12490
|
+
return patches;
|
|
12491
|
+
}
|
|
12492
|
+
const proven = await provenOver(request);
|
|
12493
|
+
return proven.outcome === "ok" ? proven : {
|
|
12494
|
+
outcome: "failed",
|
|
12495
|
+
error: restoredOriginalProjections({
|
|
12496
|
+
ports,
|
|
12497
|
+
repoRoot,
|
|
12498
|
+
patches: patches.value,
|
|
12499
|
+
refusal: proven.error
|
|
12500
|
+
})
|
|
12501
|
+
};
|
|
12502
|
+
};
|
|
12348
12503
|
|
|
12349
12504
|
// src/infrastructure/command-line/proof-runs.ts
|
|
12350
12505
|
var failedWith3 = (request) => ({
|
|
@@ -12859,8 +13014,17 @@ var doublyHeldFailureOf = (request) => request.governed.doublyHeld.some(
|
|
|
12859
13014
|
file: request.record.file
|
|
12860
13015
|
} : void 0;
|
|
12861
13016
|
var findingsExemptedBy = (request) => request.governed.exempted.filter((exempted) => exempted.by.includes(request.record)).map((exempted) => exempted.finding);
|
|
13017
|
+
var checksOfHeldSuppressions = (request) => {
|
|
13018
|
+
const { record, runs, catalogues } = request;
|
|
13019
|
+
const catalogue = catalogueOf({ catalogues, ruleSet: record.clause.ruleSet });
|
|
13020
|
+
return catalogue === void 0 ? [] : runs.filter((run) => run.mechanism === record.mechanism).flatMap(
|
|
13021
|
+
(run) => run.nativeExceptions.filter(
|
|
13022
|
+
(exception) => exception.kind !== "config-override" && exception.kind !== "command-line-option" && exception.file === record.file && sameClauseAddress({ left: exception.clause, right: record.clause }) === "same"
|
|
13023
|
+
).flatMap((exception) => nativeSitesOf2({ exception, run, catalogue })).flatMap((site) => site.check.found === "check" ? [site.check.check] : [])
|
|
13024
|
+
);
|
|
13025
|
+
};
|
|
12862
13026
|
var carveOutAnsweredOf = (request) => {
|
|
12863
|
-
const { record, governed, catalogues } = request;
|
|
13027
|
+
const { record, governed, runs, catalogues } = request;
|
|
12864
13028
|
const doublyHeld = doublyHeldFailureOf({ record, governed });
|
|
12865
13029
|
if (doublyHeld !== void 0) {
|
|
12866
13030
|
return { outcome: "failed", error: doublyHeld };
|
|
@@ -12882,7 +13046,10 @@ var carveOutAnsweredOf = (request) => {
|
|
|
12882
13046
|
value: {
|
|
12883
13047
|
kind: "file-carve-out",
|
|
12884
13048
|
record,
|
|
12885
|
-
answer:
|
|
13049
|
+
answer: governed.stale.includes(record) ? { credit: "nothing" } : {
|
|
13050
|
+
credit: "suppression-only",
|
|
13051
|
+
checks: checksOfHeldSuppressions({ record, runs, catalogues })
|
|
13052
|
+
}
|
|
12886
13053
|
}
|
|
12887
13054
|
};
|
|
12888
13055
|
};
|
|
@@ -12906,10 +13073,10 @@ var locationAnsweredOf = (request) => {
|
|
|
12906
13073
|
};
|
|
12907
13074
|
};
|
|
12908
13075
|
var answeredOf = (request) => {
|
|
12909
|
-
const { record, governed, catalogues } = request;
|
|
13076
|
+
const { record, governed, runs, catalogues } = request;
|
|
12910
13077
|
switch (record.kind) {
|
|
12911
13078
|
case "file-carve-out":
|
|
12912
|
-
return [carveOutAnsweredOf({ record, governed, catalogues })];
|
|
13079
|
+
return [carveOutAnsweredOf({ record, governed, runs, catalogues })];
|
|
12913
13080
|
case "authorised-location":
|
|
12914
13081
|
return [locationAnsweredOf({ record, governed, catalogues })];
|
|
12915
13082
|
case "clause-wide-carve-out":
|
|
@@ -12918,7 +13085,12 @@ var answeredOf = (request) => {
|
|
|
12918
13085
|
};
|
|
12919
13086
|
var recordAnswersOf = (request) => {
|
|
12920
13087
|
const answered = request.records.flatMap(
|
|
12921
|
-
(record) => answeredOf({
|
|
13088
|
+
(record) => answeredOf({
|
|
13089
|
+
record,
|
|
13090
|
+
governed: request.governed,
|
|
13091
|
+
runs: request.runs,
|
|
13092
|
+
catalogues: request.catalogues
|
|
13093
|
+
})
|
|
12922
13094
|
);
|
|
12923
13095
|
const failed4 = answered.find((each) => each.outcome === "failed");
|
|
12924
13096
|
return failed4 ?? {
|
|
@@ -12940,7 +13112,12 @@ var createAnsweringOracle = (request) => ({
|
|
|
12940
13112
|
touched: { measured: "no", base: { state: "not-given" } },
|
|
12941
13113
|
runs: pass.value.runs
|
|
12942
13114
|
});
|
|
12943
|
-
return recordAnswersOf({
|
|
13115
|
+
return recordAnswersOf({
|
|
13116
|
+
records,
|
|
13117
|
+
governed,
|
|
13118
|
+
runs: pass.value.runs,
|
|
13119
|
+
catalogues: request.catalogues
|
|
13120
|
+
});
|
|
12944
13121
|
}
|
|
12945
13122
|
});
|
|
12946
13123
|
|
|
@@ -13123,6 +13300,7 @@ var proofRequestOf = (request) => {
|
|
|
13123
13300
|
versionOneFiles: prepared.read.versionOneFiles,
|
|
13124
13301
|
catalogues: prepared.catalogues,
|
|
13125
13302
|
repoRoot: located.repoRoot,
|
|
13303
|
+
trackedPaths: prepared.trackedPaths,
|
|
13126
13304
|
projectionFilesOf: plannedProjectionOf({
|
|
13127
13305
|
command,
|
|
13128
13306
|
repoRoot: located.repoRoot,
|