| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
Sorry, something went wrong.
PR Summary by QodoResync CommonJS Settings exports after reload to expose ep_* plugin settings 🐞 Bug fix 🧪 Tests 🕐 20-40 Minutes AI Description
|
Sorry, something went wrong.
Code Review by Qodo🐞 Bugs (0) 📘 Rule violations (0) 📎 Requirement gaps (0) 🎨 UX issues (0) 🔗 Cross-repo conflicts (0) 📜 Skill insights (0) 1. Test leaks plugin setting ✓ Resolved 🐞 Bug ☼ Reliability Description Code Relevance Evidence Agent prompt To customize comments, go to the Qodo configuration screen, or learn more in the docs. |
Sorry, something went wrong.
Code Review by Qodo🐞 Bugs (2) 📘 Rule violations (0) 📎 Requirement gaps (0) 📜 Skill insights (0) 1. Test leaks settings state 🐞 Bug ☼ Reliability ⭐ New Description Code Evidence Agent prompt 2. Test leaks plugin setting 🐞 Bug ☼ Reliability Description Code Relevance Evidence Agent prompt Context used To customize comments, go to the Qodo configuration screen, or learn more in the docs. |
Sorry, something went wrong.
| } finally { | ||
| delete process.env[envKey]; | ||
| if (saved === undefined) { | ||
| delete settingsMod.ep_test_plugin; | ||
| } else { | ||
| settingsMod.ep_test_plugin = saved; |
There was a problem hiding this comment.
1. Test leaks settings state 🐞 Bug ☼ Reliability
The new regression test attempts to clean up by deleting settingsMod.ep_test_plugin, but that deletes the export property rather than reliably removing the backing settings key created by reloadSettings(). Because reloadSettings()/storeSettings() never clears keys absent from the loaded sources, ep_test_plugin can persist and contaminate subsequent tests; additionally, the env var is not restored if it previously existed.Agent Prompt
### Issue description The new test mutates `process.env` and the Settings singleton, but its cleanup is incomplete: - It unconditionally `delete`s the env var instead of restoring any previous value. - It `delete`s `settingsMod.ep_test_plugin` (an export property), which does not reliably restore the underlying `settings` object state created by `reloadSettings()`. Because `storeSettings()` never deletes missing keys, the plugin key can persist across the rest of the suite. ### Issue Context `reloadSettings()` calls `storeSettings(settingsParsed)`/`storeSettings(credentials)` and those functions only iterate over keys present in the parsed objects; they do not remove old keys. ### Fix Focus Areas - src/tests/backend/specs/settings.ts[154-187] - src/node/utils/Settings.ts[962-990] - src/node/utils/Settings.ts[1190-1195] ### Suggested fix pattern - Save the original env value: `const originalEnv = process.env[envKey]; const hadEnv = Object.prototype.hasOwnProperty.call(process.env, envKey);` - In `finally`, restore it: if (hadEnv) process.env[envKey] = originalEnv; else delete process.env[envKey]; - Restore/remove the backing key on the actual settings object (likely `settingsMod.default ?? settingsMod`): - If it previously existed, set it back. - If it didn’t, `delete (settingsMod.default ?? settingsMod).ep_test_plugin;` - Then call `reloadSettings()`.
ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools
Sorry, something went wrong.
Synchronize CommonJS Settings getters after each settings reload so plugin-specific ep_* hashes loaded from configuration are accessible directly to plugins.
| Back | FazBrowse Home | New Git URL |
What
Synchronize the CommonJS Settings compatibility getters after settings are loaded or reloaded.
Why
Plugin-specific ep_* settings hashes are added after the original one-time CJS mirror is created. Plugins using the documented require('ep_etherpad-lite/node/utils/Settings') API therefore receive undefined for their own configuration.
Changes
Fixes #8109
Tests
Note: ESLint could not be run locally due to the existing ESLint/package compatibility mismatch.