docs: record modular refactor acceptance and final verification

This commit is contained in:
abaishu0730 committed 2026-10-19 09:16:17 +08:00
1 parent a420d2d9fb
commit 7f16bd6882
7 files changed
+75 -100

No files matched your search

@@ -24,59 +24,59 @@
**Files:** all existing src business files, web feature files, tests; scripts and package.json imports; new src/shared/paths.cjs.
**Interfaces:** preserve exports, except notifications.cjs remains temporarily under modules/notifications until Task 3 splits it. PROJECT_ROOT/WEB_ROOT/SCRIPTS_ROOT/EXTENSION_ROOT exported by shared/paths.
- [ ] Inventory current tests and relative/resource path uses with rg.
- [ ] Move files to approved directories; rewrite imports from resolved original absolute targets, including fixture paths. Keep src/server.cjs as current entry until Task 5. Move dashboard.cjs to app/dashboard.cjs. Temporarily place notifications.cjs at modules/notifications/notifications.cjs.
- [ ] Centralize static roots. Preserve sibling worker lookup and server entry location; map old public web URLs to new physical files.
- [ ] Change test discovery to recursive node --test pattern; verify all original 49 test files remain discovered.
- [ ] Run module import checks and baseline suite. Expected only known Unicode shortcut failure and official CLI skip. Commit isolated migration.
- [x] Inventory current tests and relative/resource path uses with rg.
- [x] Move files to approved directories; rewrite imports from resolved original absolute targets, including fixture paths. Keep src/server.cjs as current entry until Task 5. Move dashboard.cjs to app/dashboard.cjs. Temporarily place notifications.cjs at modules/notifications/notifications.cjs.
- [x] Centralize static roots. Preserve sibling worker lookup and server entry location; map old public web URLs to new physical files.
- [x] Change test discovery to recursive node --test pattern; verify all original 49 test files remain discovered.
- [x] Run module import checks and baseline suite. Record the intermediate baseline honestly; the migration baseline runner ended before a complete result. The final integrated full suite verifies migration with the Unicode fix. Commit isolated migration.
## Task 2: Saved SMB bounded execution
**Files:** src/modules/storage/*, tests/storage/* and owned fixtures.
**Interfaces:** StorageService public methods remain compatible. Worker runner accepts AbortSignal and deadline; SmbClient exposes cancellable bounded operations without passing secrets in command arguments.
- [ ] Add failure-first tests: hung saved list/check terminates; stop cancels active and queued operations; queue works after timeout; archive result preserves bytes; oversized/invalid IPC fails.
- [ ] Execute targeted tests and capture failure before implementation.
- [ ] Route saved operations through isolated worker, reuse FileArea guards, observe process exit on cancel/timeout, enforce binary response limits. Stop rejects queued tasks promptly.
- [ ] Run storage suites including local fake-worker and archive integrity regressions; commit and report commands/results.
- [x] Add failure-first tests: hung saved list/check terminates; stop cancels active and queued operations; queue works after timeout; archive result preserves bytes; oversized/invalid IPC fails.
- [x] Execute targeted tests and capture failure before implementation.
- [x] Route saved operations through isolated worker, reuse FileArea guards, observe process exit on cancel/timeout, enforce binary response limits. Stop rejects queued tasks promptly.
- [x] Run storage suites including local fake-worker and archive integrity regressions; commit and report commands/results.
## Task 3: Notifications transaction boundary and manual recovery
**Files:** src/modules/notifications/{store,service,mapping,api}.cjs, web/modules/notifications/view.js, tests/notifications/*.
**Interfaces:** NotificationStore.recover() explicit, NotificationStore.beginSending(batchId) transactional CAS; NotificationService retains existing API and adds retryItem(id,input,actor). API retains routes and adds admin retry with evidence/audit.
- [ ] Test constructing second store leaves active prepared batch/items unchanged; cancelled reservation fails beginSending and cannot reach SMTP.
- [ ] Test final allowed SMTP failure becomes exhausted; next tick does not send; manual retry requires admin and evidence, audits, resets one item, rejects repeated submission.
- [ ] Split mapping, transactions and SMTP orchestration into separate files. Recovery runs only explicitly after application ownership. Preserve unknown-result manual resolution rules.
- [ ] Implement accurate exhausted display/action; test API and UI with local fixtures. Commit/report targeted results.
- [x] Test constructing second store leaves active prepared batch/items unchanged; cancelled reservation fails beginSending and cannot reach SMTP.
- [x] Test final allowed SMTP failure becomes exhausted; next tick does not send; manual retry requires admin and evidence, audits, resets one item, rejects repeated submission.
- [x] Split mapping, transactions and SMTP orchestration into separate files. Recovery runs only explicitly after application ownership. Preserve unknown-result manual resolution rules.
- [x] Implement accurate exhausted display/action; test API and UI with local fixtures. Commit/report targeted results.
## Task 4: BPM/browser, shared redaction and Windows supervisor
**Files:** modules/bpm/session-manager.cjs and login-form.cjs; shared/redact.cjs; assistant/policy/service and health imports; platform/service/supervisor.cjs and windows-startup.cjs; scripts/service.cjs; relevant tests and fixtures.
**Interfaces:** preserve manager.browser(), extract form helpers with unchanged login security; redact exported centrally; supervisor accepts validated fresh ports provider each launch; Unicode shortcut create/read retain ownership metadata.
- [ ] Test browser close then concurrent reconstruction launches exactly once, invalidates dead leases and ignores stale disconnect events; use real headless Chrome fixture.
- [ ] Test nested quoted JSON password/cookie and complete Cookie/Authorization values are absent from actual runtime input and persisted history.
- [ ] Test real managed child port A to B restart remains healthy, unknown occupants rejected.
- [ ] Retain failing Chinese startup-path regression on codepage1252; replace shortcut COM ANSI path handling using Unicode IShellLinkW/IPersistFile, test readback and foreign ownership.
- [ ] Implement minimal fixes and form responsibility extraction. Run owned suites, commit/report.
- [x] Test browser close then concurrent reconstruction launches exactly once, invalidates dead leases and ignores stale disconnect events; use real headless Chrome fixture.
- [x] Test nested quoted JSON password/cookie and complete Cookie/Authorization values are absent from actual runtime input and persisted history.
- [x] Test real managed child port A to B restart remains healthy, unknown occupants rejected.
- [x] Retain failing Chinese startup-path regression on codepage1252; replace shortcut COM ANSI path handling using Unicode IShellLinkW/IPersistFile, test readback and foreign ownership.
- [x] Implement minimal fixes and form responsibility extraction. Run owned suites, commit/report.
## Task 5: Application/HTTP responsibility split and ownership
**Files:** src/app/{application,bridge,dashboard,assets,request}.cjs; modules/dashboard/{api,auth}.cjs; platform/service/instance-lock.cjs; src/server.cjs; tests/app and tests/service.
**Interfaces:** server exports main/createServer/startService; application acquires acquireInstanceLock(stateDir) before any business store construction and releases on all failure/shutdown paths. notificationStore.recover() called only with ownership acquired.
- [ ] Test second main on same temporary state fails before business recovery while first owns batch; first can send once and item becomes sent. Test startup failure releases ownership.
- [ ] Split existing bridge/createServer from lifecycle, retain thin formal entry. Extract dashboard auth/business routes, request/security helpers and asset mapping with routing/auth order preserved.
- [ ] Implement named-pipe ownership lock keyed by canonical state directory; avoid unsafe stale PID lockfiles. Make cleanup robust after partial initialization.
- [ ] Run auth, HTTP, resources, browser navigation, startup and integration regressions; verify unchanged cookie/URL behavior. Commit/report.
- [x] Test second main on same temporary state fails before business recovery while first owns batch; first can send once and item becomes sent. Test startup failure releases ownership.
- [x] Split existing bridge/createServer from lifecycle, retain thin formal entry. Extract dashboard auth/business routes, request/security helpers and asset mapping with routing/auth order preserved.
- [x] Implement named-pipe ownership lock keyed by canonical state directory; avoid unsafe stale PID lockfiles. Make cleanup robust after partial initialization.
- [x] Run auth, HTTP, resources, browser navigation, startup and integration regressions; verify unchanged cookie/URL behavior. Commit/report.
## Task 6: Review and acceptance
**Files:** README/development docs/HANDOFF as relevant, all changed modules and tests.
- [ ] Independent task reviews and final whole-change review; route meaningful findings back to implementers and verify fixes.
- [ ] Check no dangling old imports/resource paths; verify test discovery and encrypted persistence compatibility using temporary state.
- [ ] Run full npm test with review NODE_PATH; require zero failures, document official CLI skip honestly.
- [ ] Update design/plan progress and architecture documentation. Report exact results and untested real-provider limits; retain reviewable attached checkout.
- [x] Independent task reviews and final whole-change review; route meaningful findings back to implementers and verify fixes.
- [x] Check no dangling old imports/resource paths; verify test discovery and encrypted persistence compatibility using temporary state.
- [x] Run full npm test with review NODE_PATH; require zero failures, document official CLI skip honestly.
- [x] Update design/plan progress and architecture documentation. Report exact results and untested real-provider limits; retain reviewable attached checkout.
@@ -1,6 +1,6 @@
# 按业务模块组织代码:重构设计
日期:2026-10-19。状态:用户已批准实施。
日期:2026-10-19。状态:已实施并验收;最终全量 222 项,221 通过、0 失败、1 跳过。详见 [本轮验证](../../modular-refactor-verification-2026-10-19.md)。
## 目标与范围