Skip to content

Reorganize plugin/extension discovery; add plugin enable/disable (PWT-113, PWT-114)#76

Merged
lpeabody merged 6 commits into
0.xfrom
feature/refactor-organization
Jun 2, 2026
Merged

Reorganize plugin/extension discovery; add plugin enable/disable (PWT-113, PWT-114)#76
lpeabody merged 6 commits into
0.xfrom
feature/refactor-organization

Conversation

@lpeabody

@lpeabody lpeabody commented Jun 2, 2026

Copy link
Copy Markdown
Contributor

Summary

Reorganization of Polymer's plugin/extension discovery, plus the PWT-114 plugin enable/disable work built on top of it. Part of the PWT-113 epic.

Refs PWT-113, PWT-114. De-risks PWT-115 (see discovery fix below).

What's in here

Discovery / plugin-system reorganization (d34e271, dfb0491)

  • Extracted shared class-discovery logic into ClassDiscoveryTrait, consumed by CoreClassDiscovery, ExtensionClassDiscovery, and the new PluginClassDiscovery.
  • Tidied the plugin manager (PluginManagerBase) and template plugin manager wiring.
  • Repo-wide code-standards sweep (namespace/formatting) across src/, bin/, and composer.json.

Plugin enable/disable — PWT-114 (fb46a09)

  • New plugin:list / plugin:enable / plugin:disable commands that toggle enabled_extensions in .polymer/config.yml. The runtime gating already existed (namespaces, commands, hooks, and service providers all derive from enabled_extensions), so disabled plugins are excluded from the autoloader — this adds the missing toggle surface.
  • Hardened enabled-extension resolution: an extension enabled in config but not installed on disk is now dropped (previously left a stale array_flip integer used as a path); guarded a missing .polymer/plugins directory.
  • findExtensions() discovery fix: it previously only found plugins installed as symlinks (path repositories) — real (dist/committed) directories were silently missed. Replaced the leaf-based recursive scan with a fixed-depth glob for the .poly_info.yml marker, so symlinked and real-directory plugins are both discovered, without descending into a plugin's own vendor/ tree (which otherwise surfaced vendored copies of other plugins, e.g. polymer_drupal inside polymer_pantheon_drupal/vendor). This is what de-risks PWT-115.
  • Fixed a stale PolymerConfig namespace import that left the unit suite fully red after the reorganization.

Testing

  • PHPUnit: 14/14 (new ExtensionDiscoveryTest covers symlink + real-directory discovery and enable/disable gating; previously the suite was 0/7 due to the stale import).
  • PHPStan (level 6) and phpcs (PSR-12): clean.
  • End-to-end via the CLI: disabling a plugin removes its commands from polymer list; re-enabling restores them; discovery paths are correct for the symlinked production layout.

Notes

  • The GrumPHP pre-commit hook is currently broken in the DDEV dev environment (project-root conflict), so commits used --no-verify; the equivalent checks were run manually and pass.

🤖 Generated with Claude Code

DDEV User and others added 3 commits October 2, 2025 19:18
…ble commands

findExtensions() previously only located plugins installed as symlinks (path
repositories); real directories were silently missed. A naive recursive marker
search instead surfaced vendored copies of other plugins (e.g. polymer_drupal
inside polymer_pantheon_drupal/vendor). Replace it with a fixed-depth glob for
the .poly_info.yml marker so symlinked and real-directory plugins are both
discovered without descending into a plugin's own vendor/ tree.

Also:
- Harden enabled-extension resolution: drop entries enabled in config but not
  installed on disk, and guard against a missing .polymer/plugins directory.
- Add plugin:list / plugin:enable / plugin:disable commands to toggle
  enabled_extensions, building the AC-1 toggle on top of existing gating.
- Fix a stale PolymerConfig namespace import that left the unit suite red after
  the package reorganization.

Refs PWT-114.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>

@gemini-code-assist gemini-code-assist 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.

Code Review

This pull request restructures the Polymer framework by moving core classes into the DigitalPolygon\Polymer\Core namespace, introducing a new bootstrapping script (polymer-robo-run.php), and implementing a robust plugin/extension management system with associated CLI commands and unit tests. Feedback on these changes highlights several reliability improvements, including handling potential failures of getcwd() and file_put_contents(), removing the arbitrary 10-iteration limit on directory traversal, removing an unused import, ensuring classes exist before reflection to prevent crashes, safely stripping the .php extension during class discovery, and using array_merge instead of the + operator to combine hooks and commands safely.

Important

The consumer version of Gemini Code Assist on GitHub is being sunset. Starting June 18, 2026, new organization installations will be blocked, and all code review activity will officially cease on July 17, 2026.
For more details on the timeline and next steps, please review the Help Documentation.

Comment thread bin/polymer-robo-run.php
Comment thread bin/polymer-robo-run.php Outdated
Comment thread src/Robo/Discovery/ExtensionDiscovery.php Outdated
Comment thread src/Robo/Discovery/ExtensionDiscovery.php Outdated
Comment thread src/Robo/Discovery/ExtensionDiscovery.php
Comment thread src/Robo/Discovery/ClassDiscoveryTrait.php
Comment thread src/Robo/Polymer.php Outdated
lpeabody and others added 3 commits June 1, 2026 22:37
- ExtensionDiscovery: throw if writing enabled_extensions to config.yml fails
  (file_put_contents was unchecked, so a failed write still reported success).
- ExtensionDiscovery: skip enabled extensions whose ExtensionInfo class is
  missing via class_exists() instead of crashing with a ReflectionException.
- ExtensionDiscovery: drop an unused Drupal test-fixture import (stray IDE auto-import).
- ClassDiscoveryTrait: strip only a trailing ".php" extension instead of
  str_replace, which corrupted any path containing ".php" mid-string.
- Polymer: combine core + extension hooks/commands with array_merge() rather than
  the "+" union operator, which silently drops colliding numeric keys.
- bin/polymer-robo-run.php: guard against getcwd() returning false, and remove the
  arbitrary 10-level cap on the upward .polymer search (filesystem-root termination
  already bounds the loop).

Refs PWT-114.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Fresh builds of the web image failed at the `pip install ... git+https://gitlab.com/blacs30/mkdocs-edit-url.git` step with "module 'setuptools' has no attribute 'setup'". The DDEV Python 3.13 base image ships an empty `setuptools` namespace package with no RECORD file, so `pip install -U setuptools` fails with uninstall-no-record-file and legacy setup.py builds cannot import a usable setuptools.

Install a real setuptools + wheel into /usr/local (earlier on sys.path) with --ignore-installed before the mkdocs install so it shadows the stub. Verified with a full clean build.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Document the package for Claude Code / agents (architecture, commands, conventions) and add an Issue tracking section pointing at the PWT Jira board. CLAUDE.md is a one-line pointer to AGENTS.md.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@lpeabody
lpeabody merged commit 93d23a2 into 0.x Jun 2, 2026
6 checks passed
@lpeabody
lpeabody deleted the feature/refactor-organization branch June 2, 2026 02:48
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