spec: 写侧落盘时机入条款;tutorial/04-ndarray 散列形态读数改用 kvspace·listlen - #353
Merged
Merged
Conversation
durable 的 body 由调用方在返回后填,返回前无法落盘,所以「写即持久」这句承诺本身 就是错的。改成写清真实时机:本笔在下一次 kvspace* 调用(读也算,每个 op 开头先落盘 上一笔)或 kvspaceClose 时落盘;前者失败以返回码 + err 报出,后者失败写 stderr。 进程正常退出(exit / main 返回)时,前端对所有未 Close 句柄兜底关闭即落盘——漏调 Close 不丢数据,真丢也绝不静默。shm 后端写即落盘(body 指针即最终位置),两后端在 「下一次调用前可见」这条上一致。 对应实现:array2d/kvspace#25(前端活跃句柄表 + atexit)、 array2d/kvspace-durable#30(close 失败写 stderr)。 Co-Authored-By: Claude Code <noreply@anthropic.com>
array·append / array·slice 作用于 compact 时先自动 scatter,结果是散列(stringkeymap) 形态——判元素数该走 kvspace·listlen,不是 ndarray·numel。 - array_append / array_slice:读数改 kvspace·listlen,注释点明「散列数组的元素数用 kvspace·listlen 读」 - 新增 array_append_sparse:散列数组的 append 坐标由 memindex 决定,追加落「最大坐标 + 1」,不得假设坐标键连续 - 新增 ndarray_numel_scattered:numel 对散列形态读成员数(对齐卷首「三算子统一观测数组 形状,对两形态均适用」) 四个用例当前 FAIL(append 打出 3 而非 4、slice 打出 1 而非 2、sparse 无输出、numel 报 "container [int64]·int64 has no shape; use kvspace…"),钉的是 #330 runtime 侧缺口。 Co-Authored-By: Claude Code <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
两个独立主题,分两个 commit。
1. spec:写侧落盘时机(对应 array2d/kvspace#23)
04-CABI.kv新增 normative 段:durable 的body由调用方在返回后填,返回前无法落盘,所以「写即持久」这句承诺本身就是错的。改成写清真实时机——本笔在下一次kvspace*调用(读也算,每个 op 开头先落盘上一笔)或Close时落盘;前者失败以返回码 + err 报出,后者写 stderr。进程正常退出时前端对所有未 Close 句柄兜底关闭:漏调 Close 不丢数据,真丢也绝不静默。shm 写即落盘,两后端在「下一次调用前可见」上一致。实现已落地并验证:array2d/kvspace#25(前端活跃句柄表 + atexit,19/19 passed)、array2d/kvspace-durable#30(close 失败写 stderr)。
2. tutorial/04-ndarray:读数改用
kvspace·listlen,补两例array·append/array·slice作用于 compact 时先自动 scatter,结果是散列(stringkeymap)形态——判元素数该走kvspace·listlen,不是ndarray·numel。array_append/array_slice:读数改kvspace·listlenarray_append_sparse:散列数组的 append 坐标由 memindex 决定,追加落「最大坐标 + 1」,不得假设坐标键连续ndarray_numel_scattered:numel 对散列形态读成员数这四个用例当前 FAIL(append 打出 3 而非 4、slice 打出 1 而非 2、sparse 无输出、numel 报
container [int64]·int64 has no shape; use kvspace…),钉的是 #330 runtime 侧缺口,故 CI 预期双后端皆红。🤖 Generated with Claude Code