Repository navigation
Description
DONE, by deleting it. pyerrors.declared(mod) answered "every exception class this
declaration names, for a gate", and it has been answering [] since
it was written.
def declared(mod: Module) -> list[str]:
"""Every exception class this declaration names, for a gate."""
return [cls.name for cls in mod.classes]
mod.classes is built by a loop that takes only DECORATED classes:
if not (isinstance(n, ast.ClassDef) and n.decorator_list):
continue
An error declaration wears no decorator. cxx = "nix::Error" is a
bare assignment, because there is no behaviour to mark and the
assignment reads as the fact it is. So every class in decl/errors.py
is skipped, mod.classes is empty, and whatever gate reads this list
has been checking nothing against nothing.
Found on 2026-09-01 while making a declared error a FIELD type
(#71). That work added Module.errors, read from the BASE
rather than from a decorator, so the names ARE available now - this
function just does not use them.
What to do
Two halves, and the second is the point.
-
declared()readsmod.errorsinstead ofmod.classes. One line. -
Find what reads it and prove the gate fails. A list that is
always empty makes every caller vacuously true, so it is not
enough to fix the source: the thing it feeds has to be shown to
refuse something. Delete a class from the declaration, or add one
the emitted module does not define, and watch the build stop. If
nothing stops, the gate is not a gate and this task is about
deleting it rather than fixing it.
Why it is worth doing
Goal 1 says a gate that has never failed has not been shown to test
anything. This one is stronger than that: it is a gate that CANNOT
fail, and it sat in the tree looking like coverage.
It is also cheap. The names are already read.
What happened, 2026-09-02
Nothing read it. Searched the tree and the history: no caller, in
any commit. The declared( hits in git log -S are a local function
of the same name inside smoke_test.py. So it was not a gate that
could not fail - it was dead code shaped like one, which is worse,
because a reader counts it as coverage.
Deleted, per this task's own second half: "if nothing stops, the gate
is not a gate and this task is about deleting it rather than fixing
it."
And there is nothing left for it to check. entries() and
chain() and module() all read ONE parse of one file, so they
cannot disagree. That is the design pyerrors.py's docstring opens
with - "two outputs from one file, and they used to be two
hand-written files that had to agree" - and declared() is a
leftover from when they were two.
One claim of mine was refuted on the way. The first version of
the deletion said entries() already covers what declared() looked
like it covered, "because getattr(mod, name) refuses a class the
tree names and the module does not define". Perturbed to check it,
and it does not: entries() reads tree.body, so a class nested
under if NIX_VERSION >= ... is invisible to it. The build passed
with such a class in the emitted module and in no manifest entry.
That is #610, and it is a real hole rather than a dead one.
The perturbation is written out there.
Migrated from tasks/072-a-gate-that-has-never-tested-anything.md.done.
Assisted-By: Opus 5
Activity