From 226d47a72dec21d967b82f6dad75e7f9d0db8705 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=A7=9A=E7=AB=A0=E6=B5=A9?= Date: Sun, 25 Oct 2026 17:15:35 +0800 Subject: [PATCH] =?UTF-8?q?fix(qa):=20=E5=91=A8=E6=8A=A5=E6=AD=A3=E6=96=87?= =?UTF-8?q?=E7=A7=BB=E9=99=A4=E4=B8=AD=E8=8B=B1=E6=96=87=E8=B4=A8=E9=87=8F?= =?UTF-8?q?=E7=BB=9F=E8=AE=A1=E5=8F=A3=E5=BE=84=E8=AF=B4=E6=98=8E?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 仅删除周报说明段及模板占位,保留自然月规则、指标数值和来源审计。 历史已保存周报不因模板变更自动改写,保留中英文各六节。 验证:移除说明断言先红后绿,自然月指标/来源及历史证据保留测试通过,完整门禁与原生备份恢复通过。 --- CHANGELOG.md | 6 ++++++ internal/qaopsmirror/master_monthly_integration_test.go | 2 +- internal/qaopsmirror/weekly_template.go | 8 -------- internal/qaopsmirror/weekly_template_test.go | 7 ++++++- 4 files changed, 13 insertions(+), 10 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index d03396e..1fbac3e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -76,6 +76,12 @@ > `0.1.12`),由 `scripts/version.py` 从 git **算出来**;开发交付的独立说明写入本文件“开发快照”章节,并打 `snapshot/vX.Y.Z` 注释标签 ⇒ 每次开发交付均可追溯, > 但"发布版本"仍然只能由人定(CI 不会自动升版本、不会打 tag)。 +## 开发快照 snapshot/v0.1.61 - 2026-10-25 + +### Changed + +- 周报中英文正文移除质量统计月份、时间范围及分母规则说明,保留覆盖率、正确率及原自然月计算口径与来源审计。 + ## 开发快照 snapshot/v0.1.60 - 2026-10-25 ### Added diff --git a/internal/qaopsmirror/master_monthly_integration_test.go b/internal/qaopsmirror/master_monthly_integration_test.go index 46092aa..304f63b 100644 --- a/internal/qaopsmirror/master_monthly_integration_test.go +++ b/internal/qaopsmirror/master_monthly_integration_test.go @@ -91,7 +91,7 @@ func TestMasterCalendarMonthsResetAndCrossingWeekReadsPreviousMonth(t *testing.T t.Fatal("missing October monthly point") } prefill, e := s.PrefillWeeklyDraft(ctx, "2026-W40", WeeklyDraftPrefillRequest{BaseRevision: 0, Nonce: "fixture_monthly_prefill_0001"}, "fixture-admin", time.Now()) - if e != nil || !strings.Contains(prefill.Draft.Markdown, "质量统计月:2026-09") || !strings.Contains(prefill.Draft.Markdown, "Coverage Rate: 66.67%") || !strings.Contains(prefill.Draft.Markdown, "Accuracy Rate: 100.00%") { + if e != nil || strings.Contains(prefill.Draft.Markdown, "质量统计月:") || strings.Contains(prefill.Draft.Markdown, "Quality month (Beijing):") || !strings.Contains(prefill.Draft.Markdown, "Coverage Rate: 66.67%") || !strings.Contains(prefill.Draft.Markdown, "Accuracy Rate: 100.00%") { t.Fatal("new prefill did not use the same September rates", e) } var before string diff --git a/internal/qaopsmirror/weekly_template.go b/internal/qaopsmirror/weekly_template.go index 592000b..e17871b 100644 --- a/internal/qaopsmirror/weekly_template.go +++ b/internal/qaopsmirror/weekly_template.go @@ -90,7 +90,6 @@ func renderWeeklyTemplate(week string, data Dashboard, now time.Time) (string, j qualitySourceWeekKey = p.Week } } - qualityPeriodEN, qualityPeriodZH := "", "" if data.QualityPeriod != nil || data.MonthlyQuality != nil { period, rates := data.QualityPeriod, data.MonthlyQuality if period == nil || rates == nil || period.Source != dashboardMonthlySource || period.PolicyVersion != dashboardMonthlyPolicy || rates.Records < 0 { @@ -102,8 +101,6 @@ func renderWeeklyTemplate(week string, data Dashboard, now time.Time) (string, j } coverage, accuracy = rates.Coverage.Percent, rates.Correctness.Percent qualitySource, qualitySourceWeekKey = dashboardMonthlySource, "" - qualityPeriodEN = fmt.Sprintf("Quality month (Beijing): %s; [%s, %s). Each rate is yes / (yes + no); pending and other unresolved values are excluded.", period.Month, period.Start.In(dashboardLocation).Format(time.RFC3339), period.CutoffAt.In(dashboardLocation).Format(time.RFC3339)) - qualityPeriodZH = fmt.Sprintf("质量统计月:%s(北京时间);范围 [%s, %s)。分别按是÷(是+否)计算,待确认等不计分母;跨月周按周一所在月。", period.Month, period.Start.In(dashboardLocation).Format(time.RFC3339), period.CutoffAt.In(dashboardLocation).Format(time.RFC3339)) } if !validWeeklyValue(coverage, true) || !validWeeklyValue(accuracy, true) { return "", nil, dobotaiops.ErrInvalidQuery @@ -118,7 +115,6 @@ func renderWeeklyTemplate(week string, data Dashboard, now time.Time) (string, j "{{YEAR}}", week[:4], "{{WEEK}}", week[6:], "{{TOTAL_QUESTIONS}}", fmt.Sprint(data.TotalIssues), "{{NEW_THIS_WEEK}}", fmt.Sprint(data.NewThisWeek), "{{COVERAGE_RATE}}", weeklyPercent(coverage), "{{ACCURACY_RATE}}", weeklyPercent(accuracy), - "{{QUALITY_PERIOD_EN}}", qualityPeriodEN, "{{QUALITY_PERIOD_ZH}}", qualityPeriodZH, "{{MONTH_EN}}", month.Format("January 2006"), "{{MONTH_ZH}}", fmt.Sprintf("%d年%d月", month.Year(), month.Month()), "{{AVERAGE_USAGE_RANKING_EN}}", weeklyRegionRanking(data.Regions, false, true), "{{AVERAGE_USAGE_RANKING_ZH}}", weeklyRegionRanking(data.Regions, false, false), "{{USAGE_COVERAGE_RANKING_EN}}", weeklyRegionRanking(data.Regions, true, true), "{{USAGE_COVERAGE_RANKING_ZH}}", weeklyRegionRanking(data.Regions, true, false), @@ -143,8 +139,6 @@ Coverage Rate: {{COVERAGE_RATE}} Accuracy Rate: {{ACCURACY_RATE}} -{{QUALITY_PERIOD_EN}} - ## 3. {{MONTH_EN}} Regional Average Usage Ranking {{AVERAGE_USAGE_RANKING_EN}} @@ -175,8 +169,6 @@ Accuracy Rate: {{ACCURACY_RATE}} 正确率:{{ACCURACY_RATE}} -{{QUALITY_PERIOD_ZH}} - ## 三、{{MONTH_ZH}}区域人均使用次数排名 {{AVERAGE_USAGE_RANKING_ZH}} diff --git a/internal/qaopsmirror/weekly_template_test.go b/internal/qaopsmirror/weekly_template_test.go index cf6f200..50cb99b 100644 --- a/internal/qaopsmirror/weekly_template_test.go +++ b/internal/qaopsmirror/weekly_template_test.go @@ -21,9 +21,14 @@ func TestWeeklyTemplateCalendarMonthOverridesOnlyNewPrefillNotHistoricalEvidence } var meta map[string]any _ = json.Unmarshal(seed, &meta) - if !strings.Contains(md, "Coverage Rate: 66.67%") || !strings.Contains(md, "Accuracy Rate: 50.00%") || !strings.Contains(md, "质量统计月:2026-09") || meta["quality_source"] != dashboardMonthlySource { + if !strings.Contains(md, "Coverage Rate: 66.67%") || !strings.Contains(md, "Accuracy Rate: 50.00%") || meta["quality_source"] != dashboardMonthlySource { t.Fatal("new weekly prefill still uses historical/week quality instead of the selected calendar month", md) } + for _, removed := range []string{"Quality month (Beijing):", "质量统计月:", "Each rate is yes /", "跨月周按周一所在月", "{{QUALITY_PERIOD_"} { + if strings.Contains(md, removed) { + t.Fatalf("weekly report still contains the removed quality-period note: %s", removed) + } + } if data.ReportedWeeks[0].CoveragePercent != 57.23 { t.Fatal("historical reported evidence changed") }