更新: 558 个文件 - 2026-03-17 21:15:02

这个提交包含在:
hao
2026-03-17 21:15:03 -07:00
父节点 080e55a98c
当前提交 16a40646a3
修改 558 个文件,包含 29800 行新增13001 行删除

查看文件

@@ -59,6 +59,20 @@ def _merge_preserved_records(
return preserved_advisories + advisories, preserved_triage + triage
def _load_existing_selection(
full_source_map: Dict[str, Any],
source_map: Dict[str, Any],
) -> tuple[Dict[str, Any], List[AdvisoryRecord], List[Dict[str, Any]]]:
allowed = {system["system_id"] for system in source_map["systems"]}
advisories = [item for item in _load_existing_advisories() if item.system_id in allowed]
triage = [item for item in _load_existing_triage() if item.get("system_id") in allowed]
render_map = source_map
if len(source_map["systems"]) != len(full_source_map["systems"]):
advisories, triage = _merge_preserved_records(source_map, advisories, triage)
render_map = full_source_map
return render_map, advisories, triage
def _summarize_changes(advisories: List[AdvisoryRecord]) -> Dict[str, Any]:
new_count = 0
updated_count = 0
@@ -143,19 +157,34 @@ def pipeline(
def cmd_render(args) -> int:
full_source_map = load_source_map()
source_map = _filter_source_map(full_source_map, args.system)
allowed = {system["system_id"] for system in source_map["systems"]}
advisories = [item for item in _load_existing_advisories() if item.system_id in allowed]
triage = [item for item in _load_existing_triage() if item.get("system_id") in allowed]
render_map, advisories, triage = _load_existing_selection(full_source_map, source_map)
summary = read_json(GENERATED_DIR / "run-summary.json", default={}) or {}
failures = summary.get("failures", [])
render_map = source_map
if len(source_map["systems"]) != len(full_source_map["systems"]):
advisories, triage = _merge_preserved_records(source_map, advisories, triage)
render_map = full_source_map
_write_outputs(render_map, advisories, triage, failures, summary)
return 0
def cmd_source_health(args) -> int:
full_source_map = load_source_map()
source_map = _filter_source_map(full_source_map, args.system)
since_dt = parse_since(args.since, default_days=30)
candidates, failures = collect_candidates(
source_map,
since_dt=since_dt,
tier=args.tier,
include_undated=args.include_undated,
)
render_map, advisories, triage = _load_existing_selection(full_source_map, source_map)
existing_summary = read_json(GENERATED_DIR / "run-summary.json", default={}) or {}
render_generated(render_map, advisories, triage, failures, existing_summary)
print(
f"Source health checked {len(candidates)} candidates across {len(source_map['systems'])} systems; failures {len(failures)}"
)
for failure in failures:
print(f"- {failure}")
return 0 if not failures else 1
def cmd_validate(args) -> int:
source_map = _filter_source_map(load_source_map(), args.system)
errors = validate(source_map)
@@ -273,6 +302,13 @@ def main() -> int:
render.add_argument("--system", action="append")
render.set_defaults(func=cmd_render)
source_health = subparsers.add_parser("source-health", help="Check source adapter health without mutating registry advisories")
source_health.add_argument("--since", default="30d")
source_health.add_argument("--tier", choices=["history-full", "rolling-24m"])
source_health.add_argument("--include-undated", action="store_true")
source_health.add_argument("--system", action="append")
source_health.set_defaults(func=cmd_source_health)
validate_parser = subparsers.add_parser("validate", help="Validate generated content")
validate_parser.add_argument("--system", action="append")
validate_parser.set_defaults(func=cmd_validate)

查看文件

@@ -119,6 +119,8 @@ def validate(source_map: Dict[str, Any]) -> List[str]:
GENERATED_DIR / "dashboard" / "docs" / "coverage-matrix.html",
GENERATED_DIR / "dashboard" / "docs" / "design-source.html",
GENERATED_DIR / "dashboard" / "docs" / "architecture-library.html",
GENERATED_DIR / "dashboard" / "data" / "completeness.json",
ROOT / "docs" / "testing-completeness-report.md",
ROOT / "08-threat-intel" / "registry" / "source-confidence.md",
]:
if not path.exists():