spec-controller 0.1.155 → 0.1.157

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
@@ -11829,6 +11829,9 @@ function evidenceOfRunResult(result) {
11829
11829
  function isFitnessObservation(observation) {
11830
11830
  return observation.qualityCheck === "fitness";
11831
11831
  }
11832
+ function ranAsFitnessFunction(observation) {
11833
+ return isFitnessObservation(observation) && observation.broken !== true && observation.exists;
11834
+ }
11832
11835
  var QUALITY_CHECKS, FALLBACK_QUALITY_CHECK, TIERS;
11833
11836
  var init_journal = __esm({
11834
11837
  "../core/dist/domain/journal.js"() {
@@ -12079,9 +12082,10 @@ function observationCountOf(row, qualityCheck) {
12079
12082
  }
12080
12083
  function stepsAt(row, qualityCheck, stepsByQualityCheck) {
12081
12084
  if (qualityCheck === "fitness") {
12082
- return ranObservationsOf(row).flatMap((o) => isFitnessObservation(o) && o.step !== void 0 ? [o.step] : []);
12085
+ return observationsOf(row).flatMap((o) => ranAsFitnessFunction(o) && o.step !== void 0 ? [o.step] : []);
12083
12086
  }
12084
- if (!namesQualityCheck(row, qualityCheck) && observationCountOf(row, qualityCheck) === 0)
12087
+ const observed = observationsOf(row).some((o) => o.qualityCheck === qualityCheck);
12088
+ if (!namesQualityCheck(row, qualityCheck) && !observed)
12085
12089
  return [];
12086
12090
  return stepsByQualityCheck.find((entry) => entry.qualityCheck === qualityCheck)?.ciSteps ?? [];
12087
12091
  }
@@ -12208,9 +12212,6 @@ function behaviouralObservationTally(ledger) {
12208
12212
  const total = BEHAVIOURAL_QUALITY_CHECKS.reduce((n, qc) => n + rawByBehaviouralQualityCheck[qc], 0);
12209
12213
  return { rawByBehaviouralQualityCheck, total, onScenario, onPhantomClaim, onUnnamedClaim };
12210
12214
  }
12211
- function ranAsFitnessFunction(observation) {
12212
- return isFitnessObservation(observation) && observation.broken !== true && observation.exists;
12213
- }
12214
12215
  function runningFitnessObservations(ledger) {
12215
12216
  return ledger.claimReconciliations.flatMap((row) => observationsOf(row).flatMap((observation) => ranAsFitnessFunction(observation) ? [observation] : []));
12216
12217
  }
@@ -12415,7 +12416,10 @@ function reconcile(scenarios, evidenceObservations, untaggedScenarios = []) {
12415
12416
  }
12416
12417
  function stepsNamed(running, stepsInOrder) {
12417
12418
  const named = new Set(running.map((observation) => observation.step));
12418
- return stepsInOrder.filter((step) => named.has(step));
12419
+ return eachOnce(stepsInOrder.filter((step) => named.has(step)));
12420
+ }
12421
+ function eachOnce(steps) {
12422
+ return [...new Set(steps)];
12419
12423
  }
12420
12424
  function withSteps(entry, ciSteps) {
12421
12425
  if (ciSteps.length === 0)
@@ -12435,7 +12439,7 @@ function ciStepsJoined(observations, ledger, runners, tiers, stepsInOrder) {
12435
12439
  return withSteps(entry, stepsNamed(runningFitnessObservations(ledger), stepsInOrder));
12436
12440
  }
12437
12441
  const running = runners.filter((row) => row.tier === entry.qualityCheck);
12438
- return withSteps(withDeclaredRunner(entry, tiers), running.map((row) => row.step));
12442
+ return withSteps(withDeclaredRunner(entry, tiers), eachOnce(running.map((row) => row.step)));
12439
12443
  })
12440
12444
  };
12441
12445
  }
@@ -27678,22 +27682,23 @@ function declaredRunnerTest(scripts, runners, shell) {
27678
27682
  const runnersRunBy = declaredRunnersRunBy(scripts, runners, shell);
27679
27683
  return (step) => runnersRunBy(step).length > 0;
27680
27684
  }
27681
- function recognisedRunners(steps, scripts, runners, shell) {
27685
+ function recognisedRunners(steps, nameOf2, scripts, runners, shell) {
27682
27686
  const runnersRunBy = declaredRunnersRunBy(scripts, runners, shell);
27683
27687
  return steps.flatMap((step) => runnersRunBy(step).map(([tier, runner]) => ({
27684
27688
  tier,
27685
27689
  runner,
27686
- step: step.identity
27690
+ step: nameOf2(step)
27687
27691
  })));
27688
27692
  }
27689
- var namesAWorkflowRead, namesAStep, jobKeyOf, byWorkflowThenJob, COUNTED_AS, noStepsOf;
27693
+ var namesAWorkflowRead, namesAStep, jobKeyOf, byCodeUnit, byWorkflowThenJob, COUNTED_AS, noStepsOf;
27690
27694
  var init_uncitedFitnessFunctions = __esm({
27691
27695
  "../core/dist/domain/uncitedFitnessFunctions.js"() {
27692
27696
  "use strict";
27693
27697
  namesAWorkflowRead = (entry, workflowsRead) => workflowsRead.some((workflow) => entry.startsWith(`${workflow}:`));
27694
27698
  namesAStep = (entry) => entry.split(":").length > 2;
27695
27699
  jobKeyOf = (step) => `${step.workflow}:${step.job}`;
27696
- byWorkflowThenJob = (a, b) => a.workflow.localeCompare(b.workflow) || a.job.localeCompare(b.job);
27700
+ byCodeUnit = (a, b) => a < b ? -1 : a > b ? 1 : 0;
27701
+ byWorkflowThenJob = (a, b) => byCodeUnit(a.workflow, b.workflow) || byCodeUnit(a.job, b.job);
27697
27702
  COUNTED_AS = {
27698
27703
  candidate: "candidates",
27699
27704
  runner: "runners",
@@ -27907,7 +27912,8 @@ var init_runVerdict = __esm({
27907
27912
 
27908
27913
  // ../core/dist/domain/outOfBalanceByFeature.js
27909
27914
  function outOfBalanceByFeature(rows, untagged, featureNames) {
27910
- const codeOfFile = new Map(Object.entries(featureNames).map(([code, slug]) => [`${slug}.feature`, code]));
27915
+ const fileOfCode = new Map(Object.entries(featureNames).map(([code, slug]) => [code, `${slug}.feature`]));
27916
+ const codeOfFile = new Map([...fileOfCode].map(([code, file]) => [file, code]));
27911
27917
  const featureOf = new Map(untagged.map((u) => [untaggedScenarioId(u), codeOfFile.get(u.feature) ?? u.feature]));
27912
27918
  const groups = /* @__PURE__ */ new Map();
27913
27919
  for (const s of rows) {
@@ -27923,10 +27929,10 @@ function outOfBalanceByFeature(rows, untagged, featureNames) {
27923
27929
  groups.set(key, group);
27924
27930
  }
27925
27931
  return [...groups].map(([feature, { claims, noScnCode }]) => {
27926
- const title = featureNames[feature];
27932
+ const featureFile = fileOfCode.get(feature);
27927
27933
  return {
27928
27934
  feature,
27929
- ...title ? { title } : {},
27935
+ ...featureFile ? { featureFile } : {},
27930
27936
  count: claims.length + noScnCode,
27931
27937
  claims,
27932
27938
  ...noScnCode > 0 ? { scenariosWithNoScnCode: noScnCode } : {}
@@ -28221,7 +28227,7 @@ function withUnmatchedNonChecks(reconciliation, { matchingNoStep, notAStepName }
28221
28227
  }
28222
28228
  function withRunnerAccount(reconciliation, steps, packageJson, { tiers: runnerTiers, unrecognisedKeys }) {
28223
28229
  const scripts = packageJson.scripts ?? {};
28224
- const behaviouralRunners = recognisedRunners(steps, scripts, runnerTiers, shellReading);
28230
+ const behaviouralRunners = recognisedRunners(steps, qualifiedStepName, scripts, runnerTiers, shellReading);
28225
28231
  const { evidenceObservations } = reconciliation.summary;
28226
28232
  return {
28227
28233
  ...reconciliation,
@@ -28657,7 +28663,7 @@ var init_outcomeDescription = __esm({
28657
28663
 
28658
28664
  // ../core/dist/render/cellSafe.js
28659
28665
  function cellSafe(text) {
28660
- return text.replace(/\s+/g, " ").replace(/\|/g, "\\|").trim();
28666
+ return text.replace(/\s+/g, " ").replace(/[\\|]/g, "\\$&").trim();
28661
28667
  }
28662
28668
  var init_cellSafe = __esm({
28663
28669
  "../core/dist/render/cellSafe.js"() {
@@ -29160,6 +29166,10 @@ function remarkWordsOf({ message, notes = [] }) {
29160
29166
  const words = [...message === void 0 ? [] : [message], ...notes.map(noteWords)];
29161
29167
  return words.length === 0 ? void 0 : words.join(" ");
29162
29168
  }
29169
+ function remarkHeadlineOf({ message, notes = [] }) {
29170
+ const headline = message?.split("\n").map((line) => line.trim()).find((line) => line.length > 0);
29171
+ return remarkWordsOf({ ...headline === void 0 ? {} : { message: headline }, notes });
29172
+ }
29163
29173
  var init_remarkWords = __esm({
29164
29174
  "../core/dist/render/remarkWords.js"() {
29165
29175
  "use strict";
@@ -29175,19 +29185,15 @@ function sharedScnCodeOf(observation) {
29175
29185
  const [code = null] = (observation.notes ?? []).flatMap((note) => note.kind === "shared-scn-code" ? [note.code] : []);
29176
29186
  return code;
29177
29187
  }
29178
- function keyOf(observation) {
29179
- return JSON.stringify([observation.qualityCheck, observation.locator ?? null, sharedScnCodeOf(observation)]);
29180
- }
29181
29188
  function remarksOf(observations) {
29182
29189
  return observations.flatMap(({ message, notes = [] }) => {
29183
29190
  const kept = notes.filter((note) => note.kind !== "shared-scn-code");
29184
- return message === void 0 && kept.length === 0 ? [] : [{ ...message !== void 0 ? { message } : {}, notes: kept }];
29191
+ return message === void 0 && kept.length === 0 ? [] : [{ ...message !== void 0 ? { message } : {}, ...kept.length > 0 ? { notes: kept } : {} }];
29185
29192
  });
29186
29193
  }
29187
- function groupOf(observations) {
29194
+ function groupOf(sharedScnCode, observations) {
29188
29195
  const [first] = observations;
29189
29196
  const passed = observations.filter((o) => o.status === "passed").length;
29190
- const sharedScnCode = sharedScnCodeOf(first);
29191
29197
  return {
29192
29198
  qualityCheck: first.qualityCheck,
29193
29199
  locator: first.locator,
@@ -29215,10 +29221,11 @@ function unnamedClaimGroupsOf(lines) {
29215
29221
  for (const o of observations) {
29216
29222
  if (isFitnessObservation(o))
29217
29223
  continue;
29218
- const key = keyOf(o);
29219
- byFile.set(key, [...byFile.get(key) ?? [], o]);
29224
+ const code = sharedScnCodeOf(o);
29225
+ const key = JSON.stringify([o.qualityCheck, o.locator ?? null, code]);
29226
+ byFile.set(key, { code, members: [...byFile.get(key)?.members ?? [], o] });
29220
29227
  }
29221
- return [...[...byFile.values()].map(groupOf), ...stepsGroupsOf(observations)];
29228
+ return [...[...byFile.values()].map(({ code, members }) => groupOf(code, members)), ...stepsGroupsOf(observations)];
29222
29229
  }
29223
29230
  var init_unnamedClaimGroups = __esm({
29224
29231
  "../core/dist/domain/unnamedClaimGroups.js"() {
@@ -29242,7 +29249,7 @@ function renderLine(line) {
29242
29249
  return `${head}${line.outcome === "broken" ? brokenSuffix(observation) : observationSuffix(observation)}`;
29243
29250
  }
29244
29251
  function quotedSuffix(parts) {
29245
- const where = parts.flatMap((part) => cellSafe(part ?? "") || []).join(": ");
29252
+ const where = parts.flatMap((part) => part?.trim() || []).join(": ");
29246
29253
  return where === "" ? "" : ` (${where})`;
29247
29254
  }
29248
29255
  function namedSuffix(o) {
@@ -29252,31 +29259,25 @@ function scenarioClauseOf({ scenario }) {
29252
29259
  return scenario === void 0 ? "" : ` \u2014 ${CORE_MESSAGES[CoreMessage.SharedScnCodeScenario](scenario.feature, scenario.title)}`;
29253
29260
  }
29254
29261
  function brokenSuffix(o) {
29255
- const remark = remarkWordsOf(o);
29256
- const where = [o.locator, remark === void 0 ? void 0 : headlineOf(remark)].filter((part) => part !== void 0 && part.length > 0).join(": ");
29257
- return where.length > 0 ? ` (${cellSafe(where)})` : "";
29262
+ return quotedSuffix([o.locator, remarkHeadlineOf(o)]);
29258
29263
  }
29259
29264
  function observationSuffix(o) {
29260
- return `${quotedSuffix([isFitnessObservation(o) ? o.fitnessFunction : o.locator])}${resultOf(o)}`;
29265
+ return `${namedSuffix(o)}${resultOf(o)}`;
29261
29266
  }
29262
29267
  function resultOf(o) {
29263
29268
  return o.status === void 0 ? "" : ` \u2014 ${CORE_MESSAGES[RESULT_MESSAGE[o.status]]}`;
29264
29269
  }
29265
- function headlineOf(message) {
29266
- return message.split("\n").map((line) => line.trim()).find((line) => line.length > 0) ?? "";
29267
- }
29268
29270
  function renderPendingItem(item) {
29269
29271
  return item.qualityCheck === void 0 ? CORE_MESSAGES[CoreMessage.PendingItem] : CORE_MESSAGES[CoreMessage.PendingItemFor](item.qualityCheck);
29270
29272
  }
29271
29273
  function renderFileGroup(group) {
29272
- const remarks = group.remarks.flatMap((remark) => remarkWordsOf(remark) ?? []);
29273
- const code = group.sharedScnCode === void 0 ? [] : [cellSafe(CORE_MESSAGES[CoreMessage.SharedScnCode](group.sharedScnCode))];
29274
- const said = [.../* @__PURE__ */ new Set([...code, ...remarks.map((remark) => cellSafe(headlineOf(remark)))])].join(" / ");
29275
- const where = group.locator === void 0 ? "" : ` (${group.locator}${said === "" ? "" : `: ${said}`})`;
29274
+ const remarks = group.remarks.flatMap((remark) => remarkHeadlineOf(remark) ?? []);
29275
+ const code = group.sharedScnCode === void 0 ? [] : [CORE_MESSAGES[CoreMessage.SharedScnCode](group.sharedScnCode)];
29276
+ const said = [.../* @__PURE__ */ new Set([...code, ...remarks])].filter((part) => part !== "").join(" / ");
29276
29277
  const counts = CORE_MESSAGES[CoreMessage.UnnamedClaimGroupCounts](group.ran, group.passed, group.failed);
29277
- const names = group.failedNames.map(cellSafe).filter((name) => name !== "");
29278
+ const names = group.failedNames.map((name) => name.trim()).filter((name) => name !== "");
29278
29279
  const failed = names.length === 0 ? "" : ` ${CORE_MESSAGES[CoreMessage.UnnamedClaimFailedNames](names)}`;
29279
- return `${group.qualityCheck}: ${OUTCOME_DESCRIPTION["cites-no-scenario"]}${where} \u2014 ${counts}${failed}`;
29280
+ return `${group.qualityCheck}: ${OUTCOME_DESCRIPTION["cites-no-scenario"]}${quotedSuffix([group.locator, said])} \u2014 ${counts}${failed}`;
29280
29281
  }
29281
29282
  function renderUnnamedClaimGroup(group) {
29282
29283
  if (!("names" in group))
@@ -29291,7 +29292,7 @@ function renderUnnamedClaimItems(lines) {
29291
29292
  }
29292
29293
  function renderRowExceptions(s) {
29293
29294
  const items = isUnnamedClaim(s) ? renderUnnamedClaimItems(reconcilingItemsOf(s)) : reconcilingItemsOf(s).map(renderLine);
29294
- const reconciling = items.join("; ");
29295
+ const reconciling = items.map(cellSafe).join("; ");
29295
29296
  const pending = s.pendingItems.map(renderPendingItem).join("; ");
29296
29297
  const groups = [reconciling, pending].filter((g) => g.length > 0);
29297
29298
  return groups.length === 0 ? "\u2014" : groups.join("; ");
@@ -29304,7 +29305,7 @@ function byFeatureTableLines(groups) {
29304
29305
  return [];
29305
29306
  const lines = [CORE_MESSAGES[CoreMessage.ByFeatureTableHeader], "| --- | --- | --- |"];
29306
29307
  for (const group of groups) {
29307
- const label = group.title ? `${group.title} (${group.feature})` : group.feature;
29308
+ const label = group.featureFile ? `${group.featureFile} (${group.feature})` : group.feature;
29308
29309
  lines.push(`| ${label} | ${group.count} | ${idsCell(group)} |`);
29309
29310
  }
29310
29311
  lines.push("");
@@ -408,7 +408,7 @@
408
408
  "feature": {
409
409
  "type": "string"
410
410
  },
411
- "title": {
411
+ "featureFile": {
412
412
  "type": "string"
413
413
  },
414
414
  "count": {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "spec-controller",
3
- "version": "0.1.155",
3
+ "version": "0.1.157",
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.155"
29
+ "@3f-consulting/spec-controller-core": "0.1.157"
30
30
  },
31
31
  "publishConfig": {
32
32
  "access": "public"