Skip to content

Add synchronous job drain ability#1805

Merged
chubes4 merged 1 commit intomainfrom
feat/sync-flow-drain-ability
May 6, 2026
Merged

Add synchronous job drain ability#1805
chubes4 merged 1 commit intomainfrom
feat/sync-flow-drain-ability

Conversation

@chubes4
Copy link
Copy Markdown
Member

@chubes4 chubes4 commented May 6, 2026

Summary

  • Adds datamachine/drain-job, a synchronous Abilities API primitive for draining due Action Scheduler step work scoped to one job_id.
  • Enforces both step and wall-clock budgets with defaults, reports terminal state/drain stats, and returns a typed error when the Action Scheduler runner is unavailable.
  • Adds Playground/WP unit coverage for running a scheduled test flow to completed_no_items plus a pure-PHP smoke test for the ability contract.

Fixes #1803.

Approach

I chose option C from the issue because a separate datamachine/drain-job ability is the clean reusable primitive. Callers can compose datamachine/run-flow with datamachine/drain-job without adding caller-mode flags to the existing async flow execution path.

Testing

  • php -l inc/Abilities/Engine/DrainJobAbility.php && php -l inc/Abilities/EngineAbilities.php && php -l tests/drain-job-ability-smoke.php && php -l tests/Unit/Abilities/Engine/DrainJobAbilityTest.php
  • php tests/drain-job-ability-smoke.php
  • vendor/bin/phpcs inc/Abilities/Engine/DrainJobAbility.php inc/Abilities/EngineAbilities.php tests/drain-job-ability-smoke.php tests/Unit/Abilities/Engine/DrainJobAbilityTest.php
  • homeboy test data-machine -- --filter DrainJobAbilityTest still ran the full Playground PHPUnit suite instead of filtering.
  • homeboy test data-machine -- tests/Unit/Abilities/Engine/DrainJobAbilityTest.php also ran the full Playground PHPUnit suite instead of selecting the file.

Full-suite result from those Homeboy runs: the new drain-job test passed, but the suite still has one unrelated failure: DataMachine\Tests\Unit\Abilities\ImageGenerationPromptRefinementTest::test_refine_prompt_includes_post_context_when_provided failing because the refined prompt is empty and does not contain Article context:.

AI assistance

  • AI assistance: Yes
  • Tool(s): OpenCode (gpt-5.5)
  • Used for: Drafted the synchronous drain ability, registration wiring, and tests. Chris reviews, validates, and owns the final change.

@homeboy-ci
Copy link
Copy Markdown
Contributor

homeboy-ci Bot commented May 6, 2026

Homeboy Results — data-machine

Lint

lint — passed

ℹ️ Full options: homeboy docs commands/lint
Deep dive: homeboy lint data-machine --changed-since c0ef3b5

Test

test — passed

  • 1 passed

ℹ️ Auto-fix lint issues: homeboy refactor data-machine --from lint --write
ℹ️ Collect coverage: homeboy test data-machine --coverage
ℹ️ Save test baseline: homeboy test data-machine --baseline
ℹ️ Pass args to test runner: homeboy test -- [args]
ℹ️ Full options: homeboy docs commands/test
Deep dive: homeboy test data-machine --changed-since c0ef3b5

Audit

audit — passed

  • test_coverage — 2 finding(s)
  • Abilities — 1 finding(s)
  • Total: 3 finding(s)

Deep dive: homeboy audit data-machine --changed-since c0ef3b5

Tooling versions
  • Homeboy CLI: homeboy 0.157.1+66bb6ecf
  • Extension: wordpress from https://github.com/Extra-Chill/homeboy-extensions
  • Extension revision: 221b9c8
  • Action: Extra-Chill/homeboy-action@v2

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.

Synchronous flow drain ability for one-shot CI execution

1 participant