Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Assets binary data changes dependng on OS and / or architecture / nodejs version #2796

Closed
webratz opened this issue Dec 3, 2024 · 7 comments
Labels
bug Functionality does not match expectation

Comments

@webratz
Copy link

webratz commented Dec 3, 2024

Search terms

Expected Behavior

No matter on what machine I run typedoc, the output with the same input should always be the same.

Actual Behavior

Typedoc produces different asset output, depending on which machine its run on. The following things produce different output:

  • assets/hierarchy.js the window.hierarchyData
  • assets/navigation.js window.navigationData
  • assets/search.js window.searchData

I'm not yet sure if its a OS and / or an architecture or nodejs version difference that causes this difference. In our case a developer runs typedoc on their Apple Silicon Macbook, and get one version of the files mentioned above. The CI system which uses a linux container on x86 gets another output.
In our case we block deployments that change checked in files. I added the environment for both variants on the bottom.

Steps to reproduce the bug

Run typedoc with the following in different systems

typedoc src --disableSources --out docs/

Environment

Developer Macbook

  • Typedoc version: 0.27.2
  • TypeScript version: 5.7.2
  • Node.js version: v20.17.0
  • OS: MacOs Sonoma 14.6.1 (23G93) / Apple M1 Pro

CI System

  • Typedoc version: 0.27.2
  • TypeScript version: 5.7.2
  • Node.js version: v18.20.5
  • OS: Debian GNU/Linux 12 (bookworm)
@webratz webratz added the bug Functionality does not match expectation label Dec 3, 2024
@webratz
Copy link
Author

webratz commented Dec 3, 2024

I'll try to get a version where at least nodejs major is the same, but due to some internal restrictions I can't run that right now

@Gerrit0
Copy link
Collaborator

Gerrit0 commented Dec 4, 2024

That data is just base 64 encoded deflate compressed JSON - if you decompress it, is it the same? I wonder if Node's default compression settings have changed

@Gerrit0
Copy link
Collaborator

Gerrit0 commented Dec 4, 2024

Going to guess it isn't Node version -- I don't have a computer with another architecture to test on, but Node 18, 20, and 23 all produce identical results on my Fedora box.

@webratz
Copy link
Author

webratz commented Dec 4, 2024

I've decompressed both and compared the json, and it is exactly the same. So my guess is, the compression is creating different results on the different systems

@Gerrit0
Copy link
Collaborator

Gerrit0 commented Dec 5, 2024

https://stackoverflow.com/a/26521451/7186598 implies that switching to using deflate directly rather than gzip might solve this, if you patch typedoc/dist/lib/utils/compress.js to use deflate instead of gzip, does that solve your issue?

@webratz
Copy link
Author

webratz commented Dec 5, 2024

I have just tested this, and can confirm: Changing to deflate leads to the encoded strings being exactly the same.

@Gerrit0 Gerrit0 closed this as completed in ed1ac7a Dec 6, 2024
@webratz
Copy link
Author

webratz commented Dec 9, 2024

thanks for the quick fix of this :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Functionality does not match expectation
Projects
None yet
Development

No branches or pull requests

2 participants