Every fixture, test document, tool example and document now uses an invented kitchen-and-baking handbook series, written in this repository. The package's behaviour is unchanged; src/ changes are comments and help text only. - Generated fixtures are regenerated from their generators. Their structural counts are identical before and after: elements, images, rows, cells, headings, bookmarks and the witness inventory's per-document totals. The image-inbox and accounting documents are renamed kapittel-84-*. - tools/okf_accounting_gate.py: the two options that named one real corpus each are replaced by a generic, repeatable --corpus PATH with no default. Row 5 compares the PDF pair alone. Gate verdict unchanged: RED rows 2, 3, 6. - tools/okf_witness.py: the STS JSON reader for one publisher's delivery is removed, along with its three twins and five tests. The mutation harness loses W09. - docs/: 13 dated reports that documented runs on a retired reference corpus are removed, and 40 are neutralized. Dead links are removed, and no new dangling path is introduced. - The synthetic MCP-gate corpus and the residual probe words are neutral. Valgt: keep the `okf quality --fasit` bar value (the measured fraction, one corpus) and rewrite only its provenance, because the verdict stays unchanged and the number names nothing. Term check with the local list: 0 of 411 tracked files, 0 file names, 0 of 27 binary fixtures. Suite after git add: 2457 passed, 1 skipped. The base tree had 2460 passed and 2 skipped; five tests went with the JSON reader and four were added by the term check. ruff, ruff format and mypy --strict src/ are clean. Co-Authored-By: Claude Opus 5.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 a downstream consumer repository 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
|