fix: harden review and verifier governance

This commit is contained in:
phamnazage-jpg
2026-05-29 18:48:48 +08:00
parent 88833fac8b
commit e999d31b25
133 changed files with 2538 additions and 159 deletions

View File

@@ -300,6 +300,44 @@ func TestResolveReportRunContextMarksHistoricalRebuildAsNonOfficial(t *testing.T
}
}
func TestResolveReportOutputPathsKeepsManualRunOutOfOfficialDailyPaths(t *testing.T) {
official, err := resolveReportOutputPaths("2026-05-14", ReportRunContext{
RunKind: "scheduled",
TriggerSource: "cron",
IsOfficialDaily: true,
})
if err != nil {
t.Fatalf("resolveReportOutputPaths returned error: %v", err)
}
if official.MarkdownPath != "reports/daily/daily_report_2026-05-14.md" {
t.Fatalf("official markdown path = %q", official.MarkdownPath)
}
if official.HTMLPath != "reports/daily/html/daily_report_2026-05-14.html" {
t.Fatalf("official html path = %q", official.HTMLPath)
}
manual, err := resolveReportOutputPaths("2026-05-14", ReportRunContext{
RunKind: "manual",
TriggerSource: "pipeline",
IsOfficialDaily: false,
})
if err != nil {
t.Fatalf("resolveReportOutputPaths returned error: %v", err)
}
if manual.MarkdownPath == official.MarkdownPath {
t.Fatalf("manual run should not overwrite official markdown path: %q", manual.MarkdownPath)
}
if manual.HTMLPath == official.HTMLPath {
t.Fatalf("manual run should not overwrite official html path: %q", manual.HTMLPath)
}
if !strings.Contains(manual.MarkdownPath, "reports/ad_hoc/") {
t.Fatalf("manual markdown path should be isolated, got %q", manual.MarkdownPath)
}
if !strings.Contains(manual.HTMLPath, "reports/ad_hoc/") {
t.Fatalf("manual html path should be isolated, got %q", manual.HTMLPath)
}
}
func TestResolveSignatureAuditReportConfigDefaults(t *testing.T) {
t.Setenv("REPORT_SIGNATURE_AUDIT_WINDOW", "")
t.Setenv("REPORT_SIGNATURE_AUDIT_CHANGED_THRESHOLD", "")