spec-controller 0.1.138 → 0.1.139
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/dist/cli.js +43 -47
- package/dist/spec-reconciliation.schema.json +4 -0
- package/package.json +2 -2
package/dist/cli.js
CHANGED
|
@@ -12419,39 +12419,28 @@ function reconcile(scenarios, evidenceObservations, untaggedScenarios = []) {
|
|
|
12419
12419
|
]
|
|
12420
12420
|
};
|
|
12421
12421
|
}
|
|
12422
|
-
function
|
|
12423
|
-
|
|
12424
|
-
|
|
12425
|
-
return observation.fitnessFunction === candidate.fitnessFunction && (observation.scnId === void 0 || candidate.id === void 0);
|
|
12426
|
-
}
|
|
12427
|
-
function stepsBehind(running, candidates) {
|
|
12428
|
-
const unmatched = [...running];
|
|
12429
|
-
return candidates.flatMap((candidate) => {
|
|
12430
|
-
const at = unmatched.findIndex((observation) => isTheStepBehind(observation, candidate));
|
|
12431
|
-
if (at === -1)
|
|
12432
|
-
return [];
|
|
12433
|
-
unmatched.splice(at, 1);
|
|
12434
|
-
return [candidate.step];
|
|
12435
|
-
});
|
|
12422
|
+
function stepsNamed(running, stepsInOrder) {
|
|
12423
|
+
const named = new Set(running.map((observation) => observation.step));
|
|
12424
|
+
return stepsInOrder.filter((step) => named.has(step));
|
|
12436
12425
|
}
|
|
12437
12426
|
function withSteps(entry, ciSteps, runner) {
|
|
12438
12427
|
if (ciSteps.length === 0)
|
|
12439
12428
|
return entry;
|
|
12440
12429
|
return { ...entry, ...runner === void 0 ? {} : { runner }, ciSteps };
|
|
12441
12430
|
}
|
|
12442
|
-
function ciStepsJoined(observations, ledger, runners,
|
|
12431
|
+
function ciStepsJoined(observations, ledger, runners, stepsInOrder) {
|
|
12443
12432
|
return {
|
|
12444
12433
|
...observations,
|
|
12445
12434
|
byQualityCheck: observations.byQualityCheck.map((entry) => {
|
|
12446
12435
|
if (entry.qualityCheck === "fitness") {
|
|
12447
|
-
return withSteps(entry,
|
|
12436
|
+
return withSteps(entry, stepsNamed(runningFitnessObservations(ledger), stepsInOrder));
|
|
12448
12437
|
}
|
|
12449
12438
|
const running = runners.filter((row) => row.tier === entry.qualityCheck);
|
|
12450
12439
|
return withSteps(entry, running.map((row) => row.step), running[0]?.runner);
|
|
12451
12440
|
})
|
|
12452
12441
|
};
|
|
12453
12442
|
}
|
|
12454
|
-
function summaryOf(ledger,
|
|
12443
|
+
function summaryOf(ledger, withEvidenceObservations) {
|
|
12455
12444
|
const tally = ledgerTally(ledger);
|
|
12456
12445
|
return {
|
|
12457
12446
|
evidenceReconciliation: {
|
|
@@ -12459,13 +12448,13 @@ function summaryOf(ledger, withBehaviouralObservations, withFitnessFunctions) {
|
|
|
12459
12448
|
qualityCheckReconciliations: tally.qualityCheckReconciliations,
|
|
12460
12449
|
pending: tally.pending
|
|
12461
12450
|
},
|
|
12462
|
-
...
|
|
12451
|
+
...withEvidenceObservations ? { evidenceObservations: evidenceObservationTally(ledger) } : {},
|
|
12463
12452
|
fitness: tally.fitness
|
|
12464
12453
|
};
|
|
12465
12454
|
}
|
|
12466
|
-
function evidenceReconciliationOf(scenarios, evidenceObservations, untaggedScenarios
|
|
12455
|
+
function evidenceReconciliationOf(scenarios, evidenceObservations, untaggedScenarios) {
|
|
12467
12456
|
const ledger = reconcile(scenarios, evidenceObservations, untaggedScenarios);
|
|
12468
|
-
return { summary: summaryOf(ledger,
|
|
12457
|
+
return { summary: summaryOf(ledger, true), ledger };
|
|
12469
12458
|
}
|
|
12470
12459
|
var init_evidenceReconciliation = __esm({
|
|
12471
12460
|
"../core/dist/domain/evidenceReconciliation.js"() {
|
|
@@ -27725,11 +27714,12 @@ var init_uncitedFitnessFunctions = __esm({
|
|
|
27725
27714
|
});
|
|
27726
27715
|
|
|
27727
27716
|
// ../core/dist/domain/fitnessReconciliation.js
|
|
27728
|
-
function namedOf(citedScn) {
|
|
27717
|
+
function namedOf({ citedScn, step }) {
|
|
27729
27718
|
return {
|
|
27730
27719
|
qualityCheck: "fitness",
|
|
27731
27720
|
fitnessFunction: citedScn,
|
|
27732
|
-
scnId: citedScn
|
|
27721
|
+
scnId: citedScn,
|
|
27722
|
+
...step === void 0 ? {} : { step }
|
|
27733
27723
|
};
|
|
27734
27724
|
}
|
|
27735
27725
|
function checkDidNotRunNote(step) {
|
|
@@ -27742,7 +27732,7 @@ function checkDidNotRunNote(step) {
|
|
|
27742
27732
|
function recordedObservationOf(step) {
|
|
27743
27733
|
if (step.report === "other") {
|
|
27744
27734
|
return {
|
|
27745
|
-
...namedOf(step
|
|
27735
|
+
...namedOf(step),
|
|
27746
27736
|
exists: false,
|
|
27747
27737
|
enforcedOverRealSource: false,
|
|
27748
27738
|
broken: true,
|
|
@@ -27750,25 +27740,36 @@ function recordedObservationOf(step) {
|
|
|
27750
27740
|
};
|
|
27751
27741
|
}
|
|
27752
27742
|
return {
|
|
27753
|
-
...namedOf(step
|
|
27743
|
+
...namedOf(step),
|
|
27754
27744
|
exists: true,
|
|
27755
27745
|
enforcedOverRealSource: true,
|
|
27756
27746
|
status: step.report === "succeeded" ? "passed" : "failed"
|
|
27757
27747
|
};
|
|
27758
27748
|
}
|
|
27759
|
-
function workflowObservationsOf(steps, isCandidate, handleOf2, citationOf) {
|
|
27749
|
+
function workflowObservationsOf(steps, isCandidate, handleOf2, stepNameOf, citationOf) {
|
|
27760
27750
|
return steps.filter(isCandidate).map((step) => {
|
|
27761
27751
|
const fitnessFunction = handleOf2(step);
|
|
27762
27752
|
const citation = citationOf(fitnessFunction, step.id);
|
|
27763
27753
|
return {
|
|
27764
27754
|
qualityCheck: "fitness",
|
|
27765
27755
|
fitnessFunction,
|
|
27756
|
+
step: stepNameOf(step),
|
|
27766
27757
|
exists: true,
|
|
27767
27758
|
enforcedOverRealSource: step.abortsJob,
|
|
27768
27759
|
...citation !== null ? { scnId: step.id ?? citation.scnId } : {}
|
|
27769
27760
|
};
|
|
27770
27761
|
}).sort((a, b) => a.fitnessFunction.localeCompare(b.fitnessFunction));
|
|
27771
27762
|
}
|
|
27763
|
+
function stepCarryingCode(steps, code, stepNameOf) {
|
|
27764
|
+
const [only, ...others] = steps.filter((step) => step.id === code);
|
|
27765
|
+
return only !== void 0 && others.length === 0 ? stepNameOf(only) : void 0;
|
|
27766
|
+
}
|
|
27767
|
+
function recordedAtSteps(recorded, steps, stepNameOf) {
|
|
27768
|
+
return recorded?.map((entry) => {
|
|
27769
|
+
const step = stepCarryingCode(steps, entry.citedScn, stepNameOf);
|
|
27770
|
+
return step === void 0 ? entry : { ...entry, step };
|
|
27771
|
+
});
|
|
27772
|
+
}
|
|
27772
27773
|
function fitnessObservationsOf(workflow, recorded) {
|
|
27773
27774
|
if (recorded === void 0)
|
|
27774
27775
|
return [...workflow];
|
|
@@ -27783,6 +27784,16 @@ var init_fitnessReconciliation = __esm({
|
|
|
27783
27784
|
}
|
|
27784
27785
|
});
|
|
27785
27786
|
|
|
27787
|
+
// ../core/dist/parse/stepNames.js
|
|
27788
|
+
function qualifiedStepName(step) {
|
|
27789
|
+
return `${step.workflow}:${step.job}:${step.identity}`;
|
|
27790
|
+
}
|
|
27791
|
+
var init_stepNames = __esm({
|
|
27792
|
+
"../core/dist/parse/stepNames.js"() {
|
|
27793
|
+
"use strict";
|
|
27794
|
+
}
|
|
27795
|
+
});
|
|
27796
|
+
|
|
27786
27797
|
// ../core/dist/parse/runningFitnessFunctions.js
|
|
27787
27798
|
function handleOf(step, scripts) {
|
|
27788
27799
|
if (!("command" in step))
|
|
@@ -27792,7 +27803,7 @@ function handleOf(step, scripts) {
|
|
|
27792
27803
|
}
|
|
27793
27804
|
function fitnessFunctionsAmong(steps, packageJson, isCandidate, citedScn) {
|
|
27794
27805
|
const scripts = packageJson.scripts ?? {};
|
|
27795
|
-
return workflowObservationsOf(steps, isCandidate, (step) => handleOf(step, scripts), citedScn);
|
|
27806
|
+
return workflowObservationsOf(steps, isCandidate, (step) => handleOf(step, scripts), qualifiedStepName, citedScn);
|
|
27796
27807
|
}
|
|
27797
27808
|
var init_runningFitnessFunctions = __esm({
|
|
27798
27809
|
"../core/dist/parse/runningFitnessFunctions.js"() {
|
|
@@ -27801,6 +27812,7 @@ var init_runningFitnessFunctions = __esm({
|
|
|
27801
27812
|
init_checkScriptsRunInCI();
|
|
27802
27813
|
init_uncitedFitnessFunctions();
|
|
27803
27814
|
init_fitnessReconciliation();
|
|
27815
|
+
init_stepNames();
|
|
27804
27816
|
}
|
|
27805
27817
|
});
|
|
27806
27818
|
|
|
@@ -28019,16 +28031,6 @@ var init_targetCorpus = __esm({
|
|
|
28019
28031
|
}
|
|
28020
28032
|
});
|
|
28021
28033
|
|
|
28022
|
-
// ../core/dist/parse/stepNames.js
|
|
28023
|
-
function qualifiedStepName(step) {
|
|
28024
|
-
return `${step.workflow}:${step.job}:${step.identity}`;
|
|
28025
|
-
}
|
|
28026
|
-
var init_stepNames = __esm({
|
|
28027
|
-
"../core/dist/parse/stepNames.js"() {
|
|
28028
|
-
"use strict";
|
|
28029
|
-
}
|
|
28030
|
-
});
|
|
28031
|
-
|
|
28032
28034
|
// ../core/dist/domain/targetConfiguration.js
|
|
28033
28035
|
function isBlock(value) {
|
|
28034
28036
|
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
@@ -28144,7 +28146,7 @@ var init_targetManifest = __esm({
|
|
|
28144
28146
|
function observationStreams(input, steps, corpus, packageJson, isCandidate) {
|
|
28145
28147
|
return [
|
|
28146
28148
|
...input.behaviouralObservations,
|
|
28147
|
-
...fitnessObservationsOf(checkObservations(corpus, steps, packageJson, isCandidate), recordedCheckStepsOf(input.ciStepRecord))
|
|
28149
|
+
...fitnessObservationsOf(checkObservations(corpus, steps, packageJson, isCandidate), recordedAtSteps(recordedCheckStepsOf(input.ciStepRecord), steps, qualifiedStepName))
|
|
28148
28150
|
];
|
|
28149
28151
|
}
|
|
28150
28152
|
function pipelineReadings(input) {
|
|
@@ -28176,7 +28178,7 @@ function evidenceReconciliationFromSources(input) {
|
|
|
28176
28178
|
const corpus = readTargetCorpus(input.features, resolveDeferralTags(packageJson, input.deferralTags));
|
|
28177
28179
|
const { steps, runners, exclusions, reconciler, dispositionOf } = pipelineReadings(input);
|
|
28178
28180
|
const isCandidate = (step) => dispositionOf(step) === "candidate";
|
|
28179
|
-
const reconciliation = evidenceReconciliationOf(corpus.scenarios, observationStreams(input, steps, corpus, packageJson, isCandidate), untaggedScenariosAmong(input.features)
|
|
28181
|
+
const reconciliation = evidenceReconciliationOf(corpus.scenarios, observationStreams(input, steps, corpus, packageJson, isCandidate), untaggedScenariosAmong(input.features));
|
|
28180
28182
|
return withScenarioCodeErrors(withConfigurationAccount(withReaderAccounts(reconciliation, steps, packageJson, runners, exclusions, reconciler, dispositionOf), packageJson), input);
|
|
28181
28183
|
}
|
|
28182
28184
|
function withConfigurationAccount(reconciliation, packageJson) {
|
|
@@ -28198,7 +28200,7 @@ function withScenarioCodeErrors(reconciliation, input) {
|
|
|
28198
28200
|
};
|
|
28199
28201
|
}
|
|
28200
28202
|
function withReaderAccounts(reconciliation, steps, packageJson, runners, exclusions, reconciler, dispositionOf) {
|
|
28201
|
-
return withStepAccounting(withUnmatchedNonChecks(withRunnerAccount(reconciliation, steps, packageJson, runners
|
|
28203
|
+
return withStepAccounting(withUnmatchedNonChecks(withRunnerAccount(reconciliation, steps, packageJson, runners), exclusions), steps, dispositionOf, reconciler.roleOf);
|
|
28202
28204
|
}
|
|
28203
28205
|
function withStepAccounting(reconciliation, steps, dispositionOf, roleOf) {
|
|
28204
28206
|
if (steps.length === 0)
|
|
@@ -28219,22 +28221,16 @@ function withUnmatchedNonChecks(reconciliation, { unmatchedEntries }) {
|
|
|
28219
28221
|
summary: { ...reconciliation.summary, nonChecksMatchingNoStep: unmatchedEntries }
|
|
28220
28222
|
};
|
|
28221
28223
|
}
|
|
28222
|
-
function withRunnerAccount(reconciliation, steps, packageJson, { tiers: runnerTiers, tiersWithoutRunner, unrecognisedKeys }
|
|
28224
|
+
function withRunnerAccount(reconciliation, steps, packageJson, { tiers: runnerTiers, tiersWithoutRunner, unrecognisedKeys }) {
|
|
28223
28225
|
const scripts = packageJson.scripts ?? {};
|
|
28224
28226
|
const behaviouralRunners = recognisedRunners(steps, scripts, runnerTiers, shellReading);
|
|
28225
28227
|
const { evidenceObservations } = reconciliation.summary;
|
|
28226
|
-
const fitnessCandidates = steps.flatMap((step) => {
|
|
28227
|
-
const id = step.id === void 0 ? {} : { id: step.id };
|
|
28228
|
-
if (dispositionOf(step) === "candidate")
|
|
28229
|
-
return [{ step: step.identity, fitnessFunction: handleOf(step, scripts), ...id }];
|
|
28230
|
-
return step.id === void 0 ? [] : [{ step: step.identity, ...id }];
|
|
28231
|
-
});
|
|
28232
28228
|
return {
|
|
28233
28229
|
...reconciliation,
|
|
28234
28230
|
summary: {
|
|
28235
28231
|
...reconciliation.summary,
|
|
28236
28232
|
...evidenceObservations === void 0 ? {} : {
|
|
28237
|
-
evidenceObservations: ciStepsJoined(evidenceObservations, reconciliation.ledger, behaviouralRunners,
|
|
28233
|
+
evidenceObservations: ciStepsJoined(evidenceObservations, reconciliation.ledger, behaviouralRunners, steps.map(qualifiedStepName))
|
|
28238
28234
|
},
|
|
28239
28235
|
...tiersWithoutRunner.length > 0 ? { tiersWithoutRunner } : {},
|
|
28240
28236
|
...unrecognisedKeys.length > 0 ? { runnerKeysNotATier: unrecognisedKeys } : {}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "spec-controller",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.139",
|
|
4
4
|
"description": "Reconcile the behaviour your scenarios name against the evidence that actually ran — the deterministic `balance` CLI.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"reconciliation",
|
|
@@ -26,7 +26,7 @@
|
|
|
26
26
|
"fast-xml-parser": "^5.11.2",
|
|
27
27
|
"ts-json-schema-generator": "^2.9.0",
|
|
28
28
|
"yaml": "^2.9.0",
|
|
29
|
-
"@3f-consulting/spec-controller-core": "0.1.
|
|
29
|
+
"@3f-consulting/spec-controller-core": "0.1.139"
|
|
30
30
|
},
|
|
31
31
|
"publishConfig": {
|
|
32
32
|
"access": "public"
|