`uv sync --frozen` resolved ruff 0.15.22 and the tree read clean. A loose install resolves 0.16.6, under which the SAME untouched code reports 148 findings -- 4 more than round 9 counted, because this round added four files. All of them are new rules rather than new defects: 0.16 widened the default rule set to whole families (YTT, ASYNC, PL, ISC, C4, UP, B, SIM, FURB, ...). (`[skip-docs]` is for CLAUDE.md, which a lint-configuration change does not reach. README's developer section IS updated in this commit.) THE DEFECT IS NOT THE 148, IT IS THAT NOBODY CHOSE THEM. `[tool.ruff]` set only `line-length` and `target-version`, so the acceptance was ruff's default, and the tree stayed green only as long as the lockfile froze an old ruff. `select` is now written down: `E4`, `E7`, `E9`, `F` (the historical default), `I` because this tree already keeps imports sorted, and `RUF100` so a `noqa` that has stopped meaning anything is caught rather than left as decoration. Pin `ruff>=0.9` -> `ruff>=0.16.6,<0.17`. Per rule, before -> after: RUF100 50 -> 0, I001 20 -> 0, ISC004 19, PLW1510 8, C408 8, EXE001 6, RUF007 5, PLE2515 4, UP031 3, B017 3, and fourteen more with 2 or fewer -- the families out of the declared set are 0 by selection, and 148 is the number to start from if they are adopted, which is a separate decision and not one to take inside a version-pin commit. 57 were auto-fixed; one E402 was reintroduced by the import-sorting fix merging a block away from its `noqa`, and got the directive back rather than a bare one. `S` IS MEASURED OUT, NOT ASSUMED OUT: it reports 2657 `S101` on a suite whose every assertion is an `assert`, and `S603` flags 19 subprocess calls of which one was ever marked -- selecting it buys 18 suppressions and no defect. Two `noqa` directives naming non-selected rules were dropped with that reason recorded in the configuration instead. THE TWO FILES 0.16 WOULD REFORMAT ARE MARKDOWN, NOT PYTHON: `README.md` and `docs/2026-09-08-blindsone-below-k-k2.md`. 0.16 formats fenced Python inside markdown, and both blocks are RECORDS -- the second is a quotation of `COST_VOCABULARY` as it stood when that measurement was taken. Reformatting a quotation makes it stop being one, so markdown is excluded from the formatter and `ruff format --check .` stays in the acceptance over `.py`. `tools/okf_consume_measure.py` is fenced by the order as run-not-edited, so its three findings are exempted by path with the reason and the debt named, and its bytes are untouched. THE LOCKFILE TRAP IS CLOSED, NOT AVOIDED. `uv.lock` predated the `[ocr]` extra, so any unlocked resolve wrote that extra's transitive tree back into it -- 681 insertions over 4 deletions, twice now, and round 9 recorded the cause as `uv run` OUTSIDE the project when it is `uv run` without `--frozen` INSIDE it. The relock is complete for every declared extra (703 insertions, 26 deletions), and measured after it, an unfrozen `uv run` leaves the file alone. `ruff check src tests tools`, `ruff format --check .` (0.16.6), `mypy src` over 21 files and 1535 tests, all green. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
59 lines
2.9 KiB
Python
59 lines
2.9 KiB
Python
#!/usr/bin/env python3
|
|
"""Thin entry point. The implementation is `llm_ingestion_okf.consume`.
|
|
|
|
It moved into the package on 2026-09-08 (O5), for the reason the module's own
|
|
docstring states: a generated consumption skill named this file by absolute
|
|
path, so the skill could not be moved, shared, or run without this clone at
|
|
that exact path. The command is now `okf consume`, on PATH after an install.
|
|
|
|
This file stays because the published reproduction blocks and the measurement
|
|
scripts under `docs/` name it, and a measurement whose command no longer runs
|
|
is a measurement nobody can repeat. `tests/test_okf_consume.py` imports it by
|
|
this name and is the contract for the pre-pass.
|
|
|
|
No logic here, deliberately: a second copy of the ranking or the cut is a
|
|
second thing that can be right while the shipped one is wrong.
|
|
|
|
**IF YOU IMPORT THIS FILE BY PATH** (`importlib.util.spec_from_file_location`),
|
|
read the module back out of `sys.modules[<name>]` after `exec_module`, or import
|
|
`llm_ingestion_okf.consume` directly: the last line of this file replaces the
|
|
REGISTRY entry, which is not the object a path importer holds.
|
|
"""
|
|
|
|
from __future__ import annotations
|
|
|
|
import sys
|
|
from pathlib import Path
|
|
|
|
sys.path.insert(0, str(Path(__file__).resolve().parents[1] / "src"))
|
|
|
|
from llm_ingestion_okf import consume as _impl
|
|
|
|
if __name__ == "__main__":
|
|
raise SystemExit(_impl.main())
|
|
|
|
# A PATH IMPORTER NEVER SEES THE LINE BELOW, so its names are copied here.
|
|
# `sys.modules[__name__] = _impl` replaces the REGISTRY entry; a caller using
|
|
# `importlib.util.spec_from_file_location` already holds the object
|
|
# `module_from_spec` made, and `exec_module` leaves that object with this
|
|
# file's own globals -- 3 public names against the packaged module's 76.
|
|
# Reported by `vegnormal-okf` after v0.7.0 and reproduced in
|
|
# `tests/test_okf_consume_shim.py` under two counting methods.
|
|
#
|
|
# THE DUNDER FILTER IS LOAD-BEARING. An unfiltered `vars(_impl)` overwrites
|
|
# `__name__` with `llm_ingestion_okf.consume`, and the next statement uses
|
|
# `__name__` as the `sys.modules` key -- the module would be aliased under the
|
|
# wrong one.
|
|
#
|
|
# This restores attribute ACCESS and NOT patch-through: a caller monkeypatching
|
|
# one of these copies patches a binding the implementation never reads. That is
|
|
# precisely why the alias below exists, and it is why the alias stays.
|
|
globals().update({k: v for k, v in vars(_impl).items() if not k.startswith("__")})
|
|
|
|
# ALIASED, not re-exported. `import okf_consume` must hand back the packaged module
|
|
# ITSELF: a re-export binds copies of the names into a second module object, so
|
|
# a caller patching one of them patches a binding the implementation never
|
|
# reads. Measured on the move: two tests that monkeypatch `okf_consume` went green
|
|
# again only under the alias. Guarded by the `__main__` branch above, because
|
|
# aliasing `sys.modules["__main__"]` would replace the running script.
|
|
sys.modules[__name__] = _impl
|