Compare commits
39
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
deadf6edee | ||
|
|
72f57beee0 | ||
|
|
f8b82d4143 | ||
|
|
f836f05998 | ||
|
|
98d256f5a2 | ||
|
|
89acb709c6 | ||
|
|
3ab4aaa861 | ||
|
|
2585915e16 | ||
|
|
e2162add22 | ||
|
|
9b4f0a0822 | ||
|
|
c769eafc60 | ||
|
|
2acaaefe77 | ||
|
|
88ce91a9e1 | ||
|
|
0e1efc713e | ||
|
|
ab6b6b1a23 | ||
|
|
3a68260cf2 | ||
|
|
422b9de6d7 | ||
|
|
1b9d9c4c26 | ||
|
|
b9c72e1d2a | ||
|
|
4bbefc9244 | ||
|
|
452e9a32bd | ||
|
|
63f62d5728 | ||
|
|
4a4ca63b45 | ||
|
|
b1fc211916 | ||
|
|
8473ac9827 | ||
|
|
e0645f376b | ||
|
|
7064c5f22c | ||
|
|
31ccfe15f8 | ||
|
|
1543d33c8a | ||
|
|
8737e093d6 | ||
|
|
0b7f238fd8 | ||
|
|
93e125e921 | ||
|
|
6d4209bf32 | ||
|
|
99789616a4 | ||
|
|
1b214d48da | ||
|
|
d8212aaa01 | ||
|
|
629fb9834d | ||
|
|
88d7cd3414 | ||
|
|
e6066e6ba9 |
No files matched your search
File diff suppressed because it is too large.
Load diff
@@ -0,0 +1,940 @@
|
|||||||
|
{
|
||||||
|
"schema": "marqdo.analysis",
|
||||||
|
"schema_version": 3,
|
||||||
|
"producer": {
|
||||||
|
"name": "marqdo",
|
||||||
|
"version": "3.0.0-rc.4",
|
||||||
|
"markdown_profile": "marqdo.md.v1"
|
||||||
|
},
|
||||||
|
"project": {
|
||||||
|
"root_id": "sha256:68fe7f20571673eda2078779c82fb2457f109e6c31da95b8b91b0513acb0fe15",
|
||||||
|
"identity_kind": "workspace_snapshot",
|
||||||
|
"entry_module_id": "root:default::85-nested-loop-control.mq.md",
|
||||||
|
"lock_digest": "",
|
||||||
|
"manifest_digest": "",
|
||||||
|
"stdlib": {
|
||||||
|
"version": "0.2.0",
|
||||||
|
"digest": "sha256:db905508dde89763b9d43b47fc5d52c6a1d5445a91f3c86a550ced43e8aac9d7",
|
||||||
|
"instance_id": "std:marqdo-stdlib@0.2.0#db905508dde89763b9d43b47fc5d52c6a1d5445a91f3c86a550ced43e8aac9d7"
|
||||||
|
},
|
||||||
|
"extensions": []
|
||||||
|
},
|
||||||
|
"modules": [
|
||||||
|
{
|
||||||
|
"id": "root:default::85-nested-loop-control.mq.md",
|
||||||
|
"package_instance_id": "root:default",
|
||||||
|
"relative_path": "85-nested-loop-control.mq.md",
|
||||||
|
"source_digest": "f0d654a033937dd5ab963cb021a155e2e01f05fc3a865af9907ebabbbc5a9b24",
|
||||||
|
"source": "## @exec main\n\n`外 = 0`\n\n`合计 = 0`\n\n`while 外 < 3`\n\n`外 = 外 + 1`\n\n`内 = 0`\n\n`while 内 < 4`\n\n`内 = 内 + 1`\n\n`if 内 == 1`\n\n`continue`\n\n`else if 内 == 3`\n\n`break`\n\n`end`\n\n`合计 = 合计 + 外`\n\n`end`\n\n`if 外 == 2`\n\n`continue`\n\n`end`\n\n`合计 = 合计 + 10`\n\n`end`\n\n`return 合计`\n",
|
||||||
|
"document": {
|
||||||
|
"children": [
|
||||||
|
{
|
||||||
|
"children": [
|
||||||
|
{
|
||||||
|
"children": [],
|
||||||
|
"kind": "text",
|
||||||
|
"literal": "@exec main",
|
||||||
|
"span": {
|
||||||
|
"end": 13,
|
||||||
|
"start": 3
|
||||||
|
}
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"kind": "heading",
|
||||||
|
"level": 2,
|
||||||
|
"setext": false,
|
||||||
|
"span": {
|
||||||
|
"end": 13,
|
||||||
|
"start": 0
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"children": [
|
||||||
|
{
|
||||||
|
"children": [],
|
||||||
|
"kind": "code",
|
||||||
|
"literal": "外 = 0",
|
||||||
|
"span": {
|
||||||
|
"end": 24,
|
||||||
|
"start": 15
|
||||||
|
},
|
||||||
|
"ticks": 1
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"kind": "paragraph",
|
||||||
|
"span": {
|
||||||
|
"end": 24,
|
||||||
|
"start": 15
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"children": [
|
||||||
|
{
|
||||||
|
"children": [],
|
||||||
|
"kind": "code",
|
||||||
|
"literal": "合计 = 0",
|
||||||
|
"span": {
|
||||||
|
"end": 38,
|
||||||
|
"start": 26
|
||||||
|
},
|
||||||
|
"ticks": 1
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"kind": "paragraph",
|
||||||
|
"span": {
|
||||||
|
"end": 38,
|
||||||
|
"start": 26
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"children": [
|
||||||
|
{
|
||||||
|
"children": [],
|
||||||
|
"kind": "code",
|
||||||
|
"literal": "while 外 < 3",
|
||||||
|
"span": {
|
||||||
|
"end": 55,
|
||||||
|
"start": 40
|
||||||
|
},
|
||||||
|
"ticks": 1
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"kind": "paragraph",
|
||||||
|
"span": {
|
||||||
|
"end": 55,
|
||||||
|
"start": 40
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"children": [
|
||||||
|
{
|
||||||
|
"children": [],
|
||||||
|
"kind": "code",
|
||||||
|
"literal": "外 = 外 + 1",
|
||||||
|
"span": {
|
||||||
|
"end": 72,
|
||||||
|
"start": 57
|
||||||
|
},
|
||||||
|
"ticks": 1
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"kind": "paragraph",
|
||||||
|
"span": {
|
||||||
|
"end": 72,
|
||||||
|
"start": 57
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"children": [
|
||||||
|
{
|
||||||
|
"children": [],
|
||||||
|
"kind": "code",
|
||||||
|
"literal": "内 = 0",
|
||||||
|
"span": {
|
||||||
|
"end": 83,
|
||||||
|
"start": 74
|
||||||
|
},
|
||||||
|
"ticks": 1
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"kind": "paragraph",
|
||||||
|
"span": {
|
||||||
|
"end": 83,
|
||||||
|
"start": 74
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"children": [
|
||||||
|
{
|
||||||
|
"children": [],
|
||||||
|
"kind": "code",
|
||||||
|
"literal": "while 内 < 4",
|
||||||
|
"span": {
|
||||||
|
"end": 100,
|
||||||
|
"start": 85
|
||||||
|
},
|
||||||
|
"ticks": 1
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"kind": "paragraph",
|
||||||
|
"span": {
|
||||||
|
"end": 100,
|
||||||
|
"start": 85
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"children": [
|
||||||
|
{
|
||||||
|
"children": [],
|
||||||
|
"kind": "code",
|
||||||
|
"literal": "内 = 内 + 1",
|
||||||
|
"span": {
|
||||||
|
"end": 117,
|
||||||
|
"start": 102
|
||||||
|
},
|
||||||
|
"ticks": 1
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"kind": "paragraph",
|
||||||
|
"span": {
|
||||||
|
"end": 117,
|
||||||
|
"start": 102
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"children": [
|
||||||
|
{
|
||||||
|
"children": [],
|
||||||
|
"kind": "code",
|
||||||
|
"literal": "if 内 == 1",
|
||||||
|
"span": {
|
||||||
|
"end": 132,
|
||||||
|
"start": 119
|
||||||
|
},
|
||||||
|
"ticks": 1
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"kind": "paragraph",
|
||||||
|
"span": {
|
||||||
|
"end": 132,
|
||||||
|
"start": 119
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"children": [
|
||||||
|
{
|
||||||
|
"children": [],
|
||||||
|
"kind": "code",
|
||||||
|
"literal": "continue",
|
||||||
|
"span": {
|
||||||
|
"end": 144,
|
||||||
|
"start": 134
|
||||||
|
},
|
||||||
|
"ticks": 1
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"kind": "paragraph",
|
||||||
|
"span": {
|
||||||
|
"end": 144,
|
||||||
|
"start": 134
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"children": [
|
||||||
|
{
|
||||||
|
"children": [],
|
||||||
|
"kind": "code",
|
||||||
|
"literal": "else if 内 == 3",
|
||||||
|
"span": {
|
||||||
|
"end": 164,
|
||||||
|
"start": 146
|
||||||
|
},
|
||||||
|
"ticks": 1
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"kind": "paragraph",
|
||||||
|
"span": {
|
||||||
|
"end": 164,
|
||||||
|
"start": 146
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"children": [
|
||||||
|
{
|
||||||
|
"children": [],
|
||||||
|
"kind": "code",
|
||||||
|
"literal": "break",
|
||||||
|
"span": {
|
||||||
|
"end": 173,
|
||||||
|
"start": 166
|
||||||
|
},
|
||||||
|
"ticks": 1
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"kind": "paragraph",
|
||||||
|
"span": {
|
||||||
|
"end": 173,
|
||||||
|
"start": 166
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"children": [
|
||||||
|
{
|
||||||
|
"children": [],
|
||||||
|
"kind": "code",
|
||||||
|
"literal": "end",
|
||||||
|
"span": {
|
||||||
|
"end": 180,
|
||||||
|
"start": 175
|
||||||
|
},
|
||||||
|
"ticks": 1
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"kind": "paragraph",
|
||||||
|
"span": {
|
||||||
|
"end": 180,
|
||||||
|
"start": 175
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"children": [
|
||||||
|
{
|
||||||
|
"children": [],
|
||||||
|
"kind": "code",
|
||||||
|
"literal": "合计 = 合计 + 外",
|
||||||
|
"span": {
|
||||||
|
"end": 205,
|
||||||
|
"start": 182
|
||||||
|
},
|
||||||
|
"ticks": 1
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"kind": "paragraph",
|
||||||
|
"span": {
|
||||||
|
"end": 205,
|
||||||
|
"start": 182
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"children": [
|
||||||
|
{
|
||||||
|
"children": [],
|
||||||
|
"kind": "code",
|
||||||
|
"literal": "end",
|
||||||
|
"span": {
|
||||||
|
"end": 212,
|
||||||
|
"start": 207
|
||||||
|
},
|
||||||
|
"ticks": 1
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"kind": "paragraph",
|
||||||
|
"span": {
|
||||||
|
"end": 212,
|
||||||
|
"start": 207
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"children": [
|
||||||
|
{
|
||||||
|
"children": [],
|
||||||
|
"kind": "code",
|
||||||
|
"literal": "if 外 == 2",
|
||||||
|
"span": {
|
||||||
|
"end": 227,
|
||||||
|
"start": 214
|
||||||
|
},
|
||||||
|
"ticks": 1
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"kind": "paragraph",
|
||||||
|
"span": {
|
||||||
|
"end": 227,
|
||||||
|
"start": 214
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"children": [
|
||||||
|
{
|
||||||
|
"children": [],
|
||||||
|
"kind": "code",
|
||||||
|
"literal": "continue",
|
||||||
|
"span": {
|
||||||
|
"end": 239,
|
||||||
|
"start": 229
|
||||||
|
},
|
||||||
|
"ticks": 1
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"kind": "paragraph",
|
||||||
|
"span": {
|
||||||
|
"end": 239,
|
||||||
|
"start": 229
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"children": [
|
||||||
|
{
|
||||||
|
"children": [],
|
||||||
|
"kind": "code",
|
||||||
|
"literal": "end",
|
||||||
|
"span": {
|
||||||
|
"end": 246,
|
||||||
|
"start": 241
|
||||||
|
},
|
||||||
|
"ticks": 1
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"kind": "paragraph",
|
||||||
|
"span": {
|
||||||
|
"end": 246,
|
||||||
|
"start": 241
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"children": [
|
||||||
|
{
|
||||||
|
"children": [],
|
||||||
|
"kind": "code",
|
||||||
|
"literal": "合计 = 合计 + 10",
|
||||||
|
"span": {
|
||||||
|
"end": 270,
|
||||||
|
"start": 248
|
||||||
|
},
|
||||||
|
"ticks": 1
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"kind": "paragraph",
|
||||||
|
"span": {
|
||||||
|
"end": 270,
|
||||||
|
"start": 248
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"children": [
|
||||||
|
{
|
||||||
|
"children": [],
|
||||||
|
"kind": "code",
|
||||||
|
"literal": "end",
|
||||||
|
"span": {
|
||||||
|
"end": 277,
|
||||||
|
"start": 272
|
||||||
|
},
|
||||||
|
"ticks": 1
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"kind": "paragraph",
|
||||||
|
"span": {
|
||||||
|
"end": 277,
|
||||||
|
"start": 272
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"children": [
|
||||||
|
{
|
||||||
|
"children": [],
|
||||||
|
"kind": "code",
|
||||||
|
"literal": "return 合计",
|
||||||
|
"span": {
|
||||||
|
"end": 294,
|
||||||
|
"start": 279
|
||||||
|
},
|
||||||
|
"ticks": 1
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"kind": "paragraph",
|
||||||
|
"span": {
|
||||||
|
"end": 294,
|
||||||
|
"start": 279
|
||||||
|
}
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"kind": "document",
|
||||||
|
"span": {
|
||||||
|
"end": 295,
|
||||||
|
"start": 0
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"units": [
|
||||||
|
{
|
||||||
|
"id": "root:default::85-nested-loop-control.mq.md#",
|
||||||
|
"path": [],
|
||||||
|
"parent_id": null,
|
||||||
|
"kind": "root",
|
||||||
|
"name": "",
|
||||||
|
"level": 0,
|
||||||
|
"mode": "knowledge",
|
||||||
|
"mode_origin": "default",
|
||||||
|
"mode_source_unit_id": "root:default::85-nested-loop-control.mq.md#",
|
||||||
|
"heading_span": null,
|
||||||
|
"span": {
|
||||||
|
"start": 0,
|
||||||
|
"end": 295
|
||||||
|
},
|
||||||
|
"function": null
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"id": "root:default::85-nested-loop-control.mq.md#main",
|
||||||
|
"path": [
|
||||||
|
"main"
|
||||||
|
],
|
||||||
|
"parent_id": "root:default::85-nested-loop-control.mq.md#",
|
||||||
|
"kind": "function",
|
||||||
|
"name": "main",
|
||||||
|
"level": 2,
|
||||||
|
"mode": "exec",
|
||||||
|
"mode_origin": "explicit",
|
||||||
|
"mode_source_unit_id": "root:default::85-nested-loop-control.mq.md#main",
|
||||||
|
"heading_span": {
|
||||||
|
"start": 0,
|
||||||
|
"end": 13
|
||||||
|
},
|
||||||
|
"span": {
|
||||||
|
"start": 0,
|
||||||
|
"end": 295
|
||||||
|
},
|
||||||
|
"function": "root:default::85-nested-loop-control.mq.md::main"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"anchors": [
|
||||||
|
{
|
||||||
|
"anchor": "main",
|
||||||
|
"unit_id": "root:default::85-nested-loop-control.mq.md#main"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"functions": [
|
||||||
|
{
|
||||||
|
"id": "root:default::85-nested-loop-control.mq.md::main",
|
||||||
|
"unit_id": "root:default::85-nested-loop-control.mq.md#main",
|
||||||
|
"local_name": "main",
|
||||||
|
"namespace": null,
|
||||||
|
"span": {
|
||||||
|
"start": 0,
|
||||||
|
"end": 294
|
||||||
|
},
|
||||||
|
"heading_span": {
|
||||||
|
"start": 0,
|
||||||
|
"end": 13
|
||||||
|
},
|
||||||
|
"signature": {
|
||||||
|
"kind": "inferred",
|
||||||
|
"params": []
|
||||||
|
},
|
||||||
|
"effects": [
|
||||||
|
"unknown"
|
||||||
|
],
|
||||||
|
"body": [
|
||||||
|
{
|
||||||
|
"kind": "assign",
|
||||||
|
"span": {
|
||||||
|
"end": 24,
|
||||||
|
"start": 15
|
||||||
|
},
|
||||||
|
"target": "外",
|
||||||
|
"value": {
|
||||||
|
"kind": "literal",
|
||||||
|
"span": {
|
||||||
|
"end": 0,
|
||||||
|
"start": 0
|
||||||
|
},
|
||||||
|
"type": "int",
|
||||||
|
"value": "0"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"kind": "assign",
|
||||||
|
"span": {
|
||||||
|
"end": 38,
|
||||||
|
"start": 26
|
||||||
|
},
|
||||||
|
"target": "合计",
|
||||||
|
"value": {
|
||||||
|
"kind": "literal",
|
||||||
|
"span": {
|
||||||
|
"end": 0,
|
||||||
|
"start": 0
|
||||||
|
},
|
||||||
|
"type": "int",
|
||||||
|
"value": "0"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"body": [
|
||||||
|
{
|
||||||
|
"kind": "assign",
|
||||||
|
"span": {
|
||||||
|
"end": 72,
|
||||||
|
"start": 57
|
||||||
|
},
|
||||||
|
"target": "外",
|
||||||
|
"value": {
|
||||||
|
"kind": "binary",
|
||||||
|
"left": {
|
||||||
|
"kind": "variable",
|
||||||
|
"name": "外",
|
||||||
|
"span": {
|
||||||
|
"end": 67,
|
||||||
|
"start": 64
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"op": "add",
|
||||||
|
"right": {
|
||||||
|
"kind": "literal",
|
||||||
|
"span": {
|
||||||
|
"end": 0,
|
||||||
|
"start": 0
|
||||||
|
},
|
||||||
|
"type": "int",
|
||||||
|
"value": "1"
|
||||||
|
},
|
||||||
|
"span": {
|
||||||
|
"end": 71,
|
||||||
|
"start": 64
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"kind": "assign",
|
||||||
|
"span": {
|
||||||
|
"end": 83,
|
||||||
|
"start": 74
|
||||||
|
},
|
||||||
|
"target": "内",
|
||||||
|
"value": {
|
||||||
|
"kind": "literal",
|
||||||
|
"span": {
|
||||||
|
"end": 0,
|
||||||
|
"start": 0
|
||||||
|
},
|
||||||
|
"type": "int",
|
||||||
|
"value": "0"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"body": [
|
||||||
|
{
|
||||||
|
"kind": "assign",
|
||||||
|
"span": {
|
||||||
|
"end": 117,
|
||||||
|
"start": 102
|
||||||
|
},
|
||||||
|
"target": "内",
|
||||||
|
"value": {
|
||||||
|
"kind": "binary",
|
||||||
|
"left": {
|
||||||
|
"kind": "variable",
|
||||||
|
"name": "内",
|
||||||
|
"span": {
|
||||||
|
"end": 112,
|
||||||
|
"start": 109
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"op": "add",
|
||||||
|
"right": {
|
||||||
|
"kind": "literal",
|
||||||
|
"span": {
|
||||||
|
"end": 0,
|
||||||
|
"start": 0
|
||||||
|
},
|
||||||
|
"type": "int",
|
||||||
|
"value": "1"
|
||||||
|
},
|
||||||
|
"span": {
|
||||||
|
"end": 116,
|
||||||
|
"start": 109
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"arms": [
|
||||||
|
{
|
||||||
|
"body": [
|
||||||
|
{
|
||||||
|
"kind": "continue",
|
||||||
|
"span": {
|
||||||
|
"end": 144,
|
||||||
|
"start": 134
|
||||||
|
}
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"condition": {
|
||||||
|
"kind": "binary",
|
||||||
|
"left": {
|
||||||
|
"kind": "variable",
|
||||||
|
"name": "内",
|
||||||
|
"span": {
|
||||||
|
"end": 126,
|
||||||
|
"start": 123
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"op": "eq",
|
||||||
|
"right": {
|
||||||
|
"kind": "literal",
|
||||||
|
"span": {
|
||||||
|
"end": 0,
|
||||||
|
"start": 0
|
||||||
|
},
|
||||||
|
"type": "int",
|
||||||
|
"value": "1"
|
||||||
|
},
|
||||||
|
"span": {
|
||||||
|
"end": 131,
|
||||||
|
"start": 123
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"condition_span": {
|
||||||
|
"end": 132,
|
||||||
|
"start": 119
|
||||||
|
},
|
||||||
|
"span": {
|
||||||
|
"end": 132,
|
||||||
|
"start": 119
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"body": [
|
||||||
|
{
|
||||||
|
"kind": "break",
|
||||||
|
"span": {
|
||||||
|
"end": 173,
|
||||||
|
"start": 166
|
||||||
|
}
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"condition": {
|
||||||
|
"kind": "binary",
|
||||||
|
"left": {
|
||||||
|
"kind": "variable",
|
||||||
|
"name": "内",
|
||||||
|
"span": {
|
||||||
|
"end": 158,
|
||||||
|
"start": 155
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"op": "eq",
|
||||||
|
"right": {
|
||||||
|
"kind": "literal",
|
||||||
|
"span": {
|
||||||
|
"end": 0,
|
||||||
|
"start": 0
|
||||||
|
},
|
||||||
|
"type": "int",
|
||||||
|
"value": "3"
|
||||||
|
},
|
||||||
|
"span": {
|
||||||
|
"end": 163,
|
||||||
|
"start": 155
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"condition_span": {
|
||||||
|
"end": 164,
|
||||||
|
"start": 146
|
||||||
|
},
|
||||||
|
"span": {
|
||||||
|
"end": 164,
|
||||||
|
"start": 146
|
||||||
|
}
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"kind": "branch",
|
||||||
|
"span": {
|
||||||
|
"end": 132,
|
||||||
|
"start": 119
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"kind": "assign",
|
||||||
|
"span": {
|
||||||
|
"end": 205,
|
||||||
|
"start": 182
|
||||||
|
},
|
||||||
|
"target": "合计",
|
||||||
|
"value": {
|
||||||
|
"kind": "binary",
|
||||||
|
"left": {
|
||||||
|
"kind": "variable",
|
||||||
|
"name": "合计",
|
||||||
|
"span": {
|
||||||
|
"end": 198,
|
||||||
|
"start": 192
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"op": "add",
|
||||||
|
"right": {
|
||||||
|
"kind": "variable",
|
||||||
|
"name": "外",
|
||||||
|
"span": {
|
||||||
|
"end": 204,
|
||||||
|
"start": 201
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"span": {
|
||||||
|
"end": 204,
|
||||||
|
"start": 192
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"condition": {
|
||||||
|
"kind": "binary",
|
||||||
|
"left": {
|
||||||
|
"kind": "variable",
|
||||||
|
"name": "内",
|
||||||
|
"span": {
|
||||||
|
"end": 95,
|
||||||
|
"start": 92
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"op": "lt",
|
||||||
|
"right": {
|
||||||
|
"kind": "literal",
|
||||||
|
"span": {
|
||||||
|
"end": 0,
|
||||||
|
"start": 0
|
||||||
|
},
|
||||||
|
"type": "int",
|
||||||
|
"value": "4"
|
||||||
|
},
|
||||||
|
"span": {
|
||||||
|
"end": 99,
|
||||||
|
"start": 92
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"condition_span": {
|
||||||
|
"end": 100,
|
||||||
|
"start": 85
|
||||||
|
},
|
||||||
|
"kind": "loop",
|
||||||
|
"span": {
|
||||||
|
"end": 100,
|
||||||
|
"start": 85
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"arms": [
|
||||||
|
{
|
||||||
|
"body": [
|
||||||
|
{
|
||||||
|
"kind": "continue",
|
||||||
|
"span": {
|
||||||
|
"end": 239,
|
||||||
|
"start": 229
|
||||||
|
}
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"condition": {
|
||||||
|
"kind": "binary",
|
||||||
|
"left": {
|
||||||
|
"kind": "variable",
|
||||||
|
"name": "外",
|
||||||
|
"span": {
|
||||||
|
"end": 221,
|
||||||
|
"start": 218
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"op": "eq",
|
||||||
|
"right": {
|
||||||
|
"kind": "literal",
|
||||||
|
"span": {
|
||||||
|
"end": 0,
|
||||||
|
"start": 0
|
||||||
|
},
|
||||||
|
"type": "int",
|
||||||
|
"value": "2"
|
||||||
|
},
|
||||||
|
"span": {
|
||||||
|
"end": 226,
|
||||||
|
"start": 218
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"condition_span": {
|
||||||
|
"end": 227,
|
||||||
|
"start": 214
|
||||||
|
},
|
||||||
|
"span": {
|
||||||
|
"end": 227,
|
||||||
|
"start": 214
|
||||||
|
}
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"kind": "branch",
|
||||||
|
"span": {
|
||||||
|
"end": 227,
|
||||||
|
"start": 214
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"kind": "assign",
|
||||||
|
"span": {
|
||||||
|
"end": 270,
|
||||||
|
"start": 248
|
||||||
|
},
|
||||||
|
"target": "合计",
|
||||||
|
"value": {
|
||||||
|
"kind": "binary",
|
||||||
|
"left": {
|
||||||
|
"kind": "variable",
|
||||||
|
"name": "合计",
|
||||||
|
"span": {
|
||||||
|
"end": 264,
|
||||||
|
"start": 258
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"op": "add",
|
||||||
|
"right": {
|
||||||
|
"kind": "literal",
|
||||||
|
"span": {
|
||||||
|
"end": 0,
|
||||||
|
"start": 0
|
||||||
|
},
|
||||||
|
"type": "int",
|
||||||
|
"value": "10"
|
||||||
|
},
|
||||||
|
"span": {
|
||||||
|
"end": 269,
|
||||||
|
"start": 258
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"condition": {
|
||||||
|
"kind": "binary",
|
||||||
|
"left": {
|
||||||
|
"kind": "variable",
|
||||||
|
"name": "外",
|
||||||
|
"span": {
|
||||||
|
"end": 50,
|
||||||
|
"start": 47
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"op": "lt",
|
||||||
|
"right": {
|
||||||
|
"kind": "literal",
|
||||||
|
"span": {
|
||||||
|
"end": 0,
|
||||||
|
"start": 0
|
||||||
|
},
|
||||||
|
"type": "int",
|
||||||
|
"value": "3"
|
||||||
|
},
|
||||||
|
"span": {
|
||||||
|
"end": 54,
|
||||||
|
"start": 47
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"condition_span": {
|
||||||
|
"end": 55,
|
||||||
|
"start": 40
|
||||||
|
},
|
||||||
|
"kind": "loop",
|
||||||
|
"span": {
|
||||||
|
"end": 55,
|
||||||
|
"start": 40
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"kind": "return",
|
||||||
|
"span": {
|
||||||
|
"end": 294,
|
||||||
|
"start": 279
|
||||||
|
},
|
||||||
|
"value": {
|
||||||
|
"kind": "variable",
|
||||||
|
"name": "合计",
|
||||||
|
"span": {
|
||||||
|
"end": 293,
|
||||||
|
"start": 287
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"imports": [],
|
||||||
|
"references": [],
|
||||||
|
"calls": [],
|
||||||
|
"resources": []
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"diagnostics": []
|
||||||
|
}
|
||||||
@@ -0,0 +1,66 @@
|
|||||||
|
{"kind":"stream.opened","payload":{"limits":{"max_observation_bytes":16777216,"max_observation_events":100000,"max_value_bytes":256},"observation":{"allow_text_values":false,"level":"structural","selected_parameters":[],"selected_variables":[],"values":false},"producer":{"name":"marqdo","version":"3.0.0-rc.4"}},"run_id":"20-1795713596362568889","schema":"marqdo.observation","schema_version":1,"seq":0}
|
||||||
|
{"kind":"run.started","payload":{"entry":"root:default::85-nested-loop-control.mq.md::main","mode":"project","source":{"analysis_digest":"sha256:9ed92f781c37d2560803e5a67d35c1d26cf37637d6bd435fe70856bb38d9cc72","root_id":"sha256:68fe7f20571673eda2078779c82fb2457f109e6c31da95b8b91b0513acb0fe15"},"started_unix_ms":1795713596382},"run_id":"20-1795713596362568889","schema":"marqdo.observation","schema_version":1,"seq":1}
|
||||||
|
{"kind":"call.enter","payload":{"frame_id":"f1","function_id":"root:default::85-nested-loop-control.mq.md::main","module_id":"root:default::85-nested-loop-control.mq.md","parent_frame_id":null,"span":null},"run_id":"20-1795713596362568889","schema":"marqdo.observation","schema_version":1,"seq":2}
|
||||||
|
{"kind":"variable.assigned","payload":{"frame_id":"f1","module_id":"root:default::85-nested-loop-control.mq.md","name":"外","span":{"end":24,"start":15},"value_state":"not_requested","value_type":"Int"},"run_id":"20-1795713596362568889","schema":"marqdo.observation","schema_version":1,"seq":3}
|
||||||
|
{"kind":"variable.assigned","payload":{"frame_id":"f1","module_id":"root:default::85-nested-loop-control.mq.md","name":"合计","span":{"end":38,"start":26},"value_state":"not_requested","value_type":"Int"},"run_id":"20-1795713596362568889","schema":"marqdo.observation","schema_version":1,"seq":4}
|
||||||
|
{"kind":"loop.iteration","payload":{"decision":"continue","frame_id":"f1","module_id":"root:default::85-nested-loop-control.mq.md","span":{"end":55,"start":40}},"run_id":"20-1795713596362568889","schema":"marqdo.observation","schema_version":1,"seq":5}
|
||||||
|
{"kind":"variable.assigned","payload":{"frame_id":"f1","module_id":"root:default::85-nested-loop-control.mq.md","name":"外","span":{"end":72,"start":57},"value_state":"not_requested","value_type":"Int"},"run_id":"20-1795713596362568889","schema":"marqdo.observation","schema_version":1,"seq":6}
|
||||||
|
{"kind":"variable.assigned","payload":{"frame_id":"f1","module_id":"root:default::85-nested-loop-control.mq.md","name":"内","span":{"end":83,"start":74},"value_state":"not_requested","value_type":"Int"},"run_id":"20-1795713596362568889","schema":"marqdo.observation","schema_version":1,"seq":7}
|
||||||
|
{"kind":"loop.iteration","payload":{"decision":"continue","frame_id":"f1","module_id":"root:default::85-nested-loop-control.mq.md","span":{"end":100,"start":85}},"run_id":"20-1795713596362568889","schema":"marqdo.observation","schema_version":1,"seq":8}
|
||||||
|
{"kind":"variable.assigned","payload":{"frame_id":"f1","module_id":"root:default::85-nested-loop-control.mq.md","name":"内","span":{"end":117,"start":102},"value_state":"not_requested","value_type":"Int"},"run_id":"20-1795713596362568889","schema":"marqdo.observation","schema_version":1,"seq":9}
|
||||||
|
{"kind":"branch.eval","payload":{"frame_id":"f1","module_id":"root:default::85-nested-loop-control.mq.md","result":true,"span":{"end":132,"start":119}},"run_id":"20-1795713596362568889","schema":"marqdo.observation","schema_version":1,"seq":10}
|
||||||
|
{"kind":"control.continue","payload":{"frame_id":"f1","module_id":"root:default::85-nested-loop-control.mq.md","span":{"end":144,"start":134}},"run_id":"20-1795713596362568889","schema":"marqdo.observation","schema_version":1,"seq":11}
|
||||||
|
{"kind":"loop.iteration","payload":{"decision":"continue","frame_id":"f1","module_id":"root:default::85-nested-loop-control.mq.md","span":{"end":100,"start":85}},"run_id":"20-1795713596362568889","schema":"marqdo.observation","schema_version":1,"seq":12}
|
||||||
|
{"kind":"variable.assigned","payload":{"frame_id":"f1","module_id":"root:default::85-nested-loop-control.mq.md","name":"内","span":{"end":117,"start":102},"value_state":"not_requested","value_type":"Int"},"run_id":"20-1795713596362568889","schema":"marqdo.observation","schema_version":1,"seq":13}
|
||||||
|
{"kind":"branch.eval","payload":{"frame_id":"f1","module_id":"root:default::85-nested-loop-control.mq.md","result":false,"span":{"end":132,"start":119}},"run_id":"20-1795713596362568889","schema":"marqdo.observation","schema_version":1,"seq":14}
|
||||||
|
{"kind":"branch.eval","payload":{"frame_id":"f1","module_id":"root:default::85-nested-loop-control.mq.md","result":false,"span":{"end":164,"start":146}},"run_id":"20-1795713596362568889","schema":"marqdo.observation","schema_version":1,"seq":15}
|
||||||
|
{"kind":"variable.assigned","payload":{"frame_id":"f1","module_id":"root:default::85-nested-loop-control.mq.md","name":"合计","span":{"end":205,"start":182},"value_state":"not_requested","value_type":"Int"},"run_id":"20-1795713596362568889","schema":"marqdo.observation","schema_version":1,"seq":16}
|
||||||
|
{"kind":"loop.iteration","payload":{"decision":"continue","frame_id":"f1","module_id":"root:default::85-nested-loop-control.mq.md","span":{"end":100,"start":85}},"run_id":"20-1795713596362568889","schema":"marqdo.observation","schema_version":1,"seq":17}
|
||||||
|
{"kind":"variable.assigned","payload":{"frame_id":"f1","module_id":"root:default::85-nested-loop-control.mq.md","name":"内","span":{"end":117,"start":102},"value_state":"not_requested","value_type":"Int"},"run_id":"20-1795713596362568889","schema":"marqdo.observation","schema_version":1,"seq":18}
|
||||||
|
{"kind":"branch.eval","payload":{"frame_id":"f1","module_id":"root:default::85-nested-loop-control.mq.md","result":false,"span":{"end":132,"start":119}},"run_id":"20-1795713596362568889","schema":"marqdo.observation","schema_version":1,"seq":19}
|
||||||
|
{"kind":"branch.eval","payload":{"frame_id":"f1","module_id":"root:default::85-nested-loop-control.mq.md","result":true,"span":{"end":164,"start":146}},"run_id":"20-1795713596362568889","schema":"marqdo.observation","schema_version":1,"seq":20}
|
||||||
|
{"kind":"control.break","payload":{"frame_id":"f1","module_id":"root:default::85-nested-loop-control.mq.md","span":{"end":173,"start":166}},"run_id":"20-1795713596362568889","schema":"marqdo.observation","schema_version":1,"seq":21}
|
||||||
|
{"kind":"branch.eval","payload":{"frame_id":"f1","module_id":"root:default::85-nested-loop-control.mq.md","result":false,"span":{"end":227,"start":214}},"run_id":"20-1795713596362568889","schema":"marqdo.observation","schema_version":1,"seq":22}
|
||||||
|
{"kind":"variable.assigned","payload":{"frame_id":"f1","module_id":"root:default::85-nested-loop-control.mq.md","name":"合计","span":{"end":270,"start":248},"value_state":"not_requested","value_type":"Int"},"run_id":"20-1795713596362568889","schema":"marqdo.observation","schema_version":1,"seq":23}
|
||||||
|
{"kind":"loop.iteration","payload":{"decision":"continue","frame_id":"f1","module_id":"root:default::85-nested-loop-control.mq.md","span":{"end":55,"start":40}},"run_id":"20-1795713596362568889","schema":"marqdo.observation","schema_version":1,"seq":24}
|
||||||
|
{"kind":"variable.assigned","payload":{"frame_id":"f1","module_id":"root:default::85-nested-loop-control.mq.md","name":"外","span":{"end":72,"start":57},"value_state":"not_requested","value_type":"Int"},"run_id":"20-1795713596362568889","schema":"marqdo.observation","schema_version":1,"seq":25}
|
||||||
|
{"kind":"variable.assigned","payload":{"frame_id":"f1","module_id":"root:default::85-nested-loop-control.mq.md","name":"内","span":{"end":83,"start":74},"value_state":"not_requested","value_type":"Int"},"run_id":"20-1795713596362568889","schema":"marqdo.observation","schema_version":1,"seq":26}
|
||||||
|
{"kind":"loop.iteration","payload":{"decision":"continue","frame_id":"f1","module_id":"root:default::85-nested-loop-control.mq.md","span":{"end":100,"start":85}},"run_id":"20-1795713596362568889","schema":"marqdo.observation","schema_version":1,"seq":27}
|
||||||
|
{"kind":"variable.assigned","payload":{"frame_id":"f1","module_id":"root:default::85-nested-loop-control.mq.md","name":"内","span":{"end":117,"start":102},"value_state":"not_requested","value_type":"Int"},"run_id":"20-1795713596362568889","schema":"marqdo.observation","schema_version":1,"seq":28}
|
||||||
|
{"kind":"branch.eval","payload":{"frame_id":"f1","module_id":"root:default::85-nested-loop-control.mq.md","result":true,"span":{"end":132,"start":119}},"run_id":"20-1795713596362568889","schema":"marqdo.observation","schema_version":1,"seq":29}
|
||||||
|
{"kind":"control.continue","payload":{"frame_id":"f1","module_id":"root:default::85-nested-loop-control.mq.md","span":{"end":144,"start":134}},"run_id":"20-1795713596362568889","schema":"marqdo.observation","schema_version":1,"seq":30}
|
||||||
|
{"kind":"loop.iteration","payload":{"decision":"continue","frame_id":"f1","module_id":"root:default::85-nested-loop-control.mq.md","span":{"end":100,"start":85}},"run_id":"20-1795713596362568889","schema":"marqdo.observation","schema_version":1,"seq":31}
|
||||||
|
{"kind":"variable.assigned","payload":{"frame_id":"f1","module_id":"root:default::85-nested-loop-control.mq.md","name":"内","span":{"end":117,"start":102},"value_state":"not_requested","value_type":"Int"},"run_id":"20-1795713596362568889","schema":"marqdo.observation","schema_version":1,"seq":32}
|
||||||
|
{"kind":"branch.eval","payload":{"frame_id":"f1","module_id":"root:default::85-nested-loop-control.mq.md","result":false,"span":{"end":132,"start":119}},"run_id":"20-1795713596362568889","schema":"marqdo.observation","schema_version":1,"seq":33}
|
||||||
|
{"kind":"branch.eval","payload":{"frame_id":"f1","module_id":"root:default::85-nested-loop-control.mq.md","result":false,"span":{"end":164,"start":146}},"run_id":"20-1795713596362568889","schema":"marqdo.observation","schema_version":1,"seq":34}
|
||||||
|
{"kind":"variable.assigned","payload":{"frame_id":"f1","module_id":"root:default::85-nested-loop-control.mq.md","name":"合计","span":{"end":205,"start":182},"value_state":"not_requested","value_type":"Int"},"run_id":"20-1795713596362568889","schema":"marqdo.observation","schema_version":1,"seq":35}
|
||||||
|
{"kind":"loop.iteration","payload":{"decision":"continue","frame_id":"f1","module_id":"root:default::85-nested-loop-control.mq.md","span":{"end":100,"start":85}},"run_id":"20-1795713596362568889","schema":"marqdo.observation","schema_version":1,"seq":36}
|
||||||
|
{"kind":"variable.assigned","payload":{"frame_id":"f1","module_id":"root:default::85-nested-loop-control.mq.md","name":"内","span":{"end":117,"start":102},"value_state":"not_requested","value_type":"Int"},"run_id":"20-1795713596362568889","schema":"marqdo.observation","schema_version":1,"seq":37}
|
||||||
|
{"kind":"branch.eval","payload":{"frame_id":"f1","module_id":"root:default::85-nested-loop-control.mq.md","result":false,"span":{"end":132,"start":119}},"run_id":"20-1795713596362568889","schema":"marqdo.observation","schema_version":1,"seq":38}
|
||||||
|
{"kind":"branch.eval","payload":{"frame_id":"f1","module_id":"root:default::85-nested-loop-control.mq.md","result":true,"span":{"end":164,"start":146}},"run_id":"20-1795713596362568889","schema":"marqdo.observation","schema_version":1,"seq":39}
|
||||||
|
{"kind":"control.break","payload":{"frame_id":"f1","module_id":"root:default::85-nested-loop-control.mq.md","span":{"end":173,"start":166}},"run_id":"20-1795713596362568889","schema":"marqdo.observation","schema_version":1,"seq":40}
|
||||||
|
{"kind":"branch.eval","payload":{"frame_id":"f1","module_id":"root:default::85-nested-loop-control.mq.md","result":true,"span":{"end":227,"start":214}},"run_id":"20-1795713596362568889","schema":"marqdo.observation","schema_version":1,"seq":41}
|
||||||
|
{"kind":"control.continue","payload":{"frame_id":"f1","module_id":"root:default::85-nested-loop-control.mq.md","span":{"end":239,"start":229}},"run_id":"20-1795713596362568889","schema":"marqdo.observation","schema_version":1,"seq":42}
|
||||||
|
{"kind":"loop.iteration","payload":{"decision":"continue","frame_id":"f1","module_id":"root:default::85-nested-loop-control.mq.md","span":{"end":55,"start":40}},"run_id":"20-1795713596362568889","schema":"marqdo.observation","schema_version":1,"seq":43}
|
||||||
|
{"kind":"variable.assigned","payload":{"frame_id":"f1","module_id":"root:default::85-nested-loop-control.mq.md","name":"外","span":{"end":72,"start":57},"value_state":"not_requested","value_type":"Int"},"run_id":"20-1795713596362568889","schema":"marqdo.observation","schema_version":1,"seq":44}
|
||||||
|
{"kind":"variable.assigned","payload":{"frame_id":"f1","module_id":"root:default::85-nested-loop-control.mq.md","name":"内","span":{"end":83,"start":74},"value_state":"not_requested","value_type":"Int"},"run_id":"20-1795713596362568889","schema":"marqdo.observation","schema_version":1,"seq":45}
|
||||||
|
{"kind":"loop.iteration","payload":{"decision":"continue","frame_id":"f1","module_id":"root:default::85-nested-loop-control.mq.md","span":{"end":100,"start":85}},"run_id":"20-1795713596362568889","schema":"marqdo.observation","schema_version":1,"seq":46}
|
||||||
|
{"kind":"variable.assigned","payload":{"frame_id":"f1","module_id":"root:default::85-nested-loop-control.mq.md","name":"内","span":{"end":117,"start":102},"value_state":"not_requested","value_type":"Int"},"run_id":"20-1795713596362568889","schema":"marqdo.observation","schema_version":1,"seq":47}
|
||||||
|
{"kind":"branch.eval","payload":{"frame_id":"f1","module_id":"root:default::85-nested-loop-control.mq.md","result":true,"span":{"end":132,"start":119}},"run_id":"20-1795713596362568889","schema":"marqdo.observation","schema_version":1,"seq":48}
|
||||||
|
{"kind":"control.continue","payload":{"frame_id":"f1","module_id":"root:default::85-nested-loop-control.mq.md","span":{"end":144,"start":134}},"run_id":"20-1795713596362568889","schema":"marqdo.observation","schema_version":1,"seq":49}
|
||||||
|
{"kind":"loop.iteration","payload":{"decision":"continue","frame_id":"f1","module_id":"root:default::85-nested-loop-control.mq.md","span":{"end":100,"start":85}},"run_id":"20-1795713596362568889","schema":"marqdo.observation","schema_version":1,"seq":50}
|
||||||
|
{"kind":"variable.assigned","payload":{"frame_id":"f1","module_id":"root:default::85-nested-loop-control.mq.md","name":"内","span":{"end":117,"start":102},"value_state":"not_requested","value_type":"Int"},"run_id":"20-1795713596362568889","schema":"marqdo.observation","schema_version":1,"seq":51}
|
||||||
|
{"kind":"branch.eval","payload":{"frame_id":"f1","module_id":"root:default::85-nested-loop-control.mq.md","result":false,"span":{"end":132,"start":119}},"run_id":"20-1795713596362568889","schema":"marqdo.observation","schema_version":1,"seq":52}
|
||||||
|
{"kind":"branch.eval","payload":{"frame_id":"f1","module_id":"root:default::85-nested-loop-control.mq.md","result":false,"span":{"end":164,"start":146}},"run_id":"20-1795713596362568889","schema":"marqdo.observation","schema_version":1,"seq":53}
|
||||||
|
{"kind":"variable.assigned","payload":{"frame_id":"f1","module_id":"root:default::85-nested-loop-control.mq.md","name":"合计","span":{"end":205,"start":182},"value_state":"not_requested","value_type":"Int"},"run_id":"20-1795713596362568889","schema":"marqdo.observation","schema_version":1,"seq":54}
|
||||||
|
{"kind":"loop.iteration","payload":{"decision":"continue","frame_id":"f1","module_id":"root:default::85-nested-loop-control.mq.md","span":{"end":100,"start":85}},"run_id":"20-1795713596362568889","schema":"marqdo.observation","schema_version":1,"seq":55}
|
||||||
|
{"kind":"variable.assigned","payload":{"frame_id":"f1","module_id":"root:default::85-nested-loop-control.mq.md","name":"内","span":{"end":117,"start":102},"value_state":"not_requested","value_type":"Int"},"run_id":"20-1795713596362568889","schema":"marqdo.observation","schema_version":1,"seq":56}
|
||||||
|
{"kind":"branch.eval","payload":{"frame_id":"f1","module_id":"root:default::85-nested-loop-control.mq.md","result":false,"span":{"end":132,"start":119}},"run_id":"20-1795713596362568889","schema":"marqdo.observation","schema_version":1,"seq":57}
|
||||||
|
{"kind":"branch.eval","payload":{"frame_id":"f1","module_id":"root:default::85-nested-loop-control.mq.md","result":true,"span":{"end":164,"start":146}},"run_id":"20-1795713596362568889","schema":"marqdo.observation","schema_version":1,"seq":58}
|
||||||
|
{"kind":"control.break","payload":{"frame_id":"f1","module_id":"root:default::85-nested-loop-control.mq.md","span":{"end":173,"start":166}},"run_id":"20-1795713596362568889","schema":"marqdo.observation","schema_version":1,"seq":59}
|
||||||
|
{"kind":"branch.eval","payload":{"frame_id":"f1","module_id":"root:default::85-nested-loop-control.mq.md","result":false,"span":{"end":227,"start":214}},"run_id":"20-1795713596362568889","schema":"marqdo.observation","schema_version":1,"seq":60}
|
||||||
|
{"kind":"variable.assigned","payload":{"frame_id":"f1","module_id":"root:default::85-nested-loop-control.mq.md","name":"合计","span":{"end":270,"start":248},"value_state":"not_requested","value_type":"Int"},"run_id":"20-1795713596362568889","schema":"marqdo.observation","schema_version":1,"seq":61}
|
||||||
|
{"kind":"loop.iteration","payload":{"decision":"exit","frame_id":"f1","module_id":"root:default::85-nested-loop-control.mq.md","span":{"end":55,"start":40}},"run_id":"20-1795713596362568889","schema":"marqdo.observation","schema_version":1,"seq":62}
|
||||||
|
{"kind":"return","payload":{"frame_id":"f1","module_id":"root:default::85-nested-loop-control.mq.md","span":{"end":294,"start":279},"value_type":"Int"},"run_id":"20-1795713596362568889","schema":"marqdo.observation","schema_version":1,"seq":63}
|
||||||
|
{"kind":"call.exit","payload":{"frame_id":"f1","module_id":"root:default::85-nested-loop-control.mq.md","span":null,"status":"return"},"run_id":"20-1795713596362568889","schema":"marqdo.observation","schema_version":1,"seq":64}
|
||||||
|
{"kind":"run.completed","payload":{"status":"ok","value":{"decimal":"26","type":"int"},"value_type":"Int"},"run_id":"20-1795713596362568889","schema":"marqdo.observation","schema_version":1,"seq":65}
|
||||||
@@ -0,0 +1 @@
|
|||||||
|
{"events":[{"kind":"stream.opened","payload":{"limits":{"max_observation_bytes":16777216,"max_observation_events":100000,"max_value_bytes":256},"observation":{"allow_text_values":false,"level":"structural","selected_parameters":[],"selected_variables":[],"values":false},"producer":{"name":"marqdo","version":"3.0.0-rc.4"}},"run_id":"20-1795713596362568889","schema":"marqdo.observation","schema_version":1,"seq":0},{"kind":"run.started","payload":{"entry":"root:default::85-nested-loop-control.mq.md::main","mode":"project","source":{"analysis_digest":"sha256:9ed92f781c37d2560803e5a67d35c1d26cf37637d6bd435fe70856bb38d9cc72","root_id":"sha256:68fe7f20571673eda2078779c82fb2457f109e6c31da95b8b91b0513acb0fe15"},"started_unix_ms":1795713596382},"run_id":"20-1795713596362568889","schema":"marqdo.observation","schema_version":1,"seq":1},{"kind":"call.enter","payload":{"frame_id":"f1","function_id":"root:default::85-nested-loop-control.mq.md::main","module_id":"root:default::85-nested-loop-control.mq.md","parent_frame_id":null,"span":null},"run_id":"20-1795713596362568889","schema":"marqdo.observation","schema_version":1,"seq":2},{"kind":"variable.assigned","payload":{"frame_id":"f1","module_id":"root:default::85-nested-loop-control.mq.md","name":"外","span":{"end":24,"start":15},"value_state":"not_requested","value_type":"Int"},"run_id":"20-1795713596362568889","schema":"marqdo.observation","schema_version":1,"seq":3},{"kind":"variable.assigned","payload":{"frame_id":"f1","module_id":"root:default::85-nested-loop-control.mq.md","name":"合计","span":{"end":38,"start":26},"value_state":"not_requested","value_type":"Int"},"run_id":"20-1795713596362568889","schema":"marqdo.observation","schema_version":1,"seq":4},{"kind":"loop.iteration","payload":{"decision":"continue","frame_id":"f1","module_id":"root:default::85-nested-loop-control.mq.md","span":{"end":55,"start":40}},"run_id":"20-1795713596362568889","schema":"marqdo.observation","schema_version":1,"seq":5},{"kind":"variable.assigned","payload":{"frame_id":"f1","module_id":"root:default::85-nested-loop-control.mq.md","name":"外","span":{"end":72,"start":57},"value_state":"not_requested","value_type":"Int"},"run_id":"20-1795713596362568889","schema":"marqdo.observation","schema_version":1,"seq":6},{"kind":"variable.assigned","payload":{"frame_id":"f1","module_id":"root:default::85-nested-loop-control.mq.md","name":"内","span":{"end":83,"start":74},"value_state":"not_requested","value_type":"Int"},"run_id":"20-1795713596362568889","schema":"marqdo.observation","schema_version":1,"seq":7},{"kind":"loop.iteration","payload":{"decision":"continue","frame_id":"f1","module_id":"root:default::85-nested-loop-control.mq.md","span":{"end":100,"start":85}},"run_id":"20-1795713596362568889","schema":"marqdo.observation","schema_version":1,"seq":8},{"kind":"variable.assigned","payload":{"frame_id":"f1","module_id":"root:default::85-nested-loop-control.mq.md","name":"内","span":{"end":117,"start":102},"value_state":"not_requested","value_type":"Int"},"run_id":"20-1795713596362568889","schema":"marqdo.observation","schema_version":1,"seq":9},{"kind":"branch.eval","payload":{"frame_id":"f1","module_id":"root:default::85-nested-loop-control.mq.md","result":true,"span":{"end":132,"start":119}},"run_id":"20-1795713596362568889","schema":"marqdo.observation","schema_version":1,"seq":10},{"kind":"control.continue","payload":{"frame_id":"f1","module_id":"root:default::85-nested-loop-control.mq.md","span":{"end":144,"start":134}},"run_id":"20-1795713596362568889","schema":"marqdo.observation","schema_version":1,"seq":11},{"kind":"loop.iteration","payload":{"decision":"continue","frame_id":"f1","module_id":"root:default::85-nested-loop-control.mq.md","span":{"end":100,"start":85}},"run_id":"20-1795713596362568889","schema":"marqdo.observation","schema_version":1,"seq":12},{"kind":"variable.assigned","payload":{"frame_id":"f1","module_id":"root:default::85-nested-loop-control.mq.md","name":"内","span":{"end":117,"start":102},"value_state":"not_requested","value_type":"Int"},"run_id":"20-1795713596362568889","schema":"marqdo.observation","schema_version":1,"seq":13},{"kind":"branch.eval","payload":{"frame_id":"f1","module_id":"root:default::85-nested-loop-control.mq.md","result":false,"span":{"end":132,"start":119}},"run_id":"20-1795713596362568889","schema":"marqdo.observation","schema_version":1,"seq":14},{"kind":"branch.eval","payload":{"frame_id":"f1","module_id":"root:default::85-nested-loop-control.mq.md","result":false,"span":{"end":164,"start":146}},"run_id":"20-1795713596362568889","schema":"marqdo.observation","schema_version":1,"seq":15},{"kind":"variable.assigned","payload":{"frame_id":"f1","module_id":"root:default::85-nested-loop-control.mq.md","name":"合计","span":{"end":205,"start":182},"value_state":"not_requested","value_type":"Int"},"run_id":"20-1795713596362568889","schema":"marqdo.observation","schema_version":1,"seq":16},{"kind":"loop.iteration","payload":{"decisiLine truncated
|
||||||
@@ -0,0 +1 @@
|
|||||||
|
{"events":[{"kind":"stream.opened","payload":{"limits":{"max_observation_bytes":16777216,"max_observation_events":100000,"max_value_bytes":256},"observation":{"allow_text_values":false,"level":"structural","selected_parameters":[],"selected_variables":[],"values":false},"producer":{"name":"marqdo","version":"3.0.0-rc.4"}},"run_id":"9-1795713570566476436","schema":"marqdo.observation","schema_version":1,"seq":0},{"kind":"run.started","payload":{"entry":"root:default::basic.mq.md::main","mode":"project","source":{"analysis_digest":"sha256:3e64eee5ba9686a578b5d5789075010d87177a727f7e54ac19fd61c99d7519d5","root_id":"sha256:0403dd889a7d44f0f3b2b823530c9301062d5ade2cd63329d3803abad55841f0"},"started_unix_ms":1795713570722},"run_id":"9-1795713570566476436","schema":"marqdo.observation","schema_version":1,"seq":1},{"kind":"call.enter","payload":{"frame_id":"f1","function_id":"root:default::basic.mq.md::Execution Events fixture A.main","module_id":"root:default::basic.mq.md","parent_frame_id":null,"span":null},"run_id":"9-1795713570566476436","schema":"marqdo.observation","schema_version":1,"seq":2},{"kind":"call.enter","payload":{"frame_id":"f2","function_id":"std:marqdo-stdlib@0.2.0#db905508dde89763b9d43b47fc5d52c6a1d5445a91f3c86a550ced43e8aac9d7::io.mq.md::io.写值","module_id":"root:default::basic.mq.md","parent_frame_id":"f1","span":{"end":72,"start":57}},"run_id":"9-1795713570566476436","schema":"marqdo.observation","schema_version":1,"seq":3},{"kind":"parameter.observed","payload":{"frame_id":"f2","module_id":"std:marqdo-stdlib@0.2.0#db905508dde89763b9d43b47fc5d52c6a1d5445a91f3c86a550ced43e8aac9d7::io.mq.md","name":"值","source":"provided","span":{"end":315,"start":312},"value_state":"not_requested","value_type":"Text"},"run_id":"9-1795713570566476436","schema":"marqdo.observation","schema_version":1,"seq":4},{"kind":"call.enter","payload":{"frame_id":"f3","function_id":"std:marqdo-stdlib@0.2.0#db905508dde89763b9d43b47fc5d52c6a1d5445a91f3c86a550ced43e8aac9d7::format.mq.md::format.显示","module_id":"std:marqdo-stdlib@0.2.0#db905508dde89763b9d43b47fc5d52c6a1d5445a91f3c86a550ced43e8aac9d7::io.mq.md","parent_frame_id":"f2","span":{"end":422,"start":404}},"run_id":"9-1795713570566476436","schema":"marqdo.observation","schema_version":1,"seq":5},{"kind":"parameter.observed","payload":{"frame_id":"f3","module_id":"std:marqdo-stdlib@0.2.0#db905508dde89763b9d43b47fc5d52c6a1d5445a91f3c86a550ced43e8aac9d7::format.mq.md","name":"值","source":"provided","span":{"end":489,"start":486},"value_state":"not_requested","value_type":"Text"},"run_id":"9-1795713570566476436","schema":"marqdo.observation","schema_version":1,"seq":6},{"kind":"variable.assigned","payload":{"frame_id":"f3","module_id":"std:marqdo-stdlib@0.2.0#db905508dde89763b9d43b47fc5d52c6a1d5445a91f3c86a550ced43e8aac9d7::format.mq.md","name":"类别","span":{"end":701,"start":677},"value_state":"not_requested","value_type":"Text"},"run_id":"9-1795713570566476436","schema":"marqdo.observation","schema_version":1,"seq":7},{"kind":"branch.eval","payload":{"frame_id":"f3","module_id":"std:marqdo-stdlib@0.2.0#db905508dde89763b9d43b47fc5d52c6a1d5445a91f3c86a550ced43e8aac9d7::format.mq.md","result":false,"span":{"end":724,"start":703}},"run_id":"9-1795713570566476436","schema":"marqdo.observation","schema_version":1,"seq":8},{"kind":"branch.eval","payload":{"frame_id":"f3","module_id":"std:marqdo-stdlib@0.2.0#db905508dde89763b9d43b47fc5d52c6a1d5445a91f3c86a550ced43e8aac9d7::format.mq.md","result":true,"span":{"end":749,"start":743}},"run_id":"9-1795713570566476436","schema":"marqdo.observation","schema_version":1,"seq":9},{"kind":"branch.eval","payload":{"frame_id":"f3","module_id":"std:marqdo-stdlib@0.2.0#db905508dde89763b9d43b47fc5d52c6a1d5445a91f3c86a550ced43e8aac9d7::format.mq.md","result":false,"span":{"end":771,"start":750}},"run_id":"9-1795713570566476436","schema":"marqdo.observation","schema_version":1,"seq":10},{"kind":"branch.eval","payload":{"frame_id":"f3","module_id":"std:marqdo-stdlib@0.2.0#db905508dde89763b9d43b47fc5d52c6a1d5445a91f3c86a550ced43e8aac9d7::format.mq.md","result":true,"span":{"end":796,"start":790}},"run_id":"9-1795713570566476436","schema":"marqdo.observation","schema_version":1,"seq":11},{"kind":"branch.eval","payload":{"frame_id":"f3","module_id":"std:marqdo-stdlib@0.2.0#db905508dde89763b9d43b47fc5d52c6a1d5445a91f3c86a550ced43e8aac9d7::format.mq.md","result":true,"span":{"end":818,"start":797}},"run_id":"9-1795713570566476436","schema":"marqdo.observation","schema_version":1,"seq":12},{"kind":"return","payload":{"frame_id":"f3","module_id":"std:marqdo-stdlib@0.2.0#db905508dde89763b9d43b47fc5d52c6a1d5445a91f3c86a550ced43e8aac9d7::format.mq.md","span":{"end":832,"start":820},"value_type":"Text"},"run_id":"9-1795713570566476436","schema":"marqdo.observation","schema_version":1,"seq":13},{"kind":"call.exit","payload":{"frame_id":"f3","module_id":"std:marqdo-stdlib@0.2.0#db905508dde89763b9d43b47fc5d52c6a1d5445a91f3c86a550ced43e8aac9d7::ioLine truncated
|
||||||
@@ -0,0 +1,316 @@
|
|||||||
|
{"kind":"stream.opened","payload":{"limits":{"max_observation_bytes":16777216,"max_observation_events":100000,"max_value_bytes":256},"observation":{"allow_text_values":false,"level":"structural","selected_parameters":[],"selected_variables":[],"values":false},"producer":{"name":"marqdo","version":"3.0.0-rc.4"}},"run_id":"9-1795713570566476436","schema":"marqdo.observation","schema_version":1,"seq":0}
|
||||||
|
{"kind":"run.started","payload":{"entry":"root:default::basic.mq.md::main","mode":"project","source":{"analysis_digest":"sha256:3e64eee5ba9686a578b5d5789075010d87177a727f7e54ac19fd61c99d7519d5","root_id":"sha256:0403dd889a7d44f0f3b2b823530c9301062d5ade2cd63329d3803abad55841f0"},"started_unix_ms":1795713570722},"run_id":"9-1795713570566476436","schema":"marqdo.observation","schema_version":1,"seq":1}
|
||||||
|
{"kind":"call.enter","payload":{"frame_id":"f1","function_id":"root:default::basic.mq.md::Execution Events fixture A.main","module_id":"root:default::basic.mq.md","parent_frame_id":null,"span":null},"run_id":"9-1795713570566476436","schema":"marqdo.observation","schema_version":1,"seq":2}
|
||||||
|
{"kind":"call.enter","payload":{"frame_id":"f2","function_id":"std:marqdo-stdlib@0.2.0#db905508dde89763b9d43b47fc5d52c6a1d5445a91f3c86a550ced43e8aac9d7::io.mq.md::io.写值","module_id":"root:default::basic.mq.md","parent_frame_id":"f1","span":{"end":72,"start":57}},"run_id":"9-1795713570566476436","schema":"marqdo.observation","schema_version":1,"seq":3}
|
||||||
|
{"kind":"parameter.observed","payload":{"frame_id":"f2","module_id":"std:marqdo-stdlib@0.2.0#db905508dde89763b9d43b47fc5d52c6a1d5445a91f3c86a550ced43e8aac9d7::io.mq.md","name":"值","source":"provided","span":{"end":315,"start":312},"value_state":"not_requested","value_type":"Text"},"run_id":"9-1795713570566476436","schema":"marqdo.observation","schema_version":1,"seq":4}
|
||||||
|
{"kind":"call.enter","payload":{"frame_id":"f3","function_id":"std:marqdo-stdlib@0.2.0#db905508dde89763b9d43b47fc5d52c6a1d5445a91f3c86a550ced43e8aac9d7::format.mq.md::format.显示","module_id":"std:marqdo-stdlib@0.2.0#db905508dde89763b9d43b47fc5d52c6a1d5445a91f3c86a550ced43e8aac9d7::io.mq.md","parent_frame_id":"f2","span":{"end":422,"start":404}},"run_id":"9-1795713570566476436","schema":"marqdo.observation","schema_version":1,"seq":5}
|
||||||
|
{"kind":"parameter.observed","payload":{"frame_id":"f3","module_id":"std:marqdo-stdlib@0.2.0#db905508dde89763b9d43b47fc5d52c6a1d5445a91f3c86a550ced43e8aac9d7::format.mq.md","name":"值","source":"provided","span":{"end":489,"start":486},"value_state":"not_requested","value_type":"Text"},"run_id":"9-1795713570566476436","schema":"marqdo.observation","schema_version":1,"seq":6}
|
||||||
|
{"kind":"variable.assigned","payload":{"frame_id":"f3","module_id":"std:marqdo-stdlib@0.2.0#db905508dde89763b9d43b47fc5d52c6a1d5445a91f3c86a550ced43e8aac9d7::format.mq.md","name":"类别","span":{"end":701,"start":677},"value_state":"not_requested","value_type":"Text"},"run_id":"9-1795713570566476436","schema":"marqdo.observation","schema_version":1,"seq":7}
|
||||||
|
{"kind":"branch.eval","payload":{"frame_id":"f3","module_id":"std:marqdo-stdlib@0.2.0#db905508dde89763b9d43b47fc5d52c6a1d5445a91f3c86a550ced43e8aac9d7::format.mq.md","result":false,"span":{"end":724,"start":703}},"run_id":"9-1795713570566476436","schema":"marqdo.observation","schema_version":1,"seq":8}
|
||||||
|
{"kind":"branch.eval","payload":{"frame_id":"f3","module_id":"std:marqdo-stdlib@0.2.0#db905508dde89763b9d43b47fc5d52c6a1d5445a91f3c86a550ced43e8aac9d7::format.mq.md","result":true,"span":{"end":749,"start":743}},"run_id":"9-1795713570566476436","schema":"marqdo.observation","schema_version":1,"seq":9}
|
||||||
|
{"kind":"branch.eval","payload":{"frame_id":"f3","module_id":"std:marqdo-stdlib@0.2.0#db905508dde89763b9d43b47fc5d52c6a1d5445a91f3c86a550ced43e8aac9d7::format.mq.md","result":false,"span":{"end":771,"start":750}},"run_id":"9-1795713570566476436","schema":"marqdo.observation","schema_version":1,"seq":10}
|
||||||
|
{"kind":"branch.eval","payload":{"frame_id":"f3","module_id":"std:marqdo-stdlib@0.2.0#db905508dde89763b9d43b47fc5d52c6a1d5445a91f3c86a550ced43e8aac9d7::format.mq.md","result":true,"span":{"end":796,"start":790}},"run_id":"9-1795713570566476436","schema":"marqdo.observation","schema_version":1,"seq":11}
|
||||||
|
{"kind":"branch.eval","payload":{"frame_id":"f3","module_id":"std:marqdo-stdlib@0.2.0#db905508dde89763b9d43b47fc5d52c6a1d5445a91f3c86a550ced43e8aac9d7::format.mq.md","result":true,"span":{"end":818,"start":797}},"run_id":"9-1795713570566476436","schema":"marqdo.observation","schema_version":1,"seq":12}
|
||||||
|
{"kind":"return","payload":{"frame_id":"f3","module_id":"std:marqdo-stdlib@0.2.0#db905508dde89763b9d43b47fc5d52c6a1d5445a91f3c86a550ced43e8aac9d7::format.mq.md","span":{"end":832,"start":820},"value_type":"Text"},"run_id":"9-1795713570566476436","schema":"marqdo.observation","schema_version":1,"seq":13}
|
||||||
|
{"kind":"call.exit","payload":{"frame_id":"f3","module_id":"std:marqdo-stdlib@0.2.0#db905508dde89763b9d43b47fc5d52c6a1d5445a91f3c86a550ced43e8aac9d7::io.mq.md","span":{"end":422,"start":404},"status":"return"},"run_id":"9-1795713570566476436","schema":"marqdo.observation","schema_version":1,"seq":14}
|
||||||
|
{"kind":"call.enter","payload":{"frame_id":"f4","function_id":"std:marqdo-stdlib@0.2.0#db905508dde89763b9d43b47fc5d52c6a1d5445a91f3c86a550ced43e8aac9d7::io/stream.mq.md::stream.写文本","module_id":"std:marqdo-stdlib@0.2.0#db905508dde89763b9d43b47fc5d52c6a1d5445a91f3c86a550ced43e8aac9d7::io.mq.md","parent_frame_id":"f2","span":{"end":430,"start":387}},"run_id":"9-1795713570566476436","schema":"marqdo.observation","schema_version":1,"seq":15}
|
||||||
|
{"kind":"parameter.observed","payload":{"frame_id":"f4","module_id":"std:marqdo-stdlib@0.2.0#db905508dde89763b9d43b47fc5d52c6a1d5445a91f3c86a550ced43e8aac9d7::io/stream.mq.md","name":"文本","source":"provided","span":{"end":1178,"start":1172},"value_state":"not_requested","value_type":"Text"},"run_id":"9-1795713570566476436","schema":"marqdo.observation","schema_version":1,"seq":16}
|
||||||
|
{"kind":"call.enter","payload":{"frame_id":"f5","function_id":"std:marqdo-stdlib@0.2.0#db905508dde89763b9d43b47fc5d52c6a1d5445a91f3c86a550ced43e8aac9d7::format.mq.md::format.字节长度","module_id":"std:marqdo-stdlib@0.2.0#db905508dde89763b9d43b47fc5d52c6a1d5445a91f3c86a550ced43e8aac9d7::io/stream.mq.md","parent_frame_id":"f4","span":{"end":1418,"start":1391}},"run_id":"9-1795713570566476436","schema":"marqdo.observation","schema_version":1,"seq":17}
|
||||||
|
{"kind":"parameter.observed","payload":{"frame_id":"f5","module_id":"std:marqdo-stdlib@0.2.0#db905508dde89763b9d43b47fc5d52c6a1d5445a91f3c86a550ced43e8aac9d7::format.mq.md","name":"文本","source":"provided","span":{"end":46,"start":40},"value_state":"not_requested","value_type":"Text"},"run_id":"9-1795713570566476436","schema":"marqdo.observation","schema_version":1,"seq":18}
|
||||||
|
{"kind":"variable.assigned","payload":{"frame_id":"f5","module_id":"std:marqdo-stdlib@0.2.0#db905508dde89763b9d43b47fc5d52c6a1d5445a91f3c86a550ced43e8aac9d7::format.mq.md","name":"点","span":{"end":84,"start":51},"value_state":"not_requested","value_type":"List"},"run_id":"9-1795713570566476436","schema":"marqdo.observation","schema_version":1,"seq":19}
|
||||||
|
{"kind":"variable.assigned","payload":{"frame_id":"f5","module_id":"std:marqdo-stdlib@0.2.0#db905508dde89763b9d43b47fc5d52c6a1d5445a91f3c86a550ced43e8aac9d7::format.mq.md","name":"总字节","span":{"end":103,"start":86},"value_state":"not_requested","value_type":"Int"},"run_id":"9-1795713570566476436","schema":"marqdo.observation","schema_version":1,"seq":20}
|
||||||
|
{"kind":"variable.assigned","payload":{"frame_id":"f5","module_id":"std:marqdo-stdlib@0.2.0#db905508dde89763b9d43b47fc5d52c6a1d5445a91f3c86a550ced43e8aac9d7::format.mq.md","name":"下标","span":{"end":119,"start":105},"value_state":"not_requested","value_type":"Int"},"run_id":"9-1795713570566476436","schema":"marqdo.observation","schema_version":1,"seq":21}
|
||||||
|
{"kind":"loop.iteration","payload":{"decision":"continue","frame_id":"f5","module_id":"std:marqdo-stdlib@0.2.0#db905508dde89763b9d43b47fc5d52c6a1d5445a91f3c86a550ced43e8aac9d7::format.mq.md","span":{"end":149,"start":121}},"run_id":"9-1795713570566476436","schema":"marqdo.observation","schema_version":1,"seq":22}
|
||||||
|
{"kind":"variable.assigned","payload":{"frame_id":"f5","module_id":"std:marqdo-stdlib@0.2.0#db905508dde89763b9d43b47fc5d52c6a1d5445a91f3c86a550ced43e8aac9d7::format.mq.md","name":"码点","span":{"end":175,"start":151},"value_state":"not_requested","value_type":"Int"},"run_id":"9-1795713570566476436","schema":"marqdo.observation","schema_version":1,"seq":23}
|
||||||
|
{"kind":"branch.eval","payload":{"frame_id":"f5","module_id":"std:marqdo-stdlib@0.2.0#db905508dde89763b9d43b47fc5d52c6a1d5445a91f3c86a550ced43e8aac9d7::format.mq.md","result":true,"span":{"end":194,"start":177}},"run_id":"9-1795713570566476436","schema":"marqdo.observation","schema_version":1,"seq":24}
|
||||||
|
{"kind":"variable.assigned","payload":{"frame_id":"f5","module_id":"std:marqdo-stdlib@0.2.0#db905508dde89763b9d43b47fc5d52c6a1d5445a91f3c86a550ced43e8aac9d7::format.mq.md","name":"总字节","span":{"end":225,"start":196},"value_state":"not_requested","value_type":"Int"},"run_id":"9-1795713570566476436","schema":"marqdo.observation","schema_version":1,"seq":25}
|
||||||
|
{"kind":"variable.assigned","payload":{"frame_id":"f5","module_id":"std:marqdo-stdlib@0.2.0#db905508dde89763b9d43b47fc5d52c6a1d5445a91f3c86a550ced43e8aac9d7::format.mq.md","name":"下标","span":{"end":440,"start":417},"value_state":"not_requested","value_type":"Int"},"run_id":"9-1795713570566476436","schema":"marqdo.observation","schema_version":1,"seq":26}
|
||||||
|
{"kind":"loop.iteration","payload":{"decision":"continue","frame_id":"f5","module_id":"std:marqdo-stdlib@0.2.0#db905508dde89763b9d43b47fc5d52c6a1d5445a91f3c86a550ced43e8aac9d7::format.mq.md","span":{"end":149,"start":121}},"run_id":"9-1795713570566476436","schema":"marqdo.observation","schema_version":1,"seq":27}
|
||||||
|
{"kind":"variable.assigned","payload":{"frame_id":"f5","module_id":"std:marqdo-stdlib@0.2.0#db905508dde89763b9d43b47fc5d52c6a1d5445a91f3c86a550ced43e8aac9d7::format.mq.md","name":"码点","span":{"end":175,"start":151},"value_state":"not_requested","value_type":"Int"},"run_id":"9-1795713570566476436","schema":"marqdo.observation","schema_version":1,"seq":28}
|
||||||
|
{"kind":"branch.eval","payload":{"frame_id":"f5","module_id":"std:marqdo-stdlib@0.2.0#db905508dde89763b9d43b47fc5d52c6a1d5445a91f3c86a550ced43e8aac9d7::format.mq.md","result":true,"span":{"end":194,"start":177}},"run_id":"9-1795713570566476436","schema":"marqdo.observation","schema_version":1,"seq":29}
|
||||||
|
{"kind":"variable.assigned","payload":{"frame_id":"f5","module_id":"std:marqdo-stdlib@0.2.0#db905508dde89763b9d43b47fc5d52c6a1d5445a91f3c86a550ced43e8aac9d7::format.mq.md","name":"总字节","span":{"end":225,"start":196},"value_state":"not_requested","value_type":"Int"},"run_id":"9-1795713570566476436","schema":"marqdo.observation","schema_version":1,"seq":30}
|
||||||
|
{"kind":"variable.assigned","payload":{"frame_id":"f5","module_id":"std:marqdo-stdlib@0.2.0#db905508dde89763b9d43b47fc5d52c6a1d5445a91f3c86a550ced43e8aac9d7::format.mq.md","name":"下标","span":{"end":440,"start":417},"value_state":"not_requested","value_type":"Int"},"run_id":"9-1795713570566476436","schema":"marqdo.observation","schema_version":1,"seq":31}
|
||||||
|
{"kind":"loop.iteration","payload":{"decision":"continue","frame_id":"f5","module_id":"std:marqdo-stdlib@0.2.0#db905508dde89763b9d43b47fc5d52c6a1d5445a91f3c86a550ced43e8aac9d7::format.mq.md","span":{"end":149,"start":121}},"run_id":"9-1795713570566476436","schema":"marqdo.observation","schema_version":1,"seq":32}
|
||||||
|
{"kind":"variable.assigned","payload":{"frame_id":"f5","module_id":"std:marqdo-stdlib@0.2.0#db905508dde89763b9d43b47fc5d52c6a1d5445a91f3c86a550ced43e8aac9d7::format.mq.md","name":"码点","span":{"end":175,"start":151},"value_state":"not_requested","value_type":"Int"},"run_id":"9-1795713570566476436","schema":"marqdo.observation","schema_version":1,"seq":33}
|
||||||
|
{"kind":"branch.eval","payload":{"frame_id":"f5","module_id":"std:marqdo-stdlib@0.2.0#db905508dde89763b9d43b47fc5d52c6a1d5445a91f3c86a550ced43e8aac9d7::format.mq.md","result":true,"span":{"end":194,"start":177}},"run_id":"9-1795713570566476436","schema":"marqdo.observation","schema_version":1,"seq":34}
|
||||||
|
{"kind":"variable.assigned","payload":{"frame_id":"f5","module_id":"std:marqdo-stdlib@0.2.0#db905508dde89763b9d43b47fc5d52c6a1d5445a91f3c86a550ced43e8aac9d7::format.mq.md","name":"总字节","span":{"end":225,"start":196},"value_state":"not_requested","value_type":"Int"},"run_id":"9-1795713570566476436","schema":"marqdo.observation","schema_version":1,"seq":35}
|
||||||
|
{"kind":"variable.assigned","payload":{"frame_id":"f5","module_id":"std:marqdo-stdlib@0.2.0#db905508dde89763b9d43b47fc5d52c6a1d5445a91f3c86a550ced43e8aac9d7::format.mq.md","name":"下标","span":{"end":440,"start":417},"value_state":"not_requested","value_type":"Int"},"run_id":"9-1795713570566476436","schema":"marqdo.observation","schema_version":1,"seq":36}
|
||||||
|
{"kind":"loop.iteration","payload":{"decision":"continue","frame_id":"f5","module_id":"std:marqdo-stdlib@0.2.0#db905508dde89763b9d43b47fc5d52c6a1d5445a91f3c86a550ced43e8aac9d7::format.mq.md","span":{"end":149,"start":121}},"run_id":"9-1795713570566476436","schema":"marqdo.observation","schema_version":1,"seq":37}
|
||||||
|
{"kind":"variable.assigned","payload":{"frame_id":"f5","module_id":"std:marqdo-stdlib@0.2.0#db905508dde89763b9d43b47fc5d52c6a1d5445a91f3c86a550ced43e8aac9d7::format.mq.md","name":"码点","span":{"end":175,"start":151},"value_state":"not_requested","value_type":"Int"},"run_id":"9-1795713570566476436","schema":"marqdo.observation","schema_version":1,"seq":38}
|
||||||
|
{"kind":"branch.eval","payload":{"frame_id":"f5","module_id":"std:marqdo-stdlib@0.2.0#db905508dde89763b9d43b47fc5d52c6a1d5445a91f3c86a550ced43e8aac9d7::format.mq.md","result":true,"span":{"end":194,"start":177}},"run_id":"9-1795713570566476436","schema":"marqdo.observation","schema_version":1,"seq":39}
|
||||||
|
{"kind":"variable.assigned","payload":{"frame_id":"f5","module_id":"std:marqdo-stdlib@0.2.0#db905508dde89763b9d43b47fc5d52c6a1d5445a91f3c86a550ced43e8aac9d7::format.mq.md","name":"总字节","span":{"end":225,"start":196},"value_state":"not_requested","value_type":"Int"},"run_id":"9-1795713570566476436","schema":"marqdo.observation","schema_version":1,"seq":40}
|
||||||
|
{"kind":"variable.assigned","payload":{"frame_id":"f5","module_id":"std:marqdo-stdlib@0.2.0#db905508dde89763b9d43b47fc5d52c6a1d5445a91f3c86a550ced43e8aac9d7::format.mq.md","name":"下标","span":{"end":440,"start":417},"value_state":"not_requested","value_type":"Int"},"run_id":"9-1795713570566476436","schema":"marqdo.observation","schema_version":1,"seq":41}
|
||||||
|
{"kind":"loop.iteration","payload":{"decision":"continue","frame_id":"f5","module_id":"std:marqdo-stdlib@0.2.0#db905508dde89763b9d43b47fc5d52c6a1d5445a91f3c86a550ced43e8aac9d7::format.mq.md","span":{"end":149,"start":121}},"run_id":"9-1795713570566476436","schema":"marqdo.observation","schema_version":1,"seq":42}
|
||||||
|
{"kind":"variable.assigned","payload":{"frame_id":"f5","module_id":"std:marqdo-stdlib@0.2.0#db905508dde89763b9d43b47fc5d52c6a1d5445a91f3c86a550ced43e8aac9d7::format.mq.md","name":"码点","span":{"end":175,"start":151},"value_state":"not_requested","value_type":"Int"},"run_id":"9-1795713570566476436","schema":"marqdo.observation","schema_version":1,"seq":43}
|
||||||
|
{"kind":"branch.eval","payload":{"frame_id":"f5","module_id":"std:marqdo-stdlib@0.2.0#db905508dde89763b9d43b47fc5d52c6a1d5445a91f3c86a550ced43e8aac9d7::format.mq.md","result":true,"span":{"end":194,"start":177}},"run_id":"9-1795713570566476436","schema":"marqdo.observation","schema_version":1,"seq":44}
|
||||||
|
{"kind":"variable.assigned","payload":{"frame_id":"f5","module_id":"std:marqdo-stdlib@0.2.0#db905508dde89763b9d43b47fc5d52c6a1d5445a91f3c86a550ced43e8aac9d7::format.mq.md","name":"总字节","span":{"end":225,"start":196},"value_state":"not_requested","value_type":"Int"},"run_id":"9-1795713570566476436","schema":"marqdo.observation","schema_version":1,"seq":45}
|
||||||
|
{"kind":"variable.assigned","payload":{"frame_id":"f5","module_id":"std:marqdo-stdlib@0.2.0#db905508dde89763b9d43b47fc5d52c6a1d5445a91f3c86a550ced43e8aac9d7::format.mq.md","name":"下标","span":{"end":440,"start":417},"value_state":"not_requested","value_type":"Int"},"run_id":"9-1795713570566476436","schema":"marqdo.observation","schema_version":1,"seq":46}
|
||||||
|
{"kind":"loop.iteration","payload":{"decision":"continue","frame_id":"f5","module_id":"std:marqdo-stdlib@0.2.0#db905508dde89763b9d43b47fc5d52c6a1d5445a91f3c86a550ced43e8aac9d7::format.mq.md","span":{"end":149,"start":121}},"run_id":"9-1795713570566476436","schema":"marqdo.observation","schema_version":1,"seq":47}
|
||||||
|
{"kind":"variable.assigned","payload":{"frame_id":"f5","module_id":"std:marqdo-stdlib@0.2.0#db905508dde89763b9d43b47fc5d52c6a1d5445a91f3c86a550ced43e8aac9d7::format.mq.md","name":"码点","span":{"end":175,"start":151},"value_state":"not_requested","value_type":"Int"},"run_id":"9-1795713570566476436","schema":"marqdo.observation","schema_version":1,"seq":48}
|
||||||
|
{"kind":"branch.eval","payload":{"frame_id":"f5","module_id":"std:marqdo-stdlib@0.2.0#db905508dde89763b9d43b47fc5d52c6a1d5445a91f3c86a550ced43e8aac9d7::format.mq.md","result":true,"span":{"end":194,"start":177}},"run_id":"9-1795713570566476436","schema":"marqdo.observation","schema_version":1,"seq":49}
|
||||||
|
{"kind":"variable.assigned","payload":{"frame_id":"f5","module_id":"std:marqdo-stdlib@0.2.0#db905508dde89763b9d43b47fc5d52c6a1d5445a91f3c86a550ced43e8aac9d7::format.mq.md","name":"总字节","span":{"end":225,"start":196},"value_state":"not_requested","value_type":"Int"},"run_id":"9-1795713570566476436","schema":"marqdo.observation","schema_version":1,"seq":50}
|
||||||
|
{"kind":"variable.assigned","payload":{"frame_id":"f5","module_id":"std:marqdo-stdlib@0.2.0#db905508dde89763b9d43b47fc5d52c6a1d5445a91f3c86a550ced43e8aac9d7::format.mq.md","name":"下标","span":{"end":440,"start":417},"value_state":"not_requested","value_type":"Int"},"run_id":"9-1795713570566476436","schema":"marqdo.observation","schema_version":1,"seq":51}
|
||||||
|
{"kind":"loop.iteration","payload":{"decision":"exit","frame_id":"f5","module_id":"std:marqdo-stdlib@0.2.0#db905508dde89763b9d43b47fc5d52c6a1d5445a91f3c86a550ced43e8aac9d7::format.mq.md","span":{"end":149,"start":121}},"run_id":"9-1795713570566476436","schema":"marqdo.observation","schema_version":1,"seq":52}
|
||||||
|
{"kind":"return","payload":{"frame_id":"f5","module_id":"std:marqdo-stdlib@0.2.0#db905508dde89763b9d43b47fc5d52c6a1d5445a91f3c86a550ced43e8aac9d7::format.mq.md","span":{"end":466,"start":448},"value_type":"Int"},"run_id":"9-1795713570566476436","schema":"marqdo.observation","schema_version":1,"seq":53}
|
||||||
|
{"kind":"call.exit","payload":{"frame_id":"f5","module_id":"std:marqdo-stdlib@0.2.0#db905508dde89763b9d43b47fc5d52c6a1d5445a91f3c86a550ced43e8aac9d7::io/stream.mq.md","span":{"end":1418,"start":1391},"status":"return"},"run_id":"9-1795713570566476436","schema":"marqdo.observation","schema_version":1,"seq":54}
|
||||||
|
{"kind":"variable.assigned","payload":{"frame_id":"f4","module_id":"std:marqdo-stdlib@0.2.0#db905508dde89763b9d43b47fc5d52c6a1d5445a91f3c86a550ced43e8aac9d7::io/stream.mq.md","name":"字节数","span":{"end":1420,"start":1377},"value_state":"not_requested","value_type":"Int"},"run_id":"9-1795713570566476436","schema":"marqdo.observation","schema_version":1,"seq":55}
|
||||||
|
{"kind":"call.enter","payload":{"frame_id":"f6","function_id":"std:marqdo-stdlib@0.2.0#db905508dde89763b9d43b47fc5d52c6a1d5445a91f3c86a550ced43e8aac9d7::io/stream.mq.md::stream.页数","module_id":"std:marqdo-stdlib@0.2.0#db905508dde89763b9d43b47fc5d52c6a1d5445a91f3c86a550ced43e8aac9d7::io/stream.mq.md","parent_frame_id":"f4","span":{"end":1461,"start":1444}},"run_id":"9-1795713570566476436","schema":"marqdo.observation","schema_version":1,"seq":56}
|
||||||
|
{"kind":"parameter.observed","payload":{"frame_id":"f6","module_id":"std:marqdo-stdlib@0.2.0#db905508dde89763b9d43b47fc5d52c6a1d5445a91f3c86a550ced43e8aac9d7::io/stream.mq.md","name":"字节","source":"provided","span":{"end":114,"start":108},"value_state":"not_requested","value_type":"Int"},"run_id":"9-1795713570566476436","schema":"marqdo.observation","schema_version":1,"seq":57}
|
||||||
|
{"kind":"variable.assigned","payload":{"frame_id":"f6","module_id":"std:marqdo-stdlib@0.2.0#db905508dde89763b9d43b47fc5d52c6a1d5445a91f3c86a550ced43e8aac9d7::io/stream.mq.md","name":"页","span":{"end":154,"start":119},"value_state":"not_requested","value_type":"Int"},"run_id":"9-1795713570566476436","schema":"marqdo.observation","schema_version":1,"seq":58}
|
||||||
|
{"kind":"branch.eval","payload":{"frame_id":"f6","module_id":"std:marqdo-stdlib@0.2.0#db905508dde89763b9d43b47fc5d52c6a1d5445a91f3c86a550ced43e8aac9d7::io/stream.mq.md","result":false,"span":{"end":169,"start":156}},"run_id":"9-1795713570566476436","schema":"marqdo.observation","schema_version":1,"seq":59}
|
||||||
|
{"kind":"branch.eval","payload":{"frame_id":"f6","module_id":"std:marqdo-stdlib@0.2.0#db905508dde89763b9d43b47fc5d52c6a1d5445a91f3c86a550ced43e8aac9d7::io/stream.mq.md","result":true,"span":{"end":189,"start":183}},"run_id":"9-1795713570566476436","schema":"marqdo.observation","schema_version":1,"seq":60}
|
||||||
|
{"kind":"branch.eval","payload":{"frame_id":"f6","module_id":"std:marqdo-stdlib@0.2.0#db905508dde89763b9d43b47fc5d52c6a1d5445a91f3c86a550ced43e8aac9d7::io/stream.mq.md","result":true,"span":{"end":199,"start":190}},"run_id":"9-1795713570566476436","schema":"marqdo.observation","schema_version":1,"seq":61}
|
||||||
|
{"kind":"return","payload":{"frame_id":"f6","module_id":"std:marqdo-stdlib@0.2.0#db905508dde89763b9d43b47fc5d52c6a1d5445a91f3c86a550ced43e8aac9d7::io/stream.mq.md","span":{"end":213,"start":201},"value_type":"Int"},"run_id":"9-1795713570566476436","schema":"marqdo.observation","schema_version":1,"seq":62}
|
||||||
|
{"kind":"call.exit","payload":{"frame_id":"f6","module_id":"std:marqdo-stdlib@0.2.0#db905508dde89763b9d43b47fc5d52c6a1d5445a91f3c86a550ced43e8aac9d7::io/stream.mq.md","span":{"end":1461,"start":1444},"status":"return"},"run_id":"9-1795713570566476436","schema":"marqdo.observation","schema_version":1,"seq":63}
|
||||||
|
{"kind":"call.enter","payload":{"frame_id":"f7","function_id":"std:marqdo-stdlib@0.2.0#db905508dde89763b9d43b47fc5d52c6a1d5445a91f3c86a550ced43e8aac9d7::io/stream.mq.md::stream.页数","module_id":"std:marqdo-stdlib@0.2.0#db905508dde89763b9d43b47fc5d52c6a1d5445a91f3c86a550ced43e8aac9d7::io/stream.mq.md","parent_frame_id":"f4","span":{"end":1480,"start":1463}},"run_id":"9-1795713570566476436","schema":"marqdo.observation","schema_version":1,"seq":64}
|
||||||
|
{"kind":"parameter.observed","payload":{"frame_id":"f7","module_id":"std:marqdo-stdlib@0.2.0#db905508dde89763b9d43b47fc5d52c6a1d5445a91f3c86a550ced43e8aac9d7::io/stream.mq.md","name":"字节","source":"provided","span":{"end":114,"start":108},"value_state":"not_requested","value_type":"Int"},"run_id":"9-1795713570566476436","schema":"marqdo.observation","schema_version":1,"seq":65}
|
||||||
|
{"kind":"variable.assigned","payload":{"frame_id":"f7","module_id":"std:marqdo-stdlib@0.2.0#db905508dde89763b9d43b47fc5d52c6a1d5445a91f3c86a550ced43e8aac9d7::io/stream.mq.md","name":"页","span":{"end":154,"start":119},"value_state":"not_requested","value_type":"Int"},"run_id":"9-1795713570566476436","schema":"marqdo.observation","schema_version":1,"seq":66}
|
||||||
|
{"kind":"branch.eval","payload":{"frame_id":"f7","module_id":"std:marqdo-stdlib@0.2.0#db905508dde89763b9d43b47fc5d52c6a1d5445a91f3c86a550ced43e8aac9d7::io/stream.mq.md","result":false,"span":{"end":169,"start":156}},"run_id":"9-1795713570566476436","schema":"marqdo.observation","schema_version":1,"seq":67}
|
||||||
|
{"kind":"branch.eval","payload":{"frame_id":"f7","module_id":"std:marqdo-stdlib@0.2.0#db905508dde89763b9d43b47fc5d52c6a1d5445a91f3c86a550ced43e8aac9d7::io/stream.mq.md","result":true,"span":{"end":189,"start":183}},"run_id":"9-1795713570566476436","schema":"marqdo.observation","schema_version":1,"seq":68}
|
||||||
|
{"kind":"branch.eval","payload":{"frame_id":"f7","module_id":"std:marqdo-stdlib@0.2.0#db905508dde89763b9d43b47fc5d52c6a1d5445a91f3c86a550ced43e8aac9d7::io/stream.mq.md","result":true,"span":{"end":199,"start":190}},"run_id":"9-1795713570566476436","schema":"marqdo.observation","schema_version":1,"seq":69}
|
||||||
|
{"kind":"return","payload":{"frame_id":"f7","module_id":"std:marqdo-stdlib@0.2.0#db905508dde89763b9d43b47fc5d52c6a1d5445a91f3c86a550ced43e8aac9d7::io/stream.mq.md","span":{"end":213,"start":201},"value_type":"Int"},"run_id":"9-1795713570566476436","schema":"marqdo.observation","schema_version":1,"seq":70}
|
||||||
|
{"kind":"call.exit","payload":{"frame_id":"f7","module_id":"std:marqdo-stdlib@0.2.0#db905508dde89763b9d43b47fc5d52c6a1d5445a91f3c86a550ced43e8aac9d7::io/stream.mq.md","span":{"end":1480,"start":1463},"status":"return"},"run_id":"9-1795713570566476436","schema":"marqdo.observation","schema_version":1,"seq":71}
|
||||||
|
{"kind":"effect","payload":{"frame_id":"f4","module_id":"std:marqdo-stdlib@0.2.0#db905508dde89763b9d43b47fc5d52c6a1d5445a91f3c86a550ced43e8aac9d7::io/stream.mq.md","operation":"memory.new","result_code":"ok","span":{"end":1481,"start":1433}},"run_id":"9-1795713570566476436","schema":"marqdo.observation","schema_version":1,"seq":72}
|
||||||
|
{"kind":"variable.assigned","payload":{"frame_id":"f4","module_id":"std:marqdo-stdlib@0.2.0#db905508dde89763b9d43b47fc5d52c6a1d5445a91f3c86a550ced43e8aac9d7::io/stream.mq.md","name":"内存","span":{"end":1483,"start":1422},"value_state":"not_requested","value_type":"Memory"},"run_id":"9-1795713570566476436","schema":"marqdo.observation","schema_version":1,"seq":73}
|
||||||
|
{"kind":"call.enter","payload":{"frame_id":"f8","function_id":"std:marqdo-stdlib@0.2.0#db905508dde89763b9d43b47fc5d52c6a1d5445a91f3c86a550ced43e8aac9d7::text/utf8.mq.md::utf8.编码","module_id":"std:marqdo-stdlib@0.2.0#db905508dde89763b9d43b47fc5d52c6a1d5445a91f3c86a550ced43e8aac9d7::io/stream.mq.md","parent_frame_id":"f4","span":{"end":1526,"start":1496}},"run_id":"9-1795713570566476436","schema":"marqdo.observation","schema_version":1,"seq":74}
|
||||||
|
{"kind":"parameter.observed","payload":{"frame_id":"f8","module_id":"std:marqdo-stdlib@0.2.0#db905508dde89763b9d43b47fc5d52c6a1d5445a91f3c86a550ced43e8aac9d7::text/utf8.mq.md","name":"文本","source":"provided","span":{"end":260,"start":254},"value_state":"not_requested","value_type":"Text"},"run_id":"9-1795713570566476436","schema":"marqdo.observation","schema_version":1,"seq":75}
|
||||||
|
{"kind":"parameter.observed","payload":{"frame_id":"f8","module_id":"std:marqdo-stdlib@0.2.0#db905508dde89763b9d43b47fc5d52c6a1d5445a91f3c86a550ced43e8aac9d7::text/utf8.mq.md","name":"内存","source":"provided","span":{"end":268,"start":261},"value_state":"not_requested","value_type":"Memory"},"run_id":"9-1795713570566476436","schema":"marqdo.observation","schema_version":1,"seq":76}
|
||||||
|
{"kind":"parameter.observed","payload":{"frame_id":"f8","module_id":"std:marqdo-stdlib@0.2.0#db905508dde89763b9d43b47fc5d52c6a1d5445a91f3c86a550ced43e8aac9d7::text/utf8.mq.md","name":"基址","source":"provided","span":{"end":276,"start":269},"value_state":"not_requested","value_type":"Int"},"run_id":"9-1795713570566476436","schema":"marqdo.observation","schema_version":1,"seq":77}
|
||||||
|
{"kind":"variable.assigned","payload":{"frame_id":"f8","module_id":"std:marqdo-stdlib@0.2.0#db905508dde89763b9d43b47fc5d52c6a1d5445a91f3c86a550ced43e8aac9d7::text/utf8.mq.md","name":"点","span":{"end":466,"start":433},"value_state":"not_requested","value_type":"List"},"run_id":"9-1795713570566476436","schema":"marqdo.observation","schema_version":1,"seq":78}
|
||||||
|
{"kind":"variable.assigned","payload":{"frame_id":"f8","module_id":"std:marqdo-stdlib@0.2.0#db905508dde89763b9d43b47fc5d52c6a1d5445a91f3c86a550ced43e8aac9d7::text/utf8.mq.md","name":"下标","span":{"end":482,"start":468},"value_state":"not_requested","value_type":"Int"},"run_id":"9-1795713570566476436","schema":"marqdo.observation","schema_version":1,"seq":79}
|
||||||
|
{"kind":"variable.assigned","payload":{"frame_id":"f8","module_id":"std:marqdo-stdlib@0.2.0#db905508dde89763b9d43b47fc5d52c6a1d5445a91f3c86a550ced43e8aac9d7::text/utf8.mq.md","name":"偏移","span":{"end":498,"start":484},"value_state":"not_requested","value_type":"Int"},"run_id":"9-1795713570566476436","schema":"marqdo.observation","schema_version":1,"seq":80}
|
||||||
|
{"kind":"loop.iteration","payload":{"decision":"continue","frame_id":"f8","module_id":"std:marqdo-stdlib@0.2.0#db905508dde89763b9d43b47fc5d52c6a1d5445a91f3c86a550ced43e8aac9d7::text/utf8.mq.md","span":{"end":528,"start":500}},"run_id":"9-1795713570566476436","schema":"marqdo.observation","schema_version":1,"seq":81}
|
||||||
|
{"kind":"variable.assigned","payload":{"frame_id":"f8","module_id":"std:marqdo-stdlib@0.2.0#db905508dde89763b9d43b47fc5d52c6a1d5445a91f3c86a550ced43e8aac9d7::text/utf8.mq.md","name":"码点","span":{"end":554,"start":530},"value_state":"not_requested","value_type":"Int"},"run_id":"9-1795713570566476436","schema":"marqdo.observation","schema_version":1,"seq":82}
|
||||||
|
{"kind":"branch.eval","payload":{"frame_id":"f8","module_id":"std:marqdo-stdlib@0.2.0#db905508dde89763b9d43b47fc5d52c6a1d5445a91f3c86a550ced43e8aac9d7::text/utf8.mq.md","result":true,"span":{"end":573,"start":556}},"run_id":"9-1795713570566476436","schema":"marqdo.observation","schema_version":1,"seq":83}
|
||||||
|
{"kind":"effect","payload":{"frame_id":"f8","module_id":"std:marqdo-stdlib@0.2.0#db905508dde89763b9d43b47fc5d52c6a1d5445a91f3c86a550ced43e8aac9d7::text/utf8.mq.md","operation":"memory.write","result_code":"ok","span":{"end":601,"start":578}},"run_id":"9-1795713570566476436","schema":"marqdo.observation","schema_version":1,"seq":84}
|
||||||
|
{"kind":"variable.assigned","payload":{"frame_id":"f8","module_id":"std:marqdo-stdlib@0.2.0#db905508dde89763b9d43b47fc5d52c6a1d5445a91f3c86a550ced43e8aac9d7::text/utf8.mq.md","name":"偏移","span":{"end":638,"start":615},"value_state":"not_requested","value_type":"Int"},"run_id":"9-1795713570566476436","schema":"marqdo.observation","schema_version":1,"seq":85}
|
||||||
|
{"kind":"variable.assigned","payload":{"frame_id":"f8","module_id":"std:marqdo-stdlib@0.2.0#db905508dde89763b9d43b47fc5d52c6a1d5445a91f3c86a550ced43e8aac9d7::text/utf8.mq.md","name":"下标","span":{"end":1347,"start":1324},"value_state":"not_requested","value_type":"Int"},"run_id":"9-1795713570566476436","schema":"marqdo.observation","schema_version":1,"seq":86}
|
||||||
|
{"kind":"loop.iteration","payload":{"decision":"continue","frame_id":"f8","module_id":"std:marqdo-stdlib@0.2.0#db905508dde89763b9d43b47fc5d52c6a1d5445a91f3c86a550ced43e8aac9d7::text/utf8.mq.md","span":{"end":528,"start":500}},"run_id":"9-1795713570566476436","schema":"marqdo.observation","schema_version":1,"seq":87}
|
||||||
|
{"kind":"variable.assigned","payload":{"frame_id":"f8","module_id":"std:marqdo-stdlib@0.2.0#db905508dde89763b9d43b47fc5d52c6a1d5445a91f3c86a550ced43e8aac9d7::text/utf8.mq.md","name":"码点","span":{"end":554,"start":530},"value_state":"not_requested","value_type":"Int"},"run_id":"9-1795713570566476436","schema":"marqdo.observation","schema_version":1,"seq":88}
|
||||||
|
{"kind":"branch.eval","payload":{"frame_id":"f8","module_id":"std:marqdo-stdlib@0.2.0#db905508dde89763b9d43b47fc5d52c6a1d5445a91f3c86a550ced43e8aac9d7::text/utf8.mq.md","result":true,"span":{"end":573,"start":556}},"run_id":"9-1795713570566476436","schema":"marqdo.observation","schema_version":1,"seq":89}
|
||||||
|
{"kind":"effect","payload":{"frame_id":"f8","module_id":"std:marqdo-stdlib@0.2.0#db905508dde89763b9d43b47fc5d52c6a1d5445a91f3c86a550ced43e8aac9d7::text/utf8.mq.md","operation":"memory.write","result_code":"ok","span":{"end":601,"start":578}},"run_id":"9-1795713570566476436","schema":"marqdo.observation","schema_version":1,"seq":90}
|
||||||
|
{"kind":"variable.assigned","payload":{"frame_id":"f8","module_id":"std:marqdo-stdlib@0.2.0#db905508dde89763b9d43b47fc5d52c6a1d5445a91f3c86a550ced43e8aac9d7::text/utf8.mq.md","name":"偏移","span":{"end":638,"start":615},"value_state":"not_requested","value_type":"Int"},"run_id":"9-1795713570566476436","schema":"marqdo.observation","schema_version":1,"seq":91}
|
||||||
|
{"kind":"variable.assigned","payload":{"frame_id":"f8","module_id":"std:marqdo-stdlib@0.2.0#db905508dde89763b9d43b47fc5d52c6a1d5445a91f3c86a550ced43e8aac9d7::text/utf8.mq.md","name":"下标","span":{"end":1347,"start":1324},"value_state":"not_requested","value_type":"Int"},"run_id":"9-1795713570566476436","schema":"marqdo.observation","schema_version":1,"seq":92}
|
||||||
|
{"kind":"loop.iteration","payload":{"decision":"continue","frame_id":"f8","module_id":"std:marqdo-stdlib@0.2.0#db905508dde89763b9d43b47fc5d52c6a1d5445a91f3c86a550ced43e8aac9d7::text/utf8.mq.md","span":{"end":528,"start":500}},"run_id":"9-1795713570566476436","schema":"marqdo.observation","schema_version":1,"seq":93}
|
||||||
|
{"kind":"variable.assigned","payload":{"frame_id":"f8","module_id":"std:marqdo-stdlib@0.2.0#db905508dde89763b9d43b47fc5d52c6a1d5445a91f3c86a550ced43e8aac9d7::text/utf8.mq.md","name":"码点","span":{"end":554,"start":530},"value_state":"not_requested","value_type":"Int"},"run_id":"9-1795713570566476436","schema":"marqdo.observation","schema_version":1,"seq":94}
|
||||||
|
{"kind":"branch.eval","payload":{"frame_id":"f8","module_id":"std:marqdo-stdlib@0.2.0#db905508dde89763b9d43b47fc5d52c6a1d5445a91f3c86a550ced43e8aac9d7::text/utf8.mq.md","result":true,"span":{"end":573,"start":556}},"run_id":"9-1795713570566476436","schema":"marqdo.observation","schema_version":1,"seq":95}
|
||||||
|
{"kind":"effect","payload":{"frame_id":"f8","module_id":"std:marqdo-stdlib@0.2.0#db905508dde89763b9d43b47fc5d52c6a1d5445a91f3c86a550ced43e8aac9d7::text/utf8.mq.md","operation":"memory.write","result_code":"ok","span":{"end":601,"start":578}},"run_id":"9-1795713570566476436","schema":"marqdo.observation","schema_version":1,"seq":96}
|
||||||
|
{"kind":"variable.assigned","payload":{"frame_id":"f8","module_id":"std:marqdo-stdlib@0.2.0#db905508dde89763b9d43b47fc5d52c6a1d5445a91f3c86a550ced43e8aac9d7::text/utf8.mq.md","name":"偏移","span":{"end":638,"start":615},"value_state":"not_requested","value_type":"Int"},"run_id":"9-1795713570566476436","schema":"marqdo.observation","schema_version":1,"seq":97}
|
||||||
|
{"kind":"variable.assigned","payload":{"frame_id":"f8","module_id":"std:marqdo-stdlib@0.2.0#db905508dde89763b9d43b47fc5d52c6a1d5445a91f3c86a550ced43e8aac9d7::text/utf8.mq.md","name":"下标","span":{"end":1347,"start":1324},"value_state":"not_requested","value_type":"Int"},"run_id":"9-1795713570566476436","schema":"marqdo.observation","schema_version":1,"seq":98}
|
||||||
|
{"kind":"loop.iteration","payload":{"decision":"continue","frame_id":"f8","module_id":"std:marqdo-stdlib@0.2.0#db905508dde89763b9d43b47fc5d52c6a1d5445a91f3c86a550ced43e8aac9d7::text/utf8.mq.md","span":{"end":528,"start":500}},"run_id":"9-1795713570566476436","schema":"marqdo.observation","schema_version":1,"seq":99}
|
||||||
|
{"kind":"variable.assigned","payload":{"frame_id":"f8","module_id":"std:marqdo-stdlib@0.2.0#db905508dde89763b9d43b47fc5d52c6a1d5445a91f3c86a550ced43e8aac9d7::text/utf8.mq.md","name":"码点","span":{"end":554,"start":530},"value_state":"not_requested","value_type":"Int"},"run_id":"9-1795713570566476436","schema":"marqdo.observation","schema_version":1,"seq":100}
|
||||||
|
{"kind":"branch.eval","payload":{"frame_id":"f8","module_id":"std:marqdo-stdlib@0.2.0#db905508dde89763b9d43b47fc5d52c6a1d5445a91f3c86a550ced43e8aac9d7::text/utf8.mq.md","result":true,"span":{"end":573,"start":556}},"run_id":"9-1795713570566476436","schema":"marqdo.observation","schema_version":1,"seq":101}
|
||||||
|
{"kind":"effect","payload":{"frame_id":"f8","module_id":"std:marqdo-stdlib@0.2.0#db905508dde89763b9d43b47fc5d52c6a1d5445a91f3c86a550ced43e8aac9d7::text/utf8.mq.md","operation":"memory.write","result_code":"ok","span":{"end":601,"start":578}},"run_id":"9-1795713570566476436","schema":"marqdo.observation","schema_version":1,"seq":102}
|
||||||
|
{"kind":"variable.assigned","payload":{"frame_id":"f8","module_id":"std:marqdo-stdlib@0.2.0#db905508dde89763b9d43b47fc5d52c6a1d5445a91f3c86a550ced43e8aac9d7::text/utf8.mq.md","name":"偏移","span":{"end":638,"start":615},"value_state":"not_requested","value_type":"Int"},"run_id":"9-1795713570566476436","schema":"marqdo.observation","schema_version":1,"seq":103}
|
||||||
|
{"kind":"variable.assigned","payload":{"frame_id":"f8","module_id":"std:marqdo-stdlib@0.2.0#db905508dde89763b9d43b47fc5d52c6a1d5445a91f3c86a550ced43e8aac9d7::text/utf8.mq.md","name":"下标","span":{"end":1347,"start":1324},"value_state":"not_requested","value_type":"Int"},"run_id":"9-1795713570566476436","schema":"marqdo.observation","schema_version":1,"seq":104}
|
||||||
|
{"kind":"loop.iteration","payload":{"decision":"continue","frame_id":"f8","module_id":"std:marqdo-stdlib@0.2.0#db905508dde89763b9d43b47fc5d52c6a1d5445a91f3c86a550ced43e8aac9d7::text/utf8.mq.md","span":{"end":528,"start":500}},"run_id":"9-1795713570566476436","schema":"marqdo.observation","schema_version":1,"seq":105}
|
||||||
|
{"kind":"variable.assigned","payload":{"frame_id":"f8","module_id":"std:marqdo-stdlib@0.2.0#db905508dde89763b9d43b47fc5d52c6a1d5445a91f3c86a550ced43e8aac9d7::text/utf8.mq.md","name":"码点","span":{"end":554,"start":530},"value_state":"not_requested","value_type":"Int"},"run_id":"9-1795713570566476436","schema":"marqdo.observation","schema_version":1,"seq":106}
|
||||||
|
{"kind":"branch.eval","payload":{"frame_id":"f8","module_id":"std:marqdo-stdlib@0.2.0#db905508dde89763b9d43b47fc5d52c6a1d5445a91f3c86a550ced43e8aac9d7::text/utf8.mq.md","result":true,"span":{"end":573,"start":556}},"run_id":"9-1795713570566476436","schema":"marqdo.observation","schema_version":1,"seq":107}
|
||||||
|
{"kind":"effect","payload":{"frame_id":"f8","module_id":"std:marqdo-stdlib@0.2.0#db905508dde89763b9d43b47fc5d52c6a1d5445a91f3c86a550ced43e8aac9d7::text/utf8.mq.md","operation":"memory.write","result_code":"ok","span":{"end":601,"start":578}},"run_id":"9-1795713570566476436","schema":"marqdo.observation","schema_version":1,"seq":108}
|
||||||
|
{"kind":"variable.assigned","payload":{"frame_id":"f8","module_id":"std:marqdo-stdlib@0.2.0#db905508dde89763b9d43b47fc5d52c6a1d5445a91f3c86a550ced43e8aac9d7::text/utf8.mq.md","name":"偏移","span":{"end":638,"start":615},"value_state":"not_requested","value_type":"Int"},"run_id":"9-1795713570566476436","schema":"marqdo.observation","schema_version":1,"seq":109}
|
||||||
|
{"kind":"variable.assigned","payload":{"frame_id":"f8","module_id":"std:marqdo-stdlib@0.2.0#db905508dde89763b9d43b47fc5d52c6a1d5445a91f3c86a550ced43e8aac9d7::text/utf8.mq.md","name":"下标","span":{"end":1347,"start":1324},"value_state":"not_requested","value_type":"Int"},"run_id":"9-1795713570566476436","schema":"marqdo.observation","schema_version":1,"seq":110}
|
||||||
|
{"kind":"loop.iteration","payload":{"decision":"continue","frame_id":"f8","module_id":"std:marqdo-stdlib@0.2.0#db905508dde89763b9d43b47fc5d52c6a1d5445a91f3c86a550ced43e8aac9d7::text/utf8.mq.md","span":{"end":528,"start":500}},"run_id":"9-1795713570566476436","schema":"marqdo.observation","schema_version":1,"seq":111}
|
||||||
|
{"kind":"variable.assigned","payload":{"frame_id":"f8","module_id":"std:marqdo-stdlib@0.2.0#db905508dde89763b9d43b47fc5d52c6a1d5445a91f3c86a550ced43e8aac9d7::text/utf8.mq.md","name":"码点","span":{"end":554,"start":530},"value_state":"not_requested","value_type":"Int"},"run_id":"9-1795713570566476436","schema":"marqdo.observation","schema_version":1,"seq":112}
|
||||||
|
{"kind":"branch.eval","payload":{"frame_id":"f8","module_id":"std:marqdo-stdlib@0.2.0#db905508dde89763b9d43b47fc5d52c6a1d5445a91f3c86a550ced43e8aac9d7::text/utf8.mq.md","result":true,"span":{"end":573,"start":556}},"run_id":"9-1795713570566476436","schema":"marqdo.observation","schema_version":1,"seq":113}
|
||||||
|
{"kind":"effect","payload":{"frame_id":"f8","module_id":"std:marqdo-stdlib@0.2.0#db905508dde89763b9d43b47fc5d52c6a1d5445a91f3c86a550ced43e8aac9d7::text/utf8.mq.md","operation":"memory.write","result_code":"ok","span":{"end":601,"start":578}},"run_id":"9-1795713570566476436","schema":"marqdo.observation","schema_version":1,"seq":114}
|
||||||
|
{"kind":"variable.assigned","payload":{"frame_id":"f8","module_id":"std:marqdo-stdlib@0.2.0#db905508dde89763b9d43b47fc5d52c6a1d5445a91f3c86a550ced43e8aac9d7::text/utf8.mq.md","name":"偏移","span":{"end":638,"start":615},"value_state":"not_requested","value_type":"Int"},"run_id":"9-1795713570566476436","schema":"marqdo.observation","schema_version":1,"seq":115}
|
||||||
|
{"kind":"variable.assigned","payload":{"frame_id":"f8","module_id":"std:marqdo-stdlib@0.2.0#db905508dde89763b9d43b47fc5d52c6a1d5445a91f3c86a550ced43e8aac9d7::text/utf8.mq.md","name":"下标","span":{"end":1347,"start":1324},"value_state":"not_requested","value_type":"Int"},"run_id":"9-1795713570566476436","schema":"marqdo.observation","schema_version":1,"seq":116}
|
||||||
|
{"kind":"loop.iteration","payload":{"decision":"exit","frame_id":"f8","module_id":"std:marqdo-stdlib@0.2.0#db905508dde89763b9d43b47fc5d52c6a1d5445a91f3c86a550ced43e8aac9d7::text/utf8.mq.md","span":{"end":528,"start":500}},"run_id":"9-1795713570566476436","schema":"marqdo.observation","schema_version":1,"seq":117}
|
||||||
|
{"kind":"return","payload":{"frame_id":"f8","module_id":"std:marqdo-stdlib@0.2.0#db905508dde89763b9d43b47fc5d52c6a1d5445a91f3c86a550ced43e8aac9d7::text/utf8.mq.md","span":{"end":1370,"start":1355},"value_type":"Int"},"run_id":"9-1795713570566476436","schema":"marqdo.observation","schema_version":1,"seq":118}
|
||||||
|
{"kind":"call.exit","payload":{"frame_id":"f8","module_id":"std:marqdo-stdlib@0.2.0#db905508dde89763b9d43b47fc5d52c6a1d5445a91f3c86a550ced43e8aac9d7::io/stream.mq.md","span":{"end":1526,"start":1496},"status":"return"},"run_id":"9-1795713570566476436","schema":"marqdo.observation","schema_version":1,"seq":119}
|
||||||
|
{"kind":"variable.assigned","payload":{"frame_id":"f4","module_id":"std:marqdo-stdlib@0.2.0#db905508dde89763b9d43b47fc5d52c6a1d5445a91f3c86a550ced43e8aac9d7::io/stream.mq.md","name":"长度","span":{"end":1528,"start":1485},"value_state":"not_requested","value_type":"Int"},"run_id":"9-1795713570566476436","schema":"marqdo.observation","schema_version":1,"seq":120}
|
||||||
|
{"kind":"effect","payload":{"frame_id":"f4","module_id":"std:marqdo-stdlib@0.2.0#db905508dde89763b9d43b47fc5d52c6a1d5445a91f3c86a550ced43e8aac9d7::io/stream.mq.md","operation":"resource.open","result_code":"ok","span":{"end":1581,"start":1538}},"run_id":"9-1795713570566476436","schema":"marqdo.observation","schema_version":1,"seq":121}
|
||||||
|
{"kind":"variable.assigned","payload":{"frame_id":"f4","module_id":"std:marqdo-stdlib@0.2.0#db905508dde89763b9d43b47fc5d52c6a1d5445a91f3c86a550ced43e8aac9d7::io/stream.mq.md","name":"流","span":{"end":1583,"start":1530},"value_state":"not_requested","value_type":"Resource"},"run_id":"9-1795713570566476436","schema":"marqdo.observation","schema_version":1,"seq":122}
|
||||||
|
{"kind":"call.enter","payload":{"frame_id":"f9","function_id":"std:marqdo-stdlib@0.2.0#db905508dde89763b9d43b47fc5d52c6a1d5445a91f3c86a550ced43e8aac9d7::io/stream.mq.md::stream.写全部","module_id":"std:marqdo-stdlib@0.2.0#db905508dde89763b9d43b47fc5d52c6a1d5445a91f3c86a550ced43e8aac9d7::io/stream.mq.md","parent_frame_id":"f4","span":{"end":1632,"start":1599}},"run_id":"9-1795713570566476436","schema":"marqdo.observation","schema_version":1,"seq":123}
|
||||||
|
{"kind":"parameter.observed","payload":{"frame_id":"f9","module_id":"std:marqdo-stdlib@0.2.0#db905508dde89763b9d43b47fc5d52c6a1d5445a91f3c86a550ced43e8aac9d7::io/stream.mq.md","name":"流","source":"provided","span":{"end":251,"start":248},"value_state":"not_requested","value_type":"Resource"},"run_id":"9-1795713570566476436","schema":"marqdo.observation","schema_version":1,"seq":124}
|
||||||
|
{"kind":"parameter.observed","payload":{"frame_id":"f9","module_id":"std:marqdo-stdlib@0.2.0#db905508dde89763b9d43b47fc5d52c6a1d5445a91f3c86a550ced43e8aac9d7::io/stream.mq.md","name":"内存","source":"provided","span":{"end":259,"start":252},"value_state":"not_requested","value_type":"Memory"},"run_id":"9-1795713570566476436","schema":"marqdo.observation","schema_version":1,"seq":125}
|
||||||
|
{"kind":"parameter.observed","payload":{"frame_id":"f9","module_id":"std:marqdo-stdlib@0.2.0#db905508dde89763b9d43b47fc5d52c6a1d5445a91f3c86a550ced43e8aac9d7::io/stream.mq.md","name":"起点","source":"provided","span":{"end":267,"start":260},"value_state":"not_requested","value_type":"Int"},"run_id":"9-1795713570566476436","schema":"marqdo.observation","schema_version":1,"seq":126}
|
||||||
|
{"kind":"parameter.observed","payload":{"frame_id":"f9","module_id":"std:marqdo-stdlib@0.2.0#db905508dde89763b9d43b47fc5d52c6a1d5445a91f3c86a550ced43e8aac9d7::io/stream.mq.md","name":"长度","source":"provided","span":{"end":275,"start":268},"value_state":"not_requested","value_type":"Int"},"run_id":"9-1795713570566476436","schema":"marqdo.observation","schema_version":1,"seq":127}
|
||||||
|
{"kind":"variable.assigned","payload":{"frame_id":"f9","module_id":"std:marqdo-stdlib@0.2.0#db905508dde89763b9d43b47fc5d52c6a1d5445a91f3c86a550ced43e8aac9d7::io/stream.mq.md","name":"已写","span":{"end":447,"start":433},"value_state":"not_requested","value_type":"Int"},"run_id":"9-1795713570566476436","schema":"marqdo.observation","schema_version":1,"seq":128}
|
||||||
|
{"kind":"variable.assigned","payload":{"frame_id":"f9","module_id":"std:marqdo-stdlib@0.2.0#db905508dde89763b9d43b47fc5d52c6a1d5445a91f3c86a550ced43e8aac9d7::io/stream.mq.md","name":"失败","span":{"end":467,"start":449},"value_state":"not_requested","value_type":"Bool"},"run_id":"9-1795713570566476436","schema":"marqdo.observation","schema_version":1,"seq":129}
|
||||||
|
{"kind":"variable.assigned","payload":{"frame_id":"f9","module_id":"std:marqdo-stdlib@0.2.0#db905508dde89763b9d43b47fc5d52c6a1d5445a91f3c86a550ced43e8aac9d7::io/stream.mq.md","name":"本次","span":{"end":511,"start":469},"value_state":"not_requested","value_type":"Map"},"run_id":"9-1795713570566476436","schema":"marqdo.observation","schema_version":1,"seq":130}
|
||||||
|
{"kind":"variable.assigned","payload":{"frame_id":"f9","module_id":"std:marqdo-stdlib@0.2.0#db905508dde89763b9d43b47fc5d52c6a1d5445a91f3c86a550ced43e8aac9d7::io/stream.mq.md","name":"错误结果","span":{"end":610,"start":513},"value_state":"not_requested","value_type":"Map"},"run_id":"9-1795713570566476436","schema":"marqdo.observation","schema_version":1,"seq":131}
|
||||||
|
{"kind":"loop.iteration","payload":{"decision":"continue","frame_id":"f9","module_id":"std:marqdo-stdlib@0.2.0#db905508dde89763b9d43b47fc5d52c6a1d5445a91f3c86a550ced43e8aac9d7::io/stream.mq.md","span":{"end":635,"start":612}},"run_id":"9-1795713570566476436","schema":"marqdo.observation","schema_version":1,"seq":132}
|
||||||
|
{"kind":"variable.assigned","payload":{"frame_id":"f9","module_id":"std:marqdo-stdlib@0.2.0#db905508dde89763b9d43b47fc5d52c6a1d5445a91f3c86a550ced43e8aac9d7::io/stream.mq.md","name":"剩余","span":{"end":665,"start":637},"value_state":"not_requested","value_type":"Int"},"run_id":"9-1795713570566476436","schema":"marqdo.observation","schema_version":1,"seq":133}
|
||||||
|
{"kind":"stdout.chunk","payload":{"byte_count":6,"data_base64":"U1RBUlQK","encoding":"base64"},"run_id":"9-1795713570566476436","schema":"marqdo.observation","schema_version":1,"seq":134}
|
||||||
|
{"kind":"effect","payload":{"frame_id":"f9","module_id":"std:marqdo-stdlib@0.2.0#db905508dde89763b9d43b47fc5d52c6a1d5445a91f3c86a550ced43e8aac9d7::io/stream.mq.md","operation":"resource.write","result_code":"ok","span":{"end":730,"start":678}},"run_id":"9-1795713570566476436","schema":"marqdo.observation","schema_version":1,"seq":135}
|
||||||
|
{"kind":"variable.assigned","payload":{"frame_id":"f9","module_id":"std:marqdo-stdlib@0.2.0#db905508dde89763b9d43b47fc5d52c6a1d5445a91f3c86a550ced43e8aac9d7::io/stream.mq.md","name":"本次","span":{"end":732,"start":667},"value_state":"not_requested","value_type":"Map"},"run_id":"9-1795713570566476436","schema":"marqdo.observation","schema_version":1,"seq":136}
|
||||||
|
{"kind":"branch.eval","payload":{"frame_id":"f9","module_id":"std:marqdo-stdlib@0.2.0#db905508dde89763b9d43b47fc5d52c6a1d5445a91f3c86a550ced43e8aac9d7::io/stream.mq.md","result":false,"span":{"end":752,"start":734}},"run_id":"9-1795713570566476436","schema":"marqdo.observation","schema_version":1,"seq":137}
|
||||||
|
{"kind":"branch.eval","payload":{"frame_id":"f9","module_id":"std:marqdo-stdlib@0.2.0#db905508dde89763b9d43b47fc5d52c6a1d5445a91f3c86a550ced43e8aac9d7::io/stream.mq.md","result":true,"span":{"end":827,"start":821}},"run_id":"9-1795713570566476436","schema":"marqdo.observation","schema_version":1,"seq":138}
|
||||||
|
{"kind":"branch.eval","payload":{"frame_id":"f9","module_id":"std:marqdo-stdlib@0.2.0#db905508dde89763b9d43b47fc5d52c6a1d5445a91f3c86a550ced43e8aac9d7::io/stream.mq.md","result":false,"span":{"end":856,"start":828}},"run_id":"9-1795713570566476436","schema":"marqdo.observation","schema_version":1,"seq":139}
|
||||||
|
{"kind":"branch.eval","payload":{"frame_id":"f9","module_id":"std:marqdo-stdlib@0.2.0#db905508dde89763b9d43b47fc5d52c6a1d5445a91f3c86a550ced43e8aac9d7::io/stream.mq.md","result":true,"span":{"end":904,"start":898}},"run_id":"9-1795713570566476436","schema":"marqdo.observation","schema_version":1,"seq":140}
|
||||||
|
{"kind":"branch.eval","payload":{"frame_id":"f9","module_id":"std:marqdo-stdlib@0.2.0#db905508dde89763b9d43b47fc5d52c6a1d5445a91f3c86a550ced43e8aac9d7::io/stream.mq.md","result":true,"span":{"end":914,"start":905}},"run_id":"9-1795713570566476436","schema":"marqdo.observation","schema_version":1,"seq":141}
|
||||||
|
{"kind":"variable.assigned","payload":{"frame_id":"f9","module_id":"std:marqdo-stdlib@0.2.0#db905508dde89763b9d43b47fc5d52c6a1d5445a91f3c86a550ced43e8aac9d7::io/stream.mq.md","name":"已写","span":{"end":956,"start":916},"value_state":"not_requested","value_type":"Int"},"run_id":"9-1795713570566476436","schema":"marqdo.observation","schema_version":1,"seq":142}
|
||||||
|
{"kind":"loop.iteration","payload":{"decision":"exit","frame_id":"f9","module_id":"std:marqdo-stdlib@0.2.0#db905508dde89763b9d43b47fc5d52c6a1d5445a91f3c86a550ced43e8aac9d7::io/stream.mq.md","span":{"end":635,"start":612}},"run_id":"9-1795713570566476436","schema":"marqdo.observation","schema_version":1,"seq":143}
|
||||||
|
{"kind":"branch.eval","payload":{"frame_id":"f9","module_id":"std:marqdo-stdlib@0.2.0#db905508dde89763b9d43b47fc5d52c6a1d5445a91f3c86a550ced43e8aac9d7::io/stream.mq.md","result":false,"span":{"end":993,"start":982}},"run_id":"9-1795713570566476436","schema":"marqdo.observation","schema_version":1,"seq":144}
|
||||||
|
{"kind":"branch.eval","payload":{"frame_id":"f9","module_id":"std:marqdo-stdlib@0.2.0#db905508dde89763b9d43b47fc5d52c6a1d5445a91f3c86a550ced43e8aac9d7::io/stream.mq.md","result":true,"span":{"end":1024,"start":1018}},"run_id":"9-1795713570566476436","schema":"marqdo.observation","schema_version":1,"seq":145}
|
||||||
|
{"kind":"branch.eval","payload":{"frame_id":"f9","module_id":"std:marqdo-stdlib@0.2.0#db905508dde89763b9d43b47fc5d52c6a1d5445a91f3c86a550ced43e8aac9d7::io/stream.mq.md","result":false,"span":{"end":1045,"start":1025}},"run_id":"9-1795713570566476436","schema":"marqdo.observation","schema_version":1,"seq":146}
|
||||||
|
{"kind":"branch.eval","payload":{"frame_id":"f9","module_id":"std:marqdo-stdlib@0.2.0#db905508dde89763b9d43b47fc5d52c6a1d5445a91f3c86a550ced43e8aac9d7::io/stream.mq.md","result":true,"span":{"end":1076,"start":1070}},"run_id":"9-1795713570566476436","schema":"marqdo.observation","schema_version":1,"seq":147}
|
||||||
|
{"kind":"branch.eval","payload":{"frame_id":"f9","module_id":"std:marqdo-stdlib@0.2.0#db905508dde89763b9d43b47fc5d52c6a1d5445a91f3c86a550ced43e8aac9d7::io/stream.mq.md","result":true,"span":{"end":1086,"start":1077}},"run_id":"9-1795713570566476436","schema":"marqdo.observation","schema_version":1,"seq":148}
|
||||||
|
{"kind":"return","payload":{"frame_id":"f9","module_id":"std:marqdo-stdlib@0.2.0#db905508dde89763b9d43b47fc5d52c6a1d5445a91f3c86a550ced43e8aac9d7::io/stream.mq.md","span":{"end":1131,"start":1088},"value_type":"Map"},"run_id":"9-1795713570566476436","schema":"marqdo.observation","schema_version":1,"seq":149}
|
||||||
|
{"kind":"call.exit","payload":{"frame_id":"f9","module_id":"std:marqdo-stdlib@0.2.0#db905508dde89763b9d43b47fc5d52c6a1d5445a91f3c86a550ced43e8aac9d7::io/stream.mq.md","span":{"end":1632,"start":1599},"status":"return"},"run_id":"9-1795713570566476436","schema":"marqdo.observation","schema_version":1,"seq":150}
|
||||||
|
{"kind":"variable.assigned","payload":{"frame_id":"f4","module_id":"std:marqdo-stdlib@0.2.0#db905508dde89763b9d43b47fc5d52c6a1d5445a91f3c86a550ced43e8aac9d7::io/stream.mq.md","name":"写结果","span":{"end":1634,"start":1585},"value_state":"not_requested","value_type":"Map"},"run_id":"9-1795713570566476436","schema":"marqdo.observation","schema_version":1,"seq":151}
|
||||||
|
{"kind":"effect","payload":{"frame_id":"f4","module_id":"std:marqdo-stdlib@0.2.0#db905508dde89763b9d43b47fc5d52c6a1d5445a91f3c86a550ced43e8aac9d7::io/stream.mq.md","operation":"resource.close","result_code":"ok","span":{"end":1666,"start":1647}},"run_id":"9-1795713570566476436","schema":"marqdo.observation","schema_version":1,"seq":152}
|
||||||
|
{"kind":"variable.assigned","payload":{"frame_id":"f4","module_id":"std:marqdo-stdlib@0.2.0#db905508dde89763b9d43b47fc5d52c6a1d5445a91f3c86a550ced43e8aac9d7::io/stream.mq.md","name":"关闭","span":{"end":1668,"start":1636},"value_state":"not_requested","value_type":"Map"},"run_id":"9-1795713570566476436","schema":"marqdo.observation","schema_version":1,"seq":153}
|
||||||
|
{"kind":"branch.eval","payload":{"frame_id":"f4","module_id":"std:marqdo-stdlib@0.2.0#db905508dde89763b9d43b47fc5d52c6a1d5445a91f3c86a550ced43e8aac9d7::io/stream.mq.md","result":false,"span":{"end":1691,"start":1670}},"run_id":"9-1795713570566476436","schema":"marqdo.observation","schema_version":1,"seq":154}
|
||||||
|
{"kind":"branch.eval","payload":{"frame_id":"f4","module_id":"std:marqdo-stdlib@0.2.0#db905508dde89763b9d43b47fc5d52c6a1d5445a91f3c86a550ced43e8aac9d7::io/stream.mq.md","result":true,"span":{"end":1719,"start":1713}},"run_id":"9-1795713570566476436","schema":"marqdo.observation","schema_version":1,"seq":155}
|
||||||
|
{"kind":"branch.eval","payload":{"frame_id":"f4","module_id":"std:marqdo-stdlib@0.2.0#db905508dde89763b9d43b47fc5d52c6a1d5445a91f3c86a550ced43e8aac9d7::io/stream.mq.md","result":false,"span":{"end":1738,"start":1720}},"run_id":"9-1795713570566476436","schema":"marqdo.observation","schema_version":1,"seq":156}
|
||||||
|
{"kind":"branch.eval","payload":{"frame_id":"f4","module_id":"std:marqdo-stdlib@0.2.0#db905508dde89763b9d43b47fc5d52c6a1d5445a91f3c86a550ced43e8aac9d7::io/stream.mq.md","result":true,"span":{"end":1763,"start":1757}},"run_id":"9-1795713570566476436","schema":"marqdo.observation","schema_version":1,"seq":157}
|
||||||
|
{"kind":"branch.eval","payload":{"frame_id":"f4","module_id":"std:marqdo-stdlib@0.2.0#db905508dde89763b9d43b47fc5d52c6a1d5445a91f3c86a550ced43e8aac9d7::io/stream.mq.md","result":true,"span":{"end":1773,"start":1764}},"run_id":"9-1795713570566476436","schema":"marqdo.observation","schema_version":1,"seq":158}
|
||||||
|
{"kind":"return","payload":{"frame_id":"f4","module_id":"std:marqdo-stdlib@0.2.0#db905508dde89763b9d43b47fc5d52c6a1d5445a91f3c86a550ced43e8aac9d7::io/stream.mq.md","span":{"end":1818,"start":1775},"value_type":"Map"},"run_id":"9-1795713570566476436","schema":"marqdo.observation","schema_version":1,"seq":159}
|
||||||
|
{"kind":"call.exit","payload":{"frame_id":"f4","module_id":"std:marqdo-stdlib@0.2.0#db905508dde89763b9d43b47fc5d52c6a1d5445a91f3c86a550ced43e8aac9d7::io.mq.md","span":{"end":430,"start":387},"status":"return"},"run_id":"9-1795713570566476436","schema":"marqdo.observation","schema_version":1,"seq":160}
|
||||||
|
{"kind":"return","payload":{"frame_id":"f2","module_id":"std:marqdo-stdlib@0.2.0#db905508dde89763b9d43b47fc5d52c6a1d5445a91f3c86a550ced43e8aac9d7::io.mq.md","span":{"end":431,"start":379},"value_type":"Map"},"run_id":"9-1795713570566476436","schema":"marqdo.observation","schema_version":1,"seq":161}
|
||||||
|
{"kind":"call.exit","payload":{"frame_id":"f2","module_id":"root:default::basic.mq.md","span":{"end":72,"start":57},"status":"return"},"run_id":"9-1795713570566476436","schema":"marqdo.observation","schema_version":1,"seq":162}
|
||||||
|
{"kind":"variable.assigned","payload":{"frame_id":"f1","module_id":"root:default::basic.mq.md","name":"n","span":{"end":83,"start":75},"value_state":"not_requested","value_type":"Int"},"run_id":"9-1795713570566476436","schema":"marqdo.observation","schema_version":1,"seq":163}
|
||||||
|
{"kind":"call.enter","payload":{"frame_id":"f10","function_id":"std:marqdo-stdlib@0.2.0#db905508dde89763b9d43b47fc5d52c6a1d5445a91f3c86a550ced43e8aac9d7::io.mq.md::io.写值","module_id":"root:default::basic.mq.md","parent_frame_id":"f1","span":{"end":100,"start":86}},"run_id":"9-1795713570566476436","schema":"marqdo.observation","schema_version":1,"seq":164}
|
||||||
|
{"kind":"parameter.observed","payload":{"frame_id":"f10","module_id":"std:marqdo-stdlib@0.2.0#db905508dde89763b9d43b47fc5d52c6a1d5445a91f3c86a550ced43e8aac9d7::io.mq.md","name":"值","source":"provided","span":{"end":315,"start":312},"value_state":"not_requested","value_type":"Text"},"run_id":"9-1795713570566476436","schema":"marqdo.observation","schema_version":1,"seq":165}
|
||||||
|
{"kind":"call.enter","payload":{"frame_id":"f11","function_id":"std:marqdo-stdlib@0.2.0#db905508dde89763b9d43b47fc5d52c6a1d5445a91f3c86a550ced43e8aac9d7::format.mq.md::format.显示","module_id":"std:marqdo-stdlib@0.2.0#db905508dde89763b9d43b47fc5d52c6a1d5445a91f3c86a550ced43e8aac9d7::io.mq.md","parent_frame_id":"f10","span":{"end":422,"start":404}},"run_id":"9-1795713570566476436","schema":"marqdo.observation","schema_version":1,"seq":166}
|
||||||
|
{"kind":"parameter.observed","payload":{"frame_id":"f11","module_id":"std:marqdo-stdlib@0.2.0#db905508dde89763b9d43b47fc5d52c6a1d5445a91f3c86a550ced43e8aac9d7::format.mq.md","name":"值","source":"provided","span":{"end":489,"start":486},"value_state":"not_requested","value_type":"Text"},"run_id":"9-1795713570566476436","schema":"marqdo.observation","schema_version":1,"seq":167}
|
||||||
|
{"kind":"variable.assigned","payload":{"frame_id":"f11","module_id":"std:marqdo-stdlib@0.2.0#db905508dde89763b9d43b47fc5d52c6a1d5445a91f3c86a550ced43e8aac9d7::format.mq.md","name":"类别","span":{"end":701,"start":677},"value_state":"not_requested","value_type":"Text"},"run_id":"9-1795713570566476436","schema":"marqdo.observation","schema_version":1,"seq":168}
|
||||||
|
{"kind":"branch.eval","payload":{"frame_id":"f11","module_id":"std:marqdo-stdlib@0.2.0#db905508dde89763b9d43b47fc5d52c6a1d5445a91f3c86a550ced43e8aac9d7::format.mq.md","result":false,"span":{"end":724,"start":703}},"run_id":"9-1795713570566476436","schema":"marqdo.observation","schema_version":1,"seq":169}
|
||||||
|
{"kind":"branch.eval","payload":{"frame_id":"f11","module_id":"std:marqdo-stdlib@0.2.0#db905508dde89763b9d43b47fc5d52c6a1d5445a91f3c86a550ced43e8aac9d7::format.mq.md","result":true,"span":{"end":749,"start":743}},"run_id":"9-1795713570566476436","schema":"marqdo.observation","schema_version":1,"seq":170}
|
||||||
|
{"kind":"branch.eval","payload":{"frame_id":"f11","module_id":"std:marqdo-stdlib@0.2.0#db905508dde89763b9d43b47fc5d52c6a1d5445a91f3c86a550ced43e8aac9d7::format.mq.md","result":false,"span":{"end":771,"start":750}},"run_id":"9-1795713570566476436","schema":"marqdo.observation","schema_version":1,"seq":171}
|
||||||
|
{"kind":"branch.eval","payload":{"frame_id":"f11","module_id":"std:marqdo-stdlib@0.2.0#db905508dde89763b9d43b47fc5d52c6a1d5445a91f3c86a550ced43e8aac9d7::format.mq.md","result":true,"span":{"end":796,"start":790}},"run_id":"9-1795713570566476436","schema":"marqdo.observation","schema_version":1,"seq":172}
|
||||||
|
{"kind":"branch.eval","payload":{"frame_id":"f11","module_id":"std:marqdo-stdlib@0.2.0#db905508dde89763b9d43b47fc5d52c6a1d5445a91f3c86a550ced43e8aac9d7::format.mq.md","result":true,"span":{"end":818,"start":797}},"run_id":"9-1795713570566476436","schema":"marqdo.observation","schema_version":1,"seq":173}
|
||||||
|
{"kind":"return","payload":{"frame_id":"f11","module_id":"std:marqdo-stdlib@0.2.0#db905508dde89763b9d43b47fc5d52c6a1d5445a91f3c86a550ced43e8aac9d7::format.mq.md","span":{"end":832,"start":820},"value_type":"Text"},"run_id":"9-1795713570566476436","schema":"marqdo.observation","schema_version":1,"seq":174}
|
||||||
|
{"kind":"call.exit","payload":{"frame_id":"f11","module_id":"std:marqdo-stdlib@0.2.0#db905508dde89763b9d43b47fc5d52c6a1d5445a91f3c86a550ced43e8aac9d7::io.mq.md","span":{"end":422,"start":404},"status":"return"},"run_id":"9-1795713570566476436","schema":"marqdo.observation","schema_version":1,"seq":175}
|
||||||
|
{"kind":"call.enter","payload":{"frame_id":"f12","function_id":"std:marqdo-stdlib@0.2.0#db905508dde89763b9d43b47fc5d52c6a1d5445a91f3c86a550ced43e8aac9d7::io/stream.mq.md::stream.写文本","module_id":"std:marqdo-stdlib@0.2.0#db905508dde89763b9d43b47fc5d52c6a1d5445a91f3c86a550ced43e8aac9d7::io.mq.md","parent_frame_id":"f10","span":{"end":430,"start":387}},"run_id":"9-1795713570566476436","schema":"marqdo.observation","schema_version":1,"seq":176}
|
||||||
|
{"kind":"parameter.observed","payload":{"frame_id":"f12","module_id":"std:marqdo-stdlib@0.2.0#db905508dde89763b9d43b47fc5d52c6a1d5445a91f3c86a550ced43e8aac9d7::io/stream.mq.md","name":"文本","source":"provided","span":{"end":1178,"start":1172},"value_state":"not_requested","value_type":"Text"},"run_id":"9-1795713570566476436","schema":"marqdo.observation","schema_version":1,"seq":177}
|
||||||
|
{"kind":"call.enter","payload":{"frame_id":"f13","function_id":"std:marqdo-stdlib@0.2.0#db905508dde89763b9d43b47fc5d52c6a1d5445a91f3c86a550ced43e8aac9d7::format.mq.md::format.字节长度","module_id":"std:marqdo-stdlib@0.2.0#db905508dde89763b9d43b47fc5d52c6a1d5445a91f3c86a550ced43e8aac9d7::io/stream.mq.md","parent_frame_id":"f12","span":{"end":1418,"start":1391}},"run_id":"9-1795713570566476436","schema":"marqdo.observation","schema_version":1,"seq":178}
|
||||||
|
{"kind":"parameter.observed","payload":{"frame_id":"f13","module_id":"std:marqdo-stdlib@0.2.0#db905508dde89763b9d43b47fc5d52c6a1d5445a91f3c86a550ced43e8aac9d7::format.mq.md","name":"文本","source":"provided","span":{"end":46,"start":40},"value_state":"not_requested","value_type":"Text"},"run_id":"9-1795713570566476436","schema":"marqdo.observation","schema_version":1,"seq":179}
|
||||||
|
{"kind":"variable.assigned","payload":{"frame_id":"f13","module_id":"std:marqdo-stdlib@0.2.0#db905508dde89763b9d43b47fc5d52c6a1d5445a91f3c86a550ced43e8aac9d7::format.mq.md","name":"点","span":{"end":84,"start":51},"value_state":"not_requested","value_type":"List"},"run_id":"9-1795713570566476436","schema":"marqdo.observation","schema_version":1,"seq":180}
|
||||||
|
{"kind":"variable.assigned","payload":{"frame_id":"f13","module_id":"std:marqdo-stdlib@0.2.0#db905508dde89763b9d43b47fc5d52c6a1d5445a91f3c86a550ced43e8aac9d7::format.mq.md","name":"总字节","span":{"end":103,"start":86},"value_state":"not_requested","value_type":"Int"},"run_id":"9-1795713570566476436","schema":"marqdo.observation","schema_version":1,"seq":181}
|
||||||
|
{"kind":"variable.assigned","payload":{"frame_id":"f13","module_id":"std:marqdo-stdlib@0.2.0#db905508dde89763b9d43b47fc5d52c6a1d5445a91f3c86a550ced43e8aac9d7::format.mq.md","name":"下标","span":{"end":119,"start":105},"value_state":"not_requested","value_type":"Int"},"run_id":"9-1795713570566476436","schema":"marqdo.observation","schema_version":1,"seq":182}
|
||||||
|
{"kind":"loop.iteration","payload":{"decision":"continue","frame_id":"f13","module_id":"std:marqdo-stdlib@0.2.0#db905508dde89763b9d43b47fc5d52c6a1d5445a91f3c86a550ced43e8aac9d7::format.mq.md","span":{"end":149,"start":121}},"run_id":"9-1795713570566476436","schema":"marqdo.observation","schema_version":1,"seq":183}
|
||||||
|
{"kind":"variable.assigned","payload":{"frame_id":"f13","module_id":"std:marqdo-stdlib@0.2.0#db905508dde89763b9d43b47fc5d52c6a1d5445a91f3c86a550ced43e8aac9d7::format.mq.md","name":"码点","span":{"end":175,"start":151},"value_state":"not_requested","value_type":"Int"},"run_id":"9-1795713570566476436","schema":"marqdo.observation","schema_version":1,"seq":184}
|
||||||
|
{"kind":"branch.eval","payload":{"frame_id":"f13","module_id":"std:marqdo-stdlib@0.2.0#db905508dde89763b9d43b47fc5d52c6a1d5445a91f3c86a550ced43e8aac9d7::format.mq.md","result":true,"span":{"end":194,"start":177}},"run_id":"9-1795713570566476436","schema":"marqdo.observation","schema_version":1,"seq":185}
|
||||||
|
{"kind":"variable.assigned","payload":{"frame_id":"f13","module_id":"std:marqdo-stdlib@0.2.0#db905508dde89763b9d43b47fc5d52c6a1d5445a91f3c86a550ced43e8aac9d7::format.mq.md","name":"总字节","span":{"end":225,"start":196},"value_state":"not_requested","value_type":"Int"},"run_id":"9-1795713570566476436","schema":"marqdo.observation","schema_version":1,"seq":186}
|
||||||
|
{"kind":"variable.assigned","payload":{"frame_id":"f13","module_id":"std:marqdo-stdlib@0.2.0#db905508dde89763b9d43b47fc5d52c6a1d5445a91f3c86a550ced43e8aac9d7::format.mq.md","name":"下标","span":{"end":440,"start":417},"value_state":"not_requested","value_type":"Int"},"run_id":"9-1795713570566476436","schema":"marqdo.observation","schema_version":1,"seq":187}
|
||||||
|
{"kind":"loop.iteration","payload":{"decision":"continue","frame_id":"f13","module_id":"std:marqdo-stdlib@0.2.0#db905508dde89763b9d43b47fc5d52c6a1d5445a91f3c86a550ced43e8aac9d7::format.mq.md","span":{"end":149,"start":121}},"run_id":"9-1795713570566476436","schema":"marqdo.observation","schema_version":1,"seq":188}
|
||||||
|
{"kind":"variable.assigned","payload":{"frame_id":"f13","module_id":"std:marqdo-stdlib@0.2.0#db905508dde89763b9d43b47fc5d52c6a1d5445a91f3c86a550ced43e8aac9d7::format.mq.md","name":"码点","span":{"end":175,"start":151},"value_state":"not_requested","value_type":"Int"},"run_id":"9-1795713570566476436","schema":"marqdo.observation","schema_version":1,"seq":189}
|
||||||
|
{"kind":"branch.eval","payload":{"frame_id":"f13","module_id":"std:marqdo-stdlib@0.2.0#db905508dde89763b9d43b47fc5d52c6a1d5445a91f3c86a550ced43e8aac9d7::format.mq.md","result":true,"span":{"end":194,"start":177}},"run_id":"9-1795713570566476436","schema":"marqdo.observation","schema_version":1,"seq":190}
|
||||||
|
{"kind":"variable.assigned","payload":{"frame_id":"f13","module_id":"std:marqdo-stdlib@0.2.0#db905508dde89763b9d43b47fc5d52c6a1d5445a91f3c86a550ced43e8aac9d7::format.mq.md","name":"总字节","span":{"end":225,"start":196},"value_state":"not_requested","value_type":"Int"},"run_id":"9-1795713570566476436","schema":"marqdo.observation","schema_version":1,"seq":191}
|
||||||
|
{"kind":"variable.assigned","payload":{"frame_id":"f13","module_id":"std:marqdo-stdlib@0.2.0#db905508dde89763b9d43b47fc5d52c6a1d5445a91f3c86a550ced43e8aac9d7::format.mq.md","name":"下标","span":{"end":440,"start":417},"value_state":"not_requested","value_type":"Int"},"run_id":"9-1795713570566476436","schema":"marqdo.observation","schema_version":1,"seq":192}
|
||||||
|
{"kind":"loop.iteration","payload":{"decision":"continue","frame_id":"f13","module_id":"std:marqdo-stdlib@0.2.0#db905508dde89763b9d43b47fc5d52c6a1d5445a91f3c86a550ced43e8aac9d7::format.mq.md","span":{"end":149,"start":121}},"run_id":"9-1795713570566476436","schema":"marqdo.observation","schema_version":1,"seq":193}
|
||||||
|
{"kind":"variable.assigned","payload":{"frame_id":"f13","module_id":"std:marqdo-stdlib@0.2.0#db905508dde89763b9d43b47fc5d52c6a1d5445a91f3c86a550ced43e8aac9d7::format.mq.md","name":"码点","span":{"end":175,"start":151},"value_state":"not_requested","value_type":"Int"},"run_id":"9-1795713570566476436","schema":"marqdo.observation","schema_version":1,"seq":194}
|
||||||
|
{"kind":"branch.eval","payload":{"frame_id":"f13","module_id":"std:marqdo-stdlib@0.2.0#db905508dde89763b9d43b47fc5d52c6a1d5445a91f3c86a550ced43e8aac9d7::format.mq.md","result":true,"span":{"end":194,"start":177}},"run_id":"9-1795713570566476436","schema":"marqdo.observation","schema_version":1,"seq":195}
|
||||||
|
{"kind":"variable.assigned","payload":{"frame_id":"f13","module_id":"std:marqdo-stdlib@0.2.0#db905508dde89763b9d43b47fc5d52c6a1d5445a91f3c86a550ced43e8aac9d7::format.mq.md","name":"总字节","span":{"end":225,"start":196},"value_state":"not_requested","value_type":"Int"},"run_id":"9-1795713570566476436","schema":"marqdo.observation","schema_version":1,"seq":196}
|
||||||
|
{"kind":"variable.assigned","payload":{"frame_id":"f13","module_id":"std:marqdo-stdlib@0.2.0#db905508dde89763b9d43b47fc5d52c6a1d5445a91f3c86a550ced43e8aac9d7::format.mq.md","name":"下标","span":{"end":440,"start":417},"value_state":"not_requested","value_type":"Int"},"run_id":"9-1795713570566476436","schema":"marqdo.observation","schema_version":1,"seq":197}
|
||||||
|
{"kind":"loop.iteration","payload":{"decision":"continue","frame_id":"f13","module_id":"std:marqdo-stdlib@0.2.0#db905508dde89763b9d43b47fc5d52c6a1d5445a91f3c86a550ced43e8aac9d7::format.mq.md","span":{"end":149,"start":121}},"run_id":"9-1795713570566476436","schema":"marqdo.observation","schema_version":1,"seq":198}
|
||||||
|
{"kind":"variable.assigned","payload":{"frame_id":"f13","module_id":"std:marqdo-stdlib@0.2.0#db905508dde89763b9d43b47fc5d52c6a1d5445a91f3c86a550ced43e8aac9d7::format.mq.md","name":"码点","span":{"end":175,"start":151},"value_state":"not_requested","value_type":"Int"},"run_id":"9-1795713570566476436","schema":"marqdo.observation","schema_version":1,"seq":199}
|
||||||
|
{"kind":"branch.eval","payload":{"frame_id":"f13","module_id":"std:marqdo-stdlib@0.2.0#db905508dde89763b9d43b47fc5d52c6a1d5445a91f3c86a550ced43e8aac9d7::format.mq.md","result":true,"span":{"end":194,"start":177}},"run_id":"9-1795713570566476436","schema":"marqdo.observation","schema_version":1,"seq":200}
|
||||||
|
{"kind":"variable.assigned","payload":{"frame_id":"f13","module_id":"std:marqdo-stdlib@0.2.0#db905508dde89763b9d43b47fc5d52c6a1d5445a91f3c86a550ced43e8aac9d7::format.mq.md","name":"总字节","span":{"end":225,"start":196},"value_state":"not_requested","value_type":"Int"},"run_id":"9-1795713570566476436","schema":"marqdo.observation","schema_version":1,"seq":201}
|
||||||
|
{"kind":"variable.assigned","payload":{"frame_id":"f13","module_id":"std:marqdo-stdlib@0.2.0#db905508dde89763b9d43b47fc5d52c6a1d5445a91f3c86a550ced43e8aac9d7::format.mq.md","name":"下标","span":{"end":440,"start":417},"value_state":"not_requested","value_type":"Int"},"run_id":"9-1795713570566476436","schema":"marqdo.observation","schema_version":1,"seq":202}
|
||||||
|
{"kind":"loop.iteration","payload":{"decision":"continue","frame_id":"f13","module_id":"std:marqdo-stdlib@0.2.0#db905508dde89763b9d43b47fc5d52c6a1d5445a91f3c86a550ced43e8aac9d7::format.mq.md","span":{"end":149,"start":121}},"run_id":"9-1795713570566476436","schema":"marqdo.observation","schema_version":1,"seq":203}
|
||||||
|
{"kind":"variable.assigned","payload":{"frame_id":"f13","module_id":"std:marqdo-stdlib@0.2.0#db905508dde89763b9d43b47fc5d52c6a1d5445a91f3c86a550ced43e8aac9d7::format.mq.md","name":"码点","span":{"end":175,"start":151},"value_state":"not_requested","value_type":"Int"},"run_id":"9-1795713570566476436","schema":"marqdo.observation","schema_version":1,"seq":204}
|
||||||
|
{"kind":"branch.eval","payload":{"frame_id":"f13","module_id":"std:marqdo-stdlib@0.2.0#db905508dde89763b9d43b47fc5d52c6a1d5445a91f3c86a550ced43e8aac9d7::format.mq.md","result":true,"span":{"end":194,"start":177}},"run_id":"9-1795713570566476436","schema":"marqdo.observation","schema_version":1,"seq":205}
|
||||||
|
{"kind":"variable.assigned","payload":{"frame_id":"f13","module_id":"std:marqdo-stdlib@0.2.0#db905508dde89763b9d43b47fc5d52c6a1d5445a91f3c86a550ced43e8aac9d7::format.mq.md","name":"总字节","span":{"end":225,"start":196},"value_state":"not_requested","value_type":"Int"},"run_id":"9-1795713570566476436","schema":"marqdo.observation","schema_version":1,"seq":206}
|
||||||
|
{"kind":"variable.assigned","payload":{"frame_id":"f13","module_id":"std:marqdo-stdlib@0.2.0#db905508dde89763b9d43b47fc5d52c6a1d5445a91f3c86a550ced43e8aac9d7::format.mq.md","name":"下标","span":{"end":440,"start":417},"value_state":"not_requested","value_type":"Int"},"run_id":"9-1795713570566476436","schema":"marqdo.observation","schema_version":1,"seq":207}
|
||||||
|
{"kind":"loop.iteration","payload":{"decision":"exit","frame_id":"f13","module_id":"std:marqdo-stdlib@0.2.0#db905508dde89763b9d43b47fc5d52c6a1d5445a91f3c86a550ced43e8aac9d7::format.mq.md","span":{"end":149,"start":121}},"run_id":"9-1795713570566476436","schema":"marqdo.observation","schema_version":1,"seq":208}
|
||||||
|
{"kind":"return","payload":{"frame_id":"f13","module_id":"std:marqdo-stdlib@0.2.0#db905508dde89763b9d43b47fc5d52c6a1d5445a91f3c86a550ced43e8aac9d7::format.mq.md","span":{"end":466,"start":448},"value_type":"Int"},"run_id":"9-1795713570566476436","schema":"marqdo.observation","schema_version":1,"seq":209}
|
||||||
|
{"kind":"call.exit","payload":{"frame_id":"f13","module_id":"std:marqdo-stdlib@0.2.0#db905508dde89763b9d43b47fc5d52c6a1d5445a91f3c86a550ced43e8aac9d7::io/stream.mq.md","span":{"end":1418,"start":1391},"status":"return"},"run_id":"9-1795713570566476436","schema":"marqdo.observation","schema_version":1,"seq":210}
|
||||||
|
{"kind":"variable.assigned","payload":{"frame_id":"f12","module_id":"std:marqdo-stdlib@0.2.0#db905508dde89763b9d43b47fc5d52c6a1d5445a91f3c86a550ced43e8aac9d7::io/stream.mq.md","name":"字节数","span":{"end":1420,"start":1377},"value_state":"not_requested","value_type":"Int"},"run_id":"9-1795713570566476436","schema":"marqdo.observation","schema_version":1,"seq":211}
|
||||||
|
{"kind":"call.enter","payload":{"frame_id":"f14","function_id":"std:marqdo-stdlib@0.2.0#db905508dde89763b9d43b47fc5d52c6a1d5445a91f3c86a550ced43e8aac9d7::io/stream.mq.md::stream.页数","module_id":"std:marqdo-stdlib@0.2.0#db905508dde89763b9d43b47fc5d52c6a1d5445a91f3c86a550ced43e8aac9d7::io/stream.mq.md","parent_frame_id":"f12","span":{"end":1461,"start":1444}},"run_id":"9-1795713570566476436","schema":"marqdo.observation","schema_version":1,"seq":212}
|
||||||
|
{"kind":"parameter.observed","payload":{"frame_id":"f14","module_id":"std:marqdo-stdlib@0.2.0#db905508dde89763b9d43b47fc5d52c6a1d5445a91f3c86a550ced43e8aac9d7::io/stream.mq.md","name":"字节","source":"provided","span":{"end":114,"start":108},"value_state":"not_requested","value_type":"Int"},"run_id":"9-1795713570566476436","schema":"marqdo.observation","schema_version":1,"seq":213}
|
||||||
|
{"kind":"variable.assigned","payload":{"frame_id":"f14","module_id":"std:marqdo-stdlib@0.2.0#db905508dde89763b9d43b47fc5d52c6a1d5445a91f3c86a550ced43e8aac9d7::io/stream.mq.md","name":"页","span":{"end":154,"start":119},"value_state":"not_requested","value_type":"Int"},"run_id":"9-1795713570566476436","schema":"marqdo.observation","schema_version":1,"seq":214}
|
||||||
|
{"kind":"branch.eval","payload":{"frame_id":"f14","module_id":"std:marqdo-stdlib@0.2.0#db905508dde89763b9d43b47fc5d52c6a1d5445a91f3c86a550ced43e8aac9d7::io/stream.mq.md","result":false,"span":{"end":169,"start":156}},"run_id":"9-1795713570566476436","schema":"marqdo.observation","schema_version":1,"seq":215}
|
||||||
|
{"kind":"branch.eval","payload":{"frame_id":"f14","module_id":"std:marqdo-stdlib@0.2.0#db905508dde89763b9d43b47fc5d52c6a1d5445a91f3c86a550ced43e8aac9d7::io/stream.mq.md","result":true,"span":{"end":189,"start":183}},"run_id":"9-1795713570566476436","schema":"marqdo.observation","schema_version":1,"seq":216}
|
||||||
|
{"kind":"branch.eval","payload":{"frame_id":"f14","module_id":"std:marqdo-stdlib@0.2.0#db905508dde89763b9d43b47fc5d52c6a1d5445a91f3c86a550ced43e8aac9d7::io/stream.mq.md","result":true,"span":{"end":199,"start":190}},"run_id":"9-1795713570566476436","schema":"marqdo.observation","schema_version":1,"seq":217}
|
||||||
|
{"kind":"return","payload":{"frame_id":"f14","module_id":"std:marqdo-stdlib@0.2.0#db905508dde89763b9d43b47fc5d52c6a1d5445a91f3c86a550ced43e8aac9d7::io/stream.mq.md","span":{"end":213,"start":201},"value_type":"Int"},"run_id":"9-1795713570566476436","schema":"marqdo.observation","schema_version":1,"seq":218}
|
||||||
|
{"kind":"call.exit","payload":{"frame_id":"f14","module_id":"std:marqdo-stdlib@0.2.0#db905508dde89763b9d43b47fc5d52c6a1d5445a91f3c86a550ced43e8aac9d7::io/stream.mq.md","span":{"end":1461,"start":1444},"status":"return"},"run_id":"9-1795713570566476436","schema":"marqdo.observation","schema_version":1,"seq":219}
|
||||||
|
{"kind":"call.enter","payload":{"frame_id":"f15","function_id":"std:marqdo-stdlib@0.2.0#db905508dde89763b9d43b47fc5d52c6a1d5445a91f3c86a550ced43e8aac9d7::io/stream.mq.md::stream.页数","module_id":"std:marqdo-stdlib@0.2.0#db905508dde89763b9d43b47fc5d52c6a1d5445a91f3c86a550ced43e8aac9d7::io/stream.mq.md","parent_frame_id":"f12","span":{"end":1480,"start":1463}},"run_id":"9-1795713570566476436","schema":"marqdo.observation","schema_version":1,"seq":220}
|
||||||
|
{"kind":"parameter.observed","payload":{"frame_id":"f15","module_id":"std:marqdo-stdlib@0.2.0#db905508dde89763b9d43b47fc5d52c6a1d5445a91f3c86a550ced43e8aac9d7::io/stream.mq.md","name":"字节","source":"provided","span":{"end":114,"start":108},"value_state":"not_requested","value_type":"Int"},"run_id":"9-1795713570566476436","schema":"marqdo.observation","schema_version":1,"seq":221}
|
||||||
|
{"kind":"variable.assigned","payload":{"frame_id":"f15","module_id":"std:marqdo-stdlib@0.2.0#db905508dde89763b9d43b47fc5d52c6a1d5445a91f3c86a550ced43e8aac9d7::io/stream.mq.md","name":"页","span":{"end":154,"start":119},"value_state":"not_requested","value_type":"Int"},"run_id":"9-1795713570566476436","schema":"marqdo.observation","schema_version":1,"seq":222}
|
||||||
|
{"kind":"branch.eval","payload":{"frame_id":"f15","module_id":"std:marqdo-stdlib@0.2.0#db905508dde89763b9d43b47fc5d52c6a1d5445a91f3c86a550ced43e8aac9d7::io/stream.mq.md","result":false,"span":{"end":169,"start":156}},"run_id":"9-1795713570566476436","schema":"marqdo.observation","schema_version":1,"seq":223}
|
||||||
|
{"kind":"branch.eval","payload":{"frame_id":"f15","module_id":"std:marqdo-stdlib@0.2.0#db905508dde89763b9d43b47fc5d52c6a1d5445a91f3c86a550ced43e8aac9d7::io/stream.mq.md","result":true,"span":{"end":189,"start":183}},"run_id":"9-1795713570566476436","schema":"marqdo.observation","schema_version":1,"seq":224}
|
||||||
|
{"kind":"branch.eval","payload":{"frame_id":"f15","module_id":"std:marqdo-stdlib@0.2.0#db905508dde89763b9d43b47fc5d52c6a1d5445a91f3c86a550ced43e8aac9d7::io/stream.mq.md","result":true,"span":{"end":199,"start":190}},"run_id":"9-1795713570566476436","schema":"marqdo.observation","schema_version":1,"seq":225}
|
||||||
|
{"kind":"return","payload":{"frame_id":"f15","module_id":"std:marqdo-stdlib@0.2.0#db905508dde89763b9d43b47fc5d52c6a1d5445a91f3c86a550ced43e8aac9d7::io/stream.mq.md","span":{"end":213,"start":201},"value_type":"Int"},"run_id":"9-1795713570566476436","schema":"marqdo.observation","schema_version":1,"seq":226}
|
||||||
|
{"kind":"call.exit","payload":{"frame_id":"f15","module_id":"std:marqdo-stdlib@0.2.0#db905508dde89763b9d43b47fc5d52c6a1d5445a91f3c86a550ced43e8aac9d7::io/stream.mq.md","span":{"end":1480,"start":1463},"status":"return"},"run_id":"9-1795713570566476436","schema":"marqdo.observation","schema_version":1,"seq":227}
|
||||||
|
{"kind":"effect","payload":{"frame_id":"f12","module_id":"std:marqdo-stdlib@0.2.0#db905508dde89763b9d43b47fc5d52c6a1d5445a91f3c86a550ced43e8aac9d7::io/stream.mq.md","operation":"memory.new","result_code":"ok","span":{"end":1481,"start":1433}},"run_id":"9-1795713570566476436","schema":"marqdo.observation","schema_version":1,"seq":228}
|
||||||
|
{"kind":"variable.assigned","payload":{"frame_id":"f12","module_id":"std:marqdo-stdlib@0.2.0#db905508dde89763b9d43b47fc5d52c6a1d5445a91f3c86a550ced43e8aac9d7::io/stream.mq.md","name":"内存","span":{"end":1483,"start":1422},"value_state":"not_requested","value_type":"Memory"},"run_id":"9-1795713570566476436","schema":"marqdo.observation","schema_version":1,"seq":229}
|
||||||
|
{"kind":"call.enter","payload":{"frame_id":"f16","function_id":"std:marqdo-stdlib@0.2.0#db905508dde89763b9d43b47fc5d52c6a1d5445a91f3c86a550ced43e8aac9d7::text/utf8.mq.md::utf8.编码","module_id":"std:marqdo-stdlib@0.2.0#db905508dde89763b9d43b47fc5d52c6a1d5445a91f3c86a550ced43e8aac9d7::io/stream.mq.md","parent_frame_id":"f12","span":{"end":1526,"start":1496}},"run_id":"9-1795713570566476436","schema":"marqdo.observation","schema_version":1,"seq":230}
|
||||||
|
{"kind":"parameter.observed","payload":{"frame_id":"f16","module_id":"std:marqdo-stdlib@0.2.0#db905508dde89763b9d43b47fc5d52c6a1d5445a91f3c86a550ced43e8aac9d7::text/utf8.mq.md","name":"文本","source":"provided","span":{"end":260,"start":254},"value_state":"not_requested","value_type":"Text"},"run_id":"9-1795713570566476436","schema":"marqdo.observation","schema_version":1,"seq":231}
|
||||||
|
{"kind":"parameter.observed","payload":{"frame_id":"f16","module_id":"std:marqdo-stdlib@0.2.0#db905508dde89763b9d43b47fc5d52c6a1d5445a91f3c86a550ced43e8aac9d7::text/utf8.mq.md","name":"内存","source":"provided","span":{"end":268,"start":261},"value_state":"not_requested","value_type":"Memory"},"run_id":"9-1795713570566476436","schema":"marqdo.observation","schema_version":1,"seq":232}
|
||||||
|
{"kind":"parameter.observed","payload":{"frame_id":"f16","module_id":"std:marqdo-stdlib@0.2.0#db905508dde89763b9d43b47fc5d52c6a1d5445a91f3c86a550ced43e8aac9d7::text/utf8.mq.md","name":"基址","source":"provided","span":{"end":276,"start":269},"value_state":"not_requested","value_type":"Int"},"run_id":"9-1795713570566476436","schema":"marqdo.observation","schema_version":1,"seq":233}
|
||||||
|
{"kind":"variable.assigned","payload":{"frame_id":"f16","module_id":"std:marqdo-stdlib@0.2.0#db905508dde89763b9d43b47fc5d52c6a1d5445a91f3c86a550ced43e8aac9d7::text/utf8.mq.md","name":"点","span":{"end":466,"start":433},"value_state":"not_requested","value_type":"List"},"run_id":"9-1795713570566476436","schema":"marqdo.observation","schema_version":1,"seq":234}
|
||||||
|
{"kind":"variable.assigned","payload":{"frame_id":"f16","module_id":"std:marqdo-stdlib@0.2.0#db905508dde89763b9d43b47fc5d52c6a1d5445a91f3c86a550ced43e8aac9d7::text/utf8.mq.md","name":"下标","span":{"end":482,"start":468},"value_state":"not_requested","value_type":"Int"},"run_id":"9-1795713570566476436","schema":"marqdo.observation","schema_version":1,"seq":235}
|
||||||
|
{"kind":"variable.assigned","payload":{"frame_id":"f16","module_id":"std:marqdo-stdlib@0.2.0#db905508dde89763b9d43b47fc5d52c6a1d5445a91f3c86a550ced43e8aac9d7::text/utf8.mq.md","name":"偏移","span":{"end":498,"start":484},"value_state":"not_requested","value_type":"Int"},"run_id":"9-1795713570566476436","schema":"marqdo.observation","schema_version":1,"seq":236}
|
||||||
|
{"kind":"loop.iteration","payload":{"decision":"continue","frame_id":"f16","module_id":"std:marqdo-stdlib@0.2.0#db905508dde89763b9d43b47fc5d52c6a1d5445a91f3c86a550ced43e8aac9d7::text/utf8.mq.md","span":{"end":528,"start":500}},"run_id":"9-1795713570566476436","schema":"marqdo.observation","schema_version":1,"seq":237}
|
||||||
|
{"kind":"variable.assigned","payload":{"frame_id":"f16","module_id":"std:marqdo-stdlib@0.2.0#db905508dde89763b9d43b47fc5d52c6a1d5445a91f3c86a550ced43e8aac9d7::text/utf8.mq.md","name":"码点","span":{"end":554,"start":530},"value_state":"not_requested","value_type":"Int"},"run_id":"9-1795713570566476436","schema":"marqdo.observation","schema_version":1,"seq":238}
|
||||||
|
{"kind":"branch.eval","payload":{"frame_id":"f16","module_id":"std:marqdo-stdlib@0.2.0#db905508dde89763b9d43b47fc5d52c6a1d5445a91f3c86a550ced43e8aac9d7::text/utf8.mq.md","result":true,"span":{"end":573,"start":556}},"run_id":"9-1795713570566476436","schema":"marqdo.observation","schema_version":1,"seq":239}
|
||||||
|
{"kind":"effect","payload":{"frame_id":"f16","module_id":"std:marqdo-stdlib@0.2.0#db905508dde89763b9d43b47fc5d52c6a1d5445a91f3c86a550ced43e8aac9d7::text/utf8.mq.md","operation":"memory.write","result_code":"ok","span":{"end":601,"start":578}},"run_id":"9-1795713570566476436","schema":"marqdo.observation","schema_version":1,"seq":240}
|
||||||
|
{"kind":"variable.assigned","payload":{"frame_id":"f16","module_id":"std:marqdo-stdlib@0.2.0#db905508dde89763b9d43b47fc5d52c6a1d5445a91f3c86a550ced43e8aac9d7::text/utf8.mq.md","name":"偏移","span":{"end":638,"start":615},"value_state":"not_requested","value_type":"Int"},"run_id":"9-1795713570566476436","schema":"marqdo.observation","schema_version":1,"seq":241}
|
||||||
|
{"kind":"variable.assigned","payload":{"frame_id":"f16","module_id":"std:marqdo-stdlib@0.2.0#db905508dde89763b9d43b47fc5d52c6a1d5445a91f3c86a550ced43e8aac9d7::text/utf8.mq.md","name":"下标","span":{"end":1347,"start":1324},"value_state":"not_requested","value_type":"Int"},"run_id":"9-1795713570566476436","schema":"marqdo.observation","schema_version":1,"seq":242}
|
||||||
|
{"kind":"loop.iteration","payload":{"decision":"continue","frame_id":"f16","module_id":"std:marqdo-stdlib@0.2.0#db905508dde89763b9d43b47fc5d52c6a1d5445a91f3c86a550ced43e8aac9d7::text/utf8.mq.md","span":{"end":528,"start":500}},"run_id":"9-1795713570566476436","schema":"marqdo.observation","schema_version":1,"seq":243}
|
||||||
|
{"kind":"variable.assigned","payload":{"frame_id":"f16","module_id":"std:marqdo-stdlib@0.2.0#db905508dde89763b9d43b47fc5d52c6a1d5445a91f3c86a550ced43e8aac9d7::text/utf8.mq.md","name":"码点","span":{"end":554,"start":530},"value_state":"not_requested","value_type":"Int"},"run_id":"9-1795713570566476436","schema":"marqdo.observation","schema_version":1,"seq":244}
|
||||||
|
{"kind":"branch.eval","payload":{"frame_id":"f16","module_id":"std:marqdo-stdlib@0.2.0#db905508dde89763b9d43b47fc5d52c6a1d5445a91f3c86a550ced43e8aac9d7::text/utf8.mq.md","result":true,"span":{"end":573,"start":556}},"run_id":"9-1795713570566476436","schema":"marqdo.observation","schema_version":1,"seq":245}
|
||||||
|
{"kind":"effect","payload":{"frame_id":"f16","module_id":"std:marqdo-stdlib@0.2.0#db905508dde89763b9d43b47fc5d52c6a1d5445a91f3c86a550ced43e8aac9d7::text/utf8.mq.md","operation":"memory.write","result_code":"ok","span":{"end":601,"start":578}},"run_id":"9-1795713570566476436","schema":"marqdo.observation","schema_version":1,"seq":246}
|
||||||
|
{"kind":"variable.assigned","payload":{"frame_id":"f16","module_id":"std:marqdo-stdlib@0.2.0#db905508dde89763b9d43b47fc5d52c6a1d5445a91f3c86a550ced43e8aac9d7::text/utf8.mq.md","name":"偏移","span":{"end":638,"start":615},"value_state":"not_requested","value_type":"Int"},"run_id":"9-1795713570566476436","schema":"marqdo.observation","schema_version":1,"seq":247}
|
||||||
|
{"kind":"variable.assigned","payload":{"frame_id":"f16","module_id":"std:marqdo-stdlib@0.2.0#db905508dde89763b9d43b47fc5d52c6a1d5445a91f3c86a550ced43e8aac9d7::text/utf8.mq.md","name":"下标","span":{"end":1347,"start":1324},"value_state":"not_requested","value_type":"Int"},"run_id":"9-1795713570566476436","schema":"marqdo.observation","schema_version":1,"seq":248}
|
||||||
|
{"kind":"loop.iteration","payload":{"decision":"continue","frame_id":"f16","module_id":"std:marqdo-stdlib@0.2.0#db905508dde89763b9d43b47fc5d52c6a1d5445a91f3c86a550ced43e8aac9d7::text/utf8.mq.md","span":{"end":528,"start":500}},"run_id":"9-1795713570566476436","schema":"marqdo.observation","schema_version":1,"seq":249}
|
||||||
|
{"kind":"variable.assigned","payload":{"frame_id":"f16","module_id":"std:marqdo-stdlib@0.2.0#db905508dde89763b9d43b47fc5d52c6a1d5445a91f3c86a550ced43e8aac9d7::text/utf8.mq.md","name":"码点","span":{"end":554,"start":530},"value_state":"not_requested","value_type":"Int"},"run_id":"9-1795713570566476436","schema":"marqdo.observation","schema_version":1,"seq":250}
|
||||||
|
{"kind":"branch.eval","payload":{"frame_id":"f16","module_id":"std:marqdo-stdlib@0.2.0#db905508dde89763b9d43b47fc5d52c6a1d5445a91f3c86a550ced43e8aac9d7::text/utf8.mq.md","result":true,"span":{"end":573,"start":556}},"run_id":"9-1795713570566476436","schema":"marqdo.observation","schema_version":1,"seq":251}
|
||||||
|
{"kind":"effect","payload":{"frame_id":"f16","module_id":"std:marqdo-stdlib@0.2.0#db905508dde89763b9d43b47fc5d52c6a1d5445a91f3c86a550ced43e8aac9d7::text/utf8.mq.md","operation":"memory.write","result_code":"ok","span":{"end":601,"start":578}},"run_id":"9-1795713570566476436","schema":"marqdo.observation","schema_version":1,"seq":252}
|
||||||
|
{"kind":"variable.assigned","payload":{"frame_id":"f16","module_id":"std:marqdo-stdlib@0.2.0#db905508dde89763b9d43b47fc5d52c6a1d5445a91f3c86a550ced43e8aac9d7::text/utf8.mq.md","name":"偏移","span":{"end":638,"start":615},"value_state":"not_requested","value_type":"Int"},"run_id":"9-1795713570566476436","schema":"marqdo.observation","schema_version":1,"seq":253}
|
||||||
|
{"kind":"variable.assigned","payload":{"frame_id":"f16","module_id":"std:marqdo-stdlib@0.2.0#db905508dde89763b9d43b47fc5d52c6a1d5445a91f3c86a550ced43e8aac9d7::text/utf8.mq.md","name":"下标","span":{"end":1347,"start":1324},"value_state":"not_requested","value_type":"Int"},"run_id":"9-1795713570566476436","schema":"marqdo.observation","schema_version":1,"seq":254}
|
||||||
|
{"kind":"loop.iteration","payload":{"decision":"continue","frame_id":"f16","module_id":"std:marqdo-stdlib@0.2.0#db905508dde89763b9d43b47fc5d52c6a1d5445a91f3c86a550ced43e8aac9d7::text/utf8.mq.md","span":{"end":528,"start":500}},"run_id":"9-1795713570566476436","schema":"marqdo.observation","schema_version":1,"seq":255}
|
||||||
|
{"kind":"variable.assigned","payload":{"frame_id":"f16","module_id":"std:marqdo-stdlib@0.2.0#db905508dde89763b9d43b47fc5d52c6a1d5445a91f3c86a550ced43e8aac9d7::text/utf8.mq.md","name":"码点","span":{"end":554,"start":530},"value_state":"not_requested","value_type":"Int"},"run_id":"9-1795713570566476436","schema":"marqdo.observation","schema_version":1,"seq":256}
|
||||||
|
{"kind":"branch.eval","payload":{"frame_id":"f16","module_id":"std:marqdo-stdlib@0.2.0#db905508dde89763b9d43b47fc5d52c6a1d5445a91f3c86a550ced43e8aac9d7::text/utf8.mq.md","result":true,"span":{"end":573,"start":556}},"run_id":"9-1795713570566476436","schema":"marqdo.observation","schema_version":1,"seq":257}
|
||||||
|
{"kind":"effect","payload":{"frame_id":"f16","module_id":"std:marqdo-stdlib@0.2.0#db905508dde89763b9d43b47fc5d52c6a1d5445a91f3c86a550ced43e8aac9d7::text/utf8.mq.md","operation":"memory.write","result_code":"ok","span":{"end":601,"start":578}},"run_id":"9-1795713570566476436","schema":"marqdo.observation","schema_version":1,"seq":258}
|
||||||
|
{"kind":"variable.assigned","payload":{"frame_id":"f16","module_id":"std:marqdo-stdlib@0.2.0#db905508dde89763b9d43b47fc5d52c6a1d5445a91f3c86a550ced43e8aac9d7::text/utf8.mq.md","name":"偏移","span":{"end":638,"start":615},"value_state":"not_requested","value_type":"Int"},"run_id":"9-1795713570566476436","schema":"marqdo.observation","schema_version":1,"seq":259}
|
||||||
|
{"kind":"variable.assigned","payload":{"frame_id":"f16","module_id":"std:marqdo-stdlib@0.2.0#db905508dde89763b9d43b47fc5d52c6a1d5445a91f3c86a550ced43e8aac9d7::text/utf8.mq.md","name":"下标","span":{"end":1347,"start":1324},"value_state":"not_requested","value_type":"Int"},"run_id":"9-1795713570566476436","schema":"marqdo.observation","schema_version":1,"seq":260}
|
||||||
|
{"kind":"loop.iteration","payload":{"decision":"continue","frame_id":"f16","module_id":"std:marqdo-stdlib@0.2.0#db905508dde89763b9d43b47fc5d52c6a1d5445a91f3c86a550ced43e8aac9d7::text/utf8.mq.md","span":{"end":528,"start":500}},"run_id":"9-1795713570566476436","schema":"marqdo.observation","schema_version":1,"seq":261}
|
||||||
|
{"kind":"variable.assigned","payload":{"frame_id":"f16","module_id":"std:marqdo-stdlib@0.2.0#db905508dde89763b9d43b47fc5d52c6a1d5445a91f3c86a550ced43e8aac9d7::text/utf8.mq.md","name":"码点","span":{"end":554,"start":530},"value_state":"not_requested","value_type":"Int"},"run_id":"9-1795713570566476436","schema":"marqdo.observation","schema_version":1,"seq":262}
|
||||||
|
{"kind":"branch.eval","payload":{"frame_id":"f16","module_id":"std:marqdo-stdlib@0.2.0#db905508dde89763b9d43b47fc5d52c6a1d5445a91f3c86a550ced43e8aac9d7::text/utf8.mq.md","result":true,"span":{"end":573,"start":556}},"run_id":"9-1795713570566476436","schema":"marqdo.observation","schema_version":1,"seq":263}
|
||||||
|
{"kind":"effect","payload":{"frame_id":"f16","module_id":"std:marqdo-stdlib@0.2.0#db905508dde89763b9d43b47fc5d52c6a1d5445a91f3c86a550ced43e8aac9d7::text/utf8.mq.md","operation":"memory.write","result_code":"ok","span":{"end":601,"start":578}},"run_id":"9-1795713570566476436","schema":"marqdo.observation","schema_version":1,"seq":264}
|
||||||
|
{"kind":"variable.assigned","payload":{"frame_id":"f16","module_id":"std:marqdo-stdlib@0.2.0#db905508dde89763b9d43b47fc5d52c6a1d5445a91f3c86a550ced43e8aac9d7::text/utf8.mq.md","name":"偏移","span":{"end":638,"start":615},"value_state":"not_requested","value_type":"Int"},"run_id":"9-1795713570566476436","schema":"marqdo.observation","schema_version":1,"seq":265}
|
||||||
|
{"kind":"variable.assigned","payload":{"frame_id":"f16","module_id":"std:marqdo-stdlib@0.2.0#db905508dde89763b9d43b47fc5d52c6a1d5445a91f3c86a550ced43e8aac9d7::text/utf8.mq.md","name":"下标","span":{"end":1347,"start":1324},"value_state":"not_requested","value_type":"Int"},"run_id":"9-1795713570566476436","schema":"marqdo.observation","schema_version":1,"seq":266}
|
||||||
|
{"kind":"loop.iteration","payload":{"decision":"exit","frame_id":"f16","module_id":"std:marqdo-stdlib@0.2.0#db905508dde89763b9d43b47fc5d52c6a1d5445a91f3c86a550ced43e8aac9d7::text/utf8.mq.md","span":{"end":528,"start":500}},"run_id":"9-1795713570566476436","schema":"marqdo.observation","schema_version":1,"seq":267}
|
||||||
|
{"kind":"return","payload":{"frame_id":"f16","module_id":"std:marqdo-stdlib@0.2.0#db905508dde89763b9d43b47fc5d52c6a1d5445a91f3c86a550ced43e8aac9d7::text/utf8.mq.md","span":{"end":1370,"start":1355},"value_type":"Int"},"run_id":"9-1795713570566476436","schema":"marqdo.observation","schema_version":1,"seq":268}
|
||||||
|
{"kind":"call.exit","payload":{"frame_id":"f16","module_id":"std:marqdo-stdlib@0.2.0#db905508dde89763b9d43b47fc5d52c6a1d5445a91f3c86a550ced43e8aac9d7::io/stream.mq.md","span":{"end":1526,"start":1496},"status":"return"},"run_id":"9-1795713570566476436","schema":"marqdo.observation","schema_version":1,"seq":269}
|
||||||
|
{"kind":"variable.assigned","payload":{"frame_id":"f12","module_id":"std:marqdo-stdlib@0.2.0#db905508dde89763b9d43b47fc5d52c6a1d5445a91f3c86a550ced43e8aac9d7::io/stream.mq.md","name":"长度","span":{"end":1528,"start":1485},"value_state":"not_requested","value_type":"Int"},"run_id":"9-1795713570566476436","schema":"marqdo.observation","schema_version":1,"seq":270}
|
||||||
|
{"kind":"effect","payload":{"frame_id":"f12","module_id":"std:marqdo-stdlib@0.2.0#db905508dde89763b9d43b47fc5d52c6a1d5445a91f3c86a550ced43e8aac9d7::io/stream.mq.md","operation":"resource.open","result_code":"ok","span":{"end":1581,"start":1538}},"run_id":"9-1795713570566476436","schema":"marqdo.observation","schema_version":1,"seq":271}
|
||||||
|
{"kind":"variable.assigned","payload":{"frame_id":"f12","module_id":"std:marqdo-stdlib@0.2.0#db905508dde89763b9d43b47fc5d52c6a1d5445a91f3c86a550ced43e8aac9d7::io/stream.mq.md","name":"流","span":{"end":1583,"start":1530},"value_state":"not_requested","value_type":"Resource"},"run_id":"9-1795713570566476436","schema":"marqdo.observation","schema_version":1,"seq":272}
|
||||||
|
{"kind":"call.enter","payload":{"frame_id":"f17","function_id":"std:marqdo-stdlib@0.2.0#db905508dde89763b9d43b47fc5d52c6a1d5445a91f3c86a550ced43e8aac9d7::io/stream.mq.md::stream.写全部","module_id":"std:marqdo-stdlib@0.2.0#db905508dde89763b9d43b47fc5d52c6a1d5445a91f3c86a550ced43e8aac9d7::io/stream.mq.md","parent_frame_id":"f12","span":{"end":1632,"start":1599}},"run_id":"9-1795713570566476436","schema":"marqdo.observation","schema_version":1,"seq":273}
|
||||||
|
{"kind":"parameter.observed","payload":{"frame_id":"f17","module_id":"std:marqdo-stdlib@0.2.0#db905508dde89763b9d43b47fc5d52c6a1d5445a91f3c86a550ced43e8aac9d7::io/stream.mq.md","name":"流","source":"provided","span":{"end":251,"start":248},"value_state":"not_requested","value_type":"Resource"},"run_id":"9-1795713570566476436","schema":"marqdo.observation","schema_version":1,"seq":274}
|
||||||
|
{"kind":"parameter.observed","payload":{"frame_id":"f17","module_id":"std:marqdo-stdlib@0.2.0#db905508dde89763b9d43b47fc5d52c6a1d5445a91f3c86a550ced43e8aac9d7::io/stream.mq.md","name":"内存","source":"provided","span":{"end":259,"start":252},"value_state":"not_requested","value_type":"Memory"},"run_id":"9-1795713570566476436","schema":"marqdo.observation","schema_version":1,"seq":275}
|
||||||
|
{"kind":"parameter.observed","payload":{"frame_id":"f17","module_id":"std:marqdo-stdlib@0.2.0#db905508dde89763b9d43b47fc5d52c6a1d5445a91f3c86a550ced43e8aac9d7::io/stream.mq.md","name":"起点","source":"provided","span":{"end":267,"start":260},"value_state":"not_requested","value_type":"Int"},"run_id":"9-1795713570566476436","schema":"marqdo.observation","schema_version":1,"seq":276}
|
||||||
|
{"kind":"parameter.observed","payload":{"frame_id":"f17","module_id":"std:marqdo-stdlib@0.2.0#db905508dde89763b9d43b47fc5d52c6a1d5445a91f3c86a550ced43e8aac9d7::io/stream.mq.md","name":"长度","source":"provided","span":{"end":275,"start":268},"value_state":"not_requested","value_type":"Int"},"run_id":"9-1795713570566476436","schema":"marqdo.observation","schema_version":1,"seq":277}
|
||||||
|
{"kind":"variable.assigned","payload":{"frame_id":"f17","module_id":"std:marqdo-stdlib@0.2.0#db905508dde89763b9d43b47fc5d52c6a1d5445a91f3c86a550ced43e8aac9d7::io/stream.mq.md","name":"已写","span":{"end":447,"start":433},"value_state":"not_requested","value_type":"Int"},"run_id":"9-1795713570566476436","schema":"marqdo.observation","schema_version":1,"seq":278}
|
||||||
|
{"kind":"variable.assigned","payload":{"frame_id":"f17","module_id":"std:marqdo-stdlib@0.2.0#db905508dde89763b9d43b47fc5d52c6a1d5445a91f3c86a550ced43e8aac9d7::io/stream.mq.md","name":"失败","span":{"end":467,"start":449},"value_state":"not_requested","value_type":"Bool"},"run_id":"9-1795713570566476436","schema":"marqdo.observation","schema_version":1,"seq":279}
|
||||||
|
{"kind":"variable.assigned","payload":{"frame_id":"f17","module_id":"std:marqdo-stdlib@0.2.0#db905508dde89763b9d43b47fc5d52c6a1d5445a91f3c86a550ced43e8aac9d7::io/stream.mq.md","name":"本次","span":{"end":511,"start":469},"value_state":"not_requested","value_type":"Map"},"run_id":"9-1795713570566476436","schema":"marqdo.observation","schema_version":1,"seq":280}
|
||||||
|
{"kind":"variable.assigned","payload":{"frame_id":"f17","module_id":"std:marqdo-stdlib@0.2.0#db905508dde89763b9d43b47fc5d52c6a1d5445a91f3c86a550ced43e8aac9d7::io/stream.mq.md","name":"错误结果","span":{"end":610,"start":513},"value_state":"not_requested","value_type":"Map"},"run_id":"9-1795713570566476436","schema":"marqdo.observation","schema_version":1,"seq":281}
|
||||||
|
{"kind":"loop.iteration","payload":{"decision":"continue","frame_id":"f17","module_id":"std:marqdo-stdlib@0.2.0#db905508dde89763b9d43b47fc5d52c6a1d5445a91f3c86a550ced43e8aac9d7::io/stream.mq.md","span":{"end":635,"start":612}},"run_id":"9-1795713570566476436","schema":"marqdo.observation","schema_version":1,"seq":282}
|
||||||
|
{"kind":"variable.assigned","payload":{"frame_id":"f17","module_id":"std:marqdo-stdlib@0.2.0#db905508dde89763b9d43b47fc5d52c6a1d5445a91f3c86a550ced43e8aac9d7::io/stream.mq.md","name":"剩余","span":{"end":665,"start":637},"value_state":"not_requested","value_type":"Int"},"run_id":"9-1795713570566476436","schema":"marqdo.observation","schema_version":1,"seq":283}
|
||||||
|
{"kind":"stdout.chunk","payload":{"byte_count":5,"data_base64":"RE9ORQo=","encoding":"base64"},"run_id":"9-1795713570566476436","schema":"marqdo.observation","schema_version":1,"seq":284}
|
||||||
|
{"kind":"effect","payload":{"frame_id":"f17","module_id":"std:marqdo-stdlib@0.2.0#db905508dde89763b9d43b47fc5d52c6a1d5445a91f3c86a550ced43e8aac9d7::io/stream.mq.md","operation":"resource.write","result_code":"ok","span":{"end":730,"start":678}},"run_id":"9-1795713570566476436","schema":"marqdo.observation","schema_version":1,"seq":285}
|
||||||
|
{"kind":"variable.assigned","payload":{"frame_id":"f17","module_id":"std:marqdo-stdlib@0.2.0#db905508dde89763b9d43b47fc5d52c6a1d5445a91f3c86a550ced43e8aac9d7::io/stream.mq.md","name":"本次","span":{"end":732,"start":667},"value_state":"not_requested","value_type":"Map"},"run_id":"9-1795713570566476436","schema":"marqdo.observation","schema_version":1,"seq":286}
|
||||||
|
{"kind":"branch.eval","payload":{"frame_id":"f17","module_id":"std:marqdo-stdlib@0.2.0#db905508dde89763b9d43b47fc5d52c6a1d5445a91f3c86a550ced43e8aac9d7::io/stream.mq.md","result":false,"span":{"end":752,"start":734}},"run_id":"9-1795713570566476436","schema":"marqdo.observation","schema_version":1,"seq":287}
|
||||||
|
{"kind":"branch.eval","payload":{"frame_id":"f17","module_id":"std:marqdo-stdlib@0.2.0#db905508dde89763b9d43b47fc5d52c6a1d5445a91f3c86a550ced43e8aac9d7::io/stream.mq.md","result":true,"span":{"end":827,"start":821}},"run_id":"9-1795713570566476436","schema":"marqdo.observation","schema_version":1,"seq":288}
|
||||||
|
{"kind":"branch.eval","payload":{"frame_id":"f17","module_id":"std:marqdo-stdlib@0.2.0#db905508dde89763b9d43b47fc5d52c6a1d5445a91f3c86a550ced43e8aac9d7::io/stream.mq.md","result":false,"span":{"end":856,"start":828}},"run_id":"9-1795713570566476436","schema":"marqdo.observation","schema_version":1,"seq":289}
|
||||||
|
{"kind":"branch.eval","payload":{"frame_id":"f17","module_id":"std:marqdo-stdlib@0.2.0#db905508dde89763b9d43b47fc5d52c6a1d5445a91f3c86a550ced43e8aac9d7::io/stream.mq.md","result":true,"span":{"end":904,"start":898}},"run_id":"9-1795713570566476436","schema":"marqdo.observation","schema_version":1,"seq":290}
|
||||||
|
{"kind":"branch.eval","payload":{"frame_id":"f17","module_id":"std:marqdo-stdlib@0.2.0#db905508dde89763b9d43b47fc5d52c6a1d5445a91f3c86a550ced43e8aac9d7::io/stream.mq.md","result":true,"span":{"end":914,"start":905}},"run_id":"9-1795713570566476436","schema":"marqdo.observation","schema_version":1,"seq":291}
|
||||||
|
{"kind":"variable.assigned","payload":{"frame_id":"f17","module_id":"std:marqdo-stdlib@0.2.0#db905508dde89763b9d43b47fc5d52c6a1d5445a91f3c86a550ced43e8aac9d7::io/stream.mq.md","name":"已写","span":{"end":956,"start":916},"value_state":"not_requested","value_type":"Int"},"run_id":"9-1795713570566476436","schema":"marqdo.observation","schema_version":1,"seq":292}
|
||||||
|
{"kind":"loop.iteration","payload":{"decision":"exit","frame_id":"f17","module_id":"std:marqdo-stdlib@0.2.0#db905508dde89763b9d43b47fc5d52c6a1d5445a91f3c86a550ced43e8aac9d7::io/stream.mq.md","span":{"end":635,"start":612}},"run_id":"9-1795713570566476436","schema":"marqdo.observation","schema_version":1,"seq":293}
|
||||||
|
{"kind":"branch.eval","payload":{"frame_id":"f17","module_id":"std:marqdo-stdlib@0.2.0#db905508dde89763b9d43b47fc5d52c6a1d5445a91f3c86a550ced43e8aac9d7::io/stream.mq.md","result":false,"span":{"end":993,"start":982}},"run_id":"9-1795713570566476436","schema":"marqdo.observation","schema_version":1,"seq":294}
|
||||||
|
{"kind":"branch.eval","payload":{"frame_id":"f17","module_id":"std:marqdo-stdlib@0.2.0#db905508dde89763b9d43b47fc5d52c6a1d5445a91f3c86a550ced43e8aac9d7::io/stream.mq.md","result":true,"span":{"end":1024,"start":1018}},"run_id":"9-1795713570566476436","schema":"marqdo.observation","schema_version":1,"seq":295}
|
||||||
|
{"kind":"branch.eval","payload":{"frame_id":"f17","module_id":"std:marqdo-stdlib@0.2.0#db905508dde89763b9d43b47fc5d52c6a1d5445a91f3c86a550ced43e8aac9d7::io/stream.mq.md","result":false,"span":{"end":1045,"start":1025}},"run_id":"9-1795713570566476436","schema":"marqdo.observation","schema_version":1,"seq":296}
|
||||||
|
{"kind":"branch.eval","payload":{"frame_id":"f17","module_id":"std:marqdo-stdlib@0.2.0#db905508dde89763b9d43b47fc5d52c6a1d5445a91f3c86a550ced43e8aac9d7::io/stream.mq.md","result":true,"span":{"end":1076,"start":1070}},"run_id":"9-1795713570566476436","schema":"marqdo.observation","schema_version":1,"seq":297}
|
||||||
|
{"kind":"branch.eval","payload":{"frame_id":"f17","module_id":"std:marqdo-stdlib@0.2.0#db905508dde89763b9d43b47fc5d52c6a1d5445a91f3c86a550ced43e8aac9d7::io/stream.mq.md","result":true,"span":{"end":1086,"start":1077}},"run_id":"9-1795713570566476436","schema":"marqdo.observation","schema_version":1,"seq":298}
|
||||||
|
{"kind":"return","payload":{"frame_id":"f17","module_id":"std:marqdo-stdlib@0.2.0#db905508dde89763b9d43b47fc5d52c6a1d5445a91f3c86a550ced43e8aac9d7::io/stream.mq.md","span":{"end":1131,"start":1088},"value_type":"Map"},"run_id":"9-1795713570566476436","schema":"marqdo.observation","schema_version":1,"seq":299}
|
||||||
|
{"kind":"call.exit","payload":{"frame_id":"f17","module_id":"std:marqdo-stdlib@0.2.0#db905508dde89763b9d43b47fc5d52c6a1d5445a91f3c86a550ced43e8aac9d7::io/stream.mq.md","span":{"end":1632,"start":1599},"status":"return"},"run_id":"9-1795713570566476436","schema":"marqdo.observation","schema_version":1,"seq":300}
|
||||||
|
{"kind":"variable.assigned","payload":{"frame_id":"f12","module_id":"std:marqdo-stdlib@0.2.0#db905508dde89763b9d43b47fc5d52c6a1d5445a91f3c86a550ced43e8aac9d7::io/stream.mq.md","name":"写结果","span":{"end":1634,"start":1585},"value_state":"not_requested","value_type":"Map"},"run_id":"9-1795713570566476436","schema":"marqdo.observation","schema_version":1,"seq":301}
|
||||||
|
{"kind":"effect","payload":{"frame_id":"f12","module_id":"std:marqdo-stdlib@0.2.0#db905508dde89763b9d43b47fc5d52c6a1d5445a91f3c86a550ced43e8aac9d7::io/stream.mq.md","operation":"resource.close","result_code":"ok","span":{"end":1666,"start":1647}},"run_id":"9-1795713570566476436","schema":"marqdo.observation","schema_version":1,"seq":302}
|
||||||
|
{"kind":"variable.assigned","payload":{"frame_id":"f12","module_id":"std:marqdo-stdlib@0.2.0#db905508dde89763b9d43b47fc5d52c6a1d5445a91f3c86a550ced43e8aac9d7::io/stream.mq.md","name":"关闭","span":{"end":1668,"start":1636},"value_state":"not_requested","value_type":"Map"},"run_id":"9-1795713570566476436","schema":"marqdo.observation","schema_version":1,"seq":303}
|
||||||
|
{"kind":"branch.eval","payload":{"frame_id":"f12","module_id":"std:marqdo-stdlib@0.2.0#db905508dde89763b9d43b47fc5d52c6a1d5445a91f3c86a550ced43e8aac9d7::io/stream.mq.md","result":false,"span":{"end":1691,"start":1670}},"run_id":"9-1795713570566476436","schema":"marqdo.observation","schema_version":1,"seq":304}
|
||||||
|
{"kind":"branch.eval","payload":{"frame_id":"f12","module_id":"std:marqdo-stdlib@0.2.0#db905508dde89763b9d43b47fc5d52c6a1d5445a91f3c86a550ced43e8aac9d7::io/stream.mq.md","result":true,"span":{"end":1719,"start":1713}},"run_id":"9-1795713570566476436","schema":"marqdo.observation","schema_version":1,"seq":305}
|
||||||
|
{"kind":"branch.eval","payload":{"frame_id":"f12","module_id":"std:marqdo-stdlib@0.2.0#db905508dde89763b9d43b47fc5d52c6a1d5445a91f3c86a550ced43e8aac9d7::io/stream.mq.md","result":false,"span":{"end":1738,"start":1720}},"run_id":"9-1795713570566476436","schema":"marqdo.observation","schema_version":1,"seq":306}
|
||||||
|
{"kind":"branch.eval","payload":{"frame_id":"f12","module_id":"std:marqdo-stdlib@0.2.0#db905508dde89763b9d43b47fc5d52c6a1d5445a91f3c86a550ced43e8aac9d7::io/stream.mq.md","result":true,"span":{"end":1763,"start":1757}},"run_id":"9-1795713570566476436","schema":"marqdo.observation","schema_version":1,"seq":307}
|
||||||
|
{"kind":"branch.eval","payload":{"frame_id":"f12","module_id":"std:marqdo-stdlib@0.2.0#db905508dde89763b9d43b47fc5d52c6a1d5445a91f3c86a550ced43e8aac9d7::io/stream.mq.md","result":true,"span":{"end":1773,"start":1764}},"run_id":"9-1795713570566476436","schema":"marqdo.observation","schema_version":1,"seq":308}
|
||||||
|
{"kind":"return","payload":{"frame_id":"f12","module_id":"std:marqdo-stdlib@0.2.0#db905508dde89763b9d43b47fc5d52c6a1d5445a91f3c86a550ced43e8aac9d7::io/stream.mq.md","span":{"end":1818,"start":1775},"value_type":"Map"},"run_id":"9-1795713570566476436","schema":"marqdo.observation","schema_version":1,"seq":309}
|
||||||
|
{"kind":"call.exit","payload":{"frame_id":"f12","module_id":"std:marqdo-stdlib@0.2.0#db905508dde89763b9d43b47fc5d52c6a1d5445a91f3c86a550ced43e8aac9d7::io.mq.md","span":{"end":430,"start":387},"status":"return"},"run_id":"9-1795713570566476436","schema":"marqdo.observation","schema_version":1,"seq":310}
|
||||||
|
{"kind":"return","payload":{"frame_id":"f10","module_id":"std:marqdo-stdlib@0.2.0#db905508dde89763b9d43b47fc5d52c6a1d5445a91f3c86a550ced43e8aac9d7::io.mq.md","span":{"end":431,"start":379},"value_type":"Map"},"run_id":"9-1795713570566476436","schema":"marqdo.observation","schema_version":1,"seq":311}
|
||||||
|
{"kind":"call.exit","payload":{"frame_id":"f10","module_id":"root:default::basic.mq.md","span":{"end":100,"start":86},"status":"return"},"run_id":"9-1795713570566476436","schema":"marqdo.observation","schema_version":1,"seq":312}
|
||||||
|
{"kind":"return","payload":{"frame_id":"f1","module_id":"root:default::basic.mq.md","span":{"end":113,"start":103},"value_type":"Int"},"run_id":"9-1795713570566476436","schema":"marqdo.observation","schema_version":1,"seq":313}
|
||||||
|
{"kind":"call.exit","payload":{"frame_id":"f1","module_id":"root:default::basic.mq.md","span":null,"status":"return"},"run_id":"9-1795713570566476436","schema":"marqdo.observation","schema_version":1,"seq":314}
|
||||||
|
{"kind":"run.completed","payload":{"status":"ok","value":{"decimal":"10","type":"int"},"value_type":"Int"},"run_id":"9-1795713570566476436","schema":"marqdo.observation","schema_version":1,"seq":315}
|
||||||
@@ -12,6 +12,8 @@ jobs:
|
|||||||
test:
|
test:
|
||||||
name: fmt + clippy + test (Linux x86_64)
|
name: fmt + clippy + test (Linux x86_64)
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
|
env:
|
||||||
|
MARQDO_TEST_STDLIB_BUNDLE: ${{ github.workspace }}/target/ecosystem-stdlib
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v4
|
- uses: actions/checkout@v4
|
||||||
- uses: dtolnay/rust-toolchain@stable
|
- uses: dtolnay/rust-toolchain@stable
|
||||||
@@ -19,6 +21,10 @@ jobs:
|
|||||||
components: rustfmt, clippy
|
components: rustfmt, clippy
|
||||||
- name: Rust cache
|
- name: Rust cache
|
||||||
uses: Swatinem/rust-cache@v2
|
uses: Swatinem/rust-cache@v2
|
||||||
|
- name: Materialize the pinned ecosystem stdlib Bundle
|
||||||
|
run: python3 tools/ci/fetch_ecosystem_bundle.py --out target/ecosystem-stdlib
|
||||||
|
- name: Verify the pinned stdlib Bundle
|
||||||
|
run: python3 tools/stdlib/bundle.py --stdlib-dir target/ecosystem-stdlib
|
||||||
- name: Formatting
|
- name: Formatting
|
||||||
run: cargo fmt --all -- --check
|
run: cargo fmt --all -- --check
|
||||||
- name: Clippy
|
- name: Clippy
|
||||||
@@ -39,9 +45,15 @@ jobs:
|
|||||||
run: cargo test -p marqdo-cli --test docs_consistency
|
run: cargo test -p marqdo-cli --test docs_consistency
|
||||||
- name: Architecture boundaries
|
- name: Architecture boundaries
|
||||||
run: cargo test -p marqdo-cli --test architecture_boundaries
|
run: cargo test -p marqdo-cli --test architecture_boundaries
|
||||||
|
- name: Dependency-direction gate (Engine / Host Contract / Native Host)
|
||||||
|
run: python3 tools/ci/check_dependency_boundaries.py
|
||||||
|
- name: Engine independence and CLI differential execution
|
||||||
|
run: python3 tools/ci/check_engine_boundary.py
|
||||||
|
- name: Plugin SDK real consumption
|
||||||
|
run: python3 tools/ci/check_plugin_sdk.py
|
||||||
- name: CI evidence tool tests
|
- name: CI evidence tool tests
|
||||||
run: python3 -m unittest discover -s tools/ci -p "test_*.py"
|
run: python3 -m unittest discover -s tools/ci -p "test_*.py"
|
||||||
- name: Whole stdlib product tests
|
- name: Whole stdlib product tests (explicit pinned Bundle)
|
||||||
run: cargo test -p marqdo-cli --test stdlib_product
|
run: cargo test -p marqdo-cli --test stdlib_product
|
||||||
- name: Validate public JSON schemas
|
- name: Validate public JSON schemas
|
||||||
run: |
|
run: |
|
||||||
@@ -93,6 +105,16 @@ jobs:
|
|||||||
--trust-native-plugin \
|
--trust-native-plugin \
|
||||||
--allow-plugin demo.solver
|
--allow-plugin demo.solver
|
||||||
|
|
||||||
|
independent-build:
|
||||||
|
name: independent CLI/worker build (no stdlib source)
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v4
|
||||||
|
- uses: dtolnay/rust-toolchain@stable
|
||||||
|
- uses: Swatinem/rust-cache@v2
|
||||||
|
- name: Build from a copy without stdlib and run a language-only program
|
||||||
|
run: python3 tools/ci/independent_build.py
|
||||||
|
|
||||||
schema:
|
schema:
|
||||||
name: schema instance validation + consumers
|
name: schema instance validation + consumers
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
@@ -214,6 +236,8 @@ jobs:
|
|||||||
persist-credentials: false
|
persist-credentials: false
|
||||||
- uses: dtolnay/rust-toolchain@stable
|
- uses: dtolnay/rust-toolchain@stable
|
||||||
- uses: Swatinem/rust-cache@v2
|
- uses: Swatinem/rust-cache@v2
|
||||||
|
- name: Materialize the pinned ecosystem stdlib Bundle
|
||||||
|
run: python3 tools/ci/fetch_ecosystem_bundle.py --out target/ecosystem-stdlib
|
||||||
- name: Build and check the frozen archive
|
- name: Build and check the frozen archive
|
||||||
shell: bash
|
shell: bash
|
||||||
run: |
|
run: |
|
||||||
@@ -221,7 +245,8 @@ jobs:
|
|||||||
cargo build --release --locked -p marqdo-cli -p marqdo-provider-worker
|
cargo build --release --locked -p marqdo-cli -p marqdo-provider-worker
|
||||||
version="$(cargo metadata --no-deps --format-version 1 --offline \
|
version="$(cargo metadata --no-deps --format-version 1 --offline \
|
||||||
| python3 -c 'import json,sys; print(next(p["version"] for p in json.load(sys.stdin)["packages"] if p["name"]=="marqdo-cli"))')"
|
| python3 -c 'import json,sys; print(next(p["version"] for p in json.load(sys.stdin)["packages"] if p["name"]=="marqdo-cli"))')"
|
||||||
python3 tools/release/package.py --source-sha "$GITHUB_SHA" --version "$version"
|
python3 tools/release/package.py --source-sha "$GITHUB_SHA" --version "$version" \
|
||||||
|
--stdlib-dir target/ecosystem-stdlib --bundle-pin tools/stdlib/bundle-pin.json
|
||||||
python3 tools/release/smoke.py --archive dist/marqdo-*.tar.gz
|
python3 tools/release/smoke.py --archive dist/marqdo-*.tar.gz
|
||||||
tools/ci/run_frozen_extensions.sh dist/marqdo-*.tar.gz "$GITHUB_SHA" dist/frozen-extension-evidence.json
|
tools/ci/run_frozen_extensions.sh dist/marqdo-*.tar.gz "$GITHUB_SHA" dist/frozen-extension-evidence.json
|
||||||
- uses: actions/upload-artifact@v4
|
- uses: actions/upload-artifact@v4
|
||||||
@@ -239,7 +264,7 @@ jobs:
|
|||||||
|
|
||||||
release-evidence:
|
release-evidence:
|
||||||
name: release evidence manifest
|
name: release evidence manifest
|
||||||
needs: [test, schema, cross-platform, frozen-extensions]
|
needs: [test, schema, cross-platform, frozen-extensions, independent-build]
|
||||||
if: always()
|
if: always()
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
@@ -252,6 +277,7 @@ jobs:
|
|||||||
LINUX_RESULT: ${{ needs.test.result }}
|
LINUX_RESULT: ${{ needs.test.result }}
|
||||||
SCHEMA_RESULT: ${{ needs.schema.result }}
|
SCHEMA_RESULT: ${{ needs.schema.result }}
|
||||||
EXTENSIONS_RESULT: ${{ needs.frozen-extensions.result }}
|
EXTENSIONS_RESULT: ${{ needs.frozen-extensions.result }}
|
||||||
|
INDEPENDENT_RESULT: ${{ needs.independent-build.result }}
|
||||||
run: |
|
run: |
|
||||||
set -euo pipefail
|
set -euo pipefail
|
||||||
state() {
|
state() {
|
||||||
@@ -262,7 +288,7 @@ jobs:
|
|||||||
esac
|
esac
|
||||||
}
|
}
|
||||||
linux="$(state "$LINUX_RESULT")"
|
linux="$(state "$LINUX_RESULT")"
|
||||||
if [ "$(state "$SCHEMA_RESULT")" != "PASS" ] || [ "$(state "$EXTENSIONS_RESULT")" != "PASS" ]; then
|
if [ "$(state "$SCHEMA_RESULT")" != "PASS" ] || [ "$(state "$EXTENSIONS_RESULT")" != "PASS" ] || [ "$(state "$INDEPENDENT_RESULT")" != "PASS" ]; then
|
||||||
linux="FAIL"
|
linux="FAIL"
|
||||||
fi
|
fi
|
||||||
python3 tools/ci/release_evidence.py --profile rc --target-sha "$TARGET_SHA" \
|
python3 tools/ci/release_evidence.py --profile rc --target-sha "$TARGET_SHA" \
|
||||||
|
|||||||
@@ -37,3 +37,12 @@ __pycache__/
|
|||||||
*.pyc
|
*.pyc
|
||||||
.perf-out-*
|
.perf-out-*
|
||||||
.perf-err-*
|
.perf-err-*
|
||||||
|
|
||||||
|
# Independent consumer/fixture build outputs and the local scratch dir
|
||||||
|
/tests/embedding/target/
|
||||||
|
/tests/sdk-plugin/target/
|
||||||
|
/.tmp/
|
||||||
|
|
||||||
|
# Accidental curl/test capture files
|
||||||
|
/out
|
||||||
|
/log.txt
|
||||||
+26
-31
@@ -13,55 +13,47 @@ steps:
|
|||||||
image: rust:1.100-bookworm
|
image: rust:1.100-bookworm
|
||||||
commands:
|
commands:
|
||||||
- apt-get update
|
- apt-get update
|
||||||
- apt-get install -y --no-install-recommends ca-certificates python3 python3-jsonschema
|
- apt-get install -y --no-install-recommends ca-certificates git python3 python3-jsonschema
|
||||||
- cargo build --locked -p marqdo-cli -p marqdo-provider-worker
|
- cargo build --locked -p marqdo-cli -p marqdo-provider-worker
|
||||||
- |
|
- python3 tools/ci/check_dependency_boundaries.py
|
||||||
set -eux
|
- python3 tools/ci/fetch_ecosystem_bundle.py --out target/ecosystem-stdlib
|
||||||
./target/debug/marqdo check tests/consumers/fixtures/observation/basic.mq.md --emit /tmp/analysis.json
|
- MARQDO_TEST_STDLIB_BUNDLE="$PWD/target/ecosystem-stdlib" bash tools/ci/contract_lane.sh
|
||||||
./target/debug/marqdo run tests/consumers/fixtures/observation/basic.mq.md --output jsonl --observation-file /tmp/observation.json > /tmp/observation.jsonl
|
|
||||||
python3 tests/consumers/analysis_consumer.py /tmp/analysis.json
|
|
||||||
python3 tests/consumers/observation_consumer.py --validate-schema /tmp/observation.jsonl
|
|
||||||
python3 tests/consumers/observation_consumer.py --snapshot --analysis /tmp/analysis.json /tmp/observation.json
|
|
||||||
./target/debug/marqdo check tests/conformance/semantics/85-nested-loop-control.mq.md --emit /tmp/control-analysis.json
|
|
||||||
./target/debug/marqdo run tests/conformance/semantics/85-nested-loop-control.mq.md --output jsonl --observation-file /tmp/control-observation.json > /tmp/control-events.jsonl
|
|
||||||
python3 tests/consumers/validate_protocols.py /tmp/control-analysis.json /tmp/control-observation.json examples/tool-unknown-name/tool.json
|
|
||||||
python3 tests/consumers/analysis_consumer.py /tmp/control-analysis.json --require-transfers
|
|
||||||
python3 tests/consumers/observation_consumer.py --snapshot --analysis /tmp/control-analysis.json /tmp/control-observation.json
|
|
||||||
python3 tests/consumers/observation_consumer.py --validate-schema --analysis /tmp/control-analysis.json /tmp/control-events.jsonl
|
|
||||||
- python3 tools/ci/verify_observation_stream.py /tmp/control-events.jsonl /tmp/control-observation.json
|
|
||||||
- |
|
|
||||||
set -eu
|
|
||||||
cp /tmp/control-analysis.json /tmp/analysis-stale.json
|
|
||||||
printf ' ' >> /tmp/analysis-stale.json
|
|
||||||
if python3 tests/consumers/observation_consumer.py --analysis /tmp/analysis-stale.json /tmp/control-events.jsonl; then
|
|
||||||
echo "stale Analysis was accepted" >&2
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
echo "stale Analysis rejected"
|
|
||||||
|
|
||||||
test:
|
test:
|
||||||
image: rust:1.100-bookworm
|
image: rust:1.100-bookworm
|
||||||
commands:
|
commands:
|
||||||
- rustup component add clippy rustfmt
|
- rustup component add clippy rustfmt
|
||||||
- apt-get update
|
- apt-get update
|
||||||
- apt-get install -y --no-install-recommends curl ca-certificates python3 python3-jsonschema build-essential gcc-mingw-w64-x86-64
|
- apt-get install -y --no-install-recommends curl ca-certificates git python3 python3-jsonschema build-essential gcc-mingw-w64-x86-64
|
||||||
- curl -fsSL https://deb.nodesource.com/setup_22.x | bash -
|
- curl -fsSL https://deb.nodesource.com/setup_22.x | bash -
|
||||||
- apt-get install -y --no-install-recommends nodejs
|
- apt-get install -y --no-install-recommends nodejs
|
||||||
|
- python3 tools/ci/fetch_ecosystem_bundle.py --out target/ecosystem-stdlib
|
||||||
|
- python3 tools/stdlib/bundle.py --stdlib-dir target/ecosystem-stdlib
|
||||||
- cargo fmt --all -- --check
|
- cargo fmt --all -- --check
|
||||||
- cargo clippy --workspace --all-targets -- -D warnings
|
- cargo clippy --workspace --all-targets -- -D warnings
|
||||||
# Provider CLI tests resolve a real provider worker next to the CLI
|
# Provider CLI tests resolve a real provider worker next to the CLI
|
||||||
# binary. Build it once so the test harness does not need a nested build.
|
# binary. Build it once so the test harness does not need a nested build.
|
||||||
- cargo build --locked -p marqdo-provider-worker
|
- cargo build --locked -p marqdo-provider-worker
|
||||||
- cargo test --workspace --locked
|
- MARQDO_TEST_STDLIB_BUNDLE="$PWD/target/ecosystem-stdlib" cargo test --workspace --locked
|
||||||
- cargo test -p marqdo-cli --test docs_consistency
|
- MARQDO_TEST_STDLIB_BUNDLE="$PWD/target/ecosystem-stdlib" cargo test -p marqdo-cli --test docs_consistency
|
||||||
- cargo test -p marqdo-cli --test architecture_boundaries
|
- MARQDO_TEST_STDLIB_BUNDLE="$PWD/target/ecosystem-stdlib" cargo test -p marqdo-cli --test architecture_boundaries
|
||||||
- python3 -m unittest discover -s tools/ci -p "test_*.py"
|
- python3 tools/ci/check_dependency_boundaries.py
|
||||||
- cargo test -p marqdo-cli --test stdlib_product
|
- python3 tools/ci/check_engine_boundary.py
|
||||||
|
- python3 tools/ci/check_plugin_sdk.py
|
||||||
|
- MARQDO_TEST_STDLIB_BUNDLE="$PWD/target/ecosystem-stdlib" python3 -m unittest discover -s tools/ci -p "test_*.py"
|
||||||
|
- MARQDO_TEST_STDLIB_BUNDLE="$PWD/target/ecosystem-stdlib" cargo test -p marqdo-cli --test stdlib_product
|
||||||
# Windows compile gate: runtime lanes are native on GitHub; this catches
|
# Windows compile gate: runtime lanes are native on GitHub; this catches
|
||||||
# cfg/compile regressions on the Linux CI without a Windows runner.
|
# cfg/compile regressions on the Linux CI without a Windows runner.
|
||||||
- rustup target add x86_64-pc-windows-gnu
|
- rustup target add x86_64-pc-windows-gnu
|
||||||
- cargo check --workspace --all-targets --target x86_64-pc-windows-gnu
|
- cargo check --workspace --all-targets --target x86_64-pc-windows-gnu
|
||||||
|
|
||||||
|
independent-build:
|
||||||
|
image: rust:1.100-bookworm
|
||||||
|
commands:
|
||||||
|
- apt-get update
|
||||||
|
- apt-get install -y --no-install-recommends ca-certificates git python3
|
||||||
|
- python3 tools/ci/independent_build.py
|
||||||
|
|
||||||
minimum-rust:
|
minimum-rust:
|
||||||
image: rust:1.89-bookworm
|
image: rust:1.89-bookworm
|
||||||
commands:
|
commands:
|
||||||
@@ -79,13 +71,16 @@ steps:
|
|||||||
# only supported transport and resolution is a sibling-of-CLI lookup.
|
# only supported transport and resolution is a sibling-of-CLI lookup.
|
||||||
- cargo build --release --locked -p marqdo-cli -p marqdo-provider-worker
|
- cargo build --release --locked -p marqdo-cli -p marqdo-provider-worker
|
||||||
- test -x target/release/marqdo-provider-worker
|
- test -x target/release/marqdo-provider-worker
|
||||||
|
- python3 tools/ci/fetch_ecosystem_bundle.py --out target/ecosystem-stdlib
|
||||||
|
- python3 tools/stdlib/bundle.py --stdlib-dir target/ecosystem-stdlib
|
||||||
# Build the deterministic archive from this exact commit and cold-install
|
# Build the deterministic archive from this exact commit and cold-install
|
||||||
# smoke-test it; the package script refuses a dirty tree or wrong SHA.
|
# smoke-test it; the package script refuses a dirty tree or wrong SHA.
|
||||||
- |
|
- |
|
||||||
set -eu
|
set -eu
|
||||||
version="$(cargo metadata --no-deps --format-version 1 --offline \
|
version="$(cargo metadata --no-deps --format-version 1 --offline \
|
||||||
| python3 -c 'import json,sys; print(next(p["version"] for p in json.load(sys.stdin)["packages"] if p["name"]=="marqdo-cli"))')"
|
| python3 -c 'import json,sys; print(next(p["version"] for p in json.load(sys.stdin)["packages"] if p["name"]=="marqdo-cli"))')"
|
||||||
python3 tools/release/package.py --source-sha "$CI_COMMIT_SHA" --version "$version"
|
python3 tools/release/package.py --source-sha "$CI_COMMIT_SHA" --version "$version" \
|
||||||
|
--stdlib-dir target/ecosystem-stdlib --bundle-pin tools/stdlib/bundle-pin.json
|
||||||
python3 tools/release/smoke.py --archive dist/marqdo-*.tar.gz
|
python3 tools/release/smoke.py --archive dist/marqdo-*.tar.gz
|
||||||
tools/ci/run_frozen_extensions.sh dist/marqdo-*.tar.gz "$CI_COMMIT_SHA" dist/frozen-extension-evidence.json
|
tools/ci/run_frozen_extensions.sh dist/marqdo-*.tar.gz "$CI_COMMIT_SHA" dist/frozen-extension-evidence.json
|
||||||
cat dist/frozen-extension-evidence.json
|
cat dist/frozen-extension-evidence.json
|
||||||
@@ -10,6 +10,8 @@ steps:
|
|||||||
commands:
|
commands:
|
||||||
- apt-get update
|
- apt-get update
|
||||||
- apt-get install -y --no-install-recommends python3 util-linux ca-certificates git openssl build-essential
|
- apt-get install -y --no-install-recommends python3 util-linux ca-certificates git openssl build-essential
|
||||||
|
- python3 tools/ci/fetch_ecosystem_bundle.py --out target/ecosystem-stdlib
|
||||||
|
- python3 tools/stdlib/bundle.py --stdlib-dir target/ecosystem-stdlib
|
||||||
- cargo build --release --locked -p marqdo-cli -p marqdo-provider-worker
|
- cargo build --release --locked -p marqdo-cli -p marqdo-provider-worker
|
||||||
- |
|
- |
|
||||||
set -eu
|
set -eu
|
||||||
@@ -22,7 +24,8 @@ steps:
|
|||||||
(cd "$perf_dir/beta" && cargo build --release --locked -p marqdo-cli)
|
(cd "$perf_dir/beta" && cargo build --release --locked -p marqdo-cli)
|
||||||
|
|
||||||
version="$(target/release/marqdo --version | cut -d ' ' -f 2)"
|
version="$(target/release/marqdo --version | cut -d ' ' -f 2)"
|
||||||
python3 tools/release/package.py --version "$version" --source-sha "$CI_COMMIT_SHA" --out-dir "$perf_dir"
|
python3 tools/release/package.py --version "$version" --source-sha "$CI_COMMIT_SHA" \
|
||||||
|
--stdlib-dir target/ecosystem-stdlib --bundle-pin tools/stdlib/bundle-pin.json --out-dir "$perf_dir"
|
||||||
archive="$perf_dir/marqdo-$version-x86_64-unknown-linux-gnu.tar.gz"
|
archive="$perf_dir/marqdo-$version-x86_64-unknown-linux-gnu.tar.gz"
|
||||||
(cd "$perf_dir" && sha256sum -c "$(basename "$archive.sha256")")
|
(cd "$perf_dir" && sha256sum -c "$(basename "$archive.sha256")")
|
||||||
tar -xzf "$archive" -C "$perf_dir"
|
tar -xzf "$archive" -C "$perf_dir"
|
||||||
@@ -37,7 +40,8 @@ steps:
|
|||||||
(cd "$perf_dir/beta" && python3 tools/perf/runner.py --no-build \
|
(cd "$perf_dir/beta" && python3 tools/perf/runner.py --no-build \
|
||||||
--warmups 5 --samples 20 --platform-id woodpecker-agent-1 \
|
--warmups 5 --samples 20 --platform-id woodpecker-agent-1 \
|
||||||
--cpu-list "$cpu_list" --out "$perf_dir/beta.json" > /dev/null)
|
--cpu-list "$cpu_list" --out "$perf_dir/beta.json" > /dev/null)
|
||||||
python3 tools/perf/runner.py --no-build --binary "$candidate/marqdo" --warmups 5 --samples 20 \
|
python3 tools/perf/runner.py --no-build --binary "$candidate/marqdo" \
|
||||||
|
--stdlib-dir "$candidate/stdlib" --warmups 5 --samples 20 \
|
||||||
--platform-id woodpecker-agent-1 --cpu-list "$cpu_list" \
|
--platform-id woodpecker-agent-1 --cpu-list "$cpu_list" \
|
||||||
--baseline "$perf_dir/beta.json" --out perf.json > /dev/null
|
--baseline "$perf_dir/beta.json" --out perf.json > /dev/null
|
||||||
python3 - <<'PY'
|
python3 - <<'PY'
|
||||||
|
|||||||
@@ -1,19 +1,20 @@
|
|||||||
# Marqdo CLI — Agent / Contributor Operating Rules
|
# Marqdo CLI — Agent / Contributor Operating Rules
|
||||||
|
|
||||||
**Start here:** read `docs/architecture/RFC-LANG-0002-unified-semantics.md` — it is the single current language authority — and its normative summary `spec/mapping.md` + `spec/expression.ebnf`. Then read `docs/DEVELOPMENT_BLUEPRINT.md` (architecture baseline; its language-mapping sections are historical), `docs/STATUS.md` (what is actually implemented, including the landed RFC-LANG-0002 migration), the relevant `spec/` files, `docs/adr/` for decisions at their date, `docs/contributor-guide.md`, and `tests/README.md` plus the conformance fixtures. Do not assume any current implementation or legacy Marqdo syntax is authoritative.
|
**Start here:** read `docs/architecture/RFC-LANG-0002-unified-semantics.md` — it is the single current language authority — and its normative summary `spec/mapping.md` + `spec/expression.ebnf`. Then read `docs/architecture/CURRENT.md` (the single current architecture overview, including the Engine / Host Contract / Native Host map), [ADR-0071](docs/adr/0071-engine-host-contract-boundary.md) (boundary rules and keep-in-workspace decision), `docs/STATUS.md` (what is actually implemented), the relevant `spec/` files, `docs/adr/` for decisions at their date, the developer entry point `docs/developers/README.md`, `docs/contributor-guide.md`, and `tests/README.md` plus the conformance fixtures. Do not assume any current implementation, legacy Marqdo syntax, historical planning document or old architecture gate is authoritative.
|
||||||
|
|
||||||
For next-phase work, the authoritative release policy for the current
|
For next-phase work, the authoritative release policy for the current
|
||||||
3.0 prerelease line is `docs/MARQDO_3_0_PRERELEASE_PLAN.md` (beta gates,
|
3.0 prerelease line is `docs/MARQDO_3_0_PRERELEASE_PLAN.md` (beta gates,
|
||||||
REL-01..REL-05, version axes, LTS conditions). `docs/STABLE_RELEASE_IMPLEMENTATION.md`
|
REL-01..REL-05, version axes, LTS conditions). The current architecture and
|
||||||
(stable gates G-A/G-B/G-C) is historical roadmap input for the later stable
|
dependency direction are owned by `docs/architecture/CURRENT.md` and
|
||||||
release; it does not override the 3.0 prerelease plan. Also read `docs/CORE_STABILIZATION_AND_ECOSYSTEM_GATE.md`
|
[ADR-0071](docs/adr/0071-engine-host-contract-boundary.md). The historical plans
|
||||||
(historical stabilization spec, baseline `0adebe4`), `docs/NEXT_PHASE_IMPLEMENTATION.md`
|
(`DEVELOPMENT_BLUEPRINT.md`, `NEXT_PHASE_IMPLEMENTATION.md`,
|
||||||
(M0.6 plan), `docs/EXTENSIBILITY_AUDIT.md` (E01–E16), `COMPATIBILITY.md` and
|
`STABLE_RELEASE_IMPLEMENTATION.md`, `CORE_STABILIZATION_AND_ECOSYSTEM_GATE.md`,
|
||||||
`docs/security-gate.md`. Older plans are historical input; the 3.0 prerelease plan is authoritative for
|
`EXTENSIBILITY_AUDIT.md`, `NEXT_RELEASE_CI_CONVERGENCE.md`) are archived design
|
||||||
current release decisions, and the stable-release spec applies only when the
|
history: read them with that status, do not use them as current requirements, and
|
||||||
project moves from beta to stable.
|
do not create a second running-status page. `COMPATIBILITY.md` and
|
||||||
None describes implemented behavior; re-check against HEAD and tests. `strict`
|
`docs/security-gate.md` remain current inputs. None describes implemented
|
||||||
remains fail-closed until G-C passes.
|
behavior; re-check against HEAD and tests. `strict` remains fail-closed until
|
||||||
|
G-C passes.
|
||||||
|
|
||||||
The stable-release spec also governs scope: do not add a top-level CLI command,
|
The stable-release spec also governs scope: do not add a top-level CLI command,
|
||||||
Knowledge/Proof/View special-casing, a second interpreter or a new package
|
Knowledge/Proof/View special-casing, a second interpreter or a new package
|
||||||
@@ -33,6 +34,8 @@ correctness and release evidence before expanding the surface.
|
|||||||
9. Side effects go through `CapabilityHost`; do not invent host bypasses for tests, plugins, math or foreign kernels. `check` and `inspect` cannot execute untrusted project code.
|
9. Side effects go through `CapabilityHost`; do not invent host bypasses for tests, plugins, math or foreign kernels. `check` and `inspect` cannot execute untrusted project code.
|
||||||
10. Language semantics, package format, ABI, authorization defaults or public CLI behavior changes require an ADR + tests + spec updates.
|
10. Language semantics, package format, ABI, authorization defaults or public CLI behavior changes require an ADR + tests + spec updates.
|
||||||
11. RFC-LANG-0002 is implemented by the frontend, `marqdo-expression`, IR lowering, runtime and the bundled stdlib. Keep `spec/`, implementation, fixtures, stdlib digest and docs in lockstep; there is no legacy mapper or per-file syntax switch to fall back to. Do not make a release claim beyond the evidence recorded in `docs/STATUS.md`.
|
11. RFC-LANG-0002 is implemented by the frontend, `marqdo-expression`, IR lowering, runtime and the bundled stdlib. Keep `spec/`, implementation, fixtures, stdlib digest and docs in lockstep; there is no legacy mapper or per-file syntax switch to fall back to. Do not make a release claim beyond the evidence recorded in `docs/STATUS.md`.
|
||||||
|
12. The language engine depends on the neutral `marqdo-host-contract` only; it must never link `marqdo-host`, the sandbox, foreign kernels, the plugin loader/worker, package or CLI in normal/build dependencies. `marqdo-host-contract` depends on `Value`/`Span` only. The native host implements the contract and must not depend back on the runtime/frontend/IR. The plugin ABI crate is a contract (no `dlopen`/worker/manifest execution); the SDK consumes the contract only. CLI is the one assembly point. This is enforced by `tools/ci/check_dependency_boundaries.py`, `tools/ci/check_engine_boundary.py`, `tools/ci/check_plugin_sdk.py` and `crates/cli/tests/architecture_boundaries.rs`; see ADR-0071.
|
||||||
|
13. Do not create empty candidate repositories (for example `marqdo-engine`/`marqdo-host`/`marqdo-cli-*`) to "solve" architecture. A repository split requires the issue #13 §9.2 evidence and a separate accepted ADR; "keep in workspace" is a valid recorded decision. The plugin SDK stays in this CLI workspace as a contract-only crate (ADR-0073); do not re-create an independent SDK repository, mirror or submodule for the pre-stable line. Do not add a second Host trait, Value encoding, wire/RPC engine protocol or compatibility re-export path.
|
||||||
|
|
||||||
## Pre-stable protocol changes
|
## Pre-stable protocol changes
|
||||||
|
|
||||||
@@ -51,7 +54,7 @@ closing a protocol replacement issue.
|
|||||||
2. Update the normative spec **in place** first; there is never a second active syntax spec.
|
2. Update the normative spec **in place** first; there is never a second active syntax spec.
|
||||||
3. Add a small `.mq.md` positive/negative conformance fixture and define the expected Markdown AST, execution IR and diagnostics.
|
3. Add a small `.mq.md` positive/negative conformance fixture and define the expected Markdown AST, execution IR and diagnostics.
|
||||||
4. Implement only the smallest module that satisfies this fixture. Keep Markdown parser, semantic mapper, expression parser, runtime and host separated.
|
4. Implement only the smallest module that satisfies this fixture. Keep Markdown parser, semantic mapper, expression parser, runtime and host separated.
|
||||||
5. Run formatting, clippy, unit tests, golden tests and relevant security/ABI compatibility tests (`cargo fmt --check`, `cargo clippy --workspace --all-targets -- -D warnings`, `cargo test --workspace`, `cargo test -p marqdo-cli`).
|
5. Run formatting, clippy, unit tests, golden tests, the architecture/dependency gates and relevant security/ABI compatibility tests (`cargo fmt --check`, `cargo clippy --workspace --all-targets -- -D warnings`, `cargo test --workspace`, `cargo test -p marqdo-cli`, `python3 tools/ci/check_dependency_boundaries.py`, `python3 tools/ci/check_engine_boundary.py`, `python3 tools/ci/check_plugin_sdk.py`).
|
||||||
6. Write the tradeoff and state of completion in the PR. Never say a feature is finished because a design example looks executable. Update `spec/` and `docs/STATUS.md` when behavior or status changes; the docs describe what the code does and flag divergences explicitly.
|
6. Write the tradeoff and state of completion in the PR. Never say a feature is finished because a design example looks executable. Update `spec/` and `docs/STATUS.md` when behavior or status changes; the docs describe what the code does and flag divergences explicitly.
|
||||||
|
|
||||||
## Unresolved design topics
|
## Unresolved design topics
|
||||||
|
|||||||
+64
-12
@@ -4,8 +4,9 @@ All notable changes to the Marqdo CLI workspace. Published prereleases:
|
|||||||
`3.0.0-beta.1` (2026-11-22, source
|
`3.0.0-beta.1` (2026-11-22, source
|
||||||
`2c7c4f31e7a388d3fcfa717a77067e696ed13854`),
|
`2c7c4f31e7a388d3fcfa717a77067e696ed13854`),
|
||||||
`3.0.0-rc.1` (source `f7a5a7b0163bf5229ed09adfffd892f9899e6667`) and
|
`3.0.0-rc.1` (source `f7a5a7b0163bf5229ed09adfffd892f9899e6667`) and
|
||||||
`3.0.0-rc.2` (source `9149ee40a48fcda692c5c112f66c465487d13dfb`); the next
|
`3.0.0-rc.2` (source `9149ee40a48fcda692c5c112f66c465487d13dfb`) and
|
||||||
section collects changes for the current `3.0.0-rc.3` candidate. Current
|
`3.0.0-rc.3` (2026-11-24, source `1e2a045cc78bf40972181abb44e7117c56cf4401`); the section below is the current
|
||||||
|
release record. Current
|
||||||
protocol contracts are Analysis v3, Observation v1, CLI Tool revision 1,
|
protocol contracts are Analysis v3, Observation v1, CLI Tool revision 1,
|
||||||
Plugin ABI v1, Foreign wire v1, Provider manifest v2 and lock v4; independent
|
Plugin ABI v1, Foreign wire v1, Provider manifest v2 and lock v4; independent
|
||||||
package versions (including the bundled stdlib `0.1.0`) are versioned
|
package versions (including the bundled stdlib `0.1.0`) are versioned
|
||||||
@@ -13,7 +14,53 @@ separately and do not follow the product version. Dates use ISO 8601.
|
|||||||
Older sections are release records: a retired option or spec they name is
|
Older sections are release records: a retired option or spec they name is
|
||||||
available at its tagged commit, not in the current tree.
|
available at its tagged commit, not in the current tree.
|
||||||
|
|
||||||
## 3.0.0-rc.3 (candidate)
|
## 3.0.0-rc.4 (2026-11-25)
|
||||||
|
|
||||||
|
- The Rust workspace, CLI version output and protocol producers report
|
||||||
|
`3.0.0-rc.4`; the supported platform remains Linux x86_64 on glibc 2.39 and
|
||||||
|
the locked Rust minimum remains 1.89. Released as tag `v3.0.0-rc.4` at
|
||||||
|
`452e9a32bd9e40dba427d4180691c58bab74449e`.
|
||||||
|
|
||||||
|
### Closed public Analysis boundary — issue #10 (breaking in place)
|
||||||
|
|
||||||
|
Executed policy: [ADR-0069](docs/adr/0069-public-analysis-boundary.md), replacing
|
||||||
|
`marqdo.analysis` revision 3 in place under ADR-0068. There is no old reader,
|
||||||
|
version negotiation or fallback; a same-revision artifact that lacks a current
|
||||||
|
required field is rejected and must be regenerated.
|
||||||
|
|
||||||
|
- **Document facts are public.** `modules[].source` carries the exact UTF-8
|
||||||
|
source already read by the loader and `modules[].document` is the canonical
|
||||||
|
Markdown AST in the public shape shared with `inspect --ast`. Consumers no
|
||||||
|
longer parse Markdown a second time or read package-cache paths.
|
||||||
|
- **Heading scope is one index.** Units expose the structured `path`, parent,
|
||||||
|
effective mode, mode origin and source unit, the heading span and the complete
|
||||||
|
section span. The root covers the whole source including a BOM. Exec H2
|
||||||
|
function ownership stays explicit.
|
||||||
|
- **Entry and snapshot identity are explicit.** `project.entry_module_id`,
|
||||||
|
captured `manifest_digest`/`lock_digest`, stdlib identity and the static
|
||||||
|
extension identities used by preparation are part of the artifact. The
|
||||||
|
post-preparation lock re-read and its silent empty digest on IO failure are
|
||||||
|
gone.
|
||||||
|
- **One document-link resolver.** Analysis `references`, `check --refs` and
|
||||||
|
`inspect --refs` share one pure resolver and explicit catalogs. It reports
|
||||||
|
`resolved`, `not_loaded`, `missing`, `ambiguous`, `external`, `outside_scope`
|
||||||
|
or `invalid`; ordinary Analysis never opens a link target and a same-document
|
||||||
|
anchor names the real source module. The duplicate `commands.rs` resolver is
|
||||||
|
deleted.
|
||||||
|
- **Calls stay bound once.** Static call records keep the single prepared
|
||||||
|
binding table and now expose target kind, exact function/builtin/plugin target
|
||||||
|
and a reason for unresolved calls. Plugin targets carry only their verified
|
||||||
|
static owner; no plugin function is fabricated.
|
||||||
|
- **Output is private and atomic.** `--emit` writes owner-only exclusive bytes
|
||||||
|
through a temporary file and rename, and refuses to overwrite a loaded source,
|
||||||
|
manifest, lock file, directory, symlink or hard link to an input.
|
||||||
|
- **Independent consumers are the gate.** The Python Analysis consumer performs
|
||||||
|
semantic validation in addition to JSON Schema; mutation fixtures reject
|
||||||
|
missing current fields, tampered source/digests/spans, cycles, wrong owners
|
||||||
|
and invalid reference/nullability combinations. View-, lint- and
|
||||||
|
knowledge-like fixtures drive the real installed CLI.
|
||||||
|
|
||||||
|
## 3.0.0-rc.3 (2026-11-24)
|
||||||
|
|
||||||
- The Rust workspace, CLI version output and protocol producers report
|
- The Rust workspace, CLI version output and protocol producers report
|
||||||
`3.0.0-rc.3`. The locked workspace requires Rust 1.89 and targets Linux
|
`3.0.0-rc.3`. The locked workspace requires Rust 1.89 and targets Linux
|
||||||
@@ -110,15 +157,20 @@ Migration for consumers:
|
|||||||
- `crates/cli/tests/architecture_boundaries.rs` forbids a second worker
|
- `crates/cli/tests/architecture_boundaries.rs` forbids a second worker
|
||||||
framing implementation and pins the workspace layer list;
|
framing implementation and pins the workspace layer list;
|
||||||
`docs_consistency` keeps one current overview and resolving links.
|
`docs_consistency` keeps one current overview and resolving links.
|
||||||
- Same-SHA Linux CI, the deterministic archive build, the from-archive smoke,
|
- Same-SHA Linux CI ([pipeline #80](https://ci.cflmy.cn/repos/1/pipeline/80)),
|
||||||
the cold-install container check and the frozen external conformance suite
|
the archive build, the from-archive smoke, the cold-install container check
|
||||||
(fixtures at `015ff8ac15417b7ebbdb31ce2be2dab5362a1eba`) are recorded in the
|
and the frozen external conformance suite (fixtures at
|
||||||
per-gate evidence bound to the release SHA; see
|
`015ff8ac15417b7ebbdb31ce2be2dab5362a1eba`, 7/7) are recorded in the
|
||||||
[`docs/releasing.md`](docs/releasing.md) and [`docs/STATUS.md`](docs/STATUS.md).
|
per-gate manifest
|
||||||
- The RC strict-L1 disposable-VM lane and the G4 shared-node comparison
|
[`docs/evidence/ci/1e2a045cc78bf40972181abb44e7117c56cf4401/manifest.json`](docs/evidence/ci/1e2a045cc78bf40972181abb44e7117c56cf4401/manifest.json)
|
||||||
(maintainer-approved `WARN` for this named RC, with the environment and
|
(`RC_RELEASE_CANDIDATE`).
|
||||||
limits recorded in the release notes) complete the RC gate set; the archive
|
- The RC strict-L1 disposable-VM lane passed on the tagged SHA and the
|
||||||
sha256 for the tagged SHA is published with the release assets.
|
published archive was re-verified in that guest; see
|
||||||
|
[`docs/evidence/2026-11-24-rc.3-release.md`](docs/evidence/2026-11-24-rc.3-release.md).
|
||||||
|
G4 is a maintainer-approved shared-node `WARN` for this named RC (three
|
||||||
|
paired runs, no p50 threshold breach), with the environment and limits in the
|
||||||
|
release notes. Release:
|
||||||
|
https://git.cflmy.cn/cflmy/marqdo-cli/releases/tag/v3.0.0-rc.3.
|
||||||
|
|
||||||
## 3.0.0-rc.2 (candidate)
|
## 3.0.0-rc.2 (candidate)
|
||||||
|
|
||||||
|
|||||||
+29
-22
@@ -1,17 +1,22 @@
|
|||||||
# Compatibility and support matrix
|
# Compatibility and support matrix
|
||||||
|
|
||||||
Snapshot: candidate product version **`3.0.0-rc.3`** (prerelease). The last
|
Snapshot: product version **`3.0.0-rc.4`** (prerelease, released 2026-11-25).
|
||||||
published prerelease is `3.0.0-rc.2` at source SHA
|
Tag `v3.0.0-rc.4` at source SHA
|
||||||
`9149ee40a48fcda692c5c112f66c465487d13dfb`. This file records what was
|
`452e9a32bd9e40dba427d4180691c58bab74449e`; release
|
||||||
actually verified and separates it from what is only implemented. The
|
https://git.cflmy.cn/cflmy/marqdo-cli/releases/tag/v3.0.0-rc.4. The previous
|
||||||
|
release is `3.0.0-rc.3` at source SHA
|
||||||
|
`1e2a045cc78bf40972181abb44e7117c56cf4401`; its evidence remains under
|
||||||
|
[`docs/evidence/`](docs/evidence/2026-11-24-rc.3-release.md). This file records
|
||||||
|
what was actually verified and separates it from what is only implemented. The
|
||||||
supported release platform is **Linux x86_64 (glibc 2.39)**; everything else is
|
supported release platform is **Linux x86_64 (glibc 2.39)**; everything else is
|
||||||
experimental and not claimed for this prerelease. Executed status and
|
experimental and not claimed for this prerelease. Executed status and SHA-bound
|
||||||
SHA-bound evidence are in [`docs/STATUS.md`](docs/STATUS.md) and under
|
evidence are in [`docs/STATUS.md`](docs/STATUS.md) and
|
||||||
[`docs/evidence/`](docs/evidence/extension/README.md).
|
[`docs/evidence/`](docs/evidence/).
|
||||||
|
|
||||||
The `3.0.0-rc.3` candidate includes the post-beta protocol convergence below.
|
The `3.0.0-rc.4` release includes the post-beta protocol convergence and the
|
||||||
See the [RC acceptance procedure](docs/releasing.md). The platform evidence
|
closed public Analysis boundary below. See the
|
||||||
table records the beta, rc.1/rc.2 and candidate verification.
|
[RC acceptance procedure](docs/releasing.md). The platform evidence table
|
||||||
|
records the beta, rc.1/rc.2/rc.3 and rc.4 candidate verification.
|
||||||
|
|
||||||
## Language source syntax (breaking change)
|
## Language source syntax (breaking change)
|
||||||
|
|
||||||
@@ -51,7 +56,7 @@ Consequences for compatibility:
|
|||||||
|
|
||||||
## Post-`3.0.0-beta.1` boundary changes (RFC-EXT-0003)
|
## Post-`3.0.0-beta.1` boundary changes (RFC-EXT-0003)
|
||||||
|
|
||||||
These landed after the beta tag and **are included in the `3.0.0-rc.3` candidate**; they are
|
These landed after the beta tag and **are included in the `3.0.0-rc.4` candidate**; they are
|
||||||
intentional beta-line incompatibilities. Frozen decisions: ADR-0060..0063; executed
|
intentional beta-line incompatibilities. Frozen decisions: ADR-0060..0063; executed
|
||||||
evidence: [`docs/evidence/2026-11-22-rfc-ext-0003-core-hardcoding.md`](docs/evidence/2026-11-22-rfc-ext-0003-core-hardcoding.md).
|
evidence: [`docs/evidence/2026-11-22-rfc-ext-0003-core-hardcoding.md`](docs/evidence/2026-11-22-rfc-ext-0003-core-hardcoding.md).
|
||||||
|
|
||||||
@@ -86,7 +91,7 @@ consume this candidate's `check --emit` output.
|
|||||||
| Surface | Version | Compatibility rule |
|
| Surface | Version | Compatibility rule |
|
||||||
|---|---|---|
|
|---|---|---|
|
||||||
| Markdown profile | `marqdo.md.v1` | Frozen parser/options. The RFC-LANG-0002 mapping rewrite keeps this profile; the source-language break is tracked above, not by a new profile id. |
|
| Markdown profile | `marqdo.md.v1` | Frozen parser/options. The RFC-LANG-0002 mapping rewrite keeps this profile; the source-language break is tracked above, not by a new profile id. |
|
||||||
| Language / CLI | `3.0.0-rc.3` (candidate) | SemVer prerelease: breaking changes inside the 3.0 beta line are allowed and announced in the changelog. The `.mq.md` source language changed incompatibly (RFC-LANG-0002); there is no old-syntax execution path or downgrade. CLI flags may change with a changelog note; `strict` refusal is contractual. |
|
| Language / CLI | `3.0.0-rc.4` (candidate) | SemVer prerelease: breaking changes inside the 3.0 beta line are allowed and announced in the changelog. The `.mq.md` source language changed incompatibly (RFC-LANG-0002); there is no old-syntax execution path or downgrade. CLI flags may change with a changelog note; `strict` refusal is contractual. |
|
||||||
| `marqdo.lock` | v4 | v3 is rejected with an explicit `marqdo lock` migration error; v1/v2 are rejected with a relock instruction; `run`/`call`/`check` never rewrite or fetch the lock. `extensions:` records manifest/artifact identity (integrity, not publisher auth). |
|
| `marqdo.lock` | v4 | v3 is rejected with an explicit `marqdo lock` migration error; v1/v2 are rejected with a relock instruction; `run`/`call`/`check` never rewrite or fetch the lock. `extensions:` records manifest/artifact identity (integrity, not publisher auth). |
|
||||||
| Analysis | v3 | One writer and one current major for every project, including projects without loop transfers. Consumers reject other majors; the retired v2 selector, schema and documents are gone (ADR-0068). |
|
| Analysis | v3 | One writer and one current major for every project, including projects without loop transfers. Consumers reject other majors; the retired v2 selector, schema and documents are gone (ADR-0068). |
|
||||||
| Observation | v1 | One `run_id`/`seq` event sequence per execution, delivered as JSONL, JSON snapshot or file snapshot from the same run. Values are opt-in and bounded; consumers reject other identifiers (spec/observation.md). |
|
| Observation | v1 | One `run_id`/`seq` event sequence per execution, delivered as JSONL, JSON snapshot or file snapshot from the same run. Values are opt-in and bounded; consumers reject other identifiers (spec/observation.md). |
|
||||||
@@ -117,7 +122,7 @@ portable/tested locally but the native platform lane has not run here;
|
|||||||
| Official stdlib public aliases (print de-magic; byte-identical output) | PASS | UNVERIFIED | UNVERIFIED |
|
| Official stdlib public aliases (print de-magic; byte-identical output) | PASS | UNVERIFIED | UNVERIFIED |
|
||||||
| Resource Provider v2 CLI (`--provider`/`--allow-provider`, worker helper) | PASS (linux/x86_64; real C sensor + helper) | **FAIL-CLOSED** (`ext.platform_unsupported`) | **UNSUPPORTED** |
|
| Resource Provider v2 CLI (`--provider`/`--allow-provider`, worker helper) | PASS (linux/x86_64; real C sensor + helper) | **FAIL-CLOSED** (`ext.platform_unsupported`) | **UNSUPPORTED** |
|
||||||
| Capability handler registry (`fs.read` handler, audit, unavailable) | PASS | UNVERIFIED | UNVERIFIED |
|
| Capability handler registry (`fs.read` handler, audit, unavailable) | PASS | UNVERIFIED | UNVERIFIED |
|
||||||
| External conformance repository (`marqdo-extension-conformance`, frozen CLI) | PASS (`--release` binary sha256 `28e3776d…`, fixture repo `e4b7352c…`; see `docs/evidence/extension/6a7bb983.../manifest.json`) | UNVERIFIED | UNVERIFIED |
|
| External conformance repository (`marqdo-extension-conformance`, frozen CLI) | PASS (7/7 categories against the published archive, fixture repo `015ff8ac…`; see the rc.3 evidence bundle) | UNVERIFIED | UNVERIFIED |
|
||||||
| Analysis v3 + Observation v1 + Python consumers | PASS (same-SHA CI contract lane and archive smoke; independent consumers) | UNVERIFIED | UNVERIFIED |
|
| Analysis v3 + Observation v1 + Python consumers | PASS (same-SHA CI contract lane and archive smoke; independent consumers) | UNVERIFIED | UNVERIFIED |
|
||||||
| CLI Tool revision 1 + independent consumers | PASS | UNVERIFIED | UNVERIFIED |
|
| CLI Tool revision 1 + independent consumers | PASS | UNVERIFIED | UNVERIFIED |
|
||||||
| Native ABI (`plugin inspect`, trusted call) | PASS (C fixture) | UNVERIFIED (host-native fixture) | **UNSUPPORTED** |
|
| Native ABI (`plugin inspect`, trusted call) | PASS (C fixture) | UNVERIFIED (host-native fixture) | **UNSUPPORTED** |
|
||||||
@@ -194,12 +199,14 @@ the Windows C ABI/provider paths remain fail-closed.
|
|||||||
|
|
||||||
## Release decision
|
## Release decision
|
||||||
|
|
||||||
**`3.0.0-rc.3` prerelease candidate — Linux x86_64 only.** The RC profile in
|
**`3.0.0-rc.4` prerelease — released as a Linux x86_64 RC.** The RC profile in
|
||||||
[`docs/MARQDO_3_0_PRERELEASE_PLAN.md`](docs/MARQDO_3_0_PRERELEASE_PLAN.md) §3 is
|
[`docs/MARQDO_3_0_PRERELEASE_PLAN.md`](docs/MARQDO_3_0_PRERELEASE_PLAN.md) §3 was
|
||||||
used, not the stable profile: Linux is the only supported platform,
|
used: Linux is the only supported platform, macOS/Windows are UNSUPPORTED for
|
||||||
macOS/Windows are declared UNSUPPORTED for this scope, strict L1 requires
|
this scope, strict L1 has same-SHA disposable-VM evidence, and G4 performance is
|
||||||
same-SHA disposable-VM evidence and G4 performance is recorded as a
|
a maintainer-approved shared-node `WARN` for this named RC only. The aggregate
|
||||||
maintainer-approved shared-node `WARN` for this named RC. The aggregate decision
|
decision and per-gate evidence are in
|
||||||
and per-gate evidence are bound to the candidate SHA in
|
[`docs/evidence/ci/1e2a045cc78bf40972181abb44e7117c56cf4401/manifest.json`](docs/evidence/ci/1e2a045cc78bf40972181abb44e7117c56cf4401/manifest.json)
|
||||||
[`docs/STATUS.md`](docs/STATUS.md) and the release assets. A prerelease does not
|
(`RC_RELEASE_CANDIDATE`) and the release assets; see
|
||||||
imply stable `3.0.0` or LTS; the stable gate remains stricter and separate.
|
[`docs/evidence/2026-11-24-rc.3-release.md`](docs/evidence/2026-11-24-rc.3-release.md).
|
||||||
|
A prerelease does not imply stable `3.0.0` or LTS; the stable gate remains
|
||||||
|
stricter and separate.
|
||||||
Generated
+31
-22
@@ -412,7 +412,7 @@ checksum = "32a66949e030da00e8c7d4434b251670a91556f4144941d37452769c25d58a53"
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "marqdo-cli"
|
name = "marqdo-cli"
|
||||||
version = "3.0.0-rc.3"
|
version = "3.0.0-rc.4"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"clap",
|
"clap",
|
||||||
"hex",
|
"hex",
|
||||||
@@ -420,6 +420,7 @@ dependencies = [
|
|||||||
"marqdo-foreign",
|
"marqdo-foreign",
|
||||||
"marqdo-frontend",
|
"marqdo-frontend",
|
||||||
"marqdo-host",
|
"marqdo-host",
|
||||||
|
"marqdo-host-contract",
|
||||||
"marqdo-ir",
|
"marqdo-ir",
|
||||||
"marqdo-markdown",
|
"marqdo-markdown",
|
||||||
"marqdo-package",
|
"marqdo-package",
|
||||||
@@ -438,7 +439,7 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "marqdo-expression"
|
name = "marqdo-expression"
|
||||||
version = "3.0.0-rc.3"
|
version = "3.0.0-rc.4"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"marqdo-span",
|
"marqdo-span",
|
||||||
"num-bigint",
|
"num-bigint",
|
||||||
@@ -449,7 +450,7 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "marqdo-foreign"
|
name = "marqdo-foreign"
|
||||||
version = "3.0.0-rc.3"
|
version = "3.0.0-rc.4"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"hex",
|
"hex",
|
||||||
"libc",
|
"libc",
|
||||||
@@ -465,7 +466,7 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "marqdo-frontend"
|
name = "marqdo-frontend"
|
||||||
version = "3.0.0-rc.3"
|
version = "3.0.0-rc.4"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"marqdo-expression",
|
"marqdo-expression",
|
||||||
"marqdo-ir",
|
"marqdo-ir",
|
||||||
@@ -480,13 +481,15 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "marqdo-host"
|
name = "marqdo-host"
|
||||||
version = "3.0.0-rc.3"
|
version = "3.0.0-rc.4"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"flate2",
|
"flate2",
|
||||||
"getrandom 0.4.3",
|
"getrandom 0.4.3",
|
||||||
"glob",
|
"glob",
|
||||||
|
"hex",
|
||||||
"libloading",
|
"libloading",
|
||||||
"marqdo-foreign",
|
"marqdo-foreign",
|
||||||
|
"marqdo-host-contract",
|
||||||
"marqdo-plugin-abi",
|
"marqdo-plugin-abi",
|
||||||
"marqdo-sandbox",
|
"marqdo-sandbox",
|
||||||
"marqdo-span",
|
"marqdo-span",
|
||||||
@@ -499,13 +502,23 @@ dependencies = [
|
|||||||
"rustls-pemfile",
|
"rustls-pemfile",
|
||||||
"serde",
|
"serde",
|
||||||
"serde_json",
|
"serde_json",
|
||||||
|
"serde_yaml",
|
||||||
|
"sha2",
|
||||||
"tempfile",
|
"tempfile",
|
||||||
"thiserror",
|
"thiserror",
|
||||||
]
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "marqdo-host-contract"
|
||||||
|
version = "3.0.0-rc.4"
|
||||||
|
dependencies = [
|
||||||
|
"marqdo-span",
|
||||||
|
"marqdo-value",
|
||||||
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "marqdo-ir"
|
name = "marqdo-ir"
|
||||||
version = "3.0.0-rc.3"
|
version = "3.0.0-rc.4"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"marqdo-expression",
|
"marqdo-expression",
|
||||||
"marqdo-span",
|
"marqdo-span",
|
||||||
@@ -515,7 +528,7 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "marqdo-markdown"
|
name = "marqdo-markdown"
|
||||||
version = "3.0.0-rc.3"
|
version = "3.0.0-rc.4"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"comrak",
|
"comrak",
|
||||||
"marqdo-span",
|
"marqdo-span",
|
||||||
@@ -526,7 +539,7 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "marqdo-package"
|
name = "marqdo-package"
|
||||||
version = "3.0.0-rc.3"
|
version = "3.0.0-rc.4"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"hex",
|
"hex",
|
||||||
"semver",
|
"semver",
|
||||||
@@ -540,23 +553,17 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "marqdo-plugin-abi"
|
name = "marqdo-plugin-abi"
|
||||||
version = "3.0.0-rc.3"
|
version = "3.0.0-rc.4"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"hex",
|
|
||||||
"libloading",
|
|
||||||
"marqdo-span",
|
|
||||||
"marqdo-value",
|
"marqdo-value",
|
||||||
"marqdo-worker-ipc",
|
|
||||||
"serde",
|
"serde",
|
||||||
"serde_json",
|
"serde_json",
|
||||||
"serde_yaml",
|
|
||||||
"sha2",
|
|
||||||
"thiserror",
|
"thiserror",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "marqdo-plugin-sdk"
|
name = "marqdo-plugin-sdk"
|
||||||
version = "3.0.0-rc.3"
|
version = "3.0.0-rc.4"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"marqdo-plugin-abi",
|
"marqdo-plugin-abi",
|
||||||
"serde",
|
"serde",
|
||||||
@@ -565,10 +572,11 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "marqdo-provider-worker"
|
name = "marqdo-provider-worker"
|
||||||
version = "3.0.0-rc.3"
|
version = "3.0.0-rc.4"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"libloading",
|
"libloading",
|
||||||
"marqdo-host",
|
"marqdo-host",
|
||||||
|
"marqdo-host-contract",
|
||||||
"marqdo-sandbox",
|
"marqdo-sandbox",
|
||||||
"marqdo-value",
|
"marqdo-value",
|
||||||
"marqdo-worker-ipc",
|
"marqdo-worker-ipc",
|
||||||
@@ -578,11 +586,12 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "marqdo-runtime"
|
name = "marqdo-runtime"
|
||||||
version = "3.0.0-rc.3"
|
version = "3.0.0-rc.4"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"marqdo-expression",
|
"marqdo-expression",
|
||||||
"marqdo-frontend",
|
"marqdo-frontend",
|
||||||
"marqdo-host",
|
"marqdo-host",
|
||||||
|
"marqdo-host-contract",
|
||||||
"marqdo-ir",
|
"marqdo-ir",
|
||||||
"marqdo-sandbox",
|
"marqdo-sandbox",
|
||||||
"marqdo-span",
|
"marqdo-span",
|
||||||
@@ -597,7 +606,7 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "marqdo-sandbox"
|
name = "marqdo-sandbox"
|
||||||
version = "3.0.0-rc.3"
|
version = "3.0.0-rc.4"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"libc",
|
"libc",
|
||||||
"serde",
|
"serde",
|
||||||
@@ -605,14 +614,14 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "marqdo-span"
|
name = "marqdo-span"
|
||||||
version = "3.0.0-rc.3"
|
version = "3.0.0-rc.4"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"serde",
|
"serde",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "marqdo-value"
|
name = "marqdo-value"
|
||||||
version = "3.0.0-rc.3"
|
version = "3.0.0-rc.4"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"marqdo-span",
|
"marqdo-span",
|
||||||
"num-bigint",
|
"num-bigint",
|
||||||
@@ -623,7 +632,7 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "marqdo-worker-ipc"
|
name = "marqdo-worker-ipc"
|
||||||
version = "3.0.0-rc.3"
|
version = "3.0.0-rc.4"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"serde_json",
|
"serde_json",
|
||||||
"thiserror",
|
"thiserror",
|
||||||
|
|||||||
+3
-1
@@ -13,6 +13,7 @@ members = [
|
|||||||
"crates/marqdo-worker-ipc",
|
"crates/marqdo-worker-ipc",
|
||||||
"crates/marqdo-plugin-sdk",
|
"crates/marqdo-plugin-sdk",
|
||||||
"crates/marqdo-host",
|
"crates/marqdo-host",
|
||||||
|
"crates/marqdo-host-contract",
|
||||||
"crates/marqdo-runtime",
|
"crates/marqdo-runtime",
|
||||||
"crates/marqdo-package",
|
"crates/marqdo-package",
|
||||||
"crates/marqdo-sandbox",
|
"crates/marqdo-sandbox",
|
||||||
@@ -20,7 +21,7 @@ members = [
|
|||||||
]
|
]
|
||||||
|
|
||||||
[workspace.package]
|
[workspace.package]
|
||||||
version = "3.0.0-rc.3"
|
version = "3.0.0-rc.4"
|
||||||
edition = "2021"
|
edition = "2021"
|
||||||
rust-version = "1.89"
|
rust-version = "1.89"
|
||||||
license = "Apache-2.0"
|
license = "Apache-2.0"
|
||||||
@@ -38,6 +39,7 @@ marqdo-foreign = { path = "crates/marqdo-foreign" }
|
|||||||
marqdo-plugin-abi = { path = "crates/marqdo-plugin-abi" }
|
marqdo-plugin-abi = { path = "crates/marqdo-plugin-abi" }
|
||||||
marqdo-worker-ipc = { path = "crates/marqdo-worker-ipc" }
|
marqdo-worker-ipc = { path = "crates/marqdo-worker-ipc" }
|
||||||
marqdo-host = { path = "crates/marqdo-host" }
|
marqdo-host = { path = "crates/marqdo-host" }
|
||||||
|
marqdo-host-contract = { path = "crates/marqdo-host-contract" }
|
||||||
marqdo-runtime = { path = "crates/marqdo-runtime" }
|
marqdo-runtime = { path = "crates/marqdo-runtime" }
|
||||||
marqdo-package = { path = "crates/marqdo-package" }
|
marqdo-package = { path = "crates/marqdo-package" }
|
||||||
marqdo-sandbox = { path = "crates/marqdo-sandbox" }
|
marqdo-sandbox = { path = "crates/marqdo-sandbox" }
|
||||||
|
|||||||
@@ -10,7 +10,7 @@ The official implementation is a Rust workspace; Python/Node are optional
|
|||||||
foreign kernels, never the compiler target.
|
foreign kernels, never the compiler target.
|
||||||
|
|
||||||
This repository is the new, independent Marqdo toolchain, now at product
|
This repository is the new, independent Marqdo toolchain, now at product
|
||||||
version **`3.0.0-rc.3`** in this checkout. It is **not** a compatibility rewrite of
|
version **`3.0.0-rc.4`** in this checkout. It is **not** a compatibility rewrite of
|
||||||
`cflmy/marqdo`; the old syntax, package format and plugin ABI v2 are not
|
`cflmy/marqdo`; the old syntax, package format and plugin ABI v2 are not
|
||||||
claimed to work here. See [docs/developers/](docs/developers/README.md) for the
|
claimed to work here. See [docs/developers/](docs/developers/README.md) for the
|
||||||
third-party entry point and `docs/MARQDO_3_0_PRERELEASE_PLAN.md` for the beta
|
third-party entry point and `docs/MARQDO_3_0_PRERELEASE_PLAN.md` for the beta
|
||||||
@@ -27,7 +27,10 @@ release policy.
|
|||||||
> [`docs/STATUS.md`](docs/STATUS.md) and
|
> [`docs/STATUS.md`](docs/STATUS.md) and
|
||||||
> [`docs/migration/README.md`](docs/migration/README.md).
|
> [`docs/migration/README.md`](docs/migration/README.md).
|
||||||
|
|
||||||
> **Published baseline: `3.0.0-beta.1` prerelease** —
|
> **Current release: `3.0.0-rc.4` prerelease** —
|
||||||
|
> [release](https://git.cflmy.cn/cflmy/marqdo-cli/releases/tag/v3.0.0-rc.4),
|
||||||
|
> source `452e9a32bd9e40dba427d4180691c58bab74449e`, Linux x86_64. The previous
|
||||||
|
> published baseline was `3.0.0-beta.1` —
|
||||||
> [release](https://git.cflmy.cn/cflmy/marqdo-cli/releases/tag/v3.0.0-beta.1),
|
> [release](https://git.cflmy.cn/cflmy/marqdo-cli/releases/tag/v3.0.0-beta.1),
|
||||||
> source `2c7c4f31e7a388d3fcfa717a77067e696ed13854`. The public beta target is **Linux x86_64 (glibc)**; macOS and Windows are experimental and not claimed, and the
|
> source `2c7c4f31e7a388d3fcfa717a77067e696ed13854`. The public beta target is **Linux x86_64 (glibc)**; macOS and Windows are experimental and not claimed, and the
|
||||||
> C ABI plugin/provider paths are Linux-only in this beta. The language
|
> C ABI plugin/provider paths are Linux-only in this beta. The language
|
||||||
@@ -46,8 +49,9 @@ release policy.
|
|||||||
CI: the source of truth is the Gitea remote
|
CI: the source of truth is the Gitea remote
|
||||||
[git.cflmy.cn/cflmy/marqdo-cli](https://git.cflmy.cn/cflmy/marqdo-cli) with
|
[git.cflmy.cn/cflmy/marqdo-cli](https://git.cflmy.cn/cflmy/marqdo-cli) with
|
||||||
Woodpecker at [ci.cflmy.cn](https://ci.cflmy.cn); [`.woodpecker/main.yml`](.woodpecker/main.yml)
|
Woodpecker at [ci.cflmy.cn](https://ci.cflmy.cn); [`.woodpecker/main.yml`](.woodpecker/main.yml)
|
||||||
runs fmt, clippy, workspace tests with `--locked`, the Windows cross-target
|
runs fmt, clippy, workspace tests with `--locked`, the dependency-direction and
|
||||||
compile gate and a release build of both binaries. The strict OS-isolation lane
|
engine-independence gates, the plugin SDK consumption gate, the Windows
|
||||||
|
cross-target compile gate and a release build of both binaries. The strict OS-isolation lane
|
||||||
requires the disposable VM described in [docs/ci.md](docs/ci.md); a GitHub
|
requires the disposable VM described in [docs/ci.md](docs/ci.md); a GitHub
|
||||||
mirror is not used as the authoritative lane for this beta.
|
mirror is not used as the authoritative lane for this beta.
|
||||||
|
|
||||||
@@ -60,6 +64,30 @@ cargo build -p marqdo-cli
|
|||||||
# binary: target/debug/marqdo (or $CARGO_TARGET_DIR/debug/marqdo)
|
# binary: target/debug/marqdo (or $CARGO_TARGET_DIR/debug/marqdo)
|
||||||
```
|
```
|
||||||
|
|
||||||
|
The CLI and Provider Worker compile without any stdlib sources. The accepted
|
||||||
|
standard-library Bundle is assembled by the ecosystem repository
|
||||||
|
(`cflmy/marqdo`) from pinned component gitlinks; this repository has **no**
|
||||||
|
`stdlib/` source tree and no compile-time source fallback (ADR-0070 Phase B).
|
||||||
|
Every product test, package step and release names one explicit, verified
|
||||||
|
Bundle; `MARQDO_STDLIB_DIR` remains the explicit runtime override and the
|
||||||
|
installed `stdlib/` next to the binary is the default:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
cargo build --release --locked -p marqdo-cli -p marqdo-provider-worker
|
||||||
|
# CI/maintainers materialize the exact pinned Bundle (commit + gitlinks):
|
||||||
|
python3 tools/ci/fetch_ecosystem_bundle.py --out target/ecosystem-stdlib
|
||||||
|
python3 tools/stdlib/bundle.py --stdlib-dir target/ecosystem-stdlib --print-path
|
||||||
|
python3 tools/release/package.py --source-sha "$(git rev-parse HEAD)" \
|
||||||
|
--version <version> --stdlib-dir target/ecosystem-stdlib \
|
||||||
|
--bundle-pin tools/stdlib/bundle-pin.json
|
||||||
|
```
|
||||||
|
|
||||||
|
Product tests and CI set `MARQDO_TEST_STDLIB_BUNDLE` to that materialized
|
||||||
|
Bundle; without it the product lane fails closed instead of reaching a source
|
||||||
|
tree.
|
||||||
|
|
||||||
|
See [`docs/releasing.md`](docs/releasing.md) for the full procedure.
|
||||||
|
|
||||||
## Quickstart
|
## Quickstart
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
@@ -152,15 +180,17 @@ rules are [`RFC-LANG-0002`](docs/architecture/RFC-LANG-0002-unified-semantics.md
|
|||||||
`{ok:false,code,message}` as an ordinary Map, with a `.mq.md` first-fit
|
`{ok:false,code,message}` as an ordinary Map, with a `.mq.md` first-fit
|
||||||
free-list allocator demonstrating reuse, splitting and `alloc.no_space`
|
free-list allocator demonstrating reuse, splitting and `alloc.no_space`
|
||||||
recovery (ADR-0024). No `Result` type or exception syntax.
|
recovery (ADR-0024). No `Result` type or exception syntax.
|
||||||
* **Bundled stdlib + official print aliases (RFC-CM CM-A07/A10)** — offline
|
* **Bundled stdlib + official print aliases (RFC-CM CM-A07/A10)** — one
|
||||||
`stdlib/` with explicit `std:io`/`std:format`/`std:text` imports, SHA-256
|
offline, ecosystem-assembled Bundle (component-owned module sources) with
|
||||||
digest verification, Analysis identity and a frozen-CLI closure test; the
|
explicit `std:io`/`std:format`/`std:text` imports, SHA-256 digest
|
||||||
|
verification, Analysis identity and a frozen-CLI closure test; the
|
||||||
`.mq.md` print chain is the only execution path for `打印`/`print` on an official install (ADR-0031),
|
`.mq.md` print chain is the only execution path for `打印`/`print` on an official install (ADR-0031),
|
||||||
covering all 15 value types; `HostOp::Print` and the legacy formatter are
|
covering all 15 value types; `HostOp::Print` and the legacy formatter are
|
||||||
removed (ADR-0027/0028/0029/0030/0031).
|
removed (ADR-0027/0028/0029/0030/0031).
|
||||||
* **HTTP/1.1 framing in `.mq.md`** — `stdlib/net/http.mq.md` status/header/
|
* **HTTP/1.1 framing in `.mq.md`** — the `marqdo-ext-http` explicit Package
|
||||||
chunked parsing and request construction; a loopback TCP test runs a real
|
provides status/header/chunked parsing and request construction; the CLI
|
||||||
exchange (ADR-0034; no TLS/host HTTP claim).
|
keeps the generic TCP endpoint and a loopback round-trip test (ADR-0034; no
|
||||||
|
TLS/host HTTP claim).
|
||||||
* **Blocking TCP endpoint (RFC-CM P5 first slice)** — `resource.open("tcp",
|
* **Blocking TCP endpoint (RFC-CM P5 first slice)** — `resource.open("tcp",
|
||||||
"<ip>:<port>", ["read","write"])` with exact IP grants, project mode and
|
"<ip>:<port>", ["read","write"])` with exact IP grants, project mode and
|
||||||
5-second timeouts; DNS/TLS/UDP/server sockets excluded (ADR-0034).
|
5-second timeouts; DNS/TLS/UDP/server sockets excluded (ADR-0034).
|
||||||
@@ -291,17 +321,18 @@ crates/marqdo-ir module/unit/function/statement IR, builtin table
|
|||||||
crates/marqdo-frontend heading scopes, mapping, inference, static calls
|
crates/marqdo-frontend heading scopes, mapping, inference, static calls
|
||||||
crates/marqdo-foreign Python/Node one-shot kernel supervisor
|
crates/marqdo-foreign Python/Node one-shot kernel supervisor
|
||||||
crates/marqdo-sandbox mode parsing + platform isolation detection
|
crates/marqdo-sandbox mode parsing + platform isolation detection
|
||||||
crates/marqdo-plugin-abi C ABI v1 mirrors, manifest, artifacts, loader
|
crates/marqdo-host-contract neutral Host trait, HostOp, context and runtime facts
|
||||||
crates/marqdo-plugin-sdk Rust plugin SDK and entry macro
|
crates/marqdo-plugin-abi public C ABI v1 contract: layout, wire envelope, errors
|
||||||
crates/marqdo-host CapabilityHost, budgets, FS, foreign/plugin adapters, core resource kinds
|
crates/marqdo-plugin-sdk Rust plugin SDK and entry macro (contract-only)
|
||||||
crates/marqdo-runtime tree-walk interpreter
|
crates/marqdo-host Native Host: capability, resources, OS, plugin loader/worker
|
||||||
|
crates/marqdo-runtime tree-walk interpreter (depends only on the neutral contract)
|
||||||
crates/marqdo-package marqdo.yaml / marqdo.lock / root discovery
|
crates/marqdo-package marqdo.yaml / marqdo.lock / root discovery
|
||||||
crates/cli CLI composition root (binary `marqdo`)
|
crates/cli CLI composition root (binary `marqdo`)
|
||||||
include/ frozen plugin C ABI header
|
include/ frozen plugin C ABI header
|
||||||
spec/ normative language/format/ABI specs
|
spec/ normative language/format/ABI specs
|
||||||
docs/ blueprint, ADRs, status, contributor guide
|
docs/ blueprint, ADRs, status, contributor guide
|
||||||
examples/ runnable documents + multi-module + plugin demo
|
examples/ runnable documents + multi-module + plugin demo
|
||||||
tests/ conformance/negative corpus (see tests/README.md)
|
tests/ conformance/negative corpus, embedding consumer and SDK fixture
|
||||||
```
|
```
|
||||||
|
|
||||||
## Documentation index
|
## Documentation index
|
||||||
@@ -488,7 +519,7 @@ extensions. Lock v3 requires an explicit `marqdo lock` migration. See
|
|||||||
|
|
||||||
#### Official stdlib aliases, no print magic
|
#### Official stdlib aliases, no print magic
|
||||||
|
|
||||||
`打印`/`print` are declared in the verified `stdlib/stdlib.json`
|
`打印`/`print` are declared in the accepted Bundle's verified `stdlib.json`
|
||||||
(`public_aliases`, covered by `aliases_digest`) and bound as ordinary
|
(`public_aliases`, covered by `aliases_digest`) and bound as ordinary
|
||||||
`Marqdo` calls to `io.mq.md::写值` (ADR-0058). There is no
|
`Marqdo` calls to `io.mq.md::写值` (ADR-0058). There is no
|
||||||
`Program.print_override`, no AST-wide print scan and no runtime print branch;
|
`Program.print_override`, no AST-wide print scan and no runtime print branch;
|
||||||
|
|||||||
@@ -18,6 +18,7 @@ marqdo-frontend = { workspace = true }
|
|||||||
marqdo-foreign = { workspace = true }
|
marqdo-foreign = { workspace = true }
|
||||||
marqdo-plugin-abi = { workspace = true }
|
marqdo-plugin-abi = { workspace = true }
|
||||||
marqdo-host = { workspace = true }
|
marqdo-host = { workspace = true }
|
||||||
|
marqdo-host-contract = { workspace = true }
|
||||||
marqdo-runtime = { workspace = true }
|
marqdo-runtime = { workspace = true }
|
||||||
marqdo-package = { workspace = true }
|
marqdo-package = { workspace = true }
|
||||||
marqdo-sandbox = { workspace = true }
|
marqdo-sandbox = { workspace = true }
|
||||||
|
|||||||
@@ -1,653 +0,0 @@
|
|||||||
//! Public Analysis projection (spec/analysis.md).
|
|
||||||
//!
|
|
||||||
//! This is deliberately not a serde dump of `marqdo-ir`: the schema and node
|
|
||||||
//! kinds are the public contract, while internal Rust types may change. The
|
|
||||||
//! exporter is read-only and never executes a document, loads a plugin or
|
|
||||||
//! starts a foreign kernel.
|
|
||||||
|
|
||||||
use std::path::Path;
|
|
||||||
|
|
||||||
use marqdo_expression::{BinaryOp, Expr, UnaryOp};
|
|
||||||
use marqdo_ir::{Function, Module, ModuleId, PlaceTarget, Resource, SignatureKind, Stmt, UnitKind};
|
|
||||||
use marqdo_span::Span;
|
|
||||||
use serde_json::{json, Value};
|
|
||||||
use sha2::{Digest, Sha256};
|
|
||||||
|
|
||||||
use crate::loader::LoadedProject;
|
|
||||||
|
|
||||||
/// Schema name and version.
|
|
||||||
pub const SCHEMA: &str = "marqdo.analysis";
|
|
||||||
pub const SCHEMA_VERSION: u32 = 3;
|
|
||||||
|
|
||||||
/// Build the deterministic public projection.
|
|
||||||
pub fn build(project: &LoadedProject) -> Value {
|
|
||||||
let mut modules = Vec::new();
|
|
||||||
for (module_id, file) in &project.files {
|
|
||||||
let module = &file.analysis.module;
|
|
||||||
modules.push(json!({
|
|
||||||
"id": module_id.to_string(),
|
|
||||||
"package_instance_id": module_id.instance,
|
|
||||||
"relative_path": module_id.relative_path,
|
|
||||||
"source_digest": sha256_hex(file.source.as_bytes()),
|
|
||||||
"units": units_json(module),
|
|
||||||
"functions": module.functions.iter().map(function_json).collect::<Vec<_>>(),
|
|
||||||
"imports": module.imports.iter().map(|import| json!({
|
|
||||||
"alias": import.alias,
|
|
||||||
"target": import.target,
|
|
||||||
"span": import.span,
|
|
||||||
"resolved": project.program.resolve_import(module_id, &import.alias).map(ToString::to_string),
|
|
||||||
})).collect::<Vec<_>>(),
|
|
||||||
"references": reference_edges(project, module_id),
|
|
||||||
"calls": module.functions.iter().flat_map(|function| calls_json(project, module, function)).collect::<Vec<_>>(),
|
|
||||||
"resources": resources_json(module_id, module),
|
|
||||||
}));
|
|
||||||
}
|
|
||||||
modules.sort_by(|a, b| {
|
|
||||||
a.get("id")
|
|
||||||
.and_then(Value::as_str)
|
|
||||||
.cmp(&b.get("id").and_then(Value::as_str))
|
|
||||||
});
|
|
||||||
json!({
|
|
||||||
"schema": SCHEMA,
|
|
||||||
"schema_version": SCHEMA_VERSION,
|
|
||||||
"producer": {
|
|
||||||
"name": "marqdo",
|
|
||||||
"version": env!("CARGO_PKG_VERSION"),
|
|
||||||
"markdown_profile": "marqdo.md.v1",
|
|
||||||
},
|
|
||||||
"project": {
|
|
||||||
"root_id": project.identity.root_id(),
|
|
||||||
"identity_kind": project.identity.kind(),
|
|
||||||
"lock_digest": lock_digest(project),
|
|
||||||
"stdlib": project.stdlib.as_ref().map(|stdlib| json!({
|
|
||||||
"version": stdlib.version,
|
|
||||||
"digest": stdlib.digest,
|
|
||||||
"instance_id": stdlib.instance_id,
|
|
||||||
})),
|
|
||||||
},
|
|
||||||
"modules": modules,
|
|
||||||
"diagnostics": diagnostics_json(project),
|
|
||||||
})
|
|
||||||
}
|
|
||||||
|
|
||||||
/// Encode exactly the bytes written by `check --emit`.
|
|
||||||
fn encode(project: &LoadedProject) -> Result<Vec<u8>, String> {
|
|
||||||
serde_json::to_vec_pretty(&build(project))
|
|
||||||
.map_err(|error| format!("cannot encode analysis: {error}"))
|
|
||||||
}
|
|
||||||
|
|
||||||
/// SHA-256 of the exact emitted Analysis bytes.
|
|
||||||
pub fn digest(project: &LoadedProject) -> Result<String, String> {
|
|
||||||
encode(project).map(|bytes| format!("sha256:{}", sha256_hex(&bytes)))
|
|
||||||
}
|
|
||||||
|
|
||||||
/// Atomically write the projection. An error must not leave a stale success
|
|
||||||
/// artifact behind.
|
|
||||||
pub fn write(project: &LoadedProject, path: &Path) -> Result<(), String> {
|
|
||||||
let bytes = encode(project)?;
|
|
||||||
let parent = path
|
|
||||||
.parent()
|
|
||||||
.filter(|parent| !parent.as_os_str().is_empty())
|
|
||||||
.unwrap_or_else(|| Path::new("."));
|
|
||||||
std::fs::create_dir_all(parent)
|
|
||||||
.map_err(|error| format!("cannot create `{}`: {error}", parent.display()))?;
|
|
||||||
let temporary = parent.join(format!(
|
|
||||||
".{}.tmp-{}",
|
|
||||||
path.file_name()
|
|
||||||
.map(|name| name.to_string_lossy().to_string())
|
|
||||||
.unwrap_or_else(|| "analysis.json".to_string()),
|
|
||||||
std::process::id()
|
|
||||||
));
|
|
||||||
std::fs::write(&temporary, bytes)
|
|
||||||
.map_err(|error| format!("cannot write `{}`: {error}", temporary.display()))?;
|
|
||||||
if let Err(error) = std::fs::rename(&temporary, path) {
|
|
||||||
let _ = std::fs::remove_file(&temporary);
|
|
||||||
return Err(format!("cannot publish `{}`: {error}", path.display()));
|
|
||||||
}
|
|
||||||
Ok(())
|
|
||||||
}
|
|
||||||
|
|
||||||
fn lock_digest(project: &LoadedProject) -> Value {
|
|
||||||
let path = project.root.join(marqdo_package::LOCK_FILE);
|
|
||||||
match std::fs::read(path) {
|
|
||||||
Ok(bytes) => Value::String(format!("sha256:{}", sha256_hex(&bytes))),
|
|
||||||
Err(_) => Value::String(String::new()),
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
fn resources_json(module_id: &ModuleId, module: &Module) -> Vec<Value> {
|
|
||||||
let mut formula_index = 0usize;
|
|
||||||
let mut code_index = 0usize;
|
|
||||||
module
|
|
||||||
.resources
|
|
||||||
.iter()
|
|
||||||
.map(|resource| match resource {
|
|
||||||
Resource::Formula {
|
|
||||||
unit,
|
|
||||||
latex,
|
|
||||||
display,
|
|
||||||
span,
|
|
||||||
} => {
|
|
||||||
formula_index += 1;
|
|
||||||
json!({
|
|
||||||
"id": format!("{module_id}#resource:formula-{formula_index}"),
|
|
||||||
"module_id": module_id.to_string(),
|
|
||||||
"unit_id": unit.to_string(),
|
|
||||||
"kind": "formula",
|
|
||||||
"span": span_json(*span),
|
|
||||||
"content_digest": sha256_hex(latex.as_bytes()),
|
|
||||||
"language": null,
|
|
||||||
"display": display,
|
|
||||||
})
|
|
||||||
}
|
|
||||||
Resource::Code {
|
|
||||||
unit,
|
|
||||||
language,
|
|
||||||
source: _,
|
|
||||||
content_hash,
|
|
||||||
span,
|
|
||||||
} => {
|
|
||||||
code_index += 1;
|
|
||||||
json!({
|
|
||||||
"id": format!("{module_id}#resource:code-{code_index}"),
|
|
||||||
"module_id": module_id.to_string(),
|
|
||||||
"unit_id": unit.to_string(),
|
|
||||||
"kind": "code",
|
|
||||||
"span": span_json(*span),
|
|
||||||
"content_digest": content_hash,
|
|
||||||
"language": language,
|
|
||||||
})
|
|
||||||
}
|
|
||||||
})
|
|
||||||
.collect()
|
|
||||||
}
|
|
||||||
|
|
||||||
fn diagnostics_json(project: &LoadedProject) -> Vec<Value> {
|
|
||||||
project
|
|
||||||
.diagnostics
|
|
||||||
.iter()
|
|
||||||
.map(|item| {
|
|
||||||
let (line, column) = item
|
|
||||||
.line_col()
|
|
||||||
.map(|(line, column)| (Value::from(line), Value::from(column)))
|
|
||||||
.unwrap_or((Value::Null, Value::Null));
|
|
||||||
json!({
|
|
||||||
"module": item.module_id.to_string(),
|
|
||||||
"relative_path": item.module_id.relative_path,
|
|
||||||
"span": item.diagnostic.span.map(span_json),
|
|
||||||
"line": line,
|
|
||||||
"column": column,
|
|
||||||
"severity": if item.diagnostic.is_error() { "error" } else { "warning" },
|
|
||||||
"code": item.diagnostic.code,
|
|
||||||
"message": item.diagnostic.message,
|
|
||||||
"hints": item.diagnostic.hints,
|
|
||||||
})
|
|
||||||
})
|
|
||||||
.collect()
|
|
||||||
}
|
|
||||||
|
|
||||||
fn units_json(module: &Module) -> Vec<Value> {
|
|
||||||
module
|
|
||||||
.units
|
|
||||||
.iter()
|
|
||||||
.map(|unit| {
|
|
||||||
let kind = match unit.kind {
|
|
||||||
UnitKind::Root => "root",
|
|
||||||
UnitKind::Namespace => "namespace",
|
|
||||||
UnitKind::Function => "function",
|
|
||||||
UnitKind::Knowledge => "knowledge",
|
|
||||||
UnitKind::Section => "section",
|
|
||||||
};
|
|
||||||
json!({
|
|
||||||
"id": unit.id.to_string(),
|
|
||||||
"kind": kind,
|
|
||||||
"name": unit.name,
|
|
||||||
"level": unit.level,
|
|
||||||
"span": span_json(unit.span),
|
|
||||||
"function": unit.function.as_ref().map(ToString::to_string),
|
|
||||||
})
|
|
||||||
})
|
|
||||||
.collect()
|
|
||||||
}
|
|
||||||
|
|
||||||
fn function_json(function: &Function) -> Value {
|
|
||||||
json!({
|
|
||||||
"id": function.id.to_string(),
|
|
||||||
"unit_id": function.unit.to_string(),
|
|
||||||
"local_name": function.local_name,
|
|
||||||
"namespace": function.namespace,
|
|
||||||
"span": span_json(function.span),
|
|
||||||
"heading_span": span_json(function.heading_span),
|
|
||||||
"signature": {
|
|
||||||
"kind": match function.signature {
|
|
||||||
SignatureKind::Explicit => "explicit",
|
|
||||||
SignatureKind::Inferred => "inferred",
|
|
||||||
},
|
|
||||||
"params": function.params.iter().map(|param| json!({
|
|
||||||
"name": param.name,
|
|
||||||
"required": param.default.is_none(),
|
|
||||||
"type": param.type_annotation,
|
|
||||||
"default": param.default.as_ref().map(expr_json),
|
|
||||||
"span": span_json(param.span),
|
|
||||||
})).collect::<Vec<_>>(),
|
|
||||||
},
|
|
||||||
"effects": ["unknown"],
|
|
||||||
"body": function.body.iter().map(stmt_json).collect::<Vec<_>>(),
|
|
||||||
})
|
|
||||||
}
|
|
||||||
|
|
||||||
/// Project an assignment place. Local targets keep the v1 string form; the new
|
|
||||||
/// index target is an additive object so existing consumers that compare the
|
|
||||||
/// local `target` string are unaffected (Analysis v3, ADR-0022).
|
|
||||||
fn place_json(place: &PlaceTarget) -> Value {
|
|
||||||
match place {
|
|
||||||
PlaceTarget::Local { name, .. } => Value::String(name.clone()),
|
|
||||||
PlaceTarget::Index { base, index, span } => json!({
|
|
||||||
"kind": "index",
|
|
||||||
"base": expr_json(base),
|
|
||||||
"index": expr_json(index),
|
|
||||||
"span": span_json(*span),
|
|
||||||
}),
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
fn stmt_json(stmt: &Stmt) -> Value {
|
|
||||||
match stmt {
|
|
||||||
Stmt::Assign {
|
|
||||||
target,
|
|
||||||
value,
|
|
||||||
span,
|
|
||||||
..
|
|
||||||
} => json!({
|
|
||||||
"kind": "assign",
|
|
||||||
"target": place_json(target),
|
|
||||||
"value": expr_json(value),
|
|
||||||
"span": span_json(*span),
|
|
||||||
}),
|
|
||||||
Stmt::Eval { expr, span } => json!({
|
|
||||||
"kind": "expression",
|
|
||||||
"value": expr_json(expr),
|
|
||||||
"span": span_json(*span),
|
|
||||||
}),
|
|
||||||
Stmt::Branch { arms, span } => json!({
|
|
||||||
"kind": "branch",
|
|
||||||
"arms": arms.iter().map(|arm| json!({
|
|
||||||
"condition": expr_json(&arm.condition),
|
|
||||||
"condition_span": span_json(arm.condition_span),
|
|
||||||
"body": arm.body.iter().map(stmt_json).collect::<Vec<_>>(),
|
|
||||||
"span": span_json(arm.span),
|
|
||||||
})).collect::<Vec<_>>(),
|
|
||||||
"span": span_json(*span),
|
|
||||||
}),
|
|
||||||
Stmt::Loop {
|
|
||||||
condition,
|
|
||||||
condition_span,
|
|
||||||
body,
|
|
||||||
span,
|
|
||||||
} => json!({
|
|
||||||
"kind": "loop",
|
|
||||||
"condition": expr_json(condition),
|
|
||||||
"condition_span": span_json(*condition_span),
|
|
||||||
"body": body.iter().map(stmt_json).collect::<Vec<_>>(),
|
|
||||||
"span": span_json(*span),
|
|
||||||
}),
|
|
||||||
Stmt::Break { span } => json!({"kind": "break", "span": span_json(*span)}),
|
|
||||||
Stmt::Continue { span } => json!({"kind": "continue", "span": span_json(*span)}),
|
|
||||||
Stmt::Return { value, span } => json!({
|
|
||||||
"kind": "return",
|
|
||||||
"value": expr_json(value),
|
|
||||||
"span": span_json(*span),
|
|
||||||
}),
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
fn expr_json(expr: &Expr) -> Value {
|
|
||||||
let span = span_json(expr.span());
|
|
||||||
match expr {
|
|
||||||
Expr::Int(value) => {
|
|
||||||
json!({"kind":"literal","type":"int","value":value.to_string(),"span":span})
|
|
||||||
}
|
|
||||||
Expr::Float(value) => json!({"kind":"literal","type":"float","value":value,"span":span}),
|
|
||||||
Expr::Text(value) => json!({"kind":"literal","type":"text","value":value,"span":span}),
|
|
||||||
Expr::Bool(value) => json!({"kind":"literal","type":"bool","value":value,"span":span}),
|
|
||||||
Expr::None => json!({"kind":"literal","type":"none","span":span}),
|
|
||||||
Expr::Ident(ident) => {
|
|
||||||
json!({"kind":"variable","name":ident.name,"span":span_json(ident.span)})
|
|
||||||
}
|
|
||||||
Expr::List(items) => {
|
|
||||||
json!({"kind":"list","items":items.iter().map(expr_json).collect::<Vec<_>>(),"span":span})
|
|
||||||
}
|
|
||||||
Expr::Record(entries) => json!({
|
|
||||||
"kind":"record",
|
|
||||||
"entries": entries.iter().map(|entry| json!({
|
|
||||||
"key": entry.key,
|
|
||||||
"key_span": span_json(entry.key_span),
|
|
||||||
"value": expr_json(&entry.value),
|
|
||||||
})).collect::<Vec<_>>(),
|
|
||||||
"span":span
|
|
||||||
}),
|
|
||||||
Expr::Unary { op, operand, .. } => json!({
|
|
||||||
"kind":"unary",
|
|
||||||
"op": unary_name(*op),
|
|
||||||
"operand": expr_json(operand),
|
|
||||||
"span":span
|
|
||||||
}),
|
|
||||||
Expr::Binary {
|
|
||||||
op, left, right, ..
|
|
||||||
} => json!({
|
|
||||||
"kind":"binary",
|
|
||||||
"op": binary_name(*op),
|
|
||||||
"left": expr_json(left),
|
|
||||||
"right": expr_json(right),
|
|
||||||
"span":span
|
|
||||||
}),
|
|
||||||
Expr::Member { base, name, .. } => json!({
|
|
||||||
"kind":"member",
|
|
||||||
"base": expr_json(base),
|
|
||||||
"field": name,
|
|
||||||
"span":span
|
|
||||||
}),
|
|
||||||
Expr::Index { base, index, .. } => json!({
|
|
||||||
"kind":"index",
|
|
||||||
"base": expr_json(base),
|
|
||||||
"index": expr_json(index),
|
|
||||||
"span":span
|
|
||||||
}),
|
|
||||||
Expr::Call { callee, args, .. } => json!({
|
|
||||||
"kind":"call",
|
|
||||||
"callee": expr_json(callee),
|
|
||||||
"args": args.iter().map(arg_json).collect::<Vec<_>>(),
|
|
||||||
"span":span
|
|
||||||
}),
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
fn arg_json(arg: &marqdo_expression::Arg) -> Value {
|
|
||||||
json!({
|
|
||||||
"name": arg.name,
|
|
||||||
"value": expr_json(&arg.value),
|
|
||||||
"span": span_json(arg.span),
|
|
||||||
})
|
|
||||||
}
|
|
||||||
|
|
||||||
fn reference_edges(project: &LoadedProject, module_id: &marqdo_ir::ModuleId) -> Vec<Value> {
|
|
||||||
let Some(file) = project.files.get(module_id) else {
|
|
||||||
return Vec::new();
|
|
||||||
};
|
|
||||||
let parent = file.path.parent().unwrap_or_else(|| Path::new("."));
|
|
||||||
let mut edges = Vec::new();
|
|
||||||
file.analysis.document.root.walk(&mut |node| {
|
|
||||||
let marqdo_markdown::MdKind::Link { url, .. } = &node.kind else {
|
|
||||||
return;
|
|
||||||
};
|
|
||||||
edges.push(resolve_reference(
|
|
||||||
project,
|
|
||||||
module_id,
|
|
||||||
&file.analysis.units,
|
|
||||||
parent,
|
|
||||||
url,
|
|
||||||
node.span,
|
|
||||||
));
|
|
||||||
});
|
|
||||||
edges.sort_by_key(|edge| {
|
|
||||||
edge.get("span")
|
|
||||||
.and_then(|span| span.get("start"))
|
|
||||||
.and_then(Value::as_u64)
|
|
||||||
.unwrap_or(0)
|
|
||||||
});
|
|
||||||
edges
|
|
||||||
}
|
|
||||||
|
|
||||||
fn resolve_reference(
|
|
||||||
project: &LoadedProject,
|
|
||||||
source_module: &marqdo_ir::ModuleId,
|
|
||||||
units: &marqdo_frontend::UnitIndex,
|
|
||||||
parent: &Path,
|
|
||||||
url: &str,
|
|
||||||
span: Span,
|
|
||||||
) -> Value {
|
|
||||||
if let Some(fragment) = url.strip_prefix('#') {
|
|
||||||
let unit = units.anchors.get(fragment).or_else(|| {
|
|
||||||
units
|
|
||||||
.units
|
|
||||||
.iter()
|
|
||||||
.find(|unit| unit.name == fragment)
|
|
||||||
.map(|unit| &unit.id)
|
|
||||||
});
|
|
||||||
return json!({
|
|
||||||
"source": source_module.to_string(),
|
|
||||||
"url": url,
|
|
||||||
"span": span_json(span),
|
|
||||||
"state": if unit.is_some() { "resolved" } else { "unresolved" },
|
|
||||||
"target_module": source_module.to_string(),
|
|
||||||
"target_unit": unit.map(ToString::to_string),
|
|
||||||
});
|
|
||||||
}
|
|
||||||
if url.starts_with("http://") || url.starts_with("https://") {
|
|
||||||
return json!({
|
|
||||||
"source": source_module.to_string(),
|
|
||||||
"url": url,
|
|
||||||
"span": span_json(span),
|
|
||||||
"state": "external",
|
|
||||||
"target_module": null,
|
|
||||||
"target_unit": null,
|
|
||||||
});
|
|
||||||
}
|
|
||||||
let (path_part, fragment) = match url.split_once('#') {
|
|
||||||
Some((path, fragment)) => (path, Some(fragment)),
|
|
||||||
None => (url, None),
|
|
||||||
};
|
|
||||||
let candidate = parent.join(path_part);
|
|
||||||
let Some(target_module) = project.module_id_for_path(&candidate) else {
|
|
||||||
return json!({
|
|
||||||
"source": source_module.to_string(),
|
|
||||||
"url": url,
|
|
||||||
"span": span_json(span),
|
|
||||||
"state": "unresolved",
|
|
||||||
"target_module": null,
|
|
||||||
"target_unit": null,
|
|
||||||
});
|
|
||||||
};
|
|
||||||
let target_units = project
|
|
||||||
.files
|
|
||||||
.get(&target_module)
|
|
||||||
.map(|file| &file.analysis.units);
|
|
||||||
let resolved = match (fragment, target_units) {
|
|
||||||
(None, _) => Some(None),
|
|
||||||
(Some(fragment), Some(units)) => units
|
|
||||||
.anchors
|
|
||||||
.get(fragment)
|
|
||||||
.or_else(|| {
|
|
||||||
units
|
|
||||||
.units
|
|
||||||
.iter()
|
|
||||||
.find(|unit| unit.name == fragment)
|
|
||||||
.map(|unit| &unit.id)
|
|
||||||
})
|
|
||||||
.map(|unit| Some(unit.to_string())),
|
|
||||||
(Some(_), None) => None,
|
|
||||||
};
|
|
||||||
let (state, target_unit) = match resolved {
|
|
||||||
Some(unit) => ("resolved", unit),
|
|
||||||
None => ("unresolved", None),
|
|
||||||
};
|
|
||||||
json!({
|
|
||||||
"source": source_module.to_string(),
|
|
||||||
"url": url,
|
|
||||||
"span": span_json(span),
|
|
||||||
"state": state,
|
|
||||||
"target_module": target_module.to_string(),
|
|
||||||
"target_unit": target_unit,
|
|
||||||
})
|
|
||||||
}
|
|
||||||
|
|
||||||
fn calls_json(project: &LoadedProject, module: &Module, function: &Function) -> Vec<Value> {
|
|
||||||
let mut calls = Vec::new();
|
|
||||||
collect_calls(project, module, function, &function.body, &mut calls);
|
|
||||||
calls.sort_by_key(|call| {
|
|
||||||
call.get("span")
|
|
||||||
.and_then(|span| span.get("start"))
|
|
||||||
.and_then(Value::as_u64)
|
|
||||||
.unwrap_or(0)
|
|
||||||
});
|
|
||||||
calls
|
|
||||||
}
|
|
||||||
|
|
||||||
fn collect_calls(
|
|
||||||
project: &LoadedProject,
|
|
||||||
module: &Module,
|
|
||||||
function: &Function,
|
|
||||||
body: &[Stmt],
|
|
||||||
calls: &mut Vec<Value>,
|
|
||||||
) {
|
|
||||||
for stmt in body {
|
|
||||||
match stmt {
|
|
||||||
Stmt::Assign { target, value, .. } => {
|
|
||||||
if let PlaceTarget::Index { base, index, .. } = target {
|
|
||||||
expr_calls(project, module, function, base, calls);
|
|
||||||
expr_calls(project, module, function, index, calls);
|
|
||||||
}
|
|
||||||
expr_calls(project, module, function, value, calls);
|
|
||||||
}
|
|
||||||
Stmt::Eval { expr: value, .. } => expr_calls(project, module, function, value, calls),
|
|
||||||
Stmt::Return { value, .. } => expr_calls(project, module, function, value, calls),
|
|
||||||
Stmt::Branch { arms, .. } => {
|
|
||||||
for arm in arms {
|
|
||||||
expr_calls(project, module, function, &arm.condition, calls);
|
|
||||||
collect_calls(project, module, function, &arm.body, calls);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
Stmt::Loop {
|
|
||||||
condition, body, ..
|
|
||||||
} => {
|
|
||||||
expr_calls(project, module, function, condition, calls);
|
|
||||||
collect_calls(project, module, function, body, calls);
|
|
||||||
}
|
|
||||||
Stmt::Break { .. } | Stmt::Continue { .. } => {}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
fn expr_calls(
|
|
||||||
project: &LoadedProject,
|
|
||||||
module: &Module,
|
|
||||||
function: &Function,
|
|
||||||
expr: &Expr,
|
|
||||||
calls: &mut Vec<Value>,
|
|
||||||
) {
|
|
||||||
match expr {
|
|
||||||
Expr::Call { callee, args, span } => {
|
|
||||||
let (state, target) = resolve_callee(project, module, function, *span);
|
|
||||||
calls.push(json!({
|
|
||||||
"function": function.id.to_string(),
|
|
||||||
"span": span_json(*span),
|
|
||||||
"callee": callee_json(callee),
|
|
||||||
"state": state,
|
|
||||||
"target": target,
|
|
||||||
}));
|
|
||||||
for arg in args {
|
|
||||||
expr_calls(project, module, function, &arg.value, calls);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
Expr::Unary { operand, .. } => expr_calls(project, module, function, operand, calls),
|
|
||||||
Expr::Binary { left, right, .. } => {
|
|
||||||
expr_calls(project, module, function, left, calls);
|
|
||||||
expr_calls(project, module, function, right, calls);
|
|
||||||
}
|
|
||||||
Expr::List(items) => {
|
|
||||||
for item in items {
|
|
||||||
expr_calls(project, module, function, item, calls);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
Expr::Record(entries) => {
|
|
||||||
for entry in entries {
|
|
||||||
expr_calls(project, module, function, &entry.value, calls);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
Expr::Member { base, .. } => expr_calls(project, module, function, base, calls),
|
|
||||||
Expr::Index { base, index, .. } => {
|
|
||||||
expr_calls(project, module, function, base, calls);
|
|
||||||
expr_calls(project, module, function, index, calls);
|
|
||||||
}
|
|
||||||
_ => {}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/// Project the authoritative call binding into the Analysis `state`/`target`
|
|
||||||
/// fields.
|
|
||||||
///
|
|
||||||
/// Analysis is a read-only projection of the same prepared binding the runtime
|
|
||||||
/// consumes (RFC-EXT-0001 §4/§9): there is no second name-resolution algorithm
|
|
||||||
/// here. `state` keeps its v1 vocabulary (`function`, `builtin`, `plugin`,
|
|
||||||
/// `unresolved`); official stdlib aliases such as `打印` therefore appear as
|
|
||||||
/// `function` targets because that is the implementation that actually runs.
|
|
||||||
fn resolve_callee(
|
|
||||||
project: &LoadedProject,
|
|
||||||
_module: &Module,
|
|
||||||
function: &Function,
|
|
||||||
span: Span,
|
|
||||||
) -> (&'static str, Value) {
|
|
||||||
let key = marqdo_ir::call_binding::CallSiteKey::new(function.id.clone(), span);
|
|
||||||
match project.program.call_bindings.get(&key) {
|
|
||||||
Some(marqdo_ir::call_binding::BoundTarget::Builtin { canonical_name }) => {
|
|
||||||
("builtin", json!(canonical_name))
|
|
||||||
}
|
|
||||||
Some(marqdo_ir::call_binding::BoundTarget::Marqdo { function }) => {
|
|
||||||
("function", json!(function.to_string()))
|
|
||||||
}
|
|
||||||
Some(marqdo_ir::call_binding::BoundTarget::AbiPlugin { export, .. }) => {
|
|
||||||
("plugin", json!(export))
|
|
||||||
}
|
|
||||||
Some(marqdo_ir::call_binding::BoundTarget::DynamicValue) | None => {
|
|
||||||
("unresolved", Value::Null)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
fn callee_json(callee: &Expr) -> Value {
|
|
||||||
match callee {
|
|
||||||
Expr::Ident(ident) => json!({"kind":"ident","name":ident.name}),
|
|
||||||
Expr::Member { base, name, .. } => {
|
|
||||||
json!({"kind":"member","base":callee_json(base),"field":name})
|
|
||||||
}
|
|
||||||
other => json!({"kind":"expression","span":span_json(other.span())}),
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
fn span_json(span: Span) -> Value {
|
|
||||||
json!({"start": span.start, "end": span.end})
|
|
||||||
}
|
|
||||||
|
|
||||||
fn unary_name(op: UnaryOp) -> &'static str {
|
|
||||||
match op {
|
|
||||||
UnaryOp::Not => "not",
|
|
||||||
UnaryOp::Neg => "neg",
|
|
||||||
UnaryOp::Pos => "pos",
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
fn binary_name(op: BinaryOp) -> &'static str {
|
|
||||||
match op {
|
|
||||||
BinaryOp::Or => "or",
|
|
||||||
BinaryOp::And => "and",
|
|
||||||
BinaryOp::Eq => "eq",
|
|
||||||
BinaryOp::Ne => "ne",
|
|
||||||
BinaryOp::Lt => "lt",
|
|
||||||
BinaryOp::Le => "le",
|
|
||||||
BinaryOp::Gt => "gt",
|
|
||||||
BinaryOp::Ge => "ge",
|
|
||||||
BinaryOp::Add => "add",
|
|
||||||
BinaryOp::Sub => "sub",
|
|
||||||
BinaryOp::Mul => "mul",
|
|
||||||
BinaryOp::Div => "div",
|
|
||||||
BinaryOp::FloorDiv => "floor_div",
|
|
||||||
BinaryOp::Mod => "mod",
|
|
||||||
BinaryOp::Pow => "pow",
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
fn sha256_hex(bytes: &[u8]) -> String {
|
|
||||||
let mut hasher = Sha256::new();
|
|
||||||
hasher.update(bytes);
|
|
||||||
hex::encode(hasher.finalize())
|
|
||||||
}
|
|
||||||
@@ -0,0 +1,115 @@
|
|||||||
|
//! Explicit projector from the canonical Markdown AST to the public document
|
||||||
|
//! shape (spec/markdown-profile.md §5, spec/analysis.md §3.1).
|
||||||
|
//!
|
||||||
|
//! The same projector is used by Analysis and `inspect --ast`; there is no
|
||||||
|
//! second tree and no serde dump of an internal Rust enum.
|
||||||
|
|
||||||
|
use marqdo_markdown::{MdKind, MdNode};
|
||||||
|
use marqdo_span::Span;
|
||||||
|
use serde_json::{json, Map, Value};
|
||||||
|
|
||||||
|
/// Project one document root. The root span is normalised to the whole source
|
||||||
|
/// (including a tolerated BOM); child spans keep their parser coordinates.
|
||||||
|
pub fn document_json(root: &MdNode, source_len: usize) -> Value {
|
||||||
|
node_json(root, Some(Span::new(0, source_len)))
|
||||||
|
}
|
||||||
|
|
||||||
|
fn node_json(node: &MdNode, span_override: Option<Span>) -> Value {
|
||||||
|
let span = span_override.unwrap_or(node.span);
|
||||||
|
let mut object = Map::new();
|
||||||
|
object.insert("kind".to_string(), json!(node.kind.tag()));
|
||||||
|
object.insert(
|
||||||
|
"span".to_string(),
|
||||||
|
json!({"start": span.start, "end": span.end}),
|
||||||
|
);
|
||||||
|
let children: Vec<Value> = node
|
||||||
|
.children
|
||||||
|
.iter()
|
||||||
|
.map(|child| node_json(child, None))
|
||||||
|
.collect();
|
||||||
|
object.insert("children".to_string(), Value::Array(children));
|
||||||
|
match &node.kind {
|
||||||
|
MdKind::Document
|
||||||
|
| MdKind::BlockQuote
|
||||||
|
| MdKind::Paragraph
|
||||||
|
| MdKind::Strong
|
||||||
|
| MdKind::Emph
|
||||||
|
| MdKind::Strikethrough
|
||||||
|
| MdKind::TableCell
|
||||||
|
| MdKind::ThematicBreak
|
||||||
|
| MdKind::SoftBreak
|
||||||
|
| MdKind::LineBreak => {}
|
||||||
|
MdKind::FrontMatter => {
|
||||||
|
object.insert(
|
||||||
|
"literal".to_string(),
|
||||||
|
Value::String(node.literal.clone().unwrap_or_default()),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
MdKind::Text | MdKind::MathBlock | MdKind::HtmlBlock | MdKind::HtmlInline => {
|
||||||
|
object.insert(
|
||||||
|
"literal".to_string(),
|
||||||
|
Value::String(node.literal.clone().unwrap_or_default()),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
MdKind::Code { ticks } => {
|
||||||
|
object.insert("ticks".to_string(), json!(ticks));
|
||||||
|
object.insert(
|
||||||
|
"literal".to_string(),
|
||||||
|
Value::String(node.literal.clone().unwrap_or_default()),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
MdKind::CodeBlock { fenced, info } => {
|
||||||
|
object.insert("fenced".to_string(), json!(fenced));
|
||||||
|
object.insert("info".to_string(), json!(info));
|
||||||
|
object.insert(
|
||||||
|
"literal".to_string(),
|
||||||
|
Value::String(node.literal.clone().unwrap_or_default()),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
MdKind::Math { display } => {
|
||||||
|
object.insert("display".to_string(), json!(display));
|
||||||
|
object.insert(
|
||||||
|
"literal".to_string(),
|
||||||
|
Value::String(node.literal.clone().unwrap_or_default()),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
MdKind::Heading { level, setext } => {
|
||||||
|
object.insert("level".to_string(), json!(level));
|
||||||
|
object.insert("setext".to_string(), json!(setext));
|
||||||
|
}
|
||||||
|
MdKind::List {
|
||||||
|
ordered,
|
||||||
|
start,
|
||||||
|
tight,
|
||||||
|
} => {
|
||||||
|
object.insert("ordered".to_string(), json!(ordered));
|
||||||
|
object.insert("start".to_string(), json!(start));
|
||||||
|
object.insert("tight".to_string(), json!(tight));
|
||||||
|
}
|
||||||
|
MdKind::Item { task } => {
|
||||||
|
object.insert("task".to_string(), json!(task));
|
||||||
|
}
|
||||||
|
MdKind::Link { url, title } | MdKind::Image { url, title } => {
|
||||||
|
object.insert("url".to_string(), json!(url));
|
||||||
|
object.insert("title".to_string(), json!(title));
|
||||||
|
}
|
||||||
|
MdKind::Table { alignments } => {
|
||||||
|
object.insert("alignments".to_string(), json!(alignments));
|
||||||
|
}
|
||||||
|
MdKind::TableRow { header } => {
|
||||||
|
object.insert("header".to_string(), json!(header));
|
||||||
|
}
|
||||||
|
MdKind::FootnoteDefinition { .. } | MdKind::FootnoteReference { .. } => {
|
||||||
|
// The frozen profile disables footnotes; the semantic validator
|
||||||
|
// rejects them if a future parser change ever emits one.
|
||||||
|
object.insert("tag".to_string(), json!(node.kind.tag()));
|
||||||
|
}
|
||||||
|
MdKind::Other { tag } => {
|
||||||
|
object.insert("tag".to_string(), json!(tag));
|
||||||
|
if let Some(literal) = &node.literal {
|
||||||
|
object.insert("literal".to_string(), Value::String(literal.clone()));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
Value::Object(object)
|
||||||
|
}
|
||||||
File diff suppressed because it is too large.
Load diff
@@ -0,0 +1,340 @@
|
|||||||
|
//! Typed public Analysis DTO (spec/analysis.md).
|
||||||
|
//!
|
||||||
|
//! These types are the boundary model, not a dump of internal IR: every field
|
||||||
|
//! is projected explicitly from the prepared program. The canonical encoder
|
||||||
|
//! serializes this model once; the file writer and the Observation digest use
|
||||||
|
//! the same bytes.
|
||||||
|
|
||||||
|
use serde::Serialize;
|
||||||
|
use serde_json::Value;
|
||||||
|
|
||||||
|
/// Half-open UTF-8 byte span in the owning module's `source`.
|
||||||
|
#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize)]
|
||||||
|
pub struct SpanJson {
|
||||||
|
/// Inclusive byte offset.
|
||||||
|
pub start: usize,
|
||||||
|
/// Exclusive byte offset.
|
||||||
|
pub end: usize,
|
||||||
|
}
|
||||||
|
|
||||||
|
impl From<marqdo_span::Span> for SpanJson {
|
||||||
|
fn from(span: marqdo_span::Span) -> Self {
|
||||||
|
Self {
|
||||||
|
start: span.start,
|
||||||
|
end: span.end,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// Root Analysis document.
|
||||||
|
#[derive(Debug, Clone, Serialize)]
|
||||||
|
pub struct Analysis {
|
||||||
|
/// `marqdo.analysis`.
|
||||||
|
pub schema: &'static str,
|
||||||
|
/// Current revision.
|
||||||
|
pub schema_version: u32,
|
||||||
|
/// Producer identity.
|
||||||
|
pub producer: Producer,
|
||||||
|
/// Project snapshot and entry context.
|
||||||
|
pub project: Project,
|
||||||
|
/// Loaded modules, sorted by id.
|
||||||
|
pub modules: Vec<ModuleAnalysis>,
|
||||||
|
/// Deterministic diagnostics.
|
||||||
|
pub diagnostics: Vec<DiagnosticRecord>,
|
||||||
|
}
|
||||||
|
|
||||||
|
/// Producer identity.
|
||||||
|
#[derive(Debug, Clone, Serialize)]
|
||||||
|
pub struct Producer {
|
||||||
|
/// Always `marqdo`.
|
||||||
|
pub name: &'static str,
|
||||||
|
/// Product version.
|
||||||
|
pub version: &'static str,
|
||||||
|
/// Markdown profile id.
|
||||||
|
pub markdown_profile: &'static str,
|
||||||
|
}
|
||||||
|
|
||||||
|
/// Project snapshot identity.
|
||||||
|
#[derive(Debug, Clone, Serialize)]
|
||||||
|
pub struct Project {
|
||||||
|
/// Logical root id.
|
||||||
|
pub root_id: String,
|
||||||
|
/// `manifest` or `workspace_snapshot`.
|
||||||
|
pub identity_kind: &'static str,
|
||||||
|
/// Module loaded from the CLI entry.
|
||||||
|
pub entry_module_id: String,
|
||||||
|
/// Captured lock digest, empty when no lock exists.
|
||||||
|
pub lock_digest: String,
|
||||||
|
/// Captured manifest digest, empty when no manifest exists.
|
||||||
|
pub manifest_digest: String,
|
||||||
|
/// Verified stdlib identity, if any.
|
||||||
|
pub stdlib: Option<Stdlib>,
|
||||||
|
/// Static extension identities that participated in preparation.
|
||||||
|
pub extensions: Vec<Extension>,
|
||||||
|
}
|
||||||
|
|
||||||
|
/// Verified bundled stdlib identity.
|
||||||
|
#[derive(Debug, Clone, Serialize)]
|
||||||
|
pub struct Stdlib {
|
||||||
|
/// Declared version.
|
||||||
|
pub version: String,
|
||||||
|
/// Verified content digest.
|
||||||
|
pub digest: String,
|
||||||
|
/// Package instance id.
|
||||||
|
pub instance_id: String,
|
||||||
|
}
|
||||||
|
|
||||||
|
/// One static extension identity.
|
||||||
|
#[derive(Debug, Clone, PartialEq, Eq, Serialize)]
|
||||||
|
pub struct Extension {
|
||||||
|
/// `plugin`, `kernel` or `provider`.
|
||||||
|
pub kind: &'static str,
|
||||||
|
/// Declared package/provider name.
|
||||||
|
pub name: String,
|
||||||
|
/// Declared version.
|
||||||
|
pub version: String,
|
||||||
|
/// Logical owner package instance.
|
||||||
|
pub logical_owner: String,
|
||||||
|
/// Declared activation source, or `--plugin`.
|
||||||
|
pub source: String,
|
||||||
|
/// Manifest digest (`sha256:<hex>`).
|
||||||
|
pub manifest_digest: String,
|
||||||
|
/// Selected artifact digest (`sha256:<hex>`).
|
||||||
|
pub artifact_digest: String,
|
||||||
|
/// Selected host target triple.
|
||||||
|
pub selected_target: String,
|
||||||
|
}
|
||||||
|
|
||||||
|
/// One loaded module.
|
||||||
|
#[derive(Debug, Clone, Serialize)]
|
||||||
|
pub struct ModuleAnalysis {
|
||||||
|
/// Canonical module id.
|
||||||
|
pub id: String,
|
||||||
|
/// Package instance.
|
||||||
|
pub package_instance_id: String,
|
||||||
|
/// Package-relative path with `/` separators.
|
||||||
|
pub relative_path: String,
|
||||||
|
/// SHA-256 of the exact source bytes.
|
||||||
|
pub source_digest: String,
|
||||||
|
/// Exact UTF-8 source text.
|
||||||
|
pub source: String,
|
||||||
|
/// Public Markdown AST.
|
||||||
|
pub document: Value,
|
||||||
|
/// Heading units in document order.
|
||||||
|
pub units: Vec<UnitRecord>,
|
||||||
|
/// Anchor map sorted by anchor.
|
||||||
|
pub anchors: Vec<AnchorRecord>,
|
||||||
|
/// Exec H2 functions in document order.
|
||||||
|
pub functions: Vec<FunctionRecord>,
|
||||||
|
/// Explicit imports in document order.
|
||||||
|
pub imports: Vec<ImportRecord>,
|
||||||
|
/// Markdown references in source order.
|
||||||
|
pub references: Vec<ReferenceRecord>,
|
||||||
|
/// Static call bindings in source order.
|
||||||
|
pub calls: Vec<CallRecord>,
|
||||||
|
/// Inert resources in document order.
|
||||||
|
pub resources: Vec<ResourceRecord>,
|
||||||
|
}
|
||||||
|
|
||||||
|
/// One addressable heading range.
|
||||||
|
#[derive(Debug, Clone, Serialize)]
|
||||||
|
pub struct UnitRecord {
|
||||||
|
/// Canonical unit id.
|
||||||
|
pub id: String,
|
||||||
|
/// Structured canonical path.
|
||||||
|
pub path: Vec<String>,
|
||||||
|
/// Parent unit id, root `null`.
|
||||||
|
pub parent_id: Option<String>,
|
||||||
|
/// `root`, `namespace`, `function`, `knowledge` or `section`.
|
||||||
|
pub kind: &'static str,
|
||||||
|
/// Normalised heading name.
|
||||||
|
pub name: String,
|
||||||
|
/// Heading level, root 0.
|
||||||
|
pub level: u8,
|
||||||
|
/// Effective mode.
|
||||||
|
pub mode: &'static str,
|
||||||
|
/// `default`, `explicit` or `inherited`.
|
||||||
|
pub mode_origin: &'static str,
|
||||||
|
/// Unit that provided the effective mode.
|
||||||
|
pub mode_source_unit_id: String,
|
||||||
|
/// Original heading span, root `null`.
|
||||||
|
pub heading_span: Option<SpanJson>,
|
||||||
|
/// Complete section range.
|
||||||
|
pub span: SpanJson,
|
||||||
|
/// Owning function id.
|
||||||
|
pub function: Option<String>,
|
||||||
|
}
|
||||||
|
|
||||||
|
/// One anchor entry.
|
||||||
|
#[derive(Debug, Clone, Serialize)]
|
||||||
|
pub struct AnchorRecord {
|
||||||
|
/// GitHub-style anchor.
|
||||||
|
pub anchor: String,
|
||||||
|
/// Addressable unit.
|
||||||
|
pub unit_id: String,
|
||||||
|
}
|
||||||
|
|
||||||
|
/// One Exec H2 function.
|
||||||
|
#[derive(Debug, Clone, Serialize)]
|
||||||
|
pub struct FunctionRecord {
|
||||||
|
/// Canonical function id.
|
||||||
|
pub id: String,
|
||||||
|
/// Addressable unit.
|
||||||
|
pub unit_id: String,
|
||||||
|
/// Local function name.
|
||||||
|
pub local_name: String,
|
||||||
|
/// Enclosing namespace.
|
||||||
|
pub namespace: Option<String>,
|
||||||
|
/// Declaration span.
|
||||||
|
pub span: SpanJson,
|
||||||
|
/// Heading span.
|
||||||
|
pub heading_span: SpanJson,
|
||||||
|
/// Signature.
|
||||||
|
pub signature: SignatureRecord,
|
||||||
|
/// Conservative effects.
|
||||||
|
pub effects: Vec<&'static str>,
|
||||||
|
/// Statements.
|
||||||
|
pub body: Vec<Value>,
|
||||||
|
}
|
||||||
|
|
||||||
|
/// Function signature.
|
||||||
|
#[derive(Debug, Clone, Serialize)]
|
||||||
|
pub struct SignatureRecord {
|
||||||
|
/// `explicit` or `inferred`.
|
||||||
|
pub kind: &'static str,
|
||||||
|
/// Parameters.
|
||||||
|
pub params: Vec<ParamRecord>,
|
||||||
|
}
|
||||||
|
|
||||||
|
/// One function parameter.
|
||||||
|
#[derive(Debug, Clone, Serialize)]
|
||||||
|
pub struct ParamRecord {
|
||||||
|
/// Parameter name.
|
||||||
|
pub name: String,
|
||||||
|
/// Whether no default value exists.
|
||||||
|
pub required: bool,
|
||||||
|
/// Declared type annotation.
|
||||||
|
pub r#type: Option<String>,
|
||||||
|
/// Default expression.
|
||||||
|
pub default: Option<Value>,
|
||||||
|
/// Declaration span.
|
||||||
|
pub span: SpanJson,
|
||||||
|
}
|
||||||
|
|
||||||
|
/// One explicit import.
|
||||||
|
#[derive(Debug, Clone, Serialize)]
|
||||||
|
pub struct ImportRecord {
|
||||||
|
/// Local alias.
|
||||||
|
pub alias: String,
|
||||||
|
/// Declared target.
|
||||||
|
pub target: String,
|
||||||
|
/// Declaration span.
|
||||||
|
pub span: SpanJson,
|
||||||
|
/// Resolved module id.
|
||||||
|
pub resolved: Option<String>,
|
||||||
|
}
|
||||||
|
|
||||||
|
/// One resolved document reference.
|
||||||
|
#[derive(Debug, Clone, Serialize)]
|
||||||
|
pub struct ReferenceRecord {
|
||||||
|
/// Source module.
|
||||||
|
pub source: String,
|
||||||
|
/// Innermost owning unit.
|
||||||
|
pub source_unit: String,
|
||||||
|
/// Raw URL.
|
||||||
|
pub url: String,
|
||||||
|
/// Link span.
|
||||||
|
pub span: SpanJson,
|
||||||
|
/// Resolver state.
|
||||||
|
pub state: &'static str,
|
||||||
|
/// `module`, `file` or `null`.
|
||||||
|
pub target_kind: Option<&'static str>,
|
||||||
|
/// Resolved module.
|
||||||
|
pub target_module: Option<String>,
|
||||||
|
/// Resolved unit.
|
||||||
|
pub target_unit: Option<String>,
|
||||||
|
/// Logical candidate package instance.
|
||||||
|
pub candidate_package_instance_id: Option<String>,
|
||||||
|
/// Normalised package-relative candidate.
|
||||||
|
pub candidate_path: Option<String>,
|
||||||
|
/// Decoded fragment.
|
||||||
|
pub fragment: Option<String>,
|
||||||
|
/// Ambiguous exact candidates.
|
||||||
|
pub candidates: Vec<String>,
|
||||||
|
}
|
||||||
|
|
||||||
|
/// One static call record.
|
||||||
|
#[derive(Debug, Clone, Serialize)]
|
||||||
|
pub struct CallRecord {
|
||||||
|
/// Caller function id.
|
||||||
|
pub function: String,
|
||||||
|
/// Call expression span.
|
||||||
|
pub span: SpanJson,
|
||||||
|
/// Callee shape.
|
||||||
|
pub callee: Value,
|
||||||
|
/// Function, builtin, plugin or unresolved.
|
||||||
|
pub state: &'static str,
|
||||||
|
/// Bound target value.
|
||||||
|
pub target: Option<String>,
|
||||||
|
/// `function`, `builtin`, `plugin` or `null`.
|
||||||
|
pub target_kind: Option<&'static str>,
|
||||||
|
/// Static plugin owner, if any.
|
||||||
|
pub target_owner: Option<TargetOwner>,
|
||||||
|
/// `dynamic`, `unbound` or `null`.
|
||||||
|
pub reason: Option<&'static str>,
|
||||||
|
}
|
||||||
|
|
||||||
|
/// Static plugin owner of a bound export.
|
||||||
|
#[derive(Debug, Clone, Serialize)]
|
||||||
|
pub struct TargetOwner {
|
||||||
|
/// Always `plugin`.
|
||||||
|
pub kind: &'static str,
|
||||||
|
/// Plugin package.
|
||||||
|
pub package: String,
|
||||||
|
/// Verified artifact digest.
|
||||||
|
pub digest: String,
|
||||||
|
}
|
||||||
|
|
||||||
|
/// One inert resource.
|
||||||
|
#[derive(Debug, Clone, Serialize)]
|
||||||
|
pub struct ResourceRecord {
|
||||||
|
/// Module-local ordinal id.
|
||||||
|
pub id: String,
|
||||||
|
/// Owning module.
|
||||||
|
pub module_id: String,
|
||||||
|
/// Innermost owning unit.
|
||||||
|
pub unit_id: String,
|
||||||
|
/// `formula` or `code`.
|
||||||
|
pub kind: &'static str,
|
||||||
|
/// AST node span.
|
||||||
|
pub span: SpanJson,
|
||||||
|
/// Payload digest.
|
||||||
|
pub content_digest: String,
|
||||||
|
/// Code fence language.
|
||||||
|
pub language: Option<String>,
|
||||||
|
/// Formula display mode (`null` for code).
|
||||||
|
pub display: Option<bool>,
|
||||||
|
}
|
||||||
|
|
||||||
|
/// One diagnostic.
|
||||||
|
#[derive(Debug, Clone, Serialize)]
|
||||||
|
pub struct DiagnosticRecord {
|
||||||
|
/// Owning module.
|
||||||
|
pub module: String,
|
||||||
|
/// Package-relative path.
|
||||||
|
pub relative_path: String,
|
||||||
|
/// Primary span.
|
||||||
|
pub span: Option<SpanJson>,
|
||||||
|
/// 1-based line.
|
||||||
|
pub line: Option<usize>,
|
||||||
|
/// 1-based column.
|
||||||
|
pub column: Option<usize>,
|
||||||
|
/// `error` or `warning`.
|
||||||
|
pub severity: &'static str,
|
||||||
|
/// Stable code.
|
||||||
|
pub code: String,
|
||||||
|
/// Message.
|
||||||
|
pub message: String,
|
||||||
|
/// Hints.
|
||||||
|
pub hints: Vec<String>,
|
||||||
|
}
|
||||||
+4
-123
@@ -3,7 +3,8 @@
|
|||||||
use std::path::{Path, PathBuf};
|
use std::path::{Path, PathBuf};
|
||||||
use std::time::{Duration, Instant};
|
use std::time::{Duration, Instant};
|
||||||
|
|
||||||
use marqdo_host::{Host, StdHost};
|
use marqdo_host::StdHost;
|
||||||
|
use marqdo_host_contract::Host;
|
||||||
use marqdo_runtime::{run_with_limits, EvaluatedArg, MemoryLimits, RuntimeError, Value};
|
use marqdo_runtime::{run_with_limits, EvaluatedArg, MemoryLimits, RuntimeError, Value};
|
||||||
use marqdo_sandbox::{PlatformCapabilities, SandboxMode, StrictOutcome};
|
use marqdo_sandbox::{PlatformCapabilities, SandboxMode, StrictOutcome};
|
||||||
use marqdo_span::Span;
|
use marqdo_span::Span;
|
||||||
@@ -64,38 +65,6 @@ pub(super) fn prepare_project(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// `marqdo check`.
|
|
||||||
fn validate_refs(project: &LoadedProject) -> Vec<FileDiagnostic> {
|
|
||||||
let mut diagnostics = Vec::new();
|
|
||||||
for file in project.files.values() {
|
|
||||||
let parent = file.path.parent().unwrap_or_else(|| Path::new("."));
|
|
||||||
let mut unresolved: Vec<marqdo_span::Span> = Vec::new();
|
|
||||||
file.analysis.document.root.walk(&mut |node| {
|
|
||||||
let marqdo_markdown::MdKind::Link { url, .. } = &node.kind else {
|
|
||||||
return;
|
|
||||||
};
|
|
||||||
let (resolved, _, _) = resolve_link(project, &file.analysis.units, parent, url);
|
|
||||||
if !resolved {
|
|
||||||
unresolved.push(node.span);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
for span in unresolved {
|
|
||||||
diagnostics.push(FileDiagnostic {
|
|
||||||
module_id: file.module_id.clone(),
|
|
||||||
path: file.path.clone(),
|
|
||||||
source: file.source.clone(),
|
|
||||||
diagnostic: marqdo_value::Diagnostic::error(
|
|
||||||
marqdo_value::codes::REF_UNRESOLVED,
|
|
||||||
Some(span),
|
|
||||||
"reference target could not be resolved",
|
|
||||||
)
|
|
||||||
.with_hint("fix the link target or add the missing heading/file"),
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
|
||||||
diagnostics
|
|
||||||
}
|
|
||||||
|
|
||||||
fn summary_json(project: &LoadedProject) -> serde_json::Value {
|
fn summary_json(project: &LoadedProject) -> serde_json::Value {
|
||||||
let entry = project.entry_file();
|
let entry = project.entry_file();
|
||||||
json!({
|
json!({
|
||||||
@@ -130,94 +99,6 @@ fn signatures_json(module: &marqdo_ir::Module) -> serde_json::Value {
|
|||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
fn refs_json(project: &LoadedProject) -> serde_json::Value {
|
|
||||||
let entry = project.entry_file();
|
|
||||||
let parent = entry.path.parent().unwrap_or_else(|| Path::new("."));
|
|
||||||
let mut edges = Vec::new();
|
|
||||||
entry.analysis.document.root.walk(&mut |node| {
|
|
||||||
let marqdo_markdown::MdKind::Link { url, .. } = &node.kind else {
|
|
||||||
return;
|
|
||||||
};
|
|
||||||
let (resolved, target_module, target_unit) =
|
|
||||||
resolve_link(project, &entry.analysis.units, parent, url);
|
|
||||||
edges.push(json!({
|
|
||||||
"source": entry.module_id.to_string(),
|
|
||||||
"url": url,
|
|
||||||
"span": node.span,
|
|
||||||
"resolved": resolved,
|
|
||||||
"target_module": target_module,
|
|
||||||
"target_unit": target_unit,
|
|
||||||
}));
|
|
||||||
});
|
|
||||||
serde_json::Value::Array(edges)
|
|
||||||
}
|
|
||||||
|
|
||||||
fn resolve_link(
|
|
||||||
project: &LoadedProject,
|
|
||||||
units: &marqdo_frontend::UnitIndex,
|
|
||||||
parent: &Path,
|
|
||||||
url: &str,
|
|
||||||
) -> (bool, Option<String>, Option<String>) {
|
|
||||||
if let Some(fragment) = url.strip_prefix('#') {
|
|
||||||
let unit = units.anchors.get(fragment).or_else(|| {
|
|
||||||
units
|
|
||||||
.units
|
|
||||||
.iter()
|
|
||||||
.find(|unit| unit.name == fragment)
|
|
||||||
.map(|unit| &unit.id)
|
|
||||||
});
|
|
||||||
return match unit {
|
|
||||||
Some(unit) => (
|
|
||||||
true,
|
|
||||||
Some(project.entry.to_string()),
|
|
||||||
Some(unit.to_string()),
|
|
||||||
),
|
|
||||||
None => (false, None, None),
|
|
||||||
};
|
|
||||||
}
|
|
||||||
if url.starts_with("http://") || url.starts_with("https://") {
|
|
||||||
return (true, None, None);
|
|
||||||
}
|
|
||||||
let (path_part, fragment) = match url.split_once('#') {
|
|
||||||
Some((path, fragment)) => (path, Some(fragment)),
|
|
||||||
None => (url, None),
|
|
||||||
};
|
|
||||||
let candidate = parent.join(path_part);
|
|
||||||
let Ok(candidate) = candidate.canonicalize() else {
|
|
||||||
return (false, None, None);
|
|
||||||
};
|
|
||||||
let Some(module_id) = project.module_id_for_path(&candidate) else {
|
|
||||||
return (false, None, None);
|
|
||||||
};
|
|
||||||
let analyzed;
|
|
||||||
let target_units = match project.files.get(&module_id) {
|
|
||||||
Some(target_file) => &target_file.analysis.units,
|
|
||||||
None => {
|
|
||||||
// Links may reference documents that are not imported. Analyse the
|
|
||||||
// target statically for reference checking; nothing executes.
|
|
||||||
let Ok(source) = std::fs::read_to_string(&candidate) else {
|
|
||||||
return (false, None, None);
|
|
||||||
};
|
|
||||||
analyzed = marqdo_frontend::analyze_source(&module_id.to_string(), &source);
|
|
||||||
&analyzed.units
|
|
||||||
}
|
|
||||||
};
|
|
||||||
let Some(fragment) = fragment else {
|
|
||||||
return (true, Some(module_id.to_string()), None);
|
|
||||||
};
|
|
||||||
let resolved = target_units.anchors.get(fragment).or_else(|| {
|
|
||||||
target_units
|
|
||||||
.units
|
|
||||||
.iter()
|
|
||||||
.find(|unit| unit.name == fragment)
|
|
||||||
.map(|unit| &unit.id)
|
|
||||||
});
|
|
||||||
match resolved {
|
|
||||||
Some(unit) => (true, Some(module_id.to_string()), Some(unit.to_string())),
|
|
||||||
None => (false, Some(module_id.to_string()), None),
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/// Machine-readable routing decision for one captured strict execution.
|
/// Machine-readable routing decision for one captured strict execution.
|
||||||
#[derive(Debug, PartialEq, Eq)]
|
#[derive(Debug, PartialEq, Eq)]
|
||||||
enum StrictRoute {
|
enum StrictRoute {
|
||||||
@@ -390,12 +271,12 @@ fn load_plugin_into_host(
|
|||||||
.parent()
|
.parent()
|
||||||
.map(|parent| parent.to_path_buf())
|
.map(|parent| parent.to_path_buf())
|
||||||
.unwrap_or_else(|| PathBuf::from("."));
|
.unwrap_or_else(|| PathBuf::from("."));
|
||||||
let manifest = marqdo_plugin_abi::PluginManifest::load(&manifest_path)
|
let manifest = marqdo_host::plugin::PluginManifest::load(&manifest_path)
|
||||||
.map_err(|error| format!("{}: {}", error.code, error.message))?;
|
.map_err(|error| format!("{}: {}", error.code, error.message))?;
|
||||||
manifest
|
manifest
|
||||||
.validate()
|
.validate()
|
||||||
.map_err(|error| format!("{}: {}", error.code, error.message))?;
|
.map_err(|error| format!("{}: {}", error.code, error.message))?;
|
||||||
if manifest.plugin.kind == marqdo_plugin_abi::PluginKind::Native && !trusted {
|
if manifest.plugin.kind == marqdo_host::plugin::PluginKind::Native && !trusted {
|
||||||
return Err(format!(
|
return Err(format!(
|
||||||
"loading `{}` in-process requires --trust-native-plugin; use `kind: worker` for crash isolation",
|
"loading `{}` in-process requires --trust-native-plugin; use `kind: worker` for crash isolation",
|
||||||
manifest.plugin.name
|
manifest.plugin.name
|
||||||
|
|||||||
@@ -13,28 +13,48 @@ pub fn check(
|
|||||||
Ok(prepared) => prepared,
|
Ok(prepared) => prepared,
|
||||||
Err(code) => {
|
Err(code) => {
|
||||||
// A failed check never leaves a success artifact behind: a consumer
|
// A failed check never leaves a success artifact behind: a consumer
|
||||||
// must not be able to bind `run` to a previous Analysis after the
|
// must not bind `run` to a previous Analysis after the project
|
||||||
// project stopped loading or compiling.
|
// stopped loading. The input document is never the cleanup target.
|
||||||
if let Some(path) = emit {
|
if let Some(path) = emit {
|
||||||
let _ = std::fs::remove_file(path);
|
if let Err(error) = crate::analysis::discard_without_prepare(file, path) {
|
||||||
}
|
|
||||||
return code;
|
|
||||||
}
|
|
||||||
};
|
|
||||||
let mut project = prepared.loaded;
|
|
||||||
if refs {
|
|
||||||
let ref_diagnostics = validate_refs(&project);
|
|
||||||
project.diagnostics.extend(ref_diagnostics);
|
|
||||||
}
|
|
||||||
let errors = output::error_count(&project.diagnostics);
|
|
||||||
if let Some(path) = emit {
|
|
||||||
if errors > 0 {
|
|
||||||
let _ = std::fs::remove_file(path);
|
|
||||||
} else if let Err(error) = crate::analysis::write(&project, path) {
|
|
||||||
eprintln!("error: {error}");
|
eprintln!("error: {error}");
|
||||||
return 2;
|
return 2;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
return code;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
let mut prepared = prepared;
|
||||||
|
if refs {
|
||||||
|
let report = crate::document_refs::references_for_project(
|
||||||
|
&prepared.loaded,
|
||||||
|
crate::document_refs::ReferenceMode::VerifyLocal,
|
||||||
|
);
|
||||||
|
for issue in report.issues {
|
||||||
|
let Some(file) = prepared.loaded.files.get(&issue.module) else {
|
||||||
|
continue;
|
||||||
|
};
|
||||||
|
prepared.loaded.diagnostics.push(FileDiagnostic {
|
||||||
|
module_id: issue.module,
|
||||||
|
path: file.path.clone(),
|
||||||
|
source: file.source.clone(),
|
||||||
|
diagnostic: issue.diagnostic,
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
let errors = output::error_count(&prepared.loaded.diagnostics);
|
||||||
|
if let Some(path) = emit {
|
||||||
|
if errors > 0 {
|
||||||
|
if let Err(error) = crate::analysis::discard(&prepared, path) {
|
||||||
|
eprintln!("error: {error}");
|
||||||
|
return 2;
|
||||||
|
}
|
||||||
|
} else if let Err(error) = crate::analysis::write(&prepared, path) {
|
||||||
|
eprintln!("error: {error}");
|
||||||
|
return 2;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
let project = &prepared.loaded;
|
||||||
if json {
|
if json {
|
||||||
output::print_json(&json!({
|
output::print_json(&json!({
|
||||||
"command": "check",
|
"command": "check",
|
||||||
|
|||||||
@@ -46,13 +46,20 @@ pub fn inspect(file: Option<&Path>, flags: &InspectFlags, json: bool, plugins: &
|
|||||||
if flags.ast {
|
if flags.ast {
|
||||||
object.insert(
|
object.insert(
|
||||||
"ast".into(),
|
"ast".into(),
|
||||||
serde_json::to_value(&entry.analysis.document.root).unwrap_or_default(),
|
crate::analysis::document_projection(
|
||||||
|
&entry.analysis.document.root,
|
||||||
|
entry.source.len(),
|
||||||
|
),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
if flags.units {
|
if flags.units {
|
||||||
object.insert(
|
object.insert(
|
||||||
"units".into(),
|
"units".into(),
|
||||||
serde_json::to_value(&entry.analysis.units.units).unwrap_or_default(),
|
serde_json::to_value(crate::analysis::units_projection(
|
||||||
|
&entry.analysis.units,
|
||||||
|
entry.source.len(),
|
||||||
|
))
|
||||||
|
.unwrap_or_default(),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
if flags.signature {
|
if flags.signature {
|
||||||
@@ -65,7 +72,9 @@ pub fn inspect(file: Option<&Path>, flags: &InspectFlags, json: bool, plugins: &
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
if flags.refs {
|
if flags.refs {
|
||||||
object.insert("refs".into(), json!(refs_json(project)));
|
let (references, issues) = refs_json(&prepared, &entry.module_id);
|
||||||
|
object.insert("refs".into(), references);
|
||||||
|
object.insert("reference_issues".into(), issues);
|
||||||
}
|
}
|
||||||
if flags.platform {
|
if flags.platform {
|
||||||
object.insert(
|
object.insert(
|
||||||
@@ -106,13 +115,21 @@ pub fn inspect(file: Option<&Path>, flags: &InspectFlags, json: bool, plugins: &
|
|||||||
if flags.ast {
|
if flags.ast {
|
||||||
println!(
|
println!(
|
||||||
"{}",
|
"{}",
|
||||||
serde_json::to_string_pretty(&entry.analysis.document.root).unwrap_or_default()
|
serde_json::to_string_pretty(&crate::analysis::document_projection(
|
||||||
|
&entry.analysis.document.root,
|
||||||
|
entry.source.len()
|
||||||
|
))
|
||||||
|
.unwrap_or_default()
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
if flags.units {
|
if flags.units {
|
||||||
println!(
|
println!(
|
||||||
"{}",
|
"{}",
|
||||||
serde_json::to_string_pretty(&entry.analysis.units.units).unwrap_or_default()
|
serde_json::to_string_pretty(&crate::analysis::units_projection(
|
||||||
|
&entry.analysis.units,
|
||||||
|
entry.source.len()
|
||||||
|
))
|
||||||
|
.unwrap_or_default()
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
if flags.signature {
|
if flags.signature {
|
||||||
@@ -128,9 +145,14 @@ pub fn inspect(file: Option<&Path>, flags: &InspectFlags, json: bool, plugins: &
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
if flags.refs {
|
if flags.refs {
|
||||||
|
let (references, issues) = refs_json(&prepared, &entry.module_id);
|
||||||
println!(
|
println!(
|
||||||
"{}",
|
"{}",
|
||||||
serde_json::to_string_pretty(&refs_json(project)).unwrap_or_default()
|
serde_json::to_string_pretty(&json!({
|
||||||
|
"refs": references,
|
||||||
|
"reference_issues": issues,
|
||||||
|
}))
|
||||||
|
.unwrap_or_default()
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
if flags.platform {
|
if flags.platform {
|
||||||
@@ -149,6 +171,41 @@ pub fn inspect(file: Option<&Path>, flags: &InspectFlags, json: bool, plugins: &
|
|||||||
0
|
0
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// Resolve the entry module's links through the one document resolver and the
|
||||||
|
/// explicit `--refs` catalog. `inspect` never executes a target.
|
||||||
|
fn refs_json(
|
||||||
|
prepared: &crate::project_prepare::PreparedProgram,
|
||||||
|
entry: &marqdo_ir::ModuleId,
|
||||||
|
) -> (serde_json::Value, serde_json::Value) {
|
||||||
|
let report = crate::document_refs::references_for_project(
|
||||||
|
&prepared.loaded,
|
||||||
|
crate::document_refs::ReferenceMode::VerifyLocal,
|
||||||
|
);
|
||||||
|
let references: Vec<crate::analysis::ReferenceRecord> = report
|
||||||
|
.by_module
|
||||||
|
.get(entry)
|
||||||
|
.cloned()
|
||||||
|
.unwrap_or_default()
|
||||||
|
.into_iter()
|
||||||
|
.map(crate::analysis::reference_projection)
|
||||||
|
.collect();
|
||||||
|
let references = serde_json::to_value(references).unwrap_or_default();
|
||||||
|
let issues = report
|
||||||
|
.issues
|
||||||
|
.iter()
|
||||||
|
.filter(|issue| &issue.module == entry)
|
||||||
|
.map(|issue| {
|
||||||
|
json!({
|
||||||
|
"code": issue.diagnostic.code,
|
||||||
|
"severity": if issue.diagnostic.is_error() { "error" } else { "warning" },
|
||||||
|
"span": issue.diagnostic.span.map(|span| json!({"start": span.start, "end": span.end})),
|
||||||
|
"message": issue.diagnostic.message,
|
||||||
|
})
|
||||||
|
})
|
||||||
|
.collect::<Vec<_>>();
|
||||||
|
(references, serde_json::Value::Array(issues))
|
||||||
|
}
|
||||||
|
|
||||||
/// Static extension identity projection for `inspect --extensions`.
|
/// Static extension identity projection for `inspect --extensions`.
|
||||||
///
|
///
|
||||||
/// Reports declared sources, lock identity, static plugin descriptors and
|
/// Reports declared sources, lock identity, static plugin descriptors and
|
||||||
|
|||||||
@@ -58,12 +58,10 @@ pub fn execute(
|
|||||||
Ok(prepared) => prepared,
|
Ok(prepared) => prepared,
|
||||||
Err(error) => return fail_prepare(stream, "prepare", &error),
|
Err(error) => return fail_prepare(stream, "prepare", &error),
|
||||||
};
|
};
|
||||||
let extension_sources = prepared.loaded.extension_sources.clone();
|
if prepared.loaded.has_errors() {
|
||||||
let project = prepared.loaded;
|
|
||||||
let static_plugins = prepared.plugins;
|
|
||||||
if project.has_errors() {
|
|
||||||
if let Some(stream) = stream {
|
if let Some(stream) = stream {
|
||||||
let code = project
|
let code = prepared
|
||||||
|
.loaded
|
||||||
.diagnostics
|
.diagnostics
|
||||||
.iter()
|
.iter()
|
||||||
.find(|item| item.diagnostic.is_error())
|
.find(|item| item.diagnostic.is_error())
|
||||||
@@ -77,10 +75,24 @@ pub fn execute(
|
|||||||
return transport_failure(&error);
|
return transport_failure(&error);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
eprint!("{}", output::render_text(&project.diagnostics));
|
eprint!("{}", output::render_text(&prepared.loaded.diagnostics));
|
||||||
eprintln!("error: refusing to run a project with compile errors");
|
eprintln!("error: refusing to run a project with compile errors");
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
// Bind the Observation snapshot to the exact bytes of the ordinary
|
||||||
|
// Analysis for these static options. Build it before moving the prepared
|
||||||
|
// program apart, but only when an observation destination is requested.
|
||||||
|
let analysis_digest = if stream.is_some() {
|
||||||
|
match crate::analysis::digest(&prepared) {
|
||||||
|
Ok(digest) => Some(digest),
|
||||||
|
Err(error) => return fail(stream, "prepare", "cli.analysis_failed", &error, 1),
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
None
|
||||||
|
};
|
||||||
|
let extension_sources = prepared.loaded.extension_sources.clone();
|
||||||
|
let project = prepared.loaded;
|
||||||
|
let static_plugins = prepared.plugins;
|
||||||
let warnings: Vec<FileDiagnostic> = project
|
let warnings: Vec<FileDiagnostic> = project
|
||||||
.diagnostics
|
.diagnostics
|
||||||
.iter()
|
.iter()
|
||||||
@@ -262,7 +274,7 @@ pub fn execute(
|
|||||||
&& static_plugins
|
&& static_plugins
|
||||||
.plugins
|
.plugins
|
||||||
.iter()
|
.iter()
|
||||||
.any(|plugin| plugin.kind == marqdo_plugin_abi::PluginKind::Native)
|
.any(|plugin| plugin.kind == marqdo_host::plugin::PluginKind::Native)
|
||||||
{
|
{
|
||||||
return fail(
|
return fail(
|
||||||
stream,
|
stream,
|
||||||
@@ -342,15 +354,12 @@ pub fn execute(
|
|||||||
};
|
};
|
||||||
if let Some(stream) = stream {
|
if let Some(stream) = stream {
|
||||||
let entry = format!("{}::{}", project.entry, function_name);
|
let entry = format!("{}::{}", project.entry, function_name);
|
||||||
let analysis_digest = match crate::analysis::digest(&project) {
|
let analysis_digest = analysis_digest.as_deref().unwrap_or_default();
|
||||||
Ok(digest) => digest,
|
|
||||||
Err(error) => return fail(Some(stream), "prepare", "cli.analysis_failed", &error, 1),
|
|
||||||
};
|
|
||||||
if let Err(error) = stream.started(
|
if let Err(error) = stream.started(
|
||||||
&entry,
|
&entry,
|
||||||
mode.as_str(),
|
mode.as_str(),
|
||||||
&project.identity.root_id(),
|
&project.identity.root_id(),
|
||||||
&analysis_digest,
|
analysis_digest,
|
||||||
) {
|
) {
|
||||||
return transport_failure(&error);
|
return transport_failure(&error);
|
||||||
}
|
}
|
||||||
@@ -549,9 +558,9 @@ mod tests {
|
|||||||
base_dir: PathBuf::from("/fixtures/demo"),
|
base_dir: PathBuf::from("/fixtures/demo"),
|
||||||
package: "demo.ext".into(),
|
package: "demo.ext".into(),
|
||||||
version: "0.1.0".into(),
|
version: "0.1.0".into(),
|
||||||
kind: marqdo_plugin_abi::PluginKind::Worker,
|
kind: marqdo_host::plugin::PluginKind::Worker,
|
||||||
manifest_sha256: format!("sha256:{}", "b".repeat(64)),
|
manifest_sha256: format!("sha256:{}", "b".repeat(64)),
|
||||||
artifact_target: marqdo_plugin_abi::HostTarget::current()
|
artifact_target: marqdo_host::plugin::HostTarget::current()
|
||||||
.triple()
|
.triple()
|
||||||
.to_string(),
|
.to_string(),
|
||||||
artifact_sha256: "a".repeat(64),
|
artifact_sha256: "a".repeat(64),
|
||||||
|
|||||||
@@ -44,7 +44,7 @@ pub fn plugin_inspect(target: &Path, json: bool) -> i32 {
|
|||||||
.parent()
|
.parent()
|
||||||
.map(|parent| parent.to_path_buf())
|
.map(|parent| parent.to_path_buf())
|
||||||
.unwrap_or_else(|| PathBuf::from("."));
|
.unwrap_or_else(|| PathBuf::from("."));
|
||||||
let manifest = match marqdo_plugin_abi::PluginManifest::load(&manifest_path) {
|
let manifest = match marqdo_host::plugin::PluginManifest::load(&manifest_path) {
|
||||||
Ok(manifest) => manifest,
|
Ok(manifest) => manifest,
|
||||||
Err(error) => {
|
Err(error) => {
|
||||||
report_plugin_error(&error, json);
|
report_plugin_error(&error, json);
|
||||||
@@ -55,7 +55,7 @@ pub fn plugin_inspect(target: &Path, json: bool) -> i32 {
|
|||||||
report_plugin_error(&error, json);
|
report_plugin_error(&error, json);
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
let host_target = marqdo_plugin_abi::HostTarget::current();
|
let host_target = marqdo_host::plugin::HostTarget::current();
|
||||||
let artifact = match manifest.verify_artifact(&base_dir, &host_target) {
|
let artifact = match manifest.verify_artifact(&base_dir, &host_target) {
|
||||||
Ok((path, artifact)) => {
|
Ok((path, artifact)) => {
|
||||||
let abi = match manifest.abi_requirement() {
|
let abi = match manifest.abi_requirement() {
|
||||||
|
|||||||
File diff suppressed because it is too large.
Load diff
@@ -10,9 +10,9 @@
|
|||||||
use std::collections::BTreeSet;
|
use std::collections::BTreeSet;
|
||||||
use std::path::{Component, Path, PathBuf};
|
use std::path::{Component, Path, PathBuf};
|
||||||
|
|
||||||
|
use marqdo_host::plugin::{HostTarget, PluginKind, PluginManifest};
|
||||||
use marqdo_ir::callable::{CallableDescriptor, CallableId, CallableOrigin, CallableSignature};
|
use marqdo_ir::callable::{CallableDescriptor, CallableId, CallableOrigin, CallableSignature};
|
||||||
use marqdo_ir::SignatureKind;
|
use marqdo_ir::SignatureKind;
|
||||||
use marqdo_plugin_abi::{HostTarget, PluginKind, PluginManifest};
|
|
||||||
use marqdo_span::Span;
|
use marqdo_span::Span;
|
||||||
use sha2::{Digest, Sha256};
|
use sha2::{Digest, Sha256};
|
||||||
|
|
||||||
|
|||||||
@@ -81,12 +81,12 @@ fn plugin_identity(extension: &ResolvedExtension) -> Result<LockedExtension, Pre
|
|||||||
),
|
),
|
||||||
)
|
)
|
||||||
})?;
|
})?;
|
||||||
let manifest = marqdo_plugin_abi::PluginManifest::load(&extension.path)
|
let manifest = marqdo_host::plugin::PluginManifest::load(&extension.path)
|
||||||
.map_err(|error| PrepareError::option(error.code.clone(), error.message.clone()))?;
|
.map_err(|error| PrepareError::option(error.code.clone(), error.message.clone()))?;
|
||||||
manifest
|
manifest
|
||||||
.validate()
|
.validate()
|
||||||
.map_err(|error| PrepareError::option(error.code.clone(), error.message.clone()))?;
|
.map_err(|error| PrepareError::option(error.code.clone(), error.message.clone()))?;
|
||||||
let host = marqdo_plugin_abi::HostTarget::current();
|
let host = marqdo_host::plugin::HostTarget::current();
|
||||||
let artifact = manifest
|
let artifact = manifest
|
||||||
.resolve_artifact(&host)
|
.resolve_artifact(&host)
|
||||||
.map_err(|error| PrepareError::option("ext.no_matching_artifact", error.message))?;
|
.map_err(|error| PrepareError::option("ext.no_matching_artifact", error.message))?;
|
||||||
@@ -161,7 +161,7 @@ fn provider_identity(extension: &ResolvedExtension) -> Result<LockedExtension, P
|
|||||||
format!("`{}` has no version", extension.path.display()),
|
format!("`{}` has no version", extension.path.display()),
|
||||||
)
|
)
|
||||||
})?;
|
})?;
|
||||||
let target = marqdo_plugin_abi::HostTarget::current()
|
let target = marqdo_host::plugin::HostTarget::current()
|
||||||
.triple()
|
.triple()
|
||||||
.to_string();
|
.to_string();
|
||||||
let artifacts = manifest
|
let artifacts = manifest
|
||||||
@@ -293,7 +293,7 @@ fn kernel_identity(extension: &ResolvedExtension) -> Result<LockedExtension, Pre
|
|||||||
version: format!("wire:{wire_version}"),
|
version: format!("wire:{wire_version}"),
|
||||||
manifest_digest: hex(&Sha256::digest(&manifest_bytes)),
|
manifest_digest: hex(&Sha256::digest(&manifest_bytes)),
|
||||||
artifact_digest: digest.to_ascii_lowercase(),
|
artifact_digest: digest.to_ascii_lowercase(),
|
||||||
selected_target: marqdo_plugin_abi::HostTarget::current()
|
selected_target: marqdo_host::plugin::HostTarget::current()
|
||||||
.triple()
|
.triple()
|
||||||
.to_string(),
|
.to_string(),
|
||||||
source: extension.from.clone(),
|
source: extension.from.clone(),
|
||||||
|
|||||||
+81
-31
@@ -119,6 +119,14 @@ fn source_digest(source: &str) -> String {
|
|||||||
hex::encode(hasher.finalize())
|
hex::encode(hasher.finalize())
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// `sha256:<hex>` of exact bytes, the wire form used by Analysis snapshots.
|
||||||
|
fn bytes_digest(bytes: &[u8]) -> String {
|
||||||
|
use sha2::{Digest, Sha256};
|
||||||
|
let mut hasher = Sha256::new();
|
||||||
|
hasher.update(bytes);
|
||||||
|
format!("sha256:{}", hex::encode(hasher.finalize()))
|
||||||
|
}
|
||||||
|
|
||||||
/// A resolved source location inside a loaded file.
|
/// A resolved source location inside a loaded file.
|
||||||
pub struct LocatedSource<'a> {
|
pub struct LocatedSource<'a> {
|
||||||
/// The owning file.
|
/// The owning file.
|
||||||
@@ -167,6 +175,13 @@ pub struct LoadedProject {
|
|||||||
pub manifest: Option<Manifest>,
|
pub manifest: Option<Manifest>,
|
||||||
/// Verified lock file, when present (lock v4).
|
/// Verified lock file, when present (lock v4).
|
||||||
pub lock: Option<LockFile>,
|
pub lock: Option<LockFile>,
|
||||||
|
/// SHA-256 of the exact `marqdo.lock` bytes captured while loading, or an
|
||||||
|
/// empty string when the project has no lock. Analysis must never re-read
|
||||||
|
/// the file: a later edit cannot change the snapshot the program used.
|
||||||
|
pub lock_digest: String,
|
||||||
|
/// SHA-256 of the exact `marqdo.yaml` bytes captured while loading, or an
|
||||||
|
/// empty string when there is no manifest.
|
||||||
|
pub manifest_digest: String,
|
||||||
/// Resolved `marqdo.yaml.extensions` activation sources (static paths only).
|
/// Resolved `marqdo.yaml.extensions` activation sources (static paths only).
|
||||||
pub extension_sources: Vec<marqdo_package::ResolvedExtension>,
|
pub extension_sources: Vec<marqdo_package::ResolvedExtension>,
|
||||||
}
|
}
|
||||||
@@ -201,29 +216,6 @@ impl LoadedProject {
|
|||||||
column: position.column,
|
column: position.column,
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Resolve a physical path to its loaded or statically addressable module.
|
|
||||||
pub fn module_id_for_path(&self, path: &Path) -> Option<ModuleId> {
|
|
||||||
let canonical = path.canonicalize().ok()?;
|
|
||||||
let mut best: Option<(&String, &PathBuf)> = None;
|
|
||||||
for (instance, root) in &self.packages {
|
|
||||||
if canonical.starts_with(root)
|
|
||||||
&& best
|
|
||||||
.as_ref()
|
|
||||||
.map(|(_, current)| root.components().count() > current.components().count())
|
|
||||||
.unwrap_or(true)
|
|
||||||
{
|
|
||||||
best = Some((instance, root));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
let (instance, root) = best?;
|
|
||||||
let relative = canonical.strip_prefix(root).ok()?;
|
|
||||||
let mut parts = Vec::new();
|
|
||||||
for component in relative.components() {
|
|
||||||
parts.push(component.as_os_str().to_string_lossy().to_string());
|
|
||||||
}
|
|
||||||
Some(ModuleId::new(instance.clone(), parts.join("/")))
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
struct Loader {
|
struct Loader {
|
||||||
@@ -251,19 +243,32 @@ pub fn load(entry: &Path) -> Result<LoadedProject, String> {
|
|||||||
.map(|parent| parent.to_path_buf())
|
.map(|parent| parent.to_path_buf())
|
||||||
.unwrap_or_else(|| PathBuf::from(".")),
|
.unwrap_or_else(|| PathBuf::from(".")),
|
||||||
};
|
};
|
||||||
let manifest = if root.join(MANIFEST_FILE).is_file() {
|
// Read each snapshot input exactly once. The digest recorded in Analysis
|
||||||
Some(Manifest::load(&root.join(MANIFEST_FILE))?)
|
// is computed from these bytes, not from a second read after preparation.
|
||||||
|
let manifest_path = root.join(MANIFEST_FILE);
|
||||||
|
let (manifest, manifest_digest) = if manifest_path.is_file() {
|
||||||
|
let bytes = std::fs::read(&manifest_path)
|
||||||
|
.map_err(|error| format!("cannot read {MANIFEST_FILE}: {error}"))?;
|
||||||
|
let yaml = String::from_utf8(bytes.clone())
|
||||||
|
.map_err(|error| format!("{MANIFEST_FILE} is not valid UTF-8: {error}"))?;
|
||||||
|
let manifest =
|
||||||
|
Manifest::from_yaml(&yaml).map_err(|error| format!("{MANIFEST_FILE}: {error}"))?;
|
||||||
|
(Some(manifest), bytes_digest(&bytes))
|
||||||
} else {
|
} else {
|
||||||
None
|
(None, String::new())
|
||||||
};
|
};
|
||||||
let lock = if root.join(LOCK_FILE).is_file() {
|
let lock_path = root.join(LOCK_FILE);
|
||||||
let lock = LockFile::load(&root.join(LOCK_FILE))
|
let (lock, lock_digest) = if lock_path.is_file() {
|
||||||
.map_err(|error| format!("{LOCK_FILE}: {error}"))?;
|
let bytes = std::fs::read(&lock_path)
|
||||||
|
.map_err(|error| format!("cannot read {LOCK_FILE}: {error}"))?;
|
||||||
|
let yaml = String::from_utf8(bytes.clone())
|
||||||
|
.map_err(|error| format!("{LOCK_FILE} is not valid UTF-8: {error}"))?;
|
||||||
|
let lock = LockFile::from_yaml(&yaml).map_err(|error| format!("{LOCK_FILE}: {error}"))?;
|
||||||
if let Some(manifest) = &manifest {
|
if let Some(manifest) = &manifest {
|
||||||
lock.validate_root(manifest)
|
lock.validate_root(manifest)
|
||||||
.map_err(|error| format!("{LOCK_FILE}: {error}"))?;
|
.map_err(|error| format!("{LOCK_FILE}: {error}"))?;
|
||||||
}
|
}
|
||||||
Some(lock)
|
(Some(lock), bytes_digest(&bytes))
|
||||||
} else {
|
} else {
|
||||||
if manifest
|
if manifest
|
||||||
.as_ref()
|
.as_ref()
|
||||||
@@ -275,7 +280,7 @@ pub fn load(entry: &Path) -> Result<LoadedProject, String> {
|
|||||||
.to_string(),
|
.to_string(),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
None
|
(None, String::new())
|
||||||
};
|
};
|
||||||
let resolver = PackageResolver::new(root.clone(), manifest.clone(), lock.clone());
|
let resolver = PackageResolver::new(root.clone(), manifest.clone(), lock.clone());
|
||||||
let entry_module = resolver.resolve_entry(&entry)?;
|
let entry_module = resolver.resolve_entry(&entry)?;
|
||||||
@@ -326,6 +331,8 @@ pub fn load(entry: &Path) -> Result<LoadedProject, String> {
|
|||||||
official_aliases,
|
official_aliases,
|
||||||
manifest,
|
manifest,
|
||||||
lock,
|
lock,
|
||||||
|
lock_digest,
|
||||||
|
manifest_digest,
|
||||||
extension_sources,
|
extension_sources,
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
@@ -683,3 +690,46 @@ fn collect_identifiers_expr(expr: &Expr, names: &mut std::collections::BTreeSet<
|
|||||||
Expr::Int(_) | Expr::Float(_) | Expr::Text(_) | Expr::Bool(_) | Expr::None => {}
|
Expr::Int(_) | Expr::Float(_) | Expr::Text(_) | Expr::Bool(_) | Expr::None => {}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[cfg(test)]
|
||||||
|
mod tests {
|
||||||
|
use super::*;
|
||||||
|
use std::sync::atomic::{AtomicU32, Ordering};
|
||||||
|
|
||||||
|
static COUNTER: AtomicU32 = AtomicU32::new(0);
|
||||||
|
|
||||||
|
fn temp_project(files: &[(&str, &str)]) -> PathBuf {
|
||||||
|
let id = COUNTER.fetch_add(1, Ordering::Relaxed);
|
||||||
|
let root =
|
||||||
|
std::env::temp_dir().join(format!("marqdo-loader-test-{}-{id}", std::process::id()));
|
||||||
|
let _ = std::fs::remove_dir_all(&root);
|
||||||
|
std::fs::create_dir_all(&root).unwrap();
|
||||||
|
for (name, source) in files {
|
||||||
|
std::fs::write(root.join(name), source).unwrap();
|
||||||
|
}
|
||||||
|
root
|
||||||
|
}
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn project_snapshot_digests_are_captured_once() {
|
||||||
|
let root = temp_project(&[
|
||||||
|
("marqdo.yaml", "project:\n name: snap\n version: 0.1.0\n"),
|
||||||
|
("index.mq.md", "## @exec main\n\n`return 1`\n"),
|
||||||
|
]);
|
||||||
|
let entry = root.join("index.mq.md");
|
||||||
|
let project = load(&entry).expect("load project");
|
||||||
|
let manifest_bytes = std::fs::read(root.join("marqdo.yaml")).unwrap();
|
||||||
|
assert_eq!(project.manifest_digest, bytes_digest(&manifest_bytes));
|
||||||
|
assert!(project.lock_digest.is_empty());
|
||||||
|
|
||||||
|
// The snapshot is what the program used; editing the manifest after
|
||||||
|
// loading cannot change the recorded digest.
|
||||||
|
std::fs::write(
|
||||||
|
root.join("marqdo.yaml"),
|
||||||
|
"project:\n name: snap\n version: 0.2.0\n",
|
||||||
|
)
|
||||||
|
.unwrap();
|
||||||
|
assert_eq!(project.manifest_digest, bytes_digest(&manifest_bytes));
|
||||||
|
let _ = std::fs::remove_dir_all(&root);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -7,6 +7,7 @@
|
|||||||
mod analysis;
|
mod analysis;
|
||||||
mod args;
|
mod args;
|
||||||
mod commands;
|
mod commands;
|
||||||
|
mod document_refs;
|
||||||
mod extension_descriptors;
|
mod extension_descriptors;
|
||||||
mod extension_selection;
|
mod extension_selection;
|
||||||
mod loader;
|
mod loader;
|
||||||
@@ -499,7 +500,7 @@ fn dispatch() -> i32 {
|
|||||||
},
|
},
|
||||||
Command::External(args) => tool::dispatch(&args),
|
Command::External(args) => tool::dispatch(&args),
|
||||||
Command::PluginWorker(args) => {
|
Command::PluginWorker(args) => {
|
||||||
marqdo_plugin_abi::worker::serve(&args.manifest, &args.base_dir)
|
marqdo_host::plugin::worker::serve(&args.manifest, &args.base_dir)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -8,10 +8,10 @@ use std::rc::Rc;
|
|||||||
use std::time::{SystemTime, UNIX_EPOCH};
|
use std::time::{SystemTime, UNIX_EPOCH};
|
||||||
|
|
||||||
use marqdo_host::{
|
use marqdo_host::{
|
||||||
FrameId, ObservationConfig, ObservationError, ObservationEvent, ObservationSink,
|
ObservationConfig, ObservationError, ObservationEvent, ObservationSink, ValueState,
|
||||||
ParameterSource, ValueState, DEFAULT_MAX_OBSERVATION_BYTES, DEFAULT_MAX_OBSERVATION_EVENTS,
|
DEFAULT_MAX_OBSERVATION_BYTES, DEFAULT_MAX_OBSERVATION_EVENTS, DEFAULT_MAX_VALUE_BYTES,
|
||||||
DEFAULT_MAX_VALUE_BYTES,
|
|
||||||
};
|
};
|
||||||
|
use marqdo_host_contract::{FrameId, ParameterSource};
|
||||||
use marqdo_value::Value;
|
use marqdo_value::Value;
|
||||||
use serde_json::{json, Value as Json};
|
use serde_json::{json, Value as Json};
|
||||||
|
|
||||||
|
|||||||
@@ -16,8 +16,8 @@
|
|||||||
use std::collections::{BTreeMap, BTreeSet};
|
use std::collections::{BTreeMap, BTreeSet};
|
||||||
use std::path::{Path, PathBuf};
|
use std::path::{Path, PathBuf};
|
||||||
|
|
||||||
|
use marqdo_host::plugin::{HostTarget, TargetTriple};
|
||||||
use marqdo_host::StdHost;
|
use marqdo_host::StdHost;
|
||||||
use marqdo_plugin_abi::{HostTarget, TargetTriple};
|
|
||||||
use serde::Deserialize;
|
use serde::Deserialize;
|
||||||
use sha2::{Digest, Sha256};
|
use sha2::{Digest, Sha256};
|
||||||
|
|
||||||
@@ -577,7 +577,7 @@ fn is_lowercase_sha256(value: &str) -> bool {
|
|||||||
}
|
}
|
||||||
|
|
||||||
fn is_known_capability(name: &str) -> bool {
|
fn is_known_capability(name: &str) -> bool {
|
||||||
marqdo_plugin_abi::KNOWN_CAPABILITIES.contains(&name)
|
marqdo_host::plugin::KNOWN_CAPABILITIES.contains(&name)
|
||||||
}
|
}
|
||||||
|
|
||||||
/// A dotted vendor capability proposal (validation only, never a grant).
|
/// A dotted vendor capability proposal (validation only, never a grant).
|
||||||
|
|||||||
+66
-60
@@ -45,24 +45,33 @@ pub struct StdlibBundle {
|
|||||||
impl StdlibBundle {
|
impl StdlibBundle {
|
||||||
/// Discover the bundle.
|
/// Discover the bundle.
|
||||||
///
|
///
|
||||||
/// Order: `MARQDO_STDLIB_DIR` (explicit, fail if invalid), a `stdlib`
|
/// Order: `MARQDO_STDLIB_DIR` (explicit, fail if invalid) then a `stdlib`
|
||||||
/// directory next to the executable, and finally — **debug builds only** — the
|
/// directory next to the executable. The official Bundle is an installed
|
||||||
/// compile-time source tree. A release binary never falls back to a build
|
/// artifact next to the binary (RFC-EXT-0003 H-08, ADR-0070); there is no
|
||||||
/// machine path: the release archive must ship a verified `stdlib/` next to
|
/// compile-time source-tree fallback in any build profile.
|
||||||
/// the binary (RFC-EXT-0003 H-08, ADR).
|
|
||||||
pub fn discover() -> Result<Option<Self>, String> {
|
pub fn discover() -> Result<Option<Self>, String> {
|
||||||
if let Some(dir) = std::env::var_os(STDLIB_DIR_ENV) {
|
let override_dir = std::env::var_os(STDLIB_DIR_ENV).map(PathBuf::from);
|
||||||
return Self::load(PathBuf::from(dir)).map(Some);
|
let exe_dir = std::env::current_exe()
|
||||||
}
|
|
||||||
Self::discover_from_exe_dir(
|
|
||||||
std::env::current_exe()
|
|
||||||
.ok()
|
.ok()
|
||||||
.and_then(|exe| exe.parent().map(Path::to_path_buf)),
|
.and_then(|exe| exe.parent().map(Path::to_path_buf));
|
||||||
)
|
Self::discover_with(override_dir, exe_dir)
|
||||||
|
}
|
||||||
|
|
||||||
|
/// Discovery with the explicit override and the executable directory passed
|
||||||
|
/// in. The override is authoritative: a bad `MARQDO_STDLIB_DIR` fails even
|
||||||
|
/// when a valid sibling Bundle exists (no silent fallback).
|
||||||
|
fn discover_with(
|
||||||
|
override_dir: Option<PathBuf>,
|
||||||
|
exe_dir: Option<PathBuf>,
|
||||||
|
) -> Result<Option<Self>, String> {
|
||||||
|
if let Some(dir) = override_dir {
|
||||||
|
return Self::load(dir).map(Some);
|
||||||
|
}
|
||||||
|
Self::discover_from_exe_dir(exe_dir)
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Discover from the directory that holds the executable, without the explicit
|
/// Discover from the directory that holds the executable, without the explicit
|
||||||
/// environment override. Release builds do not read the source tree.
|
/// environment override. Only the installed sibling Bundle is considered.
|
||||||
fn discover_from_exe_dir(exe_dir: Option<PathBuf>) -> Result<Option<Self>, String> {
|
fn discover_from_exe_dir(exe_dir: Option<PathBuf>) -> Result<Option<Self>, String> {
|
||||||
if let Some(parent) = exe_dir {
|
if let Some(parent) = exe_dir {
|
||||||
let candidate = parent.join("stdlib");
|
let candidate = parent.join("stdlib");
|
||||||
@@ -70,16 +79,6 @@ impl StdlibBundle {
|
|||||||
return Self::load(candidate).map(Some);
|
return Self::load(candidate).map(Some);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#[cfg(debug_assertions)]
|
|
||||||
{
|
|
||||||
let dev = PathBuf::from(env!("CARGO_MANIFEST_DIR"))
|
|
||||||
.join("..")
|
|
||||||
.join("..")
|
|
||||||
.join("stdlib");
|
|
||||||
if dev.is_dir() {
|
|
||||||
return Self::load(dev).map(Some);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
Ok(None)
|
Ok(None)
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -454,21 +453,41 @@ pub fn aliases_digest(aliases: &[PublicAlias]) -> String {
|
|||||||
mod tests {
|
mod tests {
|
||||||
use super::*;
|
use super::*;
|
||||||
|
|
||||||
fn dev_bundle() -> PathBuf {
|
/// A small synthetic Bundle so loader unit tests never depend on the
|
||||||
PathBuf::from(env!("CARGO_MANIFEST_DIR"))
|
/// product tree (ADR-0070 test-lane separation).
|
||||||
.join("..")
|
fn write_synthetic_bundle(root: &Path) {
|
||||||
.join("..")
|
for (relative, body) in [
|
||||||
.join("stdlib")
|
("io.mq.md", "## @knowledge test\n"),
|
||||||
|
("io/console.mq.md", "## @knowledge console\n"),
|
||||||
|
] {
|
||||||
|
let path = root.join(relative);
|
||||||
|
std::fs::create_dir_all(path.parent().unwrap()).unwrap();
|
||||||
|
std::fs::write(path, body).unwrap();
|
||||||
|
}
|
||||||
|
let digest = tree_digest(root).unwrap();
|
||||||
|
let manifest = serde_json::json!({
|
||||||
|
"name": "test-stdlib",
|
||||||
|
"version": "0.0.0-test",
|
||||||
|
"digest": digest,
|
||||||
|
});
|
||||||
|
std::fs::write(
|
||||||
|
root.join("stdlib.json"),
|
||||||
|
serde_json::to_vec(&manifest).unwrap(),
|
||||||
|
)
|
||||||
|
.unwrap();
|
||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn dev_bundle_verifies_and_resolves() {
|
fn synthetic_bundle_verifies_and_resolves() {
|
||||||
let bundle = StdlibBundle::load(dev_bundle()).unwrap();
|
let dir = tempfile::tempdir().unwrap();
|
||||||
assert!(bundle.digest.starts_with("sha256:"));
|
write_synthetic_bundle(dir.path());
|
||||||
|
let bundle = StdlibBundle::load(dir.path()).unwrap();
|
||||||
|
assert_eq!(bundle.version(), "0.0.0-test");
|
||||||
let io = bundle.resolve("io").unwrap();
|
let io = bundle.resolve("io").unwrap();
|
||||||
assert_eq!(io.relative_path, "io.mq.md");
|
assert_eq!(io.relative_path, "io.mq.md");
|
||||||
assert!(io.package.instance_id.starts_with("std:marqdo-stdlib@"));
|
assert!(io.package.instance_id.starts_with("std:test-stdlib@"));
|
||||||
assert!(bundle.resolve("../escape").is_err());
|
assert!(bundle.resolve("../escape").is_err());
|
||||||
|
assert!(bundle.resolve("/absolute").is_err());
|
||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
@@ -476,44 +495,31 @@ mod tests {
|
|||||||
let dir = tempfile::tempdir().unwrap();
|
let dir = tempfile::tempdir().unwrap();
|
||||||
let bundle = dir.path().join("stdlib");
|
let bundle = dir.path().join("stdlib");
|
||||||
std::fs::create_dir_all(&bundle).unwrap();
|
std::fs::create_dir_all(&bundle).unwrap();
|
||||||
for entry in std::fs::read_dir(dev_bundle()).unwrap() {
|
write_synthetic_bundle(&bundle);
|
||||||
let entry = entry.unwrap();
|
|
||||||
let target = bundle.join(entry.file_name());
|
|
||||||
if entry.path().is_dir() {
|
|
||||||
copy_dir(&entry.path(), &target);
|
|
||||||
} else {
|
|
||||||
std::fs::copy(entry.path(), target).unwrap();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
let found = StdlibBundle::discover_from_exe_dir(Some(dir.path().to_path_buf()))
|
let found = StdlibBundle::discover_from_exe_dir(Some(dir.path().to_path_buf()))
|
||||||
.unwrap()
|
.unwrap()
|
||||||
.expect("sibling stdlib");
|
.expect("sibling stdlib");
|
||||||
assert_eq!(found.root, bundle.canonicalize().unwrap());
|
assert_eq!(found.root(), bundle.canonicalize().unwrap());
|
||||||
}
|
}
|
||||||
|
|
||||||
fn copy_dir(source: &std::path::Path, target: &std::path::Path) {
|
#[test]
|
||||||
std::fs::create_dir_all(target).unwrap();
|
fn bad_override_fails_closed_even_with_a_valid_sibling() {
|
||||||
for entry in std::fs::read_dir(source).unwrap() {
|
let dir = tempfile::tempdir().unwrap();
|
||||||
let entry = entry.unwrap();
|
let sibling = dir.path().join("stdlib");
|
||||||
let destination = target.join(entry.file_name());
|
std::fs::create_dir_all(&sibling).unwrap();
|
||||||
if entry.path().is_dir() {
|
write_synthetic_bundle(&sibling);
|
||||||
copy_dir(&entry.path(), &destination);
|
let error = StdlibBundle::discover_with(
|
||||||
} else {
|
Some(dir.path().join("missing")),
|
||||||
std::fs::copy(entry.path(), destination).unwrap();
|
Some(dir.path().to_path_buf()),
|
||||||
}
|
)
|
||||||
}
|
.unwrap_err();
|
||||||
|
assert!(error.contains("cannot open stdlib directory"), "{error}");
|
||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn digest_tamper_is_rejected() {
|
fn digest_tamper_is_rejected() {
|
||||||
let dir = tempfile::tempdir().unwrap();
|
let dir = tempfile::tempdir().unwrap();
|
||||||
let source = dev_bundle();
|
write_synthetic_bundle(dir.path());
|
||||||
for entry in std::fs::read_dir(&source).unwrap() {
|
|
||||||
let entry = entry.unwrap();
|
|
||||||
if entry.path().is_file() {
|
|
||||||
std::fs::copy(entry.path(), dir.path().join(entry.file_name())).unwrap();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
std::fs::write(dir.path().join("io.mq.md"), "## @knowledge tampered\n").unwrap();
|
std::fs::write(dir.path().join("io.mq.md"), "## @knowledge tampered\n").unwrap();
|
||||||
let error = StdlibBundle::load(dir.path()).unwrap_err();
|
let error = StdlibBundle::load(dir.path()).unwrap_err();
|
||||||
assert!(error.contains("digest mismatch"), "{error}");
|
assert!(error.contains("digest mismatch"), "{error}");
|
||||||
|
|||||||
@@ -0,0 +1,589 @@
|
|||||||
|
//! Public Analysis boundary tests (issue #10, ADR-0069).
|
||||||
|
//!
|
||||||
|
//! These drive the real CLI binary: exact source/AST/scope projection, explicit
|
||||||
|
//! reference states, output safety, Observation digest binding, independent
|
||||||
|
//! consumers and schema/semantic mutation rejection.
|
||||||
|
#[path = "support/stdlib.rs"]
|
||||||
|
pub mod stdlib_support;
|
||||||
|
|
||||||
|
use std::path::{Path, PathBuf};
|
||||||
|
use std::process::{Command, Output};
|
||||||
|
use std::sync::atomic::{AtomicU32, Ordering};
|
||||||
|
|
||||||
|
use sha2::{Digest, Sha256};
|
||||||
|
|
||||||
|
static COUNTER: AtomicU32 = AtomicU32::new(0);
|
||||||
|
|
||||||
|
struct TempDir(PathBuf);
|
||||||
|
|
||||||
|
impl TempDir {
|
||||||
|
fn new(tag: &str) -> Self {
|
||||||
|
let id = COUNTER.fetch_add(1, Ordering::Relaxed);
|
||||||
|
let path = std::env::temp_dir().join(format!(
|
||||||
|
"marqdo-analysis-boundary-{}-{id}-{tag}",
|
||||||
|
std::process::id()
|
||||||
|
));
|
||||||
|
let _ = std::fs::remove_dir_all(&path);
|
||||||
|
std::fs::create_dir_all(&path).unwrap();
|
||||||
|
Self(path)
|
||||||
|
}
|
||||||
|
|
||||||
|
fn path(&self) -> &Path {
|
||||||
|
&self.0
|
||||||
|
}
|
||||||
|
|
||||||
|
fn write(&self, name: &str, source: &str) -> PathBuf {
|
||||||
|
let path = self.0.join(name);
|
||||||
|
if let Some(parent) = path.parent() {
|
||||||
|
std::fs::create_dir_all(parent).unwrap();
|
||||||
|
}
|
||||||
|
std::fs::write(&path, source).unwrap();
|
||||||
|
path
|
||||||
|
}
|
||||||
|
|
||||||
|
fn read(&self, name: &str) -> String {
|
||||||
|
std::fs::read_to_string(self.0.join(name)).unwrap()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
impl Drop for TempDir {
|
||||||
|
fn drop(&mut self) {
|
||||||
|
let _ = std::fs::remove_dir_all(&self.0);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
fn cli(dir: &Path, args: &[&str]) -> Output {
|
||||||
|
stdlib_support::cli_command()
|
||||||
|
.args(args)
|
||||||
|
.current_dir(dir)
|
||||||
|
.output()
|
||||||
|
.expect("run marqdo")
|
||||||
|
}
|
||||||
|
|
||||||
|
fn emit(dir: &Path, entry: &str, output: &str, extra: &[&str]) -> Output {
|
||||||
|
let mut args = vec!["check", entry, "--emit", output];
|
||||||
|
args.extend_from_slice(extra);
|
||||||
|
cli(dir, &args)
|
||||||
|
}
|
||||||
|
|
||||||
|
fn analysis(dir: &Path, name: &str) -> serde_json::Value {
|
||||||
|
serde_json::from_slice(&std::fs::read(dir.join(name)).unwrap()).unwrap()
|
||||||
|
}
|
||||||
|
|
||||||
|
fn digest(bytes: &[u8]) -> String {
|
||||||
|
let mut hasher = Sha256::new();
|
||||||
|
hasher.update(bytes);
|
||||||
|
hex::encode(hasher.finalize())
|
||||||
|
}
|
||||||
|
|
||||||
|
fn repo_root() -> PathBuf {
|
||||||
|
Path::new(env!("CARGO_MANIFEST_DIR"))
|
||||||
|
.parent()
|
||||||
|
.unwrap()
|
||||||
|
.parent()
|
||||||
|
.unwrap()
|
||||||
|
.to_path_buf()
|
||||||
|
}
|
||||||
|
|
||||||
|
const DOCUMENT: &str = "\u{feff}# @knowledge 数学\r\n\r\n## @exec 计算\r\n\r\n`params(n: Int)`\r\n\r\n`return n + 1`\r\n\r\n### 细节\r\n\r\n正文\r\n";
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn analysis_projects_exact_source_document_and_complete_scopes() {
|
||||||
|
let dir = TempDir::new("scope");
|
||||||
|
dir.write("index.mq.md", DOCUMENT);
|
||||||
|
let output = emit(dir.path(), "index.mq.md", "analysis.json", &[]);
|
||||||
|
assert!(
|
||||||
|
output.status.success(),
|
||||||
|
"{}",
|
||||||
|
String::from_utf8_lossy(&output.stderr)
|
||||||
|
);
|
||||||
|
let value = analysis(dir.path(), "analysis.json");
|
||||||
|
let module = &value["modules"][0];
|
||||||
|
assert_eq!(module["source"], DOCUMENT);
|
||||||
|
assert_eq!(module["source_digest"], digest(DOCUMENT.as_bytes()));
|
||||||
|
assert_eq!(value["project"]["entry_module_id"], module["id"]);
|
||||||
|
|
||||||
|
let document = &module["document"];
|
||||||
|
assert_eq!(document["kind"], "document");
|
||||||
|
assert_eq!(document["span"]["start"], 0);
|
||||||
|
assert_eq!(
|
||||||
|
document["span"]["end"].as_u64().unwrap() as usize,
|
||||||
|
DOCUMENT.len()
|
||||||
|
);
|
||||||
|
let heading = document["children"]
|
||||||
|
.as_array()
|
||||||
|
.unwrap()
|
||||||
|
.iter()
|
||||||
|
.find(|node| node["kind"] == "heading" && node["level"] == 1)
|
||||||
|
.expect("level-1 heading");
|
||||||
|
assert!(heading["children"].is_array());
|
||||||
|
assert!(heading["children"].as_array().unwrap().iter().any(|node| {
|
||||||
|
node["kind"] == "text"
|
||||||
|
&& node["literal"]
|
||||||
|
.as_str()
|
||||||
|
.is_some_and(|literal| literal.contains("数学"))
|
||||||
|
}));
|
||||||
|
|
||||||
|
let units = module["units"].as_array().unwrap();
|
||||||
|
let by_name = |name: &str| {
|
||||||
|
units
|
||||||
|
.iter()
|
||||||
|
.find(|unit| unit["name"] == name)
|
||||||
|
.unwrap_or_else(|| panic!("missing unit {name}"))
|
||||||
|
};
|
||||||
|
let root = &units[0];
|
||||||
|
assert_eq!(root["kind"], "root");
|
||||||
|
assert_eq!(root["parent_id"], serde_json::Value::Null);
|
||||||
|
assert_eq!(root["heading_span"], serde_json::Value::Null);
|
||||||
|
assert_eq!(root["span"]["start"], 0);
|
||||||
|
assert_eq!(
|
||||||
|
root["span"]["end"].as_u64().unwrap() as usize,
|
||||||
|
DOCUMENT.len()
|
||||||
|
);
|
||||||
|
|
||||||
|
let namespace = by_name("数学");
|
||||||
|
assert_eq!(namespace["kind"], "namespace");
|
||||||
|
assert_eq!(namespace["parent_id"], root["id"]);
|
||||||
|
assert_eq!(namespace["mode"], "knowledge");
|
||||||
|
assert_eq!(namespace["mode_origin"], "explicit");
|
||||||
|
assert_eq!(namespace["mode_source_unit_id"], namespace["id"]);
|
||||||
|
|
||||||
|
let function = by_name("计算");
|
||||||
|
assert_eq!(function["kind"], "function");
|
||||||
|
assert_eq!(function["parent_id"], namespace["id"]);
|
||||||
|
assert_eq!(function["mode"], "exec");
|
||||||
|
assert_eq!(function["mode_origin"], "explicit");
|
||||||
|
assert!(function["function"].is_string());
|
||||||
|
assert_ne!(function["span"], function["heading_span"]);
|
||||||
|
|
||||||
|
let section = by_name("细节");
|
||||||
|
assert_eq!(section["kind"], "section");
|
||||||
|
assert_eq!(section["parent_id"], function["id"]);
|
||||||
|
assert_eq!(section["mode"], "exec");
|
||||||
|
assert_eq!(section["mode_origin"], "inherited");
|
||||||
|
assert_eq!(section["mode_source_unit_id"], function["id"]);
|
||||||
|
// The complete function range includes the H3 child and runs to EOF.
|
||||||
|
assert_eq!(
|
||||||
|
function["span"]["end"].as_u64().unwrap() as usize,
|
||||||
|
DOCUMENT.len()
|
||||||
|
);
|
||||||
|
assert_eq!(
|
||||||
|
section["span"]["end"].as_u64().unwrap() as usize,
|
||||||
|
DOCUMENT.len()
|
||||||
|
);
|
||||||
|
let heading_start = DOCUMENT.find("## @exec 计算").unwrap();
|
||||||
|
assert_eq!(
|
||||||
|
function["heading_span"]["start"].as_u64().unwrap() as usize,
|
||||||
|
heading_start
|
||||||
|
);
|
||||||
|
|
||||||
|
let anchors = module["anchors"].as_array().unwrap();
|
||||||
|
assert!(anchors.iter().any(|anchor| anchor["anchor"] == "计算"));
|
||||||
|
let signature = &module["functions"][0]["signature"];
|
||||||
|
assert_eq!(signature["kind"], "explicit");
|
||||||
|
assert_eq!(signature["params"][0]["name"], "n");
|
||||||
|
assert_eq!(signature["params"][0]["type"], "Int");
|
||||||
|
}
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn reference_states_are_distinct_and_explicit_refs_do_not_change_the_program() {
|
||||||
|
let dir = TempDir::new("references");
|
||||||
|
dir.write(
|
||||||
|
"index.mq.md",
|
||||||
|
"## @exec main\n\n[本地](./other.mq.md#公式) [外链](https://example.com) [本文](#main)\n\n`return 1`\n",
|
||||||
|
);
|
||||||
|
dir.write("other.mq.md", "## @knowledge 公式\n\n正文\n");
|
||||||
|
let ordinary = emit(dir.path(), "index.mq.md", "ordinary.json", &[]);
|
||||||
|
assert!(
|
||||||
|
ordinary.status.success(),
|
||||||
|
"{}",
|
||||||
|
String::from_utf8_lossy(&ordinary.stderr)
|
||||||
|
);
|
||||||
|
let value = analysis(dir.path(), "ordinary.json");
|
||||||
|
assert_eq!(value["modules"].as_array().unwrap().len(), 1);
|
||||||
|
let references = value["modules"][0]["references"].as_array().unwrap();
|
||||||
|
let state = |url: &str| {
|
||||||
|
references
|
||||||
|
.iter()
|
||||||
|
.find(|reference| reference["url"] == url)
|
||||||
|
.unwrap_or_else(|| panic!("missing reference {url}"))["state"]
|
||||||
|
.as_str()
|
||||||
|
.unwrap()
|
||||||
|
.to_string()
|
||||||
|
};
|
||||||
|
assert_eq!(state("./other.mq.md#公式"), "not_loaded");
|
||||||
|
assert_eq!(state("https://example.com"), "external");
|
||||||
|
assert_eq!(state("#main"), "resolved");
|
||||||
|
// The ordinary artifact still describes only the loaded program.
|
||||||
|
assert_eq!(value["modules"].as_array().unwrap().len(), 1);
|
||||||
|
|
||||||
|
// Explicit refs verify the direct target and keep the same ordinary bytes'
|
||||||
|
// module set. The emitted Analysis still uses the loaded catalog.
|
||||||
|
let verified = emit(dir.path(), "index.mq.md", "verified.json", &["--refs"]);
|
||||||
|
assert!(
|
||||||
|
verified.status.success(),
|
||||||
|
"{}",
|
||||||
|
String::from_utf8_lossy(&verified.stderr)
|
||||||
|
);
|
||||||
|
let verified_value = analysis(dir.path(), "verified.json");
|
||||||
|
assert_eq!(verified_value["modules"].as_array().unwrap().len(), 1);
|
||||||
|
let verified_refs = verified_value["modules"][0]["references"]
|
||||||
|
.as_array()
|
||||||
|
.unwrap();
|
||||||
|
assert_eq!(
|
||||||
|
verified_refs
|
||||||
|
.iter()
|
||||||
|
.find(|reference| reference["url"] == "./other.mq.md#公式")
|
||||||
|
.unwrap()["state"],
|
||||||
|
"not_loaded",
|
||||||
|
"the emitted artifact must keep the loaded catalog"
|
||||||
|
);
|
||||||
|
let inspected = cli(dir.path(), &["inspect", "index.mq.md", "--refs", "--json"]);
|
||||||
|
assert!(inspected.status.success());
|
||||||
|
let inspected: serde_json::Value = serde_json::from_slice(&inspected.stdout).unwrap();
|
||||||
|
let resolved = inspected["refs"]
|
||||||
|
.as_array()
|
||||||
|
.unwrap()
|
||||||
|
.iter()
|
||||||
|
.find(|reference| reference["url"] == "./other.mq.md#公式")
|
||||||
|
.unwrap();
|
||||||
|
assert_eq!(resolved["state"], "resolved");
|
||||||
|
assert_eq!(resolved["target_kind"], "module");
|
||||||
|
assert!(resolved["target_module"]
|
||||||
|
.as_str()
|
||||||
|
.unwrap()
|
||||||
|
.ends_with("::other.mq.md"));
|
||||||
|
|
||||||
|
// A broken explicitly verified target is an error and publishes no artifact.
|
||||||
|
dir.write(
|
||||||
|
"broken.mq.md",
|
||||||
|
"## @exec main\n\n[坏](./other.mq.md#不存在)\n\n`return 1`\n",
|
||||||
|
);
|
||||||
|
let broken = emit(dir.path(), "broken.mq.md", "broken.json", &["--refs"]);
|
||||||
|
assert_eq!(broken.status.code(), Some(1), "{broken:?}");
|
||||||
|
assert!(!dir.path().join("broken.json").exists());
|
||||||
|
assert!(String::from_utf8_lossy(&broken.stderr).contains("ref.unresolved"));
|
||||||
|
}
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn emit_refuses_inputs_symlinks_hardlinks_and_directories() {
|
||||||
|
let dir = TempDir::new("emit-safety");
|
||||||
|
let source = "## @exec main\n\n`return 1`\n";
|
||||||
|
let entry = dir.write("index.mq.md", source);
|
||||||
|
|
||||||
|
let self_emit = emit(dir.path(), "index.mq.md", "index.mq.md", &[]);
|
||||||
|
assert_eq!(self_emit.status.code(), Some(2), "{self_emit:?}");
|
||||||
|
assert_eq!(dir.read("index.mq.md"), source);
|
||||||
|
|
||||||
|
#[cfg(unix)]
|
||||||
|
{
|
||||||
|
std::os::unix::fs::symlink(&entry, dir.path().join("link.json")).unwrap();
|
||||||
|
let symlink_emit = emit(dir.path(), "index.mq.md", "link.json", &[]);
|
||||||
|
assert_eq!(symlink_emit.status.code(), Some(2), "{symlink_emit:?}");
|
||||||
|
assert_eq!(dir.read("index.mq.md"), source);
|
||||||
|
|
||||||
|
std::fs::hard_link(&entry, dir.path().join("hard.json")).unwrap();
|
||||||
|
let hard_emit = emit(dir.path(), "index.mq.md", "hard.json", &[]);
|
||||||
|
assert_eq!(hard_emit.status.code(), Some(2), "{hard_emit:?}");
|
||||||
|
assert_eq!(dir.read("index.mq.md"), source);
|
||||||
|
}
|
||||||
|
|
||||||
|
std::fs::create_dir(dir.path().join("outdir")).unwrap();
|
||||||
|
let directory_emit = emit(dir.path(), "index.mq.md", "outdir", &[]);
|
||||||
|
assert_eq!(directory_emit.status.code(), Some(2), "{directory_emit:?}");
|
||||||
|
|
||||||
|
let ok = emit(dir.path(), "index.mq.md", "analysis.json", &[]);
|
||||||
|
assert!(ok.status.success(), "{ok:?}");
|
||||||
|
#[cfg(unix)]
|
||||||
|
{
|
||||||
|
use std::os::unix::fs::PermissionsExt;
|
||||||
|
let mode = std::fs::metadata(dir.path().join("analysis.json"))
|
||||||
|
.unwrap()
|
||||||
|
.permissions()
|
||||||
|
.mode()
|
||||||
|
& 0o777;
|
||||||
|
assert_eq!(mode, 0o600, "Analysis output must be owner-only");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn observation_binds_the_exact_emitted_analysis_bytes() {
|
||||||
|
let dir = TempDir::new("digest");
|
||||||
|
dir.write(
|
||||||
|
"index.mq.md",
|
||||||
|
"## @exec main\n\n`params(n: Int)`\n\n`return n + 1`\n",
|
||||||
|
);
|
||||||
|
let emitted = emit(dir.path(), "index.mq.md", "analysis.json", &[]);
|
||||||
|
assert!(
|
||||||
|
emitted.status.success(),
|
||||||
|
"{}",
|
||||||
|
String::from_utf8_lossy(&emitted.stderr)
|
||||||
|
);
|
||||||
|
let bytes = std::fs::read(dir.path().join("analysis.json")).unwrap();
|
||||||
|
let expected = format!("sha256:{}", digest(&bytes));
|
||||||
|
|
||||||
|
let run = cli(
|
||||||
|
dir.path(),
|
||||||
|
&[
|
||||||
|
"call",
|
||||||
|
"index.mq.md",
|
||||||
|
"main",
|
||||||
|
"--arg",
|
||||||
|
"n=1",
|
||||||
|
"--output",
|
||||||
|
"json",
|
||||||
|
"--observation-file",
|
||||||
|
"observation.json",
|
||||||
|
],
|
||||||
|
);
|
||||||
|
assert!(
|
||||||
|
run.status.success(),
|
||||||
|
"{}",
|
||||||
|
String::from_utf8_lossy(&run.stderr)
|
||||||
|
);
|
||||||
|
let observation = analysis(dir.path(), "observation.json");
|
||||||
|
let started = observation["events"]
|
||||||
|
.as_array()
|
||||||
|
.unwrap()
|
||||||
|
.iter()
|
||||||
|
.find(|event| event["kind"] == "run.started")
|
||||||
|
.expect("run.started");
|
||||||
|
assert_eq!(started["payload"]["source"]["analysis_digest"], expected);
|
||||||
|
}
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn independent_view_lint_and_knowledge_consumers_drive_the_real_cli() {
|
||||||
|
let dir = TempDir::new("consumers");
|
||||||
|
dir.write(
|
||||||
|
"marqdo.yaml",
|
||||||
|
"project:\n name: consumers\n version: 0.1.0\n",
|
||||||
|
);
|
||||||
|
dir.write("theory.mq.md", "## @knowledge 公式\n\n正文\n");
|
||||||
|
dir.write(
|
||||||
|
"index.mq.md",
|
||||||
|
"---\nimport:\n theory: \"./theory.mq.md\"\n---\n\n## @exec main\n\n[公式](./theory.mq.md#公式) [未加载](./notes.mq.md)\n\n`return 1`\n",
|
||||||
|
);
|
||||||
|
dir.write("notes.mq.md", "## @exec main\n\n`return 2`\n");
|
||||||
|
assert!(emit(dir.path(), "index.mq.md", "index.json", &[])
|
||||||
|
.status
|
||||||
|
.success());
|
||||||
|
assert!(emit(dir.path(), "notes.mq.md", "notes.json", &[])
|
||||||
|
.status
|
||||||
|
.success());
|
||||||
|
|
||||||
|
let consumers = repo_root().join("tests/consumers");
|
||||||
|
let run = |script: &str, args: &[&Path]| -> Output {
|
||||||
|
let mut command = Command::new("python3");
|
||||||
|
command.arg(consumers.join(script));
|
||||||
|
for arg in args {
|
||||||
|
command.arg(arg);
|
||||||
|
}
|
||||||
|
command.output().expect("python3 consumer")
|
||||||
|
};
|
||||||
|
let index_json = dir.path().join("index.json");
|
||||||
|
let notes_json = dir.path().join("notes.json");
|
||||||
|
|
||||||
|
let view = run("view_consumer.py", &[&index_json]);
|
||||||
|
assert!(
|
||||||
|
view.status.success(),
|
||||||
|
"{}",
|
||||||
|
String::from_utf8_lossy(&view.stderr)
|
||||||
|
);
|
||||||
|
assert!(String::from_utf8_lossy(&view.stdout).contains("view: rendered=1"));
|
||||||
|
|
||||||
|
let lint = run("lint_consumer.py", &[&index_json]);
|
||||||
|
assert!(
|
||||||
|
lint.status.success(),
|
||||||
|
"{}",
|
||||||
|
String::from_utf8_lossy(&lint.stderr)
|
||||||
|
);
|
||||||
|
let lint_text = String::from_utf8_lossy(&lint.stdout);
|
||||||
|
assert!(lint_text.contains("state=not_loaded"));
|
||||||
|
assert!(lint_text.contains("unresolved=1"));
|
||||||
|
|
||||||
|
let knowledge = run("knowledge_consumer.py", &[&index_json, ¬es_json]);
|
||||||
|
assert!(
|
||||||
|
knowledge.status.success(),
|
||||||
|
"{}",
|
||||||
|
String::from_utf8_lossy(&knowledge.stderr)
|
||||||
|
);
|
||||||
|
let knowledge_text = String::from_utf8_lossy(&knowledge.stdout);
|
||||||
|
assert!(knowledge_text.contains("entries=2"));
|
||||||
|
assert!(knowledge_text.contains("not_loaded=1"));
|
||||||
|
}
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn protocol_validator_accepts_current_bytes_and_rejects_mutations() {
|
||||||
|
let dir = TempDir::new("protocol-validator");
|
||||||
|
dir.write(
|
||||||
|
"index.mq.md",
|
||||||
|
"---\nimport:\n theory: \"./theory.mq.md\"\n---\n\n## @exec main\n\n$$x^2$$\n\n```python\nprint(1)\n```\n\n[公式](./theory.mq.md#公式)\n\n`结果 = theory.加一(1)`\n\n`return 结果`\n",
|
||||||
|
);
|
||||||
|
dir.write(
|
||||||
|
"theory.mq.md",
|
||||||
|
"## @exec 加一\n\n`params(n: Int)`\n\n`return n + 1`\n\n## @knowledge 公式\n\n正文\n",
|
||||||
|
);
|
||||||
|
let check = emit(dir.path(), "index.mq.md", "analysis.json", &[]);
|
||||||
|
assert!(
|
||||||
|
check.status.success(),
|
||||||
|
"{}",
|
||||||
|
String::from_utf8_lossy(&check.stderr)
|
||||||
|
);
|
||||||
|
let run = cli(
|
||||||
|
dir.path(),
|
||||||
|
&[
|
||||||
|
"call",
|
||||||
|
"index.mq.md",
|
||||||
|
"main",
|
||||||
|
"--output",
|
||||||
|
"json",
|
||||||
|
"--observation-file",
|
||||||
|
"observation.json",
|
||||||
|
],
|
||||||
|
);
|
||||||
|
assert!(run.status.success(), "{run:?}");
|
||||||
|
let validator = repo_root().join("tests/consumers/validate_protocols.py");
|
||||||
|
let output = Command::new("python3")
|
||||||
|
.arg(&validator)
|
||||||
|
.arg(dir.path().join("analysis.json"))
|
||||||
|
.arg(dir.path().join("observation.json"))
|
||||||
|
.arg(repo_root().join("examples/tool-unknown-name/tool.json"))
|
||||||
|
.output()
|
||||||
|
.expect("python3 protocol validator");
|
||||||
|
assert!(
|
||||||
|
output.status.success(),
|
||||||
|
"{}",
|
||||||
|
String::from_utf8_lossy(&output.stderr)
|
||||||
|
);
|
||||||
|
assert!(String::from_utf8_lossy(&output.stdout).contains("validated analysis"));
|
||||||
|
}
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn two_entries_keep_their_own_snapshot_context() {
|
||||||
|
let dir = TempDir::new("entries");
|
||||||
|
for (name, body) in [("first", "1"), ("second", "2")] {
|
||||||
|
dir.write(
|
||||||
|
&format!("{name}.mq.md"),
|
||||||
|
&format!("## @exec main\n\n`return {body}`\n"),
|
||||||
|
);
|
||||||
|
let output = emit(
|
||||||
|
dir.path(),
|
||||||
|
&format!("{name}.mq.md"),
|
||||||
|
&format!("{name}.json"),
|
||||||
|
&[],
|
||||||
|
);
|
||||||
|
assert!(output.status.success(), "{output:?}");
|
||||||
|
}
|
||||||
|
let first = analysis(dir.path(), "first.json");
|
||||||
|
let second = analysis(dir.path(), "second.json");
|
||||||
|
assert!(first["project"]["entry_module_id"]
|
||||||
|
.as_str()
|
||||||
|
.unwrap()
|
||||||
|
.ends_with("::first.mq.md"));
|
||||||
|
assert!(second["project"]["entry_module_id"]
|
||||||
|
.as_str()
|
||||||
|
.unwrap()
|
||||||
|
.ends_with("::second.mq.md"));
|
||||||
|
assert_ne!(first["project"]["root_id"], second["project"]["root_id"]);
|
||||||
|
}
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn explicit_refs_verify_plain_files_reject_symlinks_and_never_guess_coverage() {
|
||||||
|
let dir = TempDir::new("refs-files");
|
||||||
|
dir.write("marqdo.yaml", "project:\n name: files\n version: 0.1.0\n");
|
||||||
|
dir.write("asset.pdf", "%PDF-1.4 not a program\n");
|
||||||
|
dir.write("notes.md", "# Notes\n\nplain markdown\n");
|
||||||
|
dir.write(
|
||||||
|
"index.mq.md",
|
||||||
|
"## @exec main\n\n[资产](./asset.pdf) [普通](./notes.md#notes) [越界](./%2e%2e/secret.mq.md)\n\n`return 1`\n",
|
||||||
|
);
|
||||||
|
#[cfg(unix)]
|
||||||
|
{
|
||||||
|
std::os::unix::fs::symlink("/etc/hostname", dir.path().join("escape.mq.md")).unwrap();
|
||||||
|
dir.write(
|
||||||
|
"symlink.mq.md",
|
||||||
|
"## @exec main\n\n[逃逸](./escape.mq.md)\n\n`return 1`\n",
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
let inspected = cli(dir.path(), &["inspect", "index.mq.md", "--refs", "--json"]);
|
||||||
|
assert!(inspected.status.success(), "{inspected:?}");
|
||||||
|
let value: serde_json::Value = serde_json::from_slice(&inspected.stdout).unwrap();
|
||||||
|
let refs = value["refs"].as_array().unwrap();
|
||||||
|
let by_url = |url: &str| {
|
||||||
|
refs.iter()
|
||||||
|
.find(|reference| reference["url"] == url)
|
||||||
|
.unwrap_or_else(|| panic!("missing {url}"))
|
||||||
|
};
|
||||||
|
assert_eq!(by_url("./asset.pdf")["state"], "resolved");
|
||||||
|
assert_eq!(by_url("./asset.pdf")["target_kind"], "file");
|
||||||
|
assert_eq!(by_url("./notes.md#notes")["state"], "not_loaded");
|
||||||
|
assert_eq!(by_url("./%2e%2e/secret.mq.md")["state"], "outside_scope");
|
||||||
|
let issues = value["reference_issues"].as_array().unwrap();
|
||||||
|
assert!(issues.iter().any(|issue| issue["code"] == "ref.invalid"));
|
||||||
|
assert!(issues.iter().any(|issue| issue["code"] == "ref.not_loaded"));
|
||||||
|
|
||||||
|
#[cfg(unix)]
|
||||||
|
{
|
||||||
|
let symlinked = cli(
|
||||||
|
dir.path(),
|
||||||
|
&["inspect", "symlink.mq.md", "--refs", "--json"],
|
||||||
|
);
|
||||||
|
assert!(symlinked.status.success(), "{symlinked:?}");
|
||||||
|
let value: serde_json::Value = serde_json::from_slice(&symlinked.stdout).unwrap();
|
||||||
|
assert_eq!(value["refs"][0]["state"], "not_loaded");
|
||||||
|
assert!(value["reference_issues"]
|
||||||
|
.as_array()
|
||||||
|
.unwrap()
|
||||||
|
.iter()
|
||||||
|
.any(|issue| issue["code"] == "ref.invalid"));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn missing_unimported_program_is_an_explicit_refs_error_but_not_loaded_otherwise() {
|
||||||
|
let dir = TempDir::new("refs-missing");
|
||||||
|
dir.write(
|
||||||
|
"index.mq.md",
|
||||||
|
"## @exec main\n\n[不存在](./absent.mq.md#x)\n\n`return 1`\n",
|
||||||
|
);
|
||||||
|
let ordinary = emit(dir.path(), "index.mq.md", "ordinary.json", &[]);
|
||||||
|
assert!(ordinary.status.success(), "{ordinary:?}");
|
||||||
|
let analysis = analysis(dir.path(), "ordinary.json");
|
||||||
|
assert_eq!(
|
||||||
|
analysis["modules"][0]["references"][0]["state"],
|
||||||
|
"not_loaded"
|
||||||
|
);
|
||||||
|
let refs = emit(dir.path(), "index.mq.md", "refs.json", &["--refs"]);
|
||||||
|
assert_eq!(refs.status.code(), Some(1), "{refs:?}");
|
||||||
|
assert!(!dir.path().join("refs.json").exists());
|
||||||
|
assert!(String::from_utf8_lossy(&refs.stderr).contains("ref.unresolved"));
|
||||||
|
}
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn lock_digest_binds_the_prepared_lock_snapshot() {
|
||||||
|
let dir = TempDir::new("lock-digest");
|
||||||
|
dir.write("marqdo.yaml", "project:\n name: lock\n version: 0.1.0\n");
|
||||||
|
dir.write("index.mq.md", "## @exec main\n\n`return 1`\n");
|
||||||
|
let lock = cli(dir.path(), &["lock"]);
|
||||||
|
assert!(lock.status.success(), "{lock:?}");
|
||||||
|
let locked = emit(dir.path(), "index.mq.md", "locked.json", &[]);
|
||||||
|
assert!(locked.status.success(), "{locked:?}");
|
||||||
|
let lock_bytes = std::fs::read(dir.path().join("marqdo.lock")).unwrap();
|
||||||
|
let analysis = analysis(dir.path(), "locked.json");
|
||||||
|
assert_eq!(
|
||||||
|
analysis["project"]["lock_digest"],
|
||||||
|
format!("sha256:{}", digest(&lock_bytes))
|
||||||
|
);
|
||||||
|
let manifest_bytes = std::fs::read(dir.path().join("marqdo.yaml")).unwrap();
|
||||||
|
assert_eq!(
|
||||||
|
analysis["project"]["manifest_digest"],
|
||||||
|
format!("sha256:{}", digest(&manifest_bytes))
|
||||||
|
);
|
||||||
|
|
||||||
|
// A lock that no longer validates cannot leave a success artifact behind.
|
||||||
|
std::fs::write(dir.path().join("marqdo.lock"), "lock_version: 4\n").unwrap();
|
||||||
|
let failed = emit(dir.path(), "index.mq.md", "locked.json", &[]);
|
||||||
|
assert_ne!(failed.status.code(), Some(0), "{failed:?}");
|
||||||
|
assert!(!dir.path().join("locked.json").exists());
|
||||||
|
}
|
||||||
@@ -1,5 +1,7 @@
|
|||||||
//! Public Analysis and Observation black-box contracts (spec/analysis.md,
|
//! Public Analysis and Observation black-box contracts (spec/analysis.md,
|
||||||
//! spec/observation.md).
|
//! spec/observation.md).
|
||||||
|
#[path = "support/stdlib.rs"]
|
||||||
|
pub mod stdlib_support;
|
||||||
|
|
||||||
#[path = "support/observation.rs"]
|
#[path = "support/observation.rs"]
|
||||||
pub mod observation;
|
pub mod observation;
|
||||||
@@ -34,12 +36,8 @@ impl Drop for TempDir {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fn binary() -> &'static str {
|
|
||||||
env!("CARGO_BIN_EXE_marqdo")
|
|
||||||
}
|
|
||||||
|
|
||||||
fn cli(dir: &Path, args: &[&str]) -> Output {
|
fn cli(dir: &Path, args: &[&str]) -> Output {
|
||||||
Command::new(binary())
|
stdlib_support::cli_command()
|
||||||
.args(args)
|
.args(args)
|
||||||
.current_dir(dir)
|
.current_dir(dir)
|
||||||
.output()
|
.output()
|
||||||
@@ -267,9 +265,16 @@ print(1)
|
|||||||
assert_eq!(code["language"], "python");
|
assert_eq!(code["language"], "python");
|
||||||
assert_eq!(formula["content_digest"].as_str().unwrap().len(), 64);
|
assert_eq!(formula["content_digest"].as_str().unwrap().len(), 64);
|
||||||
assert_eq!(code["content_digest"].as_str().unwrap().len(), 64);
|
assert_eq!(code["content_digest"].as_str().unwrap().len(), 64);
|
||||||
assert!(
|
let source = analysis["modules"][0]["source"]
|
||||||
!analysis.to_string().contains("A = x + 1"),
|
.as_str()
|
||||||
"resource payloads stay in source, not Analysis"
|
.expect("exact source is public");
|
||||||
|
assert!(source.contains("A = x + 1"));
|
||||||
|
assert_eq!(
|
||||||
|
source.len(),
|
||||||
|
analysis["modules"][0]["source_digest"]
|
||||||
|
.as_str()
|
||||||
|
.map(|_| source.len())
|
||||||
|
.unwrap_or(0)
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,10 +1,15 @@
|
|||||||
//! Architecture boundary gate (review RFC-CM P0/P1).
|
//! Architecture boundary gate (review RFC-CM P0/P1).
|
||||||
//!
|
//!
|
||||||
//! These checks pin the documented layering: the runtime depends on the host
|
//! These checks pin the documented layering: the engine depends on the neutral
|
||||||
//! platform layer, the bundled stdlib stays in this repository, `std:` import
|
//! Host contract (never the native host), the plugin ABI contract carries no
|
||||||
//! targets resolve only inside the bundle, and the host keeps the documented
|
//! loader/worker execution side, the stdlib Bundle is an explicit ecosystem
|
||||||
//! stdio/file/TCP resource endpoints. They are source and digest checks, not an
|
//! input rather than an in-repo source tree, `std:` import targets resolve only
|
||||||
//! OS-sandbox proof.
|
//! inside the bundle, and the host keeps the
|
||||||
|
//! documented stdio/file/TCP resource endpoints. They are source and digest
|
||||||
|
//! checks, not an OS-sandbox proof; `tools/ci/check_dependency_boundaries.py`
|
||||||
|
//! adds the Cargo-metadata graph gate.
|
||||||
|
#[path = "support/stdlib.rs"]
|
||||||
|
pub mod stdlib_support;
|
||||||
|
|
||||||
use std::path::{Path, PathBuf};
|
use std::path::{Path, PathBuf};
|
||||||
|
|
||||||
@@ -23,87 +28,154 @@ fn read(path: &Path) -> String {
|
|||||||
std::fs::read_to_string(path).unwrap_or_else(|error| panic!("read {}: {error}", path.display()))
|
std::fs::read_to_string(path).unwrap_or_else(|error| panic!("read {}: {error}", path.display()))
|
||||||
}
|
}
|
||||||
|
|
||||||
const WORKSPACE_CRATES: &[&str] = &[
|
/// Issue #13 / ADR-0071: the reviewed responsibility allowlist is the crate
|
||||||
"marqdo-span",
|
/// table in the single current architecture overview, not a frozen count. A new
|
||||||
"marqdo-value",
|
/// crate must be added there (and to the dependency gate's reviewed map) in the
|
||||||
"marqdo-expression",
|
/// same change.
|
||||||
"marqdo-markdown",
|
|
||||||
"marqdo-ir",
|
|
||||||
"marqdo-frontend",
|
|
||||||
"marqdo-foreign",
|
|
||||||
"marqdo-plugin-abi",
|
|
||||||
"marqdo-provider-worker",
|
|
||||||
"marqdo-worker-ipc",
|
|
||||||
"marqdo-plugin-sdk",
|
|
||||||
"marqdo-host",
|
|
||||||
"marqdo-runtime",
|
|
||||||
"marqdo-package",
|
|
||||||
"marqdo-sandbox",
|
|
||||||
"cli",
|
|
||||||
];
|
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn workspace_crates_match_the_documented_layers() {
|
fn workspace_crates_are_documented_responsibilities() {
|
||||||
let manifest = read(&repo_root().join("Cargo.toml"));
|
let root = repo_root();
|
||||||
|
let manifest = read(&root.join("Cargo.toml"));
|
||||||
let members = manifest
|
let members = manifest
|
||||||
.split("members = [")
|
.split("members = [")
|
||||||
.nth(1)
|
.nth(1)
|
||||||
.and_then(|rest| rest.split(']').next())
|
.and_then(|rest| rest.split(']').next())
|
||||||
.expect("workspace members");
|
.expect("workspace members");
|
||||||
let names: Vec<&str> = members
|
let names: Vec<String> = members
|
||||||
.split(',')
|
.split(',')
|
||||||
.map(|item| item.trim().trim_matches('"'))
|
.map(|item| item.trim().trim_matches('"'))
|
||||||
.filter(|item| !item.is_empty())
|
.filter(|item| !item.is_empty())
|
||||||
|
.map(|member| {
|
||||||
|
let directory = member
|
||||||
|
.strip_prefix("crates/")
|
||||||
|
.expect("workspace members are crates/<name>");
|
||||||
|
let manifest = read(&root.join(member).join("Cargo.toml"));
|
||||||
|
manifest
|
||||||
|
.lines()
|
||||||
|
.find_map(|line| line.strip_prefix("name = "))
|
||||||
|
.map(|name| name.trim().trim_matches('"').to_string())
|
||||||
|
.unwrap_or_else(|| directory.to_string())
|
||||||
|
})
|
||||||
.collect();
|
.collect();
|
||||||
let expected: Vec<String> = WORKSPACE_CRATES
|
let current = read(&root.join("docs/architecture/CURRENT.md"));
|
||||||
.iter()
|
let responsibilities = current
|
||||||
.map(|name| format!("crates/{name}"))
|
.split("## Workspace crate responsibility map")
|
||||||
.collect();
|
.nth(1)
|
||||||
assert_eq!(
|
.expect("CURRENT.md must own the reviewed crate responsibility map")
|
||||||
names,
|
.split("\n## ")
|
||||||
expected.iter().map(String::as_str).collect::<Vec<_>>(),
|
.next()
|
||||||
"workspace members drifted; update docs/architecture/CURRENT.md with the layer"
|
.unwrap_or("");
|
||||||
);
|
for name in &names {
|
||||||
assert!(
|
assert!(
|
||||||
!names.contains(&"crates/marqdo-stdlib"),
|
responsibilities.contains(&format!("`{name}`")),
|
||||||
"the stdlib must stay in this repository (ADR-0039), not become a crate"
|
"workspace crate `{name}` has no documented responsibility in CURRENT.md"
|
||||||
|
);
|
||||||
|
}
|
||||||
|
for name in [
|
||||||
|
"marqdo-host-contract",
|
||||||
|
"marqdo-host",
|
||||||
|
"marqdo-plugin-abi",
|
||||||
|
"marqdo-cli",
|
||||||
|
] {
|
||||||
|
assert!(
|
||||||
|
names.iter().any(|crate_name| crate_name == name),
|
||||||
|
"required layer crate `{name}` is missing from the workspace"
|
||||||
|
);
|
||||||
|
}
|
||||||
|
assert!(
|
||||||
|
!names.iter().any(|name| name == "marqdo-stdlib"),
|
||||||
|
"the stdlib is a Bundle input, not a workspace crate (ADR-0039/ADR-0070)"
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn runtime_depends_on_the_host_platform_layer_without_a_cycle() {
|
fn engine_depends_on_the_neutral_host_contract_only() {
|
||||||
let runtime = read(&repo_root().join("crates/marqdo-runtime/Cargo.toml"));
|
let root = repo_root();
|
||||||
|
let runtime = read(&root.join("crates/marqdo-runtime/Cargo.toml"));
|
||||||
|
let runtime_dependencies = runtime
|
||||||
|
.split("[dependencies]")
|
||||||
|
.nth(1)
|
||||||
|
.expect("runtime dependencies")
|
||||||
|
.split("[dev-dependencies]")
|
||||||
|
.next()
|
||||||
|
.expect("runtime normal dependencies");
|
||||||
assert!(
|
assert!(
|
||||||
runtime
|
runtime_dependencies
|
||||||
|
.lines()
|
||||||
|
.any(|line| line.trim() == "marqdo-host-contract = { workspace = true }"),
|
||||||
|
"runtime must depend on the neutral marqdo-host-contract crate"
|
||||||
|
);
|
||||||
|
assert!(
|
||||||
|
!runtime_dependencies
|
||||||
.lines()
|
.lines()
|
||||||
.any(|line| line.trim() == "marqdo-host = { workspace = true }"),
|
.any(|line| line.trim() == "marqdo-host = { workspace = true }"),
|
||||||
"runtime must keep the documented marqdo-runtime -> marqdo-host direction"
|
"runtime normal/build dependencies must not link the native host"
|
||||||
);
|
);
|
||||||
let host = read(&repo_root().join("crates/marqdo-host/Cargo.toml"));
|
let contract = read(&root.join("crates/marqdo-host-contract/Cargo.toml"));
|
||||||
|
let contract_deps: Vec<&str> = contract
|
||||||
|
.split("[dependencies]")
|
||||||
|
.nth(1)
|
||||||
|
.expect("contract dependencies")
|
||||||
|
.lines()
|
||||||
|
.filter_map(|line| line.split('=').next())
|
||||||
|
.map(str::trim)
|
||||||
|
.filter(|name| !name.is_empty() && !name.starts_with('['))
|
||||||
|
.collect();
|
||||||
|
assert_eq!(
|
||||||
|
contract_deps,
|
||||||
|
["marqdo-span", "marqdo-value"],
|
||||||
|
"the host contract must stay platform neutral (value/span only)"
|
||||||
|
);
|
||||||
|
let host = read(&root.join("crates/marqdo-host/Cargo.toml"));
|
||||||
|
for forbidden in ["marqdo-runtime", "marqdo-frontend", "marqdo-ir ="] {
|
||||||
assert!(
|
assert!(
|
||||||
!host.contains("marqdo-runtime"),
|
!host.contains(forbidden),
|
||||||
"marqdo-host must not depend back on marqdo-runtime"
|
"the native host must not depend back on `{forbidden}`"
|
||||||
|
);
|
||||||
|
}
|
||||||
|
assert!(
|
||||||
|
host.contains("marqdo-host-contract = { workspace = true }"),
|
||||||
|
"the native host must implement the neutral contract crate"
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn bundled_stdlib_stays_in_this_repository_and_matches_its_digest() {
|
fn stdlib_sources_live_in_the_ecosystem_not_in_this_repository() {
|
||||||
let root = repo_root().join("stdlib");
|
// Phase B (ADR-0070): the in-repo source tree is gone. The accepted Bundle
|
||||||
|
// identity is the ecosystem pin; product tests consume an explicit, verified
|
||||||
|
// Bundle (CI materializes it with tools/ci/fetch_ecosystem_bundle.py).
|
||||||
|
assert!(
|
||||||
|
!repo_root().join("stdlib").exists(),
|
||||||
|
"Phase B must not carry an in-repo stdlib source tree"
|
||||||
|
);
|
||||||
|
let pin = stdlib_support::BundlePin::committed();
|
||||||
|
assert!(
|
||||||
|
pin.source_path.is_none(),
|
||||||
|
"the accepted Bundle pin must name the ecosystem source, not a vendored path"
|
||||||
|
);
|
||||||
|
assert_eq!(pin.name, "marqdo-stdlib");
|
||||||
|
assert_eq!(pin.version, "0.2.0");
|
||||||
|
assert_eq!(pin.source_commit.len(), 40);
|
||||||
|
let root = stdlib_support::bundle_dir();
|
||||||
let manifest: serde_json::Value =
|
let manifest: serde_json::Value =
|
||||||
serde_json::from_slice(&std::fs::read(root.join("stdlib.json")).unwrap()).unwrap();
|
serde_json::from_slice(&std::fs::read(root.join("stdlib.json")).unwrap()).unwrap();
|
||||||
assert_eq!(manifest["name"], "marqdo-stdlib");
|
assert_eq!(manifest["name"], pin.name);
|
||||||
assert_eq!(manifest["version"], "0.1.0");
|
assert_eq!(manifest["version"], pin.version);
|
||||||
let declared = manifest["digest"].as_str().expect("digest string");
|
let declared = manifest["digest"].as_str().expect("digest string");
|
||||||
|
assert_eq!(
|
||||||
|
declared, pin.tree_digest,
|
||||||
|
"the resolved Bundle must match the pin"
|
||||||
|
);
|
||||||
let actual = format!("sha256:{}", tree_digest(&root).unwrap());
|
let actual = format!("sha256:{}", tree_digest(&root).unwrap());
|
||||||
assert_eq!(
|
assert_eq!(
|
||||||
actual, declared,
|
actual, declared,
|
||||||
"stdlib digest mismatch; regenerate it with tools/pack-stdlib.py and commit the digest"
|
"stdlib digest mismatch; rebuild the Bundle from the pinned ecosystem gitlinks"
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn stdlib_imports_resolve_inside_the_bundle() {
|
fn stdlib_imports_resolve_inside_the_bundle() {
|
||||||
let root = repo_root().join("stdlib");
|
let root = stdlib_support::bundle_dir();
|
||||||
for entry in walk_markdown(&root) {
|
for entry in walk_markdown(&root) {
|
||||||
let is_test = entry.starts_with(root.join("tests"));
|
let is_test = entry.starts_with(root.join("tests"));
|
||||||
let text = read(&entry);
|
let text = read(&entry);
|
||||||
@@ -153,7 +225,6 @@ fn shared_worker_transport_is_neutral_and_not_duplicated() {
|
|||||||
}
|
}
|
||||||
for user in [
|
for user in [
|
||||||
"crates/marqdo-host/Cargo.toml",
|
"crates/marqdo-host/Cargo.toml",
|
||||||
"crates/marqdo-plugin-abi/Cargo.toml",
|
|
||||||
"crates/marqdo-provider-worker/Cargo.toml",
|
"crates/marqdo-provider-worker/Cargo.toml",
|
||||||
] {
|
] {
|
||||||
assert!(
|
assert!(
|
||||||
@@ -164,8 +235,8 @@ fn shared_worker_transport_is_neutral_and_not_duplicated() {
|
|||||||
// The four-byte length prefix and its bounds live in exactly one crate.
|
// The four-byte length prefix and its bounds live in exactly one crate.
|
||||||
for private in [
|
for private in [
|
||||||
"crates/marqdo-host/src/plugin_worker.rs",
|
"crates/marqdo-host/src/plugin_worker.rs",
|
||||||
|
"crates/marqdo-host/src/plugin/worker.rs",
|
||||||
"crates/marqdo-host/src/provider_worker.rs",
|
"crates/marqdo-host/src/provider_worker.rs",
|
||||||
"crates/marqdo-plugin-abi/src/worker.rs",
|
|
||||||
"crates/marqdo-provider-worker/src/main.rs",
|
"crates/marqdo-provider-worker/src/main.rs",
|
||||||
] {
|
] {
|
||||||
let text = read(&root.join(private));
|
let text = read(&root.join(private));
|
||||||
@@ -409,12 +480,12 @@ fn builtin_names_and_aliases_are_reviewed() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Exhaustive matches make a new HostOp or Value variant require review under ADR-0064.
|
// Exhaustive matches make a new HostOp or Value variant require review under ADR-0064.
|
||||||
const _: fn(marqdo_host::HostOp) = |operation| match operation {
|
const _: fn(marqdo_host_contract::HostOp) = |operation| match operation {
|
||||||
marqdo_host::HostOp::ForeignRun
|
marqdo_host_contract::HostOp::ForeignRun
|
||||||
| marqdo_host::HostOp::ForeignCall
|
| marqdo_host_contract::HostOp::ForeignCall
|
||||||
| marqdo_host::HostOp::FsRead
|
| marqdo_host_contract::HostOp::FsRead
|
||||||
| marqdo_host::HostOp::FsWrite
|
| marqdo_host_contract::HostOp::FsWrite
|
||||||
| marqdo_host::HostOp::PluginInvoke => (),
|
| marqdo_host_contract::HostOp::PluginInvoke => (),
|
||||||
};
|
};
|
||||||
|
|
||||||
const _: fn(marqdo_value::Value) = |value| match value {
|
const _: fn(marqdo_value::Value) = |value| match value {
|
||||||
@@ -439,7 +510,7 @@ const _: fn(marqdo_value::Value) = |value| match value {
|
|||||||
/// hard-coded runtime names. Recompute the canonical metadata digest.
|
/// hard-coded runtime names. Recompute the canonical metadata digest.
|
||||||
#[test]
|
#[test]
|
||||||
fn official_stdlib_public_aliases_are_verified_metadata() {
|
fn official_stdlib_public_aliases_are_verified_metadata() {
|
||||||
let root = repo_root().join("stdlib");
|
let root = stdlib_support::bundle_dir();
|
||||||
let manifest: serde_json::Value =
|
let manifest: serde_json::Value =
|
||||||
serde_json::from_slice(&std::fs::read(root.join("stdlib.json")).unwrap()).unwrap();
|
serde_json::from_slice(&std::fs::read(root.join("stdlib.json")).unwrap()).unwrap();
|
||||||
let aliases = manifest["public_aliases"]
|
let aliases = manifest["public_aliases"]
|
||||||
@@ -565,6 +636,129 @@ fn domain_math_kernel_is_not_part_of_the_core() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// E02/E03: there is exactly one Host trait/HostOp definition and it belongs to
|
||||||
|
/// the neutral contract; the native host only implements it.
|
||||||
|
#[test]
|
||||||
|
fn host_contract_is_the_single_side_effect_interface() {
|
||||||
|
let root = repo_root();
|
||||||
|
let mut host_traits = Vec::new();
|
||||||
|
let mut host_ops = Vec::new();
|
||||||
|
for source in walk_rs(&root.join("crates")) {
|
||||||
|
let relative = source
|
||||||
|
.strip_prefix(&root)
|
||||||
|
.unwrap()
|
||||||
|
.to_string_lossy()
|
||||||
|
.to_string();
|
||||||
|
if relative.contains("/tests/") {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
let text = read(&source);
|
||||||
|
if text.contains("pub trait Host {") {
|
||||||
|
host_traits.push(relative.clone());
|
||||||
|
}
|
||||||
|
if text.contains("pub enum HostOp {") {
|
||||||
|
host_ops.push(relative);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
assert_eq!(
|
||||||
|
host_traits,
|
||||||
|
["crates/marqdo-host-contract/src/host.rs"],
|
||||||
|
"the Host trait must be defined once in the neutral contract"
|
||||||
|
);
|
||||||
|
assert_eq!(
|
||||||
|
host_ops,
|
||||||
|
["crates/marqdo-host-contract/src/host.rs"],
|
||||||
|
"HostOp must be defined once in the neutral contract"
|
||||||
|
);
|
||||||
|
let runtime = read(&root.join("crates/marqdo-runtime/src/interpreter.rs"));
|
||||||
|
assert!(
|
||||||
|
runtime.contains("use marqdo_host_contract::{"),
|
||||||
|
"the interpreter must consume the neutral contract"
|
||||||
|
);
|
||||||
|
let host = read(&root.join("crates/marqdo-host/src/host.rs"));
|
||||||
|
assert!(
|
||||||
|
host.contains("impl Host for StdHost"),
|
||||||
|
"StdHost remains the single native host implementation"
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
/// A05/S01: the public ABI crate is a contract, not a loader; execution side
|
||||||
|
/// lives in the native host and the SDK consumes only the contract.
|
||||||
|
#[test]
|
||||||
|
fn plugin_contract_carries_no_native_execution() {
|
||||||
|
let root = repo_root();
|
||||||
|
let abi = read(&root.join("crates/marqdo-plugin-abi/Cargo.toml"));
|
||||||
|
for forbidden in ["libloading", "marqdo-worker-ipc", "serde_yaml", "sha2"] {
|
||||||
|
assert!(
|
||||||
|
!abi.contains(forbidden),
|
||||||
|
"marqdo-plugin-abi must not depend on execution-side `{forbidden}`"
|
||||||
|
);
|
||||||
|
}
|
||||||
|
for module in ["loader", "worker", "manifest", "artifact"] {
|
||||||
|
assert!(
|
||||||
|
!root
|
||||||
|
.join(format!("crates/marqdo-plugin-abi/src/{module}.rs"))
|
||||||
|
.exists(),
|
||||||
|
"`{module}` is execution-side and belongs to the native host"
|
||||||
|
);
|
||||||
|
}
|
||||||
|
for module in ["loader", "worker", "manifest", "artifact"] {
|
||||||
|
assert!(
|
||||||
|
root.join(format!("crates/marqdo-host/src/plugin/{module}.rs"))
|
||||||
|
.exists(),
|
||||||
|
"native host must own plugin `{module}`"
|
||||||
|
);
|
||||||
|
}
|
||||||
|
let sdk = read(&root.join("crates/marqdo-plugin-sdk/Cargo.toml"));
|
||||||
|
for forbidden in [
|
||||||
|
"marqdo-host",
|
||||||
|
"marqdo-cli",
|
||||||
|
"libloading",
|
||||||
|
"marqdo-worker-ipc",
|
||||||
|
] {
|
||||||
|
assert!(
|
||||||
|
!sdk.contains(forbidden),
|
||||||
|
"the plugin SDK must not depend on `{forbidden}`"
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// E01/E04: the independent embedding consumer is a real package outside the
|
||||||
|
/// workspace and depends only on engine crates.
|
||||||
|
#[test]
|
||||||
|
fn embedding_consumer_is_engine_only() {
|
||||||
|
let root = repo_root();
|
||||||
|
let consumer = read(&root.join("tests/embedding/Cargo.toml"));
|
||||||
|
assert!(
|
||||||
|
consumer.contains("[workspace]"),
|
||||||
|
"the embedding consumer must be its own workspace to avoid feature unification"
|
||||||
|
);
|
||||||
|
assert!(
|
||||||
|
consumer.contains("marqdo-runtime"),
|
||||||
|
"the embedding consumer must execute through the real runtime"
|
||||||
|
);
|
||||||
|
for forbidden in [
|
||||||
|
"marqdo-host",
|
||||||
|
"marqdo-cli",
|
||||||
|
"marqdo-sandbox",
|
||||||
|
"marqdo-foreign",
|
||||||
|
] {
|
||||||
|
let dependency_line = format!("\n{forbidden} =");
|
||||||
|
assert!(
|
||||||
|
!consumer.contains(&dependency_line),
|
||||||
|
"the embedding consumer must not depend on `{forbidden}`"
|
||||||
|
);
|
||||||
|
}
|
||||||
|
assert!(
|
||||||
|
root.join("tests/embedding/Cargo.lock").is_file(),
|
||||||
|
"the independent consumer must pin its own lock file"
|
||||||
|
);
|
||||||
|
assert!(
|
||||||
|
root.join("tools/ci/check_engine_boundary.py").is_file(),
|
||||||
|
"the build-and-run engine gate must exist"
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
fn hex(bytes: &[u8]) -> String {
|
fn hex(bytes: &[u8]) -> String {
|
||||||
let mut out = String::with_capacity(bytes.len() * 2);
|
let mut out = String::with_capacity(bytes.len() * 2);
|
||||||
for byte in bytes {
|
for byte in bytes {
|
||||||
|
|||||||
@@ -4,6 +4,9 @@
|
|||||||
//! point is to prove that `check` and `run` share one static resolution and
|
//! point is to prove that `check` and `run` share one static resolution and
|
||||||
//! that the runtime never guesses a plugin from a dotted string prefix.
|
//! that the runtime never guesses a plugin from a dotted string prefix.
|
||||||
#![cfg(unix)]
|
#![cfg(unix)]
|
||||||
|
#[path = "support/stdlib.rs"]
|
||||||
|
pub mod stdlib_support;
|
||||||
|
|
||||||
#[path = "support/observation.rs"]
|
#[path = "support/observation.rs"]
|
||||||
pub mod observation;
|
pub mod observation;
|
||||||
|
|
||||||
@@ -11,7 +14,7 @@ use std::path::{Path, PathBuf};
|
|||||||
use std::process::{Command, Output};
|
use std::process::{Command, Output};
|
||||||
use std::sync::atomic::{AtomicU32, Ordering};
|
use std::sync::atomic::{AtomicU32, Ordering};
|
||||||
|
|
||||||
use marqdo_plugin_abi::{sha256_file, HostTarget};
|
use marqdo_host::plugin::{sha256_file, HostTarget};
|
||||||
|
|
||||||
static COUNTER: AtomicU32 = AtomicU32::new(0);
|
static COUNTER: AtomicU32 = AtomicU32::new(0);
|
||||||
|
|
||||||
@@ -49,7 +52,7 @@ fn repo() -> PathBuf {
|
|||||||
}
|
}
|
||||||
|
|
||||||
fn cli(args: &[&str], dir: &Path) -> Output {
|
fn cli(args: &[&str], dir: &Path) -> Output {
|
||||||
Command::new(env!("CARGO_BIN_EXE_marqdo"))
|
stdlib_support::cli_command()
|
||||||
.args(args)
|
.args(args)
|
||||||
.current_dir(dir)
|
.current_dir(dir)
|
||||||
.output()
|
.output()
|
||||||
|
|||||||
@@ -18,11 +18,15 @@
|
|||||||
//! Developer note: `UPDATE_SEMANTICS_GOLDENS=1` rewrites `value`/`stdout` from
|
//! Developer note: `UPDATE_SEMANTICS_GOLDENS=1` rewrites `value`/`stdout` from
|
||||||
//! the implementation. Never use it without hand-checking every rewritten
|
//! the implementation. Never use it without hand-checking every rewritten
|
||||||
//! expectation; the checked-in goldens were reviewed individually.
|
//! expectation; the checked-in goldens were reviewed individually.
|
||||||
|
#[path = "support/stdlib.rs"]
|
||||||
|
pub mod stdlib_support;
|
||||||
|
|
||||||
use std::fs;
|
use std::fs;
|
||||||
|
|
||||||
use std::path::{Path, PathBuf};
|
use std::path::{Path, PathBuf};
|
||||||
|
|
||||||
use marqdo_host::{Capabilities, Host, StdHost};
|
use marqdo_host::{Capabilities, StdHost};
|
||||||
|
use marqdo_host_contract::Host;
|
||||||
use marqdo_ir::{ModuleId, Program, ResolvedImport};
|
use marqdo_ir::{ModuleId, Program, ResolvedImport};
|
||||||
use marqdo_runtime::{run, EvaluatedArg};
|
use marqdo_runtime::{run, EvaluatedArg};
|
||||||
use marqdo_sandbox::SandboxMode;
|
use marqdo_sandbox::SandboxMode;
|
||||||
@@ -291,7 +295,7 @@ fn normalise_relative(path: &Path) -> String {
|
|||||||
/// unique registry, run the single binding pass and install its table. There is
|
/// unique registry, run the single binding pass and install its table. There is
|
||||||
/// no `print_override` and no runtime name guessing.
|
/// no `print_override` and no runtime name guessing.
|
||||||
fn bind_calls_with_stdlib_aliases(program: &mut Program) {
|
fn bind_calls_with_stdlib_aliases(program: &mut Program) {
|
||||||
let root = repo_root().join("stdlib");
|
let root = stdlib_support::bundle_dir();
|
||||||
let mut loaded = std::collections::BTreeSet::new();
|
let mut loaded = std::collections::BTreeSet::new();
|
||||||
let mut official = Vec::new();
|
let mut official = Vec::new();
|
||||||
if root.join("stdlib.json").is_file() {
|
if root.join("stdlib.json").is_file() {
|
||||||
@@ -428,7 +432,7 @@ fn install_entry_stdlib_imports(
|
|||||||
module_id: &ModuleId,
|
module_id: &ModuleId,
|
||||||
analysis: &marqdo_frontend::AnalysisResult,
|
analysis: &marqdo_frontend::AnalysisResult,
|
||||||
) {
|
) {
|
||||||
let root = repo_root().join("stdlib");
|
let root = stdlib_support::bundle_dir();
|
||||||
let Some(imports) = analysis
|
let Some(imports) = analysis
|
||||||
.document
|
.document
|
||||||
.frontmatter()
|
.frontmatter()
|
||||||
|
|||||||
@@ -1,11 +1,13 @@
|
|||||||
//! R6 integration examples that do not require an official external repo.
|
//! R6 integration examples that do not require an official external repo.
|
||||||
#![cfg(unix)]
|
#![cfg(unix)]
|
||||||
|
#[path = "support/stdlib.rs"]
|
||||||
|
pub mod stdlib_support;
|
||||||
|
|
||||||
#[path = "support/observation.rs"]
|
#[path = "support/observation.rs"]
|
||||||
pub mod observation;
|
pub mod observation;
|
||||||
|
|
||||||
use std::path::Path;
|
use std::path::Path;
|
||||||
use std::process::{Command, Output};
|
use std::process::Output;
|
||||||
|
|
||||||
fn repo() -> &'static Path {
|
fn repo() -> &'static Path {
|
||||||
Path::new(env!("CARGO_MANIFEST_DIR"))
|
Path::new(env!("CARGO_MANIFEST_DIR"))
|
||||||
@@ -16,7 +18,7 @@ fn repo() -> &'static Path {
|
|||||||
}
|
}
|
||||||
|
|
||||||
fn cli(args: &[&str]) -> Output {
|
fn cli(args: &[&str]) -> Output {
|
||||||
Command::new(env!("CARGO_BIN_EXE_marqdo"))
|
stdlib_support::cli_command()
|
||||||
.args(args)
|
.args(args)
|
||||||
.current_dir(repo())
|
.current_dir(repo())
|
||||||
.output()
|
.output()
|
||||||
@@ -27,31 +29,6 @@ fn stderr(output: &Output) -> String {
|
|||||||
String::from_utf8_lossy(&output.stderr).to_string()
|
String::from_utf8_lossy(&output.stderr).to_string()
|
||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
|
||||||
fn mqmd_stdlib_print_output_matches_builtin_print() {
|
|
||||||
let output = cli(&["run", "stdlib/demo.mq.md"]);
|
|
||||||
assert_eq!(output.status.code(), Some(0), "{}", stderr(&output));
|
|
||||||
let stdout = String::from_utf8_lossy(&output.stdout);
|
|
||||||
let lines: Vec<&str> = stdout.lines().collect();
|
|
||||||
assert_eq!(lines.len(), 6, "{stdout:?}");
|
|
||||||
for pair in [(0, 1), (2, 3), (4, 5)] {
|
|
||||||
assert_eq!(
|
|
||||||
lines[pair.0], lines[pair.1],
|
|
||||||
"stdlib formatting differs from 打印 at line {}",
|
|
||||||
pair.0
|
|
||||||
);
|
|
||||||
}
|
|
||||||
assert_eq!(
|
|
||||||
lines[0],
|
|
||||||
r#"["文本", 2, 1.5, [3, true], {a: 1, b: "x"}, None]"#
|
|
||||||
);
|
|
||||||
assert_eq!(lines[2], "Table[名称 | 分数]{甲 | 87; 乙 | 92}");
|
|
||||||
assert_eq!(
|
|
||||||
lines[4],
|
|
||||||
r#"[Formula("a = 1"), Code("text", 9 bytes), FunctionRef(root:default::demo.mq.md::演示函数)]"#
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn addressable_memory_example_runs_through_the_cli() {
|
fn addressable_memory_example_runs_through_the_cli() {
|
||||||
let output = cli(&["run", "examples/memory-buffer.mq.md", "--output", "json"]);
|
let output = cli(&["run", "examples/memory-buffer.mq.md", "--output", "json"]);
|
||||||
@@ -113,14 +90,14 @@ fn unknown_tool_name_installs_and_dispatches() {
|
|||||||
.unwrap()
|
.unwrap()
|
||||||
.as_nanos()
|
.as_nanos()
|
||||||
));
|
));
|
||||||
let install = Command::new(env!("CARGO_BIN_EXE_marqdo"))
|
let install = stdlib_support::cli_command()
|
||||||
.args(["tool", "install", "examples/tool-unknown-name/tool.json"])
|
.args(["tool", "install", "examples/tool-unknown-name/tool.json"])
|
||||||
.env("MARQDO_TOOL_HOME", &home)
|
.env("MARQDO_TOOL_HOME", &home)
|
||||||
.current_dir(repo())
|
.current_dir(repo())
|
||||||
.output()
|
.output()
|
||||||
.unwrap();
|
.unwrap();
|
||||||
assert_eq!(install.status.code(), Some(0), "{}", stderr(&install));
|
assert_eq!(install.status.code(), Some(0), "{}", stderr(&install));
|
||||||
let run = Command::new(env!("CARGO_BIN_EXE_marqdo"))
|
let run = stdlib_support::cli_command()
|
||||||
.args(["benchmark", "run", "."])
|
.args(["benchmark", "run", "."])
|
||||||
.env("MARQDO_TOOL_HOME", &home)
|
.env("MARQDO_TOOL_HOME", &home)
|
||||||
.current_dir(repo())
|
.current_dir(repo())
|
||||||
@@ -128,7 +105,7 @@ fn unknown_tool_name_installs_and_dispatches() {
|
|||||||
.unwrap();
|
.unwrap();
|
||||||
assert_eq!(run.status.code(), Some(0), "{}", stderr(&run));
|
assert_eq!(run.status.code(), Some(0), "{}", stderr(&run));
|
||||||
assert!(String::from_utf8_lossy(&run.stdout).contains("arg=run"));
|
assert!(String::from_utf8_lossy(&run.stdout).contains("arg=run"));
|
||||||
let remove = Command::new(env!("CARGO_BIN_EXE_marqdo"))
|
let remove = stdlib_support::cli_command()
|
||||||
.args(["tool", "remove", "benchmark"])
|
.args(["tool", "remove", "benchmark"])
|
||||||
.env("MARQDO_TOOL_HOME", &home)
|
.env("MARQDO_TOOL_HOME", &home)
|
||||||
.current_dir(repo())
|
.current_dir(repo())
|
||||||
|
|||||||
@@ -4,12 +4,14 @@
|
|||||||
//! sources, `marqdo lock` records their exact identity, and `check`/`run`
|
//! sources, `marqdo lock` records their exact identity, and `check`/`run`
|
||||||
//! compare the current declaration with the lock before using any extension.
|
//! compare the current declaration with the lock before using any extension.
|
||||||
#![cfg(unix)]
|
#![cfg(unix)]
|
||||||
|
#[path = "support/stdlib.rs"]
|
||||||
|
pub mod stdlib_support;
|
||||||
|
|
||||||
use std::path::{Path, PathBuf};
|
use std::path::{Path, PathBuf};
|
||||||
use std::process::{Command, Output};
|
use std::process::{Command, Output};
|
||||||
use std::sync::atomic::{AtomicU32, Ordering};
|
use std::sync::atomic::{AtomicU32, Ordering};
|
||||||
|
|
||||||
use marqdo_plugin_abi::{sha256_file, HostTarget};
|
use marqdo_host::plugin::{sha256_file, HostTarget};
|
||||||
|
|
||||||
static COUNTER: AtomicU32 = AtomicU32::new(0);
|
static COUNTER: AtomicU32 = AtomicU32::new(0);
|
||||||
|
|
||||||
@@ -47,7 +49,7 @@ fn repo() -> PathBuf {
|
|||||||
}
|
}
|
||||||
|
|
||||||
fn cli(args: &[&str], dir: &Path) -> Output {
|
fn cli(args: &[&str], dir: &Path) -> Output {
|
||||||
Command::new(env!("CARGO_BIN_EXE_marqdo"))
|
stdlib_support::cli_command()
|
||||||
.args(args)
|
.args(args)
|
||||||
.current_dir(dir)
|
.current_dir(dir)
|
||||||
.output()
|
.output()
|
||||||
|
|||||||
@@ -5,9 +5,11 @@
|
|||||||
//! binary and assert that `check --emit`, `run` and `call` agree.
|
//! binary and assert that `check --emit`, `run` and `call` agree.
|
||||||
|
|
||||||
#![cfg(unix)]
|
#![cfg(unix)]
|
||||||
|
#[path = "support/stdlib.rs"]
|
||||||
|
pub mod stdlib_support;
|
||||||
|
|
||||||
use std::path::{Path, PathBuf};
|
use std::path::{Path, PathBuf};
|
||||||
use std::process::{Command, Output};
|
use std::process::Output;
|
||||||
use std::sync::atomic::{AtomicU32, Ordering};
|
use std::sync::atomic::{AtomicU32, Ordering};
|
||||||
|
|
||||||
static COUNTER: AtomicU32 = AtomicU32::new(0);
|
static COUNTER: AtomicU32 = AtomicU32::new(0);
|
||||||
@@ -41,7 +43,7 @@ impl Drop for TempDir {
|
|||||||
}
|
}
|
||||||
|
|
||||||
fn cli(args: &[&str], dir: &Path) -> Output {
|
fn cli(args: &[&str], dir: &Path) -> Output {
|
||||||
Command::new(env!("CARGO_BIN_EXE_marqdo"))
|
stdlib_support::cli_command()
|
||||||
.args(args)
|
.args(args)
|
||||||
.current_dir(dir)
|
.current_dir(dir)
|
||||||
.output()
|
.output()
|
||||||
|
|||||||
@@ -8,6 +8,8 @@
|
|||||||
//!
|
//!
|
||||||
//! Temporary directories live under the OS temp directory and are removed on
|
//! Temporary directories live under the OS temp directory and are removed on
|
||||||
//! drop; the repository itself is never modified.
|
//! drop; the repository itself is never modified.
|
||||||
|
#[path = "support/stdlib.rs"]
|
||||||
|
pub mod stdlib_support;
|
||||||
|
|
||||||
#[path = "support/observation.rs"]
|
#[path = "support/observation.rs"]
|
||||||
pub mod observation;
|
pub mod observation;
|
||||||
@@ -75,7 +77,7 @@ impl Drop for TempDir {
|
|||||||
|
|
||||||
/// Run the CLI in `dir`.
|
/// Run the CLI in `dir`.
|
||||||
fn cli(dir: &Path, args: &[&str]) -> Output {
|
fn cli(dir: &Path, args: &[&str]) -> Output {
|
||||||
Command::new(env!("CARGO_BIN_EXE_marqdo"))
|
stdlib_support::cli_command()
|
||||||
.args(args)
|
.args(args)
|
||||||
.current_dir(dir)
|
.current_dir(dir)
|
||||||
.output()
|
.output()
|
||||||
@@ -84,7 +86,7 @@ fn cli(dir: &Path, args: &[&str]) -> Output {
|
|||||||
|
|
||||||
/// Run the CLI in `dir` with one extra environment variable.
|
/// Run the CLI in `dir` with one extra environment variable.
|
||||||
fn cli_env(dir: &Path, args: &[&str], key: &str, value: &str) -> Output {
|
fn cli_env(dir: &Path, args: &[&str], key: &str, value: &str) -> Output {
|
||||||
Command::new(env!("CARGO_BIN_EXE_marqdo"))
|
stdlib_support::cli_command()
|
||||||
.args(args)
|
.args(args)
|
||||||
.current_dir(dir)
|
.current_dir(dir)
|
||||||
.env(key, value)
|
.env(key, value)
|
||||||
@@ -663,7 +665,7 @@ fn inspect_outputs_ast_units_signatures_ir_and_refs() {
|
|||||||
assert_exit(&refs, 0, "inspect --refs");
|
assert_exit(&refs, 0, "inspect --refs");
|
||||||
let value = json_stdout(&refs);
|
let value = json_stdout(&refs);
|
||||||
let edges = value["refs"].as_array().expect("refs array");
|
let edges = value["refs"].as_array().expect("refs array");
|
||||||
assert!(edges.iter().any(|edge| edge["resolved"] == true));
|
assert!(edges.iter().any(|edge| edge["state"] == "resolved"));
|
||||||
|
|
||||||
// A broken #anchor is reported as unresolved by `inspect --refs`.
|
// A broken #anchor is reported as unresolved by `inspect --refs`.
|
||||||
let dir = TempDir::new("refs");
|
let dir = TempDir::new("refs");
|
||||||
@@ -677,7 +679,8 @@ fn inspect_outputs_ast_units_signatures_ir_and_refs() {
|
|||||||
let edges = value["refs"].as_array().expect("refs array");
|
let edges = value["refs"].as_array().expect("refs array");
|
||||||
assert_eq!(edges.len(), 1);
|
assert_eq!(edges.len(), 1);
|
||||||
assert_eq!(edges[0]["url"], "#不存在的标题");
|
assert_eq!(edges[0]["url"], "#不存在的标题");
|
||||||
assert_eq!(edges[0]["resolved"], false);
|
assert_eq!(edges[0]["state"], "missing");
|
||||||
|
assert_eq!(edges[0]["target_unit"], serde_json::Value::Null);
|
||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
@@ -782,7 +785,7 @@ fn lock_and_sync_locked_detect_dependency_tampering() {
|
|||||||
/// the Linux-only example manifest. This is what makes the integration test a
|
/// the Linux-only example manifest. This is what makes the integration test a
|
||||||
/// real test on macOS/Windows rather than an accidental "no matching artifact".
|
/// real test on macOS/Windows rather than an accidental "no matching artifact".
|
||||||
fn host_triple() -> String {
|
fn host_triple() -> String {
|
||||||
marqdo_plugin_abi::artifact::current_target_triple()
|
marqdo_host::plugin::artifact::current_target_triple()
|
||||||
.as_str()
|
.as_str()
|
||||||
.to_string()
|
.to_string()
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -4,9 +4,11 @@
|
|||||||
//! checked-in examples.
|
//! checked-in examples.
|
||||||
|
|
||||||
#![cfg(unix)]
|
#![cfg(unix)]
|
||||||
|
#[path = "support/stdlib.rs"]
|
||||||
|
pub mod stdlib_support;
|
||||||
|
|
||||||
use std::path::{Path, PathBuf};
|
use std::path::{Path, PathBuf};
|
||||||
use std::process::{Command, Output};
|
use std::process::Output;
|
||||||
use std::sync::atomic::{AtomicU32, Ordering};
|
use std::sync::atomic::{AtomicU32, Ordering};
|
||||||
|
|
||||||
static COUNTER: AtomicU32 = AtomicU32::new(0);
|
static COUNTER: AtomicU32 = AtomicU32::new(0);
|
||||||
@@ -49,7 +51,7 @@ fn repo() -> PathBuf {
|
|||||||
}
|
}
|
||||||
|
|
||||||
fn cli(args: &[&str], dir: &Path) -> Output {
|
fn cli(args: &[&str], dir: &Path) -> Output {
|
||||||
Command::new(env!("CARGO_BIN_EXE_marqdo"))
|
stdlib_support::cli_command()
|
||||||
.args(args)
|
.args(args)
|
||||||
.current_dir(dir)
|
.current_dir(dir)
|
||||||
.output()
|
.output()
|
||||||
|
|||||||
@@ -4,6 +4,8 @@
|
|||||||
//! stdout line stream exactly like an external consumer. They cover the P0
|
//! stdout line stream exactly like an external consumer. They cover the P0
|
||||||
//! envelope/lifecycle/byte-fidelity contract and the P1 frame/value policy,
|
//! envelope/lifecycle/byte-fidelity contract and the P1 frame/value policy,
|
||||||
//! plus snapshot equivalence, truncation, live delivery and a broken pipe.
|
//! plus snapshot equivalence, truncation, live delivery and a broken pipe.
|
||||||
|
#[path = "support/stdlib.rs"]
|
||||||
|
pub mod stdlib_support;
|
||||||
|
|
||||||
use std::fs;
|
use std::fs;
|
||||||
use std::io::{BufRead, BufReader, Read};
|
use std::io::{BufRead, BufReader, Read};
|
||||||
@@ -51,7 +53,7 @@ impl Drop for TempDir {
|
|||||||
}
|
}
|
||||||
|
|
||||||
fn cli(dir: &Path, args: &[&str]) -> std::process::Output {
|
fn cli(dir: &Path, args: &[&str]) -> std::process::Output {
|
||||||
Command::new(env!("CARGO_BIN_EXE_marqdo"))
|
stdlib_support::cli_command()
|
||||||
.args(args)
|
.args(args)
|
||||||
.current_dir(dir)
|
.current_dir(dir)
|
||||||
.output()
|
.output()
|
||||||
@@ -280,7 +282,7 @@ fn native_plugin_is_fail_closed_in_event_mode() {
|
|||||||
let digest = hex::encode(sha2::Sha256::digest(fs::read(&artifact).unwrap()));
|
let digest = hex::encode(sha2::Sha256::digest(fs::read(&artifact).unwrap()));
|
||||||
let manifest = format!(
|
let manifest = format!(
|
||||||
"plugin:\n name: demo.solver\n version: 0.1.0\n abi: \"^1.0\"\n kind: native\n exports:\n - name: solver.add\n signature: \"($a: Int, $b: Int) -> Int\"\n requires:\n - math.compute\n artifacts:\n - target: {}\n file: solver.so\n sha256: \"{}\"\n",
|
"plugin:\n name: demo.solver\n version: 0.1.0\n abi: \"^1.0\"\n kind: native\n exports:\n - name: solver.add\n signature: \"($a: Int, $b: Int) -> Int\"\n requires:\n - math.compute\n artifacts:\n - target: {}\n file: solver.so\n sha256: \"{}\"\n",
|
||||||
marqdo_plugin_abi::HostTarget::current().triple(),
|
marqdo_host::plugin::HostTarget::current().triple(),
|
||||||
digest
|
digest
|
||||||
);
|
);
|
||||||
fs::write(plugin_dir.join("plugin.yaml"), manifest).unwrap();
|
fs::write(plugin_dir.join("plugin.yaml"), manifest).unwrap();
|
||||||
@@ -670,7 +672,7 @@ fn live_chunks_arrive_while_the_program_is_still_running() {
|
|||||||
let dir = TempDir::new("live");
|
let dir = TempDir::new("live");
|
||||||
let source = "## @exec main\n\n`打印(\"READY\")`\n\n`i = 0`\n\n`while i < 2000000`\n\n`i = i + 1`\n\n`end`\n\n`打印(\"FINISH\")`\n\n`return i`\n";
|
let source = "## @exec main\n\n`打印(\"READY\")`\n\n`i = 0`\n\n`while i < 2000000`\n\n`i = i + 1`\n\n`end`\n\n`打印(\"FINISH\")`\n\n`return i`\n";
|
||||||
dir.write("index.mq.md", source);
|
dir.write("index.mq.md", source);
|
||||||
let mut child = Command::new(env!("CARGO_BIN_EXE_marqdo"))
|
let mut child = stdlib_support::cli_command()
|
||||||
.args([
|
.args([
|
||||||
"run",
|
"run",
|
||||||
"index.mq.md",
|
"index.mq.md",
|
||||||
@@ -723,7 +725,7 @@ fn broken_pipe_makes_the_run_fail_instead_of_running_forever() {
|
|||||||
let dir = TempDir::new("pipe");
|
let dir = TempDir::new("pipe");
|
||||||
let source = "## @exec main\n\n`打印(\"START\")`\n\n`i = 0`\n\n`while i < 5000000`\n\n`i = i + 1`\n\n`end`\n\n`return i`\n";
|
let source = "## @exec main\n\n`打印(\"START\")`\n\n`i = 0`\n\n`while i < 5000000`\n\n`i = i + 1`\n\n`end`\n\n`return i`\n";
|
||||||
dir.write("index.mq.md", source);
|
dir.write("index.mq.md", source);
|
||||||
let mut child = Command::new(env!("CARGO_BIN_EXE_marqdo"))
|
let mut child = stdlib_support::cli_command()
|
||||||
.args([
|
.args([
|
||||||
"run",
|
"run",
|
||||||
"index.mq.md",
|
"index.mq.md",
|
||||||
|
|||||||
@@ -1,10 +1,11 @@
|
|||||||
//! RFC-CM P2 closure lane: C01–C06/C11/C12 in a pure, no-Foreign/no-Plugin host.
|
//! RFC-CM P2 closure lane: C01–C06/C11/C12 in a pure, no-Foreign/no-Plugin host.
|
||||||
|
#[path = "support/stdlib.rs"]
|
||||||
|
pub mod stdlib_support;
|
||||||
|
|
||||||
#[path = "support/observation.rs"]
|
#[path = "support/observation.rs"]
|
||||||
pub mod observation;
|
pub mod observation;
|
||||||
|
|
||||||
use std::path::{Path, PathBuf};
|
use std::path::{Path, PathBuf};
|
||||||
use std::process::Command;
|
|
||||||
|
|
||||||
fn repo_root() -> PathBuf {
|
fn repo_root() -> PathBuf {
|
||||||
Path::new(env!("CARGO_MANIFEST_DIR"))
|
Path::new(env!("CARGO_MANIFEST_DIR"))
|
||||||
@@ -72,7 +73,7 @@ fn p2_algorithms_run_in_a_pure_no_foreign_no_plugin_host() {
|
|||||||
"{criterion} fixture {name} uses forbidden host shortcut `{forbidden}`"
|
"{criterion} fixture {name} uses forbidden host shortcut `{forbidden}`"
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
let output = Command::new(env!("CARGO_BIN_EXE_marqdo"))
|
let output = stdlib_support::cli_command()
|
||||||
.args([
|
.args([
|
||||||
"run",
|
"run",
|
||||||
path.to_str().unwrap(),
|
path.to_str().unwrap(),
|
||||||
@@ -107,40 +108,6 @@ fn p2_algorithms_run_in_a_pure_no_foreign_no_plugin_host() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
|
||||||
fn p2_stdlib_table_also_runs_in_pure_mode() {
|
|
||||||
let path = repo_root().join("stdlib").join("tests").join("table.mq.md");
|
|
||||||
let output = Command::new(env!("CARGO_BIN_EXE_marqdo"))
|
|
||||||
.args([
|
|
||||||
"run",
|
|
||||||
path.to_str().unwrap(),
|
|
||||||
"--mode",
|
|
||||||
"pure",
|
|
||||||
"--output",
|
|
||||||
"json",
|
|
||||||
])
|
|
||||||
.current_dir(repo_root().join("stdlib"))
|
|
||||||
.env("MARQDO_STDLIB_DIR", repo_root().join("stdlib"))
|
|
||||||
.output()
|
|
||||||
.expect("run table self-test");
|
|
||||||
assert_eq!(
|
|
||||||
output.status.code(),
|
|
||||||
Some(0),
|
|
||||||
"{}",
|
|
||||||
String::from_utf8_lossy(&output.stderr)
|
|
||||||
);
|
|
||||||
let report: serde_json::Value = serde_json::from_slice(&output.stdout).expect("json");
|
|
||||||
assert_eq!(report["run"]["status"], "ok");
|
|
||||||
let items = observation::terminal(&report)["value"]["items"]
|
|
||||||
.as_array()
|
|
||||||
.expect("table test list");
|
|
||||||
assert_eq!(items.len(), 9);
|
|
||||||
assert_eq!(
|
|
||||||
items[8]["value"],
|
|
||||||
"| 名称 | 分数 |\n| --- | --- |\n| 甲 | 87 |\n| 乙 | 92 |\n| 丙 | 71 |"
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn foreign_and_plugin_shortcuts_are_unavailable_in_the_pure_lane() {
|
fn foreign_and_plugin_shortcuts_are_unavailable_in_the_pure_lane() {
|
||||||
let dir = tempfile::tempdir().unwrap();
|
let dir = tempfile::tempdir().unwrap();
|
||||||
@@ -150,7 +117,7 @@ fn foreign_and_plugin_shortcuts_are_unavailable_in_the_pure_lane() {
|
|||||||
"## @knowledge 代码\n\n```python\nprint(1)\n```\n\n## @exec main\n\n`return foreign.call(ref(\"#代码\"), None)`\n",
|
"## @knowledge 代码\n\n```python\nprint(1)\n```\n\n## @exec main\n\n`return foreign.call(ref(\"#代码\"), None)`\n",
|
||||||
)
|
)
|
||||||
.unwrap();
|
.unwrap();
|
||||||
let output = Command::new(env!("CARGO_BIN_EXE_marqdo"))
|
let output = stdlib_support::cli_command()
|
||||||
.args([
|
.args([
|
||||||
"run",
|
"run",
|
||||||
foreign.to_str().unwrap(),
|
foreign.to_str().unwrap(),
|
||||||
@@ -176,7 +143,7 @@ fn foreign_and_plugin_shortcuts_are_unavailable_in_the_pure_lane() {
|
|||||||
"## @exec main\n\n`plugin.invoke(\"missing.export\", {})`\n\n`return None`\n",
|
"## @exec main\n\n`plugin.invoke(\"missing.export\", {})`\n\n`return None`\n",
|
||||||
)
|
)
|
||||||
.unwrap();
|
.unwrap();
|
||||||
let output = Command::new(env!("CARGO_BIN_EXE_marqdo"))
|
let output = stdlib_support::cli_command()
|
||||||
.args([
|
.args([
|
||||||
"run",
|
"run",
|
||||||
plugin.to_str().unwrap(),
|
plugin.to_str().unwrap(),
|
||||||
|
|||||||
@@ -1,6 +1,8 @@
|
|||||||
//! Package instance identity, transitive imports, pinned Git and environment
|
//! Package instance identity, transitive imports, pinned Git and environment
|
||||||
//! materialization (M0.6 R1/R5).
|
//! materialization (M0.6 R1/R5).
|
||||||
#![cfg(unix)]
|
#![cfg(unix)]
|
||||||
|
#[path = "support/stdlib.rs"]
|
||||||
|
pub mod stdlib_support;
|
||||||
|
|
||||||
use std::path::{Path, PathBuf};
|
use std::path::{Path, PathBuf};
|
||||||
use std::process::{Command, Output};
|
use std::process::{Command, Output};
|
||||||
@@ -32,12 +34,8 @@ impl Drop for TempDir {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fn binary() -> &'static str {
|
|
||||||
env!("CARGO_BIN_EXE_marqdo")
|
|
||||||
}
|
|
||||||
|
|
||||||
fn cli(dir: &Path, args: &[&str]) -> Output {
|
fn cli(dir: &Path, args: &[&str]) -> Output {
|
||||||
Command::new(binary())
|
stdlib_support::cli_command()
|
||||||
.args(args)
|
.args(args)
|
||||||
.current_dir(dir)
|
.current_dir(dir)
|
||||||
.output()
|
.output()
|
||||||
|
|||||||
@@ -1,11 +1,13 @@
|
|||||||
//! Isolated plugin worker transport (ADR-0010).
|
//! Isolated plugin worker transport (ADR-0010).
|
||||||
#![cfg(unix)]
|
#![cfg(unix)]
|
||||||
|
#[path = "support/stdlib.rs"]
|
||||||
|
pub mod stdlib_support;
|
||||||
|
|
||||||
use std::path::{Path, PathBuf};
|
use std::path::{Path, PathBuf};
|
||||||
use std::process::{Command, Output};
|
use std::process::{Command, Output};
|
||||||
use std::sync::atomic::{AtomicU32, Ordering};
|
use std::sync::atomic::{AtomicU32, Ordering};
|
||||||
|
|
||||||
use marqdo_plugin_abi::{sha256_file, HostTarget};
|
use marqdo_host::plugin::{sha256_file, HostTarget};
|
||||||
|
|
||||||
static COUNTER: AtomicU32 = AtomicU32::new(0);
|
static COUNTER: AtomicU32 = AtomicU32::new(0);
|
||||||
|
|
||||||
@@ -118,7 +120,7 @@ fn write_manifest(dir: &Path, sha: &str) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
fn run(dir: &Path) -> Output {
|
fn run(dir: &Path) -> Output {
|
||||||
Command::new(env!("CARGO_BIN_EXE_marqdo"))
|
stdlib_support::cli_command()
|
||||||
.args([
|
.args([
|
||||||
"run",
|
"run",
|
||||||
dir.join("doc.mq.md").to_str().unwrap(),
|
dir.join("doc.mq.md").to_str().unwrap(),
|
||||||
@@ -167,7 +169,7 @@ fn worker_crash_is_isolated_from_the_host() {
|
|||||||
"{stderr}"
|
"{stderr}"
|
||||||
);
|
);
|
||||||
// The host process survived and still runs a native Marqdo program.
|
// The host process survived and still runs a native Marqdo program.
|
||||||
let survivor = Command::new(env!("CARGO_BIN_EXE_marqdo"))
|
let survivor = stdlib_support::cli_command()
|
||||||
.args(["run", "examples/hello.mq.md"])
|
.args(["run", "examples/hello.mq.md"])
|
||||||
.current_dir(repo())
|
.current_dir(repo())
|
||||||
.output()
|
.output()
|
||||||
@@ -235,7 +237,7 @@ fn write_capability_manifest(dir: &Path, sha: &str) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
fn run_capability(dir: &Path, allow_read: bool) -> Output {
|
fn run_capability(dir: &Path, allow_read: bool) -> Output {
|
||||||
let mut command = Command::new(env!("CARGO_BIN_EXE_marqdo"));
|
let mut command = stdlib_support::cli_command();
|
||||||
command.args([
|
command.args([
|
||||||
"run",
|
"run",
|
||||||
dir.join("doc.mq.md").to_str().unwrap(),
|
dir.join("doc.mq.md").to_str().unwrap(),
|
||||||
|
|||||||
@@ -1,7 +1,9 @@
|
|||||||
//! Compat-B `打印` routing tests (ADR-0030).
|
//! Compat-B `打印` routing tests (ADR-0030).
|
||||||
|
#[path = "support/stdlib.rs"]
|
||||||
|
pub mod stdlib_support;
|
||||||
|
|
||||||
use std::path::{Path, PathBuf};
|
use std::path::{Path, PathBuf};
|
||||||
use std::process::{Command, Output};
|
use std::process::Output;
|
||||||
|
|
||||||
struct TempDir(PathBuf);
|
struct TempDir(PathBuf);
|
||||||
|
|
||||||
@@ -25,7 +27,7 @@ impl Drop for TempDir {
|
|||||||
}
|
}
|
||||||
|
|
||||||
fn cli(dir: &Path, args: &[&str]) -> Output {
|
fn cli(dir: &Path, args: &[&str]) -> Output {
|
||||||
Command::new(env!("CARGO_BIN_EXE_marqdo"))
|
stdlib_support::cli_command()
|
||||||
.args(args)
|
.args(args)
|
||||||
.current_dir(dir)
|
.current_dir(dir)
|
||||||
.output()
|
.output()
|
||||||
|
|||||||
@@ -15,6 +15,9 @@
|
|||||||
//! Other platforms must keep this file compiling but run no provider
|
//! Other platforms must keep this file compiling but run no provider
|
||||||
//! assertions; the CLI itself fails closed with `ext.platform_unsupported`.
|
//! assertions; the CLI itself fails closed with `ext.platform_unsupported`.
|
||||||
#![cfg(all(target_os = "linux", target_arch = "x86_64"))]
|
#![cfg(all(target_os = "linux", target_arch = "x86_64"))]
|
||||||
|
#[path = "support/stdlib.rs"]
|
||||||
|
pub mod stdlib_support;
|
||||||
|
|
||||||
#[path = "support/observation.rs"]
|
#[path = "support/observation.rs"]
|
||||||
pub mod observation;
|
pub mod observation;
|
||||||
|
|
||||||
@@ -24,7 +27,7 @@ use std::process::{Command, Output};
|
|||||||
use std::sync::atomic::{AtomicU32, Ordering};
|
use std::sync::atomic::{AtomicU32, Ordering};
|
||||||
use std::sync::OnceLock;
|
use std::sync::OnceLock;
|
||||||
|
|
||||||
use marqdo_plugin_abi::HostTarget;
|
use marqdo_host::plugin::HostTarget;
|
||||||
use sha2::{Digest, Sha256};
|
use sha2::{Digest, Sha256};
|
||||||
|
|
||||||
const MARKER_ENV: &str = "MARQDO_TEST_PROVIDER_MARKER";
|
const MARKER_ENV: &str = "MARQDO_TEST_PROVIDER_MARKER";
|
||||||
@@ -400,7 +403,7 @@ fn marker_text(path: &Path) -> String {
|
|||||||
}
|
}
|
||||||
|
|
||||||
fn run_cli(dir: &Path, args: &[&str], marker: &Path) -> Output {
|
fn run_cli(dir: &Path, args: &[&str], marker: &Path) -> Output {
|
||||||
Command::new(cli_binary())
|
stdlib_support::cli_command()
|
||||||
.args(args)
|
.args(args)
|
||||||
.current_dir(dir)
|
.current_dir(dir)
|
||||||
.env(MARKER_ENV, marker)
|
.env(MARKER_ENV, marker)
|
||||||
|
|||||||
@@ -1,11 +1,13 @@
|
|||||||
//! End-to-end resource stream tests through the CLI.
|
//! End-to-end resource stream tests through the CLI.
|
||||||
|
#[path = "support/stdlib.rs"]
|
||||||
|
pub mod stdlib_support;
|
||||||
|
|
||||||
#[path = "support/observation.rs"]
|
#[path = "support/observation.rs"]
|
||||||
pub mod observation;
|
pub mod observation;
|
||||||
|
|
||||||
use std::io::Write;
|
use std::io::Write;
|
||||||
use std::path::{Path, PathBuf};
|
use std::path::{Path, PathBuf};
|
||||||
use std::process::{Command, Output, Stdio};
|
use std::process::{Output, Stdio};
|
||||||
|
|
||||||
struct TempDir(PathBuf);
|
struct TempDir(PathBuf);
|
||||||
|
|
||||||
@@ -30,7 +32,7 @@ impl Drop for TempDir {
|
|||||||
}
|
}
|
||||||
|
|
||||||
fn cli(dir: &Path, args: &[&str]) -> Output {
|
fn cli(dir: &Path, args: &[&str]) -> Output {
|
||||||
Command::new(env!("CARGO_BIN_EXE_marqdo"))
|
stdlib_support::cli_command()
|
||||||
.args(args)
|
.args(args)
|
||||||
.current_dir(dir)
|
.current_dir(dir)
|
||||||
.output()
|
.output()
|
||||||
@@ -38,7 +40,7 @@ fn cli(dir: &Path, args: &[&str]) -> Output {
|
|||||||
}
|
}
|
||||||
|
|
||||||
fn cli_with_stdin(dir: &Path, args: &[&str], input: &[u8]) -> Output {
|
fn cli_with_stdin(dir: &Path, args: &[&str], input: &[u8]) -> Output {
|
||||||
let mut child = Command::new(env!("CARGO_BIN_EXE_marqdo"))
|
let mut child = stdlib_support::cli_command()
|
||||||
.args(args)
|
.args(args)
|
||||||
.current_dir(dir)
|
.current_dir(dir)
|
||||||
.stdin(Stdio::piped())
|
.stdin(Stdio::piped())
|
||||||
|
|||||||
@@ -4,9 +4,11 @@
|
|||||||
//! in the verified `stdlib.json` metadata. There is no `print_override`, no
|
//! in the verified `stdlib.json` metadata. There is no `print_override`, no
|
||||||
//! runtime name special case and no hard-coded per-function scan.
|
//! runtime name special case and no hard-coded per-function scan.
|
||||||
#![cfg(unix)]
|
#![cfg(unix)]
|
||||||
|
#[path = "support/stdlib.rs"]
|
||||||
|
pub mod stdlib_support;
|
||||||
|
|
||||||
use std::path::{Path, PathBuf};
|
use std::path::{Path, PathBuf};
|
||||||
use std::process::{Command, Output};
|
use std::process::Output;
|
||||||
use std::sync::atomic::{AtomicU32, Ordering};
|
use std::sync::atomic::{AtomicU32, Ordering};
|
||||||
|
|
||||||
static COUNTER: AtomicU32 = AtomicU32::new(0);
|
static COUNTER: AtomicU32 = AtomicU32::new(0);
|
||||||
@@ -35,17 +37,8 @@ impl Drop for TempDir {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fn repo() -> PathBuf {
|
|
||||||
Path::new(env!("CARGO_MANIFEST_DIR"))
|
|
||||||
.parent()
|
|
||||||
.unwrap()
|
|
||||||
.parent()
|
|
||||||
.unwrap()
|
|
||||||
.to_path_buf()
|
|
||||||
}
|
|
||||||
|
|
||||||
fn cli(args: &[&str], dir: &Path, env: &[(&str, &Path)]) -> Output {
|
fn cli(args: &[&str], dir: &Path, env: &[(&str, &Path)]) -> Output {
|
||||||
let mut command = Command::new(env!("CARGO_BIN_EXE_marqdo"));
|
let mut command = stdlib_support::cli_command();
|
||||||
command.args(args).current_dir(dir);
|
command.args(args).current_dir(dir);
|
||||||
for (key, value) in env {
|
for (key, value) in env {
|
||||||
command.env(key, value);
|
command.env(key, value);
|
||||||
@@ -62,7 +55,7 @@ fn stdout(output: &Output) -> String {
|
|||||||
}
|
}
|
||||||
|
|
||||||
fn copy_stdlib(target: &Path) {
|
fn copy_stdlib(target: &Path) {
|
||||||
let source = repo().join("stdlib");
|
let source = stdlib_support::bundle_dir();
|
||||||
std::fs::create_dir_all(target).unwrap();
|
std::fs::create_dir_all(target).unwrap();
|
||||||
for entry in std::fs::read_dir(&source).unwrap() {
|
for entry in std::fs::read_dir(&source).unwrap() {
|
||||||
let entry = entry.unwrap();
|
let entry = entry.unwrap();
|
||||||
|
|||||||
@@ -1,27 +1,19 @@
|
|||||||
//! Bundled stdlib (`std:`) and frozen-CLI closure tests (CM-A10).
|
//! Bundled stdlib (`std:`) and frozen-CLI closure tests (CM-A10).
|
||||||
|
#[path = "support/stdlib.rs"]
|
||||||
|
pub mod stdlib_support;
|
||||||
|
|
||||||
use std::path::{Path, PathBuf};
|
use std::path::{Path, PathBuf};
|
||||||
use std::process::Command;
|
|
||||||
|
|
||||||
fn repo_root() -> PathBuf {
|
|
||||||
Path::new(env!("CARGO_MANIFEST_DIR"))
|
|
||||||
.parent()
|
|
||||||
.unwrap()
|
|
||||||
.parent()
|
|
||||||
.unwrap()
|
|
||||||
.to_path_buf()
|
|
||||||
}
|
|
||||||
|
|
||||||
fn binary() -> &'static str {
|
fn binary() -> &'static str {
|
||||||
env!("CARGO_BIN_EXE_marqdo")
|
env!("CARGO_BIN_EXE_marqdo")
|
||||||
}
|
}
|
||||||
|
|
||||||
fn stdlib_dir() -> PathBuf {
|
fn stdlib_dir() -> PathBuf {
|
||||||
repo_root().join("stdlib")
|
stdlib_support::bundle_dir()
|
||||||
}
|
}
|
||||||
|
|
||||||
fn run(dir: &Path, stdlib: &Path, args: &[&str]) -> std::process::Output {
|
fn run(dir: &Path, stdlib: &Path, args: &[&str]) -> std::process::Output {
|
||||||
Command::new(binary())
|
stdlib_support::cli_command()
|
||||||
.args(args)
|
.args(args)
|
||||||
.current_dir(dir)
|
.current_dir(dir)
|
||||||
.env("MARQDO_STDLIB_DIR", stdlib)
|
.env("MARQDO_STDLIB_DIR", stdlib)
|
||||||
|
|||||||
@@ -1,48 +0,0 @@
|
|||||||
//! CM-A08/P5 stdlib HTTP framing module tests.
|
|
||||||
|
|
||||||
#[path = "support/observation.rs"]
|
|
||||||
pub mod observation;
|
|
||||||
|
|
||||||
use std::path::Path;
|
|
||||||
use std::process::Command;
|
|
||||||
|
|
||||||
fn repo_root() -> std::path::PathBuf {
|
|
||||||
Path::new(env!("CARGO_MANIFEST_DIR"))
|
|
||||||
.parent()
|
|
||||||
.unwrap()
|
|
||||||
.parent()
|
|
||||||
.unwrap()
|
|
||||||
.to_path_buf()
|
|
||||||
}
|
|
||||||
|
|
||||||
#[test]
|
|
||||||
fn stdlib_http_parses_chunked_responses_and_builds_requests() {
|
|
||||||
let output = Command::new(env!("CARGO_BIN_EXE_marqdo"))
|
|
||||||
.args(["run", "tests/http.mq.md", "--output", "json"])
|
|
||||||
.current_dir(repo_root().join("stdlib"))
|
|
||||||
.env("MARQDO_STDLIB_DIR", repo_root().join("stdlib"))
|
|
||||||
.output()
|
|
||||||
.expect("run http self-test");
|
|
||||||
assert_eq!(
|
|
||||||
output.status.code(),
|
|
||||||
Some(0),
|
|
||||||
"{}",
|
|
||||||
String::from_utf8_lossy(&output.stderr)
|
|
||||||
);
|
|
||||||
let report: serde_json::Value = serde_json::from_slice(&output.stdout).expect("json");
|
|
||||||
assert_eq!(report["run"]["status"], "ok");
|
|
||||||
let items = observation::terminal(&report)["value"]["items"]
|
|
||||||
.as_array()
|
|
||||||
.expect("list");
|
|
||||||
assert_eq!(items[0]["decimal"], "200");
|
|
||||||
assert_eq!(items[1]["value"], "OK");
|
|
||||||
assert_eq!(items[2]["value"], "text/plain");
|
|
||||||
assert_eq!(items[3]["value"], "hello world");
|
|
||||||
assert_eq!(
|
|
||||||
items[4]["value"],
|
|
||||||
"POST /echo HTTP/1.1\r\nHost: example.test\r\nContent-Length: 2\r\n\r\nok"
|
|
||||||
);
|
|
||||||
assert_eq!(items[5]["decimal"], "200");
|
|
||||||
assert_eq!(items[6]["value"], "你好");
|
|
||||||
assert_eq!(items[7]["value"], "POST / HTTP/1.1\r\n\r\nAB");
|
|
||||||
}
|
|
||||||
+120
-533
@@ -1,570 +1,157 @@
|
|||||||
//! Product-level tests for the whole bundled `marqdo-stdlib` tree.
|
//! CLI product lane against the accepted external stdlib Bundle (ADR-0070 Phase B).
|
||||||
//!
|
//!
|
||||||
//! Every public module in `stdlib/README.md` has a `.mq.md` self-test under
|
//! The standard-library module sources and their self-tests live in the
|
||||||
//! `stdlib/tests/`, and this lane runs the whole directory through the real
|
//! component repositories; this lane proves what the CLI still owns: it loads
|
||||||
//! user import path (`std:` + the verified bundle), not through a conformance
|
//! one verified offline Bundle, resolves the public `std:` surface, and routes
|
||||||
//! fixture or a Rust shortcut.
|
//! the official `print`/`打印` aliases through the ordinary target function.
|
||||||
|
//! The Bundle is an explicit input (`MARQDO_TEST_STDLIB_BUNDLE`) verified
|
||||||
|
//! against `tools/stdlib/bundle-pin.json`; there is no in-repo fallback.
|
||||||
|
|
||||||
#[path = "support/observation.rs"]
|
#[path = "support/observation.rs"]
|
||||||
pub mod observation;
|
pub mod observation;
|
||||||
|
|
||||||
use std::io::Write;
|
#[path = "support/stdlib.rs"]
|
||||||
use std::path::{Path, PathBuf};
|
pub mod stdlib_support;
|
||||||
use std::process::{Command, Stdio};
|
|
||||||
use std::sync::{Mutex, MutexGuard};
|
|
||||||
|
|
||||||
fn repo_root() -> PathBuf {
|
use std::process::{Command, Output};
|
||||||
Path::new(env!("CARGO_MANIFEST_DIR"))
|
|
||||||
.parent()
|
|
||||||
.unwrap()
|
|
||||||
.parent()
|
|
||||||
.unwrap()
|
|
||||||
.to_path_buf()
|
|
||||||
}
|
|
||||||
|
|
||||||
static FS_LOCK: Mutex<()> = Mutex::new(());
|
fn run_fixture(name: &str) -> (serde_json::Value, String) {
|
||||||
|
let bundle = stdlib_support::bundle_dir();
|
||||||
fn lock_fs(name: &str) -> Option<MutexGuard<'static, ()>> {
|
let fixture = stdlib_support::repo_root()
|
||||||
if name == "fs.mq.md" {
|
.join("tests")
|
||||||
Some(FS_LOCK.lock().unwrap_or_else(|error| error.into_inner()))
|
.join("product-stdlib")
|
||||||
} else {
|
.join(format!("{name}.mq.md"));
|
||||||
None
|
let output: Output = Command::new(env!("CARGO_BIN_EXE_marqdo"))
|
||||||
}
|
.args([
|
||||||
}
|
"run",
|
||||||
|
fixture.to_str().expect("utf-8 fixture path"),
|
||||||
fn stdlib_dir() -> PathBuf {
|
"--output",
|
||||||
repo_root().join("stdlib")
|
"json",
|
||||||
}
|
])
|
||||||
|
.env("MARQDO_STDLIB_DIR", &bundle)
|
||||||
struct TestFile {
|
.current_dir(stdlib_support::repo_root())
|
||||||
name: String,
|
.output()
|
||||||
stdin: &'static str,
|
.expect("run marqdo");
|
||||||
stdout: &'static str,
|
|
||||||
args: Vec<String>,
|
|
||||||
env: Vec<(String, String)>,
|
|
||||||
}
|
|
||||||
|
|
||||||
fn product_tests() -> Vec<TestFile> {
|
|
||||||
let dir = stdlib_dir().join("tests");
|
|
||||||
let mut files: Vec<TestFile> = std::fs::read_dir(&dir)
|
|
||||||
.expect("read stdlib tests")
|
|
||||||
.map(|entry| {
|
|
||||||
let path = entry.unwrap().path();
|
|
||||||
if !path.is_file() {
|
|
||||||
return TestFile {
|
|
||||||
name: String::new(),
|
|
||||||
stdin: "",
|
|
||||||
stdout: "",
|
|
||||||
args: Vec::new(),
|
|
||||||
env: Vec::new(),
|
|
||||||
};
|
|
||||||
}
|
|
||||||
let name = path.file_name().unwrap().to_string_lossy().to_string();
|
|
||||||
let (stdin, stdout) = match name.as_str() {
|
|
||||||
"console.mq.md" => ("hello\n", ""),
|
|
||||||
"io.mq.md" => ("", "stdlib self-test\n"),
|
|
||||||
"stream.mq.md" => ("", "stream\n"),
|
|
||||||
_ => ("", ""),
|
|
||||||
};
|
|
||||||
let text_args = |values: &[&str]| -> Vec<String> {
|
|
||||||
values.iter().map(|value| value.to_string()).collect()
|
|
||||||
};
|
|
||||||
let (args, env) = if name == "fs.mq.md" {
|
|
||||||
(
|
|
||||||
text_args(&[
|
|
||||||
"--allow-read",
|
|
||||||
"out",
|
|
||||||
"--allow-read",
|
|
||||||
"out/**",
|
|
||||||
"--allow-write",
|
|
||||||
"out",
|
|
||||||
"--allow-write",
|
|
||||||
"out/**",
|
|
||||||
]),
|
|
||||||
Vec::new(),
|
|
||||||
)
|
|
||||||
} else if name == "env.mq.md" {
|
|
||||||
(
|
|
||||||
text_args(&[
|
|
||||||
"--allow-env",
|
|
||||||
"MARQDO_TEST_ENV",
|
|
||||||
"--allow-env",
|
|
||||||
"MARQDO_MISSING_ENV",
|
|
||||||
]),
|
|
||||||
vec![("MARQDO_TEST_ENV".to_string(), "env-value".to_string())],
|
|
||||||
)
|
|
||||||
} else if name == "process.mq.md" {
|
|
||||||
// Use the test binary itself as the granted program: it exists
|
|
||||||
// on every native platform, unlike the old `/bin/echo` fixture.
|
|
||||||
let program = env!("CARGO_BIN_EXE_marqdo").to_string();
|
|
||||||
(
|
|
||||||
vec![
|
|
||||||
"--allow-env".to_string(),
|
|
||||||
"MARQDO_TEST_PROCESS_PROGRAM".to_string(),
|
|
||||||
"--allow-process".to_string(),
|
|
||||||
program.clone(),
|
|
||||||
],
|
|
||||||
vec![("MARQDO_TEST_PROCESS_PROGRAM".to_string(), program)],
|
|
||||||
)
|
|
||||||
} else if name == "random.mq.md" {
|
|
||||||
(text_args(&["--allow-random"]), Vec::new())
|
|
||||||
} else {
|
|
||||||
(Vec::new(), Vec::new())
|
|
||||||
};
|
|
||||||
TestFile {
|
|
||||||
name,
|
|
||||||
stdin,
|
|
||||||
stdout,
|
|
||||||
args,
|
|
||||||
env,
|
|
||||||
}
|
|
||||||
})
|
|
||||||
.filter(|file| !file.name.is_empty())
|
|
||||||
.collect();
|
|
||||||
files.sort_by(|left, right| left.name.cmp(&right.name));
|
|
||||||
files
|
|
||||||
}
|
|
||||||
|
|
||||||
fn run_product_test(file: &TestFile) -> serde_json::Value {
|
|
||||||
if file.name == "fs.mq.md" {
|
|
||||||
let _ = std::fs::remove_dir_all(stdlib_dir().join("tests/out"));
|
|
||||||
}
|
|
||||||
let mut child = Command::new(env!("CARGO_BIN_EXE_marqdo"))
|
|
||||||
.args(["run"])
|
|
||||||
.arg(stdlib_dir().join("tests").join(&file.name))
|
|
||||||
.args(file.args.iter())
|
|
||||||
.args(["--output", "json"])
|
|
||||||
.current_dir(stdlib_dir())
|
|
||||||
.env("MARQDO_STDLIB_DIR", stdlib_dir())
|
|
||||||
.envs(
|
|
||||||
file.env
|
|
||||||
.iter()
|
|
||||||
.map(|(key, value)| (key.as_str(), value.as_str())),
|
|
||||||
)
|
|
||||||
.stdin(Stdio::piped())
|
|
||||||
.stdout(Stdio::piped())
|
|
||||||
.stderr(Stdio::piped())
|
|
||||||
.spawn()
|
|
||||||
.expect("spawn marqdo");
|
|
||||||
child
|
|
||||||
.stdin
|
|
||||||
.as_mut()
|
|
||||||
.unwrap()
|
|
||||||
.write_all(file.stdin.as_bytes())
|
|
||||||
.unwrap();
|
|
||||||
let output = child.wait_with_output().expect("wait marqdo");
|
|
||||||
assert_eq!(
|
assert_eq!(
|
||||||
output.status.code(),
|
output.status.code(),
|
||||||
Some(0),
|
Some(0),
|
||||||
"{} failed: {}",
|
"{name} failed: {}",
|
||||||
file.name,
|
|
||||||
String::from_utf8_lossy(&output.stderr)
|
String::from_utf8_lossy(&output.stderr)
|
||||||
);
|
);
|
||||||
serde_json::from_slice(&output.stdout).expect("json report")
|
let report: serde_json::Value = serde_json::from_slice(&output.stdout).expect("json report");
|
||||||
|
assert_eq!(report["run"]["status"], "ok", "{name}");
|
||||||
|
let stdout = observation::text(&report, "stdout.chunk");
|
||||||
|
(report, stdout)
|
||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn every_public_stdlib_module_has_a_product_test() {
|
fn the_accepted_bundle_is_external_and_has_the_required_surface() {
|
||||||
let names: Vec<String> = product_tests().into_iter().map(|file| file.name).collect();
|
let pin = stdlib_support::BundlePin::committed();
|
||||||
assert_eq!(
|
assert!(
|
||||||
names,
|
pin.source_path.is_none(),
|
||||||
vec![
|
"Phase B: the accepted Bundle must not be vendored in this repository"
|
||||||
"clock.mq.md",
|
|
||||||
"compress.mq.md",
|
|
||||||
"console.mq.md",
|
|
||||||
"csv.mq.md",
|
|
||||||
"datetime.mq.md",
|
|
||||||
"demo.mq.md",
|
|
||||||
"env.mq.md",
|
|
||||||
"format.mq.md",
|
|
||||||
"fs.mq.md",
|
|
||||||
"http.mq.md",
|
|
||||||
"io.mq.md",
|
|
||||||
"json.mq.md",
|
|
||||||
"path.mq.md",
|
|
||||||
"process.mq.md",
|
|
||||||
"random.mq.md",
|
|
||||||
"regex.mq.md",
|
|
||||||
"stream.mq.md",
|
|
||||||
"table.mq.md",
|
|
||||||
"text.mq.md",
|
|
||||||
"utf8.mq.md",
|
|
||||||
],
|
|
||||||
"a public stdlib module is missing a product test"
|
|
||||||
);
|
);
|
||||||
}
|
let bundle = stdlib_support::bundle_dir();
|
||||||
|
let manifest: serde_json::Value =
|
||||||
#[test]
|
serde_json::from_slice(&std::fs::read(bundle.join("stdlib.json")).unwrap()).unwrap();
|
||||||
fn the_whole_bundled_library_runs_through_std_imports() {
|
assert_eq!(manifest["name"], pin.name);
|
||||||
for file in product_tests() {
|
assert_eq!(manifest["version"], pin.version);
|
||||||
let _guard = lock_fs(&file.name);
|
assert_eq!(manifest["digest"], pin.tree_digest);
|
||||||
let report = run_product_test(&file);
|
assert_eq!(manifest["aliases_digest"], pin.aliases_digest);
|
||||||
assert_eq!(report["run"]["status"], "ok", "{}", file.name);
|
for required in [
|
||||||
assert_eq!(
|
"io.mq.md",
|
||||||
observation::text(&report, "stdout.chunk"),
|
"io/console.mq.md",
|
||||||
file.stdout,
|
"io/stream.mq.md",
|
||||||
"{} wrote unexpected stdout",
|
"format.mq.md",
|
||||||
file.name
|
"text.mq.md",
|
||||||
|
"text/utf8.mq.md",
|
||||||
|
"data/json.mq.md",
|
||||||
|
"collections/table.mq.md",
|
||||||
|
"data/table.mq.md",
|
||||||
|
"fs/file.mq.md",
|
||||||
|
"path.mq.md",
|
||||||
|
] {
|
||||||
|
assert!(
|
||||||
|
bundle.join(required).is_file(),
|
||||||
|
"the accepted Bundle is missing {required}"
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
#[test]
|
|
||||||
fn fs_test_exercises_the_file_operation_surface() {
|
|
||||||
let _guard = lock_fs("fs.mq.md");
|
|
||||||
let report = run_product_test(
|
|
||||||
product_tests()
|
|
||||||
.iter()
|
|
||||||
.find(|file| file.name == "fs.mq.md")
|
|
||||||
.expect("fs test"),
|
|
||||||
);
|
|
||||||
let items = observation::terminal(&report)["value"]["items"]
|
|
||||||
.as_array()
|
|
||||||
.expect("list");
|
|
||||||
assert_eq!(items[0]["value"], true);
|
|
||||||
assert_eq!(items[1]["decimal"], "7");
|
|
||||||
assert_eq!(items[2]["value"], true);
|
|
||||||
assert_eq!(items[3]["value"], "file");
|
|
||||||
assert_eq!(items[4]["decimal"], "7");
|
|
||||||
assert_eq!(items[5]["items"][0]["value"], "fs-a.txt");
|
|
||||||
assert_eq!(items[6]["value"], true);
|
|
||||||
assert_eq!(items[7]["value"], true);
|
|
||||||
assert_eq!(items[8]["value"], true);
|
|
||||||
assert_eq!(items[9]["value"], "你好\n");
|
|
||||||
assert_eq!(items[10]["decimal"], "7");
|
|
||||||
assert_eq!(items[11]["value"], "你好\n世界\n");
|
|
||||||
assert_eq!(items[12]["items"][0]["value"], "fs-b.txt");
|
|
||||||
assert_eq!(items[13]["value"], true);
|
|
||||||
assert_eq!(items[14]["value"], true);
|
|
||||||
assert!(
|
assert!(
|
||||||
!stdlib_dir().join("tests/out").exists(),
|
!bundle.join("tests").exists(),
|
||||||
"the fs test did not remove its directory"
|
"the accepted Bundle must not ship component self-tests"
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn json_test_parses_and_formats_nested_values() {
|
fn official_print_aliases_match_the_target_function_output() {
|
||||||
let report = run_product_test(
|
let (report, stdout) = run_fixture("print-routing");
|
||||||
product_tests()
|
assert_eq!(report["run"]["status"], "ok");
|
||||||
.iter()
|
let lines: Vec<&str> = stdout.lines().collect();
|
||||||
.find(|file| file.name == "json.mq.md")
|
assert_eq!(lines.len(), 6, "{stdout:?}");
|
||||||
.expect("json test"),
|
for pair in [(0, 1), (2, 3), (4, 5)] {
|
||||||
);
|
|
||||||
let items = observation::terminal(&report)["value"]["items"]
|
|
||||||
.as_array()
|
|
||||||
.expect("list");
|
|
||||||
assert_eq!(items[0]["value"], true);
|
|
||||||
assert_eq!(items[1]["decimal"], "1");
|
|
||||||
assert_eq!(items[2]["value"], "说\"好");
|
|
||||||
assert_eq!(
|
assert_eq!(
|
||||||
items[3]["value"],
|
lines[pair.0], lines[pair.1],
|
||||||
"[1, 2.5, -300.0, 0.4, {\"a\": 1.0}, \"x\"]"
|
"official alias formatting differs at line {}",
|
||||||
|
pair.0
|
||||||
|
);
|
||||||
|
}
|
||||||
|
assert_eq!(
|
||||||
|
lines[0],
|
||||||
|
r#"["文本", 2, 1.5, [3, true], {a: 1, b: "x"}, None]"#
|
||||||
|
);
|
||||||
|
assert_eq!(lines[2], "Table[名称 | 分数]{甲 | 87; 乙 | 92}");
|
||||||
|
assert_eq!(
|
||||||
|
lines[4],
|
||||||
|
r#"[Formula("a = 1"), Code("text", 9 bytes), FunctionRef(root:default::print-routing.mq.md::演示函数)]"#
|
||||||
);
|
);
|
||||||
assert_eq!(items[4]["value"], false);
|
|
||||||
assert_eq!(items[5]["value"], "json.invalid_array");
|
|
||||||
assert_eq!(items[6]["value"], "json.trailing");
|
|
||||||
assert_eq!(items[7]["value"], false);
|
|
||||||
assert_eq!(items[8]["value"], "json.depth");
|
|
||||||
assert_eq!(items[9]["value"], true);
|
|
||||||
assert_eq!(items[10]["items"][2]["items"][0]["decimal"], "3");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn csv_test_parses_and_formats_quoted_rows() {
|
fn std_surface_executes_against_the_official_bundle() {
|
||||||
let report = run_product_test(
|
let (report, stdout) = run_fixture("std-surface");
|
||||||
product_tests()
|
assert_eq!(stdout, "");
|
||||||
.iter()
|
assert_eq!(
|
||||||
.find(|file| file.name == "csv.mq.md")
|
observation::terminal(&report)["value"],
|
||||||
.expect("csv test"),
|
serde_json::json!({
|
||||||
|
"type": "list",
|
||||||
|
"items": [
|
||||||
|
{"type": "int", "decimal": "2"},
|
||||||
|
{"type": "text", "value": "é"},
|
||||||
|
{"type": "text", "value": "[1, 2]"},
|
||||||
|
{"type": "text", "value": "[\"ok\", 3]"},
|
||||||
|
{"type": "text", "value": "a/b"},
|
||||||
|
{"type": "text", "value": "2026-11-21T08:00:00.123Z"},
|
||||||
|
{"type": "text", "value": "| 名称 | 分数 |\n| --- | --- |\n| 甲 | 87 |\n| 乙 | 92 |"}
|
||||||
|
]
|
||||||
|
})
|
||||||
);
|
);
|
||||||
let items = observation::terminal(&report)["value"]["items"]
|
|
||||||
.as_array()
|
|
||||||
.expect("list");
|
|
||||||
let row = items[0]["items"].as_array().expect("row");
|
|
||||||
assert_eq!(row.len(), 3);
|
|
||||||
assert_eq!(row[0]["value"], "甲");
|
|
||||||
assert_eq!(row[1]["value"], "乙,丙");
|
|
||||||
assert_eq!(row[2]["value"], "说\"好");
|
|
||||||
assert_eq!(items[1]["value"], "甲,\"乙,丙\",\"说\"\"好\"");
|
|
||||||
let empty = items[2]["items"].as_array().expect("empty row");
|
|
||||||
assert_eq!(empty.len(), 1);
|
|
||||||
assert_eq!(empty[0]["value"], "");
|
|
||||||
assert_eq!(items[3]["value"], "csv.unterminated_quote");
|
|
||||||
let quoted = items[4]["items"].as_array().expect("quoted row");
|
|
||||||
assert_eq!(quoted[0]["value"], "a");
|
|
||||||
assert_eq!(quoted[1]["value"], "b");
|
|
||||||
assert_eq!(items[5]["value"], true);
|
|
||||||
let rows = items[6]["items"].as_array().expect("rows");
|
|
||||||
assert_eq!(rows.len(), 2);
|
|
||||||
assert_eq!(rows[1]["items"][0]["value"], "说\"好");
|
|
||||||
assert_eq!(items[7]["value"], "甲,\"乙,丙\"\n\"说\"\"好\",2");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn path_test_joins_and_normalizes_project_paths() {
|
fn a_missing_explicit_bundle_fails_closed_without_fallback() {
|
||||||
let report = run_product_test(
|
let missing = stdlib_support::repo_root()
|
||||||
product_tests()
|
.join("target")
|
||||||
.iter()
|
.join("does-not-exist-stdlib");
|
||||||
.find(|file| file.name == "path.mq.md")
|
let fixture = stdlib_support::repo_root().join("tests/product-stdlib/std-surface.mq.md");
|
||||||
.expect("path test"),
|
let output = Command::new(env!("CARGO_BIN_EXE_marqdo"))
|
||||||
);
|
.args([
|
||||||
let items = observation::terminal(&report)["value"]["items"]
|
"run",
|
||||||
.as_array()
|
fixture.to_str().expect("utf-8 fixture path"),
|
||||||
.expect("list");
|
"--output",
|
||||||
assert_eq!(items[0]["value"], "a/b/c");
|
"json",
|
||||||
assert_eq!(items[1]["value"], "c.txt");
|
])
|
||||||
assert_eq!(items[2]["value"], "a/b");
|
.env("MARQDO_STDLIB_DIR", &missing)
|
||||||
assert_eq!(items[3]["value"], "txt");
|
.current_dir(stdlib_support::repo_root())
|
||||||
assert_eq!(items[4]["value"], "a/c");
|
|
||||||
assert_eq!(items[5]["value"], "/a/c");
|
|
||||||
assert_eq!(items[6]["value"], "../a/b");
|
|
||||||
assert_eq!(items[7]["value"], true);
|
|
||||||
assert_eq!(items[8]["value"], false);
|
|
||||||
}
|
|
||||||
|
|
||||||
#[test]
|
|
||||||
fn regex_test_matches_anchors_classes_and_search() {
|
|
||||||
let report = run_product_test(
|
|
||||||
product_tests()
|
|
||||||
.iter()
|
|
||||||
.find(|file| file.name == "regex.mq.md")
|
|
||||||
.expect("regex test"),
|
|
||||||
);
|
|
||||||
let items = observation::terminal(&report)["value"]["items"]
|
|
||||||
.as_array()
|
|
||||||
.expect("list");
|
|
||||||
assert_eq!(items[0]["value"], true);
|
|
||||||
assert_eq!(items[1]["value"], false);
|
|
||||||
assert_eq!(items[2]["value"], true);
|
|
||||||
assert_eq!(items[3]["value"], true);
|
|
||||||
assert_eq!(items[4]["value"], true);
|
|
||||||
assert_eq!(items[5]["value"], true);
|
|
||||||
assert_eq!(items[6]["value"], true);
|
|
||||||
assert_eq!(items[7]["value"], true);
|
|
||||||
assert_eq!(items[8]["value"], true);
|
|
||||||
assert_eq!(items[9]["value"], false);
|
|
||||||
assert_eq!(items[10]["value"], "regex.invalid");
|
|
||||||
assert_eq!(items[11]["value"], "regex.unsupported");
|
|
||||||
assert_eq!(items[12]["value"], true);
|
|
||||||
assert_eq!(items[13]["value"], true);
|
|
||||||
let groups = items[14]["items"].as_array().expect("groups");
|
|
||||||
assert_eq!(groups[0]["value"], "aab");
|
|
||||||
assert_eq!(groups[1]["value"], "aa");
|
|
||||||
assert_eq!(groups[2]["value"], "b");
|
|
||||||
}
|
|
||||||
|
|
||||||
#[test]
|
|
||||||
fn datetime_test_formats_and_parses_utc_instants() {
|
|
||||||
let report = run_product_test(
|
|
||||||
product_tests()
|
|
||||||
.iter()
|
|
||||||
.find(|file| file.name == "datetime.mq.md")
|
|
||||||
.expect("datetime test"),
|
|
||||||
);
|
|
||||||
let items = observation::terminal(&report)["value"]["items"]
|
|
||||||
.as_array()
|
|
||||||
.expect("list");
|
|
||||||
assert_eq!(items[0]["value"], "1970-01-01T00:00:00Z");
|
|
||||||
assert_eq!(items[1]["value"], "2023-11-14T22:13:20.123Z");
|
|
||||||
assert_eq!(items[2]["decimal"], "0");
|
|
||||||
assert_eq!(items[3]["decimal"], "1795248000123");
|
|
||||||
assert_eq!(items[4]["value"], false);
|
|
||||||
assert_eq!(items[5]["value"], false);
|
|
||||||
assert_eq!(items[6]["value"], "1969-12-31T23:59:59.999Z");
|
|
||||||
}
|
|
||||||
|
|
||||||
#[test]
|
|
||||||
fn clock_test_reports_project_mode_unix_millis() {
|
|
||||||
let report = run_product_test(
|
|
||||||
product_tests()
|
|
||||||
.iter()
|
|
||||||
.find(|file| file.name == "clock.mq.md")
|
|
||||||
.expect("clock test"),
|
|
||||||
);
|
|
||||||
let items = observation::terminal(&report)["value"]["items"]
|
|
||||||
.as_array()
|
|
||||||
.expect("list");
|
|
||||||
assert_eq!(items[0]["value"], true);
|
|
||||||
assert_eq!(items[1]["value"], "Int");
|
|
||||||
assert_eq!(items[2]["value"], true);
|
|
||||||
}
|
|
||||||
|
|
||||||
#[test]
|
|
||||||
fn env_test_reads_only_granted_names() {
|
|
||||||
let report = run_product_test(
|
|
||||||
product_tests()
|
|
||||||
.iter()
|
|
||||||
.find(|file| file.name == "env.mq.md")
|
|
||||||
.expect("env test"),
|
|
||||||
);
|
|
||||||
let items = observation::terminal(&report)["value"]["items"]
|
|
||||||
.as_array()
|
|
||||||
.expect("list");
|
|
||||||
assert_eq!(items[0]["value"], true);
|
|
||||||
assert_eq!(items[1]["value"], true);
|
|
||||||
assert_eq!(items[2]["value"], true);
|
|
||||||
assert_eq!(items[3]["value"], "env-value");
|
|
||||||
assert_eq!(items[4]["value"], false);
|
|
||||||
assert_eq!(items[5]["value"], "env.not_found");
|
|
||||||
}
|
|
||||||
|
|
||||||
#[test]
|
|
||||||
fn process_test_runs_an_explicitly_granted_program() {
|
|
||||||
let report = run_product_test(
|
|
||||||
product_tests()
|
|
||||||
.iter()
|
|
||||||
.find(|file| file.name == "process.mq.md")
|
|
||||||
.expect("process test"),
|
|
||||||
);
|
|
||||||
let items = observation::terminal(&report)["value"]["items"]
|
|
||||||
.as_array()
|
|
||||||
.expect("list");
|
|
||||||
assert_eq!(items[0]["value"], true);
|
|
||||||
assert_eq!(items[1]["decimal"], "0");
|
|
||||||
let expected = Command::new(env!("CARGO_BIN_EXE_marqdo"))
|
|
||||||
.arg("--version")
|
|
||||||
.output()
|
.output()
|
||||||
.expect("run marqdo --version");
|
.expect("run marqdo");
|
||||||
let expected_stdout = String::from_utf8_lossy(&expected.stdout);
|
assert_ne!(
|
||||||
assert_eq!(
|
output.status.code(),
|
||||||
items[2]["value"].as_str().expect("process stdout"),
|
Some(0),
|
||||||
expected_stdout.as_ref(),
|
"an invalid explicit MARQDO_STDLIB_DIR must fail even when a Bundle is installed"
|
||||||
"process stdout must match the granted program"
|
|
||||||
);
|
|
||||||
assert_eq!(items[3]["value"], "");
|
|
||||||
}
|
|
||||||
|
|
||||||
#[test]
|
|
||||||
fn random_test_reads_bounded_entropy() {
|
|
||||||
let report = run_product_test(
|
|
||||||
product_tests()
|
|
||||||
.iter()
|
|
||||||
.find(|file| file.name == "random.mq.md")
|
|
||||||
.expect("random test"),
|
|
||||||
);
|
|
||||||
let items = observation::terminal(&report)["value"]["items"]
|
|
||||||
.as_array()
|
|
||||||
.expect("list");
|
|
||||||
assert_eq!(items[0]["value"], true);
|
|
||||||
assert_eq!(items[1]["decimal"], "16");
|
|
||||||
assert_eq!(items[2]["value"], true);
|
|
||||||
assert_eq!(items[3]["value"], true);
|
|
||||||
assert_eq!(items[4]["value"], true);
|
|
||||||
}
|
|
||||||
|
|
||||||
#[test]
|
|
||||||
fn compress_test_round_trips_gzip_text() {
|
|
||||||
let report = run_product_test(
|
|
||||||
product_tests()
|
|
||||||
.iter()
|
|
||||||
.find(|file| file.name == "compress.mq.md")
|
|
||||||
.expect("compress test"),
|
|
||||||
);
|
|
||||||
let items = observation::terminal(&report)["value"]["items"]
|
|
||||||
.as_array()
|
|
||||||
.expect("list");
|
|
||||||
assert_eq!(items[0]["value"], true);
|
|
||||||
assert_eq!(items[1]["value"], true);
|
|
||||||
assert_eq!(items[2]["value"], true);
|
|
||||||
assert_eq!(items[3]["value"], "hello 世界");
|
|
||||||
}
|
|
||||||
|
|
||||||
#[test]
|
|
||||||
fn format_test_pins_value_semantics_and_handle_observation() {
|
|
||||||
let report = run_product_test(
|
|
||||||
product_tests()
|
|
||||||
.iter()
|
|
||||||
.find(|file| file.name == "format.mq.md")
|
|
||||||
.expect("format test"),
|
|
||||||
);
|
|
||||||
let items = observation::terminal(&report)["value"]["items"]
|
|
||||||
.as_array()
|
|
||||||
.expect("list");
|
|
||||||
assert_eq!(items[0]["decimal"], "3");
|
|
||||||
assert_eq!(items[1]["value"], "[\"文本\", 2, 1.5]");
|
|
||||||
assert_eq!(items[2]["value"], "{a: 1}");
|
|
||||||
assert_eq!(items[3]["value"], "[\"a\", 2]");
|
|
||||||
assert_eq!(items[4]["value"], "None");
|
|
||||||
}
|
|
||||||
|
|
||||||
#[test]
|
|
||||||
fn text_and_utf8_tests_agree_on_the_byte_encoding() {
|
|
||||||
let text = run_product_test(
|
|
||||||
product_tests()
|
|
||||||
.iter()
|
|
||||||
.find(|file| file.name == "text.mq.md")
|
|
||||||
.expect("text test"),
|
|
||||||
);
|
|
||||||
let utf8 = run_product_test(
|
|
||||||
product_tests()
|
|
||||||
.iter()
|
|
||||||
.find(|file| file.name == "utf8.mq.md")
|
|
||||||
.expect("utf8 test"),
|
|
||||||
);
|
|
||||||
assert_eq!(
|
|
||||||
observation::terminal(&text)["value"]["items"][0]["decimal"],
|
|
||||||
"2"
|
|
||||||
);
|
|
||||||
assert_eq!(
|
|
||||||
observation::terminal(&text)["value"]["items"][1]["decimal"],
|
|
||||||
"195"
|
|
||||||
);
|
|
||||||
assert_eq!(
|
|
||||||
observation::terminal(&text)["value"]["items"][2]["decimal"],
|
|
||||||
"169"
|
|
||||||
);
|
|
||||||
assert_eq!(
|
|
||||||
observation::terminal(&utf8)["value"]["items"][0]["decimal"],
|
|
||||||
"2"
|
|
||||||
);
|
|
||||||
assert_eq!(
|
|
||||||
observation::terminal(&utf8)["value"]["items"][1]["value"],
|
|
||||||
"é"
|
|
||||||
);
|
|
||||||
assert_eq!(
|
|
||||||
observation::terminal(&utf8)["value"]["items"][2]["value"],
|
|
||||||
false
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
#[test]
|
|
||||||
fn stream_and_console_use_the_resource_endpoints() {
|
|
||||||
let stream = run_product_test(
|
|
||||||
product_tests()
|
|
||||||
.iter()
|
|
||||||
.find(|file| file.name == "stream.mq.md")
|
|
||||||
.expect("stream test"),
|
|
||||||
);
|
|
||||||
assert_eq!(
|
|
||||||
observation::terminal(&stream)["value"]["items"][0]["value"],
|
|
||||||
true
|
|
||||||
);
|
|
||||||
assert_eq!(
|
|
||||||
observation::terminal(&stream)["value"]["items"][1]["decimal"],
|
|
||||||
"7"
|
|
||||||
);
|
|
||||||
|
|
||||||
let console = run_product_test(
|
|
||||||
product_tests()
|
|
||||||
.iter()
|
|
||||||
.find(|file| file.name == "console.mq.md")
|
|
||||||
.expect("console test"),
|
|
||||||
);
|
|
||||||
assert_eq!(
|
|
||||||
observation::terminal(&console)["value"]["items"][0]["value"],
|
|
||||||
true
|
|
||||||
);
|
|
||||||
assert_eq!(
|
|
||||||
observation::terminal(&console)["value"]["items"][1]["value"],
|
|
||||||
"hello"
|
|
||||||
);
|
);
|
||||||
|
let stderr = String::from_utf8_lossy(&output.stderr);
|
||||||
assert!(
|
assert!(
|
||||||
console["events"]
|
stderr.contains("stdlib") || stderr.contains("cannot open"),
|
||||||
.as_array()
|
"failure must name the Bundle: {stderr}"
|
||||||
.unwrap()
|
|
||||||
.iter()
|
|
||||||
.any(|event| event["payload"]["operation"] == "resource.read"
|
|
||||||
|| event["payload"]["operation"] == "resource.open"),
|
|
||||||
"console test did not go through a resource endpoint"
|
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
@@ -1,77 +0,0 @@
|
|||||||
//! CM-A08 table stdlib module tests.
|
|
||||||
|
|
||||||
#[path = "support/observation.rs"]
|
|
||||||
pub mod observation;
|
|
||||||
|
|
||||||
use std::path::Path;
|
|
||||||
use std::process::Command;
|
|
||||||
|
|
||||||
fn repo_root() -> std::path::PathBuf {
|
|
||||||
Path::new(env!("CARGO_MANIFEST_DIR"))
|
|
||||||
.parent()
|
|
||||||
.unwrap()
|
|
||||||
.parent()
|
|
||||||
.unwrap()
|
|
||||||
.to_path_buf()
|
|
||||||
}
|
|
||||||
|
|
||||||
fn run_table_self_test() -> serde_json::Value {
|
|
||||||
let output = Command::new(env!("CARGO_BIN_EXE_marqdo"))
|
|
||||||
.args(["run", "tests/table.mq.md", "--output", "json"])
|
|
||||||
.current_dir(repo_root().join("stdlib"))
|
|
||||||
.env("MARQDO_STDLIB_DIR", repo_root().join("stdlib"))
|
|
||||||
.output()
|
|
||||||
.expect("run table self-test");
|
|
||||||
assert_eq!(
|
|
||||||
output.status.code(),
|
|
||||||
Some(0),
|
|
||||||
"{}",
|
|
||||||
String::from_utf8_lossy(&output.stderr)
|
|
||||||
);
|
|
||||||
serde_json::from_slice(&output.stdout).expect("json output")
|
|
||||||
}
|
|
||||||
|
|
||||||
fn rows(value: &serde_json::Value) -> &Vec<serde_json::Value> {
|
|
||||||
value["rows"].as_array().expect("rows")
|
|
||||||
}
|
|
||||||
|
|
||||||
#[test]
|
|
||||||
fn stdlib_table_algorithms_rebuild_without_mutating_inputs() {
|
|
||||||
let report = run_table_self_test();
|
|
||||||
assert_eq!(report["run"]["status"], "ok");
|
|
||||||
let items = observation::terminal(&report)["value"]["items"]
|
|
||||||
.as_array()
|
|
||||||
.expect("list");
|
|
||||||
assert_eq!(items.len(), 9);
|
|
||||||
|
|
||||||
assert_eq!(items[0]["header"], serde_json::json!(["分数"]));
|
|
||||||
assert_eq!(items[0]["rows"].as_array().unwrap().len(), 3);
|
|
||||||
|
|
||||||
assert_eq!(rows(&items[1]).len(), 2);
|
|
||||||
assert_eq!(rows(&items[2]).len(), 3);
|
|
||||||
assert_eq!(rows(&items[2])[0][1]["decimal"], "71");
|
|
||||||
assert_eq!(rows(&items[3]).len(), 4);
|
|
||||||
assert_eq!(rows(&items[3])[3][0]["value"], "丁");
|
|
||||||
assert_eq!(rows(&items[4])[0][1]["decimal"], "99");
|
|
||||||
|
|
||||||
assert_eq!(rows(&items[5]).len(), 2);
|
|
||||||
assert_eq!(items[5]["header"].as_array().unwrap().len(), 4);
|
|
||||||
|
|
||||||
assert_eq!(
|
|
||||||
items[6]["entries"]["a"]["items"].as_array().unwrap().len(),
|
|
||||||
2
|
|
||||||
);
|
|
||||||
assert_eq!(
|
|
||||||
items[6]["entries"]["b"]["items"].as_array().unwrap().len(),
|
|
||||||
1
|
|
||||||
);
|
|
||||||
|
|
||||||
// Original input is unchanged.
|
|
||||||
assert_eq!(rows(&items[7]).len(), 3);
|
|
||||||
assert_eq!(rows(&items[7])[0][1]["decimal"], "87");
|
|
||||||
|
|
||||||
assert_eq!(
|
|
||||||
items[8]["value"],
|
|
||||||
"| 名称 | 分数 |\n| --- | --- |\n| 甲 | 87 |\n| 乙 | 92 |\n| 丙 | 71 |"
|
|
||||||
);
|
|
||||||
}
|
|
||||||
@@ -0,0 +1,407 @@
|
|||||||
|
//! Pinned stdlib Bundle resolver shared by test harnesses (ADR-0070).
|
||||||
|
//!
|
||||||
|
//! Product tests consume one explicit Bundle whose identity is pinned in
|
||||||
|
//! `tools/stdlib/bundle-pin.json` (name, version, source commit, tree digest and
|
||||||
|
//! alias digest). `MARQDO_TEST_STDLIB_BUNDLE` may change the location, but the
|
||||||
|
//! Bundle must still match the pin; `MARQDO_TEST_BUNDLE_PIN` may change the pin
|
||||||
|
//! file. A bad explicit input fails even when the default location is valid —
|
||||||
|
//! there is no silent fallback.
|
||||||
|
|
||||||
|
use std::path::{Component, Path, PathBuf};
|
||||||
|
|
||||||
|
use sha2::{Digest, Sha256};
|
||||||
|
|
||||||
|
pub const BUNDLE_ENV: &str = "MARQDO_TEST_STDLIB_BUNDLE";
|
||||||
|
pub const PIN_ENV: &str = "MARQDO_TEST_BUNDLE_PIN";
|
||||||
|
|
||||||
|
/// The checkout root (this test support module lives in `crates/cli/tests`).
|
||||||
|
pub fn repo_root() -> PathBuf {
|
||||||
|
Path::new(env!("CARGO_MANIFEST_DIR"))
|
||||||
|
.parent()
|
||||||
|
.expect("crates directory")
|
||||||
|
.parent()
|
||||||
|
.expect("repository root")
|
||||||
|
.to_path_buf()
|
||||||
|
}
|
||||||
|
|
||||||
|
/// Pin file path, overridable for a candidate Bundle.
|
||||||
|
pub fn pin_path() -> PathBuf {
|
||||||
|
std::env::var_os(PIN_ENV)
|
||||||
|
.map(PathBuf::from)
|
||||||
|
.unwrap_or_else(|| {
|
||||||
|
repo_root()
|
||||||
|
.join("tools")
|
||||||
|
.join("stdlib")
|
||||||
|
.join("bundle-pin.json")
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
/// One pinned Bundle identity (`tools/stdlib/bundle-pin.json`).
|
||||||
|
#[derive(Debug, Clone)]
|
||||||
|
pub struct BundlePin {
|
||||||
|
pub name: String,
|
||||||
|
pub version: String,
|
||||||
|
pub source_commit: String,
|
||||||
|
/// None for the accepted ecosystem Bundle (Phase B): it is not vendored in
|
||||||
|
/// this repository, so product tests require an explicit verified Bundle.
|
||||||
|
pub source_path: Option<PathBuf>,
|
||||||
|
pub tree_digest: String,
|
||||||
|
pub aliases_digest: String,
|
||||||
|
}
|
||||||
|
|
||||||
|
impl BundlePin {
|
||||||
|
pub fn load(path: &Path) -> Self {
|
||||||
|
let text = std::fs::read_to_string(path)
|
||||||
|
.unwrap_or_else(|error| panic!("cannot read Bundle pin {}: {error}", path.display()));
|
||||||
|
let value: serde_json::Value = serde_json::from_str(&text)
|
||||||
|
.unwrap_or_else(|error| panic!("invalid Bundle pin {}: {error}", path.display()));
|
||||||
|
assert_eq!(
|
||||||
|
value.get("schema").and_then(serde_json::Value::as_str),
|
||||||
|
Some("marqdo.stdlib-bundle-pin"),
|
||||||
|
"{} must use the marqdo.stdlib-bundle-pin schema",
|
||||||
|
path.display()
|
||||||
|
);
|
||||||
|
assert_eq!(
|
||||||
|
value
|
||||||
|
.get("schema_version")
|
||||||
|
.and_then(serde_json::Value::as_u64),
|
||||||
|
Some(1),
|
||||||
|
"{} must use pin schema_version 1",
|
||||||
|
path.display()
|
||||||
|
);
|
||||||
|
let source = value
|
||||||
|
.get("source")
|
||||||
|
.unwrap_or_else(|| panic!("Bundle pin {} has no source object", path.display()));
|
||||||
|
let source_kind = source
|
||||||
|
.get("kind")
|
||||||
|
.and_then(serde_json::Value::as_str)
|
||||||
|
.unwrap_or("in-repo");
|
||||||
|
let source_path = match source_kind {
|
||||||
|
"in-repo" => {
|
||||||
|
let declared = source
|
||||||
|
.get("path")
|
||||||
|
.and_then(serde_json::Value::as_str)
|
||||||
|
.unwrap_or_else(|| {
|
||||||
|
panic!("in-repo Bundle pin {} has no source.path", path.display())
|
||||||
|
});
|
||||||
|
validate_relative(declared).unwrap_or_else(|error| {
|
||||||
|
panic!("Bundle pin {} source.path: {error}", path.display())
|
||||||
|
});
|
||||||
|
Some(PathBuf::from(declared))
|
||||||
|
}
|
||||||
|
"ecosystem" => {
|
||||||
|
for field in ["repository", "commit"] {
|
||||||
|
required_str(source, field, path);
|
||||||
|
}
|
||||||
|
None
|
||||||
|
}
|
||||||
|
other => panic!(
|
||||||
|
"Bundle pin {} has unknown source.kind {other:?}",
|
||||||
|
path.display()
|
||||||
|
),
|
||||||
|
};
|
||||||
|
Self {
|
||||||
|
name: required_str(&value, "name", path),
|
||||||
|
version: required_str(&value, "version", path),
|
||||||
|
source_commit: required_str(source, "commit", path),
|
||||||
|
source_path,
|
||||||
|
tree_digest: required_str(&value, "tree_digest", path),
|
||||||
|
aliases_digest: required_str(&value, "aliases_digest", path),
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// The committed pin for the current checkout.
|
||||||
|
pub fn committed() -> Self {
|
||||||
|
Self::load(&pin_path())
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
fn required_str(value: &serde_json::Value, field: &str, path: &Path) -> String {
|
||||||
|
value
|
||||||
|
.get(field)
|
||||||
|
.and_then(serde_json::Value::as_str)
|
||||||
|
.filter(|text| !text.is_empty())
|
||||||
|
.unwrap_or_else(|| panic!("Bundle pin {} has no `{field}`", path.display()))
|
||||||
|
.to_string()
|
||||||
|
}
|
||||||
|
|
||||||
|
/// One verified Bundle on disk.
|
||||||
|
#[derive(Debug, Clone)]
|
||||||
|
pub struct Bundle {
|
||||||
|
root: PathBuf,
|
||||||
|
pub name: String,
|
||||||
|
pub version: String,
|
||||||
|
pub tree_digest: String,
|
||||||
|
pub aliases_digest: String,
|
||||||
|
}
|
||||||
|
|
||||||
|
impl Bundle {
|
||||||
|
/// Resolve the Bundle for a product test: explicit override or pinned path,
|
||||||
|
/// verified against the pin.
|
||||||
|
pub fn pinned() -> Self {
|
||||||
|
let pin = BundlePin::committed();
|
||||||
|
let explicit = std::env::var_os(BUNDLE_ENV).map(PathBuf::from);
|
||||||
|
let root = match (explicit.clone(), pin.source_path.as_ref()) {
|
||||||
|
(Some(path), _) => path,
|
||||||
|
(None, Some(relative)) => repo_root().join(relative),
|
||||||
|
(None, None) => panic!(
|
||||||
|
"the accepted stdlib Bundle is not vendored in this repository; set \
|
||||||
|
{BUNDLE_ENV} to a Bundle produced from the pinned ecosystem commit {} \
|
||||||
|
(tools/ci/fetch_ecosystem_bundle.py)",
|
||||||
|
pin.source_commit
|
||||||
|
),
|
||||||
|
};
|
||||||
|
let bundle = Self::verify(&root).unwrap_or_else(|error| match &explicit {
|
||||||
|
Some(_) => panic!(
|
||||||
|
"{BUNDLE_ENV} does not name a valid stdlib Bundle at {}: {error}",
|
||||||
|
root.display()
|
||||||
|
),
|
||||||
|
None => panic!(
|
||||||
|
"pinned stdlib Bundle at {} is invalid: {error}",
|
||||||
|
root.display()
|
||||||
|
),
|
||||||
|
});
|
||||||
|
let mismatches = [
|
||||||
|
("name", &pin.name, &bundle.name),
|
||||||
|
("version", &pin.version, &bundle.version),
|
||||||
|
("tree_digest", &pin.tree_digest, &bundle.tree_digest),
|
||||||
|
(
|
||||||
|
"aliases_digest",
|
||||||
|
&pin.aliases_digest,
|
||||||
|
&bundle.aliases_digest,
|
||||||
|
),
|
||||||
|
];
|
||||||
|
for (field, expected, actual) in mismatches {
|
||||||
|
assert_eq!(
|
||||||
|
expected,
|
||||||
|
actual,
|
||||||
|
"stdlib Bundle at {} does not match the pin field `{field}`",
|
||||||
|
root.display()
|
||||||
|
);
|
||||||
|
}
|
||||||
|
for required in ["stdlib.json", "io.mq.md", "io/console.mq.md"] {
|
||||||
|
assert!(
|
||||||
|
bundle.root.join(required).is_file(),
|
||||||
|
"stdlib Bundle at {} is missing required file {required}",
|
||||||
|
bundle.root.display()
|
||||||
|
);
|
||||||
|
}
|
||||||
|
assert_eq!(
|
||||||
|
pin.source_commit.len(),
|
||||||
|
40,
|
||||||
|
"the pin must record a full source commit, got {:?}",
|
||||||
|
pin.source_commit
|
||||||
|
);
|
||||||
|
bundle
|
||||||
|
}
|
||||||
|
|
||||||
|
/// Verify one unpacked Bundle root.
|
||||||
|
pub fn verify(root: &Path) -> Result<Self, String> {
|
||||||
|
if !root.is_dir() {
|
||||||
|
return Err(format!("not a directory: {}", root.display()));
|
||||||
|
}
|
||||||
|
let manifest_path = root.join("stdlib.json");
|
||||||
|
if !manifest_path.is_file() {
|
||||||
|
return Err(format!("missing manifest: {}", manifest_path.display()));
|
||||||
|
}
|
||||||
|
let text = std::fs::read_to_string(&manifest_path)
|
||||||
|
.map_err(|error| format!("cannot read {}: {error}", manifest_path.display()))?;
|
||||||
|
let manifest: serde_json::Value = serde_json::from_str(&text)
|
||||||
|
.map_err(|error| format!("invalid {}: {error}", manifest_path.display()))?;
|
||||||
|
let name = manifest
|
||||||
|
.get("name")
|
||||||
|
.and_then(serde_json::Value::as_str)
|
||||||
|
.ok_or_else(|| format!("{} has no name", manifest_path.display()))?
|
||||||
|
.to_string();
|
||||||
|
let version = manifest
|
||||||
|
.get("version")
|
||||||
|
.and_then(serde_json::Value::as_str)
|
||||||
|
.ok_or_else(|| format!("{} has no version", manifest_path.display()))?
|
||||||
|
.to_string();
|
||||||
|
let declared = manifest
|
||||||
|
.get("digest")
|
||||||
|
.and_then(serde_json::Value::as_str)
|
||||||
|
.ok_or_else(|| format!("{} has no digest", manifest_path.display()))?
|
||||||
|
.to_string();
|
||||||
|
let actual = tree_digest(root)?;
|
||||||
|
if declared != actual {
|
||||||
|
return Err(format!(
|
||||||
|
"tree digest mismatch: stdlib.json declares {declared}, the files are {actual}"
|
||||||
|
));
|
||||||
|
}
|
||||||
|
let aliases = manifest
|
||||||
|
.get("public_aliases")
|
||||||
|
.and_then(serde_json::Value::as_array)
|
||||||
|
.cloned()
|
||||||
|
.unwrap_or_default();
|
||||||
|
let declared_aliases = manifest
|
||||||
|
.get("aliases_digest")
|
||||||
|
.and_then(serde_json::Value::as_str)
|
||||||
|
.map(ToString::to_string);
|
||||||
|
let actual_aliases = aliases_digest(&aliases);
|
||||||
|
match (declared_aliases, aliases.is_empty()) {
|
||||||
|
(Some(declared_aliases), _) => {
|
||||||
|
if declared_aliases != actual_aliases {
|
||||||
|
return Err(format!(
|
||||||
|
"alias digest mismatch: stdlib.json declares {declared_aliases}, \
|
||||||
|
the alias table is {actual_aliases}"
|
||||||
|
));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
(None, false) => {
|
||||||
|
return Err(format!(
|
||||||
|
"{} declares public_aliases without aliases_digest",
|
||||||
|
manifest_path.display()
|
||||||
|
));
|
||||||
|
}
|
||||||
|
(None, true) => {}
|
||||||
|
}
|
||||||
|
Ok(Self {
|
||||||
|
root: root
|
||||||
|
.canonicalize()
|
||||||
|
.map_err(|error| format!("cannot canonicalize {}: {error}", root.display()))?,
|
||||||
|
name,
|
||||||
|
version,
|
||||||
|
tree_digest: actual,
|
||||||
|
aliases_digest: actual_aliases,
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
pub fn root(&self) -> &Path {
|
||||||
|
&self.root
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// Resolve and verify the pinned Bundle once per test process.
|
||||||
|
pub fn bundle() -> &'static Bundle {
|
||||||
|
static BUNDLE: std::sync::OnceLock<Bundle> = std::sync::OnceLock::new();
|
||||||
|
BUNDLE.get_or_init(Bundle::pinned)
|
||||||
|
}
|
||||||
|
|
||||||
|
/// Bundle root for fixtures and `MARQDO_STDLIB_DIR`.
|
||||||
|
pub fn bundle_dir() -> PathBuf {
|
||||||
|
bundle().root().to_path_buf()
|
||||||
|
}
|
||||||
|
|
||||||
|
/// Bundle root when one is configured, without failing tests that do not need
|
||||||
|
/// the standard library (Phase B has no in-repo source tree).
|
||||||
|
pub fn try_bundle_dir() -> Option<PathBuf> {
|
||||||
|
let pin = BundlePin::committed();
|
||||||
|
if let Some(explicit) = std::env::var_os(BUNDLE_ENV) {
|
||||||
|
return Some(PathBuf::from(explicit));
|
||||||
|
}
|
||||||
|
pin.source_path.map(|relative| repo_root().join(relative))
|
||||||
|
}
|
||||||
|
|
||||||
|
/// A real CLI command that names the verified Bundle explicitly when one is
|
||||||
|
/// configured; spawned programs never rely on a compile-time source fallback.
|
||||||
|
pub fn cli_command() -> std::process::Command {
|
||||||
|
let mut command = std::process::Command::new(env!("CARGO_BIN_EXE_marqdo"));
|
||||||
|
if let Some(root) = try_bundle_dir() {
|
||||||
|
command.env("MARQDO_STDLIB_DIR", root);
|
||||||
|
}
|
||||||
|
command
|
||||||
|
}
|
||||||
|
|
||||||
|
/// Content digest over all `.mq.md` files: sorted relative path, NUL, bytes, NUL.
|
||||||
|
pub fn tree_digest(root: &Path) -> Result<String, String> {
|
||||||
|
let mut files = Vec::new();
|
||||||
|
collect_markdown(root, root, &mut files)?;
|
||||||
|
files.sort();
|
||||||
|
let mut hasher = Sha256::new();
|
||||||
|
for (relative, path) in files {
|
||||||
|
let bytes = std::fs::read(&path)
|
||||||
|
.map_err(|error| format!("cannot read {}: {error}", path.display()))?;
|
||||||
|
hasher.update(relative.as_bytes());
|
||||||
|
hasher.update([0]);
|
||||||
|
hasher.update(&bytes);
|
||||||
|
hasher.update([0]);
|
||||||
|
}
|
||||||
|
Ok(format!("sha256:{}", hex(&hasher.finalize())))
|
||||||
|
}
|
||||||
|
|
||||||
|
/// Canonical digest over the official public-alias table.
|
||||||
|
pub fn aliases_digest(aliases: &[serde_json::Value]) -> String {
|
||||||
|
let mut entries: Vec<&serde_json::Value> = aliases.iter().collect();
|
||||||
|
entries.sort_by_key(|alias| {
|
||||||
|
(
|
||||||
|
alias["target_module"].as_str().unwrap_or("").to_string(),
|
||||||
|
alias["target_function"].as_str().unwrap_or("").to_string(),
|
||||||
|
)
|
||||||
|
});
|
||||||
|
let mut hasher = Sha256::new();
|
||||||
|
for alias in entries {
|
||||||
|
if let Some(module) = alias["target_module"].as_str() {
|
||||||
|
hasher.update(module.as_bytes());
|
||||||
|
}
|
||||||
|
hasher.update([0]);
|
||||||
|
if let Some(function) = alias["target_function"].as_str() {
|
||||||
|
hasher.update(function.as_bytes());
|
||||||
|
}
|
||||||
|
hasher.update([0]);
|
||||||
|
let mut names: Vec<&str> = alias["public_names"]
|
||||||
|
.as_array()
|
||||||
|
.map(|names| names.iter().filter_map(serde_json::Value::as_str).collect())
|
||||||
|
.unwrap_or_default();
|
||||||
|
names.sort();
|
||||||
|
for name in names {
|
||||||
|
hasher.update(name.as_bytes());
|
||||||
|
hasher.update([0]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
format!("sha256:{}", hex(&hasher.finalize()))
|
||||||
|
}
|
||||||
|
|
||||||
|
fn collect_markdown(
|
||||||
|
root: &Path,
|
||||||
|
dir: &Path,
|
||||||
|
out: &mut Vec<(String, PathBuf)>,
|
||||||
|
) -> Result<(), String> {
|
||||||
|
let entries = std::fs::read_dir(dir)
|
||||||
|
.map_err(|error| format!("cannot read {}: {error}", dir.display()))?;
|
||||||
|
for entry in entries {
|
||||||
|
let entry = entry.map_err(|error| format!("cannot read {}: {error}", dir.display()))?;
|
||||||
|
let path = entry.path();
|
||||||
|
if path.is_dir() {
|
||||||
|
collect_markdown(root, &path, out)?;
|
||||||
|
} else if path
|
||||||
|
.file_name()
|
||||||
|
.is_some_and(|name| name.to_string_lossy().ends_with(".mq.md"))
|
||||||
|
{
|
||||||
|
let relative = path
|
||||||
|
.strip_prefix(root)
|
||||||
|
.map_err(|_| "stdlib file escaped its root".to_string())?
|
||||||
|
.components()
|
||||||
|
.map(|component| component.as_os_str().to_string_lossy().to_string())
|
||||||
|
.collect::<Vec<_>>()
|
||||||
|
.join("/");
|
||||||
|
out.push((relative, path));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
Ok(())
|
||||||
|
}
|
||||||
|
|
||||||
|
fn validate_relative(path: &str) -> Result<(), String> {
|
||||||
|
let mut normalised = PathBuf::new();
|
||||||
|
for component in Path::new(path).components() {
|
||||||
|
match component {
|
||||||
|
Component::Normal(part) => normalised.push(part),
|
||||||
|
Component::CurDir => {}
|
||||||
|
Component::ParentDir | Component::RootDir | Component::Prefix(_) => {
|
||||||
|
return Err("must be a relative path inside the repository".to_string())
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if normalised.as_os_str().is_empty() {
|
||||||
|
return Err("must not be empty".to_string());
|
||||||
|
}
|
||||||
|
Ok(())
|
||||||
|
}
|
||||||
|
|
||||||
|
fn hex(bytes: &[u8]) -> String {
|
||||||
|
let mut out = String::with_capacity(bytes.len() * 2);
|
||||||
|
for byte in bytes {
|
||||||
|
out.push_str(&format!("{byte:02x}"));
|
||||||
|
}
|
||||||
|
out
|
||||||
|
}
|
||||||
@@ -1,4 +1,6 @@
|
|||||||
//! C10/P5: a `.mq.md` HTTP client over the TCP resource endpoint.
|
//! C10/P5: a `.mq.md` program round-trips bytes over the TCP resource endpoint.
|
||||||
|
#[path = "support/stdlib.rs"]
|
||||||
|
pub mod stdlib_support;
|
||||||
|
|
||||||
#[path = "support/observation.rs"]
|
#[path = "support/observation.rs"]
|
||||||
pub mod observation;
|
pub mod observation;
|
||||||
@@ -6,7 +8,6 @@ pub mod observation;
|
|||||||
use std::io::{Read, Write};
|
use std::io::{Read, Write};
|
||||||
use std::net::TcpListener;
|
use std::net::TcpListener;
|
||||||
use std::path::Path;
|
use std::path::Path;
|
||||||
use std::process::Command;
|
|
||||||
|
|
||||||
struct TempDir(std::path::PathBuf);
|
struct TempDir(std::path::PathBuf);
|
||||||
|
|
||||||
@@ -30,7 +31,11 @@ impl Drop for TempDir {
|
|||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn mqmd_http_client_parses_a_response_from_a_tcp_stream() {
|
fn a_marqdo_program_round_trips_bytes_over_the_tcp_resource() {
|
||||||
|
// The CLI owns the TCP resource endpoint; the HTTP domain module now lives in
|
||||||
|
// the explicit `marqdo-ext-http` package, so this test exercises the generic
|
||||||
|
// endpoint directly instead of importing a domain module that is not part of
|
||||||
|
// the default Bundle.
|
||||||
let listener = TcpListener::bind("127.0.0.1:0").unwrap();
|
let listener = TcpListener::bind("127.0.0.1:0").unwrap();
|
||||||
let address = listener.local_addr().unwrap();
|
let address = listener.local_addr().unwrap();
|
||||||
let server = std::thread::spawn(move || {
|
let server = std::thread::spawn(move || {
|
||||||
@@ -39,17 +44,14 @@ fn mqmd_http_client_parses_a_response_from_a_tcp_stream() {
|
|||||||
let count = stream.read(&mut request).unwrap();
|
let count = stream.read(&mut request).unwrap();
|
||||||
assert!(String::from_utf8_lossy(&request[..count]).starts_with("GET / HTTP/1.1\r\n"));
|
assert!(String::from_utf8_lossy(&request[..count]).starts_with("GET / HTTP/1.1\r\n"));
|
||||||
stream
|
stream
|
||||||
.write_all(
|
.write_all(b"HTTP/1.1 200 OK\r\nContent-Length: 5\r\n\r\nhello")
|
||||||
b"HTTP/1.1 200 OK\r\nContent-Type: text/plain\r\nContent-Length: 5\r\n\r\nhello",
|
|
||||||
)
|
|
||||||
.unwrap();
|
.unwrap();
|
||||||
});
|
});
|
||||||
|
|
||||||
let dir = TempDir::new("client");
|
let dir = TempDir::new("roundtrip");
|
||||||
let program = format!(
|
let program = format!(
|
||||||
r#"---
|
r#"---
|
||||||
import:
|
import:
|
||||||
http: "std:net/http"
|
|
||||||
编码: "std:text"
|
编码: "std:text"
|
||||||
---
|
---
|
||||||
|
|
||||||
@@ -57,7 +59,7 @@ import:
|
|||||||
|
|
||||||
`流 = resource.open("tcp", "{address}", ["read", "write"])`
|
`流 = resource.open("tcp", "{address}", ["read", "write"])`
|
||||||
|
|
||||||
`请求 = http.构建请求("GET", "/", [["Host", "example.test"]], "")`
|
`请求 = "GET / HTTP/1.1\r\nHost: example.test\r\n\r\n"`
|
||||||
|
|
||||||
`请求内存 = memory.new(1, 1)`
|
`请求内存 = memory.new(1, 1)`
|
||||||
|
|
||||||
@@ -85,13 +87,11 @@ import:
|
|||||||
|
|
||||||
`关闭 = resource.close(流)`
|
`关闭 = resource.close(流)`
|
||||||
|
|
||||||
`响应 = http.解析响应(响应文本)`
|
`return [写入.ok, 写入.value.count == 请求长度, 读出.ok, 数量 > 0, 响应文本, 关闭.ok]`
|
||||||
|
|
||||||
`return [写入.ok, 读出.ok, 响应.状态, 响应.头["Content-Type"], 响应.体, 关闭.ok]`
|
|
||||||
"#
|
"#
|
||||||
);
|
);
|
||||||
std::fs::write(dir.path().join("index.mq.md"), program).unwrap();
|
std::fs::write(dir.path().join("index.mq.md"), program).unwrap();
|
||||||
let output = Command::new(env!("CARGO_BIN_EXE_marqdo"))
|
let output = stdlib_support::cli_command()
|
||||||
.args([
|
.args([
|
||||||
"run",
|
"run",
|
||||||
"index.mq.md",
|
"index.mq.md",
|
||||||
@@ -101,15 +101,6 @@ import:
|
|||||||
"json",
|
"json",
|
||||||
])
|
])
|
||||||
.current_dir(dir.path())
|
.current_dir(dir.path())
|
||||||
.env(
|
|
||||||
"MARQDO_STDLIB_DIR",
|
|
||||||
Path::new(env!("CARGO_MANIFEST_DIR"))
|
|
||||||
.parent()
|
|
||||||
.unwrap()
|
|
||||||
.parent()
|
|
||||||
.unwrap()
|
|
||||||
.join("stdlib"),
|
|
||||||
)
|
|
||||||
.output()
|
.output()
|
||||||
.expect("run marqdo");
|
.expect("run marqdo");
|
||||||
assert_eq!(
|
assert_eq!(
|
||||||
@@ -126,9 +117,12 @@ import:
|
|||||||
.expect("list");
|
.expect("list");
|
||||||
assert_eq!(items[0]["value"], true);
|
assert_eq!(items[0]["value"], true);
|
||||||
assert_eq!(items[1]["value"], true);
|
assert_eq!(items[1]["value"], true);
|
||||||
assert_eq!(items[2]["decimal"], "200");
|
assert_eq!(items[2]["value"], true);
|
||||||
assert_eq!(items[3]["value"], "text/plain");
|
assert_eq!(items[3]["value"], true);
|
||||||
assert_eq!(items[4]["value"], "hello");
|
assert_eq!(
|
||||||
|
items[4]["value"],
|
||||||
|
"HTTP/1.1 200 OK\r\nContent-Length: 5\r\n\r\nhello"
|
||||||
|
);
|
||||||
assert_eq!(items[5]["value"], true);
|
assert_eq!(items[5]["value"], true);
|
||||||
server.join().unwrap();
|
server.join().unwrap();
|
||||||
}
|
}
|
||||||
@@ -2,6 +2,8 @@
|
|||||||
//!
|
//!
|
||||||
//! The tool fixture is compiled with rustc from `tests/fixtures/tool_echo.rs`
|
//! The tool fixture is compiled with rustc from `tests/fixtures/tool_echo.rs`
|
||||||
//! rather than a shell script, so these tests run on Windows and macOS too.
|
//! rather than a shell script, so these tests run on Windows and macOS too.
|
||||||
|
#[path = "support/stdlib.rs"]
|
||||||
|
pub mod stdlib_support;
|
||||||
|
|
||||||
use std::path::{Path, PathBuf};
|
use std::path::{Path, PathBuf};
|
||||||
use std::process::{Command, Output};
|
use std::process::{Command, Output};
|
||||||
@@ -36,12 +38,8 @@ impl Drop for TempDir {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fn binary() -> &'static str {
|
|
||||||
env!("CARGO_BIN_EXE_marqdo")
|
|
||||||
}
|
|
||||||
|
|
||||||
fn cli(home: &Path, args: &[&str]) -> Output {
|
fn cli(home: &Path, args: &[&str]) -> Output {
|
||||||
Command::new(binary())
|
stdlib_support::cli_command()
|
||||||
.args(args)
|
.args(args)
|
||||||
.env("MARQDO_TOOL_HOME", home)
|
.env("MARQDO_TOOL_HOME", home)
|
||||||
.output()
|
.output()
|
||||||
@@ -157,7 +155,7 @@ fn independent_sample_tools_consume_public_analysis_and_observation() {
|
|||||||
let trace = dir.path().join("trace.json");
|
let trace = dir.path().join("trace.json");
|
||||||
let root = repo_root();
|
let root = repo_root();
|
||||||
|
|
||||||
let check = Command::new(binary())
|
let check = stdlib_support::cli_command()
|
||||||
.args([
|
.args([
|
||||||
"check",
|
"check",
|
||||||
"examples/multi-module/index.mq.md",
|
"examples/multi-module/index.mq.md",
|
||||||
@@ -169,7 +167,7 @@ fn independent_sample_tools_consume_public_analysis_and_observation() {
|
|||||||
.output()
|
.output()
|
||||||
.expect("run check");
|
.expect("run check");
|
||||||
assert!(check.status.success(), "check failed: {}", stderr(&check));
|
assert!(check.status.success(), "check failed: {}", stderr(&check));
|
||||||
let run = Command::new(binary())
|
let run = stdlib_support::cli_command()
|
||||||
.args([
|
.args([
|
||||||
"run",
|
"run",
|
||||||
"examples/multi-module/index.mq.md",
|
"examples/multi-module/index.mq.md",
|
||||||
@@ -354,7 +352,7 @@ fn tampered_binary_and_path_hijack_are_not_executed() {
|
|||||||
permissions.set_mode(0o755);
|
permissions.set_mode(0o755);
|
||||||
std::fs::set_permissions(&hijack, permissions).unwrap();
|
std::fs::set_permissions(&hijack, permissions).unwrap();
|
||||||
}
|
}
|
||||||
let output = Command::new(binary())
|
let output = stdlib_support::cli_command()
|
||||||
.arg("hijack")
|
.arg("hijack")
|
||||||
.env("MARQDO_TOOL_HOME", &home)
|
.env("MARQDO_TOOL_HOME", &home)
|
||||||
.env("PATH", &path_dir)
|
.env("PATH", &path_dir)
|
||||||
|
|||||||
@@ -39,6 +39,16 @@ pub struct HeadingInfo {
|
|||||||
pub kind: UnitKind,
|
pub kind: UnitKind,
|
||||||
/// Semantic mode declared or inherited by this heading.
|
/// Semantic mode declared or inherited by this heading.
|
||||||
pub mode: SemanticMode,
|
pub mode: SemanticMode,
|
||||||
|
/// How the effective mode was established.
|
||||||
|
pub mode_origin: ModeOrigin,
|
||||||
|
/// Unit that provided the effective mode (this unit, an explicit ancestor,
|
||||||
|
/// or the document root).
|
||||||
|
pub mode_source_unit_id: UnitId,
|
||||||
|
/// Nearest real ancestor unit (the root for a top-level heading).
|
||||||
|
pub parent_id: UnitId,
|
||||||
|
/// Complete section range: this heading through the next same-or-higher
|
||||||
|
/// heading, or the end of the source. It includes child headings.
|
||||||
|
pub full_span: Span,
|
||||||
}
|
}
|
||||||
|
|
||||||
/// A function range mapped from a level-2 heading.
|
/// A function range mapped from a level-2 heading.
|
||||||
@@ -95,6 +105,38 @@ impl UnitIndex {
|
|||||||
.iter()
|
.iter()
|
||||||
.find(|f| block_index >= f.body_start && block_index < f.body_end)
|
.find(|f| block_index >= f.body_start && block_index < f.body_end)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// Complete public range of one unit: the whole source for the root, the
|
||||||
|
/// heading-through-next-same-or-higher-heading range otherwise.
|
||||||
|
pub fn unit_range(&self, id: &UnitId) -> Option<Span> {
|
||||||
|
if id.path.is_empty() {
|
||||||
|
return self
|
||||||
|
.units
|
||||||
|
.iter()
|
||||||
|
.find(|unit| unit.id.path.is_empty())
|
||||||
|
.map(|unit| unit.span);
|
||||||
|
}
|
||||||
|
self.headings
|
||||||
|
.iter()
|
||||||
|
.find(|heading| heading.path == id.path)
|
||||||
|
.map(|heading| heading.full_span)
|
||||||
|
}
|
||||||
|
|
||||||
|
/// Innermost unit whose complete range contains `span`.
|
||||||
|
///
|
||||||
|
/// Used for document links: the root covers the whole source, so a linked
|
||||||
|
/// span always has an owner. Ties prefer the deeper path, then the later
|
||||||
|
/// start (a child cannot be larger than its parent).
|
||||||
|
pub fn unit_containing_span(&self, span: Span) -> Option<UnitId> {
|
||||||
|
self.units
|
||||||
|
.iter()
|
||||||
|
.filter_map(|unit| {
|
||||||
|
let range = self.unit_range(&unit.id)?;
|
||||||
|
(range.start <= span.start && span.end <= range.end).then_some((unit, range))
|
||||||
|
})
|
||||||
|
.max_by_key(|(unit, range)| (unit.id.path.len(), range.start))
|
||||||
|
.map(|(unit, _)| unit.id.clone())
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fn has_payload(node: &MdNode) -> bool {
|
fn has_payload(node: &MdNode) -> bool {
|
||||||
@@ -116,6 +158,28 @@ pub enum SemanticMode {
|
|||||||
Exec,
|
Exec,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// How a heading's effective mode was established.
|
||||||
|
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
|
||||||
|
pub enum ModeOrigin {
|
||||||
|
/// The document root is Knowledge by default.
|
||||||
|
Default,
|
||||||
|
/// The ATX heading declares `@exec` or `@knowledge`.
|
||||||
|
Explicit,
|
||||||
|
/// The heading inherits the mode of an ancestor or the root.
|
||||||
|
Inherited,
|
||||||
|
}
|
||||||
|
|
||||||
|
impl ModeOrigin {
|
||||||
|
/// Stable public name used by Analysis.
|
||||||
|
pub fn as_str(self) -> &'static str {
|
||||||
|
match self {
|
||||||
|
ModeOrigin::Default => "default",
|
||||||
|
ModeOrigin::Explicit => "explicit",
|
||||||
|
ModeOrigin::Inherited => "inherited",
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
fn heading_declaration(
|
fn heading_declaration(
|
||||||
node: &MdNode,
|
node: &MdNode,
|
||||||
) -> (Option<SemanticMode>, Option<String>, Option<Diagnostic>) {
|
) -> (Option<SemanticMode>, Option<String>, Option<Diagnostic>) {
|
||||||
@@ -184,20 +248,22 @@ fn heading_declaration(
|
|||||||
/// Build the heading/function index for a parsed document.
|
/// Build the heading/function index for a parsed document.
|
||||||
pub fn build_units(doc: &MarkdownDocument, module: &ModuleId) -> UnitIndex {
|
pub fn build_units(doc: &MarkdownDocument, module: &ModuleId) -> UnitIndex {
|
||||||
let mut index = UnitIndex::default();
|
let mut index = UnitIndex::default();
|
||||||
index.units.push(UnitInfo {
|
let root_id = UnitId {
|
||||||
id: UnitId {
|
|
||||||
module: module.clone(),
|
module: module.clone(),
|
||||||
path: Vec::new(),
|
path: Vec::new(),
|
||||||
},
|
};
|
||||||
|
index.units.push(UnitInfo {
|
||||||
|
id: root_id.clone(),
|
||||||
level: 0,
|
level: 0,
|
||||||
name: String::new(),
|
name: String::new(),
|
||||||
span: doc.root.span,
|
// The root covers the whole source, including a tolerated UTF-8 BOM.
|
||||||
|
span: Span::new(0, doc.source.len()),
|
||||||
kind: UnitKind::Root,
|
kind: UnitKind::Root,
|
||||||
function: None,
|
function: None,
|
||||||
});
|
});
|
||||||
|
|
||||||
// Stack of (level, path, mode) for ancestors.
|
// Stack of (level, path, mode, mode_source_unit_id) for ancestors.
|
||||||
let mut stack: Vec<(u8, Vec<String>, SemanticMode)> = Vec::new();
|
let mut stack: Vec<(u8, Vec<String>, SemanticMode, UnitId)> = Vec::new();
|
||||||
let mut seen: BTreeMap<(Vec<String>, String), Span> = BTreeMap::new();
|
let mut seen: BTreeMap<(Vec<String>, String), Span> = BTreeMap::new();
|
||||||
let mut current_namespace: Option<String> = None;
|
let mut current_namespace: Option<String> = None;
|
||||||
let mut current_function: Option<FunctionId> = None;
|
let mut current_function: Option<FunctionId> = None;
|
||||||
@@ -224,7 +290,7 @@ pub fn build_units(doc: &MarkdownDocument, module: &ModuleId) -> UnitIndex {
|
|||||||
// Resolve the ancestor scope before deriving the mode: remove every
|
// Resolve the ancestor scope before deriving the mode: remove every
|
||||||
// same-or-higher-level heading first so a heading can only inherit from
|
// same-or-higher-level heading first so a heading can only inherit from
|
||||||
// its nearest *ancestor*, never from the previous sibling.
|
// its nearest *ancestor*, never from the previous sibling.
|
||||||
while let Some((parent_level, _, _)) = stack.last() {
|
while let Some((parent_level, _, _, _)) = stack.last() {
|
||||||
if *parent_level >= level {
|
if *parent_level >= level {
|
||||||
stack.pop();
|
stack.pop();
|
||||||
} else {
|
} else {
|
||||||
@@ -233,8 +299,12 @@ pub fn build_units(doc: &MarkdownDocument, module: &ModuleId) -> UnitIndex {
|
|||||||
}
|
}
|
||||||
let inherited = stack
|
let inherited = stack
|
||||||
.last()
|
.last()
|
||||||
.map(|(_, _, mode)| *mode)
|
.map(|(_, _, mode, _)| *mode)
|
||||||
.unwrap_or(SemanticMode::Knowledge);
|
.unwrap_or(SemanticMode::Knowledge);
|
||||||
|
let inherited_source = stack
|
||||||
|
.last()
|
||||||
|
.map(|(_, _, _, source)| source.clone())
|
||||||
|
.unwrap_or_else(|| root_id.clone());
|
||||||
let mode = declared.unwrap_or(inherited);
|
let mode = declared.unwrap_or(inherited);
|
||||||
let raw_name = match declared_name {
|
let raw_name = match declared_name {
|
||||||
Some(name) => name,
|
Some(name) => name,
|
||||||
@@ -254,13 +324,25 @@ pub fn build_units(doc: &MarkdownDocument, module: &ModuleId) -> UnitIndex {
|
|||||||
|
|
||||||
let parent_path = stack
|
let parent_path = stack
|
||||||
.last()
|
.last()
|
||||||
.map(|(_, path, _)| path.clone())
|
.map(|(_, path, _, _)| path.clone())
|
||||||
.unwrap_or_default();
|
.unwrap_or_default();
|
||||||
|
let parent_id = UnitId {
|
||||||
|
module: module.clone(),
|
||||||
|
path: parent_path.clone(),
|
||||||
|
};
|
||||||
let path = {
|
let path = {
|
||||||
let mut path = parent_path.clone();
|
let mut path = parent_path.clone();
|
||||||
path.push(name.clone());
|
path.push(name.clone());
|
||||||
path
|
path
|
||||||
};
|
};
|
||||||
|
let unit_id = UnitId {
|
||||||
|
module: module.clone(),
|
||||||
|
path: path.clone(),
|
||||||
|
};
|
||||||
|
let (mode_origin, mode_source_unit_id) = match declared {
|
||||||
|
Some(_) => (ModeOrigin::Explicit, unit_id.clone()),
|
||||||
|
None => (ModeOrigin::Inherited, inherited_source),
|
||||||
|
};
|
||||||
|
|
||||||
let key = (parent_path.clone(), name.clone());
|
let key = (parent_path.clone(), name.clone());
|
||||||
if let Some(previous) = seen.get(&key) {
|
if let Some(previous) = seen.get(&key) {
|
||||||
@@ -304,6 +386,27 @@ pub fn build_units(doc: &MarkdownDocument, module: &ModuleId) -> UnitIndex {
|
|||||||
Some(namespace) => format!("{namespace}.{local}"),
|
Some(namespace) => format!("{namespace}.{local}"),
|
||||||
None => local.clone(),
|
None => local.clone(),
|
||||||
};
|
};
|
||||||
|
// `.` separates namespace from local name in a FunctionId. A
|
||||||
|
// component that itself contains `.` would make two different
|
||||||
|
// definitions render the same public id; reject it explicitly
|
||||||
|
// instead of silently producing a non-injective identity.
|
||||||
|
let ambiguous = local.contains('.')
|
||||||
|
|| current_namespace
|
||||||
|
.as_deref()
|
||||||
|
.map(|namespace| namespace.contains('.'))
|
||||||
|
.unwrap_or(false);
|
||||||
|
if ambiguous {
|
||||||
|
index.diagnostics.push(
|
||||||
|
Diagnostic::error(
|
||||||
|
codes::SEM_AMBIGUOUS_IDENTITY,
|
||||||
|
Some(child.span),
|
||||||
|
"function or namespace name contains `.`, which is the namespace separator; the public function id would be ambiguous",
|
||||||
|
)
|
||||||
|
.with_hint(
|
||||||
|
"rename the namespace or function so it does not contain a dot",
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}
|
||||||
let id = FunctionId {
|
let id = FunctionId {
|
||||||
module: module.clone(),
|
module: module.clone(),
|
||||||
name: qualified,
|
name: qualified,
|
||||||
@@ -327,10 +430,12 @@ pub fn build_units(doc: &MarkdownDocument, module: &ModuleId) -> UnitIndex {
|
|||||||
path: path.clone(),
|
path: path.clone(),
|
||||||
kind,
|
kind,
|
||||||
mode,
|
mode,
|
||||||
};
|
mode_origin,
|
||||||
let unit_id = UnitId {
|
mode_source_unit_id,
|
||||||
module: module.clone(),
|
parent_id,
|
||||||
path,
|
// Filled after all headings are known (the end is the next
|
||||||
|
// same-or-higher heading or EOF).
|
||||||
|
full_span: child.span,
|
||||||
};
|
};
|
||||||
index.units.push(UnitInfo {
|
index.units.push(UnitInfo {
|
||||||
id: unit_id,
|
id: unit_id,
|
||||||
@@ -361,7 +466,26 @@ pub fn build_units(doc: &MarkdownDocument, module: &ModuleId) -> UnitIndex {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
heading_infos.push(info.clone());
|
heading_infos.push(info.clone());
|
||||||
stack.push((level, info.path.clone(), mode));
|
stack.push((
|
||||||
|
level,
|
||||||
|
info.path.clone(),
|
||||||
|
mode,
|
||||||
|
info.mode_source_unit_id.clone(),
|
||||||
|
));
|
||||||
|
}
|
||||||
|
|
||||||
|
// Complete section ranges: from this heading to the next heading of the
|
||||||
|
// same or a higher level, or EOF. Child headings are included.
|
||||||
|
let total = doc.source.len();
|
||||||
|
for position in 0..heading_infos.len() {
|
||||||
|
let level = heading_infos[position].level;
|
||||||
|
let start = heading_infos[position].span.start;
|
||||||
|
let end = heading_infos[position + 1..]
|
||||||
|
.iter()
|
||||||
|
.find(|candidate| candidate.level <= level)
|
||||||
|
.map(|candidate| candidate.span.start)
|
||||||
|
.unwrap_or(total);
|
||||||
|
heading_infos[position].full_span = Span::new(start, end.max(start));
|
||||||
}
|
}
|
||||||
|
|
||||||
// Function body ranges and spans.
|
// Function body ranges and spans.
|
||||||
@@ -624,6 +748,117 @@ mod tests {
|
|||||||
assert_eq!(normal.kind, UnitKind::Knowledge);
|
assert_eq!(normal.kind, UnitKind::Knowledge);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn full_spans_cover_sections_and_parent_edges_form_a_tree() {
|
||||||
|
let source = "# @knowledge 力学\n\n## @exec 计算力\n\n`return 1`\n\n### 细节\n\n正文\n\n## 说明\n\n结尾\n";
|
||||||
|
let index = index_of(source);
|
||||||
|
let by_name = |name: &str| {
|
||||||
|
index
|
||||||
|
.headings
|
||||||
|
.iter()
|
||||||
|
.find(|heading| heading.name == name)
|
||||||
|
.unwrap_or_else(|| panic!("missing heading {name}"))
|
||||||
|
};
|
||||||
|
let calc = by_name("计算力");
|
||||||
|
let detail = by_name("细节");
|
||||||
|
let note = by_name("说明");
|
||||||
|
// The function range includes its H3 child but not the next H2.
|
||||||
|
assert_eq!(calc.full_span.start, calc.span.start);
|
||||||
|
assert!(calc.full_span.end > detail.span.start);
|
||||||
|
assert_eq!(calc.full_span.end, note.span.start);
|
||||||
|
assert_eq!(detail.full_span.end, note.span.start);
|
||||||
|
assert_eq!(note.full_span.end, source.len());
|
||||||
|
assert_eq!(
|
||||||
|
detail.parent_id.path,
|
||||||
|
vec!["力学".to_string(), "计算力".to_string()]
|
||||||
|
);
|
||||||
|
assert_eq!(calc.parent_id.path, vec!["力学".to_string()]);
|
||||||
|
let root = &index.units[0];
|
||||||
|
assert_eq!(root.span, marqdo_span::Span::new(0, source.len()));
|
||||||
|
assert_eq!(
|
||||||
|
calc.parent_id,
|
||||||
|
index
|
||||||
|
.units
|
||||||
|
.iter()
|
||||||
|
.find(|u| u.name == "力学")
|
||||||
|
.unwrap()
|
||||||
|
.id
|
||||||
|
.clone()
|
||||||
|
);
|
||||||
|
assert_eq!(by_name("力学").parent_id, root.id);
|
||||||
|
}
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn mode_origin_and_source_are_explicit() {
|
||||||
|
let index = index_of(
|
||||||
|
"# @knowledge 数学\n\n## @exec 计算\n\n### 细节\n\n`return 1`\n\n## 说明\n\n正文\n",
|
||||||
|
);
|
||||||
|
let by_name = |name: &str| {
|
||||||
|
index
|
||||||
|
.headings
|
||||||
|
.iter()
|
||||||
|
.find(|heading| heading.name == name)
|
||||||
|
.unwrap_or_else(|| panic!("missing heading {name}"))
|
||||||
|
};
|
||||||
|
let namespace = by_name("数学");
|
||||||
|
assert_eq!(namespace.mode_origin, ModeOrigin::Explicit);
|
||||||
|
assert_eq!(
|
||||||
|
namespace.mode_source_unit_id,
|
||||||
|
namespace_unit(&index, "数学")
|
||||||
|
);
|
||||||
|
let calc = by_name("计算");
|
||||||
|
assert_eq!(calc.mode_origin, ModeOrigin::Explicit);
|
||||||
|
assert_eq!(
|
||||||
|
calc.mode_source_unit_id.path,
|
||||||
|
vec!["数学".to_string(), "计算".to_string()]
|
||||||
|
);
|
||||||
|
let detail = by_name("细节");
|
||||||
|
assert_eq!(detail.mode_origin, ModeOrigin::Inherited);
|
||||||
|
assert_eq!(
|
||||||
|
detail.mode_source_unit_id.path,
|
||||||
|
calc.mode_source_unit_id.path
|
||||||
|
);
|
||||||
|
let note = by_name("说明");
|
||||||
|
assert_eq!(note.mode_origin, ModeOrigin::Inherited);
|
||||||
|
assert_eq!(note.mode_source_unit_id.path, vec!["数学".to_string()]);
|
||||||
|
}
|
||||||
|
|
||||||
|
fn namespace_unit(index: &UnitIndex, name: &str) -> UnitId {
|
||||||
|
index
|
||||||
|
.units
|
||||||
|
.iter()
|
||||||
|
.find(|unit| unit.name == name)
|
||||||
|
.map(|unit| unit.id.clone())
|
||||||
|
.expect("namespace unit")
|
||||||
|
}
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn a_dot_in_a_function_component_is_rejected_as_an_ambiguous_identity() {
|
||||||
|
let index = index_of("# @knowledge a.b\n\n## @exec f\n\n`return 1`\n");
|
||||||
|
assert!(index
|
||||||
|
.diagnostics
|
||||||
|
.iter()
|
||||||
|
.any(|diagnostic| diagnostic.code == "sem.ambiguous_identity"));
|
||||||
|
let index = index_of("## @exec a.b\n\n`return 1`\n");
|
||||||
|
assert!(index
|
||||||
|
.diagnostics
|
||||||
|
.iter()
|
||||||
|
.any(|diagnostic| diagnostic.code == "sem.ambiguous_identity"));
|
||||||
|
}
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn innermost_unit_owns_a_linked_span() {
|
||||||
|
let source = "前置说明。\n\n# @knowledge 数学\n\n## @exec 计算\n\n见[链接](#细节)。\n\n### 细节\n\n`return 1`\n";
|
||||||
|
let index = index_of(source);
|
||||||
|
let link_start = source.find("[链接]").unwrap();
|
||||||
|
let owner = index
|
||||||
|
.unit_containing_span(Span::new(link_start, link_start + 2))
|
||||||
|
.expect("owning unit");
|
||||||
|
assert_eq!(owner.path, vec!["数学".to_string(), "计算".to_string()]);
|
||||||
|
let root = index.unit_containing_span(Span::new(0, 1)).expect("root");
|
||||||
|
assert!(root.path.is_empty());
|
||||||
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn knowledge_scope_payloads_and_sections_stay_inert() {
|
fn knowledge_scope_payloads_and_sections_stay_inert() {
|
||||||
let index = index_of(
|
let index = index_of(
|
||||||
|
|||||||
@@ -0,0 +1,13 @@
|
|||||||
|
[package]
|
||||||
|
name = "marqdo-host-contract"
|
||||||
|
description = "Platform-neutral Host contract: the only side-effect boundary the runtime may know"
|
||||||
|
version.workspace = true
|
||||||
|
edition.workspace = true
|
||||||
|
rust-version.workspace = true
|
||||||
|
license.workspace = true
|
||||||
|
repository.workspace = true
|
||||||
|
authors.workspace = true
|
||||||
|
|
||||||
|
[dependencies]
|
||||||
|
marqdo-span = { workspace = true }
|
||||||
|
marqdo-value = { workspace = true }
|
||||||
File renamed without changes.
@@ -0,0 +1,194 @@
|
|||||||
|
//! The host boundary used by the interpreter and future frontends.
|
||||||
|
//!
|
||||||
|
//! The trait is implemented by the native CLI host, by the independent
|
||||||
|
//! embedding/test host and by any future host. Implementations own effects,
|
||||||
|
//! grants and budgets; the runtime only requests operations through this
|
||||||
|
//! interface and never performs external I/O itself.
|
||||||
|
|
||||||
|
use marqdo_span::Span;
|
||||||
|
use marqdo_value::{ErrorCategory, ResourceHandle, RuntimeError, Value};
|
||||||
|
|
||||||
|
use crate::context::ExecutionContext;
|
||||||
|
use crate::observe::{FrameId, RuntimeObservation};
|
||||||
|
use crate::resource::ResourceRead;
|
||||||
|
|
||||||
|
/// Host operations reachable from the language surface.
|
||||||
|
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
|
||||||
|
pub enum HostOp {
|
||||||
|
/// One-shot foreign execution.
|
||||||
|
ForeignRun,
|
||||||
|
/// Typed foreign call.
|
||||||
|
ForeignCall,
|
||||||
|
/// Read a project file.
|
||||||
|
FsRead,
|
||||||
|
/// Write a project file.
|
||||||
|
FsWrite,
|
||||||
|
/// Invoke a plugin export.
|
||||||
|
PluginInvoke,
|
||||||
|
}
|
||||||
|
|
||||||
|
impl HostOp {
|
||||||
|
/// Stable operation name used in traces and diagnostics.
|
||||||
|
pub const fn name(self) -> &'static str {
|
||||||
|
match self {
|
||||||
|
HostOp::ForeignRun => "foreign.run",
|
||||||
|
HostOp::ForeignCall => "foreign.call",
|
||||||
|
HostOp::FsRead => "fs.read",
|
||||||
|
HostOp::FsWrite => "fs.write",
|
||||||
|
HostOp::PluginInvoke => "plugin.invoke",
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// The host boundary used by the interpreter and future View/IDE frontends.
|
||||||
|
pub trait Host {
|
||||||
|
/// Invoke one operation with already-evaluated arguments.
|
||||||
|
fn invoke(
|
||||||
|
&mut self,
|
||||||
|
op: HostOp,
|
||||||
|
args: Vec<Value>,
|
||||||
|
ctx: &ExecutionContext,
|
||||||
|
) -> Result<Value, RuntimeError>;
|
||||||
|
|
||||||
|
/// Open a resource/stream by kind, descriptor and requested rights.
|
||||||
|
///
|
||||||
|
/// Default: unavailable. Only the standard host implements the first
|
||||||
|
/// resource kinds (ADR-0025).
|
||||||
|
fn resource_open(
|
||||||
|
&mut self,
|
||||||
|
_kind: &str,
|
||||||
|
_descriptor: &str,
|
||||||
|
_rights: &[String],
|
||||||
|
ctx: &ExecutionContext,
|
||||||
|
) -> Result<Value, RuntimeError> {
|
||||||
|
Err(RuntimeError::new(
|
||||||
|
ErrorCategory::ResourceUnsupported,
|
||||||
|
ctx.span,
|
||||||
|
"this host does not provide resource streams",
|
||||||
|
))
|
||||||
|
}
|
||||||
|
|
||||||
|
/// Read up to `max_bytes` from a resource into host memory.
|
||||||
|
fn resource_read(
|
||||||
|
&mut self,
|
||||||
|
_handle: ResourceHandle,
|
||||||
|
_max_bytes: usize,
|
||||||
|
ctx: &ExecutionContext,
|
||||||
|
) -> Result<ResourceRead, RuntimeError> {
|
||||||
|
Err(RuntimeError::new(
|
||||||
|
ErrorCategory::ResourceUnsupported,
|
||||||
|
ctx.span,
|
||||||
|
"this host does not provide resource streams",
|
||||||
|
))
|
||||||
|
}
|
||||||
|
|
||||||
|
/// Write bytes to a resource; returns the accepted count.
|
||||||
|
fn resource_write(
|
||||||
|
&mut self,
|
||||||
|
_handle: ResourceHandle,
|
||||||
|
_bytes: &[u8],
|
||||||
|
ctx: &ExecutionContext,
|
||||||
|
) -> Result<usize, RuntimeError> {
|
||||||
|
Err(RuntimeError::new(
|
||||||
|
ErrorCategory::ResourceUnsupported,
|
||||||
|
ctx.span,
|
||||||
|
"this host does not provide resource streams",
|
||||||
|
))
|
||||||
|
}
|
||||||
|
|
||||||
|
/// Close a resource handle.
|
||||||
|
fn resource_close(
|
||||||
|
&mut self,
|
||||||
|
_handle: ResourceHandle,
|
||||||
|
ctx: &ExecutionContext,
|
||||||
|
) -> Result<(), RuntimeError> {
|
||||||
|
Err(RuntimeError::new(
|
||||||
|
ErrorCategory::ResourceUnsupported,
|
||||||
|
ctx.span,
|
||||||
|
"this host does not provide resource streams",
|
||||||
|
))
|
||||||
|
}
|
||||||
|
|
||||||
|
/// Accept one inbound TCP connection from a `tcp-listener` handle.
|
||||||
|
///
|
||||||
|
/// Default: unavailable. The standard host returns a new `Resource` in a
|
||||||
|
/// recoverable `{ok,value}` map or `{ok:false,code:"tcp.timeout"}`.
|
||||||
|
fn resource_accept(
|
||||||
|
&mut self,
|
||||||
|
_handle: ResourceHandle,
|
||||||
|
ctx: &ExecutionContext,
|
||||||
|
) -> Result<Value, RuntimeError> {
|
||||||
|
Err(RuntimeError::new(
|
||||||
|
ErrorCategory::ResourceUnsupported,
|
||||||
|
ctx.span,
|
||||||
|
"this host does not provide tcp listeners",
|
||||||
|
))
|
||||||
|
}
|
||||||
|
|
||||||
|
/// Execute one non-streaming resource operation (ADR-0041).
|
||||||
|
///
|
||||||
|
/// Default: unavailable. The standard host implements the `fs.*` group;
|
||||||
|
/// every call is capability-checked and project-mode only.
|
||||||
|
fn resource_request(
|
||||||
|
&mut self,
|
||||||
|
_operation: &str,
|
||||||
|
_args: Vec<Value>,
|
||||||
|
ctx: &ExecutionContext,
|
||||||
|
) -> Result<Value, RuntimeError> {
|
||||||
|
Err(RuntimeError::new(
|
||||||
|
ErrorCategory::ResourceUnsupported,
|
||||||
|
ctx.span,
|
||||||
|
"this host does not provide resource operations",
|
||||||
|
))
|
||||||
|
}
|
||||||
|
|
||||||
|
/// Consume evaluation fuel.
|
||||||
|
fn consume_fuel(&mut self, amount: u64, span: Option<Span>) -> Result<(), RuntimeError>;
|
||||||
|
|
||||||
|
/// Check call-stack depth.
|
||||||
|
fn check_stack(&self, depth: usize, span: Option<Span>) -> Result<(), RuntimeError>;
|
||||||
|
|
||||||
|
/// Check the wall-clock deadline.
|
||||||
|
fn check_deadline(&self, span: Option<Span>) -> Result<(), RuntimeError>;
|
||||||
|
|
||||||
|
/// Take the buffered program output.
|
||||||
|
fn take_output(&mut self) -> Vec<u8>;
|
||||||
|
|
||||||
|
/// Whether the host has an installed observation sink.
|
||||||
|
///
|
||||||
|
/// The default host is inert; the interpreter uses this to skip building
|
||||||
|
/// any observation event when there is no capture destination.
|
||||||
|
fn observation_enabled(&self) -> bool {
|
||||||
|
false
|
||||||
|
}
|
||||||
|
|
||||||
|
/// Announce a successfully bound call frame.
|
||||||
|
///
|
||||||
|
/// Returns the run-unique frame identity, or `None` when observation is
|
||||||
|
/// disabled. Argument binding must have completed before this is called;
|
||||||
|
/// a binding failure never produces a frame.
|
||||||
|
fn observation_begin_frame(
|
||||||
|
&mut self,
|
||||||
|
_function_id: &str,
|
||||||
|
_module_id: &str,
|
||||||
|
_span: Option<Span>,
|
||||||
|
) -> Result<Option<FrameId>, RuntimeError> {
|
||||||
|
Ok(None)
|
||||||
|
}
|
||||||
|
|
||||||
|
/// Close a previously announced frame, including failure paths.
|
||||||
|
fn observation_end_frame(
|
||||||
|
&mut self,
|
||||||
|
_frame_id: Option<FrameId>,
|
||||||
|
_status: &str,
|
||||||
|
_module_id: &str,
|
||||||
|
_span: Option<Span>,
|
||||||
|
) -> Result<(), RuntimeError> {
|
||||||
|
Ok(())
|
||||||
|
}
|
||||||
|
|
||||||
|
/// Emit one borrowed runtime observation event. Default: ignored.
|
||||||
|
fn observe_runtime(&mut self, _event: RuntimeObservation<'_>) -> Result<(), RuntimeError> {
|
||||||
|
Ok(())
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,25 @@
|
|||||||
|
//! Platform-neutral Host contract.
|
||||||
|
//!
|
||||||
|
//! This crate owns the only side-effect interface the language engine knows:
|
||||||
|
//! the [`Host`] trait, its [`HostOp`] surface, the per-call
|
||||||
|
//! [`ExecutionContext`], the opaque resource read result and the runtime
|
||||||
|
//! observation notifications. It is a Rust compile-time interface inside one
|
||||||
|
//! codebase, not a wire protocol: there is no HTTP, RPC, C ABI or dynamic
|
||||||
|
//! loading boundary here.
|
||||||
|
//!
|
||||||
|
//! The crate is deliberately neutral. It depends only on the language value
|
||||||
|
//! and span types; it must never link the native host, the CLI, the sandbox,
|
||||||
|
//! foreign kernels, the plugin loader or a project filesystem. Native and
|
||||||
|
//! embedded hosts implement [`Host`] without re-implementing any language
|
||||||
|
//! semantics. Authorization, budgets, resource identity and OS isolation stay
|
||||||
|
//! owned by the trusted host implementation that consumes this contract.
|
||||||
|
|
||||||
|
pub mod context;
|
||||||
|
pub mod host;
|
||||||
|
pub mod observe;
|
||||||
|
pub mod resource;
|
||||||
|
|
||||||
|
pub use context::ExecutionContext;
|
||||||
|
pub use host::{Host, HostOp};
|
||||||
|
pub use observe::{FrameId, LoopTransfer, ParameterSource, RuntimeObservation};
|
||||||
|
pub use resource::ResourceRead;
|
||||||
@@ -0,0 +1,118 @@
|
|||||||
|
//! Runtime observation facts shared by the interpreter and the host contract.
|
||||||
|
//!
|
||||||
|
//! Only the types the interpreter itself produces and hands to [`crate::Host`]
|
||||||
|
//! live here. The host implementation keeps the concrete sink, redaction,
|
||||||
|
//! encoding and budget state; the public Observation protocol remains the
|
||||||
|
//! CLI's single producer. This module must not grow a second event vocabulary.
|
||||||
|
|
||||||
|
use marqdo_span::Span;
|
||||||
|
use marqdo_value::Value;
|
||||||
|
|
||||||
|
/// Opaque run-scoped call-instance identity.
|
||||||
|
///
|
||||||
|
/// Not a function identity, not a source location and never a memory pointer.
|
||||||
|
#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash, PartialOrd, Ord)]
|
||||||
|
pub struct FrameId(pub u64);
|
||||||
|
|
||||||
|
impl FrameId {
|
||||||
|
/// Stable wire form used by the public protocol (`f1`, `f2`, ...).
|
||||||
|
pub fn as_wire(self) -> String {
|
||||||
|
format!("f{}", self.0)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// Where a bound parameter's value came from.
|
||||||
|
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
|
||||||
|
pub enum ParameterSource {
|
||||||
|
/// Supplied by the caller (CLI `--arg` or a Marqdo call).
|
||||||
|
Provided,
|
||||||
|
/// Evaluated from the declared default expression.
|
||||||
|
Default,
|
||||||
|
}
|
||||||
|
|
||||||
|
impl ParameterSource {
|
||||||
|
/// Stable wire name.
|
||||||
|
pub const fn as_str(self) -> &'static str {
|
||||||
|
match self {
|
||||||
|
ParameterSource::Provided => "provided",
|
||||||
|
ParameterSource::Default => "default",
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// The action carried by a structured loop transfer observation.
|
||||||
|
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
|
||||||
|
pub enum LoopTransfer {
|
||||||
|
/// Exit the enclosing loop.
|
||||||
|
Break,
|
||||||
|
/// Proceed to the enclosing loop's next condition check.
|
||||||
|
Continue,
|
||||||
|
}
|
||||||
|
|
||||||
|
impl LoopTransfer {
|
||||||
|
/// The event kind in Observation.
|
||||||
|
pub fn event_kind(self) -> &'static str {
|
||||||
|
match self {
|
||||||
|
Self::Break => "control.break",
|
||||||
|
Self::Continue => "control.continue",
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// Borrowed runtime notification accepted by [`crate::Host::observe_runtime`].
|
||||||
|
///
|
||||||
|
/// Value and control observations carry the owning call frame.
|
||||||
|
#[derive(Debug)]
|
||||||
|
pub enum RuntimeObservation<'a> {
|
||||||
|
/// A local memory operation committed.
|
||||||
|
Effect {
|
||||||
|
operation: &'a str,
|
||||||
|
module_id: &'a str,
|
||||||
|
span: Option<Span>,
|
||||||
|
},
|
||||||
|
/// A `return` statement committed (before the call exits).
|
||||||
|
Return {
|
||||||
|
frame_id: Option<FrameId>,
|
||||||
|
value_type: &'a str,
|
||||||
|
module_id: &'a str,
|
||||||
|
span: Option<Span>,
|
||||||
|
},
|
||||||
|
/// A branch condition evaluated.
|
||||||
|
BranchEval {
|
||||||
|
frame_id: Option<FrameId>,
|
||||||
|
result: bool,
|
||||||
|
module_id: &'a str,
|
||||||
|
span: Option<Span>,
|
||||||
|
},
|
||||||
|
/// A loop condition evaluated.
|
||||||
|
LoopIteration {
|
||||||
|
frame_id: Option<FrameId>,
|
||||||
|
decision: &'a str,
|
||||||
|
module_id: &'a str,
|
||||||
|
span: Option<Span>,
|
||||||
|
},
|
||||||
|
/// An explicit loop control statement executed.
|
||||||
|
LoopTransfer {
|
||||||
|
frame_id: Option<FrameId>,
|
||||||
|
transfer: LoopTransfer,
|
||||||
|
module_id: &'a str,
|
||||||
|
span: Span,
|
||||||
|
},
|
||||||
|
/// A local variable assignment committed.
|
||||||
|
VariableAssigned {
|
||||||
|
frame_id: Option<FrameId>,
|
||||||
|
name: &'a str,
|
||||||
|
value: &'a Value,
|
||||||
|
module_id: &'a str,
|
||||||
|
span: Option<Span>,
|
||||||
|
},
|
||||||
|
/// A parameter was bound.
|
||||||
|
ParameterBound {
|
||||||
|
frame_id: Option<FrameId>,
|
||||||
|
name: &'a str,
|
||||||
|
source: ParameterSource,
|
||||||
|
value: &'a Value,
|
||||||
|
module_id: &'a str,
|
||||||
|
span: Option<Span>,
|
||||||
|
},
|
||||||
|
}
|
||||||
@@ -0,0 +1,10 @@
|
|||||||
|
//! Values crossing the resource stream methods of [`crate::Host`].
|
||||||
|
|
||||||
|
/// Bytes returned by one stream read.
|
||||||
|
#[derive(Debug, Clone, PartialEq, Eq)]
|
||||||
|
pub struct ResourceRead {
|
||||||
|
/// Bytes actually read (may be empty at EOF).
|
||||||
|
pub bytes: Vec<u8>,
|
||||||
|
/// Whether the stream has reached EOF.
|
||||||
|
pub eof: bool,
|
||||||
|
}
|
||||||
@@ -12,6 +12,7 @@ authors.workspace = true
|
|||||||
libloading = { workspace = true }
|
libloading = { workspace = true }
|
||||||
rustls = { workspace = true }
|
rustls = { workspace = true }
|
||||||
rustls-native-certs = { workspace = true }
|
rustls-native-certs = { workspace = true }
|
||||||
|
marqdo-host-contract = { workspace = true }
|
||||||
marqdo-plugin-abi = { workspace = true }
|
marqdo-plugin-abi = { workspace = true }
|
||||||
marqdo-worker-ipc = { workspace = true }
|
marqdo-worker-ipc = { workspace = true }
|
||||||
flate2 = { workspace = true }
|
flate2 = { workspace = true }
|
||||||
@@ -23,6 +24,9 @@ marqdo-value = { workspace = true }
|
|||||||
marqdo-foreign = { workspace = true }
|
marqdo-foreign = { workspace = true }
|
||||||
marqdo-sandbox = { workspace = true }
|
marqdo-sandbox = { workspace = true }
|
||||||
serde = { workspace = true }
|
serde = { workspace = true }
|
||||||
|
sha2 = { workspace = true }
|
||||||
|
hex = { workspace = true }
|
||||||
|
serde_yaml = { workspace = true }
|
||||||
serde_json = { workspace = true }
|
serde_json = { workspace = true }
|
||||||
thiserror = { workspace = true }
|
thiserror = { workspace = true }
|
||||||
|
|
||||||
|
|||||||
+13
-192
@@ -9,27 +9,30 @@ use std::net::{TcpListener, TcpStream, ToSocketAddrs, UdpSocket};
|
|||||||
use std::sync::{Arc, Mutex};
|
use std::sync::{Arc, Mutex};
|
||||||
use std::time::Duration;
|
use std::time::Duration;
|
||||||
|
|
||||||
use marqdo_plugin_abi::{
|
use crate::plugin::{
|
||||||
ErrorKind as PluginErrorKind, LoadedPlugin, PluginError, PluginKind, PluginManifest,
|
CapabilityHandler, HostTarget, LoadOptions, LoadedPlugin, PluginKind, PluginManifest,
|
||||||
};
|
};
|
||||||
|
use marqdo_host_contract::{
|
||||||
|
ExecutionContext, FrameId, Host, HostOp, ResourceRead, RuntimeObservation,
|
||||||
|
};
|
||||||
|
use marqdo_plugin_abi::{ErrorKind as PluginErrorKind, PluginError};
|
||||||
use marqdo_span::Span;
|
use marqdo_span::Span;
|
||||||
use marqdo_value::{ErrorCategory, ResourceHandle, RuntimeError, Value};
|
use marqdo_value::{ErrorCategory, ResourceHandle, RuntimeError, Value};
|
||||||
use rustls::pki_types::CertificateDer;
|
use rustls::pki_types::CertificateDer;
|
||||||
|
|
||||||
use crate::budget::Budget;
|
use crate::budget::Budget;
|
||||||
use crate::capability::{Capabilities, CapabilityAudit, CapabilityBroker};
|
use crate::capability::{Capabilities, CapabilityAudit, CapabilityBroker};
|
||||||
use crate::context::ExecutionContext;
|
|
||||||
use crate::fs::ProjectFs;
|
use crate::fs::ProjectFs;
|
||||||
use crate::handles::{contains_plugin_handle, PluginHandleTable};
|
use crate::handles::{contains_plugin_handle, PluginHandleTable};
|
||||||
use crate::observe::{
|
use crate::observe::{
|
||||||
encode_value, estimate_event_bytes, FrameId, ObservationConfig, ObservationError,
|
encode_value, estimate_event_bytes, ObservationConfig, ObservationError, ObservationEvent,
|
||||||
ObservationEvent, ObservationSink, ObservationState, RuntimeObservation,
|
ObservationSink, ObservationState,
|
||||||
};
|
};
|
||||||
use crate::plugin_worker::WorkerPlugin;
|
use crate::plugin_worker::WorkerPlugin;
|
||||||
use crate::provider_c::{load_package, CResourceProvider};
|
use crate::provider_c::{load_package, CResourceProvider};
|
||||||
use crate::provider_worker::WorkerResourceProvider;
|
use crate::provider_worker::WorkerResourceProvider;
|
||||||
use crate::resource::{
|
use crate::resource::{
|
||||||
is_core_resource_kind, ResourceProvider, ResourceRead, ResourceTable, SharedResourceProvider,
|
is_core_resource_kind, ResourceProvider, ResourceTable, SharedResourceProvider,
|
||||||
};
|
};
|
||||||
use marqdo_sandbox::{PlatformCapabilities, SandboxMode};
|
use marqdo_sandbox::{PlatformCapabilities, SandboxMode};
|
||||||
|
|
||||||
@@ -38,187 +41,6 @@ mod providers;
|
|||||||
mod resource_ops;
|
mod resource_ops;
|
||||||
mod resource_requests;
|
mod resource_requests;
|
||||||
|
|
||||||
/// Host operations reachable from the language surface.
|
|
||||||
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
|
|
||||||
pub enum HostOp {
|
|
||||||
/// One-shot foreign execution.
|
|
||||||
ForeignRun,
|
|
||||||
/// Typed foreign call.
|
|
||||||
ForeignCall,
|
|
||||||
/// Read a project file.
|
|
||||||
FsRead,
|
|
||||||
/// Write a project file.
|
|
||||||
FsWrite,
|
|
||||||
/// Invoke a plugin export.
|
|
||||||
PluginInvoke,
|
|
||||||
}
|
|
||||||
|
|
||||||
impl HostOp {
|
|
||||||
/// Stable operation name used in traces and diagnostics.
|
|
||||||
pub const fn name(self) -> &'static str {
|
|
||||||
match self {
|
|
||||||
HostOp::ForeignRun => "foreign.run",
|
|
||||||
HostOp::ForeignCall => "foreign.call",
|
|
||||||
HostOp::FsRead => "fs.read",
|
|
||||||
HostOp::FsWrite => "fs.write",
|
|
||||||
HostOp::PluginInvoke => "plugin.invoke",
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/// The host boundary used by the interpreter and future View/IDE frontends.
|
|
||||||
pub trait Host {
|
|
||||||
/// Invoke one operation with already-evaluated arguments.
|
|
||||||
fn invoke(
|
|
||||||
&mut self,
|
|
||||||
op: HostOp,
|
|
||||||
args: Vec<Value>,
|
|
||||||
ctx: &ExecutionContext,
|
|
||||||
) -> Result<Value, RuntimeError>;
|
|
||||||
|
|
||||||
/// Open a resource/stream by kind, descriptor and requested rights.
|
|
||||||
///
|
|
||||||
/// Default: unavailable. Only the standard host implements the first
|
|
||||||
/// resource kinds (ADR-0025).
|
|
||||||
fn resource_open(
|
|
||||||
&mut self,
|
|
||||||
_kind: &str,
|
|
||||||
_descriptor: &str,
|
|
||||||
_rights: &[String],
|
|
||||||
ctx: &ExecutionContext,
|
|
||||||
) -> Result<Value, RuntimeError> {
|
|
||||||
Err(RuntimeError::new(
|
|
||||||
ErrorCategory::ResourceUnsupported,
|
|
||||||
ctx.span,
|
|
||||||
"this host does not provide resource streams",
|
|
||||||
))
|
|
||||||
}
|
|
||||||
|
|
||||||
/// Read up to `max_bytes` from a resource into host memory.
|
|
||||||
fn resource_read(
|
|
||||||
&mut self,
|
|
||||||
_handle: ResourceHandle,
|
|
||||||
_max_bytes: usize,
|
|
||||||
ctx: &ExecutionContext,
|
|
||||||
) -> Result<ResourceRead, RuntimeError> {
|
|
||||||
Err(RuntimeError::new(
|
|
||||||
ErrorCategory::ResourceUnsupported,
|
|
||||||
ctx.span,
|
|
||||||
"this host does not provide resource streams",
|
|
||||||
))
|
|
||||||
}
|
|
||||||
|
|
||||||
/// Write bytes to a resource; returns the accepted count.
|
|
||||||
fn resource_write(
|
|
||||||
&mut self,
|
|
||||||
_handle: ResourceHandle,
|
|
||||||
_bytes: &[u8],
|
|
||||||
ctx: &ExecutionContext,
|
|
||||||
) -> Result<usize, RuntimeError> {
|
|
||||||
Err(RuntimeError::new(
|
|
||||||
ErrorCategory::ResourceUnsupported,
|
|
||||||
ctx.span,
|
|
||||||
"this host does not provide resource streams",
|
|
||||||
))
|
|
||||||
}
|
|
||||||
|
|
||||||
/// Close a resource handle.
|
|
||||||
fn resource_close(
|
|
||||||
&mut self,
|
|
||||||
_handle: ResourceHandle,
|
|
||||||
ctx: &ExecutionContext,
|
|
||||||
) -> Result<(), RuntimeError> {
|
|
||||||
Err(RuntimeError::new(
|
|
||||||
ErrorCategory::ResourceUnsupported,
|
|
||||||
ctx.span,
|
|
||||||
"this host does not provide resource streams",
|
|
||||||
))
|
|
||||||
}
|
|
||||||
|
|
||||||
/// Accept one inbound TCP connection from a `tcp-listener` handle.
|
|
||||||
///
|
|
||||||
/// Default: unavailable. The standard host returns a new `Resource` in a
|
|
||||||
/// recoverable `{ok,value}` map or `{ok:false,code:"tcp.timeout"}`.
|
|
||||||
fn resource_accept(
|
|
||||||
&mut self,
|
|
||||||
_handle: ResourceHandle,
|
|
||||||
ctx: &ExecutionContext,
|
|
||||||
) -> Result<Value, RuntimeError> {
|
|
||||||
Err(RuntimeError::new(
|
|
||||||
ErrorCategory::ResourceUnsupported,
|
|
||||||
ctx.span,
|
|
||||||
"this host does not provide tcp listeners",
|
|
||||||
))
|
|
||||||
}
|
|
||||||
|
|
||||||
/// Execute one non-streaming resource operation (ADR-0041).
|
|
||||||
///
|
|
||||||
/// Default: unavailable. The standard host implements the `fs.*` group;
|
|
||||||
/// every call is capability-checked and project-mode only.
|
|
||||||
fn resource_request(
|
|
||||||
&mut self,
|
|
||||||
_operation: &str,
|
|
||||||
_args: Vec<Value>,
|
|
||||||
ctx: &ExecutionContext,
|
|
||||||
) -> Result<Value, RuntimeError> {
|
|
||||||
Err(RuntimeError::new(
|
|
||||||
ErrorCategory::ResourceUnsupported,
|
|
||||||
ctx.span,
|
|
||||||
"this host does not provide resource operations",
|
|
||||||
))
|
|
||||||
}
|
|
||||||
|
|
||||||
/// Consume evaluation fuel.
|
|
||||||
fn consume_fuel(&mut self, amount: u64, span: Option<Span>) -> Result<(), RuntimeError>;
|
|
||||||
|
|
||||||
/// Check call-stack depth.
|
|
||||||
fn check_stack(&self, depth: usize, span: Option<Span>) -> Result<(), RuntimeError>;
|
|
||||||
|
|
||||||
/// Check the wall-clock deadline.
|
|
||||||
fn check_deadline(&self, span: Option<Span>) -> Result<(), RuntimeError>;
|
|
||||||
|
|
||||||
/// Take the buffered program output.
|
|
||||||
fn take_output(&mut self) -> Vec<u8>;
|
|
||||||
|
|
||||||
/// Whether the host has an installed observation sink.
|
|
||||||
///
|
|
||||||
/// The default host is inert; the interpreter uses this to skip building
|
|
||||||
/// any observation event when there is no capture destination.
|
|
||||||
fn observation_enabled(&self) -> bool {
|
|
||||||
false
|
|
||||||
}
|
|
||||||
|
|
||||||
/// Announce a successfully bound call frame.
|
|
||||||
///
|
|
||||||
/// Returns the run-unique frame identity, or `None` when observation is
|
|
||||||
/// disabled. Argument binding must have completed before this is called;
|
|
||||||
/// a binding failure never produces a frame.
|
|
||||||
fn observation_begin_frame(
|
|
||||||
&mut self,
|
|
||||||
_function_id: &str,
|
|
||||||
_module_id: &str,
|
|
||||||
_span: Option<Span>,
|
|
||||||
) -> Result<Option<FrameId>, RuntimeError> {
|
|
||||||
Ok(None)
|
|
||||||
}
|
|
||||||
|
|
||||||
/// Close a previously announced frame, including failure paths.
|
|
||||||
fn observation_end_frame(
|
|
||||||
&mut self,
|
|
||||||
_frame_id: Option<FrameId>,
|
|
||||||
_status: &str,
|
|
||||||
_module_id: &str,
|
|
||||||
_span: Option<Span>,
|
|
||||||
) -> Result<(), RuntimeError> {
|
|
||||||
Ok(())
|
|
||||||
}
|
|
||||||
|
|
||||||
/// Emit one borrowed runtime observation event. Default: ignored.
|
|
||||||
fn observe_runtime(&mut self, _event: RuntimeObservation<'_>) -> Result<(), RuntimeError> {
|
|
||||||
Ok(())
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/// Default capability host implementation.
|
/// Default capability host implementation.
|
||||||
pub struct StdHost {
|
pub struct StdHost {
|
||||||
/// Requested sandbox mode.
|
/// Requested sandbox mode.
|
||||||
@@ -372,7 +194,7 @@ impl StdHost {
|
|||||||
exports.insert(export.name.clone(), export.signature.clone());
|
exports.insert(export.name.clone(), export.signature.clone());
|
||||||
}
|
}
|
||||||
let artifact = manifest
|
let artifact = manifest
|
||||||
.resolve_artifact(&marqdo_plugin_abi::HostTarget::current())
|
.resolve_artifact(&HostTarget::current())
|
||||||
.map_err(map_plugin_error)?;
|
.map_err(map_plugin_error)?;
|
||||||
let manifest_digest = artifact.sha256.clone();
|
let manifest_digest = artifact.sha256.clone();
|
||||||
let transport = match manifest.plugin.kind {
|
let transport = match manifest.plugin.kind {
|
||||||
@@ -398,8 +220,8 @@ impl StdHost {
|
|||||||
broker.allow_vendor(capability.clone());
|
broker.allow_vendor(capability.clone());
|
||||||
}
|
}
|
||||||
let package = manifest.plugin.name.clone();
|
let package = manifest.plugin.name.clone();
|
||||||
let options = marqdo_plugin_abi::LoadOptions {
|
let options = LoadOptions {
|
||||||
host_target: marqdo_plugin_abi::HostTarget::current(),
|
host_target: HostTarget::current(),
|
||||||
capability_handler: Some(Box::new(move |capability, request| {
|
capability_handler: Some(Box::new(move |capability, request| {
|
||||||
broker.execute(&package, capability, request)
|
broker.execute(&package, capability, request)
|
||||||
})),
|
})),
|
||||||
@@ -419,8 +241,7 @@ impl StdHost {
|
|||||||
broker.allow_vendor(capability.clone());
|
broker.allow_vendor(capability.clone());
|
||||||
}
|
}
|
||||||
let package = manifest.plugin.name.clone();
|
let package = manifest.plugin.name.clone();
|
||||||
let handler: marqdo_plugin_abi::CapabilityHandler =
|
let handler: CapabilityHandler = Box::new(move |capability, request| {
|
||||||
Box::new(move |capability, request| {
|
|
||||||
broker.execute(&package, capability, request)
|
broker.execute(&package, capability, request)
|
||||||
});
|
});
|
||||||
PluginTransport::Worker(
|
PluginTransport::Worker(
|
||||||
|
|||||||
@@ -11,8 +11,8 @@ use std::time::Duration;
|
|||||||
|
|
||||||
use marqdo_value::{to_wire, ErrorCategory, RuntimeError, Value};
|
use marqdo_value::{to_wire, ErrorCategory, RuntimeError, Value};
|
||||||
|
|
||||||
use crate::context::ExecutionContext;
|
use crate::host::StdHost;
|
||||||
use crate::host::{HostOp, StdHost};
|
use marqdo_host_contract::{ExecutionContext, HostOp};
|
||||||
|
|
||||||
pub(crate) fn foreign(
|
pub(crate) fn foreign(
|
||||||
host: &mut StdHost,
|
host: &mut StdHost,
|
||||||
|
|||||||
@@ -1,17 +1,28 @@
|
|||||||
//! CapabilityHost: capability checks, resource budgets, observation and the
|
//! Native Host: the one concrete implementation of the neutral
|
||||||
//! only bridge to math, foreign kernels, files and plugins.
|
//! [`marqdo_host_contract::Host`] boundary.
|
||||||
//!
|
//!
|
||||||
//! Blueprint §9 and §7.3: every side effect goes through this boundary, checks
|
//! Every side effect goes through this crate, checks happen at the point of
|
||||||
//! happen at the point of execution, and host failures are structured errors.
|
//! execution, and host failures are structured errors. The crate owns the OS
|
||||||
|
//! adapters, capability grants, resource handles, observation sink and trusted
|
||||||
|
//! extension execution; it never owns language semantics and never depends back
|
||||||
|
//! on the runtime, frontend or IR.
|
||||||
|
//!
|
||||||
|
//! Responsibility map (ADR-0071):
|
||||||
|
//! - [`capability`]/[`budget`]: grants, broker, audit, fuel/stack/deadline/output;
|
||||||
|
//! - [`resource`], [`fs`], `process`: resource kinds, handles and OS effects;
|
||||||
|
//! - [`plugin`], `plugin_worker`, `provider_c`, `provider_worker`, [`kernels`]:
|
||||||
|
//! trusted plugin/provider/foreign execution (no second static binder);
|
||||||
|
//! - [`observe`]: the runtime observation sink, redaction, budget and encoding;
|
||||||
|
//! - [`host`]: `StdHost` assembly and the single dispatch table.
|
||||||
|
|
||||||
pub mod budget;
|
pub mod budget;
|
||||||
pub mod capability;
|
pub mod capability;
|
||||||
pub mod context;
|
|
||||||
pub mod fs;
|
pub mod fs;
|
||||||
pub mod handles;
|
pub mod handles;
|
||||||
pub mod host;
|
pub mod host;
|
||||||
pub mod kernels;
|
pub mod kernels;
|
||||||
pub mod observe;
|
pub mod observe;
|
||||||
|
pub mod plugin;
|
||||||
mod plugin_worker;
|
mod plugin_worker;
|
||||||
mod process;
|
mod process;
|
||||||
mod provider_c;
|
mod provider_c;
|
||||||
@@ -23,18 +34,16 @@ pub use capability::{
|
|||||||
Capabilities, CapabilityAudit, CapabilityBroker, CapabilityHandler, CapabilityRequest,
|
Capabilities, CapabilityAudit, CapabilityBroker, CapabilityHandler, CapabilityRequest,
|
||||||
FsReadHandler, CORE_CAPABILITIES, RESERVED_HANDLER_PREFIXES,
|
FsReadHandler, CORE_CAPABILITIES, RESERVED_HANDLER_PREFIXES,
|
||||||
};
|
};
|
||||||
pub use context::ExecutionContext;
|
|
||||||
pub use fs::ProjectFs;
|
pub use fs::ProjectFs;
|
||||||
pub use handles::{contains_plugin_handle, PluginHandleTable};
|
pub use handles::{contains_plugin_handle, PluginHandleTable};
|
||||||
pub use host::{arity, expect_text, Host, HostOp, StdHost};
|
pub use host::{arity, expect_text, StdHost};
|
||||||
pub use marqdo_sandbox::{PlatformCapabilities, SandboxMode, StrictIsolation};
|
pub use marqdo_sandbox::{PlatformCapabilities, SandboxMode, StrictIsolation};
|
||||||
pub use observe::{
|
pub use observe::{
|
||||||
encode_value, estimate_event_bytes, FrameId, LoopTransfer, ObservationConfig, ObservationError,
|
encode_value, estimate_event_bytes, ObservationConfig, ObservationError, ObservationEvent,
|
||||||
ObservationEvent, ObservationSink, ObservedValue, ParameterSource, RuntimeObservation,
|
ObservationSink, ObservedValue, ValueState, DEFAULT_MAX_OBSERVATION_BYTES,
|
||||||
ValueState, DEFAULT_MAX_OBSERVATION_BYTES, DEFAULT_MAX_OBSERVATION_EVENTS,
|
DEFAULT_MAX_OBSERVATION_EVENTS, DEFAULT_MAX_VALUE_BYTES, MAX_STREAM_CHUNK_BYTES,
|
||||||
DEFAULT_MAX_VALUE_BYTES, MAX_STREAM_CHUNK_BYTES,
|
|
||||||
};
|
};
|
||||||
pub use resource::{
|
pub use resource::{
|
||||||
is_core_resource_kind, ResourceProvider, ResourceRead, ResourceTable, SharedResourceProvider,
|
is_core_resource_kind, ResourceProvider, ResourceTable, SharedResourceProvider,
|
||||||
CORE_RESOURCE_KINDS,
|
CORE_RESOURCE_KINDS,
|
||||||
};
|
};
|
||||||
@@ -12,6 +12,7 @@
|
|||||||
|
|
||||||
use std::collections::BTreeSet;
|
use std::collections::BTreeSet;
|
||||||
|
|
||||||
|
use marqdo_host_contract::{FrameId, LoopTransfer, ParameterSource};
|
||||||
use marqdo_span::Span;
|
use marqdo_span::Span;
|
||||||
use marqdo_value::{ErrorCategory, RuntimeError, Value};
|
use marqdo_value::{ErrorCategory, RuntimeError, Value};
|
||||||
|
|
||||||
@@ -24,38 +25,6 @@ pub const DEFAULT_MAX_VALUE_BYTES: usize = 256;
|
|||||||
/// Maximum committed stdio bytes carried by one chunk event.
|
/// Maximum committed stdio bytes carried by one chunk event.
|
||||||
pub const MAX_STREAM_CHUNK_BYTES: usize = 64 * 1024;
|
pub const MAX_STREAM_CHUNK_BYTES: usize = 64 * 1024;
|
||||||
|
|
||||||
/// Opaque run-scoped call-instance identity.
|
|
||||||
///
|
|
||||||
/// Not a function identity, not a source location and never a memory pointer.
|
|
||||||
#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash, PartialOrd, Ord)]
|
|
||||||
pub struct FrameId(pub u64);
|
|
||||||
|
|
||||||
impl FrameId {
|
|
||||||
/// Stable wire form used by the public protocol (`f1`, `f2`, ...).
|
|
||||||
pub fn as_wire(self) -> String {
|
|
||||||
format!("f{}", self.0)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/// Where a bound parameter's value came from.
|
|
||||||
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
|
|
||||||
pub enum ParameterSource {
|
|
||||||
/// Supplied by the caller (CLI `--arg` or a Marqdo call).
|
|
||||||
Provided,
|
|
||||||
/// Evaluated from the declared default expression.
|
|
||||||
Default,
|
|
||||||
}
|
|
||||||
|
|
||||||
impl ParameterSource {
|
|
||||||
/// Stable wire name.
|
|
||||||
pub const fn as_str(self) -> &'static str {
|
|
||||||
match self {
|
|
||||||
ParameterSource::Provided => "provided",
|
|
||||||
ParameterSource::Default => "default",
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/// Observation policy for one run.
|
/// Observation policy for one run.
|
||||||
///
|
///
|
||||||
/// `structural` always implies frame identity; value events only exist for
|
/// `structural` always implies frame identity; value events only exist for
|
||||||
@@ -238,83 +207,6 @@ pub enum ObservationEvent<'a> {
|
|||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
/// The action carried by a structured loop transfer observation.
|
|
||||||
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
|
|
||||||
pub enum LoopTransfer {
|
|
||||||
/// Exit the enclosing loop.
|
|
||||||
Break,
|
|
||||||
/// Proceed to the enclosing loop's next condition check.
|
|
||||||
Continue,
|
|
||||||
}
|
|
||||||
|
|
||||||
impl LoopTransfer {
|
|
||||||
/// The event kind in Observation.
|
|
||||||
pub fn event_kind(self) -> &'static str {
|
|
||||||
match self {
|
|
||||||
Self::Break => "control.break",
|
|
||||||
Self::Continue => "control.continue",
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/// Borrowed runtime notification accepted by [`crate::Host::observe_runtime`].
|
|
||||||
///
|
|
||||||
/// Value and control observations carry the owning call frame.
|
|
||||||
#[derive(Debug)]
|
|
||||||
pub enum RuntimeObservation<'a> {
|
|
||||||
/// A local memory operation committed.
|
|
||||||
Effect {
|
|
||||||
operation: &'a str,
|
|
||||||
module_id: &'a str,
|
|
||||||
span: Option<Span>,
|
|
||||||
},
|
|
||||||
/// A `return` statement committed (before the call exits).
|
|
||||||
Return {
|
|
||||||
frame_id: Option<FrameId>,
|
|
||||||
value_type: &'a str,
|
|
||||||
module_id: &'a str,
|
|
||||||
span: Option<Span>,
|
|
||||||
},
|
|
||||||
/// A branch condition evaluated.
|
|
||||||
BranchEval {
|
|
||||||
frame_id: Option<FrameId>,
|
|
||||||
result: bool,
|
|
||||||
module_id: &'a str,
|
|
||||||
span: Option<Span>,
|
|
||||||
},
|
|
||||||
/// A loop condition evaluated.
|
|
||||||
LoopIteration {
|
|
||||||
frame_id: Option<FrameId>,
|
|
||||||
decision: &'a str,
|
|
||||||
module_id: &'a str,
|
|
||||||
span: Option<Span>,
|
|
||||||
},
|
|
||||||
/// An explicit loop control statement executed.
|
|
||||||
LoopTransfer {
|
|
||||||
frame_id: Option<FrameId>,
|
|
||||||
transfer: LoopTransfer,
|
|
||||||
module_id: &'a str,
|
|
||||||
span: Span,
|
|
||||||
},
|
|
||||||
/// A local variable assignment committed.
|
|
||||||
VariableAssigned {
|
|
||||||
frame_id: Option<FrameId>,
|
|
||||||
name: &'a str,
|
|
||||||
value: &'a Value,
|
|
||||||
module_id: &'a str,
|
|
||||||
span: Option<Span>,
|
|
||||||
},
|
|
||||||
/// A parameter was bound.
|
|
||||||
ParameterBound {
|
|
||||||
frame_id: Option<FrameId>,
|
|
||||||
name: &'a str,
|
|
||||||
source: ParameterSource,
|
|
||||||
value: &'a Value,
|
|
||||||
module_id: &'a str,
|
|
||||||
span: Option<Span>,
|
|
||||||
},
|
|
||||||
}
|
|
||||||
|
|
||||||
/// Sink installed by the composition root (the CLI JSONL writer in product
|
/// Sink installed by the composition root (the CLI JSONL writer in product
|
||||||
/// builds, an in-memory recorder in tests).
|
/// builds, an in-memory recorder in tests).
|
||||||
pub trait ObservationSink {
|
pub trait ObservationSink {
|
||||||
|
|||||||
+1
-1
@@ -11,7 +11,7 @@ use std::path::Path;
|
|||||||
|
|
||||||
use sha2::{Digest, Sha256};
|
use sha2::{Digest, Sha256};
|
||||||
|
|
||||||
use crate::error::PluginError;
|
use marqdo_plugin_abi::PluginError;
|
||||||
|
|
||||||
/// Length of a lowercase hexadecimal sha256 digest.
|
/// Length of a lowercase hexadecimal sha256 digest.
|
||||||
pub const SHA256_HEX_LEN: usize = 64;
|
pub const SHA256_HEX_LEN: usize = 64;
|
||||||
@@ -16,16 +16,16 @@ use std::ptr;
|
|||||||
use libloading::{Library, Symbol};
|
use libloading::{Library, Symbol};
|
||||||
use serde::Deserialize;
|
use serde::Deserialize;
|
||||||
|
|
||||||
use crate::abi::{
|
use super::artifact::HostTarget;
|
||||||
|
use super::manifest::{PluginKind, PluginManifest};
|
||||||
|
use marqdo_plugin_abi::abi::{
|
||||||
check_host_api, negotiate, result, AbiVersion, MqBytes, MqCallContext, MqHostApi, MqOwnedBytes,
|
check_host_api, negotiate, result, AbiVersion, MqBytes, MqCallContext, MqHostApi, MqOwnedBytes,
|
||||||
MqPluginApi, MqPluginEntryV1, MqPluginInvoke, PluginMetadata, ABI_MAJOR, ABI_MINOR,
|
MqPluginApi, MqPluginEntryV1, MqPluginInvoke, PluginMetadata, ABI_MAJOR, ABI_MINOR,
|
||||||
ENTRY_SYMBOL, MAX_CAPABILITY_REPLY_BYTES, MAX_ERROR_WIRE_BYTES, MAX_EXPORT_NAME_BYTES,
|
ENTRY_SYMBOL, MAX_CAPABILITY_REPLY_BYTES, MAX_ERROR_WIRE_BYTES, MAX_EXPORT_NAME_BYTES,
|
||||||
MAX_RESULT_WIRE_BYTES, MAX_SIGNATURE_WIRE_BYTES,
|
MAX_RESULT_WIRE_BYTES, MAX_SIGNATURE_WIRE_BYTES,
|
||||||
};
|
};
|
||||||
use crate::artifact::HostTarget;
|
use marqdo_plugin_abi::wire::{WireRequest, WireResponse};
|
||||||
use crate::error::PluginError;
|
use marqdo_plugin_abi::PluginError;
|
||||||
use crate::manifest::{PluginKind, PluginManifest};
|
|
||||||
use crate::wire::{WireRequest, WireResponse};
|
|
||||||
|
|
||||||
/// A callback the host installs to answer capability requests from a plugin.
|
/// A callback the host installs to answer capability requests from a plugin.
|
||||||
///
|
///
|
||||||
@@ -304,13 +304,13 @@ impl LoadedPlugin {
|
|||||||
/// This is primarily for ABI conformance tests; prefer
|
/// This is primarily for ABI conformance tests; prefer
|
||||||
/// [`LoadedPlugin::invoke`] for normal use.
|
/// [`LoadedPlugin::invoke`] for normal use.
|
||||||
pub fn invoke_raw(&mut self, function: &str, args_wire: &[u8]) -> Result<Vec<u8>, PluginError> {
|
pub fn invoke_raw(&mut self, function: &str, args_wire: &[u8]) -> Result<Vec<u8>, PluginError> {
|
||||||
if args_wire.len() > crate::abi::MAX_REQUEST_WIRE_BYTES {
|
if args_wire.len() > marqdo_plugin_abi::abi::MAX_REQUEST_WIRE_BYTES {
|
||||||
return Err(PluginError::wire(
|
return Err(PluginError::wire(
|
||||||
"request_too_large",
|
"request_too_large",
|
||||||
format!(
|
format!(
|
||||||
"request wire is {} bytes, limit is {}",
|
"request wire is {} bytes, limit is {}",
|
||||||
args_wire.len(),
|
args_wire.len(),
|
||||||
crate::abi::MAX_REQUEST_WIRE_BYTES
|
marqdo_plugin_abi::abi::MAX_REQUEST_WIRE_BYTES
|
||||||
),
|
),
|
||||||
));
|
));
|
||||||
}
|
}
|
||||||
+6
-6
@@ -10,12 +10,12 @@ use std::path::{Component, Path, PathBuf};
|
|||||||
|
|
||||||
use serde::{Deserialize, Serialize};
|
use serde::{Deserialize, Serialize};
|
||||||
|
|
||||||
use crate::abi::{
|
use super::artifact::{is_valid_sha256_hex, TargetTriple};
|
||||||
|
use super::artifact::{verify_sha256_file, HostTarget};
|
||||||
|
use marqdo_plugin_abi::abi::{
|
||||||
AbiVersion, ABI_MAJOR, ABI_MINOR, MAX_EXPORT_NAME_BYTES, MAX_SIGNATURE_WIRE_BYTES,
|
AbiVersion, ABI_MAJOR, ABI_MINOR, MAX_EXPORT_NAME_BYTES, MAX_SIGNATURE_WIRE_BYTES,
|
||||||
};
|
};
|
||||||
use crate::artifact::{is_valid_sha256_hex, TargetTriple};
|
use marqdo_plugin_abi::PluginError;
|
||||||
use crate::artifact::{verify_sha256_file, HostTarget};
|
|
||||||
use crate::error::PluginError;
|
|
||||||
|
|
||||||
/// Maximum number of exports a single plugin may register.
|
/// Maximum number of exports a single plugin may register.
|
||||||
pub const MAX_EXPORTS: usize = 256;
|
pub const MAX_EXPORTS: usize = 256;
|
||||||
@@ -648,7 +648,7 @@ plugin:
|
|||||||
#[test]
|
#[test]
|
||||||
fn malformed_yaml_is_rejected() {
|
fn malformed_yaml_is_rejected() {
|
||||||
let error = PluginManifest::parse_str("plugin: [unclosed").expect_err("must fail");
|
let error = PluginManifest::parse_str("plugin: [unclosed").expect_err("must fail");
|
||||||
assert_eq!(error.kind, crate::error::ErrorKind::Manifest);
|
assert_eq!(error.kind, marqdo_plugin_abi::ErrorKind::Manifest);
|
||||||
assert_eq!(error.code, "manifest_parse_failed");
|
assert_eq!(error.code, "manifest_parse_failed");
|
||||||
assert!(PluginManifest::parse_str("not_a_plugin: 1").is_err());
|
assert!(PluginManifest::parse_str("not_a_plugin: 1").is_err());
|
||||||
}
|
}
|
||||||
@@ -683,7 +683,7 @@ plugin:
|
|||||||
),
|
),
|
||||||
Err(error) => assert_eq!(
|
Err(error) => assert_eq!(
|
||||||
error.kind,
|
error.kind,
|
||||||
crate::error::ErrorKind::Manifest,
|
marqdo_plugin_abi::ErrorKind::Manifest,
|
||||||
"`{field}` = `{value}` should fail manifest handling"
|
"`{field}` = `{value}` should fail manifest handling"
|
||||||
),
|
),
|
||||||
}
|
}
|
||||||
@@ -0,0 +1,26 @@
|
|||||||
|
//! Execution side of the Callable Plugin ABI: manifest/artifact validation,
|
||||||
|
//! native loading, invocation dispatch and the worker process.
|
||||||
|
//!
|
||||||
|
//! The public contract (C layout, wire envelope and protocol errors) lives in
|
||||||
|
//! `marqdo-plugin-abi`; this module owns `dlopen`, process spawning, artifact
|
||||||
|
//! file selection and trusted invocation. The CLI may consume the static
|
||||||
|
//! descriptor types for `check`/`inspect` preparation, but preparation never
|
||||||
|
//! loads a library or starts a process.
|
||||||
|
//!
|
||||||
|
//! The `include/marqdo_plugin_abi_v1.h` header and the Rust layout assertions
|
||||||
|
//! in `marqdo_plugin_abi::abi` remain the single ABI authority.
|
||||||
|
|
||||||
|
pub mod artifact;
|
||||||
|
pub mod loader;
|
||||||
|
pub mod manifest;
|
||||||
|
pub mod worker;
|
||||||
|
|
||||||
|
pub use artifact::{
|
||||||
|
current_target_triple, is_valid_sha256_hex, sha256_bytes, sha256_file, verify_sha256_file,
|
||||||
|
HostTarget, TargetTriple,
|
||||||
|
};
|
||||||
|
pub use loader::{CapabilityHandler, LoadOptions, LoadedPlugin, RegisteredExport};
|
||||||
|
pub use manifest::{
|
||||||
|
AbiRequirement, Artifact, Export, PackageVersion, PluginInfo, PluginKind, PluginManifest,
|
||||||
|
KNOWN_CAPABILITIES,
|
||||||
|
};
|
||||||
@@ -13,10 +13,10 @@ use std::sync::{Arc, Mutex};
|
|||||||
|
|
||||||
use serde_json::{json, Value};
|
use serde_json::{json, Value};
|
||||||
|
|
||||||
use crate::error::PluginError;
|
use super::loader::{LoadOptions, LoadedPlugin};
|
||||||
use crate::loader::{LoadOptions, LoadedPlugin};
|
use super::manifest::{PluginKind, PluginManifest};
|
||||||
use crate::manifest::{PluginKind, PluginManifest};
|
use marqdo_plugin_abi::wire::{WireRequest, WireResponse};
|
||||||
use crate::wire::{WireRequest, WireResponse};
|
use marqdo_plugin_abi::PluginError;
|
||||||
|
|
||||||
/// Hidden CLI command name used to start a worker.
|
/// Hidden CLI command name used to start a worker.
|
||||||
pub const WORKER_COMMAND: &str = "__plugin-worker";
|
pub const WORKER_COMMAND: &str = "__plugin-worker";
|
||||||
@@ -91,7 +91,7 @@ pub fn serve(manifest_path: &Path, base_dir: &Path) -> i32 {
|
|||||||
let handler_stdout = Arc::clone(&stdout);
|
let handler_stdout = Arc::clone(&stdout);
|
||||||
let handler_ids = Arc::clone(&next_request_id);
|
let handler_ids = Arc::clone(&next_request_id);
|
||||||
let handler_calls = Arc::clone(&capability_calls);
|
let handler_calls = Arc::clone(&capability_calls);
|
||||||
let capability_handler: crate::loader::CapabilityHandler = Box::new(
|
let capability_handler: super::loader::CapabilityHandler = Box::new(
|
||||||
move |capability, request| {
|
move |capability, request| {
|
||||||
if handler_calls.fetch_add(1, Ordering::SeqCst) >= MAX_CAPABILITY_REQUESTS {
|
if handler_calls.fetch_add(1, Ordering::SeqCst) >= MAX_CAPABILITY_REQUESTS {
|
||||||
return Err(PluginError::capability(
|
return Err(PluginError::capability(
|
||||||
@@ -185,7 +185,7 @@ pub fn serve(manifest_path: &Path, base_dir: &Path) -> i32 {
|
|||||||
},
|
},
|
||||||
);
|
);
|
||||||
let options = LoadOptions {
|
let options = LoadOptions {
|
||||||
host_target: crate::artifact::HostTarget::current(),
|
host_target: super::artifact::HostTarget::current(),
|
||||||
capability_handler: Some(capability_handler),
|
capability_handler: Some(capability_handler),
|
||||||
};
|
};
|
||||||
let mut plugin = match LoadedPlugin::open_with(&native_manifest, base_dir, options) {
|
let mut plugin = match LoadedPlugin::open_with(&native_manifest, base_dir, options) {
|
||||||
@@ -15,13 +15,12 @@ use std::path::Path;
|
|||||||
use std::process::{Child, Command, Stdio};
|
use std::process::{Child, Command, Stdio};
|
||||||
use std::time::{Duration, Instant};
|
use std::time::{Duration, Instant};
|
||||||
|
|
||||||
use marqdo_plugin_abi::worker::{
|
use crate::plugin::worker::{
|
||||||
response_from_frame, MAX_CAPABILITY_REQUESTS, MAX_CAPABILITY_REQUEST_BYTES, MAX_FRAME_BYTES,
|
response_from_frame, MAX_CAPABILITY_REQUESTS, MAX_CAPABILITY_REQUEST_BYTES, MAX_FRAME_BYTES,
|
||||||
WORKER_COMMAND,
|
WORKER_COMMAND,
|
||||||
};
|
};
|
||||||
use marqdo_plugin_abi::{
|
use crate::plugin::{CapabilityHandler, PluginManifest};
|
||||||
CapabilityHandler, PluginError, PluginManifest, WireRequest, WireResponse,
|
use marqdo_plugin_abi::{PluginError, WireRequest, WireResponse};
|
||||||
};
|
|
||||||
use marqdo_worker_ipc::{Connection, FrameError, TransportError};
|
use marqdo_worker_ipc::{Connection, FrameError, TransportError};
|
||||||
use serde_json::json;
|
use serde_json::json;
|
||||||
|
|
||||||
|
|||||||
@@ -10,7 +10,7 @@ use std::time::{Duration, Instant};
|
|||||||
|
|
||||||
use marqdo_value::{ErrorCategory, RuntimeError, Value};
|
use marqdo_value::{ErrorCategory, RuntimeError, Value};
|
||||||
|
|
||||||
use crate::context::ExecutionContext;
|
use marqdo_host_contract::ExecutionContext;
|
||||||
|
|
||||||
fn process_error(code: &str, message: &str) -> Value {
|
fn process_error(code: &str, message: &str) -> Value {
|
||||||
let mut map = BTreeMap::new();
|
let mut map = BTreeMap::new();
|
||||||
|
|||||||
@@ -12,7 +12,8 @@ use libloading::Library;
|
|||||||
use marqdo_span::Span;
|
use marqdo_span::Span;
|
||||||
use marqdo_value::{ErrorCategory, RuntimeError};
|
use marqdo_value::{ErrorCategory, RuntimeError};
|
||||||
|
|
||||||
use crate::resource::{ResourceProvider, ResourceRead};
|
use crate::resource::ResourceProvider;
|
||||||
|
use marqdo_host_contract::ResourceRead;
|
||||||
|
|
||||||
const ABI_VERSION: u32 = 1;
|
const ABI_VERSION: u32 = 1;
|
||||||
const ERROR_MAX: usize = 1024;
|
const ERROR_MAX: usize = 1024;
|
||||||
|
|||||||
@@ -18,7 +18,8 @@ use marqdo_span::Span;
|
|||||||
use marqdo_worker_ipc::{Connection, FrameError, TransportError};
|
use marqdo_worker_ipc::{Connection, FrameError, TransportError};
|
||||||
use serde_json::{json, Value as Json};
|
use serde_json::{json, Value as Json};
|
||||||
|
|
||||||
use crate::resource::{ResourceProvider, ResourceRead};
|
use crate::resource::ResourceProvider;
|
||||||
|
use marqdo_host_contract::ResourceRead;
|
||||||
use marqdo_value::{ErrorCategory, RuntimeError};
|
use marqdo_value::{ErrorCategory, RuntimeError};
|
||||||
|
|
||||||
const MAX_FRAME_BYTES: usize = 1024 * 1024;
|
const MAX_FRAME_BYTES: usize = 1024 * 1024;
|
||||||
|
|||||||
@@ -13,6 +13,7 @@ use rustls::{ClientConnection, StreamOwned};
|
|||||||
use std::sync::atomic::{AtomicU64, Ordering};
|
use std::sync::atomic::{AtomicU64, Ordering};
|
||||||
use std::sync::{Arc, Mutex};
|
use std::sync::{Arc, Mutex};
|
||||||
|
|
||||||
|
use marqdo_host_contract::ResourceRead;
|
||||||
use marqdo_span::Span;
|
use marqdo_span::Span;
|
||||||
use marqdo_value::{ErrorCategory, ResourceHandle, RuntimeError};
|
use marqdo_value::{ErrorCategory, ResourceHandle, RuntimeError};
|
||||||
|
|
||||||
@@ -83,15 +84,6 @@ pub trait ResourceProvider: Send {
|
|||||||
/// Shared provider handle registered on the host.
|
/// Shared provider handle registered on the host.
|
||||||
pub type SharedResourceProvider = Arc<Mutex<Box<dyn ResourceProvider>>>;
|
pub type SharedResourceProvider = Arc<Mutex<Box<dyn ResourceProvider>>>;
|
||||||
|
|
||||||
/// Bytes returned by one stream read.
|
|
||||||
#[derive(Debug, Clone, PartialEq, Eq)]
|
|
||||||
pub struct ResourceRead {
|
|
||||||
/// Bytes actually read (may be empty at EOF).
|
|
||||||
pub bytes: Vec<u8>,
|
|
||||||
/// Whether the stream has reached EOF.
|
|
||||||
pub eof: bool,
|
|
||||||
}
|
|
||||||
|
|
||||||
struct StdinCursor {
|
struct StdinCursor {
|
||||||
bytes: Vec<u8>,
|
bytes: Vec<u8>,
|
||||||
position: usize,
|
position: usize,
|
||||||
|
|||||||
@@ -3,12 +3,13 @@
|
|||||||
use std::path::{Path, PathBuf};
|
use std::path::{Path, PathBuf};
|
||||||
use std::process::Command;
|
use std::process::Command;
|
||||||
|
|
||||||
use marqdo_host::{Capabilities, Host, StdHost};
|
use marqdo_host::{Capabilities, StdHost};
|
||||||
|
use marqdo_host_contract::Host;
|
||||||
use marqdo_sandbox::SandboxMode;
|
use marqdo_sandbox::SandboxMode;
|
||||||
use marqdo_value::ErrorCategory;
|
use marqdo_value::ErrorCategory;
|
||||||
|
|
||||||
fn context() -> marqdo_host::ExecutionContext {
|
fn context() -> marqdo_host_contract::ExecutionContext {
|
||||||
marqdo_host::ExecutionContext::new("test".to_string(), None)
|
marqdo_host_contract::ExecutionContext::new("test".to_string(), None)
|
||||||
}
|
}
|
||||||
|
|
||||||
fn handle(value: marqdo_value::Value) -> marqdo_value::ResourceHandle {
|
fn handle(value: marqdo_value::Value) -> marqdo_value::ResourceHandle {
|
||||||
|
|||||||
@@ -5,8 +5,9 @@ use std::path::{Path, PathBuf};
|
|||||||
use std::process::Command;
|
use std::process::Command;
|
||||||
use std::sync::atomic::{AtomicU32, Ordering};
|
use std::sync::atomic::{AtomicU32, Ordering};
|
||||||
|
|
||||||
use marqdo_host::{Capabilities, Host, HostOp, StdHost};
|
use marqdo_host::plugin::{sha256_file, HostTarget, PluginManifest};
|
||||||
use marqdo_plugin_abi::{sha256_file, HostTarget, PluginManifest};
|
use marqdo_host::{Capabilities, StdHost};
|
||||||
|
use marqdo_host_contract::{Host, HostOp};
|
||||||
use marqdo_sandbox::SandboxMode;
|
use marqdo_sandbox::SandboxMode;
|
||||||
use marqdo_value::{ErrorCategory, Value};
|
use marqdo_value::{ErrorCategory, Value};
|
||||||
|
|
||||||
|
|||||||
+3
-3
@@ -11,9 +11,9 @@ use std::path::{Path, PathBuf};
|
|||||||
use std::process::Command;
|
use std::process::Command;
|
||||||
use std::sync::atomic::{AtomicU32, Ordering};
|
use std::sync::atomic::{AtomicU32, Ordering};
|
||||||
|
|
||||||
use marqdo_plugin_abi::{
|
use marqdo_host::plugin::{sha256_file, HostTarget, LoadedPlugin, PluginManifest};
|
||||||
sha256_file, ErrorKind, HostTarget, LoadedPlugin, PluginManifest, Value, WireRequest,
|
use marqdo_plugin_abi::{ErrorKind, WireRequest};
|
||||||
};
|
use marqdo_value::Value;
|
||||||
|
|
||||||
static TEMP_COUNTER: AtomicU32 = AtomicU32::new(0);
|
static TEMP_COUNTER: AtomicU32 = AtomicU32::new(0);
|
||||||
|
|
||||||
@@ -8,10 +8,10 @@ use std::cell::RefCell;
|
|||||||
use std::rc::Rc;
|
use std::rc::Rc;
|
||||||
|
|
||||||
use marqdo_host::{
|
use marqdo_host::{
|
||||||
encode_value, Capabilities, ExecutionContext, FrameId, Host, ObservationConfig,
|
encode_value, Capabilities, ObservationConfig, ObservationError, ObservationEvent,
|
||||||
ObservationError, ObservationEvent, ObservationSink, ParameterSource, RuntimeObservation,
|
ObservationSink, StdHost, ValueState,
|
||||||
StdHost, ValueState,
|
|
||||||
};
|
};
|
||||||
|
use marqdo_host_contract::{ExecutionContext, FrameId, Host, ParameterSource, RuntimeObservation};
|
||||||
use marqdo_sandbox::SandboxMode;
|
use marqdo_sandbox::SandboxMode;
|
||||||
use marqdo_value::{ErrorCategory, Value};
|
use marqdo_value::{ErrorCategory, Value};
|
||||||
|
|
||||||
|
|||||||
@@ -6,8 +6,9 @@ use std::path::{Path, PathBuf};
|
|||||||
use std::process::Command;
|
use std::process::Command;
|
||||||
use std::sync::atomic::{AtomicU32, Ordering};
|
use std::sync::atomic::{AtomicU32, Ordering};
|
||||||
|
|
||||||
use marqdo_host::{Capabilities, Host, HostOp, StdHost};
|
use marqdo_host::plugin::{sha256_file, HostTarget, PluginManifest};
|
||||||
use marqdo_plugin_abi::{sha256_file, HostTarget, PluginManifest};
|
use marqdo_host::{Capabilities, StdHost};
|
||||||
|
use marqdo_host_contract::{Host, HostOp};
|
||||||
use marqdo_sandbox::SandboxMode;
|
use marqdo_sandbox::SandboxMode;
|
||||||
use marqdo_value::Value;
|
use marqdo_value::Value;
|
||||||
|
|
||||||
|
|||||||
@@ -2,7 +2,8 @@
|
|||||||
|
|
||||||
use std::path::Path;
|
use std::path::Path;
|
||||||
|
|
||||||
use marqdo_host::{Capabilities, ExecutionContext, Host, HostOp, StdHost};
|
use marqdo_host::{Capabilities, StdHost};
|
||||||
|
use marqdo_host_contract::{ExecutionContext, Host, HostOp};
|
||||||
use marqdo_sandbox::SandboxMode;
|
use marqdo_sandbox::SandboxMode;
|
||||||
use marqdo_value::{ErrorCategory, Value};
|
use marqdo_value::{ErrorCategory, Value};
|
||||||
|
|
||||||
@@ -325,12 +326,12 @@ impl marqdo_host::ResourceProvider for MockProvider {
|
|||||||
token: u64,
|
token: u64,
|
||||||
max_bytes: usize,
|
max_bytes: usize,
|
||||||
_span: Option<marqdo_span::Span>,
|
_span: Option<marqdo_span::Span>,
|
||||||
) -> Result<marqdo_host::ResourceRead, marqdo_value::RuntimeError> {
|
) -> Result<marqdo_host_contract::ResourceRead, marqdo_value::RuntimeError> {
|
||||||
assert_eq!(token, 7);
|
assert_eq!(token, 7);
|
||||||
let start = self.position;
|
let start = self.position;
|
||||||
let end = start.saturating_add(max_bytes).min(self.data.len());
|
let end = start.saturating_add(max_bytes).min(self.data.len());
|
||||||
self.position = end;
|
self.position = end;
|
||||||
Ok(marqdo_host::ResourceRead {
|
Ok(marqdo_host_contract::ResourceRead {
|
||||||
bytes: self.data[start..end].to_vec(),
|
bytes: self.data[start..end].to_vec(),
|
||||||
eof: end >= self.data.len(),
|
eof: end >= self.data.len(),
|
||||||
})
|
})
|
||||||
|
|||||||
@@ -1,9 +1,10 @@
|
|||||||
use marqdo_host::{Capabilities, Host, StdHost};
|
use marqdo_host::{Capabilities, StdHost};
|
||||||
|
use marqdo_host_contract::Host;
|
||||||
use marqdo_sandbox::SandboxMode;
|
use marqdo_sandbox::SandboxMode;
|
||||||
use marqdo_value::ErrorCategory;
|
use marqdo_value::ErrorCategory;
|
||||||
|
|
||||||
fn context() -> marqdo_host::ExecutionContext {
|
fn context() -> marqdo_host_contract::ExecutionContext {
|
||||||
marqdo_host::ExecutionContext::new("test".to_string(), None)
|
marqdo_host_contract::ExecutionContext::new("test".to_string(), None)
|
||||||
}
|
}
|
||||||
|
|
||||||
fn handle(value: marqdo_value::Value) -> marqdo_value::ResourceHandle {
|
fn handle(value: marqdo_value::Value) -> marqdo_value::ResourceHandle {
|
||||||
|
|||||||
@@ -117,10 +117,19 @@ pub struct FunctionId {
|
|||||||
|
|
||||||
impl fmt::Display for FunctionId {
|
impl fmt::Display for FunctionId {
|
||||||
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
|
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
|
||||||
write!(f, "{}::{}", self.module, self.name)
|
write!(f, "{}::{}", self.module, escape_function_name(&self.name))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// Escape the module/function delimiter inside a function name.
|
||||||
|
///
|
||||||
|
/// The canonical form is `<module>::<name>`; a name that itself contains `::`
|
||||||
|
/// would make the delimiter ambiguous. Normal names are unchanged. `%` is
|
||||||
|
/// escaped first so a literal `%3A%3A` cannot collide with an escaped `::`.
|
||||||
|
pub fn escape_function_name(name: &str) -> String {
|
||||||
|
name.replace('%', "%25").replace("::", "%3A%3A")
|
||||||
|
}
|
||||||
|
|
||||||
/// Identity of an addressable heading range.
|
/// Identity of an addressable heading range.
|
||||||
#[derive(Debug, Clone, PartialEq, Eq, PartialOrd, Ord, Hash, Serialize, Deserialize)]
|
#[derive(Debug, Clone, PartialEq, Eq, PartialOrd, Ord, Hash, Serialize, Deserialize)]
|
||||||
pub struct UnitId {
|
pub struct UnitId {
|
||||||
@@ -137,12 +146,31 @@ impl fmt::Display for UnitId {
|
|||||||
if index > 0 {
|
if index > 0 {
|
||||||
f.write_str("/")?;
|
f.write_str("/")?;
|
||||||
}
|
}
|
||||||
f.write_str(part)?;
|
f.write_str(&escape_identity_segment(part))?;
|
||||||
}
|
}
|
||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// Escape the structural separators of a canonical identity segment.
|
||||||
|
///
|
||||||
|
/// A unit display id is `<module>#<seg>/<seg>`. Escaping `%`, `/` and `#`
|
||||||
|
/// inside each segment keeps the rendering injective: a single heading named
|
||||||
|
/// `a/b` renders `a%2Fb`, never the two-level path `a` -> `b`. Headings that
|
||||||
|
/// do not contain a separator keep their existing rendering.
|
||||||
|
pub fn escape_identity_segment(segment: &str) -> String {
|
||||||
|
let mut out = String::with_capacity(segment.len());
|
||||||
|
for ch in segment.chars() {
|
||||||
|
match ch {
|
||||||
|
'%' => out.push_str("%25"),
|
||||||
|
'/' => out.push_str("%2F"),
|
||||||
|
'#' => out.push_str("%23"),
|
||||||
|
other => out.push(other),
|
||||||
|
}
|
||||||
|
}
|
||||||
|
out
|
||||||
|
}
|
||||||
|
|
||||||
/// Role of a heading range.
|
/// Role of a heading range.
|
||||||
#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)]
|
#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)]
|
||||||
#[serde(rename_all = "snake_case")]
|
#[serde(rename_all = "snake_case")]
|
||||||
@@ -582,6 +610,52 @@ mod tests {
|
|||||||
assert_eq!(module.id.to_string(), "root:default::index.mq.md");
|
assert_eq!(module.id.to_string(), "root:default::index.mq.md");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn function_ids_escape_the_module_delimiter_inside_names() {
|
||||||
|
let module = ModuleId::from("index.mq.md");
|
||||||
|
let plain = FunctionId {
|
||||||
|
module: module.clone(),
|
||||||
|
name: "数学.计算".to_string(),
|
||||||
|
};
|
||||||
|
assert_eq!(plain.to_string(), "root:default::index.mq.md::数学.计算");
|
||||||
|
let dotted = FunctionId {
|
||||||
|
module: module.clone(),
|
||||||
|
name: "a::b".to_string(),
|
||||||
|
};
|
||||||
|
assert_eq!(dotted.to_string(), "root:default::index.mq.md::a%3A%3Ab");
|
||||||
|
let literal = FunctionId {
|
||||||
|
module,
|
||||||
|
name: "a%3A%3Ab".to_string(),
|
||||||
|
};
|
||||||
|
assert_ne!(literal.to_string(), dotted.to_string());
|
||||||
|
}
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn unit_ids_are_injective_across_separator_characters() {
|
||||||
|
let module = ModuleId::from("index.mq.md");
|
||||||
|
let one_segment = UnitId {
|
||||||
|
module: module.clone(),
|
||||||
|
path: vec!["a/b".to_string()],
|
||||||
|
};
|
||||||
|
let two_segments = UnitId {
|
||||||
|
module: module.clone(),
|
||||||
|
path: vec!["a".to_string(), "b".to_string()],
|
||||||
|
};
|
||||||
|
assert_ne!(one_segment.to_string(), two_segments.to_string());
|
||||||
|
assert!(one_segment.to_string().ends_with("#a%2Fb"));
|
||||||
|
assert!(two_segments.to_string().ends_with("#a/b"));
|
||||||
|
let hash = UnitId {
|
||||||
|
module: module.clone(),
|
||||||
|
path: vec!["a#b%c".to_string()],
|
||||||
|
};
|
||||||
|
assert_eq!(hash.to_string(), "root:default::index.mq.md#a%23b%25c");
|
||||||
|
let plain = UnitId {
|
||||||
|
module,
|
||||||
|
path: vec!["数学".to_string(), "计算力".to_string()],
|
||||||
|
};
|
||||||
|
assert_eq!(plain.to_string(), "root:default::index.mq.md#数学/计算力");
|
||||||
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn ir_serializes_for_inspect() {
|
fn ir_serializes_for_inspect() {
|
||||||
let stmt = Stmt::Return {
|
let stmt = Stmt::Return {
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
[package]
|
[package]
|
||||||
name = "marqdo-plugin-abi"
|
name = "marqdo-plugin-abi"
|
||||||
description = "Versioned C ABI v1 bindings, manifest validation and artifact loading"
|
description = "Public plugin ABI v1 contract: C layout, wire envelope and protocol errors"
|
||||||
version.workspace = true
|
version.workspace = true
|
||||||
edition.workspace = true
|
edition.workspace = true
|
||||||
rust-version.workspace = true
|
rust-version.workspace = true
|
||||||
@@ -9,13 +9,7 @@ repository.workspace = true
|
|||||||
authors.workspace = true
|
authors.workspace = true
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
marqdo-span = { workspace = true }
|
|
||||||
marqdo-value = { workspace = true }
|
marqdo-value = { workspace = true }
|
||||||
marqdo-worker-ipc = { workspace = true }
|
|
||||||
serde = { workspace = true }
|
serde = { workspace = true }
|
||||||
serde_json = { workspace = true }
|
serde_json = { workspace = true }
|
||||||
serde_yaml = { workspace = true }
|
|
||||||
thiserror = { workspace = true }
|
thiserror = { workspace = true }
|
||||||
libloading = { workspace = true }
|
|
||||||
sha2 = { workspace = true }
|
|
||||||
hex = { workspace = true }
|
|
||||||
@@ -255,12 +255,17 @@ pub struct MqCallContext {
|
|||||||
|
|
||||||
impl MqCallContext {
|
impl MqCallContext {
|
||||||
/// Mint a context for a host invocation.
|
/// Mint a context for a host invocation.
|
||||||
pub(crate) fn new(host_data: *mut c_void) -> Self {
|
///
|
||||||
|
/// Host-side execution API: the native host owns the invocation lifetime
|
||||||
|
/// and passes an opaque pointer the plugin never dereferences.
|
||||||
|
pub fn new(host_data: *mut c_void) -> Self {
|
||||||
Self { host_data }
|
Self { host_data }
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Opaque host data pointer carried by this context.
|
/// Opaque host data pointer carried by this context.
|
||||||
pub(crate) fn host_data(&self) -> *mut c_void {
|
///
|
||||||
|
/// Host-side execution API; not part of the C layout exposed to plugins.
|
||||||
|
pub fn host_data(&self) -> *mut c_void {
|
||||||
self.host_data
|
self.host_data
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,31 +1,23 @@
|
|||||||
//! Versioned plugin C ABI v1 bindings, manifest validation and artifact
|
//! Public contract for the versioned plugin C ABI v1.
|
||||||
//! loading (host side).
|
|
||||||
//!
|
//!
|
||||||
//! This crate is the host-side counterpart of
|
//! This crate is the single normative Rust side of
|
||||||
//! `include/marqdo_plugin_abi_v1.h` (the frozen C ABI) and of the
|
//! `include/marqdo_plugin_abi_v1.h`: the stable `#[repr(C)]` types with layout
|
||||||
//! `marqdo-plugin-sdk` crate (the plugin-developer side). It implements the
|
//! assertions and major/minor negotiation ([`abi`]), the `wire_version` 1
|
||||||
//! blueprint section 10 contract:
|
//! JSON request/response envelope with typed value tags ([`wire`]), and the
|
||||||
|
//! structured protocol [`PluginError`].
|
||||||
//!
|
//!
|
||||||
//! - stable `#[repr(C)]` Rust mirrors of the C types, with compile-time layout
|
//! It is a contract crate, not a loader. Native loading (`dlopen`), artifact
|
||||||
//! assertions and major/minor negotiation ([`abi`]),
|
//! selection on disk, manifest file validation, worker process management and
|
||||||
//! - `plugin.yaml` parsing and validation ([`manifest`]),
|
//! capability dispatch live in the native host (`marqdo-host::plugin`). The
|
||||||
//! - target-triple artifact selection and sha256 verification ([`artifact`]),
|
//! SDK consumes only this crate. There is no second wire encoding here: the
|
||||||
//! - `wire_version` 1 JSON request/response envelopes with typed value tags
|
//! wire envelope reuses the single [`marqdo_value`] encoding.
|
||||||
//! ([`wire`]),
|
|
||||||
//! - a native loader/invocation bridge built on `libloading` ([`loader`]),
|
|
||||||
//! - structured, serializable [`PluginError`]s ([`error`]).
|
|
||||||
//!
|
//!
|
||||||
//! A C ABI is not a sandbox: native plugins run in-process and require an
|
//! A C ABI is not a sandbox. A host that loads native code must separately make
|
||||||
//! explicit trust decision. This crate only validates and loads what the
|
//! and enforce an explicit trust decision; this crate grants no capability.
|
||||||
//! caller already decided to trust; it never grants capabilities.
|
|
||||||
|
|
||||||
pub mod abi;
|
pub mod abi;
|
||||||
pub mod artifact;
|
|
||||||
pub mod error;
|
pub mod error;
|
||||||
pub mod loader;
|
|
||||||
pub mod manifest;
|
|
||||||
pub mod wire;
|
pub mod wire;
|
||||||
pub mod worker;
|
|
||||||
|
|
||||||
pub use abi::result as result_code;
|
pub use abi::result as result_code;
|
||||||
pub use abi::{
|
pub use abi::{
|
||||||
@@ -33,16 +25,7 @@ pub use abi::{
|
|||||||
MqOwnedBytes, MqPluginApi, MqPluginEntryV1, MqPluginInvoke, MqRegisterFunctionFn,
|
MqOwnedBytes, MqPluginApi, MqPluginEntryV1, MqPluginInvoke, MqRegisterFunctionFn,
|
||||||
MqRequestCapabilityFn, PluginMetadata, ABI_MAJOR, ABI_MINOR, ABI_VERSION_STRING, ENTRY_SYMBOL,
|
MqRequestCapabilityFn, PluginMetadata, ABI_MAJOR, ABI_MINOR, ABI_VERSION_STRING, ENTRY_SYMBOL,
|
||||||
};
|
};
|
||||||
pub use artifact::{
|
|
||||||
current_target_triple, is_valid_sha256_hex, sha256_bytes, sha256_file, verify_sha256_file,
|
|
||||||
HostTarget, TargetTriple,
|
|
||||||
};
|
|
||||||
pub use error::{ErrorKind, PluginError};
|
pub use error::{ErrorKind, PluginError};
|
||||||
pub use loader::{CapabilityHandler, LoadOptions, LoadedPlugin, RegisteredExport};
|
|
||||||
pub use manifest::{
|
|
||||||
AbiRequirement, Artifact, Export, PackageVersion, PluginInfo, PluginKind, PluginManifest,
|
|
||||||
KNOWN_CAPABILITIES,
|
|
||||||
};
|
|
||||||
pub use marqdo_value::Value;
|
pub use marqdo_value::Value;
|
||||||
pub use wire::{
|
pub use wire::{
|
||||||
bool_from_value, int_from_value, text_from_value, to_wire_json, WireContext, WireErrorBody,
|
bool_from_value, int_from_value, text_from_value, to_wire_json, WireContext, WireErrorBody,
|
||||||
|
|||||||
@@ -12,4 +12,3 @@ authors.workspace = true
|
|||||||
marqdo-plugin-abi = { workspace = true }
|
marqdo-plugin-abi = { workspace = true }
|
||||||
serde = { workspace = true }
|
serde = { workspace = true }
|
||||||
serde_json = { workspace = true }
|
serde_json = { workspace = true }
|
||||||
|
|
||||||
@@ -15,6 +15,7 @@ serde_json = { workspace = true }
|
|||||||
marqdo-worker-ipc = { workspace = true }
|
marqdo-worker-ipc = { workspace = true }
|
||||||
|
|
||||||
[dev-dependencies]
|
[dev-dependencies]
|
||||||
|
marqdo-host-contract = { workspace = true }
|
||||||
marqdo-host = { path = "../marqdo-host" }
|
marqdo-host = { path = "../marqdo-host" }
|
||||||
marqdo-sandbox = { path = "../marqdo-sandbox" }
|
marqdo-sandbox = { path = "../marqdo-sandbox" }
|
||||||
marqdo-value = { path = "../marqdo-value" }
|
marqdo-value = { path = "../marqdo-value" }
|
||||||
|
|||||||
@@ -3,12 +3,13 @@
|
|||||||
use std::path::Path;
|
use std::path::Path;
|
||||||
use std::process::Command;
|
use std::process::Command;
|
||||||
|
|
||||||
use marqdo_host::{Capabilities, Host, StdHost};
|
use marqdo_host::{Capabilities, StdHost};
|
||||||
|
use marqdo_host_contract::{ExecutionContext, Host};
|
||||||
use marqdo_sandbox::SandboxMode;
|
use marqdo_sandbox::SandboxMode;
|
||||||
use marqdo_value::{ErrorCategory, Value};
|
use marqdo_value::{ErrorCategory, Value};
|
||||||
|
|
||||||
fn context() -> marqdo_host::ExecutionContext {
|
fn context() -> ExecutionContext {
|
||||||
marqdo_host::ExecutionContext::new("test".to_string(), None)
|
ExecutionContext::new("test".to_string(), None)
|
||||||
}
|
}
|
||||||
|
|
||||||
fn handle(value: Value) -> marqdo_value::ResourceHandle {
|
fn handle(value: Value) -> marqdo_value::ResourceHandle {
|
||||||
|
|||||||
@@ -13,7 +13,7 @@ marqdo-span = { workspace = true }
|
|||||||
marqdo-value = { workspace = true }
|
marqdo-value = { workspace = true }
|
||||||
marqdo-ir = { workspace = true }
|
marqdo-ir = { workspace = true }
|
||||||
marqdo-expression = { workspace = true }
|
marqdo-expression = { workspace = true }
|
||||||
marqdo-host = { workspace = true }
|
marqdo-host-contract = { workspace = true }
|
||||||
num-bigint = { workspace = true }
|
num-bigint = { workspace = true }
|
||||||
num-rational = { workspace = true }
|
num-rational = { workspace = true }
|
||||||
num-traits = { workspace = true }
|
num-traits = { workspace = true }
|
||||||
@@ -21,6 +21,7 @@ thiserror = { workspace = true }
|
|||||||
|
|
||||||
|
|
||||||
[dev-dependencies]
|
[dev-dependencies]
|
||||||
|
marqdo-host = { workspace = true }
|
||||||
marqdo-frontend = { workspace = true }
|
marqdo-frontend = { workspace = true }
|
||||||
marqdo-sandbox = { workspace = true }
|
marqdo-sandbox = { workspace = true }
|
||||||
tempfile = { workspace = true }
|
tempfile = { workspace = true }
|
||||||
|
|||||||
@@ -6,7 +6,7 @@
|
|||||||
|
|
||||||
use std::collections::BTreeMap;
|
use std::collections::BTreeMap;
|
||||||
|
|
||||||
use marqdo_host::{HostOp, ResourceRead};
|
use marqdo_host_contract::{HostOp, ResourceRead};
|
||||||
use marqdo_ir::builtins::Builtin;
|
use marqdo_ir::builtins::Builtin;
|
||||||
use marqdo_ir::Resource;
|
use marqdo_ir::Resource;
|
||||||
use marqdo_span::Span;
|
use marqdo_span::Span;
|
||||||
|
|||||||
@@ -3,7 +3,7 @@
|
|||||||
use std::collections::BTreeMap;
|
use std::collections::BTreeMap;
|
||||||
|
|
||||||
use marqdo_expression::{BinaryOp, Expr, RecordEntry};
|
use marqdo_expression::{BinaryOp, Expr, RecordEntry};
|
||||||
use marqdo_host::{
|
use marqdo_host_contract::{
|
||||||
ExecutionContext, FrameId, Host, HostOp, LoopTransfer, ParameterSource, ResourceRead,
|
ExecutionContext, FrameId, Host, HostOp, LoopTransfer, ParameterSource, ResourceRead,
|
||||||
RuntimeObservation,
|
RuntimeObservation,
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -3,7 +3,7 @@
|
|||||||
//! The interpreter is Marqdo's own execution engine: expressions, scoping,
|
//! The interpreter is Marqdo's own execution engine: expressions, scoping,
|
||||||
//! calls, branches, loops and returns are evaluated here, never by translating
|
//! calls, branches, loops and returns are evaluated here, never by translating
|
||||||
//! to Python or another language. Every side effect goes through
|
//! to Python or another language. Every side effect goes through
|
||||||
//! [`marqdo_host::Host`]; prose never reaches this layer because it is absent
|
//! [`marqdo_host_contract::Host`]; prose never reaches this layer because it is absent
|
||||||
//! from the IR.
|
//! from the IR.
|
||||||
|
|
||||||
mod builtins_impl;
|
mod builtins_impl;
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
//! End-to-end interpreter tests: Markdown source → frontend IR → execution.
|
//! End-to-end interpreter tests: Markdown source → frontend IR → execution.
|
||||||
|
|
||||||
use marqdo_host::{Capabilities, Host, StdHost};
|
use marqdo_host::{Capabilities, StdHost};
|
||||||
|
use marqdo_host_contract::Host;
|
||||||
use marqdo_ir::{ModuleId, Program};
|
use marqdo_ir::{ModuleId, Program};
|
||||||
use marqdo_runtime::{run, run_with_limits, EvaluatedArg, MemoryLimits, RuntimeError, Value};
|
use marqdo_runtime::{run, run_with_limits, EvaluatedArg, MemoryLimits, RuntimeError, Value};
|
||||||
use marqdo_sandbox::SandboxMode;
|
use marqdo_sandbox::SandboxMode;
|
||||||
|
|||||||
Loaded 100 of 231 files, more files were not shown because too many files have changed in this diff.
Show more
Reference in new issue
Block a user