Skip to content

Conversation

@jayaddison
Copy link

@jayaddison jayaddison commented May 24, 2025

This is intended to support build reproducibility, providing a deterministic ordering (provided that the filenames themselves are produced deterministically by RollUp, which I believe they are) for the filesToCache list in the ServiceWorker script file.

Although I'm relatively confident in this fix, I haven't been able to build/test it locally yet, so I'm opening this PR in draft status.

May resolve #1016.

@jayaddison
Copy link
Author

Although I'm relatively confident in this fix, I haven't been able to build/test it locally yet, so I'm opening this PR in draft status.

Update: I've been able to build from 25543d3 successfully, and can confirm that the resulting filesToCache ordering appears sorted, meaning that I believe it should be stable/deterministic:

Snippet from: build/sw.js

function filesToCache(){return["app.js","app.js.map","argon2.wasm","calendar-view-CBFsQcb-.js","calendar-view-CBFsQcb-.js.map","common-DlxDDhNq.js","common-DlxDDhNq.js.map","common-min-DDW5MDcN.js","common-min-DDW5MDcN.js.map","contacts-BqxphGlM.js","contacts-BqxphGlM.js.map","date-gui-bJRihSj5.js","date-gui-bJRihSj5.js.map","date-li3obA6P.js","date-li3obA6P.js.map","gui-base-C6SJ01OE.js","gui-base-C6SJ01OE.js.map","images/font.ttf","images/logo-favicon-152.png","images/logo-favicon-196.png","images/logo-favicon.png","index.html","index.js","invoice-gh1Kkh5t.js","invoice-gh1Kkh5t.js.map","jszip-Bnh3tOTf.js","jszip-Bnh3tOTf.js.map","liboqs.wasm","linkify-BTj9bcKs.js","linkify-BTj9bcKs.js.map","login--XcUoZYf.js","login--XcUoZYf.js.map","mail-editor-Dx3qhEhD.js","mail-editor-Dx3qhEhD.js.map","mail-settings-D-h0tcr-.js","mail-settings-D-h0tcr-.js.map","mail-view-Kvd81Yxo.js","mail-view-Kvd81Yxo.js.map","mail-worker.js","mail-worker.js.map","main-Ds4pTBi_.js","main-Ds4pTBi_.js.map","native-common-DiGDsPub.js","native-common-DiGDsPub.js.map","polyfill-helpers-TovMs9th.js","polyfill-helpers-TovMs9th.js.map","polyfill.js","sanitizer-yYY4lZnw.js","sanitizer-yYY4lZnw.js.map","search-Cav5f4Fz.js","search-Cav5f4Fz.js.map","settings-CbCPOO1D.js","settings-CbCPOO1D.js.map","setup-wizard-CXwcgznQ.js","setup-wizard-CXwcgznQ.js.map","sharing-CaM4DOLx.js","sharing-CaM4DOLx.js.map","translation-en-DtEYnBUF.js","translation-en-DtEYnBUF.js.map","ui-extra-Cpn0cHmH.js","ui-extra-Cpn0cHmH.js.map","wasm-BAPiWBZ7.js","wasm-BAPiWBZ7.js.map","wasm-fallback-D-anRYZf.js","wasm-fallback-D-anRYZf.js.map","worker-bootstrap.js","worker-lazy-CVYxmNc-.js","worker-lazy-CVYxmNc-.js.map","worker-search-CgUo851E.js","worker-search-CgUo851E.js.map"]}

...however, I have not yet tested the resulting webapp.

@jayaddison
Copy link
Author

...however, I have not yet tested the resulting webapp.

By serving the build directory on a local HTTP server, I can view the login page for the client webapp. However, I do not think that the ServiceWorker is being registered correctly yet. I will check my browser's developer tool settings.

image

@jayaddison
Copy link
Author

By serving the build directory on a local HTTP server, I can view the login page for the client webapp. However, I do not think that the ServiceWorker is being registered correctly yet. I will check my browser's developer tool settings.

I would have liked to confirm that some of the filesToCache appear as requested (precached) by finding them in the Network tab of my Firefox developer tools. They do not appear there, but I do in fact think that the serviceworker registered, ran, and precached the requested resources. I believe that because:

  1. In the output of my local HTTP server, I find GET request logs for some of the precached files that are relevant to the serviceworker; e.g. "GET /argon2.wasm HTTP/1.1" 200
  2. When holding the Applications tab open in Firefox devtools and refreshing the page (with cache disabled), it seemed that a serviceworker was momentary registered -- but then perhaps stopped/deregistered itself.
  3. The browser console logs seem to indicate that a serviceworker was successfully installed; messages are logged including: ServiceWorker has been installed, updatefound, and worker init time (ms): 917

It's far from comprehensive testing, but based on these I'm ready to mark this pull request as ready for review.

@jayaddison jayaddison marked this pull request as ready for review May 28, 2025 10:44
This is intended to support build reproducibility[1], providing a
deterministic ordering (provided that the filenames themselves are
produced deterministically by RollUp, which I believe they are).

Relates-to issue tutao#8154

[1] - https://reproducible-builds.org
@jayaddison jayaddison force-pushed the issue-8154/reproducible-builds-serviceworker-cachefiles branch from 25543d3 to a488df1 Compare October 15, 2025 10:27
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.

tutanota Android app is very close to building reproducibly

1 participant