Skip to content

fix(panel): 知识库侧栏入口跟着开关走(#685) - #689

Merged
modusensus merged 1 commit into
mainfrom
fix/685-kb-seat
Nov 13, 2026
Merged

modusensus merged 1 commit into
mainfrom
fix/685-kb-seat

Conversation

@modusensus

@modusensus modusensus commented Nov 13, 2026 •

Copy link
Copy Markdown
Member

为什么

#685:关掉知识库(kbEnabled)之后,侧栏还留着「知识库」那一格入口,点进去只有空态。

知识库是三个可选功能里唯一把侧栏图标与主座位都无条件注册的,与仓库地志(choro)的「关着就不注册座位」不一致——这正是 2026-11-11 定的口径。这条修反转了 #598 评论区第四节里「入口常驻 + 空态自解释」的那一半。

改了什么(dsh-mneme/lib/client.js)

  • 侧栏那一格(sidebar.panellist / id: "dsh-mneme-kb")从 panellist 块里的无条件注册移进独立的座位闸:与 choro 同一形态——同一个 /api/dsh-mneme/features 端点、同样 fail-closed(读不到就不注册,不猜)、同样读到 kbEnabled 才 ctx.slots.register。
  • disposeKbGlyph 与它在清理回调里的调用一并删掉:登记现在归座位闸的 ctx.effect 管,与本回调的成对座位不同源。
  • 主座位(main / key: "dsh-mneme-kb")仍无条件注册。这是 feat(panel): 记忆库搬进宿主原生面板位(sidebar.panellist + main),老宿主保留回落 #562 那堵墙:布局里存着 activePanelId="dsh-mneme-kb" 的宿主,少注册 main 会在 selectPanel 时直接抛。所以「关着就不注册座位」在这里落成「侧栏没有入口、点不进去」,与 wiki 座位同一处理。

验证

  • dsh-mneme/test/client.test.js 改两条:原来锁「kb 在 panellist 块里成对注册」的用例改写为锁「图标在闸里、主座位保留」;座位计数 2→1。
  • 单文件 144/144 通过;全量 3488 tests / 3487 pass / 0 fail / 1 skip;check-sync ✓ 125。
  • 变异自证:① kbEnabled 判断改成 if (false) → 新用例红;② 往 panellist 块插回一行无条件注册 → 新用例 + 座位计数用例一起红。

Ref #685

Summary by CodeRabbit

  • 功能调整
    • 知识库侧栏入口现在受功能开关控制:开关启用时显示;关闭或无法获取开关状态时不显示。
    • 知识库主面板仍保持注册,不受侧栏入口开关影响。

Copilot AI lite review requested due to automatic review settings November 13, 2026 06:38

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has insufficient remaining quota.

An organization owner can choose the repository organization as the billing source for reviews requested by members with a paid Copilot license. Learn about Copilot code review billing.

@coderabbitai

coderabbitai Bot commented Nov 13, 2026 •

Copy link
Copy Markdown

Explain Change →

No actionable comments were generated in the recent review.

Walkthrough

知识库主面板仍无条件注册。侧栏入口现在由 /api/dsh-mneme/features 返回的 effective.kbEnabled 控制;读取失败或开关关闭时,不注册该入口。测试更新了清理逻辑和新宿主的注册预期。

Changes: 知识库侧栏入口门控

Layer / File(s) Summary
分离主面板与侧栏入口注册
dsh-mneme/lib/client.js, dsh-mneme/test/client.test.js
知识库 main 面板保持无条件注册。客户端仅在 effective.kbEnabled 为真时注册知识库侧栏入口;特性读取失败时不注册。清理逻辑和测试同步更新。

Estimated code review effort: 2 (Simple) | ~12 minutes

Change: Bug fix

Possibly related issues

  • slow-stack/mneme#685:该 issue 描述 kbEnabled 为 false 时知识库侧栏入口仍显示;本次改动增加了由该开关控制的入口注册。

Suggested reviewers: heptaspirit

Merge Risk: Minimal · up to 8495a

The knowledge-base sidebar entry now appears only when the feature is enabled, and the main panel stays registered so saved layouts still load. No concrete merge-blocking risk was found.

Pre-merge checks: Passed 4

Check name Status Explanation
Description Check Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check Passed 标题“fix(panel): 知识库侧栏入口跟着开关走(#685)”指出了主要变更:知识库侧栏入口现在随 kbEnabled 开关显示或隐藏。变更摘要与目标说明都描述了同一个行为,即仅在 kbEnabled 为真时注册侧栏入口,主面板仍无条件注册。标题简短,并使用 fix(panel) 前缀标明范围。不过标题中的编号 #685 与目标说明中的 PR #689 不一致,这一点需要作者确认,但它不影响…
Linked Issues check Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check Passed Check skipped because no linked issues were found for this pull request.
Full details: Title check

Explanation

标题“fix(panel): 知识库侧栏入口跟着开关走(#685)”指出了主要变更:知识库侧栏入口现在随 kbEnabled 开关显示或隐藏。变更摘要与目标说明都描述了同一个行为,即仅在 kbEnabled 为真时注册侧栏入口,主面板仍无条件注册。标题简短,并使用 fix(panel) 前缀标明范围。不过标题中的编号 #685 与目标说明中的 PR #689 不一致,这一点需要作者确认,但它不影响标题与变更内容的相关性判断。

Finishing Touches

Generate unit tests (beta)

  • Commit to this branch
  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Warning

Some tools did not complete. Review the errors below.

ast-grep (0.51.1)

dsh-mneme/lib/client.js

ast-grep timed out on this file

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.

Share

Recent review info

Run configuration

Commits

Reviewing files that changed from the base of the PR and between ea4ac5b and 8495a92.

Files selected for processing: 2

  • dsh-mneme/lib/client.js
  • dsh-mneme/test/client.test.js

Included review availability: This review used your included allowance. Your plan provides up to 2 included reviews per hour; 0 remain after this review.

用户 2026-11-13 反馈:关掉知识库后侧栏仍留着入口。

知识库是三个可选功能里唯一图标与主座位都无条件注册的,与日记本、
仓库地志的「关着就不注册座位」不一致。这里把侧栏图标移进 features
闸(fail-closed,取不到开关就当没开),主座位保持无条件——#562 的
墙:布局里存着 activePanelId 的宿主,少注册主座位会在切面板时抛。

这反转了 #598 评论区第四节的另一半。
@codecov

codecov Bot commented Nov 13, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

@modusensus
modusensus merged commit 9beec0a into main Nov 13, 2026
13 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.

2 participants