Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# Python 编译产物(构建缓存不入库——.#230/#336/#338 曾误提交)
__pycache__/
*.pyc
2 changes: 0 additions & 2 deletions governance/dashboard-update.py
Original file line number Diff line number Diff line change
Expand Up @@ -558,8 +558,6 @@ def _metering_tokens():
except Exception as e:
print(f"WARN cost: metering 账本拉取失败 {e}——token 指标 pending")
return None
if not os.path.isdir(td):
return None
since = NOW.strftime("%Y-%m-01")
try:
r = subprocess.run([sys.executable, os.path.join(td, "metering.py"), "aggregate",
Expand Down
1 change: 0 additions & 1 deletion governance/metrics.py
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,6 @@ def _guard_status(name, inp, policy):
if not isinstance(inp, dict) or "current" not in inp or "previous" not in inp:
return "pending", "数据源未接入"
cur, prev = inp["current"], inp["previous"]
val = {"current": cur, "previous": prev}
if cur > 0 and prev > 0:
return "red", f"逃逸持续:上一窗 {prev} + 本窗 {cur}([auto-revert]+post-merge P0)"
return "green", f"双窗逃逸:上一窗 {prev} · 本窗 {cur}"
Expand Down
Binary file removed scripts/__pycache__/adr_index_map.cpython-311.pyc
Binary file not shown.
4 changes: 2 additions & 2 deletions scripts/sli-report.sh
Original file line number Diff line number Diff line change
Expand Up @@ -152,7 +152,7 @@ except Exception: pass
esc = f"{(rev+p0)/len(merged):.3f}" if merged else "N/A"
# 抽样:seed = ISO 周(可复现)
isoweek = now.isocalendar()
seed = int(f"{isoweek[0]}-W{isoweek[1]}".replace("-W","") ) if False else hash(f"{isoweek[0]}-W{isoweek[1]}") & 0xffffffff
seed = hash(f"{isoweek[0]}-W{isoweek[1]}") & 0xffffffff # 注意:str hash 进程级加盐,非跨进程可复现(历史行为保留;换稳定 seed 是行为变更,另行评审)
sample = random.Random(seed).sample(agent_merged, min(k, len(agent_merged))) if agent_merged else []
print(f"auto_merge_rate={rate} ({len(agent_merged)}/{len(merged)})")
print(f"escape_rate={esc} (reverts={rev}+p0={p0} / merged={len(merged)}, drills_excluded={drills_excluded})")
Expand Down Expand Up @@ -197,7 +197,7 @@ $REPORT
BOD

gh issue create --repo "$GOV_REPO" --title "SLI 周报 $WEEK(自动合并门禁自身指标)" \
--body-file "$TMP/body.md" || die "周报 issue 创建失败" \n || gh issue create --repo "$GOV_REPO" --title "SLI 周报 $WEEK(自动合并门禁自身指标)" --body-file "$TMP/body.md"
--body-file "$TMP/body.md" || die "周报 issue 创建失败"

# 抽样审计 issue
SAMPLES=$(grep '^SAMPLE=' "$TMP/metrics.txt" || true)
Expand Down