Skip to content

refactor: split IPC handler monolith, add tests, harden security, and improve architecture#34

Merged
NeuroKoder3 merged 3 commits intomainfrom
refactor/architecture-hardening
Mar 19, 2026
Merged

refactor: split IPC handler monolith, add tests, harden security, and improve architecture#34
NeuroKoder3 merged 3 commits intomainfrom
refactor/architecture-hardening

Conversation

@NeuroKoder3
Copy link
Owner

Summary

  • Split 2000-line IPC handler monolith into 9 domain-specific modules (auth, entities, admin, license, barriers, ahhq, labs, clinical, operations) with a shared session/utility module
  • Added 33 comprehensive business logic tests covering priority scoring, donor matching, FHIR validation/import, notification rules, password validation, and entity helpers (46 total tests now)
  • Fixed FHIR parameter mismatch (fhir_bundle -> fhir_data) in FHIRImporter component
  • Added React ErrorBoundary wrapping the entire application with user-friendly error UI
  • Added .env.example documenting all environment variables
  • Added docs/ARCHITECTURE.md with system diagrams, data flow, security architecture, and module map
  • Hardened LICENSE_FAIL_OPEN to also check app.isPackaged, preventing accidental leak to production builds
  • Hardened default credential seeding by suppressing console output in production mode
  • Removed unused moment dependency, standardizing on date-fns
  • Converted utils/index.ts to .js for codebase consistency
  • Upgraded apiClient.js with safeApiCall error handling utility
  • Added test execution step to CI workflow
  • Fixed pre-existing lint error in LabsPanel.jsx

Test plan

  • All 13 cross-org access prevention tests pass
  • All 33 business logic tests pass (priority, matching, FHIR, notifications, passwords, entity helpers)
  • Vite production build succeeds
  • ESLint passes with zero errors
  • Verify Electron app starts correctly with refactored IPC handlers
  • Verify login/logout flow works end-to-end
  • Verify entity CRUD operations still function via the split handler modules

Made with Cursor

… improve architecture

- Split 2000-line electron/ipc/handlers.cjs into 9 domain-specific modules
  (auth, entities, admin, license, barriers, ahhq, labs, clinical, operations)
  with shared session state and utilities in shared.cjs
- Add 33 comprehensive business logic tests covering priority scoring,
  donor matching, FHIR validation/import, notification rules, password
  validation, and entity helper functions
- Fix FHIR parameter mismatch (fhir_bundle -> fhir_data) in FHIRImporter
- Add React ErrorBoundary component wrapping the entire app
- Add .env.example documenting all environment variables
- Add docs/ARCHITECTURE.md with system diagrams and module map
- Harden LICENSE_FAIL_OPEN to also check app.isPackaged (prevents leak to production)
- Harden default credential seeding (suppress console output in production)
- Remove unused moment dependency, standardize on date-fns
- Convert utils/index.ts to .js for codebase consistency
- Upgrade apiClient.js with safeApiCall error handling utility
- Add test execution step to CI workflow
- Fix pre-existing lint error in LabsPanel.jsx

Made-with: Cursor
@NeuroKoder3 NeuroKoder3 merged commit f2d2291 into main Mar 19, 2026
5 checks passed
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.

1 participant