fix(docs): 修 6 处指向不存在实体的文档硬伤——迁移文件名、ACP 审批链(Responder 在 edge-server 0 命中)、SDK 适配器注册事实(sdkAdapterIDs/IsSDKAdapter 0 命中)、run.error→run.failed、projectQueries 归属 Web,并把 known-flaky 自写的 300 行拆分阈值对齐门禁真实的 170(5 文件净 0 行) - #2289
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 13:07
Co-authored-by: Cursor <cursor@vectorcontrol.tech>
…ies 归属 Co-authored-by: Cursor <cursor@vectorcontrol.tech>
Co-authored-by: Cursor <cursor@vectorcontrol.tech>
DeliciousBuding
force-pushed
the
docs/hygiene-round71
branch
from
September 3, 2026 13:29
70c266b to
10541f2
Compare
This was referenced Sep 3, 2026
DeliciousBuding
added a commit
that referenced
this pull request
Sep 3, 2026
…ktop 9 处「打不中任何缓存条目」的失效按各 handler 语义重指到真实键(用户可见后果:desktop 已读回执此前不刷新任何缓存、未读角标一直陈旧),并收敛两端分岔的会话列表键与私设字面量(#2261) (#2306) ## 缺陷本体(实测,不是推断) `invalidateQueries` 是**前缀匹配**,而 `['hub','threads','detail',<id>]` 既不是 `['hub','threads',<id>,'messages']` 的前缀、也不是任何 shell 真实注册的键 ⇒ `hubEventBridge.ts` 里 9 处失效**匹配不到任何缓存条目**: - 5 处语义上该刷会话列表(`onMessageNew` 的 last-message 预览与未读数、`onMessageRead` 的 unread_count、`onSessionMemberJoined`/`Left` 的成员数、`onSessionInfoUpdated` 的 名称头像)→ 改指 `hubQueryKeys.threads.list`; - 4 处**冗余**(紧邻的真键已覆盖)→ 直接删:`onMessagePin`/`onMessageUnpin` 上一行就是 `threads.pins(sessionId)`;`onSessionDissolved` 两行后是宽前缀 `threads.root`(它同时 覆盖 list/messages/pins);`onAgentDone` 下一行就是 `threads.messages(threadId)`。 用户可见的那一条是 `onMessageRead`:它的注释原文写着「read receipts affect thread-level unread_count → invalidate thread detail」,而它**只**失效这一个幽灵键 ⇒ desktop 上收到 已读回执不刷新任何缓存、未读数保持陈旧。与 #2252 修掉的 6 处 MESSAGE_* 失效同一故障 模式,只换了个键。 同时删掉 `threads.all(projectId)`:**hub 家族**的它同样是幽灵(生产 0 消费者——唯一在用的 `threads.all` 是 `desktop/src/api/threadQueries.ts:18` 的 **edge** 家族,那一族有真消费者、 一字未动),且它无参时返回值 == `root`,正是「拿 root 当查询键」这条被 ADR-029 禁掉的形状。 ## 两端分岔收敛(同一个后端集合 `/client/sessions`,此前两个键) - 新增 `hubQueryKeys.threads.list = ['hub','threads','list']`,并在 queryKeys.ts 就地写下 canonical 形状(root 只作宽失效前缀、集合用 list、子资源必须有工厂、无消费者的工厂不得存在)。 - desktop `sessionQueries.ts` 的私设 `hubSessionsListKey = ['hub','sessions']` → `threads.list` (平台包不得私设 key 数组);同文件 `queryKey: ['hub','threads',sessionId,'pins']` 字面量 → `threads.pins(sessionId)` 工厂。 - web `contactQueries.ts` 的 `sessionsQueryKey = hubQueryKeys.threads.root` → `threads.list`。 这一条正是分岔的根因:同一个 `root` 前缀在 web 承担「会话列表」、在 desktop 承担 「所有 transcript」,于是「刷新会话列表」在两端语义相反。 ## 测试(`desktop/src/stores/hubEventBridge.test.tsx` 新增 7 例,14/14 全绿) 断言链**刻意做成两环**,因为用自造键播种的测试什么都证明不了(#2252 的原始教训): ① `sessionQueries.test.tsx` 钉住 live 的 `useHubSessions` 注册的正是 `threads.list`; ② 本套件钉住 bridge 对 5 类帧(MESSAGE_READ / MESSAGE_NEW / SESSION_MEMBER_JOINED / SESSION_MEMBER_LEFT / SESSION_INFO_UPDATED)失效的正是同一个工厂键 ⇒ 合起来才是 「帧落在 UI 真读的那个缓存条目上」。另加 MESSAGE_PIN → `threads.pins` 命中, 以及一例把「幽灵工厂不许回来」钉死(`threads.detail` / `threads.all` 必须 undefined、 `list` 形状正确、root 仍是 list 的前缀所以宽失效不退化)。 被改到的既有断言只有**钉字面量**的那些,行为断言一条未动: `queryKeys.test.ts` 的 `threads.detail`/hub 侧 `threads.all` 形状断言(工厂已删)、 `sessionQueries.test.tsx` 的 `SESSIONS_LIST_KEY`(从私设字面量改为工厂,反而更强: 它现在钉的是「hook 的键 == 共享工厂」)、`normalizeHubMessages.ts:90` 注释里点名的 `threads.detail`(改成 `threads.messages`,避免留下指向已删实体的注释=#2289 那一类)。 ## 门禁 三个包 typecheck 干净(删掉两个工厂**没有**造成任何编译错误,这本身就是「0 消费者」的 机器证明);`@agenthub/shared` src/stores **87 例**、desktop src/api+src/stores **14 文件/182 例**、web src/api+src/platform **20 文件/199 例**全绿;本地复跑 validate 结果见 PR。 Refs #2261(S1 裁决 = ADR-029,已落 docs/decisions.md) 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.
做了什么
文档屎山批(round-71):把活跃文档里指向不存在实体的 6 处硬伤改成事实,并修掉 1 处「文档自己写的规则与门禁不一致」。5 files changed, 6 insertions(+), 6 deletions(-) —— 全是同行替换,不增行(各文件仍在自己的行数预算内)。
docs/architecture/05-deployment.mdhub-server/migrations/0062、00630062_agent_team_runs_indexes.up.sql、0063_agent_run_events_unique_seq.up.sqlls hub-server/migrations/两个文件都在 ✅docs/architecture/03-runtime-adapters.mdrequest_permission→Responder→ brokersession/request_permission→PermissionDecisionBroker(RequestPermission桥接)git grep Responder -- edge-server= 0 命中;acp.go:122-124、acp_client.go:46写的正是session/request_permission → RequestPermission✅sdkAdapterIDs,IsSDKAdapter()返回 true」anthropic-sdk/openai-sdk,由cmd/agenthub-edge的registerSDKAdapters按--anthropic-sdk-path/--openai-sdk-path注册git grep "sdkAdapterIDs|IsSDKAdapter"= 0 命中;adapter_registry.go:62,140=registerSDKAdapters✅docs/architecture/06-auth-identity.mdprojectQueries.ts)」projectQueries.ts是app/web侧app/desktop/src/api/projectQueries.ts不存在,app/web/src/api/projectQueries.ts存在 ✅docs/architecture/11-protocol-capability-mapping.mdrun.errorrun.failedapi/events.md、edge-server/internal/httpserver/server.go、lifecycle/*用的都是run.failed;run.error在api/、edge 生产代码里 0 命中 ✅docs/governance/known-flaky.mdverify-doc-ssot.py行数预算)时拆分」verify-doc-ssot.py:304="docs/governance/known-flaky.md": 170;文件当前 167 行 ⇒ 原文档给的自拆阈值比门禁晚 130 行,按它做必然先撞门禁 ✅普查分母(车道实测,主机抽查复核)
internal/testkit、chore(frontend): 消融 4 个必红且零消费者的 format 门禁——app 的 prettier --check 实测 870/1137 个被跟踪 ts/tsx 不合规、desktop 79 个,CI/Makefile/scripts/verify 从不调用;删脚本 + 2 处随之零消费者的 prettier devDep(lockfile 同步,frozen-lockfile rc=0),.prettierrc 保留给编辑器 #2287 的format脚本与 prettier devDep)在活跃文档里零引用。门禁(主机独立复跑)
行数预算最紧的 5 个文件(改后仍在预算内):
05-deployment200/200、11-protocol200/200、04-frontend150/150、developer-quickstart170/170、07-design141/150。暗卷:植入 2 个假实体(
DockerfileX路径 +doRequestWithRetryX符号)后,扫描器输出PATH_MISS/SYM_MISS两条红;revert 后复跑 0 命中 ⇒ 扫描方法不是摆设。只报未做(需要裁决或属技术口径讨论)
docs/decisions.md里的deployments/dev/(历史裁决的条件句,不是当前路径声明)、EnvSanitizer概念标签、Available=false伪代码、05-deployment的ACCESS EXCLUSIVE锁技术口径(要不要细化到「哪些表多大」需实测数据)、ArtifactCard功能代称、以及docs/archives删留 / Mobile 口径 / owner 取值域(#2258、operator 裁决)。诚实记账
任务书里写的自测文件名
scripts/verify/tests/verify-doc-ssot.Tests.py在本仓全历史都不存在;真实的 doc 门禁自测是verify-doc-entrypoints.Tests.py(主机已复跑 rc=0)。这是任务书的错,不是车道的错,记在这里避免下一轮再抄错。