Skip to content

Enhanced autoloading mechanisms - #3023

Open
girishpanchal30 wants to merge 5 commits into
developmentfrom
bugfix/2964
Open

Enhanced autoloading mechanisms#3023
girishpanchal30 wants to merge 5 commits into
developmentfrom
bugfix/2964

Conversation

@girishpanchal30

Copy link
Copy Markdown
Contributor

Closes #2962, #2963, #2964

Summary

Ensure the autoloader is loaded as a required file with proper checks. If the file is missing, unreadable, or the class fails to initialize, log the actual error and prevent a fatal error.

Checklist before the final review

  • Included E2E or unit tests for the changes in this PR.
  • Visual elements are not affected by independent changes.
  • It is at least compatible with the minimum WordPress version.
  • It loads additional script in frontend only if it is required.
  • Does not impact the Core Web Vitals.
  • In case of deprecation, old blocks are safely migrated.
  • It is usable in Widgets and FSE.
  • Copy/Paste is working if the attributes are modified.
  • PR is following the best practices

@pirate-bot

Copy link
Copy Markdown
Contributor

Bundle Size Diff

Package Old Size New Size Diff
Animations 178.33 KB 178.33 KB 0 B (0.00%)
Blocks 1.65 MB 1.65 MB 0 B (0.00%)
CSS 7.83 KB 7.83 KB 0 B (0.00%)
Dashboard 172.49 KB 172.49 KB 0 B (0.00%)
Onboarding 68.14 KB 68.14 KB 0 B (0.00%)
Export Import 4.73 KB 4.73 KB 0 B (0.00%)
Pro 439.82 KB 439.82 KB 0 B (0.00%)

@pirate-bot

pirate-bot commented Aug 31, 2026

Copy link
Copy Markdown
Contributor

Plugin build for 1156d48 is ready 🛎️!

@pirate-bot

pirate-bot commented Aug 31, 2026

Copy link
Copy Markdown
Contributor

E2E Tests

Playwright Test Status: See serial and parallel matrix jobs

Performance Results serverResponse: {"q25":529.59,"q50":567.14,"q75":577.55,"cnt":10}, firstPaint: {"q25":1588.5,"q50":1748.59,"q75":1978.9,"cnt":10}, domContentLoaded: {"q25":4400.85,"q50":4445.1,"q75":4490.61,"cnt":10}, loaded: {"q25":4404.32,"q50":4448.76,"q75":4494.78,"cnt":10}, firstContentfulPaint: {"q25":3254.32,"q50":3309.17,"q75":3368.12,"cnt":10}, firstBlock: {"q25":20733.99,"q50":20810.26,"q75":21145.71,"cnt":10}, type: {"q25":33.04,"q50":35.41,"q75":36.88,"cnt":10}, typeWithoutInspector: {"q25":29.48,"q50":32.69,"q75":36.94,"cnt":10}, typeWithTopToolbar: {"q25":43.89,"q50":48.42,"q75":50.38,"cnt":10}, typeContainer: {"q25":19.06,"q50":21.19,"q75":21.71,"cnt":10}, focus: {"q25":166.96,"q50":174.46,"q75":182.47,"cnt":10}, inserterOpen: {"q25":55.78,"q50":61.05,"q75":64.6,"cnt":10}, inserterSearch: {"q25":34.71,"q50":37.32,"q75":38.73,"cnt":10}, inserterHover: {"q25":5.65,"q50":6.26,"q75":6.6,"cnt":20}, loadPatterns: {"q25":2206.14,"q50":2243.82,"q75":2293.54,"cnt":10}, listViewOpen: {"q25":299.78,"q50":310.47,"q75":316.42,"cnt":10}

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds resilient class loading to prevent missing or broken autoload entries from causing frontend fatal errors.

Changes:

  • Introduces a centralized, failure-tolerant Loader.
  • Hardens Lite and Pro bootstrap/autoload paths.
  • Adds regression coverage for missing and invalid classes.

Reviewed changes

Copilot reviewed 8 out of 8 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
inc/class-loader.php Adds safe class construction and boot helpers.
inc/class-main.php Routes eager initialization through Loader.
inc/class-registration.php Uses Loader for renderers and AMP classes.
otter-blocks.php Adds a direct Loader fallback and startup gate.
plugins/otter-pro/autoloader.php Skips missing or unreadable class files.
tests/test-loader.php Tests Loader and bootstrap resilience.
tests/test-main-autoload.php Expands invalid-class initialization coverage.
tests/test-otter-pro-autoloader.php Tests Pro autoloader fallback behavior.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment thread otter-blocks.php Outdated
Comment thread plugins/otter-pro/autoloader.php
Comment thread tests/test-loader.php

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 8 out of 8 changed files in this pull request and generated 1 comment.

Comment thread otter-blocks.php Outdated

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 8 out of 8 changed files in this pull request and generated no new comments.

@selul selul left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The autoloader no longer fatals, but Base_CSS still instantiates the same class list unguarded.

Comment thread plugins/otter-pro/autoloader.php
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

4 participants