spec-controller 0.1.170 → 0.1.172

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/dist/cli.js +36 -16
  2. package/package.json +2 -2
package/dist/cli.js CHANGED
@@ -11613,14 +11613,15 @@ function sharedScnCodesOf(files) {
11613
11613
  function corpusCountsOf(files) {
11614
11614
  const raw = files.reduce((n, f) => n + f.rawScnOccurrences, 0);
11615
11615
  const scenarioCount = files.reduce((n, f) => n + f.taggedScenarios.length, 0);
11616
+ const tagOccurrences = files.reduce((n, f) => n + f.tagScnOccurrences, 0);
11616
11617
  const untagged = files.flatMap(({ feature, untaggedScenarios }) => untaggedScenarios.map((scenario) => ({ feature, scenario }))).sort((a, b) => a.feature.localeCompare(b.feature) || a.scenario.localeCompare(b.scenario));
11617
- return evidenceObligations(raw, scenarioCount, untagged, sharedScnCodesOf(files));
11618
+ return evidenceObligations(raw, scenarioCount, untagged, sharedScnCodesOf(files), tagOccurrences);
11618
11619
  }
11619
- function evidenceObligations(raw, scenarioCount, untaggedScenarios = [], sharedScnCodes = []) {
11620
+ function evidenceObligations(raw, scenarioCount, untaggedScenarios = [], sharedScnCodes = [], tagOccurrences = scenarioCount) {
11620
11621
  return {
11621
11622
  rawScnOccurrences: raw,
11622
11623
  scenarioCount,
11623
- excludedOccurrences: raw - scenarioCount,
11624
+ excludedOccurrences: raw - tagOccurrences,
11624
11625
  untaggedScenarios,
11625
11626
  sharedScnCodes
11626
11627
  };
@@ -11717,23 +11718,32 @@ function gherkinDocumentOf(source) {
11717
11718
  function contentOf({ feature }, source) {
11718
11719
  const scnOccurrences = countScnOccurrences(source);
11719
11720
  if (feature === void 0)
11720
- return { featureCode: null, scenarios: [], scnOccurrences };
11721
+ return { featureCode: null, scenarios: [], scnOccurrences, tagScnOccurrences: 0 };
11721
11722
  const scenarios = [];
11723
+ let tagScnOccurrences = 0;
11724
+ const countTags = (tags) => {
11725
+ tagScnOccurrences += countScnOccurrences(tags.map((t) => t.name).join(" "));
11726
+ };
11722
11727
  const bare = (tags) => tags.map((t) => bareTerm(t.name));
11723
11728
  const collect = (children, inherited) => {
11724
11729
  for (const child of children) {
11725
11730
  if (child.rule) {
11731
+ countTags(child.rule.tags);
11726
11732
  collect(child.rule.children, [...inherited, ...bare(child.rule.tags)]);
11727
11733
  continue;
11728
11734
  }
11729
11735
  if (!child.scenario)
11730
11736
  continue;
11737
+ countTags(child.scenario.tags);
11738
+ for (const examples of child.scenario.examples)
11739
+ countTags(examples.tags);
11731
11740
  scenarios.push({ name: child.scenario.name, tags: [...bare(child.scenario.tags), ...inherited] });
11732
11741
  }
11733
11742
  };
11743
+ countTags(feature.tags);
11734
11744
  const featureTags = bare(feature.tags);
11735
11745
  collect(feature.children, featureTags);
11736
- return { featureCode: headerFeatureCode(featureTags), scenarios, scnOccurrences };
11746
+ return { featureCode: headerFeatureCode(featureTags), scenarios, scnOccurrences, tagScnOccurrences };
11737
11747
  }
11738
11748
  function parseFeatureCorpus(sources) {
11739
11749
  return parseSources(sources, gherkinDocumentOf, contentOf);
@@ -11757,7 +11767,12 @@ function untaggedScenariosOf(feature) {
11757
11767
  }
11758
11768
  function featureCountsOf(feature) {
11759
11769
  const { taggedScenarios, untaggedScenarios } = scenariosByScnCodeOf(feature);
11760
- return { rawScnOccurrences: feature.scnOccurrences, taggedScenarios, untaggedScenarios };
11770
+ return {
11771
+ rawScnOccurrences: feature.scnOccurrences,
11772
+ tagScnOccurrences: feature.tagScnOccurrences,
11773
+ taggedScenarios,
11774
+ untaggedScenarios
11775
+ };
11761
11776
  }
11762
11777
  function corpusCountsOfFeatures(features) {
11763
11778
  return corpusCountsOf(features.map((parsed) => ({ feature: parsed.file, ...featureCountsOf(parsed) })));
@@ -12082,7 +12097,7 @@ function observationCountOf(row, qualityCheckKind) {
12082
12097
  }
12083
12098
  function stepsAt(row, qualityCheckKind, stepsByQualityCheckKind) {
12084
12099
  if (qualityCheckKind === "fitness") {
12085
- return observationsOf(row).flatMap((o) => ranAsFitnessFunction(o) && o.step !== void 0 ? [o.step] : []);
12100
+ return observationsOf(row).flatMap((o) => isFitnessObservation(o) && o.step !== void 0 ? [o.step] : []);
12086
12101
  }
12087
12102
  const observed = observationsOf(row).some((o) => o.qualityCheckKind === qualityCheckKind);
12088
12103
  if (!namesQualityCheckKind(row, qualityCheckKind) && !observed)
@@ -27687,7 +27702,7 @@ function stepAccountOf(steps, dispositionOf, nameOf2, roleOf) {
27687
27702
  return {
27688
27703
  byJob,
27689
27704
  total: totalOf(byJob),
27690
- steps: stepsBehindCounts([...steps].sort(byWorkflowThenJob), dispositionOf, nameOf2, roleOf)
27705
+ steps: stepsBehindCounts(stepsInAccountingOrder(steps), dispositionOf, nameOf2, roleOf)
27691
27706
  };
27692
27707
  }
27693
27708
  function declaredRunnersRunBy(scripts, runners, shell) {
@@ -27709,7 +27724,11 @@ function recognisedRunners(steps, nameOf2, scripts, runners, shell) {
27709
27724
  step: nameOf2(step)
27710
27725
  })));
27711
27726
  }
27712
- var WORKFLOW_FILE_THEN_COLON, jobKeyOf, byCodeUnit, byWorkflowThenJob, workflowsReadInOrder, COUNTED_AS, noStepsOf;
27727
+ function countedRunners(steps, dispositionOf, nameOf2, scripts, runners, shell) {
27728
+ const counted2 = stepsInAccountingOrder(steps).filter((step) => dispositionOf(step) === "runner");
27729
+ return recognisedRunners(counted2, nameOf2, scripts, runners, shell);
27730
+ }
27731
+ var WORKFLOW_FILE_THEN_COLON, jobKeyOf, byCodeUnit, byWorkflowThenJob, stepsInAccountingOrder, workflowsReadInOrder, COUNTED_AS, noStepsOf;
27713
27732
  var init_uncitedFitnessFunctions = __esm({
27714
27733
  "../core/dist/domain/uncitedFitnessFunctions.js"() {
27715
27734
  "use strict";
@@ -27717,6 +27736,7 @@ var init_uncitedFitnessFunctions = __esm({
27717
27736
  jobKeyOf = (step) => `${step.workflow}:${step.job}`;
27718
27737
  byCodeUnit = (a, b) => a < b ? -1 : a > b ? 1 : 0;
27719
27738
  byWorkflowThenJob = (a, b) => byCodeUnit(a.workflow, b.workflow) || byCodeUnit(a.job, b.job);
27739
+ stepsInAccountingOrder = (steps) => [...steps].sort(byWorkflowThenJob);
27720
27740
  workflowsReadInOrder = (files) => [...files].sort(byCodeUnit);
27721
27741
  COUNTED_AS = {
27722
27742
  candidate: "candidates",
@@ -28221,7 +28241,7 @@ function withScenarioCodeErrors(reconciliation, input) {
28221
28241
  };
28222
28242
  }
28223
28243
  function withReaderAccounts(reconciliation, packageJson, { steps, runners, notApplied, workflowsRead, reconciler, dispositionOf }) {
28224
- return withStepAccounting(withUnmatchedNonChecks(withRunnerAccount(reconciliation, steps, packageJson, runners), notApplied), steps, dispositionOf, reconciler.roleOf, { namingAWorkflowNotRead: notApplied.namingAWorkflowNotRead, workflowsRead });
28244
+ return withStepAccounting(withUnmatchedNonChecks(withRunnerAccount(reconciliation, steps, dispositionOf, packageJson, runners), notApplied), steps, dispositionOf, reconciler.roleOf, { namingAWorkflowNotRead: notApplied.namingAWorkflowNotRead, workflowsRead });
28225
28245
  }
28226
28246
  function withStepAccounting(reconciliation, steps, dispositionOf, roleOf, { namingAWorkflowNotRead, workflowsRead }) {
28227
28247
  if (steps.length === 0)
@@ -28248,16 +28268,16 @@ function withUnmatchedNonChecks(reconciliation, { matchingNoStep, notAStepName }
28248
28268
  }
28249
28269
  };
28250
28270
  }
28251
- function withRunnerAccount(reconciliation, steps, packageJson, { layers: runnerLayers, unrecognisedKeys }) {
28271
+ function withRunnerAccount(reconciliation, steps, dispositionOf, packageJson, { layers: runnerLayers, unrecognisedKeys }) {
28252
28272
  const scripts = packageJson.scripts ?? {};
28253
- const behaviouralRunners = recognisedRunners(steps, qualifiedStepName, scripts, runnerLayers, shellReading);
28273
+ const behaviouralRunners = countedRunners(steps, dispositionOf, qualifiedStepName, scripts, runnerLayers, shellReading);
28254
28274
  const { evidenceObservations } = reconciliation.summary;
28255
28275
  return {
28256
28276
  ...reconciliation,
28257
28277
  summary: {
28258
28278
  ...reconciliation.summary,
28259
28279
  ...evidenceObservations === void 0 ? {} : {
28260
- evidenceObservations: ciStepsJoined(evidenceObservations, reconciliation.ledger, behaviouralRunners, runnerLayers, steps.map(qualifiedStepName))
28280
+ evidenceObservations: ciStepsJoined(evidenceObservations, reconciliation.ledger, behaviouralRunners, runnerLayers, stepsInAccountingOrder(steps).map(qualifiedStepName))
28261
28281
  },
28262
28282
  ...unrecognisedKeys.length > 0 ? { runnerKeysNotALayer: unrecognisedKeys } : {}
28263
28283
  }
@@ -28416,7 +28436,7 @@ var init_messages4 = __esm({
28416
28436
  CoreMessage2[CoreMessage2["FitnessCiStep"] = 85] = "FitnessCiStep";
28417
28437
  CoreMessage2[CoreMessage2["RunnerLayerNamesNone"] = 86] = "RunnerLayerNamesNone";
28418
28438
  CoreMessage2[CoreMessage2["RunnerLayerUnnamed"] = 87] = "RunnerLayerUnnamed";
28419
- CoreMessage2[CoreMessage2["NoStepReadRunsIt"] = 88] = "NoStepReadRunsIt";
28439
+ CoreMessage2[CoreMessage2["NoStepCountedAsItsRunnerRunsIt"] = 88] = "NoStepCountedAsItsRunnerRunsIt";
28420
28440
  CoreMessage2[CoreMessage2["RunnerKeyNotALayer"] = 89] = "RunnerKeyNotALayer";
28421
28441
  CoreMessage2[CoreMessage2["ReconcilerStep"] = 90] = "ReconcilerStep";
28422
28442
  CoreMessage2[CoreMessage2["ReconcilerReconciles"] = 91] = "ReconcilerReconciles";
@@ -28583,7 +28603,7 @@ var init_messages4 = __esm({
28583
28603
  [CoreMessage.FitnessCiStep]: (steps) => `${steps} step(s), each named on its fitness function's row of Claim Reconciliations.`,
28584
28604
  [CoreMessage.RunnerLayerNamesNone]: "no runner: the target names none.",
28585
28605
  [CoreMessage.RunnerLayerUnnamed]: "unnamed: the target has not said.",
28586
- [CoreMessage.NoStepReadRunsIt]: "no step read runs it.",
28606
+ [CoreMessage.NoStepCountedAsItsRunnerRunsIt]: "no step counted as its runner runs it.",
28587
28607
  [CoreMessage.RunnerKeyNotALayer]: (key) => `${key} \u2014 not a tier: the runner block is keyed by the four tiers, and this key excludes nothing.`,
28588
28608
  [CoreMessage.ReconcilerStep]: (step, whatItIs) => `${step} \u2014 the reconciler: ${whatItIs}.`,
28589
28609
  [CoreMessage.ReconcilerReconciles]: "this step runs the reconciliation this report is",
@@ -29110,7 +29130,7 @@ var init_evidenceObservations = __esm({
29110
29130
  if (typeof runner === "string") {
29111
29131
  return [
29112
29132
  cellSafe(runner),
29113
- ciSteps ? cellSafe(ciSteps.join(", ")) : CORE_MESSAGES[CoreMessage.NoStepReadRunsIt]
29133
+ ciSteps ? cellSafe(ciSteps.join(", ")) : CORE_MESSAGES[CoreMessage.NoStepCountedAsItsRunnerRunsIt]
29114
29134
  ];
29115
29135
  }
29116
29136
  if (qualityCheckKind === "fitness") {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "spec-controller",
3
- "version": "0.1.170",
3
+ "version": "0.1.172",
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.170"
29
+ "@3f-consulting/spec-controller-core": "0.1.172"
30
30
  },
31
31
  "publishConfig": {
32
32
  "access": "public"