llms.txt still installed v1.1.0 seven releases later: no check read it, and the release commit bumps only the surfaces it remembers. A test now holds every git pin and index floor in README.md and llms.txt to __version__, and every git pin to the open/ address.
39 lines
1.4 KiB
Python
39 lines
1.4 KiB
Python
"""Every printed install pin names the current release.
|
|
|
|
`llms.txt` carried `@v1.1.0` through seven releases because no check read it: the
|
|
release commit bumps the surfaces it remembers. This test reads every git pin
|
|
(`.git@vX.Y.Z`) and every index lower bound (`>=X.Y.Z`) in the files a reader
|
|
copies an install line from, and holds each to `__version__`.
|
|
"""
|
|
|
|
from __future__ import annotations
|
|
|
|
import re
|
|
from pathlib import Path
|
|
|
|
import pytest
|
|
|
|
import llm_ingestion_guard
|
|
|
|
ROOT = Path(__file__).resolve().parent.parent
|
|
SURFACES = ["README.md", "llms.txt"]
|
|
CANONICAL = "git+https://git.fromaitochitta.com/open/llm-ingestion-pipeline-security.git@"
|
|
GIT_PIN = re.compile(r"llm-ingestion-pipeline-security\.git@v(\d+\.\d+\.\d+)")
|
|
INDEX_FLOOR = re.compile(r'"llm-ingestion-guard>=(\d+\.\d+\.\d+)')
|
|
|
|
|
|
@pytest.mark.parametrize("name", SURFACES)
|
|
def test_install_pins_name_the_current_release(name):
|
|
text = (ROOT / name).read_text(encoding="utf-8")
|
|
pins = GIT_PIN.findall(text) + INDEX_FLOOR.findall(text)
|
|
assert pins, f"{name}: no install pin found"
|
|
version = llm_ingestion_guard.__version__
|
|
assert all(p == version for p in pins), f"{name}: pins {pins} != {version}"
|
|
|
|
|
|
@pytest.mark.parametrize("name", SURFACES)
|
|
def test_git_pins_point_at_the_public_address(name):
|
|
text = (ROOT / name).read_text(encoding="utf-8")
|
|
for line in text.splitlines():
|
|
if ".git@v" in line:
|
|
assert CANONICAL in line, f"{name}: {line.strip()}"
|