mirror of
https://github.com/wiltodelta/remove-ai-watermarks.git
synced 2026-10-14 21:40:47 +02:00
The ignore rule landed with a comment naming the private product, its storage provider, the private rule file, and the size of the customer set. That text is the disclosure the rule exists to prevent, so it says what a public reader needs instead: these trees are local-only and not publication-cleared. `data/research/` gets the same tracked rule as `data/spaces/`. It held 68 GB behind `.git/info/exclude` alone, which no clone has, so a fresh checkout could commit the whole corpus with nothing to stop it, and a test now pins both entries. A first draft of that test also carried a denylist of private identifiers, which published six of them into a tracked file to keep two out, and only its own self-exclusion hid that. The mechanized half is now the one that discloses nothing: no cloud GPU harness under `scripts/`. Reading the ignore entries rather than the file text matters too, because a comment naming `data/research/README.md` satisfied the first assertion with the rule deleted. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
67 lines
2.8 KiB
Python
67 lines
2.8 KiB
Python
"""Distribution-boundary regression tests."""
|
|
|
|
from __future__ import annotations
|
|
|
|
import re
|
|
from pathlib import Path
|
|
|
|
ROOT = Path(__file__).resolve().parents[1]
|
|
|
|
|
|
def _array_values(section: str, key: str) -> set[str]:
|
|
match = re.search(rf"(?ms)^{key}\s*=\s*\[(.*?)^\]", section)
|
|
assert match is not None
|
|
return set(re.findall(r'"([^"]+)"', match.group(1)))
|
|
|
|
|
|
def test_sdist_has_explicit_public_boundary() -> None:
|
|
"""Hatchling must publish only package source and required metadata."""
|
|
config = (ROOT / "pyproject.toml").read_text(encoding="utf-8")
|
|
sdist_config = config.split("[tool.hatch.build.targets.sdist]", maxsplit=1)[1].split("\n[", maxsplit=1)[0]
|
|
|
|
assert _array_values(sdist_config, "include") == {"/src", "/LICENSE", "/README.md", "/pyproject.toml"}
|
|
assert {"/data", "/tmp", "/.sc"} <= _array_values(sdist_config, "exclude")
|
|
|
|
|
|
def test_release_guide_names_every_published_surface() -> None:
|
|
"""A release checklist must not silently forget a downstream surface."""
|
|
guide = (ROOT / "docs" / "release-and-distribution.md").read_text(encoding="utf-8")
|
|
|
|
for surface in ("PyPI", "Homebrew", "Hugging Face Space", "ComfyUI Registry"):
|
|
assert surface in guide
|
|
assert re.search(r"Conda is\s+not a supported publishing surface", guide)
|
|
|
|
|
|
def test_local_only_data_stays_ignored() -> None:
|
|
"""A fresh clone must carry the ignore rules for the local-only data trees.
|
|
|
|
Both were covered only by `.git/info/exclude` or an untracked .gitignore
|
|
inside the directory, neither of which a clone has, so nothing stopped a
|
|
fresh checkout from committing them and nothing reported the gap. Read the
|
|
entries rather than the file text: a first draft matched the raw string and
|
|
a comment naming `data/research/README.md` satisfied it with the rule gone.
|
|
"""
|
|
entries = {
|
|
stripped
|
|
for line in (ROOT / ".gitignore").read_text(encoding="utf-8").splitlines()
|
|
if (stripped := line.strip()) and not stripped.startswith("#")
|
|
}
|
|
assert {"data/spaces/", "data/research/"} <= entries
|
|
|
|
|
|
def test_scripts_carry_no_cloud_gpu_harness() -> None:
|
|
"""Research that needs a cloud GPU account is not kept in this repository.
|
|
|
|
Twelve such harnesses moved out on 2026-09-07, and the import is what made
|
|
them harnesses rather than offline analysis. The private identifiers they
|
|
named are deliberately not listed here: a denylist written into a tracked
|
|
file publishes the very strings it exists to keep out, so that half of the
|
|
audit stays a read of the private rules.
|
|
"""
|
|
offenders = [
|
|
path.name
|
|
for path in sorted((ROOT / "scripts").rglob("*.py"))
|
|
if re.search(r"^\s*(?:import modal|from modal import)\b", path.read_text(encoding="utf-8"), re.MULTILINE)
|
|
]
|
|
assert offenders == []
|