Skip to content

Report worker script load failures - #8024

Open
hugosmoreira wants to merge 4 commits into
maplibre:mainfrom
hugosmoreira:fix/worker-load-errors
Open

Report worker script load failures#8024
hugosmoreira wants to merge 4 commits into
maplibre:mainfrom
hugosmoreira:fix/worker-load-errors

Conversation

@hugosmoreira

@hugosmoreira hugosmoreira commented Jul 26, 2026

Copy link
Copy Markdown
Contributor

Summary

  • monitor worker error and messageerror events from the moment each worker is created
  • report one actionable failure to every active map through its normal error event
  • include the resolved worker URL and the v5-to-v6 bundler migration guide for startup failures
  • preserve an early failure from a prewarmed worker so maps created afterward still receive it
  • distinguish startup failures from errors raised after the worker has begun responding

Closes #8018.

Testing

  • npm run test-unit (198 files, 2,935 tests)
  • targeted worker, pool, dispatcher, and map propagation tests (19 tests)
  • npm run typecheck
  • npm run lint
  • npm run build-dist
  • npm run test-build -- min.test.ts

The repository-prescribed bundle-size baseline was updated for the new diagnostic and listener plumbing.

AI assistance

Codex helped implement and validate this change. The PR remains a draft pending the contributor's required human review under the repository's AI policy.

@codecov

codecov Bot commented Jul 26, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 93.26%. Comparing base (b143343) to head (ad178de).
⚠️ Report is 7 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #8024      +/-   ##
==========================================
+ Coverage   93.24%   93.26%   +0.02%     
==========================================
  Files         290      290              
  Lines       24536    24585      +49     
  Branches     6477     6492      +15     
==========================================
+ Hits        22879    22930      +51     
+ Misses       1657     1655       -2     

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@hugosmoreira
hugosmoreira marked this pull request as ready for review July 26, 2026 15:58

@CommanderStorm CommanderStorm left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Needs some cleanup in the tests department, because some of them are a bit flaky/imprecice

Comment thread src/util/worker_pool.test.ts Outdated
Comment thread src/util/worker_pool.test.ts Outdated
Comment thread src/util/web_worker.ts Outdated
Comment thread src/util/web_worker.test.ts Outdated
Comment thread src/util/web_worker.test.ts Outdated
Comment thread src/util/web_worker.ts
@HarelM

HarelM commented Jul 28, 2026

Copy link
Copy Markdown
Collaborator

To be honest, I'm not sure what use case this solves, and it adds a lot of complicated code.
Besides not reading the v5-v6 migration guide, what does the code here really solves?

@HarelM HarelM added the need more info Further information is requested label Jul 28, 2026
@HarelM

HarelM commented Jul 28, 2026

Copy link
Copy Markdown
Collaborator

Thanks for taking the time to open this PR BTW!

@CommanderStorm

Copy link
Copy Markdown
Member

I think better errors for fails like this are good

Besides not reading the v5-v6 migration guide, what does the code here really solves?

LLMs will suggest the old version of holding our lib for a few major versions to come.
We better make the migration path very smooth and have errors that are easy to understand for humans and machines..

@HarelM

HarelM commented Jul 28, 2026

Copy link
Copy Markdown
Collaborator

The issue reported on v6 as of today are people not finding maplibre.js file in unpkg, this won't solve that.
Error message are important, but the extra complexity added here just to report the error is not worth it from my point of view. It makes thing more complicated with little value, sorry...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

need more info Further information is requested

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Map hangs silently when the worker script fails to load: no error event, no console message, 'load' never fires

3 participants