Make bumpie-meds pregnancy safety modules optional dependencies - #123
Conversation
Co-authored-by: Isaloum <155708736+Isaloum@users.noreply.github.com>
Co-authored-by: Isaloum <155708736+Isaloum@users.noreply.github.com>
Co-authored-by: Isaloum <155708736+Isaloum@users.noreply.github.com>
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: f73fecd306
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| // Only suppress MODULE_NOT_FOUND errors; re-throw other errors like syntax errors | ||
| if (error.code === 'MODULE_NOT_FOUND') { | ||
| console.warn('⚠️ Warning: bumpie-meds pregnancy safety modules not available.'); | ||
| console.warn(' Pregnancy safety features will be disabled.'); | ||
| console.warn(' To enable these features, install the bumpie-meds package.'); |
There was a problem hiding this comment.
Re-throw MODULE_NOT_FOUND from non-optional deps
Because the catch treats any MODULE_NOT_FOUND as “optional dependency missing,” a broken install of bumpie-meds (e.g., a missing transitive dependency or a renamed internal file) will be silently swallowed and pregnancy safety will be disabled without surfacing the real error. This makes production misconfigurations look like an expected optional state and can lead to missing safety checks even when the package is present. Consider only suppressing errors when the missing module is the bumpie-meds package itself (e.g., check error.message/require.resolve), and rethrow other MODULE_NOT_FOUND cases.
Useful? React with 👍 / 👎.
Tests failing due to hard dependency on
bumpie-meds/src/services/pregnancy-safety-engineand related modules. Package not present in repository or package.json, causing module resolution failures at require-time.Changes
medication-tracker.js
MODULE_NOT_FOUNDerrorscheckPregnancySafety()before calling module methodsdocs/tests/critical-features.test.js
Storage.prototypereference (Node.js has no Storage constructor)Result
Application degrades gracefully when optional modules missing. All 2117 tests pass.
Original prompt
This pull request was created from Copilot chat.
✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.