Skip to content
This repository was archived by the owner on Oct 28, 2026. It is now read-only.

Install extension/skin composer dependencies from core root - #28

Merged
Zippybonzo merged 1 commit into
mainfrom
claude/deployment-composer-merge-plugins-1hk6gi
Aug 24, 2026
Merged

Zippybonzo merged 1 commit into
mainfrom
claude/deployment-composer-merge-plugins-1hk6gi

Conversation

@Zippybonzo

@Zippybonzo Zippybonzo commented Aug 24, 2026 •

Copy link
Copy Markdown
Member

Summary

This change implements proper Composer dependency management for MediaWiki extensions and skins by installing them from the core root rather than in place. This ensures all dependencies resolve together into a single vendor/ directory that MediaWiki actually autoloads.

Key Changes

  • New composer_merge_root() function: Determines if a checkout is an extension or skin by finding the nearest ancestor with a composer.json that contains the path under extensions/ or skins/. Returns None for standalone checkouts (core itself, tools, etc.) that install in place.

  • New ensure_composer_merge_plugin() function: Manages composer.local.json in the core root, declaring extension and skin manifest globs (extensions/*/composer.json, skins/*/composer.json) via Composer's merge plugin. Preserves existing content and only writes when necessary.

  • Updated install_dependencies() function: Now detects when a checkout is an extension/skin and installs from the core root instead. Accepts optional composer_roots set to track already-installed roots and avoid redundant installs when multiple extensions share one core.

  • Updated install_dependencies_for_sync() function: Tracks composer roots across a batch of synced paths so path-restricted rsyncs of multiple extensions under one core install that root only once.

  • Documentation updates: Added "Composer and the merge plugin" section to OPERATIONS.md explaining the behavior, and updated SALT-INTEGRATION.md to note that the web user needs write access to the core root's composer.local.json and vendor/.

  • Version bump: Updated from 2.1.0 to 2.2.0.

Implementation Details

  • Uses wikimedia/composer-merge-plugin (a core dependency) to merge extension/skin manifests into core's composer.json at install time
  • Composer install timeout increased to 1800s for root installs (vs 900s for in-place installs) due to resolving more dependencies
  • Globs rather than per-extension entries mean new extensions are picked up automatically without code changes
  • Comprehensive test suite added covering merge root detection, composer.local.json management, and multi-extension sync scenarios

https://claude.ai/code/session_01QKzD8eUV1sT45NMNnjKSAg

Summary by CodeRabbit

  • New Features

    • Composer dependencies for extensions and skins are now merged and installed from the shared MediaWiki core checkout.
    • Dependency installation runs once per core checkout, using optimized production settings.
    • Existing Composer configuration is preserved and updated safely.
  • Documentation

    • Added operational guidance for merged Composer dependencies, lock files, permissions, and production updates.
    • Updated Salt integration instructions and verification requirements for version 2.2.0.

MediaWiki loads exactly one Composer autoloader — the core checkout's
vendor/ — so running `composer install` inside extensions/Foo produced a
vendor/ nothing ever autoloads, and resolved that extension's constraints
in isolation from core's.

git-checkout, git-pull, repo-register and both rsync verbs now detect when
the checkout they just updated is an extension or skin of a core tree
(the nearest ancestor with a composer.json holding it under extensions/ or
skins/, so versions/<ver> wins over the deploy root above it), declare the
manifest globs in that root's composer.local.json for
wikimedia/composer-merge-plugin, and run composer install from the root.
A checkout that is nobody's extension still installs in place.

composer.local.json is written non-destructively: existing content and any
other merge-plugin settings are kept, globs are only appended, and a
second run is a no-op. Several extensions synced under one root install
that root once rather than once per checkout.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01QKzD8eUV1sT45NMNnjKSAg
@coderabbitai

coderabbitai Bot commented Aug 24, 2026 •

Copy link
Copy Markdown

Review Change Stack

Caution

Review failed

The pull request is closed.

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: ASSERTIVE

Plan: Pro Plus

Run ID: e0a7c116-402d-43c6-95fb-185e92d3d380

📥 Commits

Reviewing files that changed from the base of the PR and between 11b7deb and e223afa.

📒 Files selected for processing (4)
  • docs/OPERATIONS.md
  • docs/SALT-INTEGRATION.md
  • shim/mwdeploy_shim.py
  • shim/tests/test_mwdeploy_shim.py

📝 Walkthrough

Walkthrough

The shim is updated to version 2.2.0. Nested extension and skin checkouts now merge Composer manifests into the nearest MediaWiki core and install dependencies from the core root. Synchronization avoids repeated installs. Documentation and tests cover the new behavior.

Changes

Core-root Composer installation

Layer / File(s) Summary
Composer root discovery and merge configuration
shim/mwdeploy_shim.py, shim/tests/test_mwdeploy_shim.py
The shim discovers enclosing core roots, validates and updates composer.local.json, preserves existing settings, and handles invalid JSON. Tests cover root selection and configuration updates.
Shared dependency installation
shim/mwdeploy_shim.py, shim/tests/test_mwdeploy_shim.py
Nested extensions and skins install through the shared core root. Synchronization skips repeated installs for the same root. Integration tests cover checkout, pull, registration, and multi-extension synchronization.
Operational and Salt integration documentation
docs/OPERATIONS.md, docs/SALT-INTEGRATION.md
The documentation describes core-root installation, required write access, lock-file handling, and the 2.2.0 requirement.

Estimated code review effort: 4 (Complex) | ~45 minutes

Sequence Diagram(s)

sequenceDiagram
  participant Sync
  participant install_dependencies
  participant CoreRoot
  participant Composer
  Sync->>install_dependencies: process extension or skin path
  install_dependencies->>CoreRoot: resolve and prepare composer.local.json
  install_dependencies->>Composer: run one root-level install
  Composer-->>CoreRoot: update shared vendor tree
  Sync->>install_dependencies: process next checkout
  install_dependencies-->>Sync: skip already-installed Composer root
Loading

Suggested reviewers: claude

✨ 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 claude/deployment-composer-merge-plugins-1hk6gi

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

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

@Zippybonzo
Zippybonzo merged commit 14d812f into main Aug 24, 2026
3 of 4 checks passed
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants