Skip to content

Add cluster-consistency check: report-only d=0 phash divergence detector - #98

Merged
WilfordGrimley merged 3 commits into
masterfrom
cluster-consistency-check-1784413807
Jul 18, 2026
Merged

Add cluster-consistency check: report-only d=0 phash divergence detector#98
WilfordGrimley merged 3 commits into
masterfrom
cluster-consistency-check-1784413807

Conversation

@WilfordGrimley

Copy link
Copy Markdown

Summary

Per docs/theory.md §6's carve-out — this Sybil/bad-actor detector isn't human-volume gated (see docs/reports/2026-07-18-dawid-skene-readiness-recheck.md, which found the other three detectors in that section still aren't ready).

New management command local_cluster_consistency_check (read-only, zero writes): groups every RESOLVED card by exact content_phash (d=0 cluster), flags clusters with 2+ members whose inferred_canonical_card differs. A d=0 cluster is by construction the same uploaded image, so a resolved-printing mismatch within one is an internal contradiction.

Doubles as the federation export's pre-flight audit — a divergent cluster is exactly the kind of record that export must not publish.

Verification

  • 8 new unit tests (host-venv pytest, real Postgres via testcontainers) — all pass.
  • pre-commit clean (ruff/isort/black/mypy/prettier).
  • Smoke-tested against real production data via a one-off docker compose run --rm container (live serving containers never touched): resolved_cards_considered=3 clusters_checked=0 divergent=0 — cross-checked directly against the live DB via manage.py shell, confirming the low count is real (only 3 cards currently carry RESOLVED status — consistent with this session's own finding that real human-backed consensus volume is still small, see the D-S readiness re-check above).

🤖 Generated with Claude Code

@WilfordGrimley
WilfordGrimley merged commit eee7c79 into master Jul 18, 2026
1 of 2 checks passed
@WilfordGrimley
WilfordGrimley deleted the cluster-consistency-check-1784413807 branch July 19, 2026 21:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant