Skip to content

Commit 71a108f

Browse files
committed
feat:1.4.0 (c)
- **相较 1.3.x:`applyEditWithDiff(...)` 现在优先保证有界、可预期** - 细粒度 diff 精化现在受全局预算约束(比较数 / 锚点 / op / 子树规模 / wall-clock),一旦继续细化不划算,就会直接退化为 coarse splice 或保守整树 diff。 - 预算超限属于正常控制流,不再表现为“精化过程像异常一样失败”;对接入方来说,拿到的是稳定的保守 diff,而不是额外的异常形态。 - 当这次编辑实际命中增量路径时,root 级精细 diff 会先局部化到增量 dirty window,而不是继续对整棵 root tree 细化。 - **相较 1.3.x:保守 diff 的语义更清晰** - 当调用方能提供完整快照长度时,整树保守 fallback 现在会报告整文档 dirty span,避免在无 position 回退场景下把脏区误报得过小。 - 默认 `diffRefinementDepthCap` 已调低,深层嵌套 diff 会更早退化,极端树输入下的行为也更一致。
1 parent e2b319b commit 71a108f

9 files changed

Lines changed: 1167 additions & 207 deletions

File tree

CHANGELOG.md

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,12 @@
77
- **Compared with 1.3.x: incremental integration is now stable**
88
- `parseIncremental`, `updateIncremental`, `tryUpdateIncremental`, and `createIncrementalSession` are now presented as stable integration surfaces rather than provisional internals.
99
- Session fallback behavior and diff payload expectations are now treated as versioned guarantees for host applications.
10-
- **Compared with 1.3.x: large or deeply nested edits are more predictable to integrate**
11-
- Incremental updates and `applyEditWithDiff(...)` now behave more conservatively when fine-grained refinement would be too costly or unsafe.
12-
- The default `diffRefinementDepthCap` is now lower, so deep nested diff refinement degrades to coarse splice ops earlier by default.
13-
- For downstream consumers, this means fewer surprising edge-case failures and clearer upgrade expectations around fallback behavior.
10+
- **Compared with 1.3.x: `applyEditWithDiff(...)` now prefers bounded, predictable diff behavior**
11+
- Fine-grained diff refinement is now budgeted (`compare` / `anchor` / `op` / subtree-size / wall-clock caps) and degrades directly to coarse splice or conservative whole-tree diff when the cost stops being worthwhile.
12+
- When the edit stays on the incremental path, root-level fine diff is localized to the incremental dirty window instead of continuing to refine the entire root tree.
13+
- **Compared with 1.3.x: conservative diff semantics are clearer**
14+
- Whole-tree conservative fallback now reports whole-document dirty spans when the caller provides full snapshot lengths, avoiding misleadingly small dirty-span reports in no-position fallback cases.
15+
- The default `diffRefinementDepthCap` is lower, so deeply nested refinement degrades earlier by default and extreme trees behave more consistently across edits.
1416
- **Upgrade note**
1517
- No breaking public API changes in `1.4.0`.
1618
- Existing `1.3.x` integrations can upgrade directly to `1.4.x`.

CHANGELOG.zh-CN.md

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,12 @@
77
- **相较 1.3.x:增量集成现在已进入 stable**
88
- `parseIncremental``updateIncremental``tryUpdateIncremental``createIncrementalSession` 不再只是“暂时可用的内部能力”,而是可按稳定集成面理解的公开能力。
99
- session 的回退语义与 diff 返回预期,现在可以按版本契约来理解和升级。
10-
- **相较 1.3.x:大编辑与深层结构下的行为更可预期**
11-
- 当细粒度精化成本过高或存在风险时,增量更新与 `applyEditWithDiff(...)` 会更保守地选择安全路径。
12-
- 默认 `diffRefinementDepthCap` 现已调低,深层嵌套 diff 会更早退化为较粗粒度的 splice。
13-
- 对接入方来说,这意味着极端输入下更少的意外失败,以及更清晰的 fallback 预期。
10+
- **相较 1.3.x:`applyEditWithDiff(...)` 现在优先保证有界、可预期**
11+
- 细粒度 diff 精化现在受全局预算约束(比较数 / 锚点 / op / 子树规模 / wall-clock),一旦继续细化不划算,就会直接退化为 coarse splice 或保守整树 diff。
12+
- 当这次编辑实际命中增量路径时,root 级精细 diff 会先局部化到增量 dirty window,而不是继续对整棵 root tree 细化。
13+
- **相较 1.3.x:保守 diff 的语义更清晰**
14+
- 当调用方能提供完整快照长度时,整树保守 fallback 现在会报告整文档 dirty span,避免在无 position 回退场景下把脏区误报得过小。
15+
- 默认 `diffRefinementDepthCap` 已调低,深层嵌套 diff 会更早退化,极端树输入下的行为也更一致。
1416
- **升级说明**
1517
- `1.4.0` 没有破坏性公共 API 变更。
1618
- 现有 `1.3.x` 集成代码可直接升级到 `1.4.x`

GUIDE.zh-CN.md

Lines changed: 26 additions & 19 deletions
Large diffs are not rendered by default.

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -432,7 +432,7 @@ Use these when you are not parsing once, but keeping a document alive across man
432432
This incremental API set is part of the stable public surface in `1.4.x`.
433433
In particular, session-level fallback is a documented contract rather than an exceptional edge case:
434434
`applyEdit(...)` / `applyEditWithDiff(...)` may return `mode: "full-fallback"` with a `fallbackReason`,
435-
and `sessionOptions.diffRefinementDepthCap` lets you trade nested diff granularity for cost on very deep trees.
435+
and diff refinement knobs now live under `sessionOptions.diff` (or per-call `applyEditWithDiff(..., diffOptions)`).
436436

437437
- `parseIncremental(source, options?)` — build and return the **first** incremental snapshot (`IncrementalDocument`)
438438
- `createIncrementalSession(source, options?, sessionOptions?)` — create a **long-lived session** for repeated edits

0 commit comments

Comments
 (0)