Repository navigation
Description
CLAUDE.md states conventions that nothing checks. A convention that nothing
checks is not followed. This issue converts the mechanical ones into tests.
Evidence
The private-dependency rule has never been obeyed. CLAUDE.md says a narrow
dependency on a private module of nanopynix is acceptable, and that you must
"Document each such dependency at the import site". Measured on this tree:
private-import sites WITH a comment : 0
private-import sites WITHOUT a comment: 20
Zero of twenty. The rule is clear, it is written down, and no site follows it.
Nothing noticed, because nothing looks.
What pynix actually consumes. Measured with an AST walk over pynix/src:
from nanopynix import ... 2 distinct names, 0 absent from __all__ ok
from nanopynix.<public sub> ... 8 distinct ok
from nanopynix._private ... 2 names, 1 module, 20 import lines not ok
nanopynix._typechecking.BEARTYPING (20)
nanopynix._typechecking.no_runtime_type_check (2)
The top-level half is already correct, so a test over it costs nothing and
holds it there. The whole private surface of the dogfooding consumer is one
module and two names.
from __future__ import annotations is prose only. The FA rules fire
only when an annotation forces the import, so a module without one passes.
Four modules under */src do not have it:
nanopynix/src/nanopynix/_core/__init__.py
nanopynix/src/nanopynix/rpc/client/__init__.py
nanopynix/src/nanopynix/rpc/worker/_worker_nix.py
nanopynix/src/nanopynix/rpc/worker/__init__.py
Why a test and not a rule in a document
Two conventions in this repository are already tests, and both work:
tests/test_suppression_grammar.py holds 451 suppressions to a documented
reason, with one violation. tests/test_agent_note_imports.py keeps a test
module from importing pytest_agent directly.
The settings drift check is the same idea against Nix itself, and the wire
allowlist in test_exceptions_classify.py caught a new exception class during
the work on #56, in the same commit that added it.
Scope
Add tests/meta/, and give the self-checks one home. A convention that a
machine can check goes there, so the next one has an obvious place and does not
become another paragraph.
1. What pynix consumes. Two assertions:
- Every name that
pyniximports from thenanopynixtop level is in
nanopynix.__all__. This passes today, and it turns the dogfooding consumer
into a source of truth for the public surface. - The set of private-module imports equals a restated literal, and each site
carries a comment that says why.
Use a ledger for the second, not a derivation. Whether to promote
BEARTYPING is a judgement: it is an instrumentation switch, and CLAUDE.md
permits a narrow private dependency when a redesign is not justified. A literal
set makes the twenty-first site fail until somebody decides, which is the same
reason the wire allowlist is a literal.
2. The future import. Correct the four modules, then make it permanent:
[lint.isort]
required-imports = ["from __future__ import annotations"]3. The commit conventions. Closes #<number>, the Conventional Commits
prefix and the two trailers are prose. A CI step over the pushed range checks
them.
Out of scope
nanopynix.__all__ completeness belongs to #44. The documented home of each
public name belongs to a separate issue. This one adds the guards and the
conventions that no issue owns.
Cannot be checked, and must be marked so
Do not let these look enforced:
- ASD-STE100 prose. A sentence-length heuristic is noise.
- Whether a name deserves to be public.
- Whether a reason comment is true. The grammar test proves that one exists.
Acceptance criteria
tests/meta/exists and holds the checks above.- Every private-module import from
pynixintonanopynixis in the ledger
and carries a comment. - A new private import, or a new undocumented one, fails the suite.
ruff check --config ruff-strict.tomlreports zero findings with
required-importsenabled.- The commit-convention step runs in CI.
Tests
The tests are the deliverable. Each one must fail before its correction lands,
and the private-import test fails today at 0 of 20.
Activity
Lillecarl commentedon Aug 1, 2026
Three corrections found while implementing this, all recorded before the closing commit lands.
tests/is out of scope, and the scanner excludes it. The issue counts 20private import sites. Repository-wide the number is 68, because
tests/alonemakes 38 private imports over 17 modules. That is correct, and not drift: the
suite is white-box by design, and
ruff-strict.tomlalready grantstests/**the
SLF001ignore for the same reason. The ledger covers the consumers only —pynix/src(20),ekn/src(7),nanopynix-helpers/src(3) anddocs(0).The ledger entry replaces the per-site comment. The acceptance criteria ask
for both. One reason recorded once beats the same sentence copied 30 times, so
the ledger carries the reason and AGENTS.md now points at the ledger instead of
saying "document at the import site". The reason also already exists at the
definition site: the docstring of
nanopynix/_typechecking.pywaives thepublic-API rule explicitly and gives the argument. The ledger cites it.
The ledger keys on
(module, name), not on the site. A twenty-first use of anapproved name is not a new decision, and 30 identical failures teach nothing. A
new name or a new module is the decision point.
The future import is 12 files, not 16. Ruff does not require the import in
a file that holds no code, and four of the sixteen are exactly that — one empty
__init__.pyand three that hold only a docstring. That behaviour is right, sothe correction is 12 files:
The CI step checks the subject prefix only, and says so in a comment beside
the job.
Closes #Nis conditional, and a required trailer would train peopleto write it for partial work — the exact failure AGENTS.md warns about. The two
commit trailers are contextual: a commit that a person writes without an agent
carries neither. The job checks the documented shape
(
^[a-z]+(\([a-z0-9._/, -]+\))?!?: .+) and not a list of allowed types,because AGENTS.md gives
feat(scope):andfix(tests):as examples and neveragreed a taxonomy. Measured against the last 30 commits: 29 pass, and the one
failure is
ASD-STE100from 28 commits ago.ci(commits): say how many subjects the gate checked
test(meta): give every self-check one home, and a map to find it
test(meta): keep the consumers on the protocols, with a ledger for th…
test(meta): check the conventions that only prose held
ci(commits): say how many subjects the gate checked
test(meta): give every self-check one home, and a map to find it
test(meta): keep the consumers on the protocols, with a ledger for th…