fix: reduce redundant work during chat and note startup
Avoid hidden activity renders, no-op message saves and attachment scans when pinning conversations. Reuse note body inspection and skip unchanged attachment reference writes while preserving recovery and cleanup behavior. Skip unnecessary Markdown normalization and memoize subagent lookups without delaying live rich text. Add storage operation counts and real Electron rendering equivalence benchmarks; full-render speedup remains unproven. Validation: 5397 tests passed, 84 skipped; typecheck passed. Lint passed excluding two existing untracked sidebar probe files. Release note: Reduce repeated rendering and disk work during chat, conversation pinning and note startup while preserving existing content and interactions.
This commit is contained in:
@@ -64,6 +64,10 @@ Main 先保存资产,再保存草稿或接受队列;消息、分支建立独
|
||||
会话删除、项目删除及清空数据均核对引用,启动回收已无归属的记录和孤立 UUID 目录。
|
||||
清理失败保留无引用数据库记录供下次重试,不回滚已接受的草稿。
|
||||
|
||||
引用保存按输入顺序去重并查询资产。已有引用的顺序、会话归属均相同,且资产无需从临时目录
|
||||
转存时,直接返回,不重复开启写事务或删除、插入引用。空引用同样适用;顺序、归属或附件
|
||||
发生变化时仍按原事务更新,临时资产仍须转存。
|
||||
|
||||
助手库 schema 39 标记新附件元数据,阻止旧客户端将其当旧格式读取;没有批量改写历史附件。
|
||||
知识库 schema 13 新增 `metadata.parsedResultId` 表达式索引,结果按主键定位,不扫描全部文档。
|
||||
知识库新结果先写入独立 resultId 目录,数据库正文/chunks 发布成功后替换引用,再清理旧目录。
|
||||
|
||||
@@ -1,5 +1,30 @@
|
||||
# Magic Notes Progress
|
||||
|
||||
## 2026-09-28: Startup Body Read Reuse
|
||||
|
||||
Startup repair now reuses the asset references collected during revision
|
||||
inspection, as described in [file reconciliation](./technical-design.md#schema-38-migration).
|
||||
The persisted format and revision recovery rules are unchanged.
|
||||
|
||||
- Real temporary SQLite/filesystem fixture: 120 entries across 120 notes,
|
||||
half rich text and half canvas, with 4,039,560 bytes of body JSON.
|
||||
Five initializations each read 240 bodies before and 120 after the change.
|
||||
Logical bytes read fell from 8,079,120 to 4,039,560 per initialization.
|
||||
- Baseline durations were 148.23, 134.42, 131.06, 140.66 and 172.90 ms;
|
||||
after durations were 136.89, 119.11, 116.41, 115.14 and 116.26 ms.
|
||||
Medians were 140.66 and 116.41 ms. These Windows runs used warm filesystem
|
||||
caches on a shared machine; they do not measure cold application startup.
|
||||
- `npx vitest run src/main/magic-notes/magic-note-storage.test.ts src/main/assistant/assistant-database.test.ts src/main/assistant/assistant-storage-upgrade.test.ts src/main/assistant-storage-startup.test.ts tests/assistant-storage-worker.test.ts`
|
||||
passed 154 tests. Coverage includes failed media inspection, missing/invalid
|
||||
bodies, retained shared assets, revision mismatch recovery and migration.
|
||||
- Full `npm test`: 5382 passed, 84 skipped, 3 failed. The failures were the
|
||||
App question-round request wait and Electron note capture focus/layout waits.
|
||||
All three passed in targeted reruns; the full run was not all green.
|
||||
The capture rerun exercised production App/preload/IPC/SQLite and reopening.
|
||||
- `npm run typecheck` passed. Full lint still reports 10 errors in the existing
|
||||
untracked `sidebar-final-probe.ts` and `sidebar-final-run.mjs`; lint excluding
|
||||
those two files passed. No provider calls were made for these storage benchmarks.
|
||||
|
||||
## 2026-09-27: Shared Destructive Button Styles
|
||||
|
||||
The draft discard Portal now receives the global `danger-solid` styles. The
|
||||
|
||||
@@ -173,7 +173,12 @@ empty content. Failed creates leave no accepted database membership; their
|
||||
unaccepted files are removed on the next access or reopen.
|
||||
|
||||
After commit, reconciliation derives `note.json` from database membership and
|
||||
scans all retained entry files before removing unreferenced assets. Manifest or
|
||||
inspects all retained entry files before removing unreferenced assets. Startup
|
||||
repair reads each current body once to inspect its revision and collect asset
|
||||
references, then passes the complete per-note reference set to reconciliation.
|
||||
If media inspection fails, cleanup uses its existing deferred retry path rather
|
||||
than trusting a partial set. Revision mismatch recovery still hydrates the body;
|
||||
legacy conversion still verifies its written content. Manifest or
|
||||
GC failures log `console.warn` with the note ID and error and remain in an
|
||||
in-memory retry set. Later database access retries; reopening derives cleanup
|
||||
again from membership. These cleanup failures do not turn a committed save,
|
||||
|
||||
Reference in New Issue
Block a user