Skip to content

[#2719] Added a platform-agnostic 'task' runner for hosting operations.#2721

Merged
AlexSkrypnyk merged 6 commits into
mainfrom
feature/2719-task-router
Jun 25, 2026
Merged

[#2719] Added a platform-agnostic 'task' runner for hosting operations.#2721
AlexSkrypnyk merged 6 commits into
mainfrom
feature/2719-task-router

Conversation

@AlexSkrypnyk

@AlexSkrypnyk AlexSkrypnyk commented Jun 25, 2026

Copy link
Copy Markdown
Member

Closes #2719

Summary

Introduces a single, platform-agnostic task runner at vendor/drevops/vortex-tooling/src/task so the Acquia Cloud hooks dispatch operations through one entrypoint - task <operation> - instead of calling the individual task-*-acquia scripts directly. This unblocks #2715 (exposing the tooling scripts as vendor/bin/ binaries), where task becomes the public entrypoint and the platform-specific task-*-acquia scripts stay internal.

The runner resolves a platform-agnostic operation to the implementation for the configured hosting platform - task-<operation>-<platform> - reusing the existing notify router pattern. The platform is read from VORTEX_TASK_PLATFORM, falling back to VORTEX_PLATFORM; the Acquia hooks export VORTEX_PLATFORM=acquia. Both the operation and the platform are validated against whitelists before the sibling path is built, and the sibling is required to be executable, so only approved scripts can run.

Changes

Task runner

  • New .vortex/tooling/src/task dispatches task <operation> [args...] to task-<operation>-<platform>. It validates the operation (copy-db, copy-files, purge-cache) and the platform (acquia, lagoon) against whitelists, requires the resolved sibling script to be executable, and forwards trailing arguments. It fails with a clear message on a missing or unknown operation, a missing or unsupported platform, or an operation that the platform does not implement.
  • The three task-*-acquia scripts are unchanged - they become internal platform implementations reached only through the router, so behaviour (environment variables, output, exit codes) is identical.

Acquia hooks

  • hooks/library/copy-db.sh, hooks/library/copy-files.sh, and hooks/library/purge-cache.sh now export VORTEX_PLATFORM=acquia and call task <operation> instead of task-<operation>-acquia. A duplicate #!/usr/bin/env bash shebang was removed from purge-cache.sh.

Tests

  • New .vortex/tooling/tests/unit/task.bats with 9 cases covering operation validation, platform resolution (VORTEX_PLATFORM, the VORTEX_TASK_PLATFORM override and its precedence), the missing-platform, unsupported-platform and unsupported-operation-on-platform errors, and dispatch of each operation.

Documentation

  • .vortex/docs/content/hosting/acquia.mdx gains a "Run a hosting task" section documenting the task <operation> DX, the operation table, and platform selection via VORTEX_PLATFORM / VORTEX_TASK_PLATFORM.

Fixtures

  • Regenerated the mirrored Acquia hook snapshot fixtures under .vortex/installer/tests/Fixtures/handler_process/.

Before / After

BEFORE                                AFTER

Acquia hook                           Acquia hook
  │                                     │ export VORTEX_PLATFORM=acquia
  ▼                                     ▼
task-copy-db-acquia   (direct)        task copy-db            (agnostic)
task-copy-files-acquia (direct)         │
task-purge-cache-acquia (direct)        ▼
                                      task  (validate operation + platform)
each script is its own entrypoint       │
                                        ▼
                                      task-copy-db-acquia     (internal impl)

@coderabbitai

coderabbitai Bot commented Jun 25, 2026

Copy link
Copy Markdown

Review Change Stack

Walkthrough

A central task router now dispatches Acquia subcommands to sibling executables, and the Acquia hook scripts call the router instead of dedicated task-* entrypoints. Unit tests cover missing, unsupported, non-executable, and supported dispatch cases.

Changes

Acquia task router

Layer / File(s) Summary
Router dispatch
.vortex/tooling/src/task
task reads the first CLI argument, sets strict and optional debug shell behavior, routes the three supported Acquia commands to sibling task-${command} executables, and fails for missing, unsupported, or non-executable targets.
Hook entrypoints
hooks/library/copy-db.sh, hooks/library/copy-files.sh, hooks/library/purge-cache.sh
The Acquia hook scripts call .vortex/tooling/src/task with subcommand arguments, and purge-cache.sh also normalizes its header area.
Router unit coverage
.vortex/tooling/tests/unit/task.bats
The Bats suite checks missing, unsupported, and non-executable failures plus dispatch for copy-db-acquia, copy-files-acquia, and purge-cache-acquia.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Poem

Hop-hop, I nudged the task trail bright,
One router path for every Acquia light.
Copy, purge, and files all found their door,
With bunny tests pattering on the floor. 🐰

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Linked Issues check ✅ Passed The router, hook updates, and tests match the linked issue requirements and preserve the Acquia command flow.
Out of Scope Changes check ✅ Passed No unrelated code changes are evident beyond the router, hook updates, and supporting tests/snapshots.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately summarizes the central change: adding a platform-agnostic task router for hosting operations.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch feature/2719-task-router

Comment @coderabbitai help to get the list of available commands.

@AlexSkrypnyk AlexSkrypnyk added this to the 1.40.0 milestone Jun 25, 2026
@AlexSkrypnyk AlexSkrypnyk added the A3 Board worker 3 label Jun 25, 2026

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 2

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In @.vortex/tooling/tests/unit/task.bats:
- Line 33: Rename the existing task test to match what it actually covers: the
scenario in task.bats removes the execute bit and validates a non-executable
sibling script, not a missing script. Update the test name around the `@test`
block for the Task sibling-script case so it reflects the non-executable sibling
behavior, and keep the test body unchanged.
- Around line 33-42: Rename the test case in task.bats so its name reflects the
actual scenario being exercised, since it disables execute permissions on
task-copy-db-acquia rather than testing a missing script. Update the `@test`
description in the Task: missing sibling script block to match the
permission/non-executable case, keeping the test body and assertions as-is.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: ASSERTIVE

Plan: Pro Plus

Run ID: 774c0bf9-42f6-4b4b-abbb-651c8d816fca

📥 Commits

Reviewing files that changed from the base of the PR and between d01b90c and 0b50362.

⛔ Files ignored due to path filters (6)
  • .vortex/installer/tests/Fixtures/handler_process/hosting_acquia/hooks/library/copy-db.sh is excluded by !.vortex/installer/tests/Fixtures/**
  • .vortex/installer/tests/Fixtures/handler_process/hosting_acquia/hooks/library/copy-files.sh is excluded by !.vortex/installer/tests/Fixtures/**
  • .vortex/installer/tests/Fixtures/handler_process/hosting_acquia/hooks/library/purge-cache.sh is excluded by !.vortex/installer/tests/Fixtures/**
  • .vortex/installer/tests/Fixtures/handler_process/hosting_project_name___acquia/hooks/library/copy-db.sh is excluded by !.vortex/installer/tests/Fixtures/**
  • .vortex/installer/tests/Fixtures/handler_process/hosting_project_name___acquia/hooks/library/copy-files.sh is excluded by !.vortex/installer/tests/Fixtures/**
  • .vortex/installer/tests/Fixtures/handler_process/hosting_project_name___acquia/hooks/library/purge-cache.sh is excluded by !.vortex/installer/tests/Fixtures/**
📒 Files selected for processing (5)
  • .vortex/tooling/src/task
  • .vortex/tooling/tests/unit/task.bats
  • hooks/library/copy-db.sh
  • hooks/library/copy-files.sh
  • hooks/library/purge-cache.sh

Comment thread .vortex/tooling/tests/unit/task.bats Outdated
Comment thread .vortex/tooling/tests/unit/task.bats Outdated
@github-actions

This comment has been minimized.

@AlexSkrypnyk

This comment has been minimized.

2 similar comments
@AlexSkrypnyk

This comment has been minimized.

@AlexSkrypnyk

This comment has been minimized.

@codecov

codecov Bot commented Jun 25, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 86.22%. Comparing base (d01b90c) to head (a7c25e2).

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #2721      +/-   ##
==========================================
- Coverage   86.67%   86.22%   -0.45%     
==========================================
  Files          96       89       -7     
  Lines        4719     4560     -159     
  Branches       47        3      -44     
==========================================
- Hits         4090     3932     -158     
+ Misses        629      628       -1     

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@github-actions

github-actions Bot commented Jun 25, 2026

Copy link
Copy Markdown

📖 Documentation preview for this pull request has been deployed to Netlify:

https://6a3caf0c4e402bee241deab4--vortex-docs.netlify.app

This preview is rebuilt on every commit and is not the production documentation site.

@github-actions

Copy link
Copy Markdown

Code coverage (threshold: 90%)

  Classes: 100.00% (1/1)
  Methods: 100.00% (2/2)
  Lines:   98.55% (204/207)
Per-class coverage
Drupal\ys_demo\Plugin\Block\CounterBlock
  Methods: 100.00% ( 2/ 2)   Lines: 100.00% ( 10/ 10)

@AlexSkrypnyk

This comment has been minimized.

2 similar comments
@AlexSkrypnyk

This comment has been minimized.

@AlexSkrypnyk

Copy link
Copy Markdown
Member Author

Code coverage (threshold: 90%)

  Classes: 100.00% (1/1)
  Methods: 100.00% (2/2)
  Lines:   98.55% (204/207)
Per-class coverage
Drupal\ys_demo\Plugin\Block\CounterBlock
  Methods: 100.00% ( 2/ 2)   Lines: 100.00% ( 10/ 10)

@AlexSkrypnyk AlexSkrypnyk changed the title [#2719] Added central 'task' router for Acquia hook scripts. [#2719] Added a platform-agnostic 'task' runner for hosting operations. Jun 25, 2026
@AlexSkrypnyk AlexSkrypnyk added the Needs review Pull request needs a review from assigned developers label Jun 25, 2026
@AlexSkrypnyk AlexSkrypnyk merged commit b7df86e into main Jun 25, 2026
34 checks passed
@AlexSkrypnyk AlexSkrypnyk deleted the feature/2719-task-router branch June 25, 2026 04:39
@github-project-automation github-project-automation Bot moved this from BACKLOG to Release queue in Vortex 1.x Jun 25, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

A3 Board worker 3 Needs review Pull request needs a review from assigned developers

Projects

Status: Release queue

Development

Successfully merging this pull request may close these issues.

Replace Acquia 'task-*' scripts with a central 'task' router

1 participant