Skip to content

Implement separate installable PWAs for workspaces using Service Worker scopes - #217

Merged
brettfxio merged 3 commits into
mainfrom
feature/separate-workspace-pwas-6151841140893464052
Aug 5, 2026
Merged

Implement separate installable PWAs for workspaces using Service Worker scopes#217
brettfxio merged 3 commits into
mainfrom
feature/separate-workspace-pwas-6151841140893464052

Conversation

@brettfxio

Copy link
Copy Markdown
Contributor

This PR implements separate, standalone installable PWAs for each individual workspace item using Service Worker directory scoping and relative manifest interception.

Instead of generating local Blob URL manifests which face compatibility issues in modern mobile/desktop PWA engines, this approach dynamically registers '/sw.js' with the exact workspace directory scope (e.g., '/workspaces/maze/') and query parameters containing page metadata (title, description, icon). The Service Worker intercepts all requests to 'manifest.json' within its scope and responds dynamically with the customized JSON configuration, setting 'start_url' to target that workspace path with app mode parameters.

Additionally:

  • Added skipWaiting() and clients.claim() to let the Service Worker take control of the page instantly.
  • Fixed a critical pre-existing bug where the missing /favicon.ico in criticalUrls caused installation to fail on clean environments.
  • Updated integration tests to verify the scoped manifest dynamic responses in Playwright, passing all 34 browser tests perfectly.

PR created automatically by Jules for task 6151841140893464052 started by @brettfxio

…er scopes and manifest interception

- Removed dynamic Blob URL manifest generation in favor of a robust, highly compatible relative / scoped manifest.json fetch interception mechanism.
- Modified sw.js registration in _layouts/default.html to register distinct directory scopes (e.g. /workspaces/maze/) for individual workspaces, passing metadata as query parameters in sw.js registration URL.
- Added self.skipWaiting() and self.clients.claim() in sw.js to ensure immediate Service Worker activation and document control upon registration.
- Added fetch listener interception in sw.js for any in-scope 'manifest.json' requests to dynamically return the customized JSON manifest configuration, configuring 'start_url' specifically for that workspace.
- Updated Playwright test tests/pwa_workspace.spec.js to poll for service worker activation, reload the document under SW control, and fetch/validate the custom intercepted manifest JSON payload.
- Fixed a bug where a missing /favicon.ico file caused Service Worker installation failures on clean contexts by removing /favicon.ico from criticalUrls in sw.js.

Co-authored-by: brettfxio <105930054+brettfxio@users.noreply.github.com>
@google-labs-jules

Copy link
Copy Markdown
Contributor

👋 Jules, reporting for duty! I'm here to lend a hand with this pull request.

When you start a review, I'll add a 👀 emoji to each comment to let you know I've read it. I'll focus on feedback directed at me and will do my best to stay out of conversations between you and other bots or reviewers to keep the noise down.

I'll push a commit with your requested changes shortly after. Please note there might be a delay between these steps, but rest assured I'm on the job!

For more direct control, you can switch me to Reactive Mode. When this mode is on, I will only act on comments where you specifically mention me with @jules. You can find this option in the Pull Request section of your global Jules UI settings. You can always switch back!

New to Jules? Learn more at jules.google/docs.


For security, I will only act on instructions from the user who triggered this task.

google-labs-jules Bot and others added 2 commits August 4, 2026 21:29
…tion on start page

- Removed old dynamic Blob URL manifest generation in favor of relative manifest.json and dynamic Service Worker interception.
- Added scope-based Service Worker registration inside workspaces, passing title, description, and icon as query parameters.
- Intercepted relative manifest.json fetches inside sw.js to dynamically return custom PWA manifests.
- Added '&fullscreen=true' to the custom manifest start_url to directly launch PWAs in presentation/fullscreen mode.
- Updated Playwright tests to fully poll and reload for Service Worker activation, ensuring smooth verification of intercepted dynamic manifest responses.

Co-authored-by: brettfxio <105930054+brettfxio@users.noreply.github.com>
…fixed corrupted workspace data

- Removed old dynamic Blob URL manifest generation in favor of highly compatible relative manifest.json Service Worker interception.
- Added scope-based Service Worker registration inside workspaces, passing title, description, and icon as query parameters.
- Intercepted manifest.json fetches inside sw.js to dynamically return custom PWA manifests.
- Added '&fullscreen=true' to the custom manifest start_url to directly launch PWAs in presentation/fullscreen mode.
- Programmatically reconstructed, balanced, and validated the corrupted `maze.md` workspace data on disk to resolve pre-existing loading errors.
- Updated Playwright tests to fully poll and reload for Service Worker activation, ensuring smooth verification of intercepted dynamic manifest responses.

Co-authored-by: brettfxio <105930054+brettfxio@users.noreply.github.com>
@brettfxio
brettfxio merged commit db3e959 into main Aug 5, 2026
2 checks passed
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