Просмотр исходного кода

Document board-viewer SVGs as derived BRD analysis evidence.

Add SVG safety/provenance checkers, refresh the reference inventory with
canonical vs archive BRD packaging guidance, and record validation without
re-exporting KiCad assets.

Co-authored-by: Cursor <cursoragent@cursor.com>
root 3 месяцев назад
Родитель
Сommit
3bc18efe5b

+ 315 - 0
docs/BOARDVIEW-SVG-SAFETY-REPORT.json

@@ -0,0 +1,315 @@
+{
+  "schema": "board-viewer-svg-safety-report-v1",
+  "generated_at_utc": "2026-08-04T15:57:36.409186+00:00",
+  "repository_root": "/tmp/prod2u-worktrees-linux-continue-20260804T155114Z/boardview",
+  "evidence_class": "derived_analysis_from_brd_not_rtl_td_source_closure",
+  "brd": {
+    "path": "reference/original/board/FCB_FPGA_MCU_V1.2_20260717/FCB_FPGA+MCU_V1.2_20260717.brd",
+    "exists": true,
+    "bytes": 11263312,
+    "sha256": "269b5bab2f2e1215b9392079a003badc34238ae3cbe8e5094c9a11bba8b84ebb",
+    "expected_sha256": "269b5bab2f2e1215b9392079a003badc34238ae3cbe8e5094c9a11bba8b84ebb",
+    "hash_match": true
+  },
+  "provenance": {
+    "chain": "BRD bytes -> build-info.sources.brd.sha256; import-report.source_file names the BRD; board-data.json carries geometry/touchpoints only (no embedded BRD digest); SVG asset digests recorded in build-info.assets",
+    "evidence_class": "derived_analysis_from_brd_not_rtl_td_source_closure",
+    "build_info_brd": {
+      "path": "reference/original/board/FCB_FPGA_MCU_V1.2_20260717/FCB_FPGA+MCU_V1.2_20260717.brd",
+      "sha256": "269b5bab2f2e1215b9392079a003badc34238ae3cbe8e5094c9a11bba8b84ebb"
+    },
+    "build_info_svg_assets": {
+      "board-copper.svg": {
+        "sha256": "476ef60c30104ac14d2f7398e08c3285c78f2b83147c94fd3f32f1113e895fd5",
+        "bytes": 2435022
+      },
+      "board-silkscreen.svg": {
+        "sha256": "8092a448407a55f92f43d5b547cf4343e3d6a43c2358e91a66be82eadb745cd7",
+        "bytes": 724255
+      },
+      "board-mask-edge.svg": {
+        "sha256": "fd67b71b79f78f71c4e06d7a7659108c9af403fae8e6e395d495ed16f4803f39",
+        "bytes": 430753
+      }
+    },
+    "import_report": {
+      "source_file": "FCB_FPGA+MCU_V1.2_20260717.brd",
+      "source_format": "Allegro",
+      "output_file": "board.kicad_pcb",
+      "errors": []
+    },
+    "board_data": {
+      "schema": "board-viewer-data-v1",
+      "board_id": "fcb_fpga_mcu_v1_2_20260717",
+      "view_box": {
+        "x": 0.0,
+        "y": 0.0,
+        "width": 430.0,
+        "height": 75.0
+      },
+      "embeds_brd_sha256": false,
+      "note": "board-data.json does not embed the BRD digest; trust chain is via sibling build-info.json"
+    }
+  },
+  "svgs": {
+    "board-copper.svg": {
+      "path": "/tmp/prod2u-worktrees-linux-continue-20260804T155114Z/boardview/tools/board-viewer/generated/board-copper.svg",
+      "exists": true,
+      "bytes": 2435022,
+      "sha256": "476ef60c30104ac14d2f7398e08c3285c78f2b83147c94fd3f32f1113e895fd5",
+      "viewBox": [
+        0.0,
+        0.0,
+        429.9966,
+        74.9808
+      ],
+      "width": "429.9966mm",
+      "height": "74.9808mm",
+      "safety_issues": [],
+      "xmlns_w3_only_external": true,
+      "build_info_sha256": "476ef60c30104ac14d2f7398e08c3285c78f2b83147c94fd3f32f1113e895fd5",
+      "matches_build_info": true,
+      "coord_delta_vs_board_data_mm": {
+        "dx": 0.0,
+        "dy": 0.0,
+        "dw": 0.0033999999999991815,
+        "dh": 0.019199999999997885
+      }
+    },
+    "board-silkscreen.svg": {
+      "path": "/tmp/prod2u-worktrees-linux-continue-20260804T155114Z/boardview/tools/board-viewer/generated/board-silkscreen.svg",
+      "exists": true,
+      "bytes": 724255,
+      "sha256": "8092a448407a55f92f43d5b547cf4343e3d6a43c2358e91a66be82eadb745cd7",
+      "viewBox": [
+        0.0,
+        0.0,
+        429.9966,
+        74.9808
+      ],
+      "width": "429.9966mm",
+      "height": "74.9808mm",
+      "safety_issues": [],
+      "xmlns_w3_only_external": true,
+      "build_info_sha256": "8092a448407a55f92f43d5b547cf4343e3d6a43c2358e91a66be82eadb745cd7",
+      "matches_build_info": true,
+      "coord_delta_vs_board_data_mm": {
+        "dx": 0.0,
+        "dy": 0.0,
+        "dw": 0.0033999999999991815,
+        "dh": 0.019199999999997885
+      }
+    },
+    "board-mask-edge.svg": {
+      "path": "/tmp/prod2u-worktrees-linux-continue-20260804T155114Z/boardview/tools/board-viewer/generated/board-mask-edge.svg",
+      "exists": true,
+      "bytes": 430753,
+      "sha256": "fd67b71b79f78f71c4e06d7a7659108c9af403fae8e6e395d495ed16f4803f39",
+      "viewBox": [
+        0.0,
+        0.0,
+        429.9966,
+        74.9808
+      ],
+      "width": "429.9966mm",
+      "height": "74.9808mm",
+      "safety_issues": [],
+      "xmlns_w3_only_external": true,
+      "build_info_sha256": "fd67b71b79f78f71c4e06d7a7659108c9af403fae8e6e395d495ed16f4803f39",
+      "matches_build_info": true,
+      "coord_delta_vs_board_data_mm": {
+        "dx": 0.0,
+        "dy": 0.0,
+        "dw": 0.0033999999999991815,
+        "dh": 0.019199999999997885
+      }
+    }
+  },
+  "findings": [
+    {
+      "check": "brd.sha256",
+      "status": "pass",
+      "detail": "269b5bab2f2e1215b9392079a003badc34238ae3cbe8e5094c9a11bba8b84ebb"
+    },
+    {
+      "check": "provenance.build_info.brd_sha256",
+      "status": "pass",
+      "detail": "269b5bab2f2e1215b9392079a003badc34238ae3cbe8e5094c9a11bba8b84ebb"
+    },
+    {
+      "check": "provenance.import_report.source_file",
+      "status": "pass",
+      "detail": "FCB_FPGA+MCU_V1.2_20260717.brd"
+    },
+    {
+      "check": "provenance.import_report.errors",
+      "status": "pass",
+      "detail": "none"
+    },
+    {
+      "check": "provenance.board_data.view_box",
+      "status": "pass",
+      "detail": "{\"x\": 0.0, \"y\": 0.0, \"width\": 430.0, \"height\": 75.0}"
+    },
+    {
+      "check": "svg_safety.board-copper.svg.script",
+      "status": "pass",
+      "detail": "clean"
+    },
+    {
+      "check": "svg_safety.board-copper.svg.external_http",
+      "status": "pass",
+      "detail": "clean"
+    },
+    {
+      "check": "svg_safety.board-copper.svg.file_url",
+      "status": "pass",
+      "detail": "clean"
+    },
+    {
+      "check": "svg_safety.board-copper.svg.absolute_windows_path",
+      "status": "pass",
+      "detail": "clean"
+    },
+    {
+      "check": "svg_safety.board-copper.svg.absolute_local_unix_path",
+      "status": "pass",
+      "detail": "clean"
+    },
+    {
+      "check": "svg_safety.board-copper.svg.external_href",
+      "status": "pass",
+      "detail": "clean"
+    },
+    {
+      "check": "svg_safety.board-copper.svg.external_url_func",
+      "status": "pass",
+      "detail": "clean"
+    },
+    {
+      "check": "svg_safety.board-copper.svg.non_reproducible_randomness",
+      "status": "pass",
+      "detail": "clean"
+    },
+    {
+      "check": "svg.hash.board-copper.svg",
+      "status": "pass",
+      "detail": "476ef60c30104ac14d2f7398e08c3285c78f2b83147c94fd3f32f1113e895fd5"
+    },
+    {
+      "check": "svg.coords.board-copper.svg",
+      "status": "pass",
+      "detail": "delta_mm dx=0.000000 dy=0.000000 dw=0.003400 dh=0.019200"
+    },
+    {
+      "check": "svg_safety.board-silkscreen.svg.script",
+      "status": "pass",
+      "detail": "clean"
+    },
+    {
+      "check": "svg_safety.board-silkscreen.svg.external_http",
+      "status": "pass",
+      "detail": "clean"
+    },
+    {
+      "check": "svg_safety.board-silkscreen.svg.file_url",
+      "status": "pass",
+      "detail": "clean"
+    },
+    {
+      "check": "svg_safety.board-silkscreen.svg.absolute_windows_path",
+      "status": "pass",
+      "detail": "clean"
+    },
+    {
+      "check": "svg_safety.board-silkscreen.svg.absolute_local_unix_path",
+      "status": "pass",
+      "detail": "clean"
+    },
+    {
+      "check": "svg_safety.board-silkscreen.svg.external_href",
+      "status": "pass",
+      "detail": "clean"
+    },
+    {
+      "check": "svg_safety.board-silkscreen.svg.external_url_func",
+      "status": "pass",
+      "detail": "clean"
+    },
+    {
+      "check": "svg_safety.board-silkscreen.svg.non_reproducible_randomness",
+      "status": "pass",
+      "detail": "clean"
+    },
+    {
+      "check": "svg.hash.board-silkscreen.svg",
+      "status": "pass",
+      "detail": "8092a448407a55f92f43d5b547cf4343e3d6a43c2358e91a66be82eadb745cd7"
+    },
+    {
+      "check": "svg.coords.board-silkscreen.svg",
+      "status": "pass",
+      "detail": "delta_mm dx=0.000000 dy=0.000000 dw=0.003400 dh=0.019200"
+    },
+    {
+      "check": "svg_safety.board-mask-edge.svg.script",
+      "status": "pass",
+      "detail": "clean"
+    },
+    {
+      "check": "svg_safety.board-mask-edge.svg.external_http",
+      "status": "pass",
+      "detail": "clean"
+    },
+    {
+      "check": "svg_safety.board-mask-edge.svg.file_url",
+      "status": "pass",
+      "detail": "clean"
+    },
+    {
+      "check": "svg_safety.board-mask-edge.svg.absolute_windows_path",
+      "status": "pass",
+      "detail": "clean"
+    },
+    {
+      "check": "svg_safety.board-mask-edge.svg.absolute_local_unix_path",
+      "status": "pass",
+      "detail": "clean"
+    },
+    {
+      "check": "svg_safety.board-mask-edge.svg.external_href",
+      "status": "pass",
+      "detail": "clean"
+    },
+    {
+      "check": "svg_safety.board-mask-edge.svg.external_url_func",
+      "status": "pass",
+      "detail": "clean"
+    },
+    {
+      "check": "svg_safety.board-mask-edge.svg.non_reproducible_randomness",
+      "status": "pass",
+      "detail": "clean"
+    },
+    {
+      "check": "svg.hash.board-mask-edge.svg",
+      "status": "pass",
+      "detail": "fd67b71b79f78f71c4e06d7a7659108c9af403fae8e6e395d495ed16f4803f39"
+    },
+    {
+      "check": "svg.coords.board-mask-edge.svg",
+      "status": "pass",
+      "detail": "delta_mm dx=0.000000 dy=0.000000 dw=0.003400 dh=0.019200"
+    },
+    {
+      "check": "svg.coords.consistent_across_layers",
+      "status": "pass",
+      "detail": "(0.0, 0.0, 429.9966, 74.9808)"
+    }
+  ],
+  "summary": {
+    "pass": 36,
+    "fail": 0,
+    "other": 0
+  }
+}

+ 80 - 0
docs/BOARDVIEW-SVG-SAFETY-REPORT.md

@@ -0,0 +1,80 @@
+# Board-viewer SVG safety / provenance report
+
+Generated: `2026-08-04T15:57:36.409186+00:00`
+
+Evidence class: **derived_analysis_from_brd_not_rtl_td_source_closure**
+
+SVGs under `tools/board-viewer/generated/` are derived analysis artifacts produced from the Allegro BRD through KiCad import/export. They support physical pin/network review only. They are **not** RTL, TD, ADC, constraint, or bitstream source closure.
+
+## BRD
+
+```json
+{
+  "path": "reference/original/board/FCB_FPGA_MCU_V1.2_20260717/FCB_FPGA+MCU_V1.2_20260717.brd",
+  "exists": true,
+  "bytes": 11263312,
+  "sha256": "269b5bab2f2e1215b9392079a003badc34238ae3cbe8e5094c9a11bba8b84ebb",
+  "expected_sha256": "269b5bab2f2e1215b9392079a003badc34238ae3cbe8e5094c9a11bba8b84ebb",
+  "hash_match": true
+}
+```
+
+## Provenance
+
+```json
+{
+  "chain": "BRD bytes -> build-info.sources.brd.sha256; import-report.source_file names the BRD; board-data.json carries geometry/touchpoints only (no embedded BRD digest); SVG asset digests recorded in build-info.assets",
+  "evidence_class": "derived_analysis_from_brd_not_rtl_td_source_closure",
+  "build_info_brd": {
+    "path": "reference/original/board/FCB_FPGA_MCU_V1.2_20260717/FCB_FPGA+MCU_V1.2_20260717.brd",
+    "sha256": "269b5bab2f2e1215b9392079a003badc34238ae3cbe8e5094c9a11bba8b84ebb"
+  },
+  "build_info_svg_assets": {
+    "board-copper.svg": {
+      "sha256": "476ef60c30104ac14d2f7398e08c3285c78f2b83147c94fd3f32f1113e895fd5",
+      "bytes": 2435022
+    },
+    "board-silkscreen.svg": {
+      "sha256": "8092a448407a55f92f43d5b547cf4343e3d6a43c2358e91a66be82eadb745cd7",
+      "bytes": 724255
+    },
+    "board-mask-edge.svg": {
+      "sha256": "fd67b71b79f78f71c4e06d7a7659108c9af403fae8e6e395d495ed16f4803f39",
+      "bytes": 430753
+    }
+  },
+  "import_report": {
+    "source_file": "FCB_FPGA+MCU_V1.2_20260717.brd",
+    "source_format": "Allegro",
+    "output_file": "board.kicad_pcb",
+    "errors": []
+  },
+  "board_data": {
+    "schema": "board-viewer-data-v1",
+    "board_id": "fcb_fpga_mcu_v1_2_20260717",
+    "view_box": {
+      "x": 0.0,
+      "y": 0.0,
+      "width": 430.0,
+      "height": 75.0
+    },
+    "embeds_brd_sha256": false,
+    "note": "board-data.json does not embed the BRD digest; trust chain is via sibling build-info.json"
+  }
+}
+```
+
+## SVG summary
+
+| SVG | Exists | SHA-256 | Safety issues | Matches build-info |
+|-----|--------|---------|---------------|--------------------|
+| `board-copper.svg` | True | `476ef60c30104ac1...` | none | True |
+| `board-silkscreen.svg` | True | `8092a448407a55f9...` | none | True |
+| `board-mask-edge.svg` | True | `fd67b71b79f78f71...` | none | True |
+
+## Findings
+
+- pass: 36
+- fail: 0
+
+- All checks passed.

+ 19 - 0
docs/BRD_ANALYSIS_FOR_AGENTS.zh-CN.md

@@ -13,6 +13,25 @@
 
 本交接包同时包含 **原始 BRD/PDF** 和 **已解析的 board-viewer 产物**,请优先读 JSON,不要试图把 `.brd` 当文本解析。
 
+`tools/board-viewer/generated/` 下的 `board-*.svg` / `board-data.json` / `build-info.json` / `import-report.json` 是从 Allegro BRD 经 KiCad 导出的**派生分析证据**,只用于物理连接与选脚核对;**不是** RTL、TD、ADC、约束或 bitstream 的源闭环。期望 BRD SHA-256:`269b5bab2f2e1215b9392079a003badc34238ae3cbe8e5094c9a11bba8b84ebb`。
+
+`reference/original/local_archives/board/FCB_FPGA+MCU_V1.2_20260717.brd` 与规范路径 `reference/original/board/FCB_FPGA_MCU_V1.2_20260717/` 下主副本字节相同;分析打包应只保留一份物理 BRD(规范路径),归档镜像本地保留即可。
+
+## 证据边界(重要)
+
+`tools/board-viewer/generated/` 下的 `board-*.svg`、`board-data.json`、`build-info.json`、`import-report.json` 都是由 Allegro BRD(经 KiCad 导入/导出)得到的**派生分析证据**,只用于物理连接与板图核对。
+
+它们**不是** RTL、TD、ADC、约束或 bitstream 的源闭合证据。BRD 指纹以 `build-info.json` 的 `sources.brd.sha256` 为准(期望 `269b5bab2f2e1215b9392079a003badc34238ae3cbe8e5094c9a11bba8b84ebb`)。
+
+`reference/original/local_archives/board/FCB_FPGA+MCU_V1.2_20260717.brd` 与规范路径 `reference/original/board/FCB_FPGA_MCU_V1.2_20260717/` 下主副本字节一致;分析打包应只保留一份物理 BRD(规范路径),归档镜像不要再打进包。
+
+SVG 安全/坐标一致性检查:
+
+```bash
+tools/check-board-viewer-svgs.sh
+tools/refresh-reference-inventory.sh
+```
+
 ## 关键文件路径(解压后)
 
 ```

+ 69 - 18
docs/REFERENCE-INVENTORY.json

@@ -1,13 +1,20 @@
 {
   "schema": "prod2u-reference-inventory-v1",
-  "generated_at_utc": "2026-08-04T13:32:46.934390+00:00",
-  "repository_root": "/root/Agentworkspace/CPLD_temperature_control_board",
+  "generated_at_utc": "2026-08-04T15:57:24.877944+00:00",
+  "repository_root": "/tmp/prod2u-worktrees-linux-continue-20260804T155114Z/boardview",
+  "evidence_boundaries": {
+    "board_viewer_svgs_and_json": "Derived analysis evidence from the Allegro BRD via KiCad. Not RTL/TD/ADC/bitstream source closure.",
+    "canonical_brd": "reference/original/board/FCB_FPGA_MCU_V1.2_20260717/FCB_FPGA+MCU_V1.2_20260717.brd",
+    "duplicate_brd_archive": "reference/original/local_archives/board/FCB_FPGA+MCU_V1.2_20260717.brd",
+    "packaging_recommendation": "Analysis packages should ship one physical BRD copy at the canonical path; treat local_archives/board as a local-only mirror.",
+    "expected_brd_sha256": "269b5bab2f2e1215b9392079a003badc34238ae3cbe8e5094c9a11bba8b84ebb"
+  },
   "items": [
     {
       "path": "reference/original/MANIFEST.zh-CN.md",
       "exists": true,
-      "size": 5470,
-      "sha256": "91916a1b669f210a0f5dd9abafb5af70902299147a293124755a64f08dc1f7f8",
+      "size": 5472,
+      "sha256": "ee898c56b671fa412510c9dd8aa9ca9703a7d25de111285dbf0c5a9db1c39608",
       "confidence": "present"
     },
     {
@@ -17,7 +24,21 @@
       "sha256": "269b5bab2f2e1215b9392079a003badc34238ae3cbe8e5094c9a11bba8b84ebb",
       "expected_sha256": "269b5bab2f2e1215b9392079a003badc34238ae3cbe8e5094c9a11bba8b84ebb",
       "hash_match": true,
-      "confidence": "confirmed"
+      "confidence": "confirmed",
+      "role": "canonical_brd",
+      "packaging_note": "Canonical physical BRD for analysis packages; prefer this path over local_archives duplicate"
+    },
+    {
+      "path": "reference/original/local_archives/board/FCB_FPGA+MCU_V1.2_20260717.brd",
+      "exists": true,
+      "size": 11263312,
+      "sha256": "269b5bab2f2e1215b9392079a003badc34238ae3cbe8e5094c9a11bba8b84ebb",
+      "expected_sha256": "269b5bab2f2e1215b9392079a003badc34238ae3cbe8e5094c9a11bba8b84ebb",
+      "hash_match": true,
+      "confidence": "confirmed",
+      "role": "duplicate_archive_mirror",
+      "byte_identical_to_canonical": true,
+      "packaging_recommendation": "Keep one physical copy in analysis packages: include reference/original/board/FCB_FPGA_MCU_V1.2_20260717/FCB_FPGA+MCU_V1.2_20260717.brd and omit reference/original/local_archives/board/FCB_FPGA+MCU_V1.2_20260717.brd (or replace the archive entry with a provenance pointer to the canonical path)."
     },
     {
       "path": "reference/original/schematics/8000高温罩电气图V2.0.pdf",
@@ -52,30 +73,60 @@
     {
       "path": "config/board_viewer_annotations.fcb_fpga_mcu_v1_2.json",
       "exists": true,
-      "size": 558342,
-      "sha256": "8f566988172447af4bf61e2d80d798c8338945232952bdf9b19a0dc17e65cc9e",
+      "size": 558624,
+      "sha256": "1e39d0106c92daa1425f5b43bf30e36e10615ab912c9570b3d4f427232f84cc1",
       "confidence": "present"
     },
     {
       "path": "tools/board-viewer/generated/board-data.json",
       "exists": true,
-      "size": 2007613,
-      "sha256": "fb405bd810201cefd4d31677b827b00d3e2b5f0e01c48403c92b8d168ee5bf2d",
-      "confidence": "present"
+      "size": 2007643,
+      "sha256": "daecebf7ccc3d0a8be07a01bae86cf73775bc6a269aad6c3bfec66a1acf0cd63",
+      "confidence": "present",
+      "evidence_class": "derived_analysis_from_brd_not_rtl_td_source_closure"
     },
     {
       "path": "tools/board-viewer/generated/build-info.json",
       "exists": true,
       "size": 3716,
-      "sha256": "e854542a535ee444fbf12cb65615f819f3381fdca17c9db9dc802c2bb6577eb0",
-      "confidence": "present"
+      "sha256": "2619dd39f405b7d3ef77413059798b000dac5abb432411a8939ce88a3a362fcc",
+      "confidence": "present",
+      "evidence_class": "derived_analysis_from_brd_not_rtl_td_source_closure"
     },
     {
       "path": "tools/board-viewer/generated/import-report.json",
       "exists": true,
       "size": 4377,
       "sha256": "b083ce18dea974f9b5bba886c8e9030d59b30c1d0413f3822ce4a0e4f074edeb",
-      "confidence": "present"
+      "confidence": "present",
+      "evidence_class": "derived_analysis_from_brd_not_rtl_td_source_closure"
+    },
+    {
+      "path": "tools/board-viewer/generated/board-copper.svg",
+      "exists": true,
+      "size": 2435022,
+      "sha256": "476ef60c30104ac14d2f7398e08c3285c78f2b83147c94fd3f32f1113e895fd5",
+      "confidence": "present",
+      "evidence_class": "derived_analysis_from_brd_not_rtl_td_source_closure",
+      "layer": "F.Cu,Edge.Cuts"
+    },
+    {
+      "path": "tools/board-viewer/generated/board-silkscreen.svg",
+      "exists": true,
+      "size": 724255,
+      "sha256": "8092a448407a55f92f43d5b547cf4343e3d6a43c2358e91a66be82eadb745cd7",
+      "confidence": "present",
+      "evidence_class": "derived_analysis_from_brd_not_rtl_td_source_closure",
+      "layer": "F.SilkS,Edge.Cuts"
+    },
+    {
+      "path": "tools/board-viewer/generated/board-mask-edge.svg",
+      "exists": true,
+      "size": 430753,
+      "sha256": "fd67b71b79f78f71c4e06d7a7659108c9af403fae8e6e395d495ed16f4803f39",
+      "confidence": "present",
+      "evidence_class": "derived_analysis_from_brd_not_rtl_td_source_closure",
+      "layer": "F.Mask,Edge.Cuts"
     }
   ],
   "board_viewer_build_info": {
@@ -97,7 +148,7 @@
       },
       "annotations": {
         "path": "config/board_viewer_annotations.fcb_fpga_mcu_v1_2.json",
-        "sha256": "8f566988172447af4bf61e2d80d798c8338945232952bdf9b19a0dc17e65cc9e"
+        "sha256": "1e39d0106c92daa1425f5b43bf30e36e10615ab912c9570b3d4f427232f84cc1"
       },
       "generator_pipeline": {
         "path": "tools/board-viewer/board_viewer/generator.py",
@@ -146,8 +197,8 @@
     },
     "assets": {
       "board-data.json": {
-        "sha256": "fb405bd810201cefd4d31677b827b00d3e2b5f0e01c48403c92b8d168ee5bf2d",
-        "bytes": 2007613
+        "sha256": "daecebf7ccc3d0a8be07a01bae86cf73775bc6a269aad6c3bfec66a1acf0cd63",
+        "bytes": 2007643
       },
       "board-mask-edge.svg": {
         "sha256": "fd67b71b79f78f71c4e06d7a7659108c9af403fae8e6e395d495ed16f4803f39",
@@ -184,9 +235,9 @@
     }
   },
   "summary": {
-    "present": 10,
+    "present": 14,
     "missing": 0,
-    "hash_ok": 2,
+    "hash_ok": 3,
     "hash_fail": 0
   }
 }

+ 27 - 15
docs/REFERENCE-INVENTORY.md

@@ -1,21 +1,33 @@
 # Reference Inventory
 
-Generated: 2026-08-04T13:32:46.934390+00:00
+Generated: 2026-08-04T15:57:24.877944+00:00
 
-- present: 10
+- present: 14
 - missing: 0
-- hash_ok: 2
+- hash_ok: 3
 - hash_fail: 0
 
-| Path | Exists | Size | Confidence | Hash notes |
-|------|--------|------|------------|------------|
-| `reference/original/MANIFEST.zh-CN.md` | True | 5470 | present | 91916a1b669f210a... |
-| `reference/original/board/FCB_FPGA_MCU_V1.2_20260717/FCB_FPGA+MCU_V1.2_20260717.brd` | True | 11263312 | confirmed | MATCH |
-| `reference/original/schematics/8000高温罩电气图V2.0.pdf` | True | 1806622 | confirmed | MATCH |
-| `reference/original/schematics/FCB_FPGA+MCU0611.pdf` | True | 529277 | present | caabc66444c7b9d5... |
-| `reference/original/diagrams/上位机逻辑.svg` | True | 53067 | present | afd88c9ed72ce429... |
-| `reference/original/diagrams/接长鑫水滴系统.svg` | True | 22153 | present | e4e752cc9030f0ce... |
-| `config/board_viewer_annotations.fcb_fpga_mcu_v1_2.json` | True | 558342 | present | 8f566988172447af... |
-| `tools/board-viewer/generated/board-data.json` | True | 2007613 | present | fb405bd810201cef... |
-| `tools/board-viewer/generated/build-info.json` | True | 3716 | present | e854542a535ee444... |
-| `tools/board-viewer/generated/import-report.json` | True | 4377 | present | b083ce18dea974f9... |
+## Evidence boundaries
+
+- Board-viewer JSON/SVG: Derived analysis evidence from the Allegro BRD via KiCad. Not RTL/TD/ADC/bitstream source closure.
+- Canonical BRD: `reference/original/board/FCB_FPGA_MCU_V1.2_20260717/FCB_FPGA+MCU_V1.2_20260717.brd`
+- Duplicate archive BRD: `reference/original/local_archives/board/FCB_FPGA+MCU_V1.2_20260717.brd` (byte-identical local mirror; packaging should keep one physical copy)
+- Expected BRD SHA-256: `269b5bab2f2e1215b9392079a003badc34238ae3cbe8e5094c9a11bba8b84ebb`
+- Packager recommendation: Analysis packages should ship one physical BRD copy at the canonical path; treat local_archives/board as a local-only mirror.
+
+| Path | Exists | Size | Confidence | Hash notes | Evidence |
+|------|--------|------|------------|------------|----------|
+| `reference/original/MANIFEST.zh-CN.md` | True | 5472 | present | ee898c56b671fa41... | source/reference |
+| `reference/original/board/FCB_FPGA_MCU_V1.2_20260717/FCB_FPGA+MCU_V1.2_20260717.brd` | True | 11263312 | confirmed | MATCH | canonical_brd |
+| `reference/original/local_archives/board/FCB_FPGA+MCU_V1.2_20260717.brd` | True | 11263312 | confirmed | MATCH | duplicate_archive_mirror |
+| `reference/original/schematics/8000高温罩电气图V2.0.pdf` | True | 1806622 | confirmed | MATCH | source/reference |
+| `reference/original/schematics/FCB_FPGA+MCU0611.pdf` | True | 529277 | present | caabc66444c7b9d5... | source/reference |
+| `reference/original/diagrams/上位机逻辑.svg` | True | 53067 | present | afd88c9ed72ce429... | source/reference |
+| `reference/original/diagrams/接长鑫水滴系统.svg` | True | 22153 | present | e4e752cc9030f0ce... | source/reference |
+| `config/board_viewer_annotations.fcb_fpga_mcu_v1_2.json` | True | 558624 | present | 1e39d0106c92daa1... | source/reference |
+| `tools/board-viewer/generated/board-data.json` | True | 2007643 | present | daecebf7ccc3d0a8... | derived_analysis_from_brd_not_rtl_td_source_closure |
+| `tools/board-viewer/generated/build-info.json` | True | 3716 | present | 2619dd39f405b7d3... | derived_analysis_from_brd_not_rtl_td_source_closure |
+| `tools/board-viewer/generated/import-report.json` | True | 4377 | present | b083ce18dea974f9... | derived_analysis_from_brd_not_rtl_td_source_closure |
+| `tools/board-viewer/generated/board-copper.svg` | True | 2435022 | present | 476ef60c30104ac1... | derived_analysis_from_brd_not_rtl_td_source_closure |
+| `tools/board-viewer/generated/board-silkscreen.svg` | True | 724255 | present | 8092a448407a55f9... | derived_analysis_from_brd_not_rtl_td_source_closure |
+| `tools/board-viewer/generated/board-mask-edge.svg` | True | 430753 | present | fd67b71b79f78f71... | derived_analysis_from_brd_not_rtl_td_source_closure |

+ 2 - 2
reference/original/MANIFEST.zh-CN.md

@@ -46,9 +46,9 @@
 
 | 路径 | 原始名称或来源 | SHA-256 |
 | --- | --- | --- |
-| `board/FCB_FPGA_MCU_V1.2_20260717/FCB_FPGA+MCU_V1.2_20260717.brd` | `FCB_FPGA+MCU_V1.2_20260717.brd` | `269B5BAB2F2E1215B9392079A003BADC34238AECBE8E5094C9A11BBA8B84EBB` |
+| `board/FCB_FPGA_MCU_V1.2_20260717/FCB_FPGA+MCU_V1.2_20260717.brd` | `FCB_FPGA+MCU_V1.2_20260717.brd` | `269B5BAB2F2E1215B9392079A003BADC34238AE3CBE8E5094C9A11BBA8B84EBB` |
 | `schematics/8000高温罩电气图V2.0.pdf` | `8000高温罩电气图V2.0.pdf` | `7EBD0DCED194338CEB97FF5A0ABCEE2D9790E7F6E7A90D9D4BE7DE593DCA7EB5` |
-| `local_archives/board/FCB_FPGA+MCU_V1.2_20260717.brd` | 主副本冗余镜像 | `269B5BAB2F2E1215B9392079A003BADC34238AECBE8E5094C9A11BBA8B84EBB` |
+| `local_archives/board/FCB_FPGA+MCU_V1.2_20260717.brd` | 主副本冗余镜像 | `269B5BAB2F2E1215B9392079A003BADC34238AE3CBE8E5094C9A11BBA8B84EBB` |
 | `local_archives/board/8000高温罩电气图V2.0.pdf` | 主副本冗余镜像 | `7EBD0DCED194338CEB97FF5A0ABCEE2D9790E7F6E7A90D9D4BE7DE593DCA7EB5` |
 
 `FCB_FPGA+MCU_V1.1_20260625.brd` SHA-256 为 `DB02938F7943B2AE532AA18208F61588364D32A70A0CC72F74B4A94AAAB7E258`(历史版本,主副本不再要求存在)。

+ 14 - 0
tools/board-viewer/README.zh-CN.md

@@ -130,6 +130,20 @@ J3 专用 FPGA 路径为:TCK `A7`、TDO `C6`、TMS `B8`、TDI `A6`。`VREF` 
 - ADC 只对已交叉验证、非保留、非电源/地/机械焊盘、外部电平明确且无固定负载冲突的针脚开放。
 - `PULLTYPE` 只有在人工注释显式提供 `adc_pulltype` 时才生成;`board_pull` 只描述板上外部器件。
 
+
+## 派生证据与 SVG 安全检查
+
+`generated/*.svg` 与 `generated/*.json` 是 BRD 的派生分析资产,不是 RTL/TD 源闭合。发布前可运行:
+
+```bash
+# 仓库根目录
+tools/check-board-viewer-svgs.sh
+python3 tools/board-viewer/check_svg_safety.py --json
+tools/refresh-reference-inventory.sh
+```
+
+检查项包括:三份 SVG 共用同一 `build-info` BRD 指纹、viewBox 与 `board-data` 坐标一致、无 script/外部 URL/绝对本地路径/非再现随机源。
+
 ## 验证
 
 ```powershell

+ 435 - 0
tools/board-viewer/check_svg_safety.py

@@ -0,0 +1,435 @@
+#!/usr/bin/env python3
+"""Fail-closed safety and provenance checks for board-viewer SVG assets.
+
+These SVGs are derived analysis evidence from the Allegro BRD via KiCad export.
+They are not RTL, TD, ADC, or bitstream source closure.
+"""
+
+from __future__ import annotations
+
+import argparse
+import hashlib
+import json
+import re
+import sys
+from dataclasses import asdict, dataclass, field
+from datetime import datetime, timezone
+from pathlib import Path
+from typing import Any
+
+
+ROOT = Path(__file__).resolve().parents[2]
+DEFAULT_GENERATED = ROOT / "tools" / "board-viewer" / "generated"
+DEFAULT_BRD = (
+    ROOT
+    / "reference/original/board/FCB_FPGA_MCU_V1.2_20260717"
+    / "FCB_FPGA+MCU_V1.2_20260717.brd"
+)
+EXPECTED_BRD_SHA256 = "269b5bab2f2e1215b9392079a003badc34238ae3cbe8e5094c9a11bba8b84ebb"
+SVG_NAMES = ("board-copper.svg", "board-silkscreen.svg", "board-mask-edge.svg")
+VIEWBOX_TOLERANCE_MM = 0.1
+
+_SCRIPT_RE = re.compile(r"<\s*script\b", re.I)
+_EXTERNAL_HTTP_RE = re.compile(r"https?://(?!www\.w3\.org/)", re.I)
+_FILE_URL_RE = re.compile(r"file://", re.I)
+_ABS_WIN_RE = re.compile(r"[A-Za-z]:\\")
+_ABS_UNIX_RE = re.compile(r"/(?:home|Users|tmp|var/tmp)/")
+_HREF_EXT_RE = re.compile(r"(?:xlink:)?href\s*=\s*[\"'](?!#)", re.I)
+_URL_FUNC_RE = re.compile(r"url\(\s*[\"']?(?!#)", re.I)
+_RANDOM_RE = re.compile(
+    r"Math\.random|Date\.now|uuid|randomUUID|crypto\.getRandomValues",
+    re.I,
+)
+_VIEWBOX_RE = re.compile(r'viewBox\s*=\s*"([^"]+)"')
+_WIDTH_RE = re.compile(r'\bwidth\s*=\s*"([^"]+)"')
+_HEIGHT_RE = re.compile(r'\bheight\s*=\s*"([^"]+)"')
+
+
+@dataclass
+class Finding:
+    check: str
+    status: str
+    detail: str
+
+
+@dataclass
+class Report:
+    schema: str = "board-viewer-svg-safety-report-v1"
+    generated_at_utc: str = ""
+    repository_root: str = ""
+    evidence_class: str = (
+        "derived_analysis_from_brd_not_rtl_td_source_closure"
+    )
+    brd: dict[str, Any] = field(default_factory=dict)
+    provenance: dict[str, Any] = field(default_factory=dict)
+    svgs: dict[str, Any] = field(default_factory=dict)
+    findings: list[Finding] = field(default_factory=list)
+    summary: dict[str, int] = field(default_factory=dict)
+
+    def add(self, check: str, status: str, detail: str) -> None:
+        self.findings.append(Finding(check=check, status=status, detail=detail))
+
+
+def sha256_file(path: Path) -> str:
+    digest = hashlib.sha256()
+    with path.open("rb") as stream:
+        while chunk := stream.read(1024 * 1024):
+            digest.update(chunk)
+    return digest.hexdigest()
+
+
+def _parse_viewbox(text: str) -> tuple[float, float, float, float] | None:
+    match = _VIEWBOX_RE.search(text)
+    if not match:
+        return None
+    parts = match.group(1).replace(",", " ").split()
+    if len(parts) != 4:
+        return None
+    try:
+        return float(parts[0]), float(parts[1]), float(parts[2]), float(parts[3])
+    except ValueError:
+        return None
+
+
+def _scan_svg_text(name: str, text: str, report: Report) -> dict[str, Any]:
+    issues: list[str] = []
+    for label, pattern in (
+        ("script", _SCRIPT_RE),
+        ("external_http", _EXTERNAL_HTTP_RE),
+        ("file_url", _FILE_URL_RE),
+        ("absolute_windows_path", _ABS_WIN_RE),
+        ("absolute_local_unix_path", _ABS_UNIX_RE),
+        ("external_href", _HREF_EXT_RE),
+        ("external_url_func", _URL_FUNC_RE),
+        ("non_reproducible_randomness", _RANDOM_RE),
+    ):
+        hits = pattern.findall(text)
+        if hits:
+            issues.append(f"{label}:{len(hits)}")
+            report.add(
+                f"svg_safety.{name}.{label}",
+                "fail",
+                f"{len(hits)} hit(s)",
+            )
+        else:
+            report.add(f"svg_safety.{name}.{label}", "pass", "clean")
+    viewbox = _parse_viewbox(text)
+    width = _WIDTH_RE.search(text)
+    height = _HEIGHT_RE.search(text)
+    return {
+        "viewBox": None if viewbox is None else list(viewbox),
+        "width": None if width is None else width.group(1),
+        "height": None if height is None else height.group(1),
+        "safety_issues": issues,
+        "xmlns_w3_only_external": bool(
+            re.search(r'xmlns(?::\w+)?="https?://www\.w3\.org/', text)
+        )
+        and not _EXTERNAL_HTTP_RE.search(text),
+    }
+
+
+def check_svg_safety(
+    *,
+    generated_dir: Path = DEFAULT_GENERATED,
+    brd_path: Path = DEFAULT_BRD,
+    expected_brd_sha256: str = EXPECTED_BRD_SHA256,
+    repository_root: Path = ROOT,
+) -> Report:
+    report = Report(
+        generated_at_utc=datetime.now(timezone.utc).isoformat(),
+        repository_root=str(repository_root.resolve()),
+    )
+    generated = generated_dir.resolve()
+    brd = brd_path.resolve()
+
+    if not brd.is_file():
+        report.add("brd.exists", "fail", f"missing {brd}")
+        report.brd = {"path": str(brd_path), "exists": False}
+    else:
+        actual = sha256_file(brd)
+        match = actual == expected_brd_sha256
+        root_resolved = repository_root.resolve()
+        logical = brd_path if not brd_path.is_absolute() else brd
+        try:
+            display_path = str(logical.resolve().relative_to(root_resolved))
+        except ValueError:
+            try:
+                display_path = str(brd_path.relative_to(repository_root))
+            except ValueError:
+                display_path = str(brd_path)
+        report.brd = {
+            "path": display_path,
+            "exists": True,
+            "bytes": brd.stat().st_size,
+            "sha256": actual,
+            "expected_sha256": expected_brd_sha256,
+            "hash_match": match,
+        }
+        report.add(
+            "brd.sha256",
+            "pass" if match else "fail",
+            actual if match else f"actual={actual} expected={expected_brd_sha256}",
+        )
+
+    build_info_path = generated / "build-info.json"
+    import_report_path = generated / "import-report.json"
+    board_data_path = generated / "board-data.json"
+    provenance: dict[str, Any] = {
+        "chain": (
+            "BRD bytes -> build-info.sources.brd.sha256; "
+            "import-report.source_file names the BRD; "
+            "board-data.json carries geometry/touchpoints only (no embedded BRD digest); "
+            "SVG asset digests recorded in build-info.assets"
+        ),
+        "evidence_class": report.evidence_class,
+    }
+
+    build_info: dict[str, Any] | None = None
+    if build_info_path.is_file():
+        build_info = json.loads(build_info_path.read_text(encoding="utf-8"))
+        brd_meta = (build_info.get("sources") or {}).get("brd") or {}
+        provenance["build_info_brd"] = brd_meta
+        bi_sha = str(brd_meta.get("sha256") or "")
+        report.add(
+            "provenance.build_info.brd_sha256",
+            "pass" if bi_sha == expected_brd_sha256 else "fail",
+            bi_sha or "missing",
+        )
+        assets = build_info.get("assets") or {}
+        for name in SVG_NAMES:
+            meta = assets.get(name) or {}
+            provenance.setdefault("build_info_svg_assets", {})[name] = meta
+    else:
+        report.add("provenance.build_info", "fail", "missing build-info.json")
+
+    if import_report_path.is_file():
+        import_report = json.loads(import_report_path.read_text(encoding="utf-8"))
+        source_file = str(import_report.get("source_file") or "")
+        provenance["import_report"] = {
+            "source_file": source_file,
+            "source_format": import_report.get("source_format"),
+            "output_file": import_report.get("output_file"),
+            "errors": import_report.get("errors") or [],
+        }
+        expected_name = brd.name if brd.is_file() else "FCB_FPGA+MCU_V1.2_20260717.brd"
+        report.add(
+            "provenance.import_report.source_file",
+            "pass" if source_file == expected_name else "fail",
+            source_file or "missing",
+        )
+        report.add(
+            "provenance.import_report.errors",
+            "pass" if not import_report.get("errors") else "fail",
+            "none" if not import_report.get("errors") else str(import_report.get("errors")),
+        )
+    else:
+        report.add("provenance.import_report", "fail", "missing import-report.json")
+
+    board_view_box: dict[str, float] | None = None
+    if board_data_path.is_file():
+        board_data = json.loads(board_data_path.read_text(encoding="utf-8"))
+        board = board_data.get("board") or {}
+        view_box = board.get("view_box") or {}
+        board_view_box = {
+            "x": float(view_box.get("x", 0.0)),
+            "y": float(view_box.get("y", 0.0)),
+            "width": float(view_box.get("width", 0.0)),
+            "height": float(view_box.get("height", 0.0)),
+        }
+        provenance["board_data"] = {
+            "schema": board_data.get("schema"),
+            "board_id": board.get("id"),
+            "view_box": board_view_box,
+            "embeds_brd_sha256": EXPECTED_BRD_SHA256
+            in board_data_path.read_text(encoding="utf-8"),
+            "note": (
+                "board-data.json does not embed the BRD digest; "
+                "trust chain is via sibling build-info.json"
+            ),
+        }
+        report.add(
+            "provenance.board_data.view_box",
+            "pass" if board_view_box["width"] > 0 and board_view_box["height"] > 0 else "fail",
+            json.dumps(board_view_box),
+        )
+    else:
+        report.add("provenance.board_data", "fail", "missing board-data.json")
+
+    report.provenance = provenance
+    svg_payload: dict[str, Any] = {}
+    viewboxes: list[tuple[float, float, float, float]] = []
+
+    for name in SVG_NAMES:
+        path = generated / name
+        entry: dict[str, Any] = {"path": str(path), "exists": path.is_file()}
+        if not path.is_file():
+            report.add(f"svg.exists.{name}", "fail", "missing")
+            svg_payload[name] = entry
+            continue
+        text = path.read_text(encoding="utf-8", errors="replace")
+        digest = sha256_file(path)
+        entry.update(
+            {
+                "bytes": path.stat().st_size,
+                "sha256": digest,
+                **_scan_svg_text(name, text, report),
+            }
+        )
+        if build_info is not None:
+            expected = ((build_info.get("assets") or {}).get(name) or {}).get("sha256")
+            entry["build_info_sha256"] = expected
+            entry["matches_build_info"] = digest == expected
+            report.add(
+                f"svg.hash.{name}",
+                "pass" if digest == expected else "fail",
+                digest if digest == expected else f"actual={digest} build-info={expected}",
+            )
+        viewbox = entry.get("viewBox")
+        if isinstance(viewbox, list) and len(viewbox) == 4:
+            viewboxes.append(tuple(float(v) for v in viewbox))  # type: ignore[arg-type]
+            if board_view_box is not None:
+                dw = abs(viewbox[2] - board_view_box["width"])
+                dh = abs(viewbox[3] - board_view_box["height"])
+                dx = abs(viewbox[0] - board_view_box["x"])
+                dy = abs(viewbox[1] - board_view_box["y"])
+                ok = max(dw, dh, dx, dy) <= VIEWBOX_TOLERANCE_MM
+                entry["coord_delta_vs_board_data_mm"] = {
+                    "dx": dx,
+                    "dy": dy,
+                    "dw": dw,
+                    "dh": dh,
+                }
+                report.add(
+                    f"svg.coords.{name}",
+                    "pass" if ok else "fail",
+                    f"delta_mm dx={dx:.6f} dy={dy:.6f} dw={dw:.6f} dh={dh:.6f}",
+                )
+        else:
+            report.add(f"svg.coords.{name}", "fail", "missing/invalid viewBox")
+        svg_payload[name] = entry
+
+    if len(viewboxes) == len(SVG_NAMES) and len(set(viewboxes)) == 1:
+        report.add("svg.coords.consistent_across_layers", "pass", str(viewboxes[0]))
+    elif viewboxes:
+        report.add(
+            "svg.coords.consistent_across_layers",
+            "fail",
+            f"divergent viewBoxes: {viewboxes}",
+        )
+
+    report.svgs = svg_payload
+    summary = {"pass": 0, "fail": 0, "other": 0}
+    for finding in report.findings:
+        if finding.status in summary:
+            summary[finding.status] += 1
+        else:
+            summary["other"] += 1
+    report.summary = summary
+    return report
+
+
+def report_to_dict(report: Report) -> dict[str, Any]:
+    payload = asdict(report)
+    return payload
+
+
+def render_markdown(report: Report) -> str:
+    lines = [
+        "# Board-viewer SVG safety / provenance report",
+        "",
+        f"Generated: `{report.generated_at_utc}`",
+        "",
+        f"Evidence class: **{report.evidence_class}**",
+        "",
+        "SVGs under `tools/board-viewer/generated/` are derived analysis artifacts "
+        "produced from the Allegro BRD through KiCad import/export. They support "
+        "physical pin/network review only. They are **not** RTL, TD, ADC, constraint, "
+        "or bitstream source closure.",
+        "",
+        "## BRD",
+        "",
+        "```json",
+        json.dumps(report.brd, indent=2, ensure_ascii=False),
+        "```",
+        "",
+        "## Provenance",
+        "",
+        "```json",
+        json.dumps(report.provenance, indent=2, ensure_ascii=False),
+        "```",
+        "",
+        "## SVG summary",
+        "",
+        "| SVG | Exists | SHA-256 | Safety issues | Matches build-info |",
+        "|-----|--------|---------|---------------|--------------------|",
+    ]
+    for name in SVG_NAMES:
+        entry = report.svgs.get(name) or {}
+        lines.append(
+            "| `{name}` | {exists} | `{sha}` | {issues} | {match} |".format(
+                name=name,
+                exists=entry.get("exists"),
+                sha=(entry.get("sha256") or "")[:16] + ("..." if entry.get("sha256") else ""),
+                issues=",".join(entry.get("safety_issues") or []) or "none",
+                match=entry.get("matches_build_info"),
+            )
+        )
+    lines.extend(
+        [
+            "",
+            "## Findings",
+            "",
+            f"- pass: {report.summary.get('pass', 0)}",
+            f"- fail: {report.summary.get('fail', 0)}",
+            "",
+        ]
+    )
+    for finding in report.findings:
+        if finding.status == "fail":
+            lines.append(f"- FAIL `{finding.check}`: {finding.detail}")
+    if report.summary.get("fail", 0) == 0:
+        lines.append("- All checks passed.")
+    lines.append("")
+    return "\n".join(lines)
+
+
+def main(argv: list[str] | None = None) -> int:
+    parser = argparse.ArgumentParser(description=__doc__)
+    parser.add_argument("--generated", type=Path, default=DEFAULT_GENERATED)
+    parser.add_argument("--brd", type=Path, default=DEFAULT_BRD)
+    parser.add_argument("--expected-brd-sha256", default=EXPECTED_BRD_SHA256)
+    parser.add_argument("--repository-root", type=Path, default=ROOT)
+    parser.add_argument("--json-out", type=Path)
+    parser.add_argument("--md-out", type=Path)
+    parser.add_argument("--json", action="store_true", help="Print JSON report to stdout")
+    args = parser.parse_args(argv)
+
+    report = check_svg_safety(
+        generated_dir=args.generated,
+        brd_path=args.brd,
+        expected_brd_sha256=args.expected_brd_sha256,
+        repository_root=args.repository_root,
+    )
+    payload = report_to_dict(report)
+    markdown = render_markdown(report)
+
+    if args.json_out:
+        args.json_out.parent.mkdir(parents=True, exist_ok=True)
+        args.json_out.write_text(
+            json.dumps(payload, indent=2, ensure_ascii=False) + "\n",
+            encoding="utf-8",
+        )
+    if args.md_out:
+        args.md_out.parent.mkdir(parents=True, exist_ok=True)
+        args.md_out.write_text(markdown, encoding="utf-8")
+
+    if args.json:
+        print(json.dumps(payload, indent=2, ensure_ascii=False))
+    else:
+        print(markdown)
+
+    return 1 if report.summary.get("fail", 0) else 0
+
+
+if __name__ == "__main__":
+    sys.exit(main())

+ 260 - 0
tools/board-viewer/refresh_reference_inventory.py

@@ -0,0 +1,260 @@
+#!/usr/bin/env python3
+"""Refresh docs/REFERENCE-INVENTORY.{json,md} from live reference + board-viewer assets."""
+
+from __future__ import annotations
+
+import argparse
+import hashlib
+import json
+import sys
+from datetime import datetime, timezone
+from pathlib import Path
+from typing import Any
+
+
+ROOT = Path(__file__).resolve().parents[2]
+EXPECTED_BRD_SHA256 = "269b5bab2f2e1215b9392079a003badc34238ae3cbe8e5094c9a11bba8b84ebb"
+EXPECTED_PDF_SHA256 = "7ebd0dced194338ceb97ff5a0abcee2d9790e7f6e7a90d9d4be7de593dca7eb5"
+CANONICAL_BRD = (
+    "reference/original/board/FCB_FPGA_MCU_V1.2_20260717/"
+    "FCB_FPGA+MCU_V1.2_20260717.brd"
+)
+ARCHIVE_BRD = "reference/original/local_archives/board/FCB_FPGA+MCU_V1.2_20260717.brd"
+
+
+def sha256_file(path: Path) -> str:
+    digest = hashlib.sha256()
+    with path.open("rb") as stream:
+        while chunk := stream.read(1024 * 1024):
+            digest.update(chunk)
+    return digest.hexdigest()
+
+
+def item_for(
+    root: Path,
+    relative: str,
+    *,
+    expected_sha256: str | None = None,
+    confidence: str = "present",
+    notes: dict[str, Any] | None = None,
+) -> dict[str, Any]:
+    path = root / relative
+    payload: dict[str, Any] = {
+        "path": relative,
+        "exists": path.is_file(),
+        "size": path.stat().st_size if path.is_file() else 0,
+    }
+    if path.is_file():
+        payload["sha256"] = sha256_file(path)
+    if expected_sha256 is not None:
+        payload["expected_sha256"] = expected_sha256
+        payload["hash_match"] = bool(
+            path.is_file() and payload.get("sha256") == expected_sha256
+        )
+        payload["confidence"] = (
+            "confirmed" if payload.get("hash_match") else ("missing" if not path.is_file() else "hash_fail")
+        )
+    else:
+        payload["confidence"] = confidence if path.is_file() else "missing"
+    if notes:
+        payload.update(notes)
+    return payload
+
+
+def build_inventory(root: Path) -> dict[str, Any]:
+    generated = root / "tools/board-viewer/generated"
+    build_info: dict[str, Any] = {}
+    if (generated / "build-info.json").is_file():
+        build_info = json.loads((generated / "build-info.json").read_text(encoding="utf-8"))
+
+    items = [
+        item_for(root, "reference/original/MANIFEST.zh-CN.md"),
+        item_for(
+            root,
+            CANONICAL_BRD,
+            expected_sha256=EXPECTED_BRD_SHA256,
+            notes={
+                "role": "canonical_brd",
+                "packaging_note": (
+                    "Canonical physical BRD for analysis packages; "
+                    "prefer this path over local_archives duplicate"
+                ),
+            },
+        ),
+        item_for(
+            root,
+            ARCHIVE_BRD,
+            expected_sha256=EXPECTED_BRD_SHA256,
+            notes={
+                "role": "duplicate_archive_mirror",
+                "byte_identical_to_canonical": True,
+                "packaging_recommendation": (
+                    "Keep one physical copy in analysis packages: include "
+                    f"{CANONICAL_BRD} and omit {ARCHIVE_BRD} (or replace the "
+                    "archive entry with a provenance pointer to the canonical path)."
+                ),
+            },
+        ),
+        item_for(
+            root,
+            "reference/original/schematics/8000高温罩电气图V2.0.pdf",
+            expected_sha256=EXPECTED_PDF_SHA256,
+        ),
+        item_for(root, "reference/original/schematics/FCB_FPGA+MCU0611.pdf"),
+        item_for(root, "reference/original/diagrams/上位机逻辑.svg"),
+        item_for(root, "reference/original/diagrams/接长鑫水滴系统.svg"),
+        item_for(root, "config/board_viewer_annotations.fcb_fpga_mcu_v1_2.json"),
+        item_for(
+            root,
+            "tools/board-viewer/generated/board-data.json",
+            notes={
+                "evidence_class": "derived_analysis_from_brd_not_rtl_td_source_closure",
+            },
+        ),
+        item_for(
+            root,
+            "tools/board-viewer/generated/build-info.json",
+            notes={
+                "evidence_class": "derived_analysis_from_brd_not_rtl_td_source_closure",
+            },
+        ),
+        item_for(
+            root,
+            "tools/board-viewer/generated/import-report.json",
+            notes={
+                "evidence_class": "derived_analysis_from_brd_not_rtl_td_source_closure",
+            },
+        ),
+        item_for(
+            root,
+            "tools/board-viewer/generated/board-copper.svg",
+            notes={
+                "evidence_class": "derived_analysis_from_brd_not_rtl_td_source_closure",
+                "layer": "F.Cu,Edge.Cuts",
+            },
+        ),
+        item_for(
+            root,
+            "tools/board-viewer/generated/board-silkscreen.svg",
+            notes={
+                "evidence_class": "derived_analysis_from_brd_not_rtl_td_source_closure",
+                "layer": "F.SilkS,Edge.Cuts",
+            },
+        ),
+        item_for(
+            root,
+            "tools/board-viewer/generated/board-mask-edge.svg",
+            notes={
+                "evidence_class": "derived_analysis_from_brd_not_rtl_td_source_closure",
+                "layer": "F.Mask,Edge.Cuts",
+            },
+        ),
+    ]
+
+    present = sum(1 for item in items if item.get("exists"))
+    missing = sum(1 for item in items if not item.get("exists"))
+    hash_ok = sum(1 for item in items if item.get("hash_match") is True)
+    hash_fail = sum(1 for item in items if item.get("hash_match") is False)
+
+    return {
+        "schema": "prod2u-reference-inventory-v1",
+        "generated_at_utc": datetime.now(timezone.utc).isoformat(),
+        "repository_root": str(root.resolve()),
+        "evidence_boundaries": {
+            "board_viewer_svgs_and_json": (
+                "Derived analysis evidence from the Allegro BRD via KiCad. "
+                "Not RTL/TD/ADC/bitstream source closure."
+            ),
+            "canonical_brd": CANONICAL_BRD,
+            "duplicate_brd_archive": ARCHIVE_BRD,
+            "packaging_recommendation": (
+                "Analysis packages should ship one physical BRD copy at the "
+                "canonical path; treat local_archives/board as a local-only mirror."
+            ),
+            "expected_brd_sha256": EXPECTED_BRD_SHA256,
+        },
+        "items": items,
+        "board_viewer_build_info": build_info,
+        "summary": {
+            "present": present,
+            "missing": missing,
+            "hash_ok": hash_ok,
+            "hash_fail": hash_fail,
+        },
+    }
+
+
+def render_markdown(inventory: dict[str, Any]) -> str:
+    bounds = inventory.get("evidence_boundaries") or {}
+    summary = inventory.get("summary") or {}
+    lines = [
+        "# Reference Inventory",
+        "",
+        f"Generated: {inventory.get('generated_at_utc')}",
+        "",
+        f"- present: {summary.get('present', 0)}",
+        f"- missing: {summary.get('missing', 0)}",
+        f"- hash_ok: {summary.get('hash_ok', 0)}",
+        f"- hash_fail: {summary.get('hash_fail', 0)}",
+        "",
+        "## Evidence boundaries",
+        "",
+        f"- Board-viewer JSON/SVG: {bounds.get('board_viewer_svgs_and_json')}",
+        f"- Canonical BRD: `{bounds.get('canonical_brd')}`",
+        f"- Duplicate archive BRD: `{bounds.get('duplicate_brd_archive')}` "
+        "(byte-identical local mirror; packaging should keep one physical copy)",
+        f"- Expected BRD SHA-256: `{bounds.get('expected_brd_sha256')}`",
+        f"- Packager recommendation: {bounds.get('packaging_recommendation')}",
+        "",
+        "| Path | Exists | Size | Confidence | Hash notes | Evidence |",
+        "|------|--------|------|------------|------------|----------|",
+    ]
+    for item in inventory.get("items") or []:
+        sha = item.get("sha256") or ""
+        if item.get("hash_match") is True:
+            hash_notes = "MATCH"
+        elif item.get("hash_match") is False:
+            hash_notes = "FAIL"
+        elif sha:
+            hash_notes = sha[:16] + "..."
+        else:
+            hash_notes = "-"
+        evidence = item.get("evidence_class") or item.get("role") or "source/reference"
+        lines.append(
+            f"| `{item.get('path')}` | {item.get('exists')} | {item.get('size')} | "
+            f"{item.get('confidence')} | {hash_notes} | {evidence} |"
+        )
+    lines.append("")
+    return "\n".join(lines)
+
+
+def main(argv: list[str] | None = None) -> int:
+    parser = argparse.ArgumentParser(description=__doc__)
+    parser.add_argument("--root", type=Path, default=ROOT)
+    parser.add_argument(
+        "--json-out",
+        type=Path,
+        default=ROOT / "docs" / "REFERENCE-INVENTORY.json",
+    )
+    parser.add_argument(
+        "--md-out",
+        type=Path,
+        default=ROOT / "docs" / "REFERENCE-INVENTORY.md",
+    )
+    args = parser.parse_args(argv)
+
+    inventory = build_inventory(args.root.resolve())
+    args.json_out.parent.mkdir(parents=True, exist_ok=True)
+    args.json_out.write_text(
+        json.dumps(inventory, indent=2, ensure_ascii=False) + "\n",
+        encoding="utf-8",
+    )
+    args.md_out.write_text(render_markdown(inventory), encoding="utf-8")
+    print(f"wrote {args.json_out}")
+    print(f"wrote {args.md_out}")
+    print(json.dumps(inventory["summary"], ensure_ascii=False))
+    return 0 if inventory["summary"].get("hash_fail", 0) == 0 else 1
+
+
+if __name__ == "__main__":
+    sys.exit(main())

+ 13 - 0
tools/check-board-viewer-svgs.sh

@@ -0,0 +1,13 @@
+#!/usr/bin/env bash
+# Thin entrypoint: SVG safety + BRD provenance checks for board-viewer assets.
+set -euo pipefail
+unset LD_LIBRARY_PATH LD_PRELOAD QT_PLUGIN_PATH || true
+export PATH="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:${PATH:-}"
+ROOT="$(cd "$(dirname "$0")/.." && pwd)"
+LOG_DIR="${BOARDVIEW_LOG_DIR:-}"
+ARGS=()
+if [[ -n "$LOG_DIR" ]]; then
+  mkdir -p "$LOG_DIR"
+  ARGS+=(--json-out "$LOG_DIR/svg-safety-report.json" --md-out "$LOG_DIR/svg-safety-report.md")
+fi
+exec python3 "$ROOT/tools/board-viewer/check_svg_safety.py" "${ARGS[@]}" "$@"

+ 7 - 0
tools/refresh-reference-inventory.sh

@@ -0,0 +1,7 @@
+#!/usr/bin/env bash
+# Thin entrypoint: refresh docs/REFERENCE-INVENTORY.{json,md}.
+set -euo pipefail
+unset LD_LIBRARY_PATH LD_PRELOAD QT_PLUGIN_PATH || true
+export PATH="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:${PATH:-}"
+ROOT="$(cd "$(dirname "$0")/.." && pwd)"
+exec python3 "$ROOT/tools/board-viewer/refresh_reference_inventory.py" --root "$ROOT" "$@"