Skip to content

refactor: 清理死代码、无效测试与归档(约 −4.7 万行,行为不变) - #45

Merged
surfine merged 10 commits into
mainfrom
cleanup/dead-code
Dec 2, 2026
Merged

surfine merged 10 commits into
mainfrom
cleanup/dead-code

Conversation

@surfine

@surfine surfine commented Dec 2, 2026 •

Copy link
Copy Markdown
Owner

What changes / 改了什么

清理低价模型留下的死代码与无效测试,产品行为不变。共约 −4.7 万行:app 代码 −584 行、测试约 −500 行,其余是三个 archive 目录。

按 commit 分:

  1. 无任何引用的声明(19 处):产品与测试都不用的常量、属性、方法。
  2. LatestFrameMailbox:最低系统提到 macOS 15 后调用方已全删,只剩测试。
  3. 重复定义:终端 App 清单、耳朵透明度、最小形宽、刘海一排圆角/格宽各有一份产品不用的副本;删副本,测试不再断言两份抄来的常量相等。
  4. 只复述实现的断言:queryBudget、droppedBytes、evictions、activeSlotCount、usesSharedTap、notchDraws 及其专用访问器;无调用方的 CrashTrap.axRef。
  5. 产品另有实现或纯 helper(28 处):能改验真实实现的断言改过去(quantity.drawing、dividerXs、SystemIslandPolicy.yields、WindowBrowserStatusPresentationFactory、keyPress、SwellKick 采样峰值),其余删除。
  6. 写了测试、从没接进产品的 10 项功能代码:审批卡 2 分钟缩回、音乐右耳剩余时间、岛贴边平移、拖窗靠近刘海时提醒变点、授权确认的按键新鲜度(宿主层)、欢迎窗日历权限行、Raycast 别名、钥匙串存不了的文案、空的滚轮白名单。以后要做时按规格重写,不从历史恢复。
  7. tests/、tools/、docs/ 下的 archive:文档链接改指 026091e9 的永久链接;一并删掉读归档清单的 tests/vm/run-updater-phase3-1018.sh。

刻意保留:规划中路线(WS2Silent*、遥控/配对、CarPlay、认出你、电量)的未接骨架;能抓到真实回归的测试访问器;FrameRhythmAnalysis(tools/probes/README.md 留给 MO-02)。

Reviewer 注意:滚轮白名单为空且 WS2InputController 写死 confirmedWheel: nil,滚动平滑和反向永远装不上,但设置里仍有开关——本 PR 只删空白名单,是否补核对或撤掉设置项需另定。

How I checked / 怎么验证的

  • cd prototype && ./build.sh --check passes(scripts/local-gate.sh check 全部通过,含 doc-links)
  • scripts/local-gate.sh unit --jobs 6:261 项全部通过(跳过 0)
  • Tried on a real Mac:未跑 L3 签名探针;本 PR 只删产品不调用的代码,执行路径不变
  • New user-facing text:无新增
  • Interface change:无

🤖 Generated with Claude Code


Note

Low Risk
Mostly deletions and documentation; low runtime risk aside from force-unwrap changes in ArrangeController if empty collections can still occur at runtime.

Overview
Large hygiene refactor that removes ~47k lines without intended product behavior changes: deleted docs/archive/ (and related tests/archive/ / tools/archive/ content), trimmed unused Swift and test-only code, and rewired doc links to permanent GitHub URLs at git commit 026091e9 instead of in-tree archive paths.

App / prototype changes are mostly deletion of unreachable code and tightening call sites: removed unused AppNapActivity.releaseBase(), dropped dead CountdownTimerSettings.chimeKey, simplified CalendarPresenter arc drawing, and replaced several ?? fallbacks with force unwraps in ArrangeController where callers already guarantee non-empty collections.

Docs now state archives live only in history; code-map.md, testing.md, known-failures.md, and release cross-links follow the same pattern. tests/vm/run-updater-phase3-1018.sh was removed with the archived appcast drafts it depended on.

Reviewed by Cursor Bugbot for commit e21dd02. Bugbot is set up for automated code reviews on this repo. Configure here.

surfine and others added 7 commits December 2, 2026 08:11
产品代码和测试都不引用的常量、计算属性与方法,连同提到它们的过期注释。

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
最低系统提到 macOS 15 时旧系统的主线程投递路径已删,这个邮箱从那以后只剩测试在用。

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
终端 App 清单、耳朵透明度、最小形宽和刘海一排的圆角/格宽各有一份产品不用的副本;
删副本,测试不再断言两份抄来的常量相等。

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
queryBudget、droppedBytes、evictions、activeSlotCount、usesSharedTap、notchDraws 只给测试读,
断言等于把实现再写一遍;axRef 没有调用方。notchDraws 的断言改为直接验 visible。

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
28 处只给测试用的声明:产品已有另一套实现(菜单动态行、日程唤醒、键线渐变、状态文案、
刘海一排竖线等)或纯 helper(系统岛 tag、动画解析峰值、文件架名称省略等)。
能改验真实实现的断言改过去(quantity.drawing、dividerXs、SystemIslandPolicy.yields、
WindowBrowserStatusPresentationFactory、keyPress、SwellKick 采样峰值),其余随之删除。

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
审批卡 2 分钟缩回、音乐右耳剩余时间、岛贴边平移、拖窗靠近刘海时提醒变点、
授权确认的按键新鲜度、欢迎窗日历权限行、Raycast 命令别名、钥匙串存不了的文案、
空的滚轮白名单。产品从未调用它们;以后要做时按规格重写。

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
约 4.5 万行已完结轮次的证据快照、一次性研究探针和旧版发布关文档,不参与构建和门禁。
文档里的链接改指 git 历史 026091e 的永久链接;一并删掉只为 1.0.18 发布关写的
tests/vm/run-updater-phase3-1018.sh(读的正是归档里的清单草稿)。

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@cursor

cursor Bot commented Dec 2, 2026

Copy link
Copy Markdown

Bugbot couldn't run - usage limit reached

Bugbot is counted against Cursor usage for this user or team, and this run hit a usage or spend limit.

A user or team admin can review and increase usage limits in the Cursor dashboard.

(requestId: 0e16d8a7-c184-4051-8c5a-02c6029a6d98)

- 删掉值永远不变的开关:FileDragSensor.shelfEnabled、
  WS2HookConfigPreview.writesUserHome、IdentityEvidenceBar.requireCalibratedThreshold、
  ScreenCaptureBridge.deliverMain、ActionBar.showsMoreButton、NotchLevelControl.wantsKeyboardLight
- 删掉没人接的回调与功能:加速度计设置页状态刷新、WS2FocusEffectExecutor.onBlocked、
  FoldRenderer.motionX/Y、手柄扳机阻力反馈
- 去掉调用方已保证的夹值与空检查:网格列数 max(1,…)、p95 下标、音量二次夹值、
  ArrangeController 的 ?? 兜底、NotchRow 负宽度、缩略图尺寸 isFinite 等
- 测试同步删掉只验证这些兜底的断言

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
surfine and others added 2 commits December 2, 2026 16:00
restTuckAdmitted 恒为 false,休息时整屏收起与任意键放回的全局监听从未运行:
.tuckAll 改为直接跳过,删掉 FocusRestReturnMonitor 及其测试与隐私登记。
admitted 恒为 true,删掉两处永远通过的检查。行为不变。

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@surfine
surfine merged commit 28cf7e7 into main Dec 2, 2026
10 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