[PR #4893] [MERGED] fix(infra): deterministic env var ordering #4976

Closed
opened 2026-03-17 02:28:07 +03:00 by kerem · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/hoppscotch/hoppscotch/pull/4893
Author: @CuriousCorrelation
Created: 3/15/2025
Status: Merged
Merged: 3/19/2025
Merged by: @jamesgeorge007

Base: patchHead: infra/fix/consistent-env-var-ordering


📝 Commits (1)

  • 78e1d55 fix(infra): deterministic env var ordering

📊 Changes

3 files changed (+3 additions, -0 deletions)

View changed files

📝 aio_run.mjs (+1 -0)
📝 packages/hoppscotch-selfhost-web/prod_run.mjs (+1 -0)
📝 packages/hoppscotch-sh-admin/prod_run.mjs (+1 -0)

📄 Description

This change sorts environment variables alphabetically before they're processed with import-meta-env that injects them into the index.html. This makes sure consistent hashes across pod restarts when there aren't any functional changes made to the .env file.

The issue was affecting desktop app reconnections after k8s pod restarts. The cause was non-deterministic env var ordering (a side-effect of Map) during the import-meta-env injection process. Even when the env vars themselves didn't change, their order in the injected JSON could change, ultimately resulting in different file hashes.

This fix ensures that regardless of the order in which env vars are provided by the runtime, they will be sorted alphabetically before being written to the build.env file.


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/hoppscotch/hoppscotch/pull/4893 **Author:** [@CuriousCorrelation](https://github.com/CuriousCorrelation) **Created:** 3/15/2025 **Status:** ✅ Merged **Merged:** 3/19/2025 **Merged by:** [@jamesgeorge007](https://github.com/jamesgeorge007) **Base:** `patch` ← **Head:** `infra/fix/consistent-env-var-ordering` --- ### 📝 Commits (1) - [`78e1d55`](https://github.com/hoppscotch/hoppscotch/commit/78e1d553504006c8fd1e9cc57cfe900da8064a90) fix(infra): deterministic env var ordering ### 📊 Changes **3 files changed** (+3 additions, -0 deletions) <details> <summary>View changed files</summary> 📝 `aio_run.mjs` (+1 -0) 📝 `packages/hoppscotch-selfhost-web/prod_run.mjs` (+1 -0) 📝 `packages/hoppscotch-sh-admin/prod_run.mjs` (+1 -0) </details> ### 📄 Description This change sorts environment variables alphabetically before they're processed with import-meta-env that injects them into the index.html. This makes sure consistent hashes across pod restarts when there aren't any functional changes made to the `.env` file. The issue was affecting desktop app reconnections after k8s pod restarts. The cause was non-deterministic env var ordering (a side-effect of `Map`) during the import-meta-env injection process. Even when the env vars themselves didn't change, their order in the injected JSON could change, ultimately resulting in different file hashes. This fix ensures that regardless of the order in which env vars are provided by the runtime, they will be sorted alphabetically before being written to the build.env file. --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
kerem 2026-03-17 02:28:07 +03:00
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/hoppscotch#4976
No description provided.