CB-WP-0019-T05: what the meta budget is for, at 80/20
InnerLoop v1.7. The purpose is written first and the number follows from it: most spend on the task at hand, some on control, review and improving the process. make status prints it above the figure, because a threshold with no stated purpose is what let this number be argued three times. Soft 20% over a trailing 5, and the self-test enforces that the ratio and the window are a PAIR: META_SOFT_PCT == 100 / TRAILING_PASSES. One meta pass among n at parity cost reads 1/n, so 80/20 is one pass in five at normal cost -- a five-pass window. The same 20% over three would have silently also demanded the meta pass be half-price, which makes meta work rushed rather than rare. Moving the ratio without the window goes red. The phase setting is declared, argued and expiring in gates.toml, and reverts on review_by unless re-argued. Verified live at 35%. One with no reason or no expiry is refused rather than honoured, because a threshold anyone may move is not a threshold. Measured: the last five passes read 7% against the new line. InnerLoop.md crossed the 400-line limit three times while this was written and was fixed structurally each time -- the arithmetic, the cost-per-response basis and the two review case studies moved to InnerLoopReference.md. The limit was not raised. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This commit is contained in:
parent
07261b4444
commit
cc8917a6fb
5 changed files with 235 additions and 37 deletions
100
tools/status.py
100
tools/status.py
|
|
@ -118,12 +118,54 @@ def cost_lines():
|
|||
|
||||
# ------------------------------------------------------- the meta budget
|
||||
|
||||
# How many passes the budget looks back over. One pass is a coin flip —
|
||||
# a `meta` pass reads 100% and a `product` pass reads 0%, and neither
|
||||
# says anything about the balance the budget is about. Three is the
|
||||
# smallest window in which a ratio means something and still moves.
|
||||
TRAILING_PASSES = 3
|
||||
META_SOFT_PCT = 25
|
||||
# **The ratio and the window are a pair** (InnerLoop v1.7, CB-WP-0019 T05).
|
||||
# One meta pass among `n`, costing what its neighbours cost, reads `1/n`:
|
||||
# 33% over three, 25% over four, 20% over five. So 80/20 — the split the
|
||||
# maintainer set — is *one pass in five at normal cost*, and that is a
|
||||
# five-pass window. The same 20% over three would additionally demand the
|
||||
# meta pass be half-price, which does not make meta work rarer, only
|
||||
# rushed. Changing either number without the other changes the rule.
|
||||
TRAILING_PASSES = 5
|
||||
META_SOFT_PCT = 20
|
||||
|
||||
# What the budget is for, in one line, because for three arguments it had
|
||||
# a threshold and no purpose: most of the spend goes on the task at hand;
|
||||
# some must go on control, review, and improving the process that carries
|
||||
# the work forward.
|
||||
META_PURPOSE = ("most spend on the task at hand; some on control, review "
|
||||
"and improving the process")
|
||||
|
||||
|
||||
def meta_phase(root=None):
|
||||
"""The declared phase setting from gates.toml, or None.
|
||||
|
||||
Returns `(pct, reason, review_by)`. A phase setting is allowed to move
|
||||
the line — stage 0 and a stabilisation phase do not deserve the same
|
||||
ratio — but only **declared, argued and expiring**. One with no reason
|
||||
or no expiry is refused rather than honoured, so the line cannot be
|
||||
raised quietly to pass a breach.
|
||||
"""
|
||||
path = os.path.join(root or ROOT, "gates.toml")
|
||||
try:
|
||||
text = open(path).read()
|
||||
except OSError:
|
||||
return None
|
||||
m = re.search(r"^meta_phase\s*=\s*\{(.+?)\}", text, re.M | re.S)
|
||||
if not m:
|
||||
return None
|
||||
body = m.group(1)
|
||||
|
||||
def field(name):
|
||||
f = re.search(name + r'\s*=\s*"([^"]*)"', body)
|
||||
return f.group(1) if f else None
|
||||
|
||||
pct = re.search(r"pct\s*=\s*(\d+)", body)
|
||||
reason, review_by = field("reason"), field("review_by")
|
||||
if not pct or not reason or not review_by:
|
||||
raise ValueError(
|
||||
"meta_phase needs pct, reason and review_by — a threshold with "
|
||||
"no argument or no expiry is a dial, not a threshold")
|
||||
return int(pct.group(1)), reason, review_by
|
||||
|
||||
|
||||
def workplan_starts():
|
||||
|
|
@ -178,9 +220,15 @@ def meta_budget(plans):
|
|||
print("\n meta budget UNAVAILABLE — the trailing window measured $0")
|
||||
return
|
||||
share = 100 * meta / total
|
||||
mark = "ok " if share <= META_SOFT_PCT else "OVER"
|
||||
phase = meta_phase()
|
||||
soft = phase[0] if phase else META_SOFT_PCT
|
||||
mark = "ok " if share <= soft else "OVER"
|
||||
print(f"\n meta budget [{mark}] {share:.0f}% over the last "
|
||||
f"{len(window)} pass(es) (soft {META_SOFT_PCT}%, InnerLoop v1.6)")
|
||||
f"{len(window)} pass(es) (soft {soft}%, InnerLoop v1.7)")
|
||||
print(f" for: {META_PURPOSE}")
|
||||
if phase:
|
||||
print(f" phase setting {phase[0]}% until {phase[2]} — {phase[1]}")
|
||||
print(f" (reverts to {META_SOFT_PCT}% on that date unless re-argued)")
|
||||
for wid, kind, _w in window:
|
||||
c = costs[wid]
|
||||
print(f" {wid} {kind:<8} ${c['cost']:>7,.2f} "
|
||||
|
|
@ -293,6 +341,42 @@ def self_test():
|
|||
"""
|
||||
results = []
|
||||
|
||||
def check(name, ok, detail=""):
|
||||
results.append((name, ok, detail))
|
||||
|
||||
# CB-WP-0019 T05: the ratio and the window are a pair. If either moves
|
||||
# without the other, "80/20" stops meaning one pass in five at normal
|
||||
# cost — which is the whole content of the rule.
|
||||
check("the meta ratio matches its window",
|
||||
abs(META_SOFT_PCT - 100 / TRAILING_PASSES) < 1e-9,
|
||||
f"{META_SOFT_PCT}% over {TRAILING_PASSES} passes; one meta pass at "
|
||||
f"parity reads {100 / TRAILING_PASSES:.0f}%")
|
||||
check("the budget states what it is for",
|
||||
bool(META_PURPOSE) and "task at hand" in META_PURPOSE)
|
||||
|
||||
# A phase setting may move the line, but only declared, argued and
|
||||
# expiring. One with no reason or no expiry is refused rather than
|
||||
# honoured — otherwise it is a dial for passing breaches.
|
||||
import tempfile
|
||||
def phase_of(body):
|
||||
with tempfile.TemporaryDirectory() as d:
|
||||
open(os.path.join(d, "gates.toml"), "w").write(body)
|
||||
return meta_phase(d)
|
||||
check("a phase setting with no gates.toml is absent, not an error",
|
||||
phase_of("# nothing here") is None)
|
||||
good = 'meta_phase = { pct = 35, reason = "stage 0 hardening", review_by = "2026-12-31" }'
|
||||
check("a fully declared phase setting is honoured",
|
||||
phase_of(good) == (35, "stage 0 hardening", "2026-12-31"))
|
||||
for bad, why in [
|
||||
('meta_phase = { pct = 90, review_by = "2026-12-31" }', "no reason"),
|
||||
('meta_phase = { pct = 90, reason = "because" }', "no expiry"),
|
||||
]:
|
||||
try:
|
||||
phase_of(bad)
|
||||
check(f"a phase setting with {why} is refused", False, "it was honoured")
|
||||
except ValueError:
|
||||
check(f"a phase setting with {why} is refused", True)
|
||||
|
||||
def check(name, ok, detail=""):
|
||||
results.append((name, ok, detail))
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue