Repository navigation
refactor(src,ci): 拆分 UI 路由与 Profile 写编排,压缩注释,deploy.yml 大 shell 移到 tools/ - #16
Merged
Merged
Conversation
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
leeefun
added a commit
that referenced
this pull request
Oct 6, 2026
…ell 检查 评审反馈(#16): - deploy.yml 的 paths 漏了 tools/ci/** ⇒ 只改 CI 脚本不会触发部署。补上。 - quality.yml 新增 'bash -n tools/ci/*.sh':这三个脚本是部署实质逻辑,不在 tsc/eslint 射程内,改坏了 PR 仍可能全绿。 - profile.ts 的 saveAndNotifyCurrentProfile 是拆分后的遗留重复(零调用者), 删掉;唯一实现在 profileWrite.ts。随之清掉不再使用的 import。 - profile.ts 的 'export { BadRequestError, basename }' 是兼容 re-export,与本次 干净切换目标相悖;删掉,test/limits.test.ts 改为直接从 ../src/db 取 BadRequestError。 - shared.ts 从 279 行收窄到 19 行:单消费端 helper 各回其领域文件 (deployment*/readDeletedFlagOr400/readIntParam → info.ts;readCredentials → routes.ts; Range 三件套 → history-data.ts;UI_TEXT_CREATE_MAX_BYTES/mapLimit/并发常量 → history-mutations.ts);只留 2+ 消费端的 parsePathIds。 验证:tsc 0、eslint 0、bash -n 全过;全量 22/22·497 通过;V1/V2 探针 findings=0。
leeefun
added a commit
that referenced
this pull request
Oct 6, 2026
评审指出:#16 基于旧 master,其 historyOps.ts / routes(移动后) 仍是裸的 deleteHistoryWorkingDir,没有 #13 的 best-effort 语义 ⇒ 若 #16 先合会退掉 #13。 本提交把 #13 的改动原样前向移植(使 #16 rebase 时无实质冲突): - src/historyOps.ts:deleteRecordsWorkingDirs 改 best-effort(catch + '[cleanup] deferred R2 cleanup')。 - src/ui/routes/history-mutations.ts:batch-purge 单条 R2 删失败不再把整批变 500。 - test/fixes.test.ts:FakeBucket.failDelete 注入 + 三条用例(purgeTrash/clearAllHistory/阳性对照)。 - docs/design.md §6:登记删除成功语义。
…ools/
结构与注释精简,不改行为:
- src/ui/routes.ts(964)拆成装配点(117)+ src/ui/routes/{shared,history-data,
history-mutations,info}.ts;20 条路由与 test/ui-guard 的 EXPECTED_API_ROUTES 逐字一致。
- src/profile.ts(759)拆成共享原语(201)+ src/profileWrite.ts(PUT 编排)+
src/profileHistory.ts(POST 编排);调用方(routes/*、test/*)随迁,无 re-export 垫片。
- src/**、src/durable/** 注释压缩:删日期/审计编号/已删除文档引用/修前故事,保留当前不变式。
- wrangler.toml:删资源创建史/事故史/日期/费用推导,保留绑定、默认值与易踩的 CF 特性。
- deploy.yml(486→206):把 Resolve resources / Resolve switches / Smoke check 三个大 shell
移到 tools/ci/*.sh,workflow 只留步骤名与 env;vars 名单、schema 迁移步骤与顺序、守卫目标串不变。
- README/design.md/ui.md:目录树与模块表随拆分更新。
验证:tsc 0 错、eslint 0 告警、bash/sh -n 全过、三个 CI 脚本按输入实测(非法值当场失败、
缺地址报错)、smoke-check 对本地实例跑通(全部资产 200 + 鉴权/统计/profile 断言)。
完整套件 22/22、497 用例通过(dev server 8787)。
…ell 检查 评审反馈(#16): - deploy.yml 的 paths 漏了 tools/ci/** ⇒ 只改 CI 脚本不会触发部署。补上。 - quality.yml 新增 'bash -n tools/ci/*.sh':这三个脚本是部署实质逻辑,不在 tsc/eslint 射程内,改坏了 PR 仍可能全绿。 - profile.ts 的 saveAndNotifyCurrentProfile 是拆分后的遗留重复(零调用者), 删掉;唯一实现在 profileWrite.ts。随之清掉不再使用的 import。 - profile.ts 的 'export { BadRequestError, basename }' 是兼容 re-export,与本次 干净切换目标相悖;删掉,test/limits.test.ts 改为直接从 ../src/db 取 BadRequestError。 - shared.ts 从 279 行收窄到 19 行:单消费端 helper 各回其领域文件 (deployment*/readDeletedFlagOr400/readIntParam → info.ts;readCredentials → routes.ts; Range 三件套 → history-data.ts;UI_TEXT_CREATE_MAX_BYTES/mapLimit/并发常量 → history-mutations.ts);只留 2+ 消费端的 parsePathIds。 验证:tsc 0、eslint 0、bash -n 全过;全量 22/22·497 通过;V1/V2 探针 findings=0。
评审指出:#16 基于旧 master,其 historyOps.ts / routes(移动后) 仍是裸的 deleteHistoryWorkingDir,没有 #13 的 best-effort 语义 ⇒ 若 #16 先合会退掉 #13。 本提交把 #13 的改动原样前向移植(使 #16 rebase 时无实质冲突): - src/historyOps.ts:deleteRecordsWorkingDirs 改 best-effort(catch + '[cleanup] deferred R2 cleanup')。 - src/ui/routes/history-mutations.ts:batch-purge 单条 R2 删失败不再把整批变 500。 - test/fixes.test.ts:FakeBucket.failDelete 注入 + 三条用例(purgeTrash/clearAllHistory/阳性对照)。 - docs/design.md §6:登记删除成功语义。
rebase 到新 master 时,core.autocrlf=true 把三个 CI 脚本重新落成 CRLF,会让 Linux 上的 GitHub Actions bash 直接语法错误(自动换行把 set -euo pipefail 与 函数定义的解析打乱)。加 .gitattributes 显式锁定 *.sh 为 LF,并 renormalize 三个脚本。 已核对:全新 checkout 后三者均为 LF,WSL 真 bash 下 bash -n 与 resolve-switches 实跑通过。
leeefun
force-pushed
the
chore/source-slimming
branch
from
October 7, 2026 00:33
676d177 to
b2aed81
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
改动(结构 + 注释精简,不改行为)
1. 源码历史注释
src/**、src/durable/**:删日期、审计编号(F-x / P1 / R-x / §)、ADR 当历史标记、"修前/实测"故事、指向已删除文档的引用、已关闭 issue 编号;保留当前不变式与非显然理由(含 Cloudflarecompatibility_date——那是当前平台 API 边界,不是项目历史)。2.
wrangler.toml删资源创建史、事故史、日期、长篇费用推导;保留绑定、默认值、变量含义与容易踩坑的 Cloudflare 特性(账户实测事实另见
docs/free-plan-account-facts.md,不复制回 TOML)。3.
.github/workflows/deploy.yml(486 → ~210 行)把三个大 shell 移到
tools/ci/*.sh,workflow 只留步骤名与 env:未引入 composite action、未自造 Actions 框架。
vars:名单、schema 迁移步骤与顺序、test/docs.test.ts守卫的目标串全部不变。配套:
paths增加tools/ci/**(否则只改 CI 脚本不会触发 Deploy);quality.yml增加bash -n tools/ci/*.sh(这三个脚本不在 tsc/eslint 射程内);.gitattributes锁定*.sh为 LF(core.autocrlf=true会把它们落成 CRLF,在 Linux bash 上是语法错误)。4. 克制的代码拆分
src/ui/routes.ts(964)→ 装配点(145)+src/ui/routes/{shared,history-data,history-mutations,info}.ts;shared.ts只留 2+ 消费端 的parsePathIds(20 行),其余单消费端 helper 各归其领域文件。src/profile.ts(759)→ 共享原语(185)+src/profileWrite.ts(PUT 编排)+src/profileHistory.ts(POST 编排);删掉拆分遗留的重复saveAndNotifyCurrentProfile与兼容用 re-export。cleanup.ts、SyncClipboardHub.ts、db.ts不拆(复杂度属同一资源/状态模型)。调用方(
routes/*、test/*)随迁,无 re-export 垫片。验证
tsc --noEmit0 错;eslint0 告警;bash -n tools/ci/*.sh通过(WSL 真 GNU bash 5.2 实测)。test/ui-guard.test.ts的EXPECTED_API_ROUTES逐字一致。resolve-switches正常/非法输入分支正确;resolve-resourcesmock 网络跑通全分支;smoke-check对本地实例全绿。合并方式
Squash and merge:本 PR 的中间过程(初版拆分 → 修 shared/CI/重复函数 → 清注释 → rebase 解决冲突)不进 master,只留一个最终结构性提交。