From 86f0b4bd20cdec86dfb5bdb7978d1f6ff4af111a Mon Sep 17 00:00:00 2001
From: Ariver <shanghai3168@gmail.com>
Date: Fri, 14 Aug 2026 22:41:54 +0800
Subject: [PATCH] [verified] feat: export performance diagnostics

---
 C1.source/CODEGRAPH.md |   33 +++++++++++++++++++++++++++++++++
 1 files changed, 33 insertions(+), 0 deletions(-)

diff --git a/C1.source/CODEGRAPH.md b/C1.source/CODEGRAPH.md
index bb59b00..fc72b95 100644
--- a/C1.source/CODEGRAPH.md
+++ b/C1.source/CODEGRAPH.md
@@ -25,6 +25,7 @@
 - 功能系列:`0.1.x`
 - 当前可核对 tag:`v0.1.13-build20260814.0445`
 - 最近本地验收候选包:`0.1.13 / 20260814.0445`
+- 当前开发变更:`0.1.14 / 20260814.2230` 本地性能诊断包,尚未形成新的冻结基线。
 - 最后冻结前验证:2026-08-14,`swift build`、`swift test`、`round1-app-shelf-fixture-qa.sh`、DMG 挂载元数据检查和 mounted App `codesign --verify --deep --strict` 通过;用户实测两行 App Shelf 遮挡问题已解决。
 - 发布事实:`0.1.13` 是本地验收通过的代码冻结 / rollback baseline;不是正式官网 release,Developer ID、notarization、staple、Gatekeeper、下载源和正式发布 manifest 仍未闭环。
 - Git 根目录:`/Users/ar/Projects/Aligner/03-O`
@@ -59,6 +60,7 @@
 | `QuickSwitch.Spaces` | Space 枚举、窗口 Space 归属、Space 激活 | `Sources/Aligner/Infrastructure/PrivateAPI/SkyLightSpaceEnumerator.swift` |
 | `QuickSwitch.ThemeAndSettings` | 视图模式、主题、设置持久化、Settings 入口 | `Sources/AlignerCore/Preferences/AlignerPreferences.swift` |
 | `QuickSwitch.TriggerAndPermissions` | 快捷键、权限、Force Quit 放行、权限窗口 | `Sources/Aligner/AlignerApplicationDelegate.swift` |
+| `Diagnostics.PerformanceExport` | 性能事件循环日志、跨机器诊断包导出和归档结构 | `Sources/Aligner/DevelopmentDiagnostics.swift` |
 | `QuickSwitch.Screenshots` | 真实截图、ScreenCaptureKit、骨架 fallback | `Sources/AlignerCore/Screenshots/ScreenCaptureKitScreenshotProvider.swift` |
 | `Commerce.Entitlement` | Round01.5 试用、授权、Pro feature gate 模型 | `Sources/AlignerCore/Commerce/` |
 
@@ -110,6 +112,37 @@
 - `../C2.builds/Z-研发中间产物/qa-reports/round01-overlay-qa-report.json`
 - `../C2.builds/Z-研发中间产物/qa-reports/round01-close-card-confirmation-report.json`
 
+## Node: Diagnostics.PerformanceExport
+
+职责:
+
+- 保留最近的结构化性能事件,并在用户遇到卡顿后导出本地 zip 诊断包。
+- 汇总版本、硬件、显示器、权限、偏好、最近 Quick Switch 阶段耗时,以及应用名称和窗口数量。
+
+核心文件:
+
+- `Sources/Aligner/DevelopmentDiagnostics.swift`
+- `Sources/Aligner/PerformanceDiagnosticsExporter.swift`
+- `Sources/Aligner/QuickSwitchSessionController.swift`
+- `Sources/AlignerCore/Diagnostics/PerformanceDiagnosticArchiveWriter.swift`
+
+关键入口:
+
+- `AlignerApplicationDelegate.exportPerformanceDiagnostics()`
+- `QuickSwitchSessionController.performanceDiagnosticSummary()`
+- `PerformanceDiagnosticArchiveWriter.write(...)`
+
+已保护行为:
+
+- 导出使用最近一次已加载的 Quick Switch 快照;不得为了导出再次触发窗口枚举、截图或 Space 查询。
+- 诊断包允许包含应用名称、bundle identifier、进程 ID 和窗口聚合数量;不包含窗口标题、窗口截图或键入内容。
+- 日志写入与归档在 UI 主线程之外执行,且沿用已有 10MB 循环日志上限。
+
+QA 入口:
+
+- `Tests/AlignerCoreTests/AlignerCoreTests.swift`
+- `swift test`
+
 ## Node: QuickSwitch.Snapshot
 
 职责:

--
Gitblit v1.9.3