Add cluster-consistency check: report-only d=0 phash divergence detector - #98
Merged
Merged
Conversation
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_016i9S7LQsCL3FGaih3ZTRBJ
…-check-1784413807
…the two called directly Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_016i9S7LQsCL3FGaih3ZTRBJ
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Per
docs/theory.md§6's carve-out — this Sybil/bad-actor detector isn't human-volume gated (seedocs/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 everyRESOLVEDcard by exactcontent_phash(d=0 cluster), flags clusters with 2+ members whoseinferred_canonical_carddiffers. 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
docker compose run --rmcontainer (live serving containers never touched):resolved_cards_considered=3 clusters_checked=0 divergent=0— cross-checked directly against the live DB viamanage.py shell, confirming the low count is real (only 3 cards currently carryRESOLVEDstatus — 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