Skip to content

Commit 2fdb554

Browse files
github-actions[bot]Liam0205
authored andcommitted
docs(llmdoc): fix stale Recall SetCommon restriction in pine-cpp-runtime
The ValidateOutput type-constraint example still cited "Recall 不能 SetCommon" as the forbidden case, but Recall may now write common fields (mutating semantics). Corrected to list SetItem/RemoveItem/SetItemOrder as the forbidden item-level actions and note Recall may SetCommon. Auto-updated by GitHub Actions
1 parent c353c04 commit 2fdb554

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

llmdoc/architecture/pine-cpp-runtime.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,7 @@ pine-cpp 已超过原计划的 MVP 边界,目前作为完整的运行时存在
106106
- **Frame 锁形态:per-call `std::shared_mutex`**——每次 `item()` / `common()` 内部自取锁,与 pine-go(`sync.RWMutex` per-call)和 pine-java(`ReentrantReadWriteLock` per-call)完全镜像。这是 2026-06 锁优化战役的最终决策:曾实现 dispatch 级 hoist(单 op 一次锁窗口,calibrated +4%)但为跨运行时锁形态对齐而 revert(commit `3c87bd6`);历史方案与数据见 git log `9f7db78` / `a7d3b31``.code-review/sharedmutex-deep-dive/analysis.md`
107107
- `include/pine/shared_mutex.hpp``pine::SharedMutex`,Go `sync.RWMutex` 协议的 C++ port(fetch_add + 负数宣告 + semaphore),单次拿放 10.14ns 超 Go 的 13.75ns(该组件的设计验收标准),10 doctest + TSan 验证。**当前 Frame 不使用它**:锁在 calibrated 负载上仅占 ~2% CPU,切换收益(0.4-0.9 个百分点)低于二进制布局噪声。它是已验证备件——当出现锁占比 >5% 的负载时,一行替换 typedef 即可启用
108108
- `OperatorOutput` write-log 模式:算子只声明写入意图,由 frame 应用,便于 trace/debug。`item_writes_` 内部为 `vector<ItemWrite>``struct ItemWrite { int index; std::string field; Variant value; }`),`set_item` 为 O(1) 摊销 push_back;`apply_output` 按顺序重放(last-write-wins 语义),`snapshot_output` 显式 group 到 map 保持最终状态视图
109-
- **ValidateOutput 类型约束**(R3-H1):每个算子 execute 后、apply_output 前,按 operator_type 检查输出方法是否合法(Recall 不能 SetCommon),违规抛 ExecutionError `"type violation: operator type X must not call [Method1 Method2]"`
109+
- **ValidateOutput 类型约束**(R3-H1):每个算子 execute 后、apply_output 前,按 operator_type 检查输出方法是否合法(Recall 不能 SetItem/RemoveItem/SetItemOrder,只能 AddItem;但 **Recall 可以 SetCommon**——写请求级 common 状态是正常的 mutating hazard,DAG 已按 CommonOutput 构建 RAW/WAW/WAR 边),违规抛 ExecutionError `"type violation: operator type X must not call [Method1 Method2]"`
110110
- **算子输入投影层**
111111
- **`OperatorInput`**`include/pine/operator_input.hpp`):Frame + InputFieldSpec 之上的 lazy read-only proxy。算子签名为 `execute(const OperatorInput&, OperatorOutput&)`,通过 `common(field)` / `item(i, field)` 按需读取,自动替换 defaulted 字段。避免旧实现的 O(N×M) eager reify(逐 item×field 预复制到 `vector<map>`)。**`item_count` 在构造时缓存**,避免每次调用获取 shared_lock
112112
- `build_operator_input(frame, op_name, spec)` 工厂:按 `strict_common → nullable_common → strict_item → nullable_item`(先 common 后 item)顺序校验输入字段,通过后构造 lazy proxy。校验分两个 `with_read_lock` 窗口完成——窗口1 做 strict + nullable common;`validate_strict_items``shared_mutex` 非递归(不能嵌套取锁)必须在窗口外独立取锁,排在 common 之后、nullable item 之前;窗口2 做 nullable item(热路径 N×M 仍折叠进单个 lock 窗口)。**该顺序是字节级错误对等契约的一部分**:当一个 config 同时违反 common 与 strict item 时,三运行时必须抛出同一个"首个错误"(common 先于 item),不可被锁/批量化优化隐式改写(参见 `memory/reflections/review-driven-build-input-error-ordering.md`

0 commit comments

Comments
 (0)