feat(json,csv): bound depth and add multi-value/multi-row APIs
This commit is contained in:
1 parent
efbb8007e1
commit
94a13880c4
10 files changed
+316
-12
No files matched your search
+3
-3
@@ -202,14 +202,14 @@ This is still a **local VM lane**, not a self-hosted GitHub Actions security URL
|
||||
over the existing `resource.*` ABI plus `存在`/`元数据`/`列出目录`/`创建目录`/
|
||||
`删除`/`重命名`/`追加文本`/`读取片段`/`遍历` over `resource.request`
|
||||
(ADR-0041/0045); `data/json`/`data/csv`
|
||||
provide recursive JSON and quoted single-row CSV product parsers; `path` and a
|
||||
`regex` subset are pure `.mq.md`; `datetime` is pure UTC ISO-8601 and
|
||||
provide recursive JSON (128-depth bound, multi-value) and quoted single/multi-row
|
||||
CSV product parsers; `path` and a `regex` subset are pure `.mq.md`; `datetime` is pure UTC ISO-8601 and
|
||||
`clock.现在` reads `clock.now` in project mode (ADR-0042); `env.读取` reads
|
||||
only exact `--allow-env NAME` grants in project mode (ADR-0043); `process.运行`
|
||||
runs an exact `--allow-process PROGRAM` grant with 5 s timeout and 1 MiB caps
|
||||
(ADR-0044, not an OS sandbox); `random.字节` reads explicitly granted
|
||||
`random.bytes` entropy (ADR-0046). File watch, binary offset reads, streaming
|
||||
JSON/CSV, a JSON depth bound and regex groups/alternation remain open.
|
||||
incremental JSON/CSV streaming and regex groups/alternation remain open.
|
||||
- Bundled standard library (CM-A10, ADR-0028): `stdlib/` ships
|
||||
`format`/`text`/`io`/`fs`/`data`/`path`/`regex`/`datetime`/`clock`/`env`/`process`/`random`/`compress`; explicit `std:` imports resolve only inside the bundle;
|
||||
a SHA-256 digest over `*.mq.md` is verified before loading; Analysis records
|
||||
|
||||
@@ -92,8 +92,8 @@ review RFC, not a new crate per provider.
|
||||
| project file write | `resource.open("file", path, ["write"])`; buffers until `close`, never flush-on-drop | implemented, project mode | `resource_streams`, `stdlib_product` |
|
||||
| `std:fs/file` | `读文本/写文本/复制文件/存在/元数据/列出目录/创建目录/删除/重命名/追加文本/读取片段/遍历` over `resource.*`; bounded at 8 MiB | implemented; no watch/binary offset read | `stdlib_product` |
|
||||
| `resource.request` | `resource.request("fs.exists|metadata|list|mkdir|remove|rename", paths)`; project mode, grant-checked, recoverable fs Result | implemented `fs.*`; no seek/append/watch | `resource_streams`, `stdlib_product` |
|
||||
| `std:data/json` | `json.解析(文本)` -> Result with nested Value; `json.格式化(值)` -> Text | implemented (recursive, recoverable errors) | `stdlib_product` |
|
||||
| `std:data/csv` | `csv.解析行(文本)` -> Result with List<Text>; `csv.格式化行(列表)` -> Text | implemented (single row, quoted) | `stdlib_product` |
|
||||
| `std:data/json` | `json.解析/解析多个/格式化`; nested Value, 128-depth bound, recoverable errors | implemented (recursive, multi-value; no streaming) | `stdlib_product` |
|
||||
| `std:data/csv` | `csv.解析行/解析/格式化行/格式化`; quoted single/multi-row, CRLF, quoted newlines | implemented (no streaming) | `stdlib_product` |
|
||||
| `std:path` | `path.连接/文件名/目录名/扩展名/规范/是否绝对`; lexical only | implemented (no I/O) | `stdlib_product` |
|
||||
| `std:regex` | `regex.匹配/搜索` with `^ $ . * + ? [...]` escapes | implemented subset; no groups/alternation | `stdlib_product` |
|
||||
| `std:datetime` | `datetime.格式化(毫秒)` / `datetime.解析(文本)`; UTC ISO-8601, pre-1970 supported | implemented (pure) | `stdlib_product` |
|
||||
@@ -130,7 +130,7 @@ that a phase is complete.
|
||||
| P0 | Documentation drift between `STATUS.md`, the architecture index and the evidence | being fixed by this migration and the docs gate |
|
||||
| P1 | `std:fs/file` read/write/copy, metadata/directory, append/read_at/walk are implemented; watch and binary offset reads remain open | open |
|
||||
| P1 | No file watch or binary `read_at` | open; future Resource Operation extension |
|
||||
| P1 | JSON/CSV product parsers are implemented; no streaming/multi-line CSV or depth-bounded JSON walker | open |
|
||||
| P1 | JSON/CSV product parsers are implemented with depth bound and multi-value/multi-row; no incremental streaming parser | open |
|
||||
| P1 | CLI split into `commands/{sandbox,run,check,inspect,init,package,tool}.rs`; host split into `host/{resource_ops,providers,effects,dispatch}.rs` plus `process.rs`; `commands.rs` keeps shared project/runtime helpers and `host.rs` keeps the `Host` trait methods and capability checks | split; shared helpers and trait methods remain by design |
|
||||
| P2 | HTTP parsing is Unicode-codepoint oriented; a general byte body is not the only path | open; convert before a general network release |
|
||||
| P2 | DNS, UDP, TCP listener and TLS client endpoints are implemented; no TLS server/mTLS or custom-CA CLI | open |
|
||||
|
||||
@@ -0,0 +1,35 @@
|
||||
# Evidence: JSON depth/multi-value and CSV multi-row
|
||||
|
||||
Date: 2026-11-21 (Asia/Shanghai)
|
||||
Source baseline: `efbb8007e172be4662348d73903a2a320d9d6ff9`
|
||||
Repository: `marqdo-cli`
|
||||
RFC item: P1 JSON/CSV completeness
|
||||
|
||||
## Implemented
|
||||
|
||||
- `json.解析` now rejects nesting deeper than 128 with `json.depth`; the
|
||||
depth scanner ignores string contents and escapes.
|
||||
- `json.解析多个(文本)` parses whitespace-separated JSON values and returns
|
||||
`{ok:true,value:List}`, failing atomically on the first bad value.
|
||||
- `csv.解析(文本)` parses multi-row CSV with quoted fields, `""`, CRLF/LF and
|
||||
quoted newlines; `csv.格式化(行列表)` rebuilds the text.
|
||||
- `csv.解析行`/`格式化行` remain the single-row API.
|
||||
|
||||
## Tests
|
||||
|
||||
`stdlib/tests/json.mq.md` covers 130-level input -> `json.depth` and
|
||||
multi-value parsing; `stdlib/tests/csv.mq.md` covers quoted multi-row input
|
||||
and formatting. Both run through `std:` imports in the product lane.
|
||||
|
||||
```text
|
||||
cargo fmt --all -- --check PASS
|
||||
cargo clippy --workspace --all-targets -- -D warnings PASS
|
||||
cargo test --workspace 490 passed, 0 failed, 2 ignored
|
||||
cargo test -p marqdo-cli --test stdlib_product 16 passed
|
||||
python3 tools/pack-stdlib.py PASS
|
||||
```
|
||||
|
||||
## Not covered
|
||||
|
||||
No incremental/chunked JSON or CSV parser: both still require the full text in
|
||||
one Text value. No streaming parser state/Resource kind.
|
||||
Reference in new issue
Block a user