@pactosigna/trace 0.1.7 → 0.1.8

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
@@ -904,6 +904,7 @@ function detectUnitNoVerification(documents, links, deviceSafetyClass) {
904
904
  return documents.filter((d) => {
905
905
  if (d.type !== "detailed_design") return false;
906
906
  if (!isApprovedOrEffective(d)) return false;
907
+ if (d.frontmatter.software_item_type !== "unit") return false;
907
908
  return !verifiedDocIds.has(d.id);
908
909
  }).map(
909
910
  (d) => buildGap(
@@ -916,6 +917,8 @@ function detectUnitNoVerification(documents, links, deviceSafetyClass) {
916
917
  }
917
918
  function detectRiskControlNoVerification(documents, links) {
918
919
  const verifiedDocIds = buildVerifiedDocIds(links);
920
+ const docById = new Map(documents.map((d) => [d.id, d]));
921
+ const TESTABLE_TYPES = /* @__PURE__ */ new Set(["requirement", "architecture", "detailed_design"]);
919
922
  const gaps = [];
920
923
  for (const doc of documents) {
921
924
  if (!RISK_ENTRY_TYPES.has(doc.type)) continue;
@@ -932,7 +935,21 @@ function detectRiskControlNoVerification(documents, links) {
932
935
  }
933
936
  }
934
937
  for (const control of controls) {
935
- if (!verifiedDocIds.has(extractDocumentId(control))) {
938
+ const controlDocId = extractDocumentId(control);
939
+ const controlDoc = docById.get(controlDocId);
940
+ if (!controlDoc) {
941
+ gaps.push(
942
+ buildGap(
943
+ doc,
944
+ "risk_control_no_verification",
945
+ "warning",
946
+ `Risk "${doc.title}" has mitigation control "${control}" referencing document "${controlDocId}" which does not exist in the document corpus.`
947
+ )
948
+ );
949
+ continue;
950
+ }
951
+ if (!TESTABLE_TYPES.has(controlDoc.type)) continue;
952
+ if (!verifiedDocIds.has(controlDocId)) {
936
953
  gaps.push(
937
954
  buildGap(
938
955
  doc,
@@ -5631,7 +5648,13 @@ function validateDocument(content, filePath) {
5631
5648
  }
5632
5649
  }
5633
5650
  }
5634
- const SKIP_UNKNOWN_SECTION_TYPES = /* @__PURE__ */ new Set(["architecture", "detailed_design"]);
5651
+ const SKIP_UNKNOWN_SECTION_TYPES = /* @__PURE__ */ new Set([
5652
+ "architecture",
5653
+ "detailed_design",
5654
+ "sop",
5655
+ "policy",
5656
+ "work_instruction"
5657
+ ]);
5635
5658
  if (docType && !SKIP_UNKNOWN_SECTION_TYPES.has(docType)) {
5636
5659
  const bodyFormat = BODY_FORMAT[docType];
5637
5660
  const knownSections = /* @__PURE__ */ new Set();
package/dist/index.js CHANGED
@@ -1870,6 +1870,7 @@ function detectUnitNoVerification(documents, links, deviceSafetyClass) {
1870
1870
  return documents.filter((d) => {
1871
1871
  if (d.type !== "detailed_design") return false;
1872
1872
  if (!isApprovedOrEffective(d)) return false;
1873
+ if (d.frontmatter.software_item_type !== "unit") return false;
1873
1874
  return !verifiedDocIds.has(d.id);
1874
1875
  }).map(
1875
1876
  (d) => buildGap(
@@ -1882,6 +1883,8 @@ function detectUnitNoVerification(documents, links, deviceSafetyClass) {
1882
1883
  }
1883
1884
  function detectRiskControlNoVerification(documents, links) {
1884
1885
  const verifiedDocIds = buildVerifiedDocIds(links);
1886
+ const docById = new Map(documents.map((d) => [d.id, d]));
1887
+ const TESTABLE_TYPES = /* @__PURE__ */ new Set(["requirement", "architecture", "detailed_design"]);
1885
1888
  const gaps = [];
1886
1889
  for (const doc of documents) {
1887
1890
  if (!RISK_ENTRY_TYPES.has(doc.type)) continue;
@@ -1898,7 +1901,21 @@ function detectRiskControlNoVerification(documents, links) {
1898
1901
  }
1899
1902
  }
1900
1903
  for (const control of controls) {
1901
- if (!verifiedDocIds.has(extractDocumentId(control))) {
1904
+ const controlDocId = extractDocumentId(control);
1905
+ const controlDoc = docById.get(controlDocId);
1906
+ if (!controlDoc) {
1907
+ gaps.push(
1908
+ buildGap(
1909
+ doc,
1910
+ "risk_control_no_verification",
1911
+ "warning",
1912
+ `Risk "${doc.title}" has mitigation control "${control}" referencing document "${controlDocId}" which does not exist in the document corpus.`
1913
+ )
1914
+ );
1915
+ continue;
1916
+ }
1917
+ if (!TESTABLE_TYPES.has(controlDoc.type)) continue;
1918
+ if (!verifiedDocIds.has(controlDocId)) {
1902
1919
  gaps.push(
1903
1920
  buildGap(
1904
1921
  doc,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pactosigna/trace",
3
- "version": "0.1.7",
3
+ "version": "0.1.8",
4
4
  "type": "module",
5
5
  "description": "QMS traceability engine — gap detection, risk analysis, impact analysis (IEC 62304, ISO 14971)",
6
6
  "publishConfig": {