refactor(frontend): 消融前端死表面与两端契约分岔——收回 136 处 0 消费者 export(13 处连实现删)+ web/desktop 4 条契约收敛到单一来源 + 21 处过期注释/路径订正(净 −119 行) - #2279
Merged
Conversation
|
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 09:00
DeliciousBuding
force-pushed
the
refactor/fe-ablation-round69
branch
from
September 3, 2026 09:18
96b6785 to
ce2d741
Compare
…C-4 清单逐条复核:每个符号仅本文件内使用、全仓代码/注释/barrel 均无外部消费(自建扫描器逐一验证未照抄车道结论);公共 barrel 未收录任何一个;删后 @agenthub/shared 与 @agenthub/workbench typecheck 均绿 (#2274) Co-authored-by: Cursor <cursor@vectorcontrol.tech>
…BottomSheet.motion 3 常量、theme/motion resolveMotionTiming、hubClientTeamTypes 4 个无人消费的兼容别名、hubWS 两个从未被引用的内部事件名常量(同步修正 HubWSGapPayload 的文档注释,不再点名已删常量)、surfaceMetadata getSurfaceByWebRoute、e2eDataModeContract isE2ERequestAllowed(isBoundaryAllowed 仍有他处消费,保留)、workbenchApprovalEvents ApprovalJumpDetail;shared/workbench/mobile-rn typecheck 均绿 (#2274) Co-authored-by: Cursor <cursor@vectorcontrol.tech>
….ts 与 index.ts 不再点名 #2151 已删除的 edge-server/internal/diff(改为陈述 TS 侧实现、无 Go 对应物,并指出现存 Go 侧只有 surfacing_diff.go 生成器与 diff_apply.go 应用器);normalizeEdgeEvents.test.ts 注释改为真实发射点 parser_ndjson_parse_msg.go:29,68(事件名常量 orchestration/contracts.go:163);vitest.config.ts 删掉不存在的 src/mock.ts 覆盖排除项及其编造的理由注释;normalizeHubMessages.ts pin 溯源注释重写为实况(REST 消费方 desktop useHubPinnedMessages / web useWebWorkbenchModel,WS 帧驱动 pinMap store,结论 HubMessage.pinned 不加保留) (#2246) Co-authored-by: Cursor <cursor@vectorcontrol.tech>
…rm.ts 复审触发条件内联为可核验判据(Mobile Hub client 暴露 approval/runtimeEvidence/sandbox 契约或接通远程执行时再重新评估);同文件 mobileFriendlyError.ts 主机已修,未动 (#2246) Co-authored-by: Cursor <cursor@vectorcontrol.tech>
…ench/src/(D-11)——真实文件为 app/workbench/src/{RightInspector,AgentHubWorkbench}.tsx(已 ls 证实),测试断言与夹具两侧同步改,互相钉死的关系保留;shared+workbench 全量测试通过 (#2246)
Co-authored-by: Cursor <cursor@vectorcontrol.tech>
…P_EVENT 常量,改为点名真正的投递口 HubWSHandle.onGap(desktop hubEventBridge.ts:466 与 web webHubRealtime.ts:322 都只经 onGap 消费它,事件名常量从加入起就没有任何引用) (#2274) Co-authored-by: Cursor <cursor@vectorcontrol.tech>
判据:全仓 grep(含 test/barrel/md)除定义外 0 引用;以 typecheck + lint 双验证。
- 79 处:仅删除 export 修饰符(符号仍在定义文件内使用,例如
DesktopPlatform/AppLanguage/UpdateExecutionTargetRequest 等)。
- 23 处:删修饰符后变成未使用(eslint no-unused-vars 报错,typecheck 未开
noUnusedLocals 故以 eslint 为准),连实现一并删除:
app/desktop/src/api/agentProfileQueries.ts:useHubCreate/Update/DeleteAgentProfile
app/desktop/src/api/edgeClient.ts:deleteThreadPin、pinThreadItem
app/desktop/src/api/hubQueries.ts:WorkspaceProjectPage
app/desktop/src/platform/desktopPlatform.ts:desktopAgents、desktopConversations、
desktopTranscript、resolveDesktopPreviewTranscript + 随之无用的 import/const
(demoWorkbenchAgents、resolveDemoWorkbenchTranscript、WorkbenchAgent、
TranscriptBlock、WORKBENCH_DEMO_FALLBACK_CONVERSATION_ID、
DESKTOP_FALLBACK_CONVERSATION_ID)
app/desktop/src/stores/modelSettingsStore.ts:DEFAULT_MODEL_ALIASES、
DEFAULT_CC_SWITCH_PROVIDER_STATUS、obscureApiKey、revealApiKey、maskApiKey、
CREDENTIAL_SALT(原仅经 export 组导出且 0 消费者)
app/web/src/api/agentQueries.ts:createDefaultAgentProfileRequest
app/web/src/api/projectQueries.ts:useCreateHubWorkspaceProjectThread、
useSendHubWorkspaceProjectThreadMessage
app/web/src/api/runEventReplay.ts:getRecoveryState、replayGapBlock、RecoveryState import
app/web/src/config.ts:EVENT_LOG_MAX
app/web/src/i18n/index.ts:setLanguagePreference
app/web/src/platform/useWebWorkbenchModel.ts:webHubEmptyContacts(re-export 行)
- 验证:pnpm -r typecheck 5 包全绿;web test 271 passed;desktop test 458 passed;
web lint 0 problems;desktop lint 10 problems(6 errors+4 warnings)与改前基线
完全一致(4 条 warning 未增减);git diff --check 干净。
Co-authored-by: Cursor <cursor@vectorcontrol.tech>
- 原注释点名的 edgeEventBridge.ts 全仓从未存在(grep 仅此 1 命中即注释本身), 会把读者引向空文件;真实入口是 platform/useDesktopEdgeEvents.ts + api/eventClient.ts(createEventStream 建流)。改为点名真实路径。 Co-authored-by: Cursor <cursor@vectorcontrol.tech>
- app/desktop/src/components/LoginForm.tsx:32-48:catch 块对齐 web
LoginForm——OidcError 走 t('auth.error.oidc.<code>', { defaultValue:
t('auth.error.oidc.default') }),非 OidcError 走 t('auth.error.oidc.default'),
删除直出 err.message 的通道与硬编码英文 defaultValue 'Login failed'。
键在 desktop locale 双语均已存在,defaultValue 原本就是不可达的死字面量。
- app/desktop/src/__tests__/LoginForm.test.tsx:改了两条断言并点名理由——
原 'shows TokenDance errors from the auth hook' 与 'falls back to the
localized unavailable error...' 断言的是旧缺陷行为(alert 里出现原始
'Hub login unavailable' / 'auth.error.tokenDanceUnavailable'),本次改为
钉住修复后行为(auth.error.oidc.default,且不含原始串),并新增一条
OidcError 码解析断言;未删除任何用例,未放宽。
Co-authored-by: Cursor <cursor@vectorcontrol.tech>
…D-P2-3) - 删除 app/web/src/api/hubClient.ts 里的 AgentInstance / PendingAgentTask 两个 interface(与 shared hubClientTeamTypes.ts:606-634 逐字全等)。 - 消费方(webPlatform.ts:17,20)经 export * from '@shared/hub/hubClient' 解析到 shared 的 AgentInstance/PendingAgentTask 别名,值逐字相同, 0 个消费者的 import 需要改;shared 侧给 Hub* 加字段时 web 将出现编译错误, 不再静默漂移。 - 关于牵出的 6 对同名镜像测试(hubClient/hubAuth/hubTokenStorage/useAuth/ AuthPage/ThemeContext .test.*):逐对 diff 复核后确认**不是副本** (行数/断言均不同,各自钉 web 包装器与 desktop 客户端的表面行为), 因此无测试可合并/删除——本次未删任何测试;证据见 round-69 lane-E REPORT 第 3 节。 Co-authored-by: Cursor <cursor@vectorcontrol.tech>
…p 的 online 改计 healthy (#2256 D-P2-1/D-P3-1) - app/web|desktop/src/api/hubClient.ts:ExecutionTargetHealthState 去掉 '... | string'(字面量被吸收、白名单零类型安全的根因),收成服务端 target_health.go 取值域的 8 项联合;ExecutionTargetTrustLevel 收成 4 项联合。 - app/web/src/api/executionTargetQueries.ts:healthStates 白名单补 'registered'(已绑定但尚无存活证据的正常生命周期态),与 desktop 对齐 (8 项);新增测试钉住 registered 透传而非落入 unknown。 - app/desktop/src/api/executionTargetQueries.ts:summarizeExecutionTargets 的 healthy 分支补 'online'(与 web 口径一致,online 不再落入 unknown)。 - app/desktop/src/api/hubClient.ts:toSharedTarget/包装器参数改用 shared 的 HubExecutionTargetRequest 契约(desktop 本地 shape 可赋值给它), 收紧类型后的 contravariance 编译红以此修掉,不改任何收窄结论。 - 待产品裁决(未发明):desktop 是否补 mismatch/stale 计数、web 是否去掉, 见 round-69 lane-E REPORT。 Co-authored-by: Cursor <cursor@vectorcontrol.tech>
D-P1-3) - fetchExecutionTargets 从单次 pageSize=50 改为与 desktop 同策略的 cursor 循环(50×10);循环耗尽返回 hasMore:true,避免第 51 台起静默截断。 - 纯收敛,仅改 app/web 侧,shared 不动。 - 关于 executionTargetQueries.test.ts:24 的 ?pageSize=50 断言:实测收敛后 **并未变红**——该断言断言的是第一页 URL,而 qs() 不序列化 undefined, 第一页 URL 仍为 ?pageSize=50。因此本条**未改该断言**(它仍然钉住第一页 URL,不是错误断言),只新增两条断言钉住多页 cursor 与 500 上限行为; 无任何断言被放宽。 Co-authored-by: Cursor <cursor@vectorcontrol.tech>
…eateDefaultAgentProfileRequest 是它在全仓的唯一消费者(app/web/src/api/agentQueries.ts 里那句 t?.('agents.newDefault', { index }) ?? `新 Agent ${index}`,也正是 #2278 特意保留 t 参数的那一个 mapper),函数一走这个键就成了死键,被 verify-i18n-deadkeys.py 的 fail-closed 门禁抓到;两侧同时删,不走 baseline 登记(它不是动态键,是彻底的孤儿)
明卷:
- python3 scripts/verify/verify-i18n-deadkeys.py -> 通过
- 两个 bundle json.load 校验通过
- 主机在主 checkout 的合并树上复跑 validate job 的全部 62 条命令:仅本条与 commit-message 门禁两处红,其余 60 条全绿
Co-authored-by: Cursor <cursor@vectorcontrol.tech>
…tion.ts 的 resolveMotionTiming、cd3b7a4b 删掉 web api/hubClient.ts 的本地 DTO 副本后各留下一个文件尾空行,被 validate 的 Check whitespace(git diff --check "origin/master...HEAD")判红;两条 lane 各自只跑了 git diff --check(工作树,无 range)所以都没看见 Co-authored-by: Cursor <cursor@vectorcontrol.tech>
DeliciousBuding
force-pushed
the
refactor/fe-ablation-round69
branch
from
September 3, 2026 09:30
ce2d741 to
7375132
Compare
This was referenced Sep 3, 2026
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.
这个 PR 做什么
前端消融批:把「导出但全仓 0 消费者」的公共表面收回去,并把 web / desktop 两端各抄一份、且已经分岔的契约收敛到单一来源。净 −119 行(78 文件,+327/−446)。
两条 lane 写集不相交(A:
app/{shared,workbench,mobile-rn};E:app/{web,desktop}),主机已在主 checkout 里把两条分支合到一棵树上跑完真实门禁后才开这个 PR。A 半:死表面(
app/shared、app/workbench、app/mobile-rn)export修饰符(18 文件,实现保留)。判据:符号仅本文件内使用,全仓代码/注释/barrel/测试 0 外部消费。BottomSheet.motion3 个常量、theme/motion.resolveMotionTiming、hubClientTeamTypes4 个无人消费的兼容别名、hubWS2 个从未被引用的内部事件名常量、surfaceMetadata.getSurfaceByWebRoute、e2eDataModeContract.isE2ERequestAllowed、workbenchApprovalEvents.ApprovalJumpDetail。diff.ts/index.ts不再点名 #2151 已删除的edge-server/internal/diff;vitest.config.ts删掉不存在的src/mock.ts排除项及其编造的理由;normalizeHubMessages的 pin 溯源注释重写为实况;14 处测试里的旧路径字面量app/shared/src/workbench/→app/workbench/src/;mobile-rn 去掉指向仓外一次性 lane 工件的裸BLOCKED.md指针。HubWSGapPayload头注仍点名同批删掉的HUB_WS_GAP_EVENT,改为点名真正的投递口HubWSHandle.onGap。刻意没删:
COMPOSER_APPROVAL_MODES(composerApprovalMode.ts:50)虽然仍 0 消费者,但 #2277 明确把它重构成「唯一来源」(从APPROVAL_MODE_ROWS派生)而不是删掉,属设计意图,不逆操作。E 半:两端契约分岔(
app/web、app/desktop)hasMore(此前 web 侧静默截断)。registered,两端去掉| string吸收(它会让任何拼错的态静默通过),desktop 的online改计入healthy。web/hubClient.ts删掉 shared DTO 的本地副本,不再遮蔽 SSOT 同名别名。err.message直出给用户。hubEventBridge头注指向真实 Edge 事件入口(断链修复)。export修饰符;其中 23 处删修饰符后暴露no-unused-vars,连实现一起删。真实验证(主机在主 checkout 的合并树上跑,node_modules 是真的)
lane 侧各自还跑过:
@agenthub/workbench全量 168 文件 / 1717 用例通过(A 分支上,其中RuntimeBrandIcon.test.tsx出现过一次 vitest 池级超时,单独复跑 7/7 通过 9.12s,判定为 4 核机 worker 启动 flake);web lint 0 problems;desktop lint 10 problems(6 errors + 4 warnings,与改前基线逐条一致,未加重,desktop lint 在 CI 里是 advisory,理由见 #2278)。暗卷(主机自跑):对 C-2 删掉的 13 个符号逐个
git grep -w复核,前端侧全部 0 命中;TeamTaskDependencyState/HumanReviewState/TeamRouteAuditState/HumanReviewChange的剩余命中全部在hub-server/internal/model/agent_team_state.go与api/openapi.yaml,即被删的只是 TS 侧无人消费的兼容别名,Go 侧同名真身与其消费者不受影响。未做 / 待裁决(不在本 PR 内)
app/web/src/i18n/index.ts:38的?? 'en'(D-6):属 web 写集但两条 lane 都判定需要口径裁决,未动。mismatch/stale:产品裁决,未发明。shared/ui+workbench,未列全)。本 PR 只处理有清单依据的那批;320 条是纯修饰符 churn,是否扩圈另开 issue 裁决。Refs #2274
Refs #2256
Refs #2246