feat(tools): summarize import issue histogram

This commit is contained in:
hm
2026-10-31 18:49:33 +08:00
parent 530be5c970
commit 99abe4607a
3 changed files with 19 additions and 0 deletions
+1
View File
@@ -54,6 +54,7 @@
- CLI `--heal --out <dir>`:自动修复后把每个 body 保存为可复读的 `.vde`;
- CLI `--strict`:警告/可修复项也计入失败,目录模式区分 PASS/WARN/FAIL;
- CLI `--quick`:仅解析级快速筛查,便于大语料目录先定位导入失败/不支持表达;
- 目录模式汇总 issues 直方图(如 `step.warning×N`),便于按问题类型审查;
- 版本 1.0.93 全链路同步;权威根构建四批 **7707/7707 PASS**;
- 1.0.93 SDK 11/11 consumers PASS;
- 独立验证报告:`docs/reference/93-VDE微内核1.0.93-验证报告.md`。
+1
View File
@@ -48,6 +48,7 @@ result: PASS (0 body defect(s))
[WARN] part.step format=STEP bodies=1 E=0 W=6 repairs=2 heal=1
[FAIL] broken.stl format=STL bodies=1 E=1 W=3 repairs=4 heal=1
summary: total=3 pass=1 warn=1 defect=0 import_failed=1 healable=2
issues: step.warning×12 step.skipped_entities×3
```
## 2. 输出字段怎么读
+17
View File
@@ -34,6 +34,7 @@
#include <cstdio>
#include <cstring>
#include <filesystem>
#include <map>
#include <string>
#include <vector>
@@ -158,6 +159,7 @@ int check_directory(const std::string& dir, bool strict, bool quick) {
return 2;
}
int total = 0, pass = 0, warn = 0, defect = 0, failed = 0, healable = 0;
std::map<std::string, int> issue_counts;
for (const auto& f : files) {
++total;
const ImportDiagnostic d = quick ? import_cad(f).diagnostic
@@ -169,6 +171,9 @@ int check_directory(const std::string& dir, bool strict, bool quick) {
else if (soft) ++warn;
else ++pass;
if (d.can_heal()) ++healable;
for (const auto& i : d.issues)
if (i.severity != ImportIssueSeverity::Info)
++issue_counts[i.code];
const char* status = hard ? "FAIL" : (soft ? "WARN" : "PASS");
std::printf("[%s] %s format=%s bodies=%d E=%d W=%d repairs=%zu heal=%d\n",
status, f.c_str(), d.format.c_str(),
@@ -198,6 +203,18 @@ int check_directory(const std::string& dir, bool strict, bool quick) {
}
std::printf("\nsummary: total=%d pass=%d warn=%d defect=%d import_failed=%d healable=%d quick=%d\n",
total, pass, warn, defect, failed, healable, quick ? 1 : 0);
if (!issue_counts.empty()) {
std::vector<std::pair<int, std::string>> top;
for (const auto& kv : issue_counts) top.emplace_back(kv.second, kv.first);
std::sort(top.begin(), top.end(), [](const auto& a, const auto& b) {
if (a.first != b.first) return a.first > b.first;
return a.second < b.second;
});
std::printf("issues:");
for (size_t i = 0; i < top.size() && i < 8; ++i)
std::printf(" %s×%d", top[i].second.c_str(), top[i].first);
std::printf("\n");
}
return failed > 0 ? 2 : ((defect > 0 || (strict && warn > 0)) ? 1 : 0);
}