fix: make View fixtures run from the standalone beta archive

This commit is contained in:
cflmy committed 2026-11-22 21:28:55 +08:00
1 parent ce0efe5fc2
commit 34de5a34d9
10 files changed
+640 -21484

No files matched your search

+6
View File
@@ -49,3 +49,9 @@ Beta 版 CLI 必须使用 prerelease 范围(`>=3.0.0-beta.1,<4.0.0`);`>=3.
- `trace.source.root_id == analysis.project.root_id`;事件 `module_id` 必须存在于 Analysis。
- `trace.truncated != null` → `TRUNCATED`,不声明全部分支/循环已遍历。
- 运行只使用 `MARQDO_BIN` 子进程与公开 JSON;不链接 Core crate、不读 Core 源码、不依赖私有 IR。
## 官方 Beta 归档的标准库
`v3.0.0-beta.1` 的 Linux 归档未携带 `stdlib/`。View 的冻结验收示例使用
该二进制公开的 Memory、stdout 和文件资源原语。含 `std:` 导入的项目由
所选 Core 校验,缺少标准库时由 View 展示 Core 的诊断。
+13 -3
View File
@@ -1,6 +1,6 @@
# @knowledge 控制流演示
下面的函数没有任何必需参数,因此可以在 `pure` 模式下显式运行并产生真实 Trace。
下面的函数可以在 `pure` 模式显式运行并产生真实 Trace。示例把 ASCII 数字和换行写入标准输出资源。
# @exec 演示
@@ -8,20 +8,30 @@
`x = 0`
`buffer = memory.new(1, 1)`
`buffer[1] = 10`
`stdout = resource.open("stdio", "stdout", ["write"])`
**while x < 3**
**if x > 1**
**print(x)**
`buffer[0] = 48 + x`
**else**
**print(0)**
`buffer[0] = 48`
**end**
`resource.write(stdout, buffer, 0, 2)`
**x = x + 1**
**end**
`resource.close(stdout)`
`return 3`
+2 -7
View File
@@ -1,8 +1,3 @@
---
import:
fs_lib: "std:fs/file"
---
# @knowledge 受控写入示例
本文件只有在显式提交 `project` 运行并授予项目内 `out/**` 写入权限时才会写文件。
@@ -10,8 +5,8 @@ import:
## @exec main
**创建 = fs_lib.创建目录("out")**
**创建 = resource.request("fs.mkdir", ["out"])**
**写入 = fs_lib.写文本("out/view-sentinel.txt", "explicit run only\n")**
**写入 = fs.write("out/view-sentinel.txt", "explicit run only\n")**
*return 写入*
+5 -1
View File
@@ -23,7 +23,11 @@ cd "$work"
echo "==> check all five example documents (no execution)"
for file in welcome.mq.md branch-loop.mq.md function-params.mq.md knowledge-only.mq.md unsafe-side-effect.mq.md; do
"$MARQDO_BIN" check "$file" --emit "analysis-$file.json" --json >/dev/null
if ! "$MARQDO_BIN" check "$file" --emit "analysis-$file.json" --json > "check-$file.json"; then
echo "error: frozen CLI refused $file" >&2
cat "check-$file.json" >&2
exit 1
fi
test -s "analysis-$file.json"
done
+3 -3
View File
@@ -73,9 +73,9 @@ fn real_control_flow_trace_binds_and_projects_events() {
);
let projection = &run.projection;
assert_eq!(projection.state, RunDisplayState::Succeeded);
assert_eq!(projection.counts.total(), 285);
assert_eq!(projection.entry_event_count, 18);
assert_eq!(projection.other_event_count, 267);
assert_eq!(projection.counts.total(), 27);
assert_eq!(projection.entry_event_count, 27);
assert_eq!(projection.other_event_count, 0);
assert_eq!(projection.run_status, "ok");
assert!(projection.truncated.is_none());
assert_eq!(projection.stdout, "0\n0\n2\n");
File diff suppressed because it is too large. Load diff
+22 -66
View File
@@ -6,102 +6,58 @@
"success": true,
"trace": [
{
"duration_micros": 17,
"module": "std:marqdo-stdlib@0.1.0#5407d3665ba2fe105820d0f1af5efaafa10c277a69eb819c3225719813c8c713::io/stream.mq.md",
"duration_micros": 14,
"module": "root:control-flow@0.1.0::index.mq.md",
"op": "resource.open",
"result": "ok",
"seq": 66,
"seq": 4,
"span": {
"end": 1581,
"start": 1538
"end": 304,
"start": 261
}
},
{
"duration_micros": 2,
"module": "std:marqdo-stdlib@0.1.0#5407d3665ba2fe105820d0f1af5efaafa10c277a69eb819c3225719813c8c713::io/stream.mq.md",
"duration_micros": 21,
"module": "root:control-flow@0.1.0::index.mq.md",
"op": "resource.write",
"result": "kind=stdio count=2",
"seq": 70,
"seq": 10,
"span": {
"end": 730,
"start": 678
}
},
{
"duration_micros": 1,
"module": "std:marqdo-stdlib@0.1.0#5407d3665ba2fe105820d0f1af5efaafa10c277a69eb819c3225719813c8c713::io/stream.mq.md",
"op": "resource.close",
"result": "flushed_bytes=0",
"seq": 85,
"span": {
"end": 1666,
"start": 1647
}
},
{
"duration_micros": 2,
"module": "std:marqdo-stdlib@0.1.0#5407d3665ba2fe105820d0f1af5efaafa10c277a69eb819c3225719813c8c713::io/stream.mq.md",
"op": "resource.open",
"result": "ok",
"seq": 160,
"span": {
"end": 1581,
"start": 1538
"end": 434,
"start": 398
}
},
{
"duration_micros": 0,
"module": "std:marqdo-stdlib@0.1.0#5407d3665ba2fe105820d0f1af5efaafa10c277a69eb819c3225719813c8c713::io/stream.mq.md",
"module": "root:control-flow@0.1.0::index.mq.md",
"op": "resource.write",
"result": "kind=stdio count=2",
"seq": 164,
"seq": 16,
"span": {
"end": 730,
"start": 678
"end": 434,
"start": 398
}
},
{
"duration_micros": 0,
"module": "std:marqdo-stdlib@0.1.0#5407d3665ba2fe105820d0f1af5efaafa10c277a69eb819c3225719813c8c713::io/stream.mq.md",
"op": "resource.close",
"result": "flushed_bytes=0",
"seq": 179,
"span": {
"end": 1666,
"start": 1647
}
},
{
"duration_micros": 0,
"module": "std:marqdo-stdlib@0.1.0#5407d3665ba2fe105820d0f1af5efaafa10c277a69eb819c3225719813c8c713::io/stream.mq.md",
"op": "resource.open",
"result": "ok",
"seq": 253,
"span": {
"end": 1581,
"start": 1538
}
},
{
"duration_micros": 0,
"module": "std:marqdo-stdlib@0.1.0#5407d3665ba2fe105820d0f1af5efaafa10c277a69eb819c3225719813c8c713::io/stream.mq.md",
"module": "root:control-flow@0.1.0::index.mq.md",
"op": "resource.write",
"result": "kind=stdio count=2",
"seq": 257,
"seq": 21,
"span": {
"end": 730,
"start": 678
"end": 434,
"start": 398
}
},
{
"duration_micros": 0,
"module": "std:marqdo-stdlib@0.1.0#5407d3665ba2fe105820d0f1af5efaafa10c277a69eb819c3225719813c8c713::io/stream.mq.md",
"module": "root:control-flow@0.1.0::index.mq.md",
"op": "resource.close",
"result": "flushed_bytes=0",
"seq": 272,
"seq": 24,
"span": {
"end": 1666,
"start": 1647
"end": 484,
"start": 462
}
}
],
File diff suppressed because it is too large. Load diff
@@ -4,7 +4,19 @@
"stderr": "",
"stdout": "0\n0\n2\n",
"success": true,
"trace": [],
"trace": [
{
"duration_micros": 10,
"module": "root:control-flow@0.1.0::index.mq.md",
"op": "resource.open",
"result": "ok",
"seq": 4,
"span": {
"end": 304,
"start": 261
}
}
],
"value": {
"decimal": "3",
"type": "int"
@@ -9,47 +9,48 @@
"span": null
},
{
"detail": "continue",
"function_id": "root:control-flow@0.1.0::index.mq.md::演示.main",
"kind": "loop.iteration",
"detail": "initial_pages=1 max_pages=1",
"function_id": null,
"kind": "memory.new",
"module_id": "root:control-flow@0.1.0::index.mq.md",
"seq": 1,
"span": {
"end": 197,
"start": 182
"end": 230,
"start": 214
}
},
{
"detail": "false",
"detail": "byte",
"function_id": "root:control-flow@0.1.0::index.mq.md::演示.main",
"kind": "branch.eval",
"kind": "memory.write",
"module_id": "root:control-flow@0.1.0::index.mq.md",
"seq": 2,
"span": {
"end": 211,
"start": 199
"end": 243,
"start": 234
}
},
{
"detail": "true",
"function_id": "root:control-flow@0.1.0::index.mq.md::演示.main",
"kind": "branch.eval",
"detail": "kind=stdio descriptor=stdout",
"function_id": null,
"kind": "resource.open",
"module_id": "root:control-flow@0.1.0::index.mq.md",
"seq": 3,
"span": {
"end": 211,
"start": 199
"end": 304,
"start": 261
}
},
{
"detail": null,
"function_id": "std:marqdo-stdlib@0.1.0#5407d3665ba2fe105820d0f1af5efaafa10c277a69eb819c3225719813c8c713::io.mq.md::io.写值",
"kind": "call.enter",
"detail": "ok",
"duration_micros": 10,
"kind": "effect",
"module_id": "root:control-flow@0.1.0::index.mq.md",
"operation": "resource.open",
"seq": 4,
"span": {
"end": 247,
"start": 239
"end": 304,
"start": 261
}
},
{
@@ -66,13 +67,13 @@
},
"run": {
"entry": "root:control-flow@0.1.0::index.mq.md::main",
"id": "6-1795317753027990146",
"id": "31-1795354081721454068",
"status": "ok"
},
"schema": "marqdo.trace",
"schema_version": 2,
"source": {
"analysis_digest": "sha256:e2aca5a1a0c9fa073a21b5af7deb8ef493ac981b97c788b721347c24c94f48ab",
"analysis_digest": "sha256:392c82598cdd9d649951133df9a364d85bca7036aa653a4139aab190e9040af4",
"root_id": "root:control-flow@0.1.0"
},
"truncated": {