Skip to content

refactor(EventUpsert): delegate to DM core upsert-post ability#209

Merged
chubes4 merged 1 commit into
mainfrom
refactor-event-upsert-to-core
Apr 23, 2026
Merged

refactor(EventUpsert): delegate to DM core upsert-post ability#209
chubes4 merged 1 commit into
mainfrom
refactor-event-upsert-to-core

Conversation

@chubes4
Copy link
Copy Markdown
Member

@chubes4 chubes4 commented Apr 23, 2026

Summary

Refactors EventUpsert to delegate the create/update/no_change decision to DM core's datamachine/upsert-post ability (shipped in data-machine#1167 / v0.77.0).

What changed

  • Removed: createEventPost(), updateEventPost(), hasDataChanged() — replaced by single call to datamachine/upsert-post
  • Added: buildEventMetaInput() — extracts submission metadata for core upsert
  • Modified: buildEventData() — accepts optional $existing_post_id for datetime hydration on update path
  • Modified: executeUpsertWithinLock() — domain-specific identity resolution → core upsert → post-upsert event processing

What stayed (domain-specific)

  • Fuzzy identity resolution (findExistingEventViaAbility, findExistingEvent, all find* helpers)
  • Advisory locks by (date, normalized_title)
  • Venue/promoter taxonomy assignment with smart merging
  • Featured image processing
  • Block content generation (generate_event_block_content)
  • Submission metadata handling

Size

EventUpsert.php: 1,701 → 1,579 lines (-122)

Depends on

Closes

…sert-post ability

Replaces inline createEventPost/updateEventPost/hasDataChanged with a single
call to datamachine/upsert-post, which handles content-hash idempotency and
provenance stamping.

Domain-specific logic kept in the extension:
- Fuzzy identity resolution (findExistingEventViaAbility + findExistingEvent)
- Advisory locks by (date, normalized_title)
- Venue/promoter taxonomy assignment with smart merging
- Featured image processing
- Submission metadata
- Block content generation

Net: -122 lines, simpler create/update branching, leverages core primitives.

Refs Extra-Chill/data-machine#1167
Closes #208
@homeboy-ci
Copy link
Copy Markdown
Contributor

homeboy-ci Bot commented Apr 23, 2026

Homeboy Results — data-machine-events

Audit

⚡ Scope: changed files only

audit (changed files only)

  • Alignment score: 0.877
  • Outliers in current run: 13
  • Drift increased: no
  • Severity counts: info: 2, unknown: 13, warning: 7
  • Top actionable findings:
    1. inc/Steps/Upsert/Events/EventUpsert.php — god_file — File has 1579 lines (threshold: 1000)
    2. inc/Steps/Upsert/Events/EventUpsert.php — intra_method_duplicate — Duplicated block in findEventByExactTitle — 5 identical lines at line 722 and line 732
    3. inc/Steps/Upsert/Events/EventUpsert.php — intra_method_duplicate — Duplicated block in findEventByTicketUrl — 5 identical lines at line 790 and line 829
    4. inc/Steps/Upsert/Events/EventUpsert.php — intra_method_duplicate — Duplicated block in findEventByVenueDateAndFuzzyTitle — 5 identical lines at line 507 and line 530
    5. inc/Steps/Upsert/Events/EventUpsert.php — parallel_implementation — Parallel implementation: generate_description_blocks has similar call pattern to generateDescriptionInnerBlocks in inc/Abilities/EventUpdateAbilities.php — shared calls: array, empty, preg_replace, preg_split
    6. inc/Steps/Upsert/Events/EventUpsert.php — unused_parameter — Unused parameter 'event_data' in function 'buildEventMetaInput' (no callers found)
    7. inc/Steps/Upsert/Events/EventUpsert.php — unused_parameter — Unused parameter 'handler_config' in function 'assignVenueTaxonomy' (no callers found)
    8. inc/Steps/Upsert/Events/EventUpsert.php — unused_parameter — Unused parameter 'parameters' in function 'buildEventMetaInput' (no callers found)
    9. inc/Steps/Upsert/Events/EventUpsert.php — missing_test_file — No test file found (expected 'tests/Unit/Steps/Upsert/Events/EventUpsertTest.php')
    10. inc/Abilities/AbilityCategories.php — outlier — (outlier)
Audit findings (10 shown)
1. **inc/Steps/Upsert/Events/EventUpsert.php** — god_file — File has 1579 lines (threshold: 1000)
2. **inc/Steps/Upsert/Events/EventUpsert.php** — intra_method_duplicate — Duplicated block in `findEventByExactTitle` — 5 identical lines at line 722 and line 732
3. **inc/Steps/Upsert/Events/EventUpsert.php** — intra_method_duplicate — Duplicated block in `findEventByTicketUrl` — 5 identical lines at line 790 and line 829
4. **inc/Steps/Upsert/Events/EventUpsert.php** — intra_method_duplicate — Duplicated block in `findEventByVenueDateAndFuzzyTitle` — 5 identical lines at line 507 and line 530
5. **inc/Steps/Upsert/Events/EventUpsert.php** — parallel_implementation — Parallel implementation: `generate_description_blocks` has similar call pattern to `generateDescriptionInnerBlocks` in inc/Abilities/EventUpdateAbilities.php — shared calls: `array`, `empty`, `preg_replace`, `preg_split`
6. **inc/Steps/Upsert/Events/EventUpsert.php** — unused_parameter — Unused parameter 'event_data' in function 'buildEventMetaInput' (no callers found)
7. **inc/Steps/Upsert/Events/EventUpsert.php** — unused_parameter — Unused parameter 'handler_config' in function 'assignVenueTaxonomy' (no callers found)
8. **inc/Steps/Upsert/Events/EventUpsert.php** — unused_parameter — Unused parameter 'parameters' in function 'buildEventMetaInput' (no callers found)
9. **inc/Steps/Upsert/Events/EventUpsert.php** — missing_test_file — No test file found (expected 'tests/Unit/Steps/Upsert/Events/EventUpsertTest.php')
10. **inc/Abilities/AbilityCategories.php** — outlier — (outlier)
Tooling versions
  • Homeboy CLI: homeboy 0.89.1+2b0fc5f
  • Extension: wordpress from https://github.com/Extra-Chill/homeboy-extensions
  • Extension revision: unknown
  • Action: Extra-Chill/homeboy-action@v2

Homeboy Action v1

@chubes4 chubes4 merged commit d09d1ec into main Apr 23, 2026
1 check passed
@chubes4 chubes4 deleted the refactor-event-upsert-to-core branch April 23, 2026 04:46
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