feat(qa-ops): 交付十一项统计看板与完整图片导出
build / build (push) Successful in 1m10s

以治理库单一只读事务分开聚合累计、自然周、截止月及当前通讯录使用分母;浏览器不再读取全量长答案来构建看板。

新增迁移52与普通worker周质量冻结,保留真实冻结时点、规则和标量贡献;缺少当时快照留空。提交后冻结头与贡献不可修改、删除或追加;只读接口保留管理员、固定租户、严格JSON与输入冲突保护。

已验证:make verify退出0,686个Go用例和305个前端用例通过,必需跳过0;镜像与组织隔离PostgreSQL竞态回归退出0。真实治理副本浏览器核对第41周累计1885与新增471、十一项和完整PNG下载,390px无外溢、JS异常0;明确模拟503后不伪零且重试恢复。没有修改DobotAI原始问答、真实区域规则或生产发布门禁。
This commit is contained in:
姚章浩
2026-10-18 23:26:55 +08:00
parent 76671e0784
commit 6e67034fbd
32 changed files with 2103 additions and 356 deletions
+23
View File
@@ -0,0 +1,23 @@
package main
import (
"context"
"errors"
"time"
)
type recordsSyncSchedulerStore interface {
EnqueueDue(context.Context) (bool, error)
TrackQualityWeeks(context.Context, time.Time) error
FreezePreviousQualityWeek(context.Context, time.Time) (bool, error)
}
func runRecordsSyncCycle(ctx context.Context, store recordsSyncSchedulerStore, at time.Time) error {
_, syncErr := store.EnqueueDue(ctx)
trackingErr := store.TrackQualityWeeks(ctx, at)
if trackingErr != nil {
return errors.Join(syncErr, trackingErr)
}
_, freezeErr := store.FreezePreviousQualityWeek(ctx, at)
return errors.Join(syncErr, freezeErr)
}
+37
View File
@@ -0,0 +1,37 @@
package main
import (
"context"
"errors"
"reflect"
"testing"
"time"
)
type frozenScheduleSpy struct {
calls []string
trackErr error
}
func (s *frozenScheduleSpy) EnqueueDue(context.Context) (bool, error) {
s.calls = append(s.calls, "sync")
return true, nil
}
func (s *frozenScheduleSpy) TrackQualityWeeks(context.Context, time.Time) error {
s.calls = append(s.calls, "track")
return s.trackErr
}
func (s *frozenScheduleSpy) FreezePreviousQualityWeek(context.Context, time.Time) (bool, error) {
s.calls = append(s.calls, "freeze")
return true, nil
}
func TestRecordsSchedulerActuallyCapturesFrozenWeeklyMetrics(t *testing.T) {
s := &frozenScheduleSpy{}
if e := runRecordsSyncCycle(context.Background(), s, time.Now()); e != nil || !reflect.DeepEqual(s.calls, []string{"sync", "track", "freeze"}) {
t.Fatal("weekly capture is not on the real scheduler invocation path", e, s.calls)
}
broken := &frozenScheduleSpy{trackErr: errors.New("isolated tracking unavailable")}
if e := runRecordsSyncCycle(context.Background(), broken, time.Now()); e == nil || !reflect.DeepEqual(broken.calls, []string{"sync", "track"}) {
t.Fatal("snapshot failure must not suppress source sync or freeze untracked history")
}
}
+1 -1
View File
@@ -40,7 +40,7 @@ func runRecordsSyncScheduler(ctx context.Context, store *qaopsmirror.Store, onEr
tick := time.NewTicker(15 * time.Second)
defer tick.Stop()
for {
if _, e := store.EnqueueDue(ctx); e != nil && ctx.Err() == nil && onError != nil {
if e := runRecordsSyncCycle(ctx, store, time.Now()); e != nil && ctx.Err() == nil && onError != nil {
onError(e)
}
select {