Refractoring Stage 5 Completed the IPC feature-grouping step.

This commit is contained in:
2026-10-16 18:07:16 +03:00
parent 52f7001b34
commit 0737892766
8 changed files with 560 additions and 373 deletions
+16 -3
View File
@@ -82,7 +82,7 @@ This is a gradual destination, not a requirement to move everything at once. IPC
**Result:** mail protocol, outbox, attachment, scheduling, IDLE, and snooze workflows are isolated behind injected dependencies; `npm test` passes 92 tests.
### 5. Harden and modularize IPC
### 5. Harden and modularize IPC — complete
- [x] Verify the IPC sender is the expected top-level application document (`desktop/security/ipc-sender.cjs`).
- [x] Restrict navigation to the exact app document URL; reject arbitrary `file:` navigation.
@@ -90,12 +90,14 @@ This is a gradual destination, not a requirement to move everything at once. IPC
- [x] Bind DAV object updates/deletes to the selected account, server collection, server-returned resource, and current ETag (`desktop/dav/remote-reference.cjs`).
- [x] Validate channel-specific fields and limits; reject renderer-supplied raw SMTP payload fields.
- [x] Group OpenPGP handlers and source fetching in `desktop/ipc/pgp.cjs`, retaining the shared IPC boundary.
- [ ] Group mail/account handlers in a feature registrar.
- [x] Group mail/account handlers in `desktop/ipc/mail.cjs`.
- [x] Group DAV handlers in `desktop/ipc/dav.cjs`; keep `preload.cjs` as the narrow renderer API.
- [ ] Return deliberate DTOs rather than internal store objects.
- [x] Retain public account and DAV config projections rather than exposing secret-bearing store records.
**Acceptance:** IPC tests cover malformed inputs and rejected senders; privileged behavior remains in trusted code.
**Result:** OpenPGP, mail/account, and DAV handler groups now register through the same sender and payload validation wrapper. Registration/schema tests cover all feature modules.
### 6. Modularize renderer incrementally
- Introduce explicit modules and feature initialization APIs, starting with shared state and mail UI.
@@ -118,6 +120,14 @@ This is a gradual destination, not a requirement to move everything at once. IPC
- Run `npm test` after each extraction; run desktop/Android build checks at relevant integration points.
- Keep changes small and inspect generated output before replacing it. The Android preparation script recreates `www/`, so edits there are not authoritative.
## Build version coordination
- `package.json` is the canonical application version; keep both `package-lock.json` version fields synchronized with it.
- Electron Builder and the desktop Actions artifact name derive from `package.json`.
- Android `versionName` derives from the same package version. Its current `versionCode` mapping is `major * 10000 + minor * 100 + patch`; keep minor and patch below 100, and revise the mapping before reaching that boundary to avoid collisions.
- `scripts/build-all.ps1` uses the package version for APK naming. Before a release, bump once with `npm run bump:build`, verify the lockfile and computed Android version code, and build every target without another bump.
- Latest version check: `package.json` and both lockfile version fields are `0.4.12`; Android derives `versionName 0.4.12` and `versionCode 412`. The existing Windows artifacts are through `ep-mail 0.4.11.exe`; no `0.4.12` release artifact has been built yet.
## Progress log
- Initial baseline: `npm test` passed 37 tests on 2026-10-16.
@@ -134,5 +144,8 @@ This is a gradual destination, not a requirement to move everything at once. IPC
- Step 5 also binds DAV updates/deletes to the configured account, same-origin collection, a server-listed resource, and a current ETag; DAV IDs are constrained against line injection and path traversal.
- Step 5 moved OpenPGP handler registration and message-source fetching into a feature module and added registration/schema coverage.
- Step 5 moved DAV handler registration into a feature module and added registration/schema coverage; the full suite passes 110 tests.
- Step 5 grouped mail/account handlers in `desktop/ipc/mail.cjs`; all 114 tests pass and the remaining app-version handler stays in the Electron shell.
- Added a build-version consistency check. The user bumped to `0.4.12`; package and lockfile match, and Android's derived build number is `412`. The release artifacts have not yet been built for this version.
- Step 5 grouped mail/account handlers and added a release-version consistency test; current package/lockfile/Android version alignment was checked and documented.
- The current IPC/DAV validation changes pass the full suite: 108 tests.
- While work continued, `package.json` and `package-lock.json` reflected a version bump to `0.4.6`; those changes were preserved.