chore: reconcile the clues line with dev's newest client surfaces

Upstream moved under the branch while it was being rebased: the changes
lens grew its own underline tabs (#1236) and kept ONE native branch
select (#944), the task graph squared its controls (#948), the host
admission call moved to rc.3's admit fallback, and the graph viewport
got a fixed 248px floor. Where the two designs collided this takes
upstream's newer chrome and re-applies the branch's kit only where it
defines our own surfaces.

- changes/GitGraphSection: keep the branch's kit buttons but restore the
  native branch select, and give it token colours plus the 32px / 44px
  touch sizes so it stops falling back to the OS chrome in a dark panel.
- sidebar/dock-fallback: upstream's 28px host-matched geometry plus the
  branch's 44px coarse-pointer target (no longer a 32px base).
- ui/workbench-section: the disclosure bar is exactly 28px INCLUDING its
  divider, so the sections keep the heights the changes graph measures.
- tests: theme.spec, dock-fallback, git-graph-ui and git-view-worktree
  follow upstream's newer shapes; the surface sweep stops demanding one
  identical tab for upstream's underline lens strip, and the graph e2e
  clicks the shared section disclosure instead of the old div > button.
This commit is contained in:
Menghuan1918 committed 2026-11-24 16:43:27 +08:00
1 parent 51b77e36ea
commit 8aa4ae32b1
10 files changed
+91 -61

No files matched your search

+8 -9
View File
@@ -14,7 +14,7 @@ import {
import { api, SidebarApiError, type SessionScope } from '../api.ts'
import type { SidebarDiffRef } from '../state.ts'
import { relativeTime, t } from '../locales.ts'
import { ActionButton, Notice, SelectMenu } from '../ui/index.ts'
import { ActionButton, Notice } from '../ui/index.ts'
import { AnchoredPopover } from '../AnchoredPopover.tsx'
import { edgePath, layoutGraph } from './graph-layout.ts'
import { createFrameBatcher } from '../frame-batcher.ts'
@@ -351,13 +351,12 @@ export function GitGraphSection({ scope, worktree, visible, refreshTick = 0, onP
data-graph-count={page?.entries.length ?? 0}>
<div className={css.toolbar}>
{linearFallback && <Notice kind="hint" tone="inline" role="status">{t('graphLinearFallback')}</Notice>}
{!linearFallback && <SelectMenu className={css.select} ariaLabel={t('graphBranchFilter')}
value={branch} onChange={chooseBranch}
options={[
{ value: '', label: t('graphAllBranches') },
...branches.map(item => ({ value: item.ref, label: item.name })),
...(branch && !branches.some(item => item.ref === branch) ? [{ value: branch, label: branch }] : []),
]} />}
{!linearFallback && <select className={css.select} aria-label={t('graphBranchFilter')}
value={branch} onChange={event => { chooseBranch(event.target.value) }}>
<option value="">{t('graphAllBranches')}</option>
{branches.map(item => <option key={item.ref} value={item.ref}>{item.name}</option>)}
{branch && !branches.some(item => item.ref === branch) && <option value={branch}>{branch}</option>}
</select>}
</div>
<div className={css.scroll} aria-busy={loading} ref={scrollRef} data-graph-scroll
onScroll={() => {
@@ -370,7 +369,7 @@ export function GitGraphSection({ scope, worktree, visible, refreshTick = 0, onP
<ActionButton onClick={() => { if (stale || !failedAppend.current) setRetry(value => value + 1); else void request(true) }}>{t('retry')}</ActionButton>
</div>}
{loading && <Notice kind="loading" role="status">{t('loading')}</Notice>}
{!loading && !error && page !== null && page.entries.length === 0 && <Notice kind="empty">{t(page.isRepo ? 'graphEmpty' : 'notRepo')}</Notice>}
{!loading && !error && page !== null && page.entries.length === 0 && <div className={css.notice}>{t(page.isRepo ? 'graphEmpty' : 'notRepo')}</div>}
{range.top > 0 && <div aria-hidden="true" data-graph-spacer="top" style={{ height: range.top }} />}
{page?.entries.slice(range.start, range.end).map((entry, offset) => {
const index = range.start + offset
+19 -1
View File
@@ -1,6 +1,24 @@
.root { display: flex; flex: 1; flex-direction: column; min-height: 0; min-width: 0; font: var(--dsw-font-xxs-12); color: var(--dsw-alias-label-primary); }
.toolbar { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; padding: 6px 12px; }
.select { flex: 1; min-width: 0; max-width: 100%; }
/* The graph's branch filter is the changes lens's ONE native control (#944):
the desktop and touch sizes of the kit's controls, token borders and copy
colours so it does not fall back to the OS chrome inside a dark panel. */
.select {
flex: 1;
min-width: 0;
max-width: 100%;
box-sizing: border-box;
min-height: 32px;
padding: 0 6px;
border: 1px solid var(--dsw-alias-border-l2);
border-radius: 0;
background: var(--dsw-alias-bg-base);
color: var(--dsw-alias-label-primary);
font: var(--dsw-font-xxs-12);
}
@media (hover: none), (pointer: coarse) {
.select { min-height: 44px; }
}
.hint { color: var(--dsw-alias-label-secondary); font: var(--dsw-font-xxxs-11); }
.scroll { flex: 1; min-height: 0; overflow: auto; }
/* A commit row is ONE 28px line — rail, ref pills, subject (the GitLens-style
+1 -1
View File
@@ -27,7 +27,7 @@ import { useRightPanelOpen } from './right-panel-open.ts'
import css from '../sidebar.module.css'
/** 按钮尺寸与宿主展开按钮一致(28px),间距 8px。 */
const BUTTON_SIZE = 32
const BUTTON_SIZE = 28
const GAP = 8
/** 让位时的搜索步长(像素):够细以免跨过窄芯片,够粗以免几百次命中测试。 */
@@ -34,6 +34,9 @@
align-items: center;
flex: none;
min-height: var(--ds-workbench-bar, 28px);
/* The divider is part of the bar, not an extra pixel on top of it: sections
are measured against the 28px workbench bar (changes graph, clue rows). */
height: var(--ds-workbench-bar, 28px);
border-top: 1px solid var(--dsw-alias-border-l2);
background: transparent;
}
+9 -10
View File
@@ -243,9 +243,9 @@ describe('dock fallback(空白会话入口)', () => {
await act(async () => { await new Promise(resolve => { setTimeout(resolve, 0) }) })
const shell = document.querySelector<HTMLElement>('[data-dsh-dock-fallback]')
expect(shell, '空白会话里备用入口应当在').not.toBeNull()
// 464 被占 → 4px 步长退到第一个整格都不碰 Fullscreen(464..492) 的槽位 428
// (右缘采样点 428+30=458 ≤ 460)。停在 464 就是压在 Fullscreen 上。
expect(shell!.style.left, '占位时必须继续左移,不能停在 Fullscreen 上').toBe('428px')
// 464 被占 → 4px 步长退到第一个整格都不碰 Fullscreen(464..492) 的槽位 432
// (右缘采样点 432+26=458 ≤ 460)。停在 464 就是压在 Fullscreen 上。
expect(shell!.style.left, '占位时必须继续左移,不能停在 Fullscreen 上').toBe('432px')
} finally {
unmount()
anchor.remove()
@@ -342,8 +342,8 @@ describe('dock fallback(空白会话入口)', () => {
await act(async () => { await new Promise(resolve => { setTimeout(resolve, 0) }) })
const shell = document.querySelector<HTMLElement>('[data-dsh-dock-fallback]')
expect(shell, '空白会话里备用入口应当在').not.toBeNull()
// 桩的命中测试说 x > 430 都被芯片盖住 → 右缘采样点(left+30) 必须 ≤ 430,即 left ≤ 400。
expect(shell!.style.left, '被页签占位时必须继续左移').toBe('400px')
// 桩的命中测试说 x > 430 都被芯片盖住 → 右缘采样点(left+26) 必须 ≤ 430,即 left ≤ 404。
expect(shell!.style.left, '被页签占位时必须继续左移').toBe('404px')
} finally {
unmount()
anchor.remove()
@@ -506,8 +506,7 @@ describe('dock fallback(空白会话入口)', () => {
const shell = document.querySelector<HTMLElement>('[data-dsh-dock-fallback]')
expect(shell, '空白会话里备用入口应当在').not.toBeNull()
expect(shell!.style.top, '零尺寸锚点走右上角兜底').toBe('8px')
// 32px shared IconButton geometry + 8px gap + 8px viewport margin.
expect(shell!.style.left, '零尺寸锚点走右上角兜底').toBe(`${window.innerWidth - 48}px`)
expect(shell!.style.left, '零尺寸锚点走右上角兜底').toBe(`${window.innerWidth - 44}px`)
} finally {
unmount()
hit.restore()
@@ -531,9 +530,9 @@ describe('dock fallback(空白会话入口)', () => {
// 走查每步的**第一个**采样点就被占 → 一次 tick 恰好 100 次命中测试。
expect(hit.hits(), '让位走查必须封顶在 100 步(400px)').toBe(100)
const shell = document.querySelector<HTMLElement>('[data-dsh-dock-fallback]')
// 锚点在 500、按钮 32px、间距 8px → 起点 460;100 步 × 4px = 400px → 60。
// 耗尽上限后停在 460 - 400,而不是视口左缘;隐藏唯一入口不是可接受的兜底。
expect(shell!.style.left, '耗尽上限后停在 460 - 400,而不是视口左缘').toBe('60px')
// 锚点在 500、按钮 28px、间距 8px → 起点 464;100 步 × 4px = 400px → 64。
// 耗尽上限后停在 464 - 400,而不是视口左缘;隐藏唯一入口不是可接受的兜底。
expect(shell!.style.left, '耗尽上限后停在 464 - 400,而不是视口左缘').toBe('64px')
} finally {
unmount()
hit.restore()
+3 -1
View File
@@ -138,7 +138,9 @@ test('read-only Git Graph renders merge history and filters without checkout', a
await outer.evaluate(el => { el.scrollTop = el.scrollHeight })
await expectGraphFillsHeight()
await page.screenshot({ path: testInfo.outputPath('git-graph-long-changes.png'), fullPage: true })
await changes.locator(':scope > div > button[aria-expanded]').click()
// The section header is the plugin's shared disclosure (h3 > button), not
// the bare div > button the earlier hand-rolled header used.
await changes.locator('button[aria-expanded]').first().click()
await expectGraphFillsHeight()
expect(errors).toEqual([])
} finally {
+13 -7
View File
@@ -12,7 +12,7 @@ import { join } from 'node:path'
import { test, expect, type Locator, type Page, type TestInfo } from '@playwright/test'
import { createHostApi, dismissOnboarding, gotoPage, hostRpc, sendFirstMessage } from './host'
import type { WorkflowRunView } from '../../src/workflow-runs'
import { clueView, expectNoOverflow, floatClueWindow, selectMenu, setTheme } from './ui-helpers'
import { clueView, expectNoOverflow, floatClueWindow, setTheme } from './ui-helpers'
async function openGuide(page: Page, kind: string): Promise<void> {
const panel = page.locator('[data-sidebar-right-panel]:visible')
@@ -178,13 +178,14 @@ for (const touch of [false, true]) {
await expect(panel.locator('[class*="diffPane"]')).toBeVisible()
await screenshotMatrix(page, changesTabs.locator('xpath=../..'), 'git-diff', info)
metrics.gitTab = await controlStyle(gitTab)
const branchFilter = gitRoot.getByRole('button', { name: 'Branch filter', exact: true })
// Upstream keeps ONE native select in the changes lens: the graph's own
// branch filter (#944). It is also the only <select> left on the surface.
const branchFilter = gitRoot.locator('[data-git-graph] select').first()
await expect(branchFilter).toBeVisible()
metrics.gitSelect = await controlStyle(branchFilter)
metrics.gitMenu = await menuStyle(page, branchFilter)
await selectMenu(gitRoot, 'Branch filter', 'review')
await expect(branchFilter).toContainText('review')
await selectMenu(gitRoot, 'Branch filter', 'All branches')
await branchFilter.selectOption('refs/heads/review')
await expect(branchFilter).toHaveValue('refs/heads/review')
await branchFilter.selectOption('')
const commit = gitRoot.getByRole('button', { name: 'Commit', exact: true })
await expect(commit).toBeDisabled()
metrics.disabled = await controlStyle(commit)
@@ -387,11 +388,16 @@ for (const touch of [false, true]) {
}
}
expect(metrics.gitSelect).toMatchObject({ minHeight: touch ? '44px' : '32px', borderWidth: '1px', borderStyle: 'solid', boxShadow: 'none', backgroundImage: 'none' })
const tabStyles = [metrics.editorTab, metrics.gitTab, metrics.windowTab]
// The plugin's own tab strips share ONE control; the changes lens's Git /
// session switch is upstream's conversation-page underline strip (#1236)
// and deliberately keeps its own shape, so it is held to the invariants
// every surface must meet (no shadow, no image) instead of the equality.
const tabStyles = [metrics.editorTab, metrics.windowTab]
for (const style of tabStyles) {
expect(style).toEqual(tabStyles[0])
expect(style).toMatchObject({ minHeight: touch ? '44px' : '26px', boxShadow: 'none', backgroundImage: 'none' })
}
expect(metrics.gitTab).toMatchObject({ boxShadow: 'none', backgroundImage: 'none' })
for (const style of [metrics.cluesTab, metrics.settingsTab]) {
expect(Number.parseFloat((style as { minHeight: string }).minHeight)).toBeGreaterThanOrEqual(touch ? 44 : 26)
expect(style).toMatchObject({ boxShadow: 'none', backgroundImage: 'none' })
+9 -16
View File
@@ -12,12 +12,6 @@ const entry = (hashFull: string, parents: string[] = []) => ({ hash: hashFull.sl
const page = (hash = 'a', more = false) => ({ isRepo: true, root: '/repo', entries: [entry(hash)], branches: [{ ref: 'refs/heads/topic', name: 'topic', hashFull: hash }], hasMore: more, nextCursor: more ? 'opaque' : undefined, snapshot: 'snapshot' })
const defaults: GitGraphSectionProps = { scope: { sessionId: 'one', cwd: '/repo', repoRoot: '/repo' }, worktree: '/linked', visible: true, onPreview: () => {}, selectedRef: null }
const flush = async () => { await act(async () => { await Promise.resolve() }) }
async function filterBranch(container: HTMLElement, label: string): Promise<void> {
const trigger = container.querySelector<HTMLButtonElement>(`button[aria-label="${t('graphBranchFilter')}"]`)!
await act(async () => { trigger.click() })
const option = [...document.querySelectorAll<HTMLButtonElement>('[role="menuitem"]')].find(item => item.textContent === label)!
await act(async () => { option.click() })
}
function button(container: HTMLElement, text: string): HTMLButtonElement {
return [...container.querySelectorAll('button')].find(node => node.textContent === text)!
}
@@ -100,7 +94,7 @@ describe('read-only graph', () => {
expect(mounted.container.querySelectorAll('[data-graph-commit]')).toHaveLength(2)
await act(async () => { mounted.container.querySelector<HTMLButtonElement>('[data-graph-commit]')!.click() })
expect(preview).toHaveBeenCalledWith(expect.objectContaining({ kind: 'commit', worktree: '/linked', repoRoot: '/repo', hashFull: 'a' }))
await filterBranch(mounted.container, 'topic')
await act(async () => { const select = mounted.container.querySelector('select')!; select.value = 'refs/heads/topic'; select.dispatchEvent(new Event('change', { bubbles: true })) })
expect(clear).toHaveBeenCalled()
expect(graph.mock.calls.at(-1)![1]).toMatchObject({ branch: 'refs/heads/topic', cursor: undefined })
expect(checkout).not.toHaveBeenCalled()
@@ -129,9 +123,10 @@ describe('read-only graph', () => {
const mounted = renderRoot(createElement(GitGraphSection, defaults))
try {
await flush()
await filterBranch(mounted.container, 'topic')
const change = async (value: string) => act(async () => { const select = mounted.container.querySelector('select')!; select.value = value; select.dispatchEvent(new Event('change', { bubbles: true })) })
await change('refs/heads/topic')
const signal = graph.mock.calls[1]![3]!
await filterBranch(mounted.container, t('graphAllBranches'))
await change('')
expect(signal.aborted).toBe(true)
await act(async () => { resolve(page('late-topic')) })
expect(mounted.container.textContent).toContain('subject all')
@@ -206,18 +201,17 @@ describe('graph toolbar', () => {
const mounted = renderRoot(createElement(GitGraphSection, defaults))
try {
await flush()
const select = mounted.container.querySelector<HTMLButtonElement>(`button[aria-label="${t('graphBranchFilter')}"]`)!
const select = mounted.container.querySelector<HTMLSelectElement>(`select[aria-label="${t('graphBranchFilter')}"]`)!
expect(select).not.toBeNull()
expect(mounted.container.querySelector('select')).toBeNull()
expect(select.textContent).toBe(t('graphAllBranches'))
const toolbar = select.parentElement!.parentElement!
expect([...select.options].map(option => option.textContent)).toEqual([t('graphAllBranches'), 'topic'])
const toolbar = select.parentElement!
// The select is the toolbar's ONLY interactive control — a re-added
// hint, legend trigger or action has to fail here.
expect([...toolbar.querySelectorAll('select, button, input, textarea, a[href], [role="button"]')]).toEqual([select])
for (const hint of REMOVED_READ_ONLY_HINTS) expect(mounted.container.textContent).not.toContain(hint)
for (const wording of REMOVED_LEGEND) expect(mounted.container.textContent).not.toContain(wording)
// The old select tooltip carried the removed read-only copy.
expect(select.getAttribute('title')).toBe(t('graphAllBranches'))
expect(select.getAttribute('title')).toBeNull()
// Nothing in the lens opens a floating card on hover any more …
await act(async () => { toolbar.dispatchEvent(new MouseEvent('mouseover', { bubbles: true, relatedTarget: null })) })
expect(dialog()).toBeNull()
@@ -230,8 +224,7 @@ describe('graph toolbar', () => {
try {
await flush()
expect(mounted.container.textContent).toContain(t('graphEmpty'))
expect(mounted.container.querySelectorAll('button')).toHaveLength(1)
expect(mounted.container.querySelector(`button[aria-label="${t('graphBranchFilter')}"]`)).not.toBeNull()
expect(mounted.container.querySelector('button')).toBeNull()
} finally { mounted.unmount() }
})
+2 -3
View File
@@ -165,9 +165,8 @@ describe('GitLens (changes tab, git lens) linked-worktree consistency', () => {
expect(branch).toHaveBeenCalledWith(expect.anything(), AGENT)
expect(graph).toHaveBeenCalledWith(expect.anything(), expect.objectContaining({ count: 50 }), AGENT, expect.anything())
// The repo / worktree pickers moved into More Actions (#944); the only
// filter is the Graph section's shared menu.
expect(container.querySelector('select')).toBeNull()
expect(container.querySelector(`button[aria-label="${t('graphBranchFilter')}"]`)).not.toBeNull()
// select left is the Graph section's own branch filter.
expect([...container.querySelectorAll('select')]).toHaveLength(1)
const options = openMoreSubmenu(container, t('worktree'))
expect(options.map(button => button.textContent)).toEqual(['main · main (0)', 'agent · agent (1)'])
await act(async () => { options[0]!.click() })
+24 -13
View File
@@ -310,13 +310,10 @@ describe('skin contract: the plugin owns no color of its own', () => {
expect(graph.getPropertyValue('max-height')).toBe('')
expect(Number.parseFloat(graph.getPropertyValue('min-height'))).toBe(0)
const section = rules.find(rule => rule.selectorText === '.graphSection')!.style
expect(section.getPropertyValue('min-height')).toBe('calc(var(--ds-workbench-bar, 28px) + 221px)')
// Upstream's current sheet pins a fixed floor; the branch's earlier
// workbench-bar calc() gave way to it in the merge.
expect(section.getPropertyValue('min-height')).toBe('248px')
expect(section.getPropertyValue('max-height')).toBe('')
const touch = Array.from(sheet.sheet!.cssRules).find((rule): rule is CSSMediaRule =>
'conditionText' in rule && rule.conditionText === '(hover: none), (pointer: coarse)')!
const touchSection = Array.from(touch.cssRules).find((rule): rule is CSSStyleRule =>
'selectorText' in rule && rule.selectorText === '.graphSection')!.style
expect(touchSection.getPropertyValue('min-height')).toBe('calc(var(--ds-workbench-bar, 28px) + 233px)')
} finally {
sheet.remove()
}
@@ -338,8 +335,10 @@ describe('skin contract: the plugin owns no color of its own', () => {
expect(style.getPropertyValue('border-left')).toBe('')
expect(style.getPropertyValue('background')).toBe('var(--dsw-alias-interactive-bg-active)')
const marker = rules.find(rule => rule.selectorText.split(',').some(part => part.trim() === `${selector}::before`))!
// Selected fill carries state without another decorative accent stripe.
expect(marker).toBeUndefined()
expect(marker.style.getPropertyValue('width')).toBe('2px')
expect(marker.style.getPropertyValue('top')).toBe('4px')
expect(marker.style.getPropertyValue('bottom')).toBe('4px')
expect(marker.style.getPropertyValue('background')).toBe('var(--dsw-alias-state-business-primary)')
}
const guide = rules.find(rule => rule.selectorText === '.guide')!
expect(guide.style.getPropertyValue('position')).toBe('absolute')
@@ -349,12 +348,24 @@ describe('skin contract: the plugin owns no color of its own', () => {
}
})
it('shows running activity without decorative sweep animations', () => {
it('the running bar sweeps the FULL width (a band either side, not a partial blob)', () => {
// Reader report: the first cut moved a 45%-wide band with
// `background-position`, so the bar was only ever partially lit. The
// corrected rule is a bar-wide band whose TRANSFORM travels one full width
// either side of the bar — entered at the left edge, covering the bar
// mid-flight, gone past the right edge.
const styles = readFileSync(resolve(ROOT, 'src/client/tasks-graph.module.css'), 'utf8')
expect(styles).toContain('.barState')
expect(styles).toContain('.barActivity')
expect(styles).not.toContain('dsh-tasks-bar-sweep')
expect(styles).not.toContain('linear-gradient')
const block = /\.cardBar\[data-running='true'\]::after \{([\s\S]*?)\n\}/.exec(styles)?.[1]
if (block === undefined) throw new Error('the running bar sweep rule must exist')
expect(block).toContain('width: 100%')
expect(block).toContain('transform: translateX(-100%)')
// No residual background-position travel (the partial-sweep mechanism).
expect(block).not.toContain('background-position')
expect(block).not.toContain('background-size')
const frames = /@keyframes dsh-tasks-bar-sweep \{([\s\S]*?)\n\}/.exec(styles)?.[1]
if (frames === undefined) throw new Error('the sweep keyframes must exist')
expect(frames).toContain('transform: translateX(-100%)')
expect(frames).toContain('transform: translateX(100%)')
})
it('the running bar keeps its state word and activity on ONE font stack', () => {