refactor(frontend): 消融 #1546 projects port 死面(净 −880 行/31 文件)——portProjectsEnabled = Boolean(port) && !projects 在两个 shell 的所有可达状态恒为 false(shell 只在 hubReady 注入 port,而此时 projects 必为数组),故端口取数/游标分页/load-more 重试/端口建改与 ProjectNav sentinel UI 全部结构性不可达;按 S2 要求另开 #2290 登记 live 路径分页缺口 - #2291
Merged
Conversation
…rtProjectsEnabled = Boolean(port) && !projects 在 hubReady 的两种取值下恒为 false(shell 只在 hubReady 时注入 port,而此时 projects 必为数组),于是端口内部取数/游标分页/load-more 重试/端口建改与 ProjectNav 的 sentinel UI 全部结构性不可达;删端口契约 + 两个平台适配器及其测试 + hook 的 144 行端口分支 + 8 处 prop 管道 + 分页 UI + 2 个只被死 UI 用的 i18n 键 + 死 CSS 类 + 0 消费者的 resolveHubProjectsDefault(31 文件净 −879 行,可达行为逐条对照未变) Co-authored-by: Cursor <cursor@vectorcontrol.tech>
|
Important Review skippedAuto reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Team Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
DeliciousBuding
enabled auto-merge (squash)
September 3, 2026 13:54
This was referenced Sep 3, 2026
DeliciousBuding
added a commit
that referenced
this pull request
Sep 4, 2026
…ale coverage exclude(语义裁决见 ADR-034) round-74 普查(lane-artifacts/round-74/b6-vocabulary-survey.md,526 行)+ 主机独立 复核确认的事实:Hub 的 workspace/project **没有 status 事实**(model/service/ handler/openapi/migration/live DB 六处逐字一致,live 表仅 6 列),而 UI 的 status filter 100% 前端内存过滤、三个同名 mapper 产 5 个与 Hub 交集为 ∅ 的词。 因此「让筛选对真实 Hub 数据成立」在没有 L3 事实源之前不可达——语义部分交 operator 裁决(ADR-034,DEFERRED 带触发条件),本批只做不需要裁决的四件事: 1. 删 app/workbench/src/hubDataMapping.ts 的 workspaceProjectToProjectInfo: 它把每个 Hub 项目硬编码成 status:'Active'(Hub 侧不存在的词)。#2291 删掉它 唯一调用者后成为 0 非测试消费者孤儿;desktop 只 import 编排函数 (resolveHubProjects 等)并传自己的本地 mapper,web 用自己的副本——主机已逐 import 复核。连带删除仅被它使用的 formatProjectDate。 2. 修 hubDataMapping.test.ts 的错误注释:它宣称「Desktop 用 resolveHubProjects + workspaceProjectToProjectInfo」,正是这句错注释让孤儿活了下来;resolveHubProjects 是纯编排器,测试改用 stub mapper(−4 例)。 3. openapi 枚举对齐 0074 的真实取值域:team run status 补 pending_review(×2)、 assignment type 补 compete(×3),与 model 常量及 0074 CHECK 逐字一致。漂移根因 登记进 ADR-034:现有 3 个 verifier 只比路由形状与「2xx 有没有 schema」,不比字段 集/enum(openapi-schema-baseline.json 逐字 [])。 4. 清 app/workbench/vitest.config.ts coverage 对 src/workbenchProjectsPort.ts 的 stale exclude——该文件已被 #2291 删除。 验收:workbench typecheck 绿 + 25/25;三包全量 workbench 1712 / web 270 / desktop 4975 全绿;本地复跑 checks.yml validate job 62 条命令 PASS=62 FAIL=0。 Refs #2274 (B-6) Co-authored-by: Cursor <cursor@vectorcontrol.tech>
DeliciousBuding
added a commit
that referenced
this pull request
Sep 4, 2026
…ale coverage exclude(语义裁决见 ADR-034) (#2316) round-74 普查(lane-artifacts/round-74/b6-vocabulary-survey.md,526 行)+ 主机独立 复核确认的事实:Hub 的 workspace/project **没有 status 事实**(model/service/ handler/openapi/migration/live DB 六处逐字一致,live 表仅 6 列),而 UI 的 status filter 100% 前端内存过滤、三个同名 mapper 产 5 个与 Hub 交集为 ∅ 的词。 因此「让筛选对真实 Hub 数据成立」在没有 L3 事实源之前不可达——语义部分交 operator 裁决(ADR-034,DEFERRED 带触发条件),本批只做不需要裁决的四件事: 1. 删 app/workbench/src/hubDataMapping.ts 的 workspaceProjectToProjectInfo: 它把每个 Hub 项目硬编码成 status:'Active'(Hub 侧不存在的词)。#2291 删掉它 唯一调用者后成为 0 非测试消费者孤儿;desktop 只 import 编排函数 (resolveHubProjects 等)并传自己的本地 mapper,web 用自己的副本——主机已逐 import 复核。连带删除仅被它使用的 formatProjectDate。 2. 修 hubDataMapping.test.ts 的错误注释:它宣称「Desktop 用 resolveHubProjects + workspaceProjectToProjectInfo」,正是这句错注释让孤儿活了下来;resolveHubProjects 是纯编排器,测试改用 stub mapper(−4 例)。 3. openapi 枚举对齐 0074 的真实取值域:team run status 补 pending_review(×2)、 assignment type 补 compete(×3),与 model 常量及 0074 CHECK 逐字一致。漂移根因 登记进 ADR-034:现有 3 个 verifier 只比路由形状与「2xx 有没有 schema」,不比字段 集/enum(openapi-schema-baseline.json 逐字 [])。 4. 清 app/workbench/vitest.config.ts coverage 对 src/workbenchProjectsPort.ts 的 stale exclude——该文件已被 #2291 删除。 验收:workbench typecheck 绿 + 25/25;三包全量 workbench 1712 / web 270 / desktop 4975 全绿;本地复跑 checks.yml validate job 62 条命令 PASS=62 FAIL=0。 Refs #2274 (B-6) Co-authored-by: DeliciousBuding <DeliciousBuding@users.noreply.github.com> Co-authored-by: Cursor <cursor@vectorcontrol.tech>
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.
做了什么
端到端删掉 #1546 的
WorkbenchProjectsPort死面:31 files changed, 58 insertions(+), 938 deletions(-)(净 −880 行)。这是 #2274 里 C-3 / S2 记的「本 issue 行数最大的一块死结构」,删前已在真实树上重做可达性核实(issue 是索引不是事实源)。删除清单:
app/workbench/src/workbenchProjectsPort.ts(整文件)、index.ts的WorkbenchProjectsPage/WorkbenchProjectsPort导出app/web/src/platform/webWorkbenchProjectsPort.ts+ 其测试、app/desktop/src/platform/desktopWorkbenchProjectsPort.ts+ 其测试、两个App.tsx的 import/useMemo/prop(含 web 侧因此变成未使用的tCommon)useWorkbenchProjectsRoute.ts298 → 154 行:端口内部取数状态、游标/hasMore/loadingMore/loadMoreError 及其 refs、loadProjects、loadMore、端口版 create/update、unmount 守卫AgentHubWorkbenchTypes、workbenchFrameTypes、WorkbenchFrame、workbenchFramePartsHelpers、AgentHubWorkbenchHelpers、workbenchRoutesTypes、WorkbenchRoutes(8 处)ProjectNav的 IntersectionObserver sentinel + loadingMore 通知 + loadMoreError/重试按钮、ProjectsPage与pages/projects/types.ts的 4 个分页 props、workbenchRoutesHelpers的分页映射、ProjectsPage.module.css的.sentinel规则projects.loadMoreError、projects.retryLoadMore(zh + en,只被上面那块死 UI 用;projects.loading保留,live 的加载态在用)hubDataMapping.ts的resolveHubProjectsDefault(0 个真实消费者,只有它自己的测试)+ 该测试块可达性证明(为什么这是死面而不是「还没接上的功能」)
关键一行在
useWorkbenchProjectsRoute.ts:两个 shell 的注入方式(改前原文):
而
resolveWebWorkbenchProjects/resolveHubProjects的返回值:hubReady=true时恒为数组((projects ?? []).map(...),空数组也是 truthy);hubReady=false时是undefined(mock/fixture 模式)或[]。同时两个 model 都是projectsActions = hubReady ? {create, update} : undefined。hubReadyprojectsPortprojectsportProjectsEnabledport.listProjectsport.createProject/updateProjectportProjectsEnabled为门)if (onProjectCreate) return onProjectCreate(draft),hubReady 时回调必存在)[]if (!projectsPort) return)⇒ 端口分支在两个 shell 的所有可达状态下都不执行。下游同理:
loadMore恒undefined、hasMore恒false、loadingMore恒false、loadMoreError恒undefined,所以ProjectNav的 sentinel(if (!sentinel || !hasMore) return)与重试按钮也永不渲染。两个 shell 的注释自己就承认了这件事(改前原文):"Injected only in real mode — parent-managed projects keep the port dormant while demo mode falls back to mock fixtures."
逐条行为等价审计(删掉的每个分支在可达状态下的常量值)
sourceProjectsprojects ?? (false ? portProjects : (realDataMode ? [] : MOCK))projects ?? (realDataMode ? [] : MOCK)— 同值effectiveProjectsStatusprojectsStatus ?? (false ? portProjectsStatus : undefined)projectsStatus— 同值canMutateProjectBoolean(onProjectCreate ?? onProjectUpdate ?? projectsPort);hubReady 时前两者必有、demo 时三者皆无Boolean(onProjectCreate ?? onProjectUpdate)— 同值handleProjectCreate/UpdateloadMore/hasMore/loadingMore/loadMoreErrorundefined/false/false/undefined证据(主机实跑)
用例数账(诚实记):净 −19 例,全部只断言被删代码——workbench 1722→1714(端口驱动 describe 的 11 例:8 例随代码删除,3 例改写成父级驱动版本保留,另新增 1 例「mutation affordance 只来自父级回调」);desktop 435→430(适配器测试整文件 5 例);web 271→265(适配器测试整文件 6 例)。
workbenchRoutesHelpers.test.ts里 2 处props.hasMore/onLoadMore断言随字段删除而去掉(用例本身保留)。contacts/tasks 的分页测试未触碰(那是活面)。关联
ProjectInfo.status语义未触碰,本轮只删死面)pageSize: 50且不读nextCursor、desktop 连pageSize都不传,服务端支持游标 + 上限 200)⇒ 第 51 个项目起静默不显示。删除前后用户可见行为一致(以前也不显示),但现在缺口是显式的而不是藏在一条永不执行的代码里。Negative constraints(刻意没做)
pages/projects/**的 UI、状态过滤([整理] 静态审计 backlog 跟踪(探索 lane 剩余项) #2154 P2-3)、编辑器、以及两个 shell 自己的 projects 查询与 mutations。workspaceProjectToProjectInfo副本(app/web/src/platform/webWorkbenchProjects.ts与workbench/src/hubDataMapping.ts各有一份、签名不同:web 版多projectGroups投影)——那是另一条手抄分岔,需要自己的一批与实测,已在hubDataMapping.test.ts的头注里点名登记。src行为。