Skip to content

feat(knowledge-network): version picker by the title, readable comparisons and a danger zone - #1310

Merged
sh00tg0a1 merged 20 commits into
mainfrom
fix/kn-version-bar-status
Nov 11, 2026
Merged

sh00tg0a1 merged 20 commits into
mainfrom
fix/kn-version-bar-status

Conversation

@sh00tg0a1

@sh00tg0a1 sh00tg0a1 commented Nov 11, 2026 •

Copy link
Copy Markdown
Member

Pull Request

What Changed

Brief description of changes:

  • Version picker beside the network's title on the overview (borderless, branch icon; its menu links only to version management); on other pages it sits in the top bar trail
  • "Publish" is a primary button with an icon, first in the title's right-hand actions
  • Comparison and publish dialogs: count chips, a rail of changed definitions grouped by kind with action badges, and a field-by-field old/new view; a definition on one side only is shown as content (its fields and a property table)
  • Version management: discard and roll back move into a danger zone styled like the console's other danger zones
  • The version views use the console's --color-* tokens (AntD --ant-* variables are not emitted here, which left them unstyled)
  • Quieter status: the read-only notice is gone; only the outdated-draft alert remains
  • A network without versions shows a picker with its running v1 and a "Publish" button: once confirmed, what it holds is kept as the running v1 and later edits go to a draft. The separate "Enable versioning" entry and dialog are removed; the versions page explains the same
  • Docs: N/A

Why

  • Related Issue: Part of feat(ontology): 本体版本与变更管理 bkn-foundry#1229 (follow-up; does not close it)
  • Related Feature: knowledge-network versioning UI
  • Background: review on the dev VM found the picker hard to find, the comparison too sparse to read, and the destructive actions next to the everyday ones. Turning versioning on is now just the first publish, so users never meet an "enable" switch.

How

  • Key implementation points: KnVersionSlot (provider, hosts and portals) places the picker and the publish action in the overview header; KnDiffSummary is rewritten on lib/kn-diff-path.ts, which splits API change paths such as data_properties[abbr].display_name into a group and a field and drops the network entry when it differs only in branch; KnVersionsPanel gains the danger zone.
  • Breaking changes (API, config, database, etc.): none.

Testing

  • Unit tests passed locally
  • Integration tests passed locally — N/A
  • Verified in test environment

Test notes: tsc -b --force, vitest run on components/versions, lib, scenes/workspace ; vitest run src/modules/knowledge-network (2732 tests), scan-hardcoded-zh and locale parity. New cases in KnVersionBar.test.tsx, KnDiffSummary.test.tsx, KnVersionsPanel.test.tsx. Checked on the dev VM in light and dark theme.


Risk & Rollback


Additional Notes

  • Screenshots, logs, documentation links, etc.: N/A

🤖 Generated with Claude Code

sh00tg0a1 and others added 14 commits November 11, 2026 10:52
…parisons

- The version bar says nothing about a draft that matches the running
  version; a draft with changes shows one line of secondary text.
- Version states, diff counts and diff actions show as a colored dot with
  text instead of filled tags.
- A comparison always reads from the older side to the newer one, so a
  pair picked newer-first no longer reports additions as removals.
- The diff counts include a change to the network itself, which the list
  already shows.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The full-width version strip above the workspace gives way to a quiet
picker right after the network's name in the top bar, as a branch picker
sits next to a repository's name. A draft that matches the running
version reads as that version; once the draft has changes the picker
says so and a publish link appears. Viewing changes, discarding them and
the version history sit behind a small menu. A read-only version keeps
one line of secondary text with the way back to the draft.

The shell gains a slot after the trail for such page controls.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
A new network starts with versioning on; the switch in the create dialog
still turns it off. A network without versioning keeps working as before,
with edits taking effect at once, and shows a quiet link to enable
versioning where the version picker would be.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…n top bar

The knowledge network workspace is a standalone page that renders its own
TopBar outside the console shell, so the trail slot was missing there and
the picker fell back to a strip above the content. The slot becomes a
provider that the console shell and the standalone workspace page both
use.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…itle

On the overview the picker now sits next to the network name, as a small
filled select with a branch icon; other sections keep it after the top
bar's trail. Drops the select's fixed width that left a gap before the
caret.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…cker

The picker beside the title loses its background and the separate more
menu: view changes, discard and history now sit under the version list.
The read-only line under a picked version goes too, since the picker
already says which version is on screen.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…ition

The publish dialog and the compare dialog list the changed definitions by
kind on the left and, for the one picked, its changes on the right: a
changed definition field by field, grouped by the property or rule they
belong to, with both versions side by side; an added or removed one as
its content, one table row per property. Field paths read as labels. The
network no longer shows as changed when only the branch each side was
read from differs. Ported from the network comparison page on the yf
release branch.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…our tokens

The version styles used antd's CSS variables, which the console does not
emit, so borders, tints, the selected definition and the status dots
fell back to nothing. They now use the console's --color-* tokens, which
also follow the dark theme. The comparison counts become small cards
with the number in its action's colour, and each changed definition
carries its action on a light tint.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…er zone

Version management keeps publishing and comparing in its summary and moves
discarding the draft and rolling back to a danger zone at the bottom,
each with what it does. The version picker keeps only a link to version
management under the list, and publishing becomes a regular-size primary
button with an icon.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
On the overview, publishing joins the network's actions on the right of
its title as the main one, and the picker stays by the title. Elsewhere
it still follows the picker in the top bar.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…'s others

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…ange

The versioning switch is removed with the server that versions every
network; turning it on by default here would only conflict with that.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@sh00tg0a1 sh00tg0a1 added the by-agent Issue or pull request produced by an agent label Nov 11, 2026

@github-actions github-actions Bot 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.

版本选择器移入标题/顶栏、差异按定义逐项展示、危险操作区三块改动逻辑自洽,未发现可确认的阻断项。剩下的是评测页没有挂顶栏插槽、只读态提示被移除、放弃草稿文案在边界版本号上不准这几处体验问题。

影响范围与未覆盖面
  • 影响范围:知识网络工作区各页的版本选择器位置、只读版本的提示方式,以及发布/对比弹窗里的差异展示都变了;评测页(/knowledge-network/workspace/:networkId/evals)的选择器会落回内容区。
  • 未覆盖:危险操作区文案描述的回退目标,没有对照后端 draft/reset 的实现核实。

待确认项(不阻断放行)

  • src/modules/knowledge-network/components/versions/KnVersionBar.tsx — 原来查看历史/运行版本时会出现「该版本只读」的 Alert 和「回到草稿」按钮,这次一并删掉了。现在 editable=false 时编辑入口会直接消失,只剩选择器上的 v1/v2 这类名字;而无改动的草稿也显示成运行版本名,用户分不清自己是在草稿里还是在只读版本里。请确认这是有意的取舍。
  • src/modules/knowledge-network/components/versions/KnVersionsPanel.tsx — 危险操作区的 discardBody 固定写成 knVersionName(running):还没发布过(running=0)但草稿已有改动时,会显示「草稿回到运行版本 v0」;草稿落后(base≠running)时,文案说回到运行版本,而顶栏写的是「基于 base」。请确认 draft/reset 不传 from_version 时,后端实际回退到哪个版本。

有异议或想再评一轮,请回复 /review——普通回帖不会触发复评,且回帖人需为本仓 OWNER/MEMBER/COLLABORATOR。

sh00tg0a1 and others added 4 commits November 11, 2026 11:26
A network gets its versions on its first edit in Studio, so there is
nothing to turn on: the version picker's "enable" entry and the enable
dialog are gone, and the versions page of a network without versions says
what its first edit does.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
A network gets its versions on its first edit; until then the picker
shows what it holds as its running v1, with the way to version management
and nothing to publish, and its versions page says so.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…k without versions

The list still says it is running, as the picker of a versioned network does.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
A network without versions keeps taking edits at once. Its version
picker now carries "Publish": once confirmed, what the network holds is
kept as the running v1 and later edits go to a draft. The versions page
says so.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…st publish

Before the first publish there is no running version, and the danger zone
said the draft goes back to "v0". It now says the draft is emptied.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@sh00tg0a1

Copy link
Copy Markdown
Member Author

On the pending items:

  • discardBody before a first publish (fixed in 022a50c): with running_version 0 the danger zone now says the draft is emptied instead of naming "v0". With the draft behind (base ≠ running), draft/reset without from_version resets to the running version on the backend (k = state.RunningVersion in ResetDraft), so "goes back to the running version" is what happens.
  • Read-only notice removed: intentional, a product decision. Outside the draft the edit entries are hidden and the picker names the version on screen.
  • Evals page without the header slot: known and minor; it keeps the picker in the content area for now.

/review

@github-actions github-actions Bot 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.

上一轮的待确认项作者都已处理或说明(discardBody 在首次发布前改为「清空草稿」,只读提示的移除属于产品取舍,评测页插槽暂不处理)。本轮新增的「无版本网络显示为 v1、首次发布即 enable」与 service 返回的 running_version=1 语义一致,没有发现新的阻断项。

影响范围与未覆盖面
  • 影响范围:未开启版本管理的网络,所有用户在标题旁都会看到 v1 选择器,有 modify 权限的用户还会看到「发布」按钮;版本页不再提供开启入口。
  • 未覆盖:首次发布之前在后端被关闭过版本管理的网络,重新 enable 后是否仍编号为 v1,没有对照后端实现核实。

有异议或想再评一轮,请回复 /review——普通回帖不会触发复评,且回帖人需为本仓 OWNER/MEMBER/COLLABORATOR。

Keep stateUnknown from #1309; backToDraft stays removed with the read-only notice.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@sh00tg0a1
sh00tg0a1 merged commit 513d447 into main Nov 11, 2026
34 of 36 checks passed
@sh00tg0a1
sh00tg0a1 deleted the fix/kn-version-bar-status branch November 11, 2026 16:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

by-agent Issue or pull request produced by an agent

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant