Skip to content

Bundle the embedded editor exclusively in release packages (ADR-0002) - #72

Merged
erseco merged 2 commits into
mainfrom
feature/bundle-only-editor
Jul 24, 2026
Merged

erseco merged 2 commits into
mainfrom
feature/bundle-only-editor

Conversation

@erseco

@erseco erseco commented Jul 24, 2026 •

Copy link
Copy Markdown
Contributor

What

The embedded editor becomes a release artifact. Every official release ZIP ships the pre-built editor under dist/static/, that bundle is the only editor the plugin ever uses, and the plugin no longer downloads executable editor code at runtime. The install/update machinery is removed. Mirrors exelearning/moodle-mod_exelearning#106.

Why

Recorded in ADR-0002. Release ZIPs already bundle the editor built from the matching tag, and check-editor-releases.yml publishes a new plugin release for every editor release — so the runtime downloader only added: a remotely sourced executable code surface plugin reviewers object to, the possibility of two sites on the same plugin version serving different editor builds, and a permanent network/TLS/ZIP-extraction/rollback attack surface. It also required a PHP-writable plugin directory.

Changes

  • Removed — ExeLearning_Static_Editor_Installer (GitHub release discovery, download, SHA-256 verification, extraction, atomic install with backup/rollback, admin-post action), the settings-page Download & Install / Update button, the exelearning_*_editor_install* hooks and their docs, and the installer lifecycle tests.
  • Added — ExeLearning_Editor_Bundle, a read-only helper that checks only dist/static/ (index.html + expected asset dirs). The settings screen shows nothing in a normal installation; a warning card appears only when the bundle is missing (e.g. a development checkout without make build-editor).
  • Graceful degradation — without a valid bundle the editor screen redirects to settings with an explanatory notice, and client-side export formats stay disabled.
  • Packaging guard — make package fails (stderr, non-zero exit, no partial ZIP) when dist/static/index.html, the editor asset directories, or a non-empty .editor-version are missing.
  • Upgrade — DB migration v2 drops the exelearning_static_editor option and the exelearning_installing_editor transient.
  • Playground — unchanged: blueprint.json already provisions the editor at blueprint level from a pinned release asset, outside the plugin runtime.
  • Docs & i18n — README, readme.txt, HOOKS.md, AGENTS.md and architecture docs updated; translations regenerated with the new strings translated in all 10 locales.

Tests

  • PHPUnit: 796/796 green (wp-env), including new coverage for valid/absent/invalid bundle detection and the upgrade cleanup.
  • PHPCS (.phpcs.xml.dist, --no-cache): clean.
  • make package: verified to fail without dist/static/ and without .editor-version, and to produce a ZIP containing dist/static/ (3824 files) and .editor-version on the success path, restoring version placeholders afterwards.
  • make check-translations: up to date and deterministic.

Migration implications

Sites keep working with the editor bundled in their release ZIP. A previously self-installed dist/static/ copy is simply replaced on the next plugin update — the served editor version becomes the one matching the plugin release, which is the point of the change. No data is deleted beyond the two installer bookkeeping entries.

Remove the runtime editor installer/updater: the embedded editor is a
release artifact shipped pre-built under dist/static/ in every official
release ZIP, and that bundle is the only editor source the plugin uses.

- Remove ExeLearning_Static_Editor_Installer (GitHub release discovery,
  download, SHA-256 verification, ZIP extraction, install/rollback, the
  admin-post action) and its settings-page install/update button.
- Add ExeLearning_Editor_Bundle, a read-only helper that validates the
  bundled editor and reads the .editor-version marker.
- Degrade cleanly without a bundle: the editor screen redirects to the
  settings page with an explanatory notice and client-side export
  formats stay disabled.
- Guard 'make package' so it fails (stderr, non-zero, no partial ZIP)
  when dist/static/ or a non-empty .editor-version is missing.
- DB migration v2 drops the exelearning_static_editor option and the
  exelearning_installing_editor transient.
- Remove the exelearning_*_editor_install* hooks and their docs; update
  README, readme.txt, HOOKS.md, AGENTS.md and architecture docs.
- Regenerate translations for all locales; translate the new strings.
- Replace installer lifecycle tests with bundle detection/validation
  and upgrade-cleanup tests.
@github-actions

Copy link
Copy Markdown
Contributor

Test in WordPress Playground

Test the plugin with the code from this branch:

Preview in WordPress Playground

ℹ️ The eXeLearning editor is fetched from the shared release and unpacked into the plugin when the playground boots, so the first load may take a few extra seconds. ELP upload, shortcode, Gutenberg block and preview work normally.

In a normal installation the embedded editor is always bundled
(ADR-0002), so a status card stating that adds nothing. Render the card
only as a warning when dist/static/ is absent or invalid, and drop the
now-unused version display, ExeLearning_Editor_Bundle::get_version()
and the happy-path strings/styles.
@erseco
erseco merged commit 3a49e65 into main Jul 24, 2026
4 checks passed
@erseco
erseco deleted the feature/bundle-only-editor branch July 24, 2026 12:44
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