Files
remove-ai-watermarks/tests/test_contentseal_corpus.py
T
Victor KuznetsovandClaude Fable 4.5 e09104e39f Document Meta Muse Image Content Seal support with oracle-verified corpus
Muse Image (muse-image-1.0, Meta Superintelligence Labs, 2026-07-07) ships
every output with Content Seal, a proprietary invisible pixel watermark, and
no visible mark. Establish support documentation and a verified corpus:

- data/contentseal/: five own generations via the Meta Model API, every
  oracle verdict recorded in manifest.csv (44 rows, settled-text protocol,
  fresh-navigation variant for calibration rows)
- Oracle: meta.ai/identification web tool only; no API endpoint exists in
  the Meta Model API (verified against dev.meta.ai/docs); internal REST
  pair documented with its server-side sliding-window rate limit
- Removal: default qwen-zimage profile clears Content Seal (oracle-verified
  on the worst source); strength floor derived at 0.1 by the standard
  worst-boundary-plus-cross-source-spread method, recorded but not encoded
  as a constant since no provenance signal routes Muse output onto a vendor
  cohort
- Seal robustness measured: survives resize, JPEG q85, metadata stripping,
  CDN WebP transcode; dies to center crops and diffusion regeneration
- tests/test_contentseal_corpus.py guards manifest integrity

Co-Authored-By: Claude Fable 4.5 <noreply@anthropic.com>
2026-08-26 21:08:47 -07:00

61 lines
2.3 KiB
Python

"""Tests for the Content Seal oracle corpus layout.
Mirrors the synthid corpus guard: the manifest is the source of truth for
which binaries exist, and every recorded hash must match the file it names.
Derived rows are recipes, not stored files, so only originals are checked
against disk.
"""
from __future__ import annotations
import csv
import hashlib
import re
from pathlib import Path
CORPUS_DIR = Path(__file__).resolve().parent.parent / "data" / "contentseal"
MANIFEST = CORPUS_DIR / "manifest.csv"
ORIGINALS = CORPUS_DIR / "originals"
_SHA256 = re.compile(r"^[0-9a-f]{64}$")
_VALID_VERDICTS = {"detected", "not_detected", ""}
_VALID_ORIGINS = {"meta-model-api", "derived", "meta-blog-cdn", "synthetic-local"}
def _manifest_rows() -> list[dict[str, str]]:
with open(MANIFEST, newline="") as f:
return list(csv.DictReader(f))
def test_manifest_original_rows_match_binaries_and_hashes() -> None:
rows = [r for r in _manifest_rows() if r["file"]]
stored = {path.name for path in ORIGINALS.iterdir() if path.is_file()}
assert {r["file"].removeprefix("originals/") for r in rows} == stored
for row in rows:
digest = hashlib.sha256((CORPUS_DIR / row["file"]).read_bytes()).hexdigest()
assert digest == row["sha256"], row["file"]
def test_manifest_rows_are_well_formed() -> None:
rows = _manifest_rows()
assert len({row["sha256"] for row in rows}) == len(rows), "duplicate sha256"
for row in rows:
assert _SHA256.match(row["sha256"]), row["name"]
assert row["origin"].split(":")[0] in _VALID_ORIGINS, row["name"]
assert row["oracle_verdict"] in _VALID_VERDICTS, row["name"]
# Every oracle verdict must carry its check timestamp.
if row["oracle_verdict"]:
assert row["checked_at_utc"], row["name"]
# Detection rows must name the oracle attribution.
if row["oracle_verdict"] == "detected":
assert "Muse Image 1" in row["oracle_attribution"], row["name"]
def test_default_pipeline_clearance_is_recorded() -> None:
"""The verified claim that the default profile clears Content Seal must stay."""
rows = {row["name"]: row for row in _manifest_rows()}
for name in ("fox_modal_invisible", "text_modal_invisible"):
assert rows[name]["oracle_verdict"] == "not_detected", name