Make the budget gate's hard index-row limit actually fail

`check_index_rows` read `'warn' if hard else 'warn'` -- both branches identical -- so
INDEX_ROW_HARD was defined, computed, and unable to fail anything: an index row could grow
without bound while every gate stayed green.

Found by injecting an over-long row into SKILL.md and requiring the gate to fail. That is the
only way a dead threshold shows itself; a gate that has only ever been observed passing is not
evidence that it can see anything.

A test now pins both sides -- a row past the soft limit warns, a row past the hard limit fails
-- and it was checked against the pre-fix behaviour, where it fails.
This commit is contained in:
inliver233 committed 2026-10-16 19:17:21 +08:00
1 parent ca38fa393d
commit b8aa0a529b
2 files changed
+29 -1

No files matched your search

+5 -1
View File
@@ -196,7 +196,11 @@ def check_index_rows(lines):
out = []
for section, key, size in long_rows:
hard = size > INDEX_ROW_HARD
out.append(('warn' if hard else 'warn',
# `hard` must actually escalate. This read `'warn' if hard else 'warn'` -- both branches the
# same -- so INDEX_ROW_HARD was defined, computed and never able to fail anything: an index
# row could grow without limit and CI stayed green. Found by injecting an over-long row and
# asking the gate to fail, which is the only way this class of defect shows up.
out.append(('fail' if hard else 'warn',
'%s: row for %s is %d chars (soft limit %d)%s' %
(section, key, size, INDEX_ROW_SOFT,
' -- that is a paragraph, not an index entry' if hard else '')))