Share telemetry aggregate protection across report flows

This commit is contained in:
yaojingang
2026-06-16 03:37:05 +08:00
parent f930167d5a
commit dd3c260ff2
3 changed files with 22 additions and 21 deletions
+2 -2
View File
@@ -61,7 +61,7 @@ from yao_cli_report_commands import (
command_world_class_submission_kit,
command_world_class_submission_review,
)
from yao_cli_runtime import ROOT, run_script
from yao_cli_runtime import ROOT, run_adoption_drift_if_source_exists, run_script
from yao_cli_telemetry import add_telemetry_args, maybe_record_cli_event
@@ -428,7 +428,7 @@ def command_workspace_flow(args: argparse.Namespace) -> int:
{"phase": "report-refresh", "result": run_script("python_compat_check.py", [str(ROOT)])},
{"phase": "report-refresh", "result": run_script("render_architecture_maintainability.py", [str(ROOT)])},
{"phase": "report-refresh", "result": run_script("compile_skill.py", [str(ROOT)])},
{"phase": "report-refresh", "result": run_script("render_adoption_drift_report.py", [str(ROOT)])},
{"phase": "report-refresh", "result": run_adoption_drift_if_source_exists()},
{"phase": "report-refresh", "result": run_script("render_telemetry_hook_recipes.py", [str(ROOT)])},
{"phase": "report-refresh", "result": run_script("render_review_waivers.py", [str(ROOT)])},
{"phase": "report-refresh", "result": run_script("render_review_annotations.py", [str(ROOT)])},
+1 -19
View File
@@ -5,7 +5,7 @@ import json
from pathlib import Path
from yao_cli_config import baseline_compare_args, local_output_runner_command
from yao_cli_runtime import ROOT, run_script
from yao_cli_runtime import ROOT, run_adoption_drift_if_source_exists, run_script
SCRIPT_INTERFACE = "internal-module"
@@ -32,24 +32,6 @@ def append_outputs(cmd: list[str], args: argparse.Namespace, *, markdown: bool =
cmd.extend(["--generated-at", args.generated_at])
def run_adoption_drift_if_source_exists() -> dict:
events_path = ROOT / "reports" / "telemetry_events.jsonl"
if events_path.exists():
return run_script("render_adoption_drift_report.py", [str(ROOT)])
return {
"command": "render_adoption_drift_report.py skipped: missing reports/telemetry_events.jsonl",
"returncode": 0,
"ok": True,
"stdout": "",
"stderr": "",
"payload": {
"ok": True,
"skipped": True,
"reason": "raw telemetry event logs are local-only; keeping committed adoption_drift_report artifacts",
},
}
def render_skill_report_command(args: argparse.Namespace, script_name: str, *, markdown: bool = True, generated_at: bool = False) -> int:
cmd = [resolved_skill_dir(args)]
append_outputs(cmd, args, markdown=markdown, generated_at=generated_at)
+19
View File
@@ -43,3 +43,22 @@ def run_script(name: str, args: list[str], cwd: Path | None = None) -> dict:
"stderr": proc.stderr,
"payload": payload,
}
def run_adoption_drift_if_source_exists(skill_dir: Path | None = None) -> dict:
target = (skill_dir or ROOT).resolve()
events_path = target / "reports" / "telemetry_events.jsonl"
if events_path.exists():
return run_script("render_adoption_drift_report.py", [str(target)])
return {
"command": "render_adoption_drift_report.py skipped: missing reports/telemetry_events.jsonl",
"returncode": 0,
"ok": True,
"stdout": "",
"stderr": "",
"payload": {
"ok": True,
"skipped": True,
"reason": "raw telemetry event logs are local-only; keeping committed adoption_drift_report artifacts",
},
}