Skip to content

feat(sidebar): add project-grouped session view mode - #510

Merged
Astro-Han merged 5 commits into
apache:mainfrom
sunheyi6:feature/session-folders
Jul 5, 2026
Merged

Astro-Han merged 5 commits into
apache:mainfrom
sunheyi6:feature/session-folders

Conversation

@sunheyi6

@sunheyi6 sunheyi6 commented Jul 4, 2026 •

Copy link
Copy Markdown
Contributor

Project-Grouped Session View

Adds a sidebar view mode that groups visible sessions by their session cwd/project path, alongside the existing status-grouped view.

Changes

  • Adds a status/project view-mode toggle in the sidebar
  • Derives both status and project groups from the filtered visible session set
  • Adds an unassigned-project fallback bucket for sessions without cwd
  • Keeps the existing SessionHistoryList fallback grouping path intact
  • Adds behavior/contract coverage for project groups, pending-send fallback, and shared visible-session derivation

Review requested: @Astro-Han

@sunheyi6
sunheyi6 force-pushed the feature/session-folders branch from 11a1348 to 18e46f0 Compare July 4, 2026 12:12

@Astro-Han Astro-Han left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

结论

  • 合并判断:需修后再合并
  • 建议 review 状态:Request changes
  • 主要原因:这个 PR 同时混了“按项目/cwd 自动分组”和“用户自定义文件夹”两套产品语义,主路径没接通,当前也 build 不过。

P0 阻塞项

  • 未发现 P0。

P1 阻塞项

  • P1:产品语义需要先收敛。当前 PR 混用了“按 cwd 的项目分组”和“用户手动文件夹分组”两套模型

    • 证据:PR body 提的是 Session Folder View Mode,新增了 SessionFolder、folders.json、folderId、folder CRUD、moveSessionToFolder;但 deriveSessionFolderGroups 又会把没有 folderId 的 session 按 session.cwd 自动归到 cwd group。
    • 问题:用户看到“按文件夹”时,行为同时包含手动 folder 和自动项目/cwd group,归属规则不清晰;后续也会把“项目管理”和“手动分类”绑在一起,产品和数据模型都会变重。
    • 建议:V1 先做更常见、边界更清楚的“按项目分组”:按 session 的 cwd/workspace 自动分组,提供“按当前模式 / 按项目”切换。先砍掉 SessionFolder、folders.json、folderId、folder CRUD 和“移动到文件夹”。如果以后要做用户自定义收藏夹/文件夹,另开 PR 单独设计。
  • P1:当前 PR 自身 build 不过

    • 证据:在 PR worktree 里执行 node ../../worktree-bootstrap.mjs,@maka/desktop build:main 报错:Property 'cwd' does not exist on type 'SessionSummary'。
    • 位置:apps/desktop/src/renderer/session-folder-grouping.ts 直接读取 session.cwd,但 SessionSummary 类型没有该字段。
    • 建议:如果走“按项目分组”,需要先明确 project/cwd 信息是否应该进入 SessionSummary,并由 session read model 稳定提供;如果不走 cwd 分组,就删掉这段自动 cwd grouping。
  • P1:renderer 调用了不存在的 Electron bridge,folder 主路径跑不通

    • 证据:app-shell.tsx 调用 window.maka.folders.list();app-shell-session-row-actions.ts 调用 window.maka.sessions.setFolder(...) 和 window.maka.folders.create/rename/remove/setCollapsed(...),但 main.ts、preload.ts、global.d.ts 都没新增对应的 IPC handler、preload API 和类型。
    • 影响:即使 UI 渲染出来,点击创建、重命名、删除、移动 folder 也会直接失败。
    • 建议:若按项目分组做 V1,删掉这些 folder CRUD / setFolder 的 bridge 需求;若坚持用户文件夹,必须补全 main/preload/global 类型和边界测试。
  • P1:UI 只传了 props,没有真正渲染 folder 功能入口

    • 证据:SessionHistoryList 只新增了 viewMode、folders、folderActions、onMoveToFolder 的 props 类型;实际 render 里仍只渲染原来的 session groups 和置顶/重命名/归档/删除四个 row actions,没有“按文件夹/按项目” toggle,也没有 create/rename/remove folder 或 move menu。
    • 影响:PR 声称的 folder CRUD 和 move session 主路径没有用户入口。
    • 建议:按收敛后的 V1 重做 UI:如果是“按项目分组”,只需要一个清晰的 view-mode toggle 和项目 group 展示,不要 folder CRUD / move menu。
  • P1:当前 PR 和最新 main 冲突,无法合并

    • 证据:GitHub 状态显示 CONFLICTING/DIRTY;本地 merge 探针也在 apps/desktop/src/renderer/app-shell-effects.ts 冲突。
    • 原因:最新 main 已将 bootstrap subscriptions 改为 useEffectEvent 稳定回调形状,本 PR 仍基于旧形状添加 refreshFolders。
    • 建议:先基于最新 main 重整实现,不要把 folder refresh 逻辑接回旧 effect 结构。

P2 非阻塞项

  • P2:新增测试偏源码正则,没有覆盖真实用户路径(非阻塞)

    • 证据:session-folder-view-contract.test.ts 主要检查 AppShell 是否传了 props;但没有 mount/渲染 SessionListPanel,所以“props 传了但 UI 完全没用”这种情况没测到。
    • 建议:补行为测试:切换到“按项目”后能看到项目组;没有 cwd 的 session 进入“未归属项目”;切回当前模式后恢复原列表语义。测试应在删除实际 UI 接线时失败。
  • P2:删除 folder 的语义和数据清理不完整(非阻塞)

    • 证据:removeFolder 文案说“文件夹内的会话将移至未分组”,但当前只删除 folder metadata,然后 refresh folders/sessions;没看到清理相关 session folderId 的路径。
    • 影响:如果保留用户文件夹模型,会留下 orphan folderId,后续行为依赖 grouping helper 兜底,而不是数据一致性。
    • 建议:如果 V1 改为按项目分组,这块直接删掉;如果保留手动 folder,删除 folder 时要明确清理 session 归属,并加测试。

P3 非阻塞项

  • P3:生产代码里 PR-FOLDERS 注释偏多(非阻塞)

    • 建议:实现稳定后删掉 PR 过程注释,只保留必要的不变量说明。“folder view mode”“PR-FOLDERS”这类说明应该由命名和测试表达,不需要散在生产代码里。
  • P3:SessionFolder 作为 public core 类型过早(非阻塞)

    • 建议:如果最终不是用户手动 folder,别把 SessionFolder 推进 @maka/core public API。V1 的项目分组可以先用 renderer derivation 或已有 session summary 字段,避免过早固定数据契约。

@sunheyi6
sunheyi6 force-pushed the feature/session-folders branch from 18e46f0 to 14449d3 Compare July 4, 2026 22:44

@Astro-Han Astro-Han left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Request changes. The folder-CRUD model is gone and the project-grouping direction is right, but two blocking issues remain.

P0 — typecheck fails. apps/desktop/src/renderer/session-project-grouping.ts:58 has an unterminated regex literal:

const parts = projectPath.replace(/\/g, '/').replace(/\/+$/, '').split('/');

/\/g is not a valid regex. It looks like you wanted to normalize Windows backslashes to forward slashes, which is replace(/\\/g, '/'). npm run typecheck fails on this line (4 cascading errors, all from line 58); CI will fail. npm run build passes only because build:renderer uses esbuild without full type checking — so this slips past build but not typecheck.

P1 — the feature is not wired into the sidebar. SessionListPanel now accepts projectGroups, viewMode, and onViewModeChange, but app-shell.tsx (the only caller, around line 1227) is unchanged and passes none of them:

<SessionListPanel
  selection={navSelection}
  sessions={visibleSessions}
  ...
  statusGroups={sessionStatusGroups}
  ...
/>

With no onViewModeChange, the {onViewModeChange && (...)} toggle never renders, so the user never sees the "按状态 / 按项目" buttons. With no projectGroups, viewMode defaults to 'status' and the panel falls back to statusGroups. The project-grouped view is unreachable. app-shell.tsx needs to compute deriveProjectGroups(visibleSessions), hold a viewMode state, and pass all three props down.

This is the same shape as the P1 from the first review (props vs. real UI wiring), just inverted: last time the caller passed props the component ignored; this time the component accepts props the caller never sends. Either way the user sees nothing.

P3 — non-blocking. ProjectGroup is defined twice with identical fields: session-project-grouping.ts:9 and session-list-panel.tsx:10. Import it from one place rather than redeclaring.

What landed well: the manual-folder model (SessionFolder, folders.json, folderId, folder CRUD, setFolder bridge) is fully removed; grouping is a pure derivation over session.cwd; the main rebase conflict is resolved (mergeable). Once the regex and the app-shell wiring are fixed this should be in good shape.

P0: fix unterminated regex in session-project-grouping.ts:58
  — projectPath.replace(/\/g, '/') → replace(/\g, '/')
P1: wire projectGroups/viewMode/onViewModeChange in app-shell.tsx
  — import deriveProjectGroups, add viewMode state, pass to SessionListPanel
P3: deduplicate ProjectGroup type
  — import from @maka/ui instead of redefining in session-project-grouping.ts
@sunheyi6
sunheyi6 requested a review from Astro-Han July 5, 2026 07:42

@Astro-Han Astro-Han left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

The P0 (regex) and P1 (app-shell wiring) from the earlier review are fixed: typecheck is clean, app-shell passes projectGroups/viewMode/onViewModeChange, deriveProjectGroups(visibleSessions) computes the groups, and ProjectGroup is defined once. Two things to address before merge, plus non-blocking notes.

Before merge — rebase onto latest main. This PR's base is old main; the 5 desktop test failures in the worktree (font-size/typography, daily-review ×2, error-boundary, session-time-buckets, SearchModal) are all pre-existing on that old base and already fixed on current main (main is 2003/2003 green). Rebase clears them.

Before merge — cursor: pointer on .maka-view-mode-btn violates the cursor convention. The contract (cursor-convention-contract.test.ts) allows cursor: pointer only on .maka-markdown-link-internal — macOS reserves the hand cursor for links, every other control uses the default arrow. The new view-mode buttons add cursor: pointer in sidebar.css, so the contract fails on this branch (it passes on main). Drop the declaration — buttons render as buttons with the default arrow — or merge breaks the contract.

P2 (non-blocking) — no behavior test. The diff has no test file. Add a component/integration test that seeds sessions with/without cwd, toggles 按项目 / 按状态, and asserts the right groups render (project groups appear, ungrouped bucket, then status groups on toggle back). Not a source-regex test — it should fail if app-shell wiring, the toggle, or the ungrouped fallback is removed.

P3 (non-blocking) — ProjectGroup can be cut. The flow is UI defines ProjectGroup → renderer session-project-grouping.ts imports it from @maka/ui → UI maps it back to SessionHistoryStatusGroup. Let AppShell compute statusGroups directly from viewMode and drop the projectGroups prop, the ProjectGroup export, and the internal mapping. Less production code, no cross-package type coupling.

P3 (non-blocking) — PR title/body still describes the old folder model. The title says "session folders with view-mode toggle and folder grouping" and the body still promises SessionFolder, folder-store, folderId, folder CRUD, and move-to-folder — none of which are in this PR anymore. Update to describe the actual change: project-grouped view mode, toggle, cwd-derived grouping.

@Astro-Han
Astro-Han dismissed stale reviews from themself July 5, 2026 09:02

Core blocking issues (P0 regex, P1 app-shell wiring) are fixed in aebafa7. Remaining items (rebase, cursor:pointer, P2/P3) are in the latest COMMENTED review.

@Astro-Han Astro-Han left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Current head aebafa71 still needs changes.

First, two earlier items are no longer true on this head:

  • viewMode is already declared as useState<SessionViewMode>('status').
  • SessionListPanel passes statusGroups={groups} only once. There is no duplicate statusGroups={props.statusGroups} prop.

The current blockers are different.

P1: desktop tests fail on the new view-mode CSS

The new view-mode button adds a hand cursor:

.maka-view-mode-btn {
  cursor: pointer;
}

cursor-convention-contract.test.ts only allows cursor: pointer on .maka-markdown-link-internal. Buttons should keep the default arrow on macOS. Drop this declaration.

The same rule uses an unknown font-size token:

font-size: var(--font-size-ui-sm);

The typography contract only allows the declared --font-size-* tokens. Use an existing allowed token, for example var(--font-size-ui), or add a token through the token system if a smaller size is really required.

P1: SessionListPanel fallback breaks the existing pending-send bucket

When neither project groups nor status groups are provided, the panel now builds a synthetic single group:

groups = [{
  id: 'all',
  label: '',
  sessions,
  collapsible: false,
  defaultExpanded: true,
}];

It then always passes statusGroups={groups} into SessionHistoryList. That bypasses SessionHistoryList's existing default grouping and breaks the contract that empty-message sessions show under the concise pending-send bucket (待发送). Keep the existing fallback path intact: only pass statusGroups when the caller intentionally supplies derived groups. If there are no derived groups, let SessionHistoryList group props.sessions the old way.

P2: status view and project view use different session sets

projectGroups is derived from visibleSessions, but sessionStatusGroups is still derived from all sessions:

const sessionStatusGroups = useMemo(
  () => deriveSessionStatusGroups(sessions, { pinFirst: true }),
  [sessions],
);

const visibleSessions = useMemo(() => filterSessions(sessions, navSelection), [sessions, navSelection]);
const projectGroups = useMemo(() => deriveProjectGroups(visibleSessions), [visibleSessions]);

Both are passed to SessionListPanel. In filtered navigation states, toggling between 按状态 and 按项目 can change the candidate session set instead of only changing the grouping. Derive both grouping modes from the same visibleSessions, or compute the final statusGroups in AppShell and pass one grouped list to the UI.

P2: no behavior test for the new mode toggle

The diff has no test file. Add a behavior-level test that exercises the actual toggle: render a minimal session set, click 按项目, assert project groups and the 未归属项目 bucket, then click 按状态 and assert the status groups are back. It should fail if the AppShell wiring is removed, if project groups use the wrong source collection, or if no-cwd sessions disappear.

P3: remove the ProjectGroup middle type

The current flow is UI defines and exports ProjectGroup, desktop imports that type from @maka/ui, then UI maps it back into SessionHistoryStatusGroup. This can be smaller. Either have deriveProjectGroups return SessionHistoryStatusGroup directly, or let AppShell compute the final groups for the selected view mode and pass only statusGroups into SessionListPanel. That removes the projectGroups prop and the cross-package type loop.

P3: PR title and body still describe the old manual-folder design

The PR title/body still mention SessionFolder, folder-store, folderId, Folder CRUD, collapse, and move-to-folder. This PR no longer implements that model. Update the description to the current scope: project-grouped view mode, the toggle, cwd-derived grouping, and the unassigned-project fallback.

Verification context: after merging this PR over current main locally, desktop build and typecheck pass, but the desktop test suite fails on the cursor contract, the typography token contract, and the pending-send bucket contract described above.

@sunheyi6 sunheyi6 changed the title feat(sidebar): session folders with view-mode toggle and folder grouping feat(sidebar): add project-grouped session view mode Jul 5, 2026
@sunheyi6
sunheyi6 requested a review from Astro-Han July 5, 2026 11:35
Project group ids were the raw cwd path, which can contain spaces and
slashes. Those break DOM id validity and the aria-controls / body-id
pairing in SessionListGroups. Derive a stable DOM-safe id (project:<fnv1a>)
from the normalized path; keep the basename as the label. Two projects
sharing a basename still get distinct ids because the full path is hashed.

@Astro-Han Astro-Han left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Follow-up fix pushed (737f4ec0): project group ids are now sanitized (project:<fnv1a> of the normalized path), so cwds with spaces or special characters no longer break the DOM id / aria-controls pairing in SessionListGroups. The basename is still the label; two projects sharing a basename stay distinct because the full path is hashed. Regression test covers a spaced cwd plus a shared-basename pair. typecheck, build, and full desktop suite (2043/0) green.

@Astro-Han
Astro-Han merged commit af25aab into apache:main Jul 5, 2026
Astro-Han added a commit that referenced this pull request Jul 5, 2026
#520 PR9 review P3-1: the Table primitive had a single consumer
(usage-settings-page SimpleStatsTable) and no second HTML <table> consumer
in sight — the model "table" is a div-based list (.modelTable), not an HTML
table, so it will never migrate onto Table. Per Occam's razor, lift the
primitive only when a second real consumer appears.

- Delete packages/ui/src/primitives/table.tsx and its barrel export.
- SimpleStatsTable in usage-settings-page now renders a native HTML
  <table>/<thead>/<tbody>/<tr>/<th>/<td> with the same Tailwind classes the
  primitive applied (w-full border-collapse rounded-[var(--radius-surface)]
  border border-border text-caption + cell border-b/px/py/align/
  tabular-nums). Styles stay inline so the stats surface is self-contained
  until a second HTML <table> consumer justifies lifting it back.
- Rename card-table-converge-contract → card-converge-contract: drop the
  Table data-slot / table-sites assertions, keep Card. Note the usage stats
  table a11y semantics (aria-label + scope) now live in
  settings-usage-contract, whose assertions are updated to match the native
  <table>/<th scope> shape.
- settings-form-a11y and tabular-nums are untouched: they assert on the
  .modelTable CSS class (a div surface), not on the Table primitive.

Verification: 2049/2049 contract pass (one fewer test — the deleted
"table sites import Table" case), typecheck clean. Screenshot pixel diff vs
main: settings-general light/dark 1280 AE=0; settings-data 1280 shows ~4500
px (RMSE 0.001) in the `data` section, which is main-branch composer/sidebar
drift (#510/#511), not this change — the usage stats table lives in the
`usage` section and its styles are identical to the retired primitive.
Astro-Han added a commit that referenced this pull request Jul 5, 2026
…PR9) (#554)

* feat(ui): add Card/Table primitives, retire settings card/table classes (#520 PR9)

Card (packages/ui/src/primitives/card.tsx) — thin surface container
(data-slot="card" + radius-surface), following maka's ChoiceCard
philosophy: each call site keeps its own layout/visual CSS. settingsRows,
settingsMetricCard, and maka-error-card now route through Card; their CSS
drops the border-radius line (Card owns it), layout is byte-identical.

Table (packages/ui/src/primitives/table.tsx) — shadcn-style family
(Table/TableHeader/TableBody/TableRow/TableHead/TableCell) with data-slot.
settingsStatsTable retires entirely; the table chrome (border + radius +
caption font-size) and the cell chrome (tabular-nums + hairline row
separators + caption-tone color + semibold head) move into the primitive.

maka-error-card stays on Card (not Alert): it is a large crash surface
with shadow-modal + stack <pre>, not a small inline callout.

card-table-converge-contract locks the migration. Updated four existing
contracts whose selectors pinned the retired classes/structure:
radius-converge (drop .settingsRows tier — Card owns it now),
tabular-nums (drop .settingsStatsTable th/td — Table owns it now),
settings-usage (regex now matches the Table family + scoped heads/cells),
web-search-boundary (regex now matches <SettingsRows className=…>).

Token values verified equivalent: --font-weight-semibold=600 (font-semibold),
--space-1/2, --radius-surface=8px. Screenshot manifest passes (32/32, 0 fail).

* feat(ui): converge badge surfaces onto pill Badge + squared Chip

#520 PR9 commit 2: collapse the four coexisting badge surfaces onto two
canonical primitives, split by UI role.

- pill Badge (primitives/badge.tsx): emphasis markers. Retire the
  PrimitiveBadge alias + the legacy ui.tsx Badge (raw emerald/amber
  variants). health/permission center, artifact-pane, plan-reminder, and
  permission-dialog route through <Badge>.
- squared Chip (primitives/chip.tsx): dense status rows. Retire the
  .settingsBadge + .settingsConnectionBadge CSS chips. settings
  connection status / default / category markers route through <Chip>;
  variants mirror StatusTone, so settings callers pass the tone directly
  instead of going through statusBadgeVariant (which stays for the
  health/permission pill Badge sites).
- contracts: badge-converge (pill track), chip-converge (squared track,
  locks radius-control not pill), settings-form-a11y (lock point moved
  from the CSS class to the Chip primitive), radius-converge (drop the
  stale ui.tsx badgeVariants entry).
- visual zero-change: Chip cva reproduces the retired CSS oklch alphas
  (success/12, info/14, warning/18, destructive/15) and the neutral
  foreground-5 base. screenshot pixel diff vs main: settings-bots
  light/dark 1280 AE=0.

* fix(ui): address PR9 review — Chip size=sm for settingsBadge, token contract, comment fix

#520 PR9 review fixes:

- P2: the three .settingsBadge migration sites (provider-connection-detail
  x2, provider-add-form x1) now use Chip size="sm" to reproduce the retired
  .settingsBadge geometry (18px / font-normal / 0-6px padding). Without
  size="sm" they defaulted to the larger status-row size (20px / semibold /
  2-8px padding) and drifted. The neutral background did not drift:
  bg-secondary aliases --color-secondary = var(--foreground-5), so only
  height/weight/padding moved.
- P3-2: chip-converge-contract now locks user-visible tokens (neutral
  bg-secondary + foreground-secondary text, sm/default size geometry,
  status-tone alphas /12 /14 /18 /15) so a cva class change that keeps the
  import is still caught. Dropped the "no old span" migration-narrative
  loop; kept import + role-split + token assertions.
- P3-3: bot.css / connection.css retire comments now say Chip
  variant="neutral" (not Badge variant="secondary"), matching the actual
  migration and not steering future migrants back to the pill Badge.

Verification: 2050/2050 contract pass, typecheck clean, screenshot
settings-bots light/dark 1280 + light 990 all AE=0 (pixel-identical to
main after the size=sm fix; the 990 variant's earlier 13380 px diff is gone).

* refactor(ui): retire premature Table primitive per review (#520 PR9 P3)

#520 PR9 review P3-1: the Table primitive had a single consumer
(usage-settings-page SimpleStatsTable) and no second HTML <table> consumer
in sight — the model "table" is a div-based list (.modelTable), not an HTML
table, so it will never migrate onto Table. Per Occam's razor, lift the
primitive only when a second real consumer appears.

- Delete packages/ui/src/primitives/table.tsx and its barrel export.
- SimpleStatsTable in usage-settings-page now renders a native HTML
  <table>/<thead>/<tbody>/<tr>/<th>/<td> with the same Tailwind classes the
  primitive applied (w-full border-collapse rounded-[var(--radius-surface)]
  border border-border text-caption + cell border-b/px/py/align/
  tabular-nums). Styles stay inline so the stats surface is self-contained
  until a second HTML <table> consumer justifies lifting it back.
- Rename card-table-converge-contract → card-converge-contract: drop the
  Table data-slot / table-sites assertions, keep Card. Note the usage stats
  table a11y semantics (aria-label + scope) now live in
  settings-usage-contract, whose assertions are updated to match the native
  <table>/<th scope> shape.
- settings-form-a11y and tabular-nums are untouched: they assert on the
  .modelTable CSS class (a div surface), not on the Table primitive.

Verification: 2049/2049 contract pass (one fewer test — the deleted
"table sites import Table" case), typecheck clean. Screenshot pixel diff vs
main: settings-general light/dark 1280 AE=0; settings-data 1280 shows ~4500
px (RMSE 0.001) in the `data` section, which is main-branch composer/sidebar
drift (#510/#511), not this change — the usage stats table lives in the
`usage` section and its styles are identical to the retired primitive.

* docs(css): fix .settingsStatsTable retire comment to point at local SimpleStatsTable

Per PR9 review P3: the retire comment still referenced the deleted
packages/ui/src/primitives/table.tsx, which would mislead a future maintainer
into restoring a public Table primitive. Now points at the local native
SimpleStatsTable in usage-settings-page.tsx, matching the actual state.
Astro-Han added a commit that referenced this pull request Jul 6, 2026
… Input (#520 item 22) (#555)

* feat(ui): canonical Input/Textarea onto Base UI, retire native ui.tsx Input (#22 PR10)

#22 PR10: collapse the dual Input tracks onto one canonical
primitives/input.tsx + primitives/textarea.tsx, retiring the native ui.tsx
Input/Textarea.

- primitives/input.tsx now wraps Base UI's Input primitive with maka's
  inputClasses styling ported as the default chrome. Stays a single <input>
  (no span wrapper) so caller CSS targeting `> input` / `input:focus-visible`
  still matches. unstyled gives the bare form (bareFieldClasses +
  data-maka-field-chrome="none") for Field/InputGroup embedding.
- primitives/textarea.tsx parallel shape: single <textarea> + inputClasses +
  textarea sizing. Base UI ships no Textarea, so this is a native textarea.
  Drops the Base UI Field.Control + span wrapper (caller doesn't use Field).
- ui.tsx Input, Textarea, inputClasses, bareFieldClasses retired. inputClasses +
  bareFieldClasses moved into primitives/input.tsx (exported) so number-field
  keeps its standalone NumberFieldInput chrome.
- InputGroup: InputGroupInput/InputGroupTextarea already pass unstyled (inner
  field bare, InputGroup owns the chrome — no double chrome). InputGroup CSS
  updated to key off data-slot="input"/"textarea" (the single element) instead
  of the retired span data-slot="input-control"/"textarea-control"; dropped the
  span-only `:contents` / `:before:hidden` rules.
- index.ts re-exports primitives/input + primitives/textarea as the canonical
  Input/Textarea; the 44 usages across 9 settings files keep importing from
  @maka/ui unchanged.
- Contracts: new input-canonical-contract (single element, inputClasses token
  lock, ui.tsx retired, bare-field shape); field-chrome.test rewritten for the
  unified shape (drops nativeInput/h-8.5/field-sizing-content assertions that
  pinned the old primitives/input vs ui.tsx divergence); radius-converge
  inputClasses tier repointed at primitives/input.tsx.

Verification: typecheck clean; @maka/ui test 43/43; @maka/desktop test
2069/2069. Screenshot pixel diff vs main: settings-general and settings-bots
light/dark 1280 AE=0 (pixel-identical, both contain Input). settings-data
364 px (edge); settings-appearance/daily-review ~9-10K px in a 12px right-edge
column (window edge, not input/textarea); settings-memory ~18K px in a large
content block (main-branch composer/sidebar commits #510/#511, not this PR).

* fix(ui): PR10 review — InputGroup force-bare, search reset, behavior contract

- P2-1: InputGroupInput/Textarea spread props before unstyled and
  data-maka-field-chrome so a caller's unstyled={false} cannot re-enable
  the inner chrome (would double the border / focus ring). The InputGroup
  owns the chrome; the inner control stays bare.
- P2-2: port type="search" WebKit cancel/decoration/results reset into
  primitives/input. Main's primitives/input always applied this for
  InputGroupInput (search-modal path); the unified Input keeps the
  contract for both the @maka/ui Input and InputGroupInput paths.
  size/nativeInput/type=file variants audited — no callers in repo
  (@maka/ui Input was ui.tsx without these; InputGroupInput never
  passed them); removed without a compat layer.
- P3-1: rewrite input-canonical-contract as behavior tests only — no
  source regex. Styled/unstyled single element + chrome, InputGroup
  force-bare even with unstyled={false}, type="search" webkit reset,
  barrel import smoke.
- P3-2: #22 PR10 -> #520 item 22 in comments (the PR流水号 narrative
  pointed at the wrong tracker).

* fix(ui): drop redundant data-maka-field-chrome on InputGroup adapters

The canonical Input/Textarea already force data-maka-field-chrome="none"
when unstyled (the {...props} spread precedes the attribute in both
primitives, so a caller cannot override it). The adapter passing it
explicitly was a no-op. Drop the redundant attribute; keep unstyled.
GabrielDrapor added a commit to GabrielDrapor/maka-agent that referenced this pull request Jul 6, 2026
Two independent sidebar bugs, one CSS file:

1. Session row action buttons (pin/rename/archive/delete) rendered on
   top of fully-legible title text: the actions cluster's background
   gradient used `var(--state-hover-bg)` as its "opaque" stop, but that
   token is a 4% alpha tint of `--foreground` — same color as the text,
   nearly transparent. Replaced with `color-mix(in oklch, var(--foreground)
   4%, var(--background))` which flattens the tint into a genuinely
   opaque color. A 16px leading fade softens the title-to-actions
   transition without leaking text through (the old version's fade used
   the translucent token, so text was fully readable under the icons).

2. "按状态/按项目" view-mode toggle stretched to ~270px tall: PR apache#510
   added the toggle as a 5th grid child of `.maka-session-panel` but
   left `grid-template-rows` at 4 tracks, so the toggle consumed the
   `minmax(0, 1fr)` track meant for the session list. Added a 5th
   `auto` track for the toggle.

Co-Authored-By: Claude <[email protected]>
GabrielDrapor added a commit to GabrielDrapor/maka-agent that referenced this pull request Jul 6, 2026
Two independent sidebar bugs, one CSS file:

1. Session row action buttons (pin/rename/archive/delete) rendered on
   top of fully-legible title text: the actions cluster's background
   gradient used `var(--state-hover-bg)` as its "opaque" stop, but that
   token is a 4% alpha tint of `--foreground` — same color as the text,
   nearly transparent. Replaced with `color-mix(in oklch, var(--foreground)
   4%, var(--background))` which flattens the tint into a genuinely
   opaque color. A 16px leading fade softens the title-to-actions
   transition without leaking text through (the old version's fade used
   the translucent token, so text was fully readable under the icons).

2. "按状态/按项目" view-mode toggle stretched to ~270px tall: PR apache#510
   added the toggle as a 5th grid child of `.maka-session-panel` but
   left `grid-template-rows` at 4 tracks, so the toggle consumed the
   `minmax(0, 1fr)` track meant for the session list. Added a 5th
   `auto` track for the toggle.

Co-Authored-By: Claude <[email protected]>
likun666661 pushed a commit that referenced this pull request Jul 7, 2026
#576)

Two independent sidebar bugs, one CSS file:

1. Session row action buttons (pin/rename/archive/delete) rendered on
   top of fully-legible title text: the actions cluster's background
   gradient used `var(--state-hover-bg)` as its "opaque" stop, but that
   token is a 4% alpha tint of `--foreground` — same color as the text,
   nearly transparent. Replaced with `color-mix(in oklch, var(--foreground)
   4%, var(--background))` which flattens the tint into a genuinely
   opaque color. A 16px leading fade softens the title-to-actions
   transition without leaking text through (the old version's fade used
   the translucent token, so text was fully readable under the icons).

2. "按状态/按项目" view-mode toggle stretched to ~270px tall: PR #510
   added the toggle as a 5th grid child of `.maka-session-panel` but
   left `grid-template-rows` at 4 tracks, so the toggle consumed the
   `minmax(0, 1fr)` track meant for the session list. Added a 5th
   `auto` track for the toggle.

Co-authored-by: Claude <[email protected]>
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