Skip to content

one_d4: derive checkmate/discovered_check/double_check from ATTACK rows#1087

Merged
aaylward merged 1 commit intomainfrom
fix/issue-1083-attack-single-source-of-truth
Mar 1, 2026
Merged

one_d4: derive checkmate/discovered_check/double_check from ATTACK rows#1087
aaylward merged 1 commit intomainfrom
fix/issue-1083-attack-single-source-of-truth

Conversation

@aaylward
Copy link
Copy Markdown
Collaborator

@aaylward aaylward commented Mar 1, 2026

Summary

  • Removes CheckmateDetector, DiscoveredCheckDetector, and DoubleCheckDetector from the indexer pipeline (Option B from chore(one_d4): resolve dual-detection inconsistency for DISCOVERED_ATTACK, CHECKMATE, and DOUBLE_CHECK motifs #1083)
  • CHECKMATE, DISCOVERED_CHECK, and DOUBLE_CHECK are now derived at query/response time from stored ATTACK rows, consistent with FORK and DISCOVERED_ATTACK
  • GameFeatureDao.queryOccurrences() SQL now excludes all five derived-motif types from direct storage lookup; post-processing derives all five from ATTACK rows
  • All 106 tests pass; new DAO tests document each derivation contract

Details

  • Deleted: CheckmateDetector, DiscoveredCheckDetector, DoubleCheckDetector + their test files
  • Extended SQL filter: motif NOT IN ('FORK', 'CHECKMATE', 'DISCOVERED_CHECK', 'DOUBLE_CHECK', 'DISCOVERED_ATTACK') to exclude both new and stale stored rows
  • Added derivation helpers: deriveDiscoveredAttackOccurrences, deriveCheckmateOccurrences, deriveDiscoveredCheckOccurrences, deriveDoubleCheckOccurrences
  • Updated FullMotifDetectorTest, MotifE2ETest, IndexE2ETest, ReanalysisE2ETest to reflect new architecture

Test plan

  • All 106 existing tests pass
  • New GameFeatureDaoTest cases cover each derivation path and stale-row filtering
  • MotifE2ETest.checkmate_motifDetectedWithIsMateTrue continues to pass (derived from ATTACK rows)
  • FullMotifDetectorTest updated to reflect CHECKMATE no longer indexed at extract time

Closes #1083

@aaylward aaylward enabled auto-merge (squash) March 1, 2026 04:32
@cloudflare-workers-and-pages
Copy link
Copy Markdown

cloudflare-workers-and-pages bot commented Mar 1, 2026

Deploying with  Cloudflare Workers  Cloudflare Workers

The latest updates on your project. Learn more about integrating Git with Workers.

Status Name Latest Commit Preview URL Updated (UTC)
✅ Deployment successful!
View logs
1d4-web 33a3669 Commit Preview URL

Branch Preview URL
Mar 01 2026, 04:36 AM

…m ATTACK rows (#1083)

Remove CheckmateDetector, DiscoveredCheckDetector, and DoubleCheckDetector from the
indexer. CHECKMATE, DISCOVERED_CHECK, and DOUBLE_CHECK are now derived at query/response
time from stored ATTACK rows, just like FORK and DISCOVERED_ATTACK.

- Delete the three detector classes and their unit tests
- Remove from IndexerModule.motifDetectors() and BUILD.bazel
- GameFeatureDao.queryOccurrences(): extend SQL filter to exclude stale stored rows
  ('FORK', 'CHECKMATE', 'DISCOVERED_CHECK', 'DOUBLE_CHECK', 'DISCOVERED_ATTACK');
  add five derivation helpers that derive all ATTACK-based motifs in post-processing
- Add GameFeatureDaoTest cases for each new derivation and for stale-row filtering
- Update FullMotifDetectorTest: remove 3 detectors from setUp(), remove CHECKMATE from
  expected motif set, add CHECKMATE to absent set, delete extractFeatures_checkmate_Ra5()
- Update MotifE2ETest, IndexE2ETest, ReanalysisE2ETest: remove deleted detector imports

Closes #1083
@aaylward aaylward force-pushed the fix/issue-1083-attack-single-source-of-truth branch from 426814d to 33a3669 Compare March 1, 2026 04:35
@aaylward aaylward merged commit 71a9220 into main Mar 1, 2026
12 checks passed
@aaylward aaylward deleted the fix/issue-1083-attack-single-source-of-truth branch March 1, 2026 04:42
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.

chore(one_d4): resolve dual-detection inconsistency for DISCOVERED_ATTACK, CHECKMATE, and DOUBLE_CHECK motifs

1 participant