Skip to content

feat: add query-events ability as single event query primitive#156

Merged
chubes4 merged 2 commits intomainfrom
feature/query-events-ability
Mar 23, 2026
Merged

feat: add query-events ability as single event query primitive#156
chubes4 merged 2 commits intomainfrom
feature/query-events-ability

Conversation

@chubes4
Copy link
Member

@chubes4 chubes4 commented Mar 23, 2026

Summary

New ability data-machine-events/query-events — the single primitive for all event date queries. Every consumer that previously built its own WP_Query + posts_clauses filters now calls this ability.

Architecture

                    ┌───────────────────────────┐
                    │  query-events ability      │
                    │  (single primitive)        │
                    └─────────┬─────────────────┘
        ┌─────────────────────┼──────────────────────┐
        │         │           │          │           │
   Calendar   Health     Timezone   Encoding    EventUpsert
   Ability    Ability    Ability    Ability     (5 dedup)
              QualityAudit  TicketUrlResync  CLI Trait
              DuplicateDetection

Input Schema

scope, date_start, date_end, date_match, days_ahead,
time_start, time_end, tax_filters, search, geo,
exclude, per_page, fields (all|ids|count), order, status, meta_query

Files Changed (13)

File Change
EventDateQueryAbilities.php NEW — the ability class
CalendarAbilities.php Uses ability instead of EventQueryBuilder
EventHealthAbilities.php Inline posts_clauses → ability
TimezoneAbilities.php Inline posts_clauses → ability
EncodingFixAbilities.php Inline posts_clauses → ability
EventQualityAuditAbilities.php Inline posts_clauses → ability
TicketUrlResyncAbilities.php Inline posts_clauses → ability
DuplicateDetectionAbilities.php Inline posts_clauses → ability (date_match)
EventQueryTrait.php CLI inline posts_clauses → ability
EventUpsert.php 5 dedup methods: inline posts_clauses → date_match
EventQueryBuilder.php Deprecated (kept for external compat)
EventQueryAbilities.php TODO comment (needs date_query support)
data-machine-events.php Wire EventDateQueryAbilities instantiation

Net: -109 lines — removes more code than it adds.

Verification

  • Calendar: 30,404 upcoming events, page 1/113 ✅
  • Counts: 30,407 future / 6,351 past ✅
  • Health check: 23,243 events scanned ✅
  • Date match: 290 events on 2026-04-15 ✅
  • Austin (term 1628): 1,422 upcoming ✅

Cross-repo PR

  • Extra-Chill/extrachill-events — 7 files refactored to use ability

New ability `data-machine-events/query-events` centralizes all event
date queries behind one primitive. Every consumer that previously built
its own WP_Query + posts_clauses filters now calls this ability.

- New EventDateQueryAbilities class with scope/date/tax/geo/search params
- CalendarAbilities refactored: uses ability instead of EventQueryBuilder
- 6 abilities refactored: Health, Timezone, Encoding, QualityAudit,
  TicketUrlResync, DuplicateDetection — all inline posts_clauses removed
- CLI EventQueryTrait: inline filters replaced with ability call
- EventUpsert: 5 dedup methods switched from inline filters to date_match
- EventQueryBuilder deprecated (kept for external compatibility)
- Net -109 lines: simpler code, consistent behavior across all consumers
@homeboy-ci
Copy link
Contributor

homeboy-ci bot commented Mar 23, 2026

Homeboy Results — data-machine-events

Homeboy

Failure Digest

Lint Failure Digest

Test Failure Digest

Audit Failure Digest

Autofixability classification

  • Overall: auto_fixable
  • Autofix enabled: yes
  • Autofix attempted this run: no
  • Auto-fixable failed commands:
    • lint
    • test
  • Failed commands with available automated fixes:
    • lint
    • test

Machine-readable artifacts

  • homeboy-lint-summary.json
  • homeboy-test-failures.json
  • homeboy-audit-summary.json
  • homeboy-autofixability.json

⚡ Scope: changed files only

audit (changed files only)

  • Drift increased: no

lint (changed files only)

test (changed files only)

Tooling versions
  • Homeboy CLI: homeboy 0.85.3+a74a3c7
  • Extension: wordpress from https://github.com/Extra-Chill/homeboy-extensions
  • Extension revision: unknown
  • Action: Extra-Chill/homeboy-action@v2

Homeboy Action v1

…ilities

PageBoundary SQL logic now lives in CalendarAbilities (its only caller).
Taxonomy_Helper SQL logic now lives in FilterAbilities (its only caller).
Both utility classes deprecated with pointers to the abilities.

This eliminates raw SQL that bypassed the abilities layer. The principle:
business logic lives in the ability, utility classes don't write SQL.

- CalendarAbilities: absorbs compute_unique_event_dates() + cache
- FilterAbilities: absorbs get_batch_term_counts(), hierarchy building
- FilterAbilities::flatten_hierarchy() stays public (render.php uses it)
- render.php: imports FilterAbilities instead of Taxonomy_Helper
- DateFilter dependency removed from Taxonomy_Helper's SQL
@chubes4 chubes4 merged commit 90fa951 into main Mar 23, 2026
1 check failed
@chubes4 chubes4 deleted the feature/query-events-ability branch March 23, 2026 19:30
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