Skip to content

feat: add universal handler dry-run command (wp datamachine test)#937

Merged
chubes4 merged 1 commit intomainfrom
feature/test-handler-command
Mar 22, 2026
Merged

feat: add universal handler dry-run command (wp datamachine test)#937
chubes4 merged 1 commit intomainfrom
feature/test-handler-command

Conversation

@chubes4
Copy link
Member

@chubes4 chubes4 commented Mar 22, 2026

Summary

Adds wp datamachine test <handler> — a universal dry-run command for any fetch handler. Resolves #936.

  • TestHandlerAbility (inc/Abilities/Handler/TestHandlerAbility.php) — the ability that resolves handler by slug, applies config defaults, calls get_fetch_data('direct', ...), and returns packet summaries
  • TestCommand (inc/Cli/Commands/TestCommand.php) — the CLI surface with --list, --describe, --config, --flow, --limit, and --format flags
  • Wired up in data-machine.php (require + instantiation) and Bootstrap.php (CLI registration)

CLI Interface

# List available fetch handlers
wp datamachine test --list

# Show config schema for a handler
wp datamachine test ticketmaster --describe

# Test a handler with config
wp datamachine test ticketmaster --config='{"location":"32.7,-79.9","radius":"50"}'

# Test using an existing flow's config
wp datamachine test --flow=42

# Limit + JSON output
wp datamachine test rss --config='{"feed_url":"..."}' --limit=3 --format=json

Testing Done

Tested live on events.extrachill.com:

  • --list → 13 fetch handlers listed ✅
  • --describe ticketmaster → config fields table ✅
  • --flow=3 (Royal American web scraper) → 26 events found ✅
  • ticketmaster --config='{"location":"32.7,-79.9","radius":"50"}' → 151 events ✅
  • rss --config='{"feed_url":"https://pitchfork.com/feed/feed-news/rss"}' → RSS items ✅
  • Invalid handler → clean error message ✅
  • JSON format → full packet data ✅

New primitive for testing any fetch handler without running a full pipeline.
Resolves handler by slug, applies config defaults, calls get_fetch_data(),
and returns packet summaries.

Supports --list, --describe, --config, --flow, --limit, and --format.

Closes #936
@chubes4 chubes4 merged commit 2acdd0f into main Mar 22, 2026
1 check failed
@chubes4 chubes4 deleted the feature/test-handler-command branch March 22, 2026 21:58
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.

Add wp datamachine test <handler> — universal handler dry-run

1 participant