feat: keep WP Codebox current via subtree-aware plugin updates#189
Merged
Conversation
WP Codebox is packaged as the packages/wordpress-plugin/ subtree of a Node monorepo, not a standalone single-repo plugin. The generic update_plugin_to_latest_tag() helper clones a whole repo into wp-content/plugins/<slug> and checks out a tag, which cannot work for a subtree-packaged plugin — so a WP Codebox install made from the packaged subtree is not a git checkout, gets skipped by the tagged-release path, and silently drifts behind upstream (observed in the field at 0.1.0 while upstream shipped 0.5.0, four minor versions of browser-probe runtime behind). Add update_wp_codebox_plugin_subtree(): resolves the latest version tag via git ls-remote (no full clone), and when the installed plugin is behind, sparse- checks-out the wordpress-plugin subtree at that tag and syncs it into wp-content/plugins/wp-codebox, preserving the artifact-install shape. It is a no-op when WP Codebox is not installed (install remains the setup interview's job), delegates to update_plugin_to_latest_tag() when the install is a real git checkout, and honors --dry-run / --skip-plugins / --no-data-machine like the existing plugin phase. Wired into the plugins phase after the Data Machine plugin update. Add tests/wp-codebox-subtree.sh (network-free, stubbed git ls-remote) covering not-installed skip, already-at-latest no-op, git-checkout delegation, dry-run reporting, and the Data-Machine-disabled skip; registered in shell.yml CI.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
upgrade.shnever updated WP Codebox, so installs silently drift behind upstream. Observed in the field: a WP Codebox install pinned at 0.1.0 while upstream had shipped 0.5.0 — four minor versions of browser-probe runtime behind, which broke the WordPress extension's PHPUnit-via-WP-Codebox test harness until the plugin was manually synced.Root cause
WP Codebox is packaged as the
packages/wordpress-plugin/subtree of a Node monorepo (Automattic/wp-codebox), not a standalone single-repo plugin. The genericupdate_plugin_to_latest_tag()helper clones a whole repo intowp-content/plugins/<slug>and checks out a tag — which cannot work for a subtree-packaged plugin (it would deposit the entire monorepo). So a WP Codebox install made from the packaged subtree is not a git checkout, the tagged-release path skips it ("…is not a git checkout — skipping tagged release update"), and it never advances.The fix
New
lib/wp-codebox.sh::update_wp_codebox_plugin_subtree(), wired into the plugins phase right after the Data Machine plugin update:git ls-remote(no full clone).packages/wordpress-pluginsubtree at that tag and syncssrc/,assets/,wp-codebox.php,README.md,package.jsonintowp-content/plugins/wp-codebox, preserving the artifact-install shape (no.gitin the plugin dir).update_plugin_to_latest_tag()when the install is a real git checkout.--dry-run,--skip-plugins, and--no-data-machinelike the existing plugin phase.Verified against the live site in dry-run:
WP Codebox already at latest tag (v0.5.0).Tests
tests/wp-codebox-subtree.sh(network-free; stubbedgit ls-remote) covers:update_plugin_to_latest_tag0.4.0 → 0.5.0, performs no writeINSTALL_DATA_MACHINE=false→ clean skipRegistered in
.github/workflows/shell.yml. All passing locally.