tools (volt): the "could not grade" class gets one code -- rc 2 -- and a gate that measures it on every tool
Six tools answered an input they could not read with a code that means
something else: check_lint and census_row_delta exited 1 (the code that
means "the grading found a fault"), the two append-only tools exited 1 out
of a raw traceback, selftest_sweep exited 1 with "0 tools, nothing
discovered", and the two queue readers exited 3 -- one meaning, three
codes. Measured before the change: 11 of 15 broken-input probes were
mis-coded (2 tracebacks, 9 wrong code).
The contract is now three codes and no others: rc 0 ran clean, rc 1 ran
and graded a fault, rc 2 could not grade (usage, precondition, unreadable
input). rc 3 is retired.
And the class is gated, not merely fixed: selftest_sweep.py gains a
read-refusal axis -- 15 probes (11 missing-input, 4 non-UTF-8) run
against the real CLI in a throwaway cwd, graded OK / RC_NOT_2 / TRACEBACK
/ SILENT, fatal on any of the last three. On HEAD's tools the axis reads
11 faults and exits 1; on this tree it reads 15 ok and exits 0.
Also: doc_census_check.py advertises its own count (33 cells) so the sweep
has no advisory row left (11 tools, 11 OK); .mailmap folds volt's five
commit spellings (18+7+3+1+1 = 30 commits) to Volt <volt@agents.invalid>,
the identity 016d26e lost to the repo's Timmy config.
Selftests: 18/15/33/37/54/16/22, 0 failed. Sweep 11 tools, 11 OK, 0 fatal.
queue_index --check rc 0 (49 sections, 45 ids, 9 nested). landing_check
346/346.
This commit is contained in:
1 parent
461eede57a
commit
6ee8fcee5a
9 files changed
+238
-35
No files matched your search
@@ -489,7 +489,7 @@ def run(args):
|
||||
# missing path or at bytes that are not UTF-8 raised FileNotFoundError /
|
||||
# UnicodeDecodeError straight out of run(), so the operator got a stack and
|
||||
# rc 1 while every other reader in this repo (`queue_claim_check.py:558-563`)
|
||||
# says `cannot read queue:` and exits 3. The same contract is owed to the
|
||||
# says `cannot read queue:` and exits 2. The same contract is owed to the
|
||||
# --check document: a gate that cannot read its input has verified nothing,
|
||||
# and must not report that as a stale index (rc 1) or a crash.
|
||||
try:
|
||||
@@ -497,7 +497,7 @@ def run(args):
|
||||
text = fh.read()
|
||||
except (OSError, UnicodeDecodeError) as exc:
|
||||
print("cannot read queue: %s" % exc, file=sys.stderr)
|
||||
return 3
|
||||
return 2
|
||||
payload = parse(text)
|
||||
|
||||
if args.check:
|
||||
@@ -505,7 +505,7 @@ def run(args):
|
||||
doc = open(args.check, encoding="utf-8").read()
|
||||
except (OSError, UnicodeDecodeError) as exc:
|
||||
print("cannot read index document: %s" % exc, file=sys.stderr)
|
||||
return 3
|
||||
return 2
|
||||
pinned = extract_pinned(doc)
|
||||
if pinned is None:
|
||||
print("UNVERIFIABLE: no parseable pinned block in %s" % args.check)
|
||||
@@ -772,9 +772,9 @@ def selftest():
|
||||
# --- a read error is an exit code, not a traceback -----------------------
|
||||
# `--queue` at a missing path or at bytes that are not UTF-8 used to raise
|
||||
# straight out of run() (FileNotFoundError / UnicodeDecodeError, rc 1). The
|
||||
# repo's other reader exits 3 with `cannot read queue:`; this tool now does
|
||||
# repo's other reader exits 2 with `cannot read queue:`; this tool now does
|
||||
# the same, and owes the --check document the same answer: an unreadable
|
||||
# gate input is rc 3, never the rc 1 that means "stale".
|
||||
# gate input is rc 2, never the rc 1 that means "stale".
|
||||
bad_q = os.path.join(root, "bad-utf8.md")
|
||||
with open(bad_q, "wb") as fh:
|
||||
fh.write(b"\xff\xfe\x80\n")
|
||||
@@ -782,14 +782,14 @@ def selftest():
|
||||
with contextlib.redirect_stderr(err):
|
||||
rc = run(argparse.Namespace(repo=root, queue="missing-queue.md", index=False,
|
||||
json=None, write=None, check=None, outside=False))
|
||||
check("missing queue -> exit 3", rc, 3)
|
||||
check("missing queue -> exit 2", rc, 2)
|
||||
check("missing queue -> says cannot read queue",
|
||||
err.getvalue().startswith("cannot read queue:"), True)
|
||||
err = io.StringIO()
|
||||
with contextlib.redirect_stderr(err):
|
||||
rc = run(argparse.Namespace(repo=root, queue="bad-utf8.md", index=False,
|
||||
json=None, write=None, check=None, outside=False))
|
||||
check("non-UTF-8 queue -> exit 3", rc, 3)
|
||||
check("non-UTF-8 queue -> exit 2", rc, 2)
|
||||
check("non-UTF-8 queue -> says cannot read queue",
|
||||
"cannot read queue:" in err.getvalue(), True)
|
||||
err = io.StringIO()
|
||||
@@ -798,14 +798,14 @@ def selftest():
|
||||
json=None, write=None,
|
||||
check=os.path.join(repo, "missing-index.md"),
|
||||
outside=False))
|
||||
check("missing index document -> exit 3", rc, 3)
|
||||
check("missing index document -> exit 2", rc, 2)
|
||||
check("missing index document -> names the document",
|
||||
"cannot read index document:" in err.getvalue(), True)
|
||||
err = io.StringIO()
|
||||
with contextlib.redirect_stderr(err):
|
||||
rc = run(argparse.Namespace(repo=repo, queue="WORK-QUEUE.md", index=False,
|
||||
json=None, write=None, check=bad_q, outside=False))
|
||||
check("non-UTF-8 index document -> exit 3", rc, 3)
|
||||
check("non-UTF-8 index document -> exit 2", rc, 2)
|
||||
check("non-UTF-8 index document -> names the document",
|
||||
"cannot read index document:" in err.getvalue(), True)
|
||||
|
||||
|
||||
Reference in new issue
Block a user