Skip to content

refactor(scorm): replace runtime and document clean provenance and licensing - #105

Draft
erseco wants to merge 4 commits into
mainfrom
refactor/scorm12-runtime-clean-provenance
Draft

refactor(scorm): replace runtime and document clean provenance and licensing#105
erseco wants to merge 4 commits into
mainfrom
refactor/scorm12-runtime-clean-provenance

Conversation

@erseco

@erseco erseco commented Jul 24, 2026

Copy link
Copy Markdown
Contributor

Summary

Replace the legacy SCORM 1.2 runtime bundled by the Moodle plugin with the clean-provenance runtime introduced in exelearning/exelearning#2209, and document the origin, build process, and licensing of the bundled third-party and eXeLearning code.

This change also addresses the documentation requested by external validation finding DIR-05.

Runtime changes

  • Replace assets/scorm/SCORM_API_wrapper.js with the unmodified upstream pipwerks SCORM API wrapper:
    • License: MIT
    • Version: v1.1.20180906
    • Upstream commit: 82e455b4032ee08febf64d2fa2bf1aacaebaa446
    • SHA-256: f2a558ba284edbc6842edf51678df1f7e3e05cbf09ec00bc6dd5988b6caa2e78
  • Replace assets/scorm/SCOFunctions.js with the eXeLearning-owned SCORM 1.2 runtime assembled from:
    1. exe-scorm12-client.js
    2. exe-scorm12-policy.js
    3. exe-scorm12-lifecycle.js
    4. exe-scorm12-adapter.js
  • Record pipwerks in thirdpartylibs.xml as the plugin's only third-party library.
  • Exclude the generated assets/scorm/SCOFunctions.js file from the repository ESLint scope.

The new runtime is implemented from the SCORM 1.2 Run-Time Environment specification and is licensed under AGPL-3.0-or-later. It no longer contains ADL/CTC-derived code or Rustici Creative Commons fragments.

Documentation and licensing

  • Add assets/scorm/readme_moodle.txt with:
    • the provenance and exact update path of both SCORM runtime files;
    • the pipwerks upstream commit and checksum;
    • an explanation of why SCOFunctions.js is first-party eXeLearning code rather than a third-party library.
  • Add dist/readme_moodle.txt with:
    • the origin of the bundled eXeLearning editor;
    • the build and packaging commands;
    • the reason the file lives in dist/ rather than dist/static/;
    • the licensing relationship between the AGPL editor and the GPLv3 Moodle plugin.
  • Add a Third-party code section to README.md explaining:
    • which bundled code is third-party;
    • which code belongs to the eXeLearning project;
    • how GPLv3 section 13 and AGPLv3 section 13 permit this distribution while each component retains its own license.

Compatibility

No injector change is required. classes/local/scorm/scorm_injector.php continues to inject:

  • libs/SCORM_API_wrapper.js
  • libs/SCOFunctions.js

The replacement keeps the existing public contract, including the global lifecycle functions and the scorm facade used by exported content.

Behavior changes to verify

  • An existing incomplete status is no longer reset to not attempted when a page is reopened.
  • Resume state survives reloads.
  • Persistence runs on pagehide and visibilitychange instead of relying only on unload.
  • cmi.core.exit is empty after a terminal status and suspend otherwise.
  • Completion, grade reporting, learner name access, score bounds, navigation, and resume continue to work in supported Moodle versions.

The legacy Moodle-specific window flags, such as mod_scorm_is_window_closing, were intentionally not copied. Any compatibility issue requiring them should be reported to the main eXeLearning repository and evaluated against ADR-0001.

Verification

  • Both readme_moodle.txt files are included in the generated release ZIP next to the code they document.
  • The pipwerks wrapper is byte-identical to the documented upstream revision.
  • Automated tests and coverage checks pass.
  • The Moodle Playground preview can be used to test ELPX upload, viewer, preview, completion, grading, and resume behavior.

Follow-up

A versioned artifact, checksum verification step, or synchronization script should eventually replace the current manual copying of SCORM runtime files between the main eXeLearning repository and this plugin.


Moodle Playground Preview

The changes in this pull request can be previewed and tested using a Moodle Playground instance.

Preview in Moodle 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. ELPX upload, viewer and preview work normally.

…M 1.2 rewrite

Coordinated update with exelearning/exelearning#2209:

- assets/scorm/SCORM_API_wrapper.js is now the unmodified upstream
  pipwerks wrapper (MIT, v1.1.20180906,
  pipwerks/scorm-api-wrapper@82e455b,
  SHA-256 f2a558ba284edbc6842edf51678df1f7e3e05cbf09ec00bc6dd5988b6caa2e78).
- assets/scorm/SCOFunctions.js is now the eXeLearning-owned SCORM 1.2
  runtime (GPL-compatible AGPL-3.0-or-later), assembled from the four
  layers in the eXeLearning repo (public/app/common/scorm/scorm12/).
  It keeps the full injected contract (loadPage/unloadPage globals, the
  scorm facade incl. SetScoreMax/SetScoreMin/GetLearnerName/GetScoreRaw,
  additive pipwerks.SCORM extensions), so scorm_injector.php needs no
  change.
- thirdpartylibs.xml: bump the wrapper version and drop the SCOFunctions
  entry (no longer third-party); eslint-ignore the assembled artifact.

Runtime contract: doc/development/scorm12-runtime-contract.md and
doc/architecture/adr/ADR-0001-scorm12-runtime-rewrite.md in the
eXeLearning repository.
@codecov-commenter

codecov-commenter commented Jul 24, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 92.31%. Comparing base (0be72e3) to head (4a7cf0c).
✅ All tests successful. No failed tests found.

Additional details and impacted files
@@            Coverage Diff            @@
##               main     #105   +/-   ##
=========================================
  Coverage     92.31%   92.31%           
  Complexity      824      824           
=========================================
  Files            51       51           
  Lines          3734     3734           
=========================================
  Hits           3447     3447           
  Misses          287      287           
Flag Coverage Δ
javascript 94.11% <ø> (ø)
php 92.23% <ø> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

Components Coverage Δ
PHP (server-side) 92.23% <ø> (ø)
JavaScript (SCORM tracker) 94.11% <ø> (ø)
🚀 New features to boost your workflow:
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

erseco added 2 commits July 25, 2026 14:29
Document the provenance, build process, and AGPL/GPLv3 licensing rationale for the bundled eXeLearning editor and SCORM runtime.
@erseco erseco changed the title refactor(scorm): replace runtime files with the clean-provenance SCORM 1.2 rewrite (exelearning#2209) refactor(scorm): replace runtime and document clean provenance and licensing Jul 25, 2026
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.

2 participants