Files
remove-ai-watermarks/tests/test_codex_plugin.py
T
Victor KuznetsovandClaude Opus 5.5 521831b972 Scope out plan-removable branding and LLM text watermarks
A visible mark is in scope when its vendor describes it as identifying
AI-generated content, whichever plan turns it off: the Gemini sparkle,
or the visible watermark Gemini Notebook (formerly NotebookLM) adds to
generated images and videos. Product branding that a paid plan of the
same product removes, such as "Made with Gamma", is out of scope.

Watermarks in LLM-generated text are out of scope: the Claude and
OpenAI marks live in word choice with no hidden characters, only a
substantial rewrite removes them, and their detectors are not public.

The skill states both boundaries, including the vendor-declared
exception so the Gemini sparkle is never refused, and moves to 1.0.13.
The Codex plugin version is now pinned to the Claude plugin's.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-17 22:33:51 -07:00

76 lines
3.1 KiB
Python

"""The Codex plugin manifest, held to the checks a Codex plugin catalog runs on it."""
from __future__ import annotations
import json
import re
import subprocess
from pathlib import Path
ROOT = Path(__file__).resolve().parents[1]
MANIFEST = ROOT / ".codex-plugin" / "plugin.json"
CLAUDE_PLUGIN = ROOT / "skills" / ".claude-plugin" / "plugin.json"
def _manifest() -> dict:
return json.loads(MANIFEST.read_text(encoding="utf-8"))
def test_manifest_carries_every_field_the_catalog_validator_requires() -> None:
manifest = _manifest()
for field in ("name", "version", "description", "repository", "license"):
assert str(manifest.get(field, "")).strip(), field
interface = manifest["interface"]
for field in ("displayName", "shortDescription", "composerIcon"):
assert str(interface.get(field, "")).strip(), field
assert re.fullmatch(r"[a-z0-9]+(?:-[a-z0-9]+)*", manifest["name"])
assert re.fullmatch(r"\d+\.\d+\.\d+", manifest["version"])
assert re.fullmatch(r"#[0-9A-Fa-f]{6}", interface["brandColor"])
def test_manifest_describes_the_same_plugin_as_the_claude_manifest() -> None:
manifest = _manifest()
claude = json.loads(CLAUDE_PLUGIN.read_text(encoding="utf-8"))
for field in ("name", "version", "description", "repository", "license", "homepage"):
assert manifest[field] == claude[field], field
def test_every_declared_path_stays_inside_the_repository() -> None:
manifest = _manifest()
interface = manifest["interface"]
paths = [manifest["skills"], interface["composerIcon"], interface["logo"]]
for declared in paths:
assert declared.startswith("./"), declared
resolved = (ROOT / declared).resolve()
assert resolved.is_relative_to(ROOT), declared
assert resolved.exists(), declared
assert (ROOT / manifest["skills"] / "remove-ai-watermarks" / "SKILL.md").is_file()
def test_icon_is_a_small_self_contained_svg() -> None:
icon = ROOT / _manifest()["interface"]["composerIcon"]
content = icon.read_text(encoding="utf-8")
assert icon.suffix == ".svg"
assert icon.stat().st_size <= 50 * 1024
for forbidden in ("data:image/", "base64", "TODO", "PLACEHOLDER"):
assert forbidden not in content, forbidden
def test_no_tracked_code_matches_the_scanner_dynamic_execution_rule() -> None:
"""The catalog's scanner reports a high finding for any call spelled like
Python's built-in evaluator in its code files, and that rule cannot tell it from
the PyTorch module method of the same name. Its scan job is advisory, but the
finding still lands on the listing PR, so the code switches modules to inference
with the equivalent ``module.train(False)``."""
tracked = subprocess.run(
["git", "ls-files", "*.py", "*.js", "*.mjs", "*.cjs", "*.ts", "*.tsx", "*.jsx"], # noqa: S607
cwd=ROOT,
check=True,
capture_output=True,
text=True,
).stdout.split()
assert tracked
rule = re.compile(r"\beval\s*\(")
offenders = [name for name in tracked if rule.search((ROOT / name).read_text(encoding="utf-8", errors="ignore"))]
assert offenders == []