@elisra-devops/docgen-data-provider 1.91.0 → 1.92.0

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.
@@ -139,7 +139,6 @@ export default class ResultDataProvider {
139
139
  private normalizeMewpRequirementCode;
140
140
  private normalizeMewpRequirementCodeWithSuffix;
141
141
  private compareMewpRequirementCodes;
142
- private formatStepScopedRequirementGroups;
143
142
  private formatRequirementCodesGroupedByFamily;
144
143
  private toMewpComparableText;
145
144
  private fetchTestPlanName;
@@ -594,8 +594,10 @@ class ResultDataProvider {
594
594
  mentionedCodesByBase.get(baseKey).add(code);
595
595
  }
596
596
  // Direction A logic:
597
- // 1) Base mention ("SR0054") is parent-level only and considered covered
598
- // if any member of that family is linked across scoped test cases.
597
+ // 1) Base mention ("SR0054") is parent-level and considered covered only when
598
+ // the whole family is covered across scoped test cases:
599
+ // - if family has children, all children must be linked;
600
+ // - if family has no children, the base item itself must be linked.
599
601
  // 2) Child mention ("SR0054-1") is exact-match and checked across scoped test cases.
600
602
  const missingBaseWhenFamilyUncovered = new Set();
601
603
  const missingSpecificMentionedNoFamily = new Set();
@@ -606,9 +608,15 @@ class ResultDataProvider {
606
608
  const mentionedSpecificMembers = mentionedCodesList.filter((code) => /-\d+$/.test(code));
607
609
  if (familyCodes === null || familyCodes === void 0 ? void 0 : familyCodes.size) {
608
610
  const familyLinkedCodes = linkedFamilyCodesAcrossTestCases.get(baseKey) || new Set();
609
- // Base mention ("SR0054") is satisfied by any linked member in the same family.
611
+ // Base mention ("SR0054") requires full family coverage across selected test cases.
610
612
  if (hasBaseMention) {
611
- if (familyLinkedCodes.size === 0) {
613
+ const normalizedFamilyMembers = [...familyCodes]
614
+ .map((code) => this.normalizeMewpRequirementCodeWithSuffix(code))
615
+ .filter((code) => !!code);
616
+ const specificFamilyMembers = normalizedFamilyMembers.filter((code) => /-\d+$/.test(code));
617
+ const requiredFamilyMembers = specificFamilyMembers.length > 0 ? specificFamilyMembers : normalizedFamilyMembers;
618
+ const isWholeFamilyCovered = requiredFamilyMembers.every((memberCode) => familyLinkedCodes.has(memberCode));
619
+ if (!isWholeFamilyCovered) {
612
620
  missingBaseWhenFamilyUncovered.add(baseKey);
613
621
  }
614
622
  }
@@ -648,9 +656,18 @@ class ResultDataProvider {
648
656
  return;
649
657
  const normalizedStepRef = String(stepRef || 'Step ?').trim() || 'Step ?';
650
658
  if (!mentionedButNotLinkedByStep.has(normalizedStepRef)) {
651
- mentionedButNotLinkedByStep.set(normalizedStepRef, new Set());
659
+ mentionedButNotLinkedByStep.set(normalizedStepRef, {
660
+ baseIds: new Set(),
661
+ specificIds: new Set(),
662
+ });
663
+ }
664
+ const entry = mentionedButNotLinkedByStep.get(normalizedStepRef);
665
+ if (/-\d+$/.test(normalizedRequirementId)) {
666
+ entry.specificIds.add(normalizedRequirementId);
667
+ }
668
+ else {
669
+ entry.baseIds.add(normalizedRequirementId);
652
670
  }
653
- mentionedButNotLinkedByStep.get(normalizedStepRef).add(normalizedRequirementId);
654
671
  };
655
672
  const sortedMissingSpecificMentionedNoFamily = [...missingSpecificMentionedNoFamily].sort((a, b) => a.localeCompare(b));
656
673
  const sortedMissingBaseWhenFamilyUncovered = [...missingBaseWhenFamilyUncovered].sort((a, b) => a.localeCompare(b));
@@ -679,8 +696,16 @@ class ResultDataProvider {
679
696
  return stepOrderA - stepOrderB;
680
697
  return String(a[0]).localeCompare(String(b[0]));
681
698
  })
682
- .map(([stepRef, requirementIds]) => {
683
- return this.formatStepScopedRequirementGroups(stepRef, requirementIds);
699
+ .map(([stepRef, requirementIdsByType]) => {
700
+ const specificCodes = [...requirementIdsByType.specificIds].sort((a, b) => this.compareMewpRequirementCodes(a, b));
701
+ const specificFamilies = new Set(specificCodes.map((code) => this.toRequirementKey(code)).filter((code) => !!code));
702
+ const baseCodes = [...requirementIdsByType.baseIds]
703
+ .filter((baseCode) => !specificFamilies.has(baseCode))
704
+ .sort((a, b) => this.compareMewpRequirementCodes(a, b));
705
+ const displayCodes = [...specificCodes, ...baseCodes];
706
+ if (displayCodes.length === 0)
707
+ return `${stepRef}:`;
708
+ return `${stepRef}: ${displayCodes.join('; ')}`.trim();
684
709
  })
685
710
  .join('\n')
686
711
  .trim();
@@ -2174,18 +2199,6 @@ class ResultDataProvider {
2174
2199
  return left.suffix - right.suffix;
2175
2200
  return left.raw.localeCompare(right.raw);
2176
2201
  }
2177
- formatStepScopedRequirementGroups(stepRef, requirementIds) {
2178
- const groupedRequirementList = this.formatRequirementCodesGroupedByFamily(requirementIds);
2179
- if (!groupedRequirementList)
2180
- return `${stepRef}:`;
2181
- const groupedLines = groupedRequirementList
2182
- .split('\n')
2183
- .map((line) => String(line || '').trim())
2184
- .filter((line) => line.length > 0);
2185
- if (groupedLines.length <= 1)
2186
- return `${stepRef}: ${groupedLines[0] || ''}`.trim();
2187
- return `${stepRef}:\n${groupedLines.map((line) => `- ${line}`).join('\n')}`.trim();
2188
- }
2189
2202
  formatRequirementCodesGroupedByFamily(codes) {
2190
2203
  const byBaseKey = new Map();
2191
2204
  for (const rawCode of codes || []) {
@@ -2205,10 +2218,7 @@ class ResultDataProvider {
2205
2218
  const sortedMembers = [...members].sort((a, b) => this.compareMewpRequirementCodes(a, b));
2206
2219
  if (sortedMembers.length <= 1)
2207
2220
  return sortedMembers[0];
2208
- const nonBaseMembers = sortedMembers.filter((member) => member !== baseKey);
2209
- if (nonBaseMembers.length > 0) {
2210
- return `${baseKey}: ${nonBaseMembers.join(', ')}`;
2211
- }
2221
+ // Direction B display is family-level when multiple members exist.
2212
2222
  return baseKey;
2213
2223
  })
2214
2224
  .join('\n');