image.domain\self_evolve\ci_hook.mbt
94.6% · 35 / 37 points · 109 linesBackground color reports the state of each line. Underlined characters mark exact instrumented byte offsets; hover them to inspect the visit count.
- 1
///| - 2
/// # CI 钩子 self_evolve/ci_hook - 3
/// - 4
/// 图像处理库子模块 - 5
/// 图像处理库子模块 Image processing library submodule - 6
// 自演化 CI 集成 — moon test 自动演化钩子 + 回归门禁 - 7
// CI integration: auto-evolution hooks + regression gate - 8
// - 9
// Phase 5 v284: 将自演化集成到 CI — 门禁检查(grill + repair + optimize)+ 回归检测。 - 10
- 11
///| - 12
/// CI 门禁结果。 - 13
/// 描述 CI gate result. - 14
#derive(Eq, @debug.Debug) - 15
pub(all) struct CIGateResult { - 16
passed : Bool - 17
total_checks : Int32 - 18
failed_checks : Int32 - 19
gate_summary : String - 20
} - 21
- 22
///| - 23
pub extend CIGateResult with @debug.Debug::{to_repr} - 24
- 25
///| - 26
pub extend CIGateResult with Eq::{not_equal, equal} - 27
- 28
///| - 29
/// CI 门禁检查:对管道执行 grill + repair + optimize 全套检查。 - 30
/// 描述 CI gate check: run grill + repair + optimize on a pipeline. - 31
pub fn ci_gate_check(pipeline : @imgir.IRPipeline) -> CIGateResult { - 32●
let grill_report = run_grill_check(pipeline) - 33●
let repair_rep = repair_report(pipeline) - 34●
let opt_verified = optimize_verified(pipeline) - 35
// 三项检查 - 36
let checks : Array[(String, Bool)] = [] - 37●
checks.push(("grill_all_passed", grill_report.all_passed())) - 38●
checks.push(("repair_fully_repaired", repair_rep.is_fully_repaired())) - 39●
checks.push(("optimize_verified", opt_verified)) - 40●
let total = checks.length() - 41
let mut failed = 0 - 42
for c in checks { - 43●
if !c.1 { - 44●
failed = failed + 1 - 45
} - 46
} - 47
let passed = failed == 0 - 48
let summary = "CI 门禁: " + - 49●
(total - failed).to_string() + - 50
"/" + - 51●
total.to_string() + - 52
" 通过, " + - 53●
failed.to_string() + - 54
" 失败" - 55
{ passed, total_checks: total, failed_checks: failed, gate_summary: summary, } - 56
} - 57
- 58
///| - 59
/// 对全部 19 种算子执行 CI 门禁检查。 - 60
/// 运行 Run CI gate check on all 19 op variants. - 61
pub fn ci_gate_all() -> Array[CIGateResult] { - 62●
let results : Array[CIGateResult] = [] - 63●
for op in all_ops() { - 64●
let pipe = @imgir.IRPipeline::new().add(op) - 65●
results.push(ci_gate_check(pipe)) - 66
} - 67
results - 68
} - 69
- 70
///| - 71
/// 回归门禁:优化后不劣化 + 修复后无退化。 - 72
/// 描述 Regression gate: optimization non-degrading + repair fully fixed. - 73
pub fn ci_regression_gate(pipeline : @imgir.IRPipeline) -> Bool { - 74●
let opt_ok = optimize_verified(pipeline) - 75●
let repair_rep = repair_report(pipeline) - 76●
opt_ok && repair_rep.is_fully_repaired() - 77
} - 78
- 79
///| - 80
/// 全部 19 算子是否通过回归门禁。 - 81
/// 描述 Whether all 19 ops pass regression gate. - 82
pub fn ci_regression_all_pass() -> Bool { - 83●
let mut all_ok = true - 84●
for op in all_ops() { - 85●
let pipe = @imgir.IRPipeline::new().add(op) - 86●
if !ci_regression_gate(pipe) { - 87○
all_ok = false - 88
} - 89
} - 90
all_ok - 91
} - 92
- 93
///| - 94
/// CI 门禁通过率(0-100)。 - 95
/// 描述 CI gate pass rate (0-100). - 96
pub fn CIGateResult::pass_rate(self : CIGateResult) -> Int32 { - 97●
if self.total_checks == 0 { - 98○
100 - 99
} else { - 100●
(self.total_checks - self.failed_checks) * 100 / self.total_checks - 101
} - 102
} - 103
- 104
///| - 105
/// CI 门禁是否全通过。 - 106
/// 描述 Whether CI gate fully passed. - 107
pub fn CIGateResult::is_green(self : CIGateResult) -> Bool { - 108●
self.failed_checks == 0 - 109
}