spec-controller 0.1.123 → 0.1.124

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 CHANGED
@@ -27572,7 +27572,8 @@ function reconcilerSteps(steps, nameOf2, runsTheReconciler) {
27572
27572
  const role = reconcilerRoleOf(step, runsTheReconciler);
27573
27573
  return role === void 0 ? [] : [{ step: nameOf2(step), role }];
27574
27574
  }),
27575
- isReconciler: (step) => reconcilerRoleOf(step, runsTheReconciler) !== void 0
27575
+ isReconciler: (step) => reconcilerRoleOf(step, runsTheReconciler) !== void 0,
27576
+ roleOf: (step) => reconcilerRoleOf(step, runsTheReconciler)
27576
27577
  };
27577
27578
  }
27578
27579
  function nonChecksApplied(steps, nameOf2, nonChecks) {
@@ -27600,34 +27601,57 @@ function dispositionOfIncluded(step, runsARunner) {
27600
27601
  function stepDispositions({ isReconciler, isNamedANonCheck, runsARunner }) {
27601
27602
  return (step) => exclusionOf(step, isReconciler, isNamedANonCheck) ?? dispositionOfIncluded(step, runsARunner);
27602
27603
  }
27603
- function stepAccounting(steps, dispositionOf) {
27604
- const count = (disposition) => steps.filter((step) => dispositionOf(step) === disposition).length;
27605
- const candidates = count("candidate");
27606
- const runners = count("runner");
27607
- const reconciler = count("reconciler");
27608
- const excluded = count("nonCheck");
27609
- const plumbing = count("plumbing");
27604
+ function everyStepAccountedFor({ stepsRead, accountedFor }) {
27605
+ return accountedFor === stepsRead;
27606
+ }
27607
+ function totalOf(rows) {
27608
+ const summed = (count) => rows.reduce((sum, row) => sum + row[count], 0);
27609
+ const candidates = summed("candidates");
27610
+ const runners = summed("runners");
27611
+ const reconciler = summed("reconciler");
27612
+ const excluded = summed("excluded");
27613
+ const plumbing = summed("plumbing");
27610
27614
  return {
27611
- stepsRead: steps.length,
27615
+ stepsRead: summed("stepsRead"),
27612
27616
  candidates,
27613
27617
  runners,
27614
27618
  reconciler,
27615
27619
  excluded,
27616
27620
  plumbing,
27617
- accountedFor: reconciler + excluded + plumbing + runners + candidates
27621
+ accountedFor: candidates + runners + reconciler + excluded + plumbing
27618
27622
  };
27619
27623
  }
27620
- function everyStepAccountedFor({ stepsRead, accountedFor }) {
27621
- return accountedFor === stepsRead;
27624
+ function stepsBehindCounts(steps, dispositionOf, nameOf2, roleOf) {
27625
+ const reconciler = steps.filter((step) => dispositionOf(step) === "reconciler").flatMap((step) => {
27626
+ const role = roleOf(step);
27627
+ return role === void 0 ? [] : [{ step: nameOf2(step), role }];
27628
+ });
27629
+ const namesOf = (disposition) => steps.filter((step) => dispositionOf(step) === disposition).map(nameOf2);
27630
+ const runners = namesOf("runner");
27631
+ const excluded = namesOf("nonCheck");
27632
+ const plumbing = namesOf("plumbing");
27633
+ return {
27634
+ ...runners.length > 0 ? { runners } : {},
27635
+ ...reconciler.length > 0 ? { reconciler } : {},
27636
+ ...excluded.length > 0 ? { excluded } : {},
27637
+ ...plumbing.length > 0 ? { plumbing } : {}
27638
+ };
27622
27639
  }
27623
- function discoveryScope(steps, dispositionOf) {
27624
- const tallies = /* @__PURE__ */ new Map();
27640
+ function stepAccountOf(steps, dispositionOf, nameOf2, roleOf) {
27641
+ const rows = /* @__PURE__ */ new Map();
27625
27642
  for (const step of steps) {
27626
- const tally = tallies.get(jobKeyOf(step)) ?? { source: step.workflow, job: step.job, steps: 0, candidates: 0 };
27627
- const candidate = dispositionOf(step) === "candidate" ? 1 : 0;
27628
- tallies.set(jobKeyOf(step), { ...tally, steps: tally.steps + 1, candidates: tally.candidates + candidate });
27643
+ const row = rows.get(jobKeyOf(step)) ?? noStepsOf(step);
27644
+ const count = COUNTED_AS[dispositionOf(step)];
27645
+ rows.set(jobKeyOf(step), { ...row, stepsRead: row.stepsRead + 1, [count]: row[count] + 1 });
27629
27646
  }
27630
- return [...tallies.values()].sort((a, b) => a.source.localeCompare(b.source) || a.job.localeCompare(b.job));
27647
+ const byJob = [...rows.values()].sort((a, b) => a.workflow.localeCompare(b.workflow) || a.job.localeCompare(b.job));
27648
+ const total = totalOf(byJob);
27649
+ return {
27650
+ byJob,
27651
+ total,
27652
+ everyStepAccountedFor: everyStepAccountedFor(total),
27653
+ steps: stepsBehindCounts(steps, dispositionOf, nameOf2, roleOf)
27654
+ };
27631
27655
  }
27632
27656
  function declaredRunnersRunBy(scripts, runners, shell) {
27633
27657
  return (step) => {
@@ -27648,11 +27672,28 @@ function recognisedRunners(steps, scripts, runners, shell) {
27648
27672
  step: step.identity
27649
27673
  })));
27650
27674
  }
27651
- var jobKeyOf;
27675
+ var jobKeyOf, COUNTED_AS, noStepsOf;
27652
27676
  var init_uncitedFitnessFunctions = __esm({
27653
27677
  "../core/dist/domain/uncitedFitnessFunctions.js"() {
27654
27678
  "use strict";
27655
27679
  jobKeyOf = (step) => `${step.workflow}:${step.job}`;
27680
+ COUNTED_AS = {
27681
+ candidate: "candidates",
27682
+ runner: "runners",
27683
+ reconciler: "reconciler",
27684
+ nonCheck: "excluded",
27685
+ plumbing: "plumbing"
27686
+ };
27687
+ noStepsOf = ({ workflow, job }) => ({
27688
+ workflow,
27689
+ job,
27690
+ stepsRead: 0,
27691
+ candidates: 0,
27692
+ runners: 0,
27693
+ reconciler: 0,
27694
+ excluded: 0,
27695
+ plumbing: 0
27696
+ });
27656
27697
  }
27657
27698
  });
27658
27699
 
@@ -27824,12 +27865,8 @@ var init_runVerdict = __esm({
27824
27865
  });
27825
27866
 
27826
27867
  // ../core/dist/assemble/renderInput.js
27827
- function concludedSummary({ stepAccounting: stepAccounting2, ...summary }, verdictInputs) {
27828
- return {
27829
- ...summary,
27830
- ...stepAccounting2 ? { stepAccounting: { ...stepAccounting2, everyStepAccountedFor: everyStepAccountedFor(stepAccounting2) } } : {},
27831
- runVerdict: runVerdict(verdictInputs)
27832
- };
27868
+ function concludedSummary(summary, verdictInputs) {
27869
+ return { ...summary, runVerdict: runVerdict(verdictInputs) };
27833
27870
  }
27834
27871
  function assembleRenderInput(evidenceReconciliation, ctx, evidenceObligations2, featureNames) {
27835
27872
  const errors = errorsOf(evidenceReconciliation.scenarioCodeErrors, evidenceReconciliation.summary);
@@ -27853,7 +27890,6 @@ var init_renderInput2 = __esm({
27853
27890
  init_provenance();
27854
27891
  init_renderInput();
27855
27892
  init_runVerdict();
27856
- init_uncitedFitnessFunctions();
27857
27893
  }
27858
27894
  });
27859
27895
 
@@ -28094,40 +28130,25 @@ function withScenarioCodeErrors(reconciliation, input) {
28094
28130
  };
28095
28131
  }
28096
28132
  function withReaderAccounts(reconciliation, steps, packageJson, runners, exclusions, reconciler, dispositionOf) {
28097
- return withStepAccounting(withScopeAccount(withExclusionAccount(withReconcilerAccount(withRunnerAccount(reconciliation, steps, packageJson, runners), reconciler), exclusions), steps, dispositionOf), steps, dispositionOf);
28133
+ return withStepAccounting(withUnmatchedNonChecks(withRunnerAccount(reconciliation, steps, packageJson, runners), exclusions), steps, dispositionOf, reconciler.roleOf);
28098
28134
  }
28099
- function withStepAccounting(reconciliation, steps, dispositionOf) {
28100
- const accounting = stepAccounting(steps, dispositionOf);
28101
- if (accounting.stepsRead === 0)
28135
+ function withStepAccounting(reconciliation, steps, dispositionOf, roleOf) {
28136
+ if (steps.length === 0)
28102
28137
  return reconciliation;
28103
28138
  return {
28104
28139
  ...reconciliation,
28105
- summary: { ...reconciliation.summary, stepAccounting: accounting }
28140
+ summary: {
28141
+ ...reconciliation.summary,
28142
+ stepAccounting: stepAccountOf(steps, dispositionOf, qualifiedStepName, roleOf)
28143
+ }
28106
28144
  };
28107
28145
  }
28108
- function withScopeAccount(reconciliation, steps, dispositionOf) {
28109
- const scope = discoveryScope(steps, dispositionOf);
28110
- if (scope.length === 0)
28111
- return reconciliation;
28112
- return { ...reconciliation, summary: { ...reconciliation.summary, discoveryScope: scope } };
28113
- }
28114
- function withReconcilerAccount(reconciliation, reconciler) {
28115
- if (reconciler.steps.length === 0)
28146
+ function withUnmatchedNonChecks(reconciliation, { unmatchedEntries }) {
28147
+ if (unmatchedEntries.length === 0)
28116
28148
  return reconciliation;
28117
28149
  return {
28118
28150
  ...reconciliation,
28119
- summary: { ...reconciliation.summary, reconcilerSteps: reconciler.steps }
28120
- };
28121
- }
28122
- function withExclusionAccount(reconciliation, exclusions) {
28123
- const { excluded, unmatchedEntries } = exclusions;
28124
- return {
28125
- ...reconciliation,
28126
- summary: {
28127
- ...reconciliation.summary,
28128
- ...excluded.length > 0 ? { excludedSteps: excluded } : {},
28129
- ...unmatchedEntries.length > 0 ? { nonChecksMatchingNoStep: unmatchedEntries } : {}
28130
- }
28151
+ summary: { ...reconciliation.summary, nonChecksMatchingNoStep: unmatchedEntries }
28131
28152
  };
28132
28153
  }
28133
28154
  function withRunnerAccount(reconciliation, steps, packageJson, { tiers: runnerTiers, tiersWithoutRunner, unrecognisedKeys }) {
@@ -28170,7 +28191,11 @@ function assembleSavedReport(saved, strictGiven) {
28170
28191
  return {
28171
28192
  ...saved,
28172
28193
  runProvenance: { ...saved.runProvenance, strict },
28173
- summary: concludedSummary(saved.summary, { ledger: saved.ledger, scenarioCodeErrors: saved.errors?.scenarioCodes, strict })
28194
+ summary: concludedSummary(saved.summary, {
28195
+ ledger: saved.ledger,
28196
+ scenarioCodeErrors: saved.errors?.scenarioCodes,
28197
+ strict
28198
+ })
28174
28199
  };
28175
28200
  }
28176
28201
  var init_savedReport = __esm({
@@ -28820,15 +28845,15 @@ var init_discoveryScope = __esm({
28820
28845
  "use strict";
28821
28846
  init_messages4();
28822
28847
  discoveryScopeSection = (report) => {
28823
- const scope = report.summary.discoveryScope ?? [];
28824
- if (scope.length === 0)
28848
+ const rows = report.summary.stepAccounting?.byJob ?? [];
28849
+ if (rows.length === 0)
28825
28850
  return [];
28826
28851
  return [
28827
28852
  CORE_MESSAGES[CoreMessage.DiscoveryScopeHeading],
28828
28853
  "",
28829
28854
  CORE_MESSAGES[CoreMessage.DiscoveryScopeTableHeader],
28830
28855
  "| --- | --- | --- | --- |",
28831
- ...scope.map(({ source, job, steps, candidates }) => `| ${source} | ${job} | ${steps} | ${candidates} |`),
28856
+ ...rows.map(({ workflow, job, stepsRead, candidates }) => `| ${workflow} | ${job} | ${stepsRead} | ${candidates} |`),
28832
28857
  ""
28833
28858
  ];
28834
28859
  };
@@ -28893,7 +28918,7 @@ var init_excludedSteps = __esm({
28893
28918
  "use strict";
28894
28919
  init_messages4();
28895
28920
  excludedStepsSection = (report) => {
28896
- const excluded = report.summary.excludedSteps ?? [];
28921
+ const excluded = report.summary.stepAccounting?.steps.excluded ?? [];
28897
28922
  const unmatched = report.errors?.configuration?.nonChecksMatchingNoStep ?? [];
28898
28923
  if (excluded.length === 0 && unmatched.length === 0)
28899
28924
  return [];
@@ -28919,7 +28944,7 @@ var init_reconcilerSteps = __esm({
28919
28944
  records: CORE_MESSAGES[CoreMessage.ReconcilerRecords]
28920
28945
  };
28921
28946
  reconcilerSection = (report) => {
28922
- const steps = report.summary.reconcilerSteps ?? [];
28947
+ const steps = report.summary.stepAccounting?.steps.reconciler ?? [];
28923
28948
  if (steps.length === 0)
28924
28949
  return [];
28925
28950
  return [
@@ -28938,12 +28963,12 @@ var init_stepAccounting = __esm({
28938
28963
  "../core/dist/render/stepAccounting.js"() {
28939
28964
  "use strict";
28940
28965
  init_messages4();
28941
- verdictOf = (accounting) => accounting.everyStepAccountedFor ? `- ${CORE_MESSAGES[CoreMessage.EveryStepAccountedFor]}` : `- ${CORE_MESSAGES[CoreMessage.StepsNotAccountedFor](accounting.stepsRead, accounting.accountedFor)}`;
28966
+ verdictOf = ({ everyStepAccountedFor: everyStepAccountedFor2, total }) => everyStepAccountedFor2 ? `- ${CORE_MESSAGES[CoreMessage.EveryStepAccountedFor]}` : `- ${CORE_MESSAGES[CoreMessage.StepsNotAccountedFor](total.stepsRead, total.accountedFor)}`;
28942
28967
  stepAccountingSection = (report) => {
28943
28968
  const accounting = report.summary.stepAccounting;
28944
28969
  if (accounting === void 0)
28945
28970
  return [];
28946
- const { stepsRead, candidates, runners, reconciler, excluded, plumbing = 0, accountedFor } = accounting;
28971
+ const { stepsRead, candidates, runners, reconciler, excluded, plumbing, accountedFor } = accounting.total;
28947
28972
  return [
28948
28973
  CORE_MESSAGES[CoreMessage.StepAccountingHeading],
28949
28974
  "",
@@ -21,45 +21,6 @@
21
21
  "runVerdict": {
22
22
  "$ref": "#/definitions/RunVerdict"
23
23
  },
24
- "stepAccounting": {
25
- "type": "object",
26
- "additionalProperties": false,
27
- "properties": {
28
- "everyStepAccountedFor": {
29
- "type": "boolean"
30
- },
31
- "stepsRead": {
32
- "type": "number"
33
- },
34
- "candidates": {
35
- "type": "number"
36
- },
37
- "runners": {
38
- "type": "number"
39
- },
40
- "reconciler": {
41
- "type": "number"
42
- },
43
- "excluded": {
44
- "type": "number"
45
- },
46
- "plumbing": {
47
- "type": "number"
48
- },
49
- "accountedFor": {
50
- "type": "number"
51
- }
52
- },
53
- "required": [
54
- "accountedFor",
55
- "candidates",
56
- "everyStepAccountedFor",
57
- "excluded",
58
- "reconciler",
59
- "runners",
60
- "stepsRead"
61
- ]
62
- },
63
24
  "claimReconciliations": {
64
25
  "$ref": "#/definitions/ClaimReconciliationTotals"
65
26
  },
@@ -114,23 +75,8 @@
114
75
  "$ref": "#/definitions/TierWithoutRunner"
115
76
  }
116
77
  },
117
- "excludedSteps": {
118
- "type": "array",
119
- "items": {
120
- "type": "string"
121
- }
122
- },
123
- "reconcilerSteps": {
124
- "type": "array",
125
- "items": {
126
- "$ref": "#/definitions/ReconcilerStep"
127
- }
128
- },
129
- "discoveryScope": {
130
- "type": "array",
131
- "items": {
132
- "$ref": "#/definitions/JobDiscoveryScope"
133
- }
78
+ "stepAccounting": {
79
+ "$ref": "#/definitions/StepAccounting"
134
80
  }
135
81
  },
136
82
  "required": [
@@ -702,47 +648,156 @@
702
648
  "performance"
703
649
  ]
704
650
  },
705
- "ReconcilerStep": {
651
+ "StepAccounting": {
706
652
  "type": "object",
707
653
  "properties": {
708
- "step": {
709
- "type": "string"
654
+ "byJob": {
655
+ "type": "array",
656
+ "items": {
657
+ "$ref": "#/definitions/JobStepAccount"
658
+ }
710
659
  },
711
- "role": {
712
- "type": "string",
713
- "enum": [
714
- "reconciles",
715
- "records"
716
- ]
660
+ "total": {
661
+ "$ref": "#/definitions/StepAccountTotal"
662
+ },
663
+ "everyStepAccountedFor": {
664
+ "type": "boolean"
665
+ },
666
+ "steps": {
667
+ "$ref": "#/definitions/StepsBehindCounts"
717
668
  }
718
669
  },
719
670
  "required": [
720
- "step",
721
- "role"
671
+ "byJob",
672
+ "total",
673
+ "everyStepAccountedFor",
674
+ "steps"
722
675
  ],
723
676
  "additionalProperties": false
724
677
  },
725
- "JobDiscoveryScope": {
678
+ "JobStepAccount": {
726
679
  "type": "object",
727
680
  "properties": {
728
- "source": {
681
+ "workflow": {
729
682
  "type": "string"
730
683
  },
731
684
  "job": {
732
685
  "type": "string"
733
686
  },
734
- "steps": {
687
+ "stepsRead": {
735
688
  "type": "number"
736
689
  },
737
690
  "candidates": {
738
691
  "type": "number"
692
+ },
693
+ "runners": {
694
+ "type": "number"
695
+ },
696
+ "reconciler": {
697
+ "type": "number"
698
+ },
699
+ "excluded": {
700
+ "type": "number"
701
+ },
702
+ "plumbing": {
703
+ "type": "number"
739
704
  }
740
705
  },
741
706
  "required": [
742
- "source",
707
+ "workflow",
743
708
  "job",
744
- "steps",
745
- "candidates"
709
+ "stepsRead",
710
+ "candidates",
711
+ "runners",
712
+ "reconciler",
713
+ "excluded",
714
+ "plumbing"
715
+ ],
716
+ "additionalProperties": false
717
+ },
718
+ "StepAccountTotal": {
719
+ "type": "object",
720
+ "properties": {
721
+ "stepsRead": {
722
+ "type": "number"
723
+ },
724
+ "candidates": {
725
+ "type": "number"
726
+ },
727
+ "runners": {
728
+ "type": "number"
729
+ },
730
+ "reconciler": {
731
+ "type": "number"
732
+ },
733
+ "excluded": {
734
+ "type": "number"
735
+ },
736
+ "plumbing": {
737
+ "type": "number"
738
+ },
739
+ "accountedFor": {
740
+ "type": "number"
741
+ }
742
+ },
743
+ "required": [
744
+ "accountedFor",
745
+ "candidates",
746
+ "excluded",
747
+ "plumbing",
748
+ "reconciler",
749
+ "runners",
750
+ "stepsRead"
751
+ ],
752
+ "additionalProperties": false
753
+ },
754
+ "StepsBehindCounts": {
755
+ "type": "object",
756
+ "properties": {
757
+ "runners": {
758
+ "type": "array",
759
+ "items": {
760
+ "type": "string"
761
+ }
762
+ },
763
+ "reconciler": {
764
+ "type": "array",
765
+ "items": {
766
+ "$ref": "#/definitions/ReconcilerStep"
767
+ }
768
+ },
769
+ "excluded": {
770
+ "type": "array",
771
+ "items": {
772
+ "type": "string"
773
+ }
774
+ },
775
+ "plumbing": {
776
+ "type": "array",
777
+ "items": {
778
+ "type": "string"
779
+ }
780
+ }
781
+ },
782
+ "additionalProperties": false
783
+ },
784
+ "ReconcilerStep": {
785
+ "type": "object",
786
+ "properties": {
787
+ "step": {
788
+ "type": "string"
789
+ },
790
+ "role": {
791
+ "type": "string",
792
+ "enum": [
793
+ "reconciles",
794
+ "records"
795
+ ]
796
+ }
797
+ },
798
+ "required": [
799
+ "step",
800
+ "role"
746
801
  ],
747
802
  "additionalProperties": false
748
803
  },
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "spec-controller",
3
- "version": "0.1.123",
3
+ "version": "0.1.124",
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.123"
29
+ "@3f-consulting/spec-controller-core": "0.1.124"
30
30
  },
31
31
  "publishConfig": {
32
32
  "access": "public"