Skip to content

refactor: remove ability manifest and obsolete class includes #3393

Description

@chubes4

Parent: #3113

Goal

Remove bootstrap ceremony that duplicates a private fixed declaration list and Composer PSR-4 autoloading, while preserving Data Machine's lightweight/full-runtime boundary, ability lifecycle, declaration order, and file-level side effects.

Scope

Delete AbilityManifest

AbilityManifest has one caller and consumes one private fixed list of four known classes. It has no filter, provider registry, alternate producer, persisted state, or public transport contract.

Replace the manifest call with direct registration/construction for:

  • AgentAbilities
  • ImageTemplateAbilities
  • SendEmailAbility
  • SendEmailQueuedAbility

Delete:

  • inc/Abilities/AbilityManifest.php
  • the private manifest builder in AbilityServiceProvider
  • dead imports and manifest-loading code

Remove Composer-obsolete class includes

vendor/autoload.php loads before Data Machine bootstrap and PSR-4 owns Data Machine class namespaces. Remove manual require_once statements that only load class/trait/interface definitions before direct construction.

Retain every procedural or side-effect include, especially:

  • ContentActionHandlers.php
  • WordPress admin function includes
  • procedural setup/bootstrap files
  • directive/filter files with file-level registration
  • queue tuning and other hook-installing files

Also remove class-only eager includes from inc/bootstrap.php only where route/service registration is already explicitly owned and no file-level side effect exists.

Contract preservation

  • lightweight abilities remain available before full runtime
  • full runtime remains lazy and idempotent
  • abilities register exactly once before, during, and after wp_abilities_api_init
  • direct REST, CLI, chat, frontend, background, single-site, and multisite boot paths remain unchanged
  • route inventory and registration order remain unchanged
  • standalone tests use Composer and faithful WordPress stubs rather than incidental production includes

Tests

Cover lightweight ability registration timing, full-runtime activation, provider composition, route inventory, load order, duplicate registration, Composer optimized autoload, package activation, and all existing ability/REST smokes.

Constraints

  • No generic replacement manifest.
  • No registration framework change.
  • No behavior moved into adapters.
  • No changelog or version edit.
  • Net-negative production PHP LOC.
  • Avoid every file touched by open PR fix: prepare WordPress.org release package #3361.
  • Conventional refactor: commit.
  • PR only; no release or deployment.

Expected production reduction: approximately 130–145 PHP lines.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions