HEL-919 rework: old ledger verbatim in copy (no seal rename) + scoped budget keys; running-expiry drill evidence

Co-authored-by: multica-agent <github@multica.ai>
This commit is contained in:
施工员2号
2026-11-04 11:56:00 +08:00
co-authored by multica-agent
parent 9c3789af06
commit 99c5de1d60
12 changed files with 185 additions and 101 deletions
+2 -1
View File
@@ -38,12 +38,13 @@ def main() -> int:
ap = argparse.ArgumentParser(description=__doc__)
ap.add_argument("--db", required=True, type=Path, help="团队实例产品库路径")
ap.add_argument("--reason", default="", help="封账原因(记录在交付评论,不写入库)")
ap.add_argument("--scope", default="", help="budget_total 键 scope(如 hel919:);缺省=旧账原键")
args = ap.parse_args()
if not args.db.is_file():
print(json.dumps({"ok": False, "error": f"库不存在:{args.db}"}, ensure_ascii=False))
return 1
store = Store(args.db, init=False)
guard = PersistentBudget(store, BudgetGuard(BudgetConfig()))
guard = PersistentBudget(store, BudgetGuard(BudgetConfig()), scope=args.scope)
before = guard.total_requests_used()
marker = guard.seal()
# 自检:封账后 acquire 必须被拒且不落账(拒绝路径在任何写入之前)。