Commit Graph
1436 Commits
Author SHA1 Message Date
lhh010 37bc30f164 fix(git): harden runGit's output caps — latch, killTree, stderr budget
dev already caps stdout bytes (GIT_OUTPUT_MAX_BYTES) and NUL fields, but
three gaps remain, all proven by the 2026-10-13 host crashes (twice:
RangeError: Invalid string length at the stdout accumulator, a junction-
forest workspace driving 'git status -uall' to gigabytes):

1. no latch after a byte-cap reject — later chunks kept ACCUMULATING on
   the retained strings. On Windows spawn('git') resolves to the cmd
   shim, whose grandchild survives child.kill() and keeps feeding the
   dead accumulator (measured: the orphan outlived kill() by 20+s). The
   fieldCapped guard covered only the row cap; the byte cap had none.
2. kill() reaches only the wrapper — the orphaned grandchild needs its
   pipes destroyed (EPIPE) to actually stop. killTree() destroys both
   streams and is now used by every kill path (timeout, byte cap, field
   cap).
3. stderr was uncapped — a command whose DIAGNOSTICS stream past the
   budget is as able to kill the host via string length as its answer;
   stderr now shares the same maxBytes budget.

Worst case in a pathological workspace is now one failed SCM refresh,
never a dead host.
2026-10-18 20:18:57 +08:00
ymac 8c3e00ec54 docs(plans): 记录 @ 引用插入展平 chip 的根因、修复、真机断言与「不修清单」
上游不接收 issue,所以把这次查到的宿主行为(手打 mention 只装饰目录前缀、贪婪跨空白把两个
mention 并成一个 token、无空格连打两个 @…/ 会让草稿字符重排)连同根因(setDraft 的契约会移除
inline chip;结构化插入的 span 用错投影导致每次插入都回退到那条破坏性路径)一并存档,避免下次
再从插件侧找原因。
2026-10-18 20:18:37 +08:00
ymac 70eb6b7276 test(e2e): 挂载 lane 钉住 @ 引用插入不会整份重写草稿(chip 不被展平)
上游一旦改动 composer 的内部事件或坐标投影,这条链路的表现是「点击无效」而不是报错
(我们发的是非公开的 session 作用域事件),单测用假宿主钉不住这一点,所以补一条真机断言:
真实 composer 里经文件树点两次文件 @(两个 `[data-composer-chip]`,第一个仍带自己的文件名)
再点一次目录 @(落成宿主装饰的纯文本 token),四条断言都在;旧实现第二次点击就会把第一个
chip 展平成文本,前三条会红。

顺带把 `context-types.ts` 的 `setDraft` 注释补一句:上游若改该语义(保留 chip 或提供公开
插入面),要与 `conversation-draft.ts` 的两条插入路径一起复核。
2026-10-18 20:18:37 +08:00
ymac 3757f75ca7 fix(client): 草稿插入不再整份重写,chip 不再被展平(@ 提及两段式)
`appendToDraft` 走的是宿主 `setDraft(整串)`,而该 API 的契约原文就是「用纯文本替换整份
草稿、移除内联引用 chip」:草稿里已有的每个 chip 会被展平成 `@dir/file.ts` 文本,宿主再只
装饰 `@dir/` 前缀——所以侧栏 @ 引用按钮插一次目录(或文件插入失败回退一次),之前所有
@ 选择都会退化成「`@notes/` + 文件名」两段。另外文件插入的 span 用的是剪贴板长度,而宿主
`TokenSpan` 是 detect 坐标(chip = 一个 U+FFFC),草稿里只要已有一个 chip 就越界被拒,
于是那次插入必然落到上面这条破坏性回退上——这正是「第一次正常、第二次把第一次变成两段式」。

- 文件与目录都改走宿主的 scoped composer 事件(`slash/input-insert-reference` /
  `slash/input-insert-text`):只改目标区间,其它节点原样保留;
- 新增 `detectLength` / `clipboardToDetect`,用 `InputState.occurrences` 把 span 折进
  detect 坐标(落在 chip 内部的位置吸附到该 chip 之前);
- 删掉 `placeComposerCaretAfterInsert`:事件插入后由宿主落 caret,而 0.1.7+ 的 composer
  是 Lexical contenteditable,`<textarea>` 探测恒 null,那套补偿已是死代码;
- 事件没人处理时返回 false 并保持草稿不动(宁可什么都不插,也不再整份重写);
- 回归:`tests/conversation-draft.spec.ts` 的假宿主同时模拟 detect 坐标折叠与「越界拒绝」,
  `tests/sidebar-workspace-reference.spec.tsx` / `tests/reference-in-chat.spec.ts` 改为断言
  事件载荷,并断言 `setDraft` 从不被调用。
2026-10-18 19:31:38 +08:00
Matt Van Horn 74c723ecc6 fix(builtins): archive sidechat sessions when their tabs close
Closing a bound side chat tab now archives that thread through
uiWorkspace.archiveSession with stopActivity, then disposes the live
agent. A missing workspace service or a failed archive still disposes
the agent, and the close path settles on its own. A tab with no thread
id skips both steps. The header action that saves a copy as a new
session, and the explicit archive control, stay as they were.

Fixes #942
2026-10-16 23:47:14 -07:00
Menghuan1918 83faf70940 release: merge dev for v0.28.0 (DSH 0.2.1-rc.1) 2026-10-17 14:13:26 +08:00
Menghuan1918 0fab0afdbb merge chore/dsh-0.2.1-rc.1-release-0.28.0: prepare stable RC adapter 2026-10-17 14:03:22 +08:00
Menghuan1918 66c91091bc chore(release): adapt to DSH 0.2.1-rc.1 for 0.28.0 2026-10-17 14:03:22 +08:00
Menghuan1918 35ad6fc685 release: merge dev for v0.28.0-alpha.0 2026-10-17 12:24:23 +08:00
Menghuan1918 6a122c4893 merge test/alpha-baseline-crlf: fix Windows release gate 2026-10-17 12:15:58 +08:00
Menghuan1918 1fd6e0f139 test: accept CRLF checkouts in DSH baseline guard 2026-10-17 12:15:58 +08:00
Menghuan1918 2b8a4da569 chore(release): prepare alpha.0 with latest dev fixes 2026-10-17 12:02:59 +08:00
Menghuan1918 6417547bb5 merge origin/dev: include Context diagnostics and graph layout fixes
# Conflicts:
#	CHANGELOG.md
2026-10-17 11:52:48 +08:00
Menghuan1918 24d2032de1 merge fix/git-graph-fill-height: fill available Git graph height 2026-10-17 11:36:53 +08:00
Menghuan1918 38d94bdb98 fix(git): let commit graph fill available sidebar height
Replace the 460px viewport cap with flex allocation. Bound the graph section minimum so long history scrolls internally instead of stretching the outer list. Verify tall and narrow panes, preview selection, folding and long Changes lists in the mounted host.
2026-10-17 11:33:55 +08:00
m4ku1337 c0e6851962 fix(menu): close the reduced-motion media query that swallowed the submenu flip (#955)
layout.css opens @media (prefers-reduced-motion: reduce) at line 77 and never
closes it. 36fbc5a deleted the run of 61 lines that started with that brace and
ran to the end of the file (0 insertions, 61 deletions), and b011be1 added the
context-menu submenu rules back below the still-open block (60 insertions). The
file has been one brace short ever since: 13 '{' against 12 '}'.

Everything from line 78 on is therefore a descendant of the media query. The
only rules in that range are the media query's intended child — the center
column's 'transition: none' — and the six rules that consume the
data-dsh-sidebar-submenu attribute menu-flip.ts publishes on <body>: the flip
that keeps a nested submenu inside the viewport, and the visual tether (parent
row highlight, 4px gap, 4px hover corridor). In the default theme none of them
matched, so our "open with" submenu grew past the right edge of a right-docked
workbench; reduce-motion users were the only ones who ever got the flip (#955).

Restoring the brace puts all six back at top level. No rule text changes: the
result is byte-identical to the pre-regression revision 36fbc5a^ (7219 bytes).

tests/css-block-scope.spec.ts pins the property that hid this: menu-flip.spec.tsx
asserts with toContain, which matches selector text wherever it sits, so the
nesting stayed green in every released version from v0.24.1 through v0.26.1, and
on dev (0.27.0) where it still is. The new spec reads block structure instead:
every stylesheet under src/ has to close what it opens, and the six flip/tether
selectors have to open at depth 0. Run against the historical revisions, the spec is red on every
revision that shipped the nesting — v0.24.1 through v0.26.1 and dev — where it
reports "1 unclosed block(s)" and names the flip rules as nested. 36fbc5a is the
commit that lost both the brace and the rules, and it deleted menu-flip.ts with
them, so the spec cannot even load there; with that module stubbed back in, both
assertions fail on its CSS. On 36fbc5a^ and on this branch the spec passes.

Verified on this branch: pnpm exec vitest run tests/css-block-scope.spec.ts
tests/menu-flip.spec.tsx -> 11 passed; pnpm typecheck, pnpm lint clean.
2026-10-17 03:42:23 +08:00
Menghuan1918 0c7868cc07 Merge Context diagnostics integration into dev 2026-10-17 02:22:07 +08:00
Menghuan1918 93c43b0ac9 feat: add optional Context diagnostics navigation
Use an activation-scoped Cordis controller for session, agent, and job-owner entries. Reuse native Context tabs, cancel stale navigation, and close source overlays without canceling pending requests.

Verify optional capability lifecycle, truthful job ownership, three real dsh-context configurations, and the existing mount regression suite.
2026-10-17 02:20:53 +08:00
Menghuan1918 57722809ed merge chore/dsh-0.2.1-alpha.5-adaptation: support alpha.5 2026-10-17 02:12:44 +08:00
Menghuan1918 4ebd3e9bdd chore: adapt sidebar to DSH 0.2.1-alpha.5 2026-10-17 02:12:44 +08:00
Menghuan1918 9cb0b9c56d release: merge dev for v0.27.0 2026-10-16 22:06:07 +08:00
Menghuan1918 693b4850e3 merge chore/release-0.27.0: prepare Git page release 2026-10-16 21:57:02 +08:00
Menghuan1918 b5fec8d9a2 chore(release): prepare 0.27.0 Git page integration 2026-10-16 21:57:02 +08:00
Menghuan1918 55a0fd019d merge test/isolate-scroll-fixture: avoid stale shared repositories 2026-10-16 21:49:48 +08:00
Menghuan1918 3e9eacf0cb test(e2e): isolate scroll retention fixtures per run 2026-10-16 21:49:48 +08:00
Menghuan1918 612cea242f merge fix/git-scm-layout: restore selected Git row layout 2026-10-16 21:46:54 +08:00
Menghuan1918 0ba7edf444 fix(git): keep selected change rows inside their groups
Restore selection declarations removed with logRow during graph integration. Dangling selectors had inherited absolute positioning and borders from indent guides. Add parsed CSS and mounted browser regression coverage for staged, unstaged and conflict rows.
2026-10-16 21:45:57 +08:00
Menghuan1918 e523f832cc merge pr-964 (#964 侧边对话子会话改为从最后一次 summarizing compaction 起种,不再全量复制父日志) into dev(@NolanHo) 2026-10-16 21:27:48 +08:00
Menghuan1918 aacb2b247e docs: 移除 sidechat compaction-tail seed 设计文档 2026-10-16 21:17:13 +08:00
Menghuan1918 af2aeb2889 docs(agents): AGENTS.md 收敛为规则清单(67KB → 10.8KB),深度参考移入 docs/
- AGENTS.md 只留每次都要遵守的规则与索引:§0 分支模型、§1 硬约束、§2 挂载
  门禁与钉版禁忌、§3 版本适配与抬基线清单、§4 发版、§5 开发规则、§6 去哪找
- 原 §3.4 宿主契约第 1–12 条与 0.1.5–0.1.7 沿用至今的约束移入
  docs/host-contracts.md,**编号保持不变**——代码 / 测试 / 文档里既有的
  「AGENTS.md §3.4 第 N 条」与 `§3.10` 引用仍能命中
- 删掉测试地图长清单与 CI 取证叙事:契约本就在各 spec 头注释、docs/plans 与
  CHANGELOG 里,AGENTS.md 只留索引与那几条会真咬人的跨平台规则
- 订正过期事实:testTimeout 30s、chunk 名真源 CHUNK_NAMES、markdownTextProps
  渲染点、minimumReleaseAgeExclude 所在脚本、0.1.7 线最后支持版 v0.22.1
2026-10-16 18:35:51 +08:00
Menghuan1918 f73e6632c3 chore(changes): 清掉第三镜头的残留样式(.lens / .lens[hidden])
图谱区改挂 Git 镜头后这两条选择器没有消费者;行为无变化。
2026-10-16 17:41:33 +08:00
Menghuan1918 71c8243a2b docs: Git 页面合并车的 CHANGELOG 段、融合设计文档与接入文档/AGENTS 同步
- CHANGELOG 顶部新增 Unreleased 段(11 个 PR 的逐条说明与贡献者署名);
- 新增 docs/plans/2026-10-16-git-page-vscode-scm-merge.md(决策 D2/D5、被剔除的夹带、
  有意偏差、守住的不变量、未做清单、过程中修掉的三处 CI 红);
- guide:页签名、Source Control 视角、changes.ops 的 wait 长轮询口径、guide 条目名;
- AGENTS §5/§6:内置 tab 名与测试地图补入本批新增/改写的 spec。
2026-10-16 17:31:41 +08:00
Menghuan1918 88ded478de merge pr-969 (#969 feat(git-graph): 只读提交图) into dev(@vlln)
融合(D5):#969 的图谱引擎作为 Git 镜头内的「提交图」区上线,不再新增第三个镜头。
- 保留:src/git-graph.ts(有界路由 + graph-stale/graph-limit)、graph-layout.ts、
  graph.module.css、CommitDetails、DiffPane 的 PaneTabStrip 与 details/content/diff 分签、
  hover 卡片、引用徽章、分支筛选、无限滚动、e2e 与设计文档;
- 落位:GitGraphLens → GitGraphSection(挂在 GitLens 的 Graph 区,目标读镜头自己的
  仓库/worktree 选择,不再自持选择器);行右键接回 #944 的提交菜单(查看/复制/revert/cherry-pick);
- 去掉:第三镜头与 changesGraphLens 键、#944 的 GitGraph.tsx(及随之无消费者的
  log 行样式与 historyLoadError/changesNoHistory 词典键);
- 镜头常驻保留(hidden 切换):Graph 的滚动/选中、Changes 的展开与草稿切走不丢,
  同时 store 槽位与轮询按「可见 + 在屏」分别门控(切回不闪 loading);
- 两套重写过的测试按新契约对齐(底部面板分签、图谱区与 Git 镜头的关系、图行/历史断言)。
2026-10-16 17:30:44 +08:00
Menghuan1918 40ed740f3a merge pr-944 (#944 feat(git): Git 内容区改为 VS Code Source Control 结构) into dev(@hairyf)
冲突解决(按 D4 与仓库现役不变量):
- status() 改为 porcelain v2(branch/upstream/ahead-behind/detached/operation 一次读回),
  但保留 dev 的行/字段上限、pathspec 化 numstat 与 #909 的分侧计数;v2 记录遍历抽成
  porcelainV2Tokens,状态解析与 pathspec 提取共用同一份字段知识;
- GitLens 的 Merge/Staged/Changes 三组取 #944,两组各读自己那一侧(#909),
  Merge 组不印行数(冲突不是行数故事,也不许把某一侧当「这个数」);
  sideEntries 保留(每组只读自己那一半的 XY 字母);
- ChangesTab 保留 #939 的官方 Tabs 外观与 a11y 包装、刷新按 #944 只留给本轮文件镜头;
- 测试:git.spec 导入取并集、rmSync 清理改回 removeTree、smoke 的 branch/detached 断言
  按 porcelain v2 语义改写,其余用例按新契约微调(band 顺序、changesOps 第 4 参 wait)。

剔除夹带(D4):.agents/skills/handle/SKILL.md、eslint/vitest 的 soruce/vscode 忽略项、
webRuntime→connection.requestRejection 栅栏与 ownEntryId 放宽(index.ts / context-types.ts
取 dev)、栅栏类测试桩与注释一并回退,栅栏归属留给 0.2.1 兼容批。
2026-10-16 17:14:06 +08:00
Menghuan1918 6586c08bbc test(changes-ops): 对齐空窗长轮询的契约断言(#885 收尾)
- tests/unbounded-caches.spec.ts:基线拉取不再传 0 而是不传游标(0 会丢掉 seq 0 的真实事件),
  并断言 primed 之后第 4 参 wait=true、基线 false;
- tests/changes-ops-route.spec.ts:用例名/注释英文,补一条 PTC 事件对穿透路由的断言,subCallId 用 ToolCallId;
- api.ts / ChangesTab.tsx / ops-stream.ts 的说明改回英文行文(行为不变)。
2026-10-16 16:54:41 +08:00
Menghuan1918 172ca849dd fix(git): BFS 发现根与 rev-parse 的路径拼法统一(#607 收尾)
macOS 的 tmpdir 是软链(/var → /private/var),Windows 上 join 出的是反斜杠而
`rev-parse --show-toplevel` 用正斜杠:两种拼法都会让同一个检出在仓库选择器里出现两次,
CI 的 canonical() 断言先红。发现根现在走 realpath +(Windows 才做的)分隔符折叠。

在 5b6f7319 的 ci-windows 上实测到 5 条 git.spec.ts 失败(全是分隔符)。
2026-10-16 16:54:39 +08:00
Menghuan1918 bd65b41e9d merge pr-885 (#885 fix: 减少 changes.ops 空窗重复请求) into dev(@wang-kaopu)
冲突解决:保留 #885 的路由抽取(src/changes-ops.ts + 'changes.ops': changesOps),
把 dev 的现役内容搬进新模块:PTC 四种事件类型、-1 游标下限、会话/持久化双读与 4000 窗口;
index.ts 的 import 块取 dev(只补 ServerResponse),订阅回调按仓内惯例restate 最小结构切片。
测试:路由 spec 加一条 PTC 事件穿透断言,用例名与注释统一英文。
2026-10-16 16:44:20 +08:00
Menghuan1918 db2a87f360 merge pr-921 (#921 fix: 修复 PTC 模式下本轮文件列表为空) into dev(@wang-kaopu)
冲突解决:extractFileOps 的文档注释与实现合并「PTC 事件对 + 会话 cwd 路径解析」两半,
参数解析抽成 ptcArgs(PTC 的 arguments 已是对象);测试保留 PTC 四例并按 #940 去掉分组名。
host 路由 / ops-stream 头注释恢复英文行文(行为不变),README_EN.md 保持删除、README.md 取 dev。
2026-10-16 16:41:11 +08:00
Menghuan1918 bb23b47fa5 merge pr-886 (#886 fix(changes): 本轮文件按会话 cwd 解析完整路径) into dev(@wang-kaopu)
冲突解决:README.md 取 dev、README_EN.md 保持删除、CHANGELOG 里误落 v0.25.0 段的条目删掉(发版段统一在收尾批处理);
#886 的用例去掉 groupByFile(#940 已删除该分组函数),改断言解析后的完整路径。
2026-10-16 16:39:50 +08:00
Menghuan1918 9f630d1618 merge pr-940 (#940 fix(changes): 本轮文件操作改为平铺行) into dev(@hairyf)
冲突解决:README.md 取 dev(PR 基于拆分前的旧中英双 README,改动目标已不存在),
README_EN.md 保持删除;guide 的 usage: git [-v | --version] [-h | --help] [-C <path>] [-c <name>=<value>]
           [--exec-path[=<path>]] [--html-path] [--man-path] [--info-path]
           [-p | --paginate | -P | --no-pager] [--no-replace-objects] [--no-lazy-fetch]
           [--no-optional-locks] [--no-advice] [--bare] [--git-dir=<path>]
           [--work-tree=<path>] [--namespace=<name>] [--config-env=<name>=<envvar>]
           <command> [<args>]

These are common Git commands used in various situations:

start a working area (see also: git help tutorial)
   clone      Clone a repository into a new directory
   init       Create an empty Git repository or reinitialize an existing one

work on the current change (see also: git help everyday)
   add        Add file contents to the index
   mv         Move or rename a file, a directory, or a symlink
   restore    Restore working tree files
   rm         Remove files from the working tree and from the index

examine the history and state (see also: git help revisions)
   bisect     Use binary search to find the commit that introduced a bug
   diff       Show changes between commits, commit and working tree, etc
   grep       Print lines matching a pattern
   log        Show commit logs
   show       Show various types of objects
   status     Show the working tree status

grow, mark and tweak your common history
   backfill   Download missing objects in a partial clone
   branch     List, create, or delete branches
   commit     Record changes to the repository
   history    EXPERIMENTAL: Rewrite history
   merge      Join two or more development histories together
   rebase     Reapply commits on top of another base tip
   reset      Set `HEAD` or the index to a known state
   switch     Switch branches
   tag        Create, list, delete or verify tags

collaborate (see also: git help workflows)
   fetch      Download objects and refs from another repository
   pull       Fetch from and integrate with another repository or a local branch
   push       Update remote refs along with associated objects

'git help -a' and 'git help -g' list available subcommands and some
concept guides. See 'git help <command>' or 'git help <concept>'
to read about a specific subcommand or concept.
See 'git help git' for an overview of the system. 行合并「平铺措辞 + 下划线 Tabs 说明」;
editor-host.spec.tsx 的 RENDER_WAIT_MS 注释保留 dev 的 CI 史,并补记 PR 的夹具泄漏结论。
2026-10-16 16:38:37 +08:00
Menghuan1918 5b6f7319f9 merge pr-909 (#909 fix(changes): 变更面板两侧行数不再相加,各分组各读自己那一侧) into dev(@UNscientific-9)
冲突解决:删除 addLineCounts,状态读数改为分侧(staged/unstaged 各自一张表),
保留 dev 的 pathspec 化 numstat 读取(--literal-pathspecs + 原路径 + 行/字段上限)。
同批带上 #607 落地后暴露的两处适配:
- discoverRepoRoots 的 BFS 发现根改走 realpath(macOS tmpdir 的 /var → /private/var 别名,
  否则 rev-parse 的根与扫描根是同一仓库的两种拼法,dev 的 canonical() 断言当场红);
- tests/git-worktree 的 numstat pathspec 用例按分侧形状断言(合计仍为 +3/−0)。
2026-10-16 16:35:59 +08:00
Menghuan1918 15665f1ff3 merge pr-607 (#607 feat(git): 工作区根为仓库时仍探测并展示子目录独立仓库) into dev(@iasiv5) 2026-10-16 16:33:40 +08:00
Menghuan1918 f132c69cb0 merge pr-827 (#827 fix(git): 自动应答 dubious ownership 守卫,单命令注入 safe.directory) into dev(@yanzhaohui1999)
冲突解决:保留 dev 的 runGit 三道护栏(8 MiB 输出上限 / maxNulFields 行数上限 / core.quotePath=false),
把 #827 的 spawnGit + safe.directory 重试叠在其上;GIT_ENV 取并集(GIT_OPTIONAL_LOCKS=0 + LC_ALL=C)。
不复活已被 ebc5d0b6 删除的 runGitRaw(无调用者)。
2026-10-16 16:33:38 +08:00
Menghuan1918 1de5e44394 merge pr-939 (#939 fix(changes): 镜头切换器改用官方 Tabs 样式) into dev(@hairyf) 2026-10-16 16:31:17 +08:00
Menghuan1918 49309251f3 merge pr-968 (#968 feat(changes): 页签名「文件变动」改为「Git」) into dev(@vlln) 2026-10-16 16:31:15 +08:00
Siyan Li 0bc32a9945 fix: serve HTML preview assets with browser-compatible MIME types 2026-10-16 16:20:16 +08:00
NolanHo 37e0354d15 fix(sidechat): drop a command/done whose citation fell in the dropped span (round 5, F2)
The round-5 final report pinned a real bad-seed path on cc11ce4 and
verified my in-flight atomic drops did not cover it: a command/done
whose run SURVIVES while its numeric sourceEventSeq cites an earlier
NON-command event in the dropped span kept the parent seq — a stale
citation the host's commands invariant rejects (the contract: the
citation names an earlier non-command event, never the run). Their
real-data oracle found three such seeds among the forty genuinely
trimming production sessions.

The pre-decision now drops the done when either its run's commandId or
its cited source seq is not in the emitted set (the run staying behind
is legal — an open command), and rebaseEvent's runtime belt returns
DROPPED for an unmappable citation instead of leaving the parent value.
The spec's both-kept fixture is rewritten against the host contract:
unique commandId per run and a citation pointing at the user message,
asserting the remapped citation names a non-command event. A mutation
that removes the droppedGroups filter reddens the mid-keep-group case,
so the atomic-drop chain and the bracket gate now have an in-repo pin.
2026-10-16 16:14:41 +08:00
NolanHo b5e6d4daac docs(sidechat): record the round-5 atomic-drop rework and the real-data regressions it fixed 2026-10-16 16:14:41 +08:00
NolanHo f320cdee83 fix(sidechat): drop grouped records atomically and honor the host's optional removedCount (round 5)
The round-5 delta review and the real-data re-run exposed two v5
regressions that disabled the optimization exactly where it matters.

First, the new bracket gate fell back on real multi-group sessions: a
mid-keep compaction group's summary cites nodes a later group
re-shadowed, so record-level dropping stranded its successful
compaction/end and the gate rejected the whole tail — the deployment's
main session forked at 9,077 ms with seed 35,993 (the full copy). The
fix is the reviewers' other option, now data-backed: decide the
emitted-seq set BEFORE emission and drop unmatched groups ATOMICALLY —
a compaction bracket goes as a whole, a command/done losing its run
goes alone. The fuzz suite recovers from 108 to 129 clean trims per
3000 cases (every one passing the real session, compaction, and
commands invariants plus the real inbox projection), and the round-4
cascade counterexample flips from fallback to a clean trim.

Second, v5 treated a missing removedCount as invalid, but the host
contract makes it optional and defaults it to 0 — the host's own writer
omits it for pure inserts, 54% of production splices are like that,
and 38 of 89 real compaction sessions (including the e2e main session)
fell back purely on this. Restored the ?? 0 default while keeping the
rest of the host-fold strictness.

The round-4 spec case is rewritten against the host's chained-replace
semantics (the consumed group swallows the surface span as it exists
at ITS fold moment), which turned it from an empty test — the fixture
could not fold at all, so it pinned nothing — into a real pin: the
atomic drop trims with the earlier group's records gone entirely.
Final second-instance e2e on the real main session: 953 ms, seed
3,457 (10.4x), and a cold-context answer that only the compaction
summaries could contain.
2026-10-16 16:14:41 +08:00
NolanHo a106e1964e fix(sidechat): keep grouped records atomic and pin them with host-oracle tests (review round 4)
Round 4 (two fresh reviewers, pinned to both 657dcd5 and 196fa11)
could not falsify the core equivalence (2100 generated shapes, 113
trims all passing the real session invariant, Session.create, the real
durable-inbox projection, and node-by-node deriveEventMessage wire
comparison; every non-trim byte-identical to the legacy full copy) but
both votes converged on one root cause: host GROUPED records were
split by record-level dropping. A kept compaction group could lose its
summary to the dropped span and strand a successful compaction/end the
host's compaction invariant companion rejects; a command/done could
outlive its command/run the commands companion rejects — invisible to
all three existing self-checks. The inbox fix from the e2e (196fa11)
was verified: the positional durable-inbox projection is the layer the
host rejects at, and the walk-back plus inboxSplicesValid hold.

v5: bracketsValid mirrors the host's grouped-record rules (a successful
compaction/end requires its compaction/summary; a command/done requires
its prior command/run) so a split group falls back to the full copy;
command/done.sourceEventSeq remaps onto the rebased run;
expectedFirstKeptTurn is derived from the skeleton's actual turn/start
(out-of-turn heads no longer renumber against a phantom turn 1); and
inboxSplicesValid matches the host fold's strictness (known targets,
numeric start/removedCount, array inserts, string ids). The spec's
oracle now uses the host's own deriveEventMessage so a projection bug
cannot hide from the equivalence cases, and two new cases pin the
round-4 shapes (same-turn double compaction, command bracket split and
its both-kept control with a remapped sourceEventSeq).
2026-10-16 16:14:41 +08:00