Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .project/governance/generated/CURRENT_STATE.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"schema_version": "work-lab-current-state/v1",
"generated_at": "2026-10-28T20:17:34.928480Z",
"generated_at": "2026-10-28T20:48:47.468519Z",
"source_digest": "e8fa215a78b6743663b96c4d35d32c69f76d5cd626b1440ab386e97951e34106",
"checkout_attestation": {
"status": "RUNTIME_REQUIRED",
Expand Down
2 changes: 1 addition & 1 deletion .project/governance/generated/CURRENT_STATE.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# WORK-LAB current state

Generated at: `2026-10-28T20:17:34.928480Z` \
Generated at: `2026-10-28T20:48:47.468519Z` \
Source digest: `e8fa215a78b6743663b96c4d35d32c69f76d5cd626b1440ab386e97951e34106` \
Content digest: `d759dd9e3382a68e5c518e598d7bbb535504ba90191365d7e50035dba5c9cb5c`

Expand Down
17 changes: 15 additions & 2 deletions apps/observer/frontend/DESIGN.md
Original file line number Diff line number Diff line change
Expand Up @@ -525,9 +525,22 @@ each one declared at the sentence rather than excused repo-wide:
`.project-local/artifacts/NARROW_BAND_ATTEMPT_20261008.diff`. **The standard row was the defect**, so
SCREEN_SPEC now states window surfaces instead of a phone band, the target rule reads 24×24 (WCAG
2.5.8) rather than the 44px figure that came with the deleted row, and the gate measures the real
floor. ERR-219 records it. What remains genuinely open is a design question the deleted row was
papering over: the rail has no per-lane icon set, so it cannot be made narrow on purpose — only by
floor. ERR-219 records it. What remained genuinely open was a design question the deleted row was
papering over: the rail had no per-lane icon set, so it could not be made narrow on purpose — only by
removing information.
**Closed on the picture half 2026-10-29, and the diagnosis changed.** `src/lib/viewRegistry.ts` had
declared one Lucide glyph per lane all along (32 rows, 30 distinct glyphs, the two repeats being the
registry's own pairing convention: `executions`/`execution-detail` share `PlayCircle`, `privacy`/`trust`
share `ShieldCheck`); the field simply had **no consumer**, so the rail painted 31 identical `.nav-dot`
circles and every source-level grep read as delivered. `src/components/layout/Sidebar.tsx` now renders
each lane's declared glyph in place of the dot. Measured on the built bundle at 1280×820: 31/31 rows
paint a glyph, label truncation 0 before and 0 after (`truncated=0` in
`.project-local/runs/live-probe-20261029/rail-before-main.json` and `rail-after-icons.json`), and the
geometry, legibility and pressed-state gates are unchanged — the glyph replaces a 10px decoration with a
15px one instead of adding to it, which is the difference between this attempt and the discarded one.
`src/laneIcons.contract.test.tsx` binds the painted row to the registry row and fails if a lane loses
its name. **What is still open is the width decision, not the icon set**: the rail may now be narrowed
on purpose, and whether to do that is an owner call about the professional shell.
11. **One role, two literals, kept equal by a guard rather than by one definition.**
`--color-bg / -sidebar / -panel / -panel2 / -border / -ink / -muted` in `src/index.css` repeat, character
for character, what `src/skins/b10.css` (`:root`) and `src/skins/l10b-shell.css` (`html.light`) declare for
Expand Down
24 changes: 18 additions & 6 deletions apps/observer/frontend/src/components/layout/Sidebar.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import * as React from 'react'
import type { LucideIcon } from 'lucide-react'
import { cn } from '@/lib/utils'
import { VIEW_REGISTRY, OVERVIEW_ID, OVERVIEW_LABEL } from '@/lib/viewRegistry'
import { VIEW_REGISTRY, OVERVIEW_ID, OVERVIEW_LABEL, OVERVIEW_ICON } from '@/lib/viewRegistry'
// WUI-01/WUI-02: the grouping is data now, and it lives in `lib/navigation` next to the statement of
// which lanes are daily destinations and which left the default nav. The rail renders that model; it no
// longer owns it, because a grouping that only a component can read cannot be asserted, searched or
Expand All @@ -16,7 +17,7 @@ import { NAV_GROUPS, DAILY_DESTINATION_IDS, isOnDefaultNav } from '@/lib/navigat
* <div><h1>WORK-LAB</h1><small>AI WORKFLOW CONTROL PLANE</small></div>
* </div>
* <div class="nav">
* <button><span class="nav-dot"></span><span>总览</span></button>
* <button><svg class="lucide-activity"></svg><span>总览</span></button>
* …
* </div>
* <div class="sidebar-footer">
Expand All @@ -29,7 +30,10 @@ import { NAV_GROUPS, DAILY_DESTINATION_IDS, isOnDefaultNav } from '@/lib/navigat
* tile, overridden in src/skins/l10b-shell.css to the 91x48 cut-out logo mark — the
* pinned skin itself stays verbatim per decision D-11) / `.nav button` (+ `.active` gradient + `::before` cyan→blue edge bar) /
* `.nav-dot` / `.sidebar-footer` / `.avatar` are all B10-verbatim in
* src/skins/b10.css. This component only supplies the data (the lanes) — the
* src/skins/b10.css. Since 2026-10-29 the rail mounts each lane's own registry glyph in place of the
* decorative `.nav-dot`; the rule stays in the pinned sheet untouched, and no lane's name was hidden to
* make room — that trade is exactly what `apps/observer/frontend/DESIGN.md` gap 10 records as the failed
* first attempt. This component only supplies the data (the lanes) — the
* groups from `lib/navigation` render as the B10 buttons, each group with its
* own labelled disclosure block so every lane on the default nav stays one click away.
*
Expand All @@ -39,6 +43,9 @@ import { NAV_GROUPS, DAILY_DESTINATION_IDS, isOnDefaultNav } from '@/lib/navigat
interface LaneDef {
id: string
label: string
// WUI-03 gap 10: the glyph comes from the registry row, not from a table kept here. A picture the rail
// invents is a second source, and the two sources drift exactly the way the three 总览 literals did (N-1).
icon: LucideIcon
}

// The rail renders every lane in NAV_GROUPS that is still on the default nav. `workflow-editor` is the
Expand All @@ -49,9 +56,10 @@ interface LaneDef {


function buildLanes(): Map<string, LaneDef> {
const map = new Map<string, LaneDef>([[OVERVIEW_ID, { id: OVERVIEW_ID, label: OVERVIEW_LABEL }]])
const map = new Map<string, LaneDef>([[OVERVIEW_ID,
{ id: OVERVIEW_ID, label: OVERVIEW_LABEL, icon: OVERVIEW_ICON }]])
for (const e of VIEW_REGISTRY) {
if (e.component) map.set(e.id, { id: e.id, label: e.label })
if (e.component) map.set(e.id, { id: e.id, label: e.label, icon: e.icon })
}
return map
}
Expand Down Expand Up @@ -157,7 +165,11 @@ function Nav({
aria-current={active ? 'page' : undefined}
className={cn(active && 'active')}
>
<span className="nav-dot" aria-hidden="true" />
{/* WUI-03 gap 10: the lane's own glyph, declared in the registry and until 2026-10-29
carried no consumer — the rail painted 31 identical `.nav-dot` circles. It replaces
the dot instead of joining it, because a second 15px box pushes more labels into
`.truncate`, and a truncated label is the information the gap said not to remove. */}
<l.icon size={15} strokeWidth={2} aria-hidden="true" data-lane-icon={l.id} />
<span className="truncate">{l.label}</span>
</button>
)
Expand Down
85 changes: 85 additions & 0 deletions apps/observer/frontend/src/laneIcons.contract.test.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,85 @@
// WUI-03 gap 10: the per-lane icon set stops being data nobody renders.
//
// `apps/observer/frontend/src/lib/viewRegistry.ts` has declared one Lucide component per lane since long
// before this test existed, and the rail painted 31 identical `.nav-dot` circles instead — a field with zero
// consumers reads as delivered in every source-level grep and as absent on the screen. These cases bind the
// painted row to the registry row, keep the lane's NAME on screen (the first attempt at this gap hid the
// labels and produced 23 indistinguishable rows; `apps/observer/frontend/DESIGN.md` gap 10 records it), and
// derive their own population from the registry so the assertions cannot run over an empty list.
import { describe, expect, it } from 'vitest'
import { render } from '@testing-library/react'
import type { LucideIcon } from 'lucide-react'
import { createElement } from 'react'
import { Sidebar } from '@/components/layout/Sidebar'
import { VIEW_REGISTRY, OVERVIEW_ID, OVERVIEW_ICON } from '@/lib/viewRegistry'
import { NAV_GROUPS, isOnDefaultNav } from '@/lib/navigation'

function railRows() {
const { container } = render(<Sidebar activeView={OVERVIEW_ID} onSelect={() => {}} />)
return Array.from(container.querySelectorAll<HTMLElement>('nav.nav button[data-lane]'))
}

function onNavLanesWithComponents() {
const ids = NAV_GROUPS.flatMap((group) => group.ids).filter(isOnDefaultNav)
const byId = new Map(VIEW_REGISTRY.map((e) => [e.id, e]))
return ids.map((id) => ({ id, entry: byId.get(id) })).filter((row) => row.entry?.component)
}

// An SVG node's `className` is an SVGAnimatedString, so the comparable thing is the `class` attribute.
const classOf = (node: Element | null | undefined) => node?.getAttribute('class') ?? ''
const iconClass = (Icon: LucideIcon) => classOf(render(createElement(Icon)).container.firstElementChild)

const REGISTRY_ICON_CLASS = new Map(VIEW_REGISTRY.map((e) => [e.id, iconClass(e.icon)]))

describe("the rail paints each lane's own declared glyph", () => {
it('the population is the rail itself, not a hand-picked sample', () => {
const lanes = onNavLanesWithComponents()
expect(lanes.length).toBeGreaterThanOrEqual(20)
const rows = railRows()
expect(rows.map((r) => r.getAttribute('data-lane'))).toHaveLength(rows.length)
// overview is a synthetic lane with no registry row; every other rail row must be in the population
for (const lane of lanes) expect(rows.some((r) => r.getAttribute('data-lane') === lane.id)).toBe(true)
})

it('every rail row carries exactly one glyph, and it is the glyph that lane declares', () => {
for (const row of railRows()) {
const id = row.getAttribute('data-lane') as string
const glyphs = Array.from(row.querySelectorAll('[data-lane-icon]'))
expect(glyphs, `lane ${id} paints no icon at all`).toHaveLength(1)
if (id === OVERVIEW_ID) {
expect(classOf(row.querySelector('svg'))).toBe(iconClass(OVERVIEW_ICON))
continue
}
expect(glyphs[0].getAttribute('data-lane-icon')).toBe(id)
expect(classOf(row.querySelector('svg'))).toBe(REGISTRY_ICON_CLASS.get(id))
}
})

it('the dot no longer rides along, so a row cannot grow two markers', () => {
const { container } = render(<Sidebar activeView={OVERVIEW_ID} onSelect={() => {}} />)
expect(container.querySelector('.nav-dot')).toBeNull()
})

it('adding a glyph never costs a lane its name', () => {
for (const row of railRows()) {
const id = row.getAttribute('data-lane') as string
const label = row.querySelector('span')?.textContent?.trim() ?? ''
expect(label, `lane ${id} lost its visible name`).not.toBe('')
expect(row.getAttribute('title')).toBe(label)
}
})

it('the rail is exactly as distinguishing as the data it renders', () => {
const painted = new Map(railRows().map((row) =>
[row.getAttribute('data-lane'), classOf(row.querySelector('svg'))]))
const declared = new Map(onNavLanesWithComponents().map((l) => [l.id, REGISTRY_ICON_CLASS.get(l.id) ?? '']))
declared.set(OVERVIEW_ID, iconClass(OVERVIEW_ICON))
// Row for row, the picture IS the registry. If someone gives two lanes one glyph by mistake the
// `declared` map still says two different things, so this fails rather than agreeing by construction.
expect(painted).toEqual(declared)
// 31 identical markers was the defect; a population that collapsed back to a handful of glyphs is
// caught by the same equality above, so the only extra floor here is that the population is real.
expect(new Set(declared.values()).size).toBeGreaterThan(1)
expect(painted.size).toBeGreaterThanOrEqual(20)
})
})
8 changes: 8 additions & 0 deletions apps/observer/frontend/src/lib/viewRegistry.ts
Original file line number Diff line number Diff line change
Expand Up @@ -172,3 +172,11 @@ export const OVERVIEW_ID = 'overview'
// 项目监控 and forbids a second home, so the id stays and the word changes. Nothing outside this
// constant may spell it: the desktop component contract fails on a second source.
export const OVERVIEW_LABEL = '项目监控'

// Same reasoning as N-1 above, one axis over: the rail needs a glyph for this lane and the lane has no
// registry row to declare it, so the icon lives beside the label rather than being minted inside the
// component (a glyph chosen in a component is a second source that can drift from the registry's set).
// It borrows 监控's `Activity` instead of taking a 31st glyph, which is the convention the registry already
// uses for paired surfaces (`executions` and `execution-detail` share `PlayCircle`; `privacy` and `trust`
// share `ShieldCheck`).
export const OVERVIEW_ICON = Activity
2 changes: 1 addition & 1 deletion docs/audits/TOOL_INVENTORY_2026-10-07.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"schemaVersion": "work-lab/tool-inventory/v1",
"generatedAt": "2026-10-28T19:56:51Z",
"generatedAt": "2026-10-28T20:48:02Z",
"generatedBy": "scripts/audit/tool_inventory_readback.py",
"scope": [
"scripts/audit/",
Expand Down
Loading
Loading