Compare commits

...
Author SHA1 Message Date
cflmy 7a0e8c4e42 docs: pin the evidence baseline commit
ci/woodpecker/push/main Pipeline was successful
ci/woodpecker/pr/main Pipeline was successful
The evidence consistency gate requires a commit/security SHA in every
docs/evidence Markdown file; record the Bundle-0.3.0 baseline commit so the
document-access evidence passes the same gate as the other records.
2026-11-30 15:45:07 +08:00
cflmy d7dbce68b6 feat: expose the loaded document snapshot to runtime programs
ci/woodpecker/push/main Pipeline failed
ci/woodpecker/pr/main Pipeline was canceled
Implement marqdo-cli#24 (AI-U1): ordinary .mq.md programs can read the
document snapshot that `prepare` already loaded, without a parser, host paths
or a second knowledge body.

- marqdo-host-contract gains the neutral read-only DocumentModule/DocumentUnit
  projection (canonical ids, path/parent/level/mode/anchors, exact section and
  heading spans, source digest, exact source) and two default-unavailable Host
  methods.
- The composition root builds the snapshot from the same load as Analysis
  (entry + explicit import closure only; no extra reads) and attaches it to the
  native host. StdHost only slices the immutable source; it never executes
  project code, loads modules, parses Markdown or touches the network.
- New builtins: document.outline(module?, parent?, limit?) and
  document.read(module, unit, expected_digest?, max_bytes?). Expected states
  (not loaded, unknown unit, stale source, over budget, invalid span) are
  structured result maps with stable document.* codes, so ordinary control flow
  can branch instead of crashing.
- Specification: spec/document-access.md, spec/evaluation.md §8, ADR-0074,
  README/developers/STATUS links and a docs-consistency gate for the single
  current contract.
- Tests: document_access.rs checks byte-exact agreement with check --emit
  Analysis (module/unit ids, digests, spans, cross-module anchor read) and all
  failure codes; the ADR-0064 builtin review table records the two additions.

Binary budgets are explicit (snapshot 128 modules/16 MiB; outline 1024/4096;
read 256 KiB/1 MiB) and over-budget requests report document.too_large rather
than truncating.
2026-11-30 15:42:30 +08:00
cflmy 8ad2f2cffa Merge pull request #28 from codex/bundle-0.3.0
ci/woodpecker/push/main Pipeline was successful
feat: pin official Bundle 0.3.0 (paired candidate)
2026-11-30 13:20:09 +08:00
cflmy 8e43a3d82c docs: align current Bundle references with 0.3.0
ci/woodpecker/push/main Pipeline was successful
ci/woodpecker/pr/main Pipeline was successful
The architecture boundary test hardcodes the accepted Bundle version; the
developer limits doc and the environment-report spec example name the current
Bundle identity. Update them together with the pin bump so the candidate
combination has one current Bundle identity. Historical release/evidence
records keep their original versions.
2026-11-30 13:08:03 +08:00
cflmy bc05b0aa6c feat: pin the official Bundle 0.3.0 candidate
Update the CLI's single Bundle pin to version 0.3.0, tree digest
sha256:4e47b0ff... and the paired ecosystem root commit ad88b1e9 which pins
the merged std-data strict JSON entry. This is the CLI-side input for the same
candidate combination (root Bundle bump + CLI pin); it does not add a second
manifest or release path.
2026-11-30 13:05:44 +08:00
cflmy 36666ab52b Merge pull request #27 from codex/issue-25-26-environment-document-contract
ci/woodpecker/push/main Pipeline was successful
feat: offline environment report + document-structure contract (#25/#26/#20)
2026-11-30 12:04:17 +08:00
cflmy 79da4d2ca4 Merge remote-tracking branch 'origin/master' into codex/issue-25-26-environment-document-contract
ci/woodpecker/push/main Pipeline was successful
ci/woodpecker/pr/main Pipeline was successful
2026-11-30 11:53:06 +08:00
cflmy a9ccb3a6da docs: record environment-report and document-contract evidence
ci/woodpecker/push/main Pipeline was successful
ci/woodpecker/pr/main Pipeline was successful
Add the reproducible evidence record for candidate 0f87f856: pinned
ecosystem Bundle identity, the full source gate list (fmt/clippy/638
workspace tests/boundaries/independent-build), the environment-report probes,
the release archive built with the embedded source SHA (package identity check
+ smoke PASS) and the Woodpecker push/PR lanes. Windows/macOS native lanes and
the strict VM lane stay UNVERIFIED.

Links the record from docs/STATUS.md.
2026-11-30 11:41:37 +08:00
cflmy 0f87f856db feat: add offline environment report and document-structure contract
ci/woodpecker/push/main Pipeline was successful
ci/woodpecker/pr/main Pipeline was canceled
Implements the two CLI-owned P0 sub-issues of the ecosystem architecture
tickets without adding document-language syntax.

Environment report (marqdo-cli#26 §9.2, binding for #20):
- `marqdo inspect --environment [--json]` emits `marqdo.environment` v1:
  producer version and build-embedded source commit, platform/arch/glibc and
  real strict probe, adjacent provider-worker version/SHA (offline
  `--build-info`, bounded), verified Bundle identity, current protocol
  revisions and path-free diagnostics. Project-independent, offline, and
  exclusive with document inspection flags.
- Release builds embed `MARQDO_BUILD_SOURCE_SHA`; the CI `build` lane sets it.
  `tools/release/package.py` refuses to stage an archive whose binaries report
  another commit or Bundle digest, and `tools/release/smoke.py` re-verifies the
  extracted archive.
- Spec: `spec/environment.md`. Tests: `environment_report.rs` (5 cases) and
  in-module unit tests; docs/releasing/COMPATIBILITY/STATUS updated.

Document-structure contract (marqdo-cli#25):
- `spec/document-structure.md` states the current author/tool semantics once:
  heading mode inheritance (nearest ancestor, only Exec H2 callable), unit
  identity and duplicate-name rules, anchor collision numbering, byte-exact
  half-open spans, `index.mq.md` entry vs directory-dependency import meaning,
  link != import != call, Proposed annotations marked not implemented, and the
  Analysis fields consumers may rely on. It links the single authoritative
  specs instead of duplicating them.
- Tests: `document_structure.rs` (6 cases) + docs_consistency coverage.

No runtime behavior change, no new language surface, no new cross-repo
dependency. `docs_consistency` and `architecture_boundaries` remain green.
2026-11-30 11:35:24 +08:00
cflmy 123a54cb3e Merge pull request 'docs: align RC.6 release scope and baseline Bundle input' (#23) from codex/issue-10-rc6-readiness into master
ci/woodpecker/push/main Pipeline was successful
Merge PR #23: align RC.6 release scope and baseline Bundle input
2026-11-28 00:48:39 +08:00
cflmy 63776735e9 docs: keep the architecture baseline on the last published SHA
ci/woodpecker/manual/performance Pipeline is pending
ci/woodpecker/push/main Pipeline is pending
ci/woodpecker/pr/main Pipeline was successful
2026-11-28 00:33:29 +08:00
cflmy 73b51ffb69 ci: pin the Node 22 mirror tarball without runtime substitution
ci/woodpecker/pr/main Pipeline is pending
ci/woodpecker/manual/performance Pipeline is pending
ci/woodpecker/push/main Pipeline was canceled
2026-11-28 00:27:59 +08:00
cflmy 8c6e2c6509 ci: install Node 22 from the reachable binary mirror
ci/woodpecker/push/main Pipeline failed
ci/woodpecker/pr/main Pipeline was canceled
2026-11-28 00:26:03 +08:00
cflmy c96589a3c5 docs: align RC.6 release scope and baseline Bundle input
ci/woodpecker/push/main Pipeline was canceled
ci/woodpecker/pr/main Pipeline was canceled
2026-11-28 00:19:19 +08:00
cflmy 0973241a1f Merge pull request 'Prepare RC.6 with a verified strict-unavailable release path' (#22) from codex/issue-10-rc6-gates into master
ci/woodpecker/push/main Pipeline is pending
Merge PR #22: prepare RC.6 with a verified strict-unavailable release path
2026-11-28 00:11:10 +08:00
cflmy 6cfdd811b4 Prepare RC.6 with an approved strict-unavailable gate
ci/woodpecker/pr/main Pipeline was successful
ci/woodpecker/push/main Pipeline was canceled
ci/woodpecker/manual/performance Pipeline failed
2026-11-27 23:22:56 +08:00
cflmy ed86796d6b Bind CLI release index to verified archive and Bundle inputs
ci/woodpecker/pr/main Pipeline was successful
ci/woodpecker/push/main Pipeline was successful
2026-11-27 22:17:56 +08:00
cflmy 13affa76dd docs: adopt the ecosystem repository development conventions
ci/woodpecker/pr/main Pipeline was successful
ci/woodpecker/push/main Pipeline failed
Add the canonical marker/link and a short pointer to the root repository
conventions; the CLI-specific boundaries in this file remain authoritative.
No code or product behavior changes.

Refs cflmy/marqdo docs/REPOSITORY-CONVENTIONS.md
2026-11-27 11:37:17 +08:00
cflmy c44b0f9438 release: finalize 3.0.0-rc.5 release records and honest gate limitations
ci/woodpecker/pr/main Pipeline was successful
ci/woodpecker/push/main Pipeline was successful
- Current release docs (README/COMPATIBILITY/STATUS/developers/spec) move to
  rc.5 with the previous release corrected to rc.4; add the rc.5 release notes.
- Record the actual gate outcome: deterministic archive, smoke, offline
  Ubuntu 24.04 cold install, migrated extensions, external conformance and the
  std: surface PASS; strict L1 UNVERIFIED because the release environment has no
  VM/namespaces (no PASS claimed) and the paired shared-node G4 comparison is
  below thresholds but not an approved-node PASS.
- CHANGELOG carries the rc.5 release record; no tag has been created yet.

Refs cflmy/marqdo#2, cflmy/marqdo-cli#11
2026-11-27 10:32:41 +08:00
cflmy 29fc0108f5 candidate: rc.5 archive evidence, rc.4 paired perf baseline and strict blocker
ci/woodpecker/push/main Pipeline failed
ci/woodpecker/pr/main Pipeline failed
- Record the deterministic rc.5 archive (sha256:446197ad...) built twice from
  the candidate commit, smoke PASS and the offline Ubuntu 24.04/glibc 2.39
  cold install PASS; still no tag/release/asset upload.
- Fix the perf comparison baseline to the previous published rc.4 instead of
  the pre-external-Bundle beta, and measure the same fixture workload in both.
  The shared-node paired run (9/9 COMPARED, max p50 +5.15%, max RSS +4.87%,
  investigate=false) remains a WARN candidate only: status SMOKE and
  environment_approved=false, so it cannot be claimed as G4 PASS.
- Record strict L1 as BLOCKED with the real failures (no namespaces/VM,
  runuser denied); no strict evidence was produced and root-only results are
  never promoted.

Refs cflmy/marqdo-cli#11, cflmy/marqdo#2
2026-11-27 10:21:11 +08:00
cflmy 9b21486c7d candidate: prepare 3.0.0-rc.5 metadata and fix the migrated perf print workload
ci/woodpecker/push/main Pipeline failed
ci/woodpecker/pr/main Pipeline failed
Version/metadata candidate only — this commit does not create a tag or release:
- workspace version 3.0.0-rc.4 -> 3.0.0-rc.5 (Cargo.toml/Cargo.lock) and an
  explicit unreleased-candidate CHANGELOG section; current release docs still
  describe rc.4 until a frozen release SHA and maintainer approval exist.
- The external-Bundle migration removed the in-repo stdlib tree, so the G4
  stdlib-print-demo workload no longer had a source. Move it to a self-contained
  tools/perf/fixtures/print-demo.mq.md, rename to print-demo, record its expected
  digest, and make performance.yml copy the same tools/perf into the baseline
  worktree so a paired run measures identical workloads.
- Evidence records the candidate measurement (MEASURED/correctness VERIFIED on
  the shared node) but explicitly does not claim G4 PASS: the beta baseline
  predates the external-Bundle harness and no approved paired node exists yet.

Refs cflmy/marqdo-cli issues #11, cflmy/marqdo#2
2026-11-27 10:08:22 +08:00
cflmy deadf6edee ci: keep the contract lane short and make Bundle materialization idempotent
ci/woodpecker/pr/main Pipeline was successful
ci/woodpecker/push/main Pipeline was successful
Woodpecker executes the job commands as one shell script; the inline contract
block plus its trailing commands exceeded the runner's command buffer and the
last command was truncated mid-argument (the raw log shows the shell received
'python3 tools/c'). Move the lane into tools/ci/contract_lane.sh and keep the
CI commands short, preserving every check.

CI jobs share one workspace, so a second job saw 'output already exists' from
the first fetch. The helper now reuses an output only after verifying it against
the pin, builds into a temporary sibling and moves it into place atomically.

Refs cflmy/marqdo-cli#11
2026-11-27 01:21:46 +08:00
cflmy 72f57beee0 refactor: accept the ecosystem stdlib Bundle and remove the in-repo sources
ci/woodpecker/push/main Pipeline failed
ci/woodpecker/pr/main Pipeline failed
Phase B of ADR-0070 (issue #11): the CLI no longer owns standard-library
sources. The pin names the accepted ecosystem Bundle (marqdo-stdlib@0.2.0,
root commit + tree/alias digests); tools/ci/fetch_ecosystem_bundle.py
materializes it from the pinned root commit and stdlib gitlinks and verifies
the digests. bundle.py and the test harness require an explicit verified Bundle
for the accepted identity, and runtime discovery has no compile-time source
fallback in any profile.

Delete stdlib/ (modules, self-tests, aliases manifest). Module and domain tests
stay with their component owners; the CLI product lane now verifies the
external Bundle's public surface, std: resolution and official print/打印 alias
routing (tests/product-stdlib). Composition assertions whose owner is the
ecosystem (Table split, print-format equivalence) moved to the root Bundle
acceptance; the generic TCP round-trip stays a CLI test. Spawned-CLI tests name
the verified Bundle explicitly.

CI (Woodpecker + GitHub) materializes the pinned Bundle before product tests,
packaging and performance lanes; packaging and release take --stdlib-dir from
that artifact. Docs, STATUS, ADR-0070 and a Phase B evidence record updated.

Refs cflmy/marqdo#9, cflmy/marqdo-cli#11
2026-11-27 01:04:01 +08:00
154 changed files with 36397 additions and 6168 deletions

No files matched your search

File diff suppressed because it is too large. Load diff
+940
View File
@@ -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": []
}
+66
View File
@@ -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
+1
View File
@@ -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
+316
View File
@@ -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}
+8 -5
View File
@@ -12,6 +12,8 @@ jobs:
test:
name: fmt + clippy + test (Linux x86_64)
runs-on: ubuntu-latest
env:
MARQDO_TEST_STDLIB_BUNDLE: ${{ github.workspace }}/target/ecosystem-stdlib
steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@stable
@@ -19,8 +21,10 @@ jobs:
components: rustfmt, clippy
- name: Rust cache
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
run: python3 tools/stdlib/bundle.py --stdlib-dir target/ecosystem-stdlib
- name: Formatting
run: cargo fmt --all -- --check
- name: Clippy
@@ -50,9 +54,6 @@ jobs:
- name: CI evidence tool tests
run: python3 -m unittest discover -s tools/ci -p "test_*.py"
- name: Whole stdlib product tests (explicit pinned Bundle)
env:
MARQDO_TEST_STDLIB_BUNDLE: ${{ github.workspace }}/stdlib
MARQDO_TEST_BUNDLE_PIN: ${{ github.workspace }}/tools/stdlib/bundle-pin.json
run: cargo test -p marqdo-cli --test stdlib_product
- name: Validate public JSON schemas
run: |
@@ -235,6 +236,8 @@ jobs:
persist-credentials: false
- uses: dtolnay/rust-toolchain@stable
- 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
shell: bash
run: |
@@ -243,7 +246,7 @@ jobs:
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 tools/release/package.py --source-sha "$GITHUB_SHA" --version "$version" \
--stdlib-dir stdlib --bundle-pin tools/stdlib/bundle-pin.json
--stdlib-dir target/ecosystem-stdlib --bundle-pin tools/stdlib/bundle-pin.json
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
- uses: actions/upload-artifact@v4
+31 -27
View File
@@ -13,47 +13,47 @@ steps:
image: rust:1.100-bookworm
commands:
- 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
- python3 tools/ci/check_dependency_boundaries.py
- |
set -eux
./target/debug/marqdo check tests/consumers/fixtures/observation/basic.mq.md --emit /tmp/analysis.json
./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
- python3 tools/ci/assert_stale_analysis.py /tmp/control-analysis.json /tmp/control-events.jsonl
# The contract and test steps share a mutable submodule checkout.
- mkdir -p target
- flock target/ecosystem-bundle.lock python3 tools/ci/fetch_ecosystem_bundle.py --out target/ecosystem-stdlib
- MARQDO_TEST_STDLIB_BUNDLE="$PWD/target/ecosystem-stdlib" bash tools/ci/contract_lane.sh
test:
image: rust:1.100-bookworm
commands:
- rustup component add clippy rustfmt
- apt-get update
- apt-get install -y --no-install-recommends curl ca-certificates python3 python3-jsonschema build-essential gcc-mingw-w64-x86-64
- curl -fsSL https://deb.nodesource.com/setup_22.x | bash -
- apt-get install -y --no-install-recommends nodejs
- python3 tools/stdlib/bundle.py
- apt-get install -y --no-install-recommends curl ca-certificates git python3 python3-jsonschema build-essential gcc-mingw-w64-x86-64 xz-utils
# Node 22 is required by the ES-module foreign-kernel tests. Install the
# official tarball from the reachable npmmirror binary mirror; the
# NodeSource apt repository has repeatedly stalled in this runner.
- |
set -eu
curl -fsSL --retry 5 --retry-delay 5 \
"https://cdn.npmmirror.com/binaries/node/v22.23.5/node-v22.23.5-linux-x64.tar.xz" \
-o /tmp/node.tar.xz
tar -xJf /tmp/node.tar.xz -C /usr/local --strip-components=1
node --version
npm --version
- mkdir -p target
- flock target/ecosystem-bundle.lock 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 clippy --workspace --all-targets -- -D warnings
# 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.
- cargo build --locked -p marqdo-provider-worker
- cargo test --workspace --locked
- 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 --workspace --locked
- MARQDO_TEST_STDLIB_BUNDLE="$PWD/target/ecosystem-stdlib" cargo test -p marqdo-cli --test docs_consistency
- MARQDO_TEST_STDLIB_BUNDLE="$PWD/target/ecosystem-stdlib" cargo test -p marqdo-cli --test architecture_boundaries
- python3 tools/ci/check_dependency_boundaries.py
- python3 tools/ci/check_engine_boundary.py
- python3 tools/ci/check_plugin_sdk.py
- python3 -m unittest discover -s tools/ci -p "test_*.py"
- MARQDO_TEST_STDLIB_BUNDLE="$PWD/stdlib" MARQDO_TEST_BUNDLE_PIN="$PWD/tools/stdlib/bundle-pin.json" cargo test -p marqdo-cli --test stdlib_product
- 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
# cfg/compile regressions on the Linux CI without a Windows runner.
- rustup target add x86_64-pc-windows-gnu
@@ -81,9 +81,13 @@ steps:
- apt-get install -y --no-install-recommends ca-certificates git openssl python3 python3-jsonschema build-essential
# Release archives must ship both binaries: the provider worker is the
# only supported transport and resolution is a sibling-of-CLI lookup.
# The release commit is embedded in both binaries so `inspect
# --environment` and package/smoke evidence bind to the exact source SHA.
- export MARQDO_BUILD_SOURCE_SHA="$CI_COMMIT_SHA"
- cargo build --release --locked -p marqdo-cli -p marqdo-provider-worker
- test -x target/release/marqdo-provider-worker
- python3 tools/stdlib/bundle.py
- 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
# smoke-test it; the package script refuses a dirty tree or wrong SHA.
- |
@@ -91,7 +95,7 @@ steps:
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 tools/release/package.py --source-sha "$CI_COMMIT_SHA" --version "$version" \
--stdlib-dir stdlib --bundle-pin tools/stdlib/bundle-pin.json
--stdlib-dir target/ecosystem-stdlib --bundle-pin tools/stdlib/bundle-pin.json
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
cat dist/frozen-extension-evidence.json
+14 -5
View File
@@ -10,21 +10,29 @@ steps:
commands:
- apt-get update
- apt-get install -y --no-install-recommends python3 util-linux ca-certificates git openssl build-essential
- python3 tools/stdlib/bundle.py
- 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
- |
set -eu
baseline_sha=2c7c4f31e7a388d3fcfa717a77067e696ed13854
git fetch --no-tags origin refs/tags/v3.0.0-beta.1
# Previous published RC for the rc.6 comparison.
baseline_sha=c44b0f943875d563bb7c170f8ccd3fd56a82360f
git fetch --no-tags origin refs/tags/v3.0.0-rc.5
test "$(git rev-parse 'FETCH_HEAD^{commit}')" = "$baseline_sha"
perf_dir="$(mktemp -d)"
git worktree add --detach "$perf_dir/beta" "$baseline_sha"
trap 'git worktree remove --force "$perf_dir/beta"; rm -rf "$perf_dir"' EXIT
(cd "$perf_dir/beta" && cargo build --release --locked -p marqdo-cli)
# The external-Bundle migration moved the print workload fixture out of
# the removed in-repo stdlib tree; both binaries must measure the same
# workload sources/expected digests, so copy the perf definition into
# the baseline worktree.
rm -rf "$perf_dir/beta/tools/perf"
cp -a tools/perf "$perf_dir/beta/tools/perf"
version="$(target/release/marqdo --version | cut -d ' ' -f 2)"
python3 tools/release/package.py --version "$version" --source-sha "$CI_COMMIT_SHA" \
--stdlib-dir stdlib --bundle-pin tools/stdlib/bundle-pin.json --out-dir "$perf_dir"
--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"
(cd "$perf_dir" && sha256sum -c "$(basename "$archive.sha256")")
tar -xzf "$archive" -C "$perf_dir"
@@ -37,7 +45,8 @@ steps:
echo "G4_CPU $(awk -F: '/model name/ {print $2; exit}' /proc/cpuinfo | xargs)"
echo "G4_GOVERNOR $(cat /sys/devices/system/cpu/cpu0/cpufreq/scaling_governor 2>/dev/null || echo unavailable)"
(cd "$perf_dir/beta" && python3 tools/perf/runner.py --no-build \
--warmups 5 --samples 20 --platform-id woodpecker-agent-1 \
--stdlib-dir "$candidate/stdlib" --warmups 5 --samples 20 \
--platform-id woodpecker-agent-1 \
--cpu-list "$cpu_list" --out "$perf_dir/beta.json" > /dev/null)
python3 tools/perf/runner.py --no-build --binary "$candidate/marqdo" \
--stdlib-dir "$candidate/stdlib" --warmups 5 --samples 20 \
+5
View File
@@ -1,5 +1,10 @@
# Marqdo CLI — Agent / Contributor Operating Rules
<!-- marqdo:repo-conventions v1 -->
生态级仓库开发规范:https://git.cflmy.cn/cflmy/marqdo/src/branch/main/docs/REPOSITORY-CONVENTIONS.md
**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
+28 -2
View File
@@ -5,8 +5,9 @@ All notable changes to the Marqdo CLI workspace. Published prereleases:
`2c7c4f31e7a388d3fcfa717a77067e696ed13854`),
`3.0.0-rc.1` (source `f7a5a7b0163bf5229ed09adfffd892f9899e6667`) and
`3.0.0-rc.2` (source `9149ee40a48fcda692c5c112f66c465487d13dfb`) and
`3.0.0-rc.3` (2026-11-24, source `1e2a045cc78bf40972181abb44e7117c56cf4401`); the section below is the current
release record. Current
`3.0.0-rc.3` (2026-11-24, source `1e2a045cc78bf40972181abb44e7117c56cf4401`)
and `3.0.0-rc.4` (2026-11-25, source `452e9a32bd9e40dba427d4180691c58bab74449e`);
the section below is the current release record. Current
protocol contracts are Analysis v3, Observation v1, CLI Tool revision 1,
Plugin ABI v1, Foreign wire v1, Provider manifest v2 and lock v4; independent
package versions (including the bundled stdlib `0.1.0`) are versioned
@@ -14,6 +15,31 @@ 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
available at its tagged commit, not in the current tree.
## 3.0.0-rc.6 (candidate)
- The release index binds the packaged CLI and Worker assets to the tested
source SHA and the actual stdlib Bundle inputs.
- A Linux RC can report strict isolation as unsupported with maintainer
approval and same-archive fail-closed evidence. Stable and LTS require a
passing disposable-VM gate.
## 3.0.0-rc.5 (2026-11-27)
Release record for tag `v3.0.0-rc.5` (Linux x86_64, glibc 2.39 prerelease).
The Gitea release carries the archive; known limitations (strict L1 UNVERIFIED
in the release environment, shared-node G4 WARN only) are recorded in
`docs/releases/3.0.0-rc.5.md`.
- The CLI and provider worker consume one explicit external stdlib Bundle
(`--stdlib-dir`/Bundle pin) and the repository no longer carries a `stdlib/`
source tree (issue #11 Phase B). Contract lanes and product tests materialize
the ecosystem Bundle through `tools/ci/fetch_ecosystem_bundle.py`.
- Tooling, docs and test support reference the external Bundle; the release
archive still ships exactly one verified stdlib Bundle.
- Version metadata is `3.0.0-rc.5` on this candidate branch only. Remaining
release gates: frozen SHA, same-SHA CI, strict VM, G4 performance and
maintainer approval.
## 3.0.0-rc.4 (2026-11-25)
- The Rust workspace, CLI version output and protocol producers report
+24 -21
View File
@@ -1,22 +1,21 @@
# Compatibility and support matrix
Snapshot: product version **`3.0.0-rc.4`** (prerelease, released 2026-11-25).
Tag `v3.0.0-rc.4` at source SHA
`452e9a32bd9e40dba427d4180691c58bab74449e`; release
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
Snapshot: product version **`3.0.0-rc.6`** (prerelease, release candidate,
2026-11-28). Tag `v3.0.0-rc.6` on the tested release commit; release
https://git.cflmy.cn/cflmy/marqdo-cli/releases/tag/v3.0.0-rc.6. The previous
release is `3.0.0-rc.5` at source SHA
`c44b0f943875d563bb7c170f8ccd3fd56a82360f`; its evidence remains under
[`docs/releases/3.0.0-rc.5.md`](docs/releases/3.0.0-rc.5.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
experimental and not claimed for this prerelease. Executed status and SHA-bound
evidence are in [`docs/STATUS.md`](docs/STATUS.md) and
[`docs/evidence/`](docs/evidence/).
The `3.0.0-rc.4` release includes the post-beta protocol convergence and the
closed public Analysis boundary below. See the
The `3.0.0-rc.6` release candidate includes the post-beta protocol convergence
and the closed public Analysis boundary below. See the
[RC acceptance procedure](docs/releasing.md). The platform evidence table
records the beta, rc.1/rc.2/rc.3 and rc.4 candidate verification.
records the beta, rc.1/rc.2/rc.3, rc.4 and rc.5 candidate verification.
## Language source syntax (breaking change)
@@ -56,7 +55,7 @@ Consequences for compatibility:
## 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.4` candidate**; they are
These landed after the beta tag and **are included in the `3.0.0-rc.6` candidate**; they are
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).
@@ -91,7 +90,7 @@ consume this candidate's `check --emit` output.
| 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. |
| 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. |
| Language / CLI | `3.0.0-rc.6` (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). |
| 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). |
@@ -102,6 +101,7 @@ consume this candidate's `check --emit` output.
| Analysis `calls[].state/target` | v3 projection | Projected from the unique binding; official stdlib aliases appear as `function`. The private binding table is not serialized. |
| Extension selection | lock v4 | `marqdo.yaml.extensions` only `./path` or `@alias/path`; declaration is not a grant; declared identity must match the lock (`ext.extension_lock_mismatch`). |
| Foreign wire | v1 | One-shot request envelope; provider descriptors are explicit. |
| Environment report | v1 | `inspect --environment --json` (`marqdo.environment`). Additive fields are compatible; code/semantic changes need a schema revision (spec/environment.md). It never projects paths, credentials or source. |
## Platform / feature evidence
@@ -125,6 +125,7 @@ portable/tested locally but the native platform lane has not run here;
| 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 |
| CLI Tool revision 1 + independent consumers | PASS | UNVERIFIED | UNVERIFIED |
| Environment report (`inspect --environment`, embedded source SHA, Bundle identity) | PASS (workspace tests + CI build identity embedding) | UNVERIFIED | UNVERIFIED |
| Native ABI (`plugin inspect`, trusted call) | PASS (C fixture) | UNVERIFIED (host-native fixture) | **UNSUPPORTED** |
| Worker ABI + `fs.read` bridge | PASS (Unix) | UNVERIFIED | **UNSUPPORTED** (Unix-gated) |
| Foreign Python/Node | PASS (system `python3`/`node`) | UNVERIFIED | UNVERIFIED |
@@ -139,7 +140,7 @@ build of both binaries), the release-archive cold-install smoke, the external
frozen-binary conformance repository, and the disposable-VM strict lane. The
source of truth is the Gitea remote `git.cflmy.cn/cflmy/marqdo-cli` with
Woodpecker at `ci.cflmy.cn`; a GitHub mirror is not the authoritative lane for
this beta. macOS/Windows entries are implementation notes, not support claims;
this prerelease line. macOS/Windows entries are implementation notes, not support claims;
the Windows C ABI/provider paths remain fail-closed.
## Strict L1 scope (ADR-0021)
@@ -199,14 +200,16 @@ the Windows C ABI/provider paths remain fail-closed.
## Release decision
**`3.0.0-rc.4` prerelease — released as a Linux x86_64 RC.** The RC profile in
**`3.0.0-rc.6` prerelease — release candidate for a Linux x86_64 RC.** The RC
profile in
[`docs/MARQDO_3_0_PRERELEASE_PLAN.md`](docs/MARQDO_3_0_PRERELEASE_PLAN.md) §3 was
used: Linux is the only supported platform, macOS/Windows are UNSUPPORTED for
this scope, strict L1 has same-SHA disposable-VM evidence, and G4 performance is
a maintainer-approved shared-node `WARN` for this named RC only. The aggregate
decision and per-gate evidence are in
[`docs/evidence/ci/1e2a045cc78bf40972181abb44e7117c56cf4401/manifest.json`](docs/evidence/ci/1e2a045cc78bf40972181abb44e7117c56cf4401/manifest.json)
(`RC_RELEASE_CANDIDATE`) and the release assets; see
[`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
this scope. This cycle verifies the deterministic archive, the archive-only
Ubuntu 24.04 cold install, the migrated extensions, frozen external conformance
and a shared-host performance `WARN`. The RC records `strict: unsupported` with
same-SHA fail-closed smoke evidence; the disposable-VM strict L1 PASS remains a
stable/LTS gate, so no isolation PASS is claimed here. The RC gate aggregate
(`RC_RELEASE_CANDIDATE`) is generated by `tools/ci/release_evidence.py`; the
per-gate references are recorded in CLI issue #22 and the release assets. A
prerelease does not imply stable `3.0.0` or LTS; the stable gate remains
stricter and separate.
Generated
+18 -17
View File
@@ -412,10 +412,11 @@ checksum = "32a66949e030da00e8c7d4434b251670a91556f4144941d37452769c25d58a53"
[[package]]
name = "marqdo-cli"
version = "3.0.0-rc.4"
version = "3.0.0-rc.6"
dependencies = [
"clap",
"hex",
"libc",
"marqdo-expression",
"marqdo-foreign",
"marqdo-frontend",
@@ -439,7 +440,7 @@ dependencies = [
[[package]]
name = "marqdo-expression"
version = "3.0.0-rc.4"
version = "3.0.0-rc.6"
dependencies = [
"marqdo-span",
"num-bigint",
@@ -450,7 +451,7 @@ dependencies = [
[[package]]
name = "marqdo-foreign"
version = "3.0.0-rc.4"
version = "3.0.0-rc.6"
dependencies = [
"hex",
"libc",
@@ -466,7 +467,7 @@ dependencies = [
[[package]]
name = "marqdo-frontend"
version = "3.0.0-rc.4"
version = "3.0.0-rc.6"
dependencies = [
"marqdo-expression",
"marqdo-ir",
@@ -481,7 +482,7 @@ dependencies = [
[[package]]
name = "marqdo-host"
version = "3.0.0-rc.4"
version = "3.0.0-rc.6"
dependencies = [
"flate2",
"getrandom 0.4.3",
@@ -510,7 +511,7 @@ dependencies = [
[[package]]
name = "marqdo-host-contract"
version = "3.0.0-rc.4"
version = "3.0.0-rc.6"
dependencies = [
"marqdo-span",
"marqdo-value",
@@ -518,7 +519,7 @@ dependencies = [
[[package]]
name = "marqdo-ir"
version = "3.0.0-rc.4"
version = "3.0.0-rc.6"
dependencies = [
"marqdo-expression",
"marqdo-span",
@@ -528,7 +529,7 @@ dependencies = [
[[package]]
name = "marqdo-markdown"
version = "3.0.0-rc.4"
version = "3.0.0-rc.6"
dependencies = [
"comrak",
"marqdo-span",
@@ -539,7 +540,7 @@ dependencies = [
[[package]]
name = "marqdo-package"
version = "3.0.0-rc.4"
version = "3.0.0-rc.6"
dependencies = [
"hex",
"semver",
@@ -553,7 +554,7 @@ dependencies = [
[[package]]
name = "marqdo-plugin-abi"
version = "3.0.0-rc.4"
version = "3.0.0-rc.6"
dependencies = [
"marqdo-value",
"serde",
@@ -563,7 +564,7 @@ dependencies = [
[[package]]
name = "marqdo-plugin-sdk"
version = "3.0.0-rc.4"
version = "3.0.0-rc.6"
dependencies = [
"marqdo-plugin-abi",
"serde",
@@ -572,7 +573,7 @@ dependencies = [
[[package]]
name = "marqdo-provider-worker"
version = "3.0.0-rc.4"
version = "3.0.0-rc.6"
dependencies = [
"libloading",
"marqdo-host",
@@ -586,7 +587,7 @@ dependencies = [
[[package]]
name = "marqdo-runtime"
version = "3.0.0-rc.4"
version = "3.0.0-rc.6"
dependencies = [
"marqdo-expression",
"marqdo-frontend",
@@ -606,7 +607,7 @@ dependencies = [
[[package]]
name = "marqdo-sandbox"
version = "3.0.0-rc.4"
version = "3.0.0-rc.6"
dependencies = [
"libc",
"serde",
@@ -614,14 +615,14 @@ dependencies = [
[[package]]
name = "marqdo-span"
version = "3.0.0-rc.4"
version = "3.0.0-rc.6"
dependencies = [
"serde",
]
[[package]]
name = "marqdo-value"
version = "3.0.0-rc.4"
version = "3.0.0-rc.6"
dependencies = [
"marqdo-span",
"num-bigint",
@@ -632,7 +633,7 @@ dependencies = [
[[package]]
name = "marqdo-worker-ipc"
version = "3.0.0-rc.4"
version = "3.0.0-rc.6"
dependencies = [
"serde_json",
"thiserror",
+1 -1
View File
@@ -21,7 +21,7 @@ members = [
]
[workspace.package]
version = "3.0.0-rc.4"
version = "3.0.0-rc.6"
edition = "2021"
rust-version = "1.89"
license = "Apache-2.0"
+50 -25
View File
@@ -10,7 +10,7 @@ The official implementation is a Rust workspace; Python/Node are optional
foreign kernels, never the compiler target.
This repository is the new, independent Marqdo toolchain, now at product
version **`3.0.0-rc.4`** in this checkout. It is **not** a compatibility rewrite of
version **`3.0.0-rc.6`** in this checkout. It is **not** a compatibility rewrite of
`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
third-party entry point and `docs/MARQDO_3_0_PRERELEASE_PLAN.md` for the beta
@@ -27,19 +27,23 @@ release policy.
> [`docs/STATUS.md`](docs/STATUS.md) and
> [`docs/migration/README.md`](docs/migration/README.md).
> **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),
> 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
> **Current release: `3.0.0-rc.6` prerelease** —
> [release](https://git.cflmy.cn/cflmy/marqdo-cli/releases/tag/v3.0.0-rc.6),
> source: the tagged release commit, Linux x86_64. The previous published
> release was `3.0.0-rc.5` —
> [release](https://git.cflmy.cn/cflmy/marqdo-cli/releases/tag/v3.0.0-rc.5),
> source `c44b0f943875d563bb7c170f8ccd3fd56a82360f`. The supported prerelease
> target is **Linux x86_64 (glibc 2.39)**; macOS and Windows are experimental
> and not claimed, and the C ABI plugin/provider paths are Linux-only in this
> prerelease line. The language
> (RFC-LANG-0002), lock v4, Analysis, Observation, CLI Tool, Plugin ABI v1
> (native + worker), pinned Foreign providers and Resource Provider v2 are
> implemented and covered by tests. **`strict` OS isolation is Linux-only and
> probe-gated**; unsupported hosts must fail closed, and strict L2
> (Worker/Foreign/Provider) is not implemented. The broker and worker
> transports are not sandboxes. The beta release decision, support matrix and
> (Worker/Foreign/Provider) is not implemented. This RC records `strict:
> unsupported` with same-SHA fail-closed evidence; a disposable-VM PASS is
> required for stable/LTS, not for the RC. The broker and worker
> transports are not sandboxes. The RC release decision, support matrix and
> remaining gaps are recorded in [`docs/STATUS.md`](docs/STATUS.md),
> [`COMPATIBILITY.md`](COMPATIBILITY.md),
> [`docs/developers/release-limits.md`](docs/developers/release-limits.md) and
@@ -53,7 +57,7 @@ runs fmt, clippy, workspace tests with `--locked`, the dependency-direction and
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
mirror is not used as the authoritative lane for this beta.
mirror is not used as the authoritative lane for this prerelease line.
## Build
@@ -64,19 +68,28 @@ cargo build -p marqdo-cli
# binary: target/debug/marqdo (or $CARGO_TARGET_DIR/debug/marqdo)
```
The CLI and Provider Worker compile without the stdlib sources. A release is
assembled from one explicit, verified Bundle (ADR-0070); the debug CLI still
discovers the checkout's `stdlib/` for the development loop, and
`MARQDO_STDLIB_DIR` is the explicit runtime override:
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
python3 tools/stdlib/bundle.py --print-path
# 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 stdlib \
--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
@@ -89,6 +102,7 @@ marqdo run index.mq.md # executes ## @exec main
marqdo run index.mq.md --output jsonl # live Observation JSON Lines
marqdo inspect index.mq.md --ast
marqdo inspect index.mq.md --signature
marqdo inspect --environment --json # offline installed-identity report
marqdo call index.mq.md main
```
@@ -171,15 +185,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
free-list allocator demonstrating reuse, splitting and `alloc.no_space`
recovery (ADR-0024). No `Result` type or exception syntax.
* **Bundled stdlib + official print aliases (RFC-CM CM-A07/A10)** — offline
`stdlib/` with explicit `std:io`/`std:format`/`std:text` imports, SHA-256
digest verification, Analysis identity and a frozen-CLI closure test; the
* **Bundled stdlib + official print aliases (RFC-CM CM-A07/A10)** — one
offline, ecosystem-assembled Bundle (component-owned module sources) with
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),
covering all 15 value types; `HostOp::Print` and the legacy formatter are
removed (ADR-0027/0028/0029/0030/0031).
* **HTTP/1.1 framing in `.mq.md`** — `stdlib/net/http.mq.md` status/header/
chunked parsing and request construction; a loopback TCP test runs a real
exchange (ADR-0034; no TLS/host HTTP claim).
* **HTTP/1.1 framing in `.mq.md`** — the `marqdo-ext-http` explicit Package
provides status/header/chunked parsing and request construction; the CLI
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",
"<ip>:<port>", ["read","write"])` with exact IP grants, project mode and
5-second timeouts; DNS/TLS/UDP/server sockets excluded (ADR-0034).
@@ -255,6 +271,12 @@ rules are [`RFC-LANG-0002`](docs/architecture/RFC-LANG-0002-unified-semantics.md
[Observation](spec/observation.md) delivers the same run as live JSONL or
a JSON snapshot. [CLI Tool](spec/cli-tool.md) installs independently built
commands with exact protocol requirements and verifies their entire bundle.
`document.outline`/`document.read` expose the already loaded document
snapshot (exact unit spans/digests) to ordinary programs without a parser
(`spec/document-access.md`). `inspect --environment --json` reports the
offline installed identity
(version, embedded source commit, platform, Bundle, protocol revisions) for
feedback and release evidence.
Run everything:
@@ -384,7 +406,10 @@ tests/ conformance/negative corpus, embedding consumer an
[`plugin-abi.md`](spec/plugin-abi.md), [`math.md`](spec/math.md),
[`foreign.md`](spec/foreign.md), [`cli-tool.md`](spec/cli-tool.md),
[`analysis.md`](spec/analysis.md), [`observation.md`](spec/observation.md),
[`worker-ipc.md`](spec/worker-ipc.md);
[`worker-ipc.md`](spec/worker-ipc.md),
[`environment.md`](spec/environment.md),
[`document-structure.md`](spec/document-structure.md),
[`document-access.md`](spec/document-access.md);
JSON Schemas in [`spec/schemas/`](spec/schemas/).
* [`tests/README.md`](tests/README.md) — conformance corpus and `UPDATE_GOLDENS`
workflow.
@@ -508,7 +533,7 @@ extensions. Lock v3 requires an explicit `marqdo lock` migration. See
#### 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
`Marqdo` calls to `io.mq.md::写值` (ADR-0058). There is no
`Program.print_override`, no AST-wide print scan and no runtime print branch;
+1
View File
@@ -30,6 +30,7 @@ hex = { workspace = true }
sha2 = { workspace = true }
semver = { workspace = true }
tempfile = { workspace = true }
libc = { workspace = true }
[[bin]]
name = "marqdo"
+28
View File
@@ -0,0 +1,28 @@
//! Embed the release source commit when the build supplies it.
//!
//! The release pipeline builds the archive from one commit and records the
//! same commit in `SOURCE_SHA`/`RELEASE_INFO.json`; embedding it here lets
//! `marqdo inspect --environment --json` report the exact product identity
//! without reading files next to the binary (marqdo-cli#26 §9.2). An ordinary
//! development build simply has no embedded commit and reports `null` instead
//! of guessing.
fn main() {
println!("cargo:rerun-if-env-changed=MARQDO_BUILD_SOURCE_SHA");
let Ok(sha) = std::env::var("MARQDO_BUILD_SOURCE_SHA") else {
return;
};
let sha = sha.trim();
let valid = sha.len() == 40
&& sha
.chars()
.all(|ch| ch.is_ascii_hexdigit() && !ch.is_ascii_uppercase());
if valid {
println!("cargo:rustc-env=MARQDO_BUILD_SOURCE_SHA={sha}");
} else {
println!(
"cargo:warning=MARQDO_BUILD_SOURCE_SHA is not a full lowercase 40-hex commit; \
the environment report will not claim a source commit"
);
}
}
+1 -1
View File
@@ -31,7 +31,7 @@ pub const SCHEMA: &str = "marqdo.analysis";
/// Current public revision.
pub const SCHEMA_VERSION: u32 = 3;
/// Markdown profile recorded by the producer.
const MARKDOWN_PROFILE: &str = "marqdo.md.v1";
pub const MARKDOWN_PROFILE: &str = "marqdo.md.v1";
/// Projection shared with `inspect --ast`.
pub fn document_projection(root: &marqdo_markdown::MdNode, source_len: usize) -> Value {
+11
View File
@@ -19,9 +19,20 @@ pub struct InspectFlags {
pub platform: bool,
/// Show declared/loaded extension identities (never grants).
pub extensions: bool,
/// Print the offline installed-environment diagnostic report.
///
/// Exclusive with document inspection: it needs no project and must not be
/// combined with project flags (enforced by the argument parser).
pub environment: bool,
}
pub fn inspect(file: Option<&Path>, flags: &InspectFlags, json: bool, plugins: &[PathBuf]) -> i32 {
// The installed-environment report is project-independent and must not
// prepare, load or execute anything. The argument parser rejects combining
// it with document-inspection flags.
if flags.environment {
return crate::environment::emit(json);
}
let prepared = match prepare_project(file, json, plugins) {
Ok(prepared) => prepared,
Err(code) => return code,
+3 -1
View File
@@ -185,7 +185,9 @@ pub fn execute(
}
};
let stdin = read_stdin();
let mut host = StdHost::new(mode, capabilities, project.root.clone()).with_stdin(stdin);
let mut host = StdHost::new(mode, capabilities, project.root.clone())
.with_stdin(stdin)
.with_documents(crate::document_snapshot::catalog(&project));
if let Some(stream) = stream {
host = host.with_observation(stream.config(), Box::new(stream.host_sink()));
}
+111
View File
@@ -0,0 +1,111 @@
//! Build the immutable read-only document snapshot for the runtime.
//!
//! The snapshot contains exactly the modules that `prepare` already loaded for
//! this run/call (the entry plus its explicit import closure). It reuses the
//! frontend unit index that Analysis revision 3 projects, so `document.outline`
//! and `document.read` return the same identities and byte spans as
//! `check --emit` — without reading files again, parsing Markdown or executing
//! anything.
use std::collections::{BTreeMap, BTreeSet};
use marqdo_host_contract::{DocumentModule, DocumentUnit};
use marqdo_span::Span;
use crate::loader::LoadedProject;
/// Maximum number of modules exposed to the runtime in one run.
const MAX_MODULES: usize = 128;
/// Maximum total source bytes exposed to the runtime in one run.
const MAX_TOTAL_BYTES: usize = 16 * 1024 * 1024;
/// Build the snapshot, or an empty catalog when the loaded project exceeds the
/// documented snapshot budget.
///
/// An over-budget project keeps running normally but the document builtins
/// report `document.too_large` instead of silently serving a truncated view.
pub fn catalog(project: &LoadedProject) -> Vec<DocumentModule> {
if project.files.len() > MAX_MODULES {
return Vec::new();
}
let total: usize = project.files.values().map(|file| file.source.len()).sum();
if total > MAX_TOTAL_BYTES {
return Vec::new();
}
project
.files
.iter()
.map(|(module_id, file)| {
let index = &file.analysis.units;
let mut anchors_by_unit: BTreeMap<String, BTreeSet<String>> = BTreeMap::new();
for (anchor, unit_id) in &index.anchors {
anchors_by_unit
.entry(unit_id.to_string())
.or_default()
.insert(anchor.clone());
}
let units = index
.units
.iter()
.map(|unit| {
let id = unit.id.to_string();
let (span, heading_span, mode, parent_id, anchors) = if unit.level == 0 {
(
Span::new(0, file.source.len()),
None,
"knowledge".to_string(),
None,
Vec::new(),
)
} else {
let heading = index
.headings
.iter()
.find(|heading| heading.path == unit.id.path);
let full_span = heading
.map(|heading| heading.full_span)
.unwrap_or(unit.span);
let mode = match heading.map(|heading| heading.mode) {
Some(marqdo_frontend::units::SemanticMode::Exec) => "exec".to_string(),
_ => "knowledge".to_string(),
};
let parent_id = heading.map(|heading| heading.parent_id.to_string());
(
full_span,
Some(unit.span),
mode,
parent_id,
anchors_by_unit
.get(&id)
.map(|anchors| anchors.iter().cloned().collect())
.unwrap_or_default(),
)
};
DocumentUnit {
id,
path: unit.id.path.clone(),
parent_id,
level: unit.level,
mode,
anchors,
span,
heading_span,
}
})
.collect();
DocumentModule {
id: module_id.canonical(),
source_digest: source_digest(&file.source),
source: file.source.clone(),
units,
}
})
.collect()
}
fn source_digest(source: &str) -> String {
use sha2::{Digest, Sha256};
let mut hasher = Sha256::new();
hasher.update(source.as_bytes());
hex::encode(hasher.finalize())
}
+443
View File
@@ -0,0 +1,443 @@
//! Offline installed-environment report (`marqdo inspect --environment`).
//!
//! This is the stable machine-readable diagnostic export required by
//! marqdo-cli#26 §9.2 / marqdo#56 §9.4. It reads only installed identity and
//! process-platform facts:
//!
//! * it never executes project code, opens a provider session, loads a plugin
//! or accesses the network;
//! * it never prints credentials, Analysis/source content, user data or
//! absolute host paths;
//! * a degraded installation is reported as data (`status` + stable
//! `diagnostics[].code`) instead of being hidden.
//!
//! The report schema is `marqdo.environment` version 1. It is intentionally
//! separate from the Analysis/Observation/CLI-Tool protocols: it describes the
//! installation used for feedback, not a project.
use std::io::Read;
use std::path::{Path, PathBuf};
use std::process::{Command, Stdio};
use std::time::{Duration, Instant};
use serde_json::{json, Value};
use marqdo_value::codes;
use crate::output;
/// Report schema name.
pub const SCHEMA: &str = "marqdo.environment";
/// Current report revision.
pub const SCHEMA_VERSION: u32 = 1;
/// Build-time source commit, when the release build supplied one.
const BUILD_SOURCE_SHA: Option<&str> = option_env!("MARQDO_BUILD_SOURCE_SHA");
/// Upper bound for reading the adjacent worker's offline build identity.
///
/// The command prints one small JSON line; the bound keeps a replaced or
/// broken sibling binary from hanging the diagnostic export.
const WORKER_BUILD_INFO_TIMEOUT: Duration = Duration::from_millis(750);
/// Build the complete environment report.
pub fn report() -> Value {
let mut diagnostics: Vec<Value> = Vec::new();
let producer = producer_json();
let platform = platform_json();
let worker = worker_json(&mut diagnostics);
let bundle = bundle_json(&mut diagnostics);
json!({
"schema": SCHEMA,
"schema_version": SCHEMA_VERSION,
"producer": producer,
"platform": platform,
"worker": worker,
"bundle": bundle,
"protocols": protocols_json(),
"diagnostics": diagnostics,
})
}
/// Print the report and return the process exit code.
///
/// Emitting a report always succeeds: a degraded installation is data, not a
/// command failure. Usage errors (for example combining `--environment` with a
/// project-inspection flag) are rejected by the argument parser before this
/// function runs.
pub fn emit(json_output: bool) -> i32 {
let report = report();
if json_output {
output::print_json(&report);
return 0;
}
let producer = &report["producer"];
let source = producer["source"]["sha"].as_str().unwrap_or("unavailable");
println!(
"marqdo {} (source {source})",
producer["version"].as_str().unwrap_or("unknown")
);
let platform = &report["platform"];
println!(
"platform: {}/{} ({})",
platform["os"].as_str().unwrap_or("unknown"),
platform["arch"].as_str().unwrap_or("unknown"),
platform["family"].as_str().unwrap_or("unknown")
);
if let Some(libc) = platform["libc"].as_object() {
let version = libc.get("version").and_then(Value::as_str).unwrap_or("");
println!(
"libc: {}{}",
libc.get("family")
.and_then(Value::as_str)
.unwrap_or("unknown"),
if version.is_empty() {
String::new()
} else {
format!(" {version}")
}
);
}
println!(
"worker: {}",
report["worker"]["status"].as_str().unwrap_or("unknown")
);
let bundle = &report["bundle"];
match bundle["status"].as_str().unwrap_or("unknown") {
"verified" => println!(
"bundle: {} {} (tree {})",
bundle["name"].as_str().unwrap_or("unknown"),
bundle["version"].as_str().unwrap_or("unknown"),
bundle["tree_digest"].as_str().unwrap_or("unknown")
),
status => println!("bundle: {status}"),
}
let protocols = &report["protocols"];
println!(
"protocols: analysis={} observation={} cli-tool={} plugin-abi={} provider-manifest={} lock={}",
protocols["analysis"],
protocols["observation"],
protocols["cli_tool"]["version"],
protocols["plugin_abi"]["version"].as_str().unwrap_or("unknown"),
protocols["provider_manifest"],
protocols["package_lock"]
);
let diagnostics = report["diagnostics"]
.as_array()
.cloned()
.unwrap_or_default();
if diagnostics.is_empty() {
println!("diagnostics: none");
} else {
for diagnostic in diagnostics {
println!(
"diagnostics: [{}] {}",
diagnostic["code"].as_str().unwrap_or("unknown"),
diagnostic["message"].as_str().unwrap_or("")
);
}
}
0
}
fn producer_json() -> Value {
let source = match BUILD_SOURCE_SHA {
Some(sha) => json!({"sha": sha, "origin": "embedded"}),
None => json!({"sha": null, "origin": "unavailable"}),
};
json!({
"name": "marqdo",
"version": env!("CARGO_PKG_VERSION"),
"source": source,
})
}
fn platform_json() -> Value {
let capabilities = marqdo_sandbox::PlatformCapabilities::detect();
json!({
"os": capabilities.os,
"arch": capabilities.arch,
"family": std::env::consts::FAMILY,
"libc": libc_json(),
"strict": serde_json::to_value(capabilities.strict).unwrap_or(Value::Null),
"worker_processes": capabilities.worker_processes,
})
}
fn libc_json() -> Value {
#[cfg(all(target_os = "linux", target_env = "gnu"))]
{
// SAFETY: `gnu_get_libc_version` returns a pointer to a static
// NUL-terminated string owned by the C library for the process
// lifetime; it is copied immediately and never retained.
let version = unsafe {
let pointer = libc::gnu_get_libc_version();
if pointer.is_null() {
None
} else {
Some(
std::ffi::CStr::from_ptr(pointer)
.to_string_lossy()
.into_owned(),
)
}
};
json!({"family": "glibc", "version": version})
}
#[cfg(target_env = "musl")]
{
json!({"family": "musl", "version": null})
}
#[cfg(not(any(all(target_os = "linux", target_env = "gnu"), target_env = "musl")))]
{
Value::Null
}
}
fn sibling_program(name: &str) -> Option<PathBuf> {
let executable = std::env::current_exe().ok()?;
let directory = executable.parent()?;
let file_name = if cfg!(windows) {
format!("{name}.exe")
} else {
name.to_string()
};
let candidate = directory.join(file_name);
candidate.is_file().then_some(candidate)
}
fn worker_json(diagnostics: &mut Vec<Value>) -> Value {
let Some(worker) = sibling_program("marqdo-provider-worker") else {
return json!({
"name": "marqdo-provider-worker",
"status": "absent",
"version": null,
"source_sha": null,
});
};
match read_worker_build_info(&worker) {
Ok((version, source_sha)) => json!({
"name": "marqdo-provider-worker",
"status": "present",
"version": version,
"source_sha": source_sha,
}),
Err(reason) => {
diagnostics.push(json!({
"code": codes::ENV_WORKER_INFO_UNAVAILABLE,
"message": "the adjacent provider worker did not report its offline build identity",
"detail": reason,
}));
json!({
"name": "marqdo-provider-worker",
"status": "present",
"version": null,
"source_sha": null,
})
}
}
}
/// Read the worker's single-shot `--build-info` document.
///
/// Only the version and a validated source SHA are retained; no path or
/// environment value is projected. The child is bounded and killed if the
/// installed binary does not answer in time.
fn read_worker_build_info(worker: &Path) -> Result<(String, Option<String>), String> {
let mut child = Command::new(worker)
.arg("--build-info")
.stdin(Stdio::null())
.stdout(Stdio::piped())
.stderr(Stdio::null())
.spawn()
.map_err(|error| format!("cannot execute the adjacent provider worker: {error}"))?;
let deadline = Instant::now() + WORKER_BUILD_INFO_TIMEOUT;
loop {
match child.try_wait() {
Ok(Some(status)) => {
if !status.success() {
return Err("the adjacent provider worker rejected `--build-info`".to_string());
}
break;
}
Ok(None) => {
if Instant::now() >= deadline {
let _ = child.kill();
let _ = child.wait();
return Err("the adjacent provider worker did not answer in time".to_string());
}
std::thread::sleep(Duration::from_millis(10));
}
Err(error) => return Err(format!("cannot wait for the provider worker: {error}")),
}
}
let mut output = String::new();
child
.stdout
.take()
.ok_or_else(|| "the provider worker produced no output".to_string())?
.read_to_string(&mut output)
.map_err(|error| format!("cannot read the provider worker output: {error}"))?;
let value: Value = serde_json::from_str(output.trim())
.map_err(|_| "the provider worker output is not one JSON document".to_string())?;
if value.get("schema").and_then(Value::as_str) != Some("marqdo.build-info")
|| value.get("schema_version").and_then(Value::as_u64) != Some(1)
|| value.get("product").and_then(Value::as_str) != Some("marqdo-provider-worker")
{
return Err("the provider worker build identity is not a current document".to_string());
}
let version = value
.get("version")
.and_then(Value::as_str)
.filter(|version| !version.is_empty())
.ok_or_else(|| "the provider worker build identity has no version".to_string())?
.to_string();
let source_sha = match value.get("source_sha") {
Some(Value::Null) | None => None,
Some(Value::String(sha)) if is_source_sha(sha) => Some(sha.clone()),
Some(_) => {
return Err(
"the provider worker build identity has an invalid source commit".to_string(),
)
}
};
Ok((version, source_sha))
}
fn is_source_sha(sha: &str) -> bool {
sha.len() == 40
&& sha
.chars()
.all(|ch| ch.is_ascii_hexdigit() && !ch.is_ascii_uppercase())
}
fn bundle_json(diagnostics: &mut Vec<Value>) -> Value {
let origin = if std::env::var_os(crate::stdlib::STDLIB_DIR_ENV).is_some() {
"explicit-env"
} else {
"sibling"
};
match crate::stdlib::StdlibBundle::discover() {
Ok(Some(bundle)) => json!({
"status": "verified",
"origin": origin,
"name": bundle.name(),
"version": bundle.version(),
"tree_digest": bundle.digest(),
"instance_id": bundle.instance_id(),
}),
Ok(None) => json!({
"status": "absent",
"origin": null,
"name": null,
"version": null,
"tree_digest": null,
"instance_id": null,
}),
Err(error) => {
let (code, message) = categorize_bundle_error(&error);
diagnostics.push(json!({"code": code, "message": message}));
json!({
"status": "invalid",
"origin": origin,
"name": null,
"version": null,
"tree_digest": null,
"instance_id": null,
})
}
}
}
/// Map one bundle load failure to a stable code and a path-free message.
///
/// The raw loader error can contain an absolute host path, so it is never
/// projected: diagnostics carry a stable code and a fixed message.
fn categorize_bundle_error(error: &str) -> (&'static str, &'static str) {
if error.contains("digest mismatch") || error.contains("alias metadata digest") {
(
codes::ENV_STDLIB_DIGEST_MISMATCH,
"the installed stdlib Bundle does not match its declared digest",
)
} else if error.contains("cannot read")
|| error.contains("cannot open")
|| error.contains("cannot open stdlib directory")
{
(
codes::ENV_STDLIB_UNREADABLE,
"the installed stdlib Bundle cannot be read",
)
} else {
(
codes::ENV_STDLIB_INVALID,
"the installed stdlib Bundle is not a current verified Bundle",
)
}
}
fn protocols_json() -> Value {
json!({
"markdown_profile": crate::analysis::MARKDOWN_PROFILE,
"analysis": crate::analysis::SCHEMA_VERSION,
"observation": crate::observation::SCHEMA_VERSION,
"cli_tool": {
"version": crate::tool::PROTOCOL_VERSION,
"api_revision": crate::tool::API_REVISION,
},
"plugin_abi": {
"version": marqdo_plugin_abi::ABI_VERSION_STRING,
"major": marqdo_plugin_abi::ABI_MAJOR,
"minor": marqdo_plugin_abi::ABI_MINOR,
},
"provider_manifest": crate::provider_manifest::PROVIDER_SCHEMA_VERSION,
"package_lock": marqdo_package::LOCK_VERSION,
})
}
#[cfg(test)]
mod tests {
use super::*;
#[test]
fn report_is_one_current_document() {
let report = report();
assert_eq!(report["schema"], SCHEMA);
assert_eq!(report["schema_version"], 1);
assert_eq!(report["producer"]["name"], "marqdo");
assert_eq!(report["producer"]["version"], env!("CARGO_PKG_VERSION"));
assert!(report["platform"]["os"].is_string());
assert!(report["protocols"]["analysis"].is_number());
assert!(report["protocols"]["package_lock"].is_number());
assert!(report["diagnostics"].is_array());
}
#[test]
fn report_never_projects_absolute_host_paths_or_secrets() {
let text = serde_json::to_string(&report()).unwrap();
assert!(!text.contains("/root/"), "{text}");
assert!(!text.contains("\\Users\\"), "{text}");
assert!(!text.contains("token"), "{text}");
assert!(!text.contains("api_key"), "{text}");
assert!(!text.contains("secret"), "{text}");
}
#[test]
fn bundle_failures_map_to_stable_path_free_codes() {
let (code, message) =
categorize_bundle_error("stdlib digest mismatch: declared sha256:aa, actual sha256:bb");
assert_eq!(code, codes::ENV_STDLIB_DIGEST_MISMATCH);
assert!(!message.contains('/'));
let (code, _) = categorize_bundle_error("cannot read `/root/private/stdlib.json`: denied");
assert_eq!(code, codes::ENV_STDLIB_UNREADABLE);
let (code, _) = categorize_bundle_error("`/root/x` has no name");
assert_eq!(code, codes::ENV_STDLIB_INVALID);
}
#[test]
fn source_sha_validation_is_strict() {
assert!(is_source_sha("63776735e924ade279cdf59d5c733dc24bfdabbb"));
assert!(!is_source_sha("6377673"));
assert!(!is_source_sha("63776735E924ADE279CDF59D5C733DC24BFDABBB"));
assert!(!is_source_sha("zzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzz"));
}
}
+14 -1
View File
@@ -8,6 +8,8 @@ mod analysis;
mod args;
mod commands;
mod document_refs;
mod document_snapshot;
mod environment;
mod extension_descriptors;
mod extension_selection;
mod loader;
@@ -97,7 +99,7 @@ enum Command {
Call(CallArgs),
/// Statically check a document without executing it.
Check(CheckArgs),
/// Inspect AST, units, signatures, IR, references or platform support.
/// Inspect AST, units, signatures, IR, references, platform support or the installed environment.
Inspect(InspectArgs),
/// Conservative formatting: normalises line endings and trailing newlines.
Fmt(FmtArgs),
@@ -298,6 +300,16 @@ struct InspectArgs {
/// Print declared/loaded extension identities (never grants).
#[arg(long)]
extensions: bool,
/// Print the offline installed-environment diagnostic report.
///
/// Reads only installed identity and platform facts: no project code is
/// executed, no provider session is started and no absolute path,
/// credential or source content is printed (marqdo-cli#26 §9.2).
#[arg(
long,
conflicts_with_all = ["file", "ast", "units", "signature", "ir", "refs", "platform", "extensions", "plugin"]
)]
environment: bool,
/// Explicitly selected plugin manifest for extension inspection (repeatable).
#[arg(long = "plugin", value_name = "PATH")]
plugin: Vec<PathBuf>,
@@ -462,6 +474,7 @@ fn dispatch() -> i32 {
refs: args.refs,
platform: args.platform,
extensions: args.extensions,
environment: args.environment,
};
commands::inspect(args.file.as_deref(), &flags, args.json, &args.plugin)
}
+10 -16
View File
@@ -45,11 +45,10 @@ pub struct StdlibBundle {
impl StdlibBundle {
/// Discover the bundle.
///
/// Order: `MARQDO_STDLIB_DIR` (explicit, fail if invalid), a `stdlib`
/// directory next to the executable, and finally — **debug builds only** — the
/// compile-time source tree. A release binary never falls back to a build
/// machine path: the release archive must ship a verified `stdlib/` next to
/// the binary (RFC-EXT-0003 H-08, ADR).
/// Order: `MARQDO_STDLIB_DIR` (explicit, fail if invalid) then a `stdlib`
/// directory next to the executable. The official Bundle is an installed
/// artifact next to the binary (RFC-EXT-0003 H-08, ADR-0070); there is no
/// compile-time source-tree fallback in any build profile.
pub fn discover() -> Result<Option<Self>, String> {
let override_dir = std::env::var_os(STDLIB_DIR_ENV).map(PathBuf::from);
let exe_dir = std::env::current_exe()
@@ -72,7 +71,7 @@ impl StdlibBundle {
}
/// 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> {
if let Some(parent) = exe_dir {
let candidate = parent.join("stdlib");
@@ -80,16 +79,6 @@ impl StdlibBundle {
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)
}
@@ -167,6 +156,11 @@ impl StdlibBundle {
}
/// Declared stdlib version.
/// Declared Bundle name.
pub fn name(&self) -> &str {
&self.name
}
pub fn version(&self) -> &str {
&self.version
}
+2 -2
View File
@@ -16,12 +16,12 @@ use serde::{Deserialize, Serialize};
use sha2::{Digest, Sha256};
const SCHEMA: &str = "marqdo.cli-tool";
const PROTOCOL_VERSION: u32 = 1;
pub(crate) const PROTOCOL_VERSION: u32 = 1;
const RECORD_VERSION: u32 = 2;
const MAX_BUNDLE_FILES: usize = 4096;
const MAX_BUNDLE_BYTES: u64 = 256 * 1024 * 1024;
const API_REVISION: u32 = 1;
pub(crate) const API_REVISION: u32 = 1;
const BUILTIN_COMMANDS: &[&str] = &[
"init", "run", "call", "check", "inspect", "fmt", "plugin", "add", "remove", "lock", "sync",
+3 -5
View File
@@ -3,6 +3,8 @@
//! 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};
@@ -50,12 +52,8 @@ impl Drop for TempDir {
}
}
fn binary() -> &'static str {
env!("CARGO_BIN_EXE_marqdo")
}
fn cli(dir: &Path, args: &[&str]) -> Output {
Command::new(binary())
stdlib_support::cli_command()
.args(args)
.current_dir(dir)
.output()
+3 -5
View File
@@ -1,5 +1,7 @@
//! Public Analysis and Observation black-box contracts (spec/analysis.md,
//! spec/observation.md).
#[path = "support/stdlib.rs"]
pub mod stdlib_support;
#[path = "support/observation.rs"]
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 {
Command::new(binary())
stdlib_support::cli_command()
.args(args)
.current_dir(dir)
.output()
+28 -14
View File
@@ -2,12 +2,12 @@
//!
//! These checks pin the documented layering: the engine depends on the neutral
//! Host contract (never the native host), the plugin ABI contract carries no
//! loader/worker execution side, the bundled stdlib stays in this repository,
//! `std:` import targets resolve only inside the bundle, and the host keeps the
//! loader/worker execution side, the stdlib Bundle is an explicit ecosystem
//! input rather than an in-repo source tree, `std:` import targets resolve only
//! 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;
@@ -140,24 +140,36 @@ fn engine_depends_on_the_neutral_host_contract_only() {
}
#[test]
fn bundled_stdlib_stays_in_this_repository_and_matches_its_digest() {
let root = stdlib_support::bundle_dir();
// Phase A (ADR-0070): the pinned Bundle is still the checkout tree. Phase B
// replaces this assertion when the ecosystem Bundle becomes the input.
assert_eq!(
root,
repo_root().join("stdlib").canonicalize().unwrap(),
"the Phase A stdlib pin must resolve to the in-repo stdlib tree"
fn stdlib_sources_live_in_the_ecosystem_not_in_this_repository() {
// 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.3.0");
assert_eq!(pin.source_commit.len(), 40);
let root = stdlib_support::bundle_dir();
let manifest: serde_json::Value =
serde_json::from_slice(&std::fs::read(root.join("stdlib.json")).unwrap()).unwrap();
assert_eq!(manifest["name"], "marqdo-stdlib");
assert_eq!(manifest["version"], "0.1.0");
assert_eq!(manifest["name"], pin.name);
assert_eq!(manifest["version"], pin.version);
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());
assert_eq!(
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"
);
}
@@ -422,6 +434,8 @@ fn builtin_names_and_aliases_are_reviewed() {
assert_eq!(
names,
[
"document.outline",
"document.read",
"float",
"foreign.call",
"foreign.run",
+4 -1
View File
@@ -4,6 +4,9 @@
//! 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.
#![cfg(unix)]
#[path = "support/stdlib.rs"]
pub mod stdlib_support;
#[path = "support/observation.rs"]
pub mod observation;
@@ -49,7 +52,7 @@ fn repo() -> PathBuf {
}
fn cli(args: &[&str], dir: &Path) -> Output {
Command::new(env!("CARGO_BIN_EXE_marqdo"))
stdlib_support::cli_command()
.args(args)
.current_dir(dir)
.output()
+2 -2
View File
@@ -18,11 +18,11 @@
//! Developer note: `UPDATE_SEMANTICS_GOLDENS=1` rewrites `value`/`stdout` from
//! the implementation. Never use it without hand-checking every rewritten
//! expectation; the checked-in goldens were reviewed individually.
use std::fs;
#[path = "support/stdlib.rs"]
pub mod stdlib_support;
use std::fs;
use std::path::{Path, PathBuf};
use marqdo_host::{Capabilities, StdHost};
+127
View File
@@ -300,3 +300,130 @@ fn current_contract_documents_do_not_reference_retired_interfaces() {
}
}
}
#[test]
fn environment_report_contract_is_documented_once() {
let root = repo_root();
let spec = read(&root.join("spec/environment.md"));
for needle in [
"marqdo.environment",
"schema_version: 1",
"inspect --environment",
"MARQDO_BUILD_SOURCE_SHA",
"env.stdlib_digest_mismatch",
"never project",
] {
assert!(
spec.contains(needle),
"spec/environment.md is missing `{needle}`"
);
}
assert!(
!root.join("spec/environment-v1.md").exists(),
"the environment report must have one current specification"
);
let readme = read(&root.join("README.md"));
assert!(
readme.contains("spec/environment.md"),
"README.md does not link the environment report spec"
);
let releasing = read(&root.join("docs/releasing.md"));
assert!(
releasing.contains("inspect --environment")
&& releasing.contains("MARQDO_BUILD_SOURCE_SHA"),
"docs/releasing.md does not document the identity binding"
);
let compatibility = read(&root.join("COMPATIBILITY.md"));
assert!(
compatibility.contains("Environment report"),
"COMPATIBILITY.md does not list the environment report contract"
);
}
#[test]
fn document_structure_contract_has_one_overview_and_author_entry_points() {
let root = repo_root();
let spec = read(&root.join("spec/document-structure.md"));
for needle in [
"## 1. Document root and heading modes",
"index.mq.md",
"link, import, call",
"Proposed",
] {
assert!(
spec.contains(needle),
"spec/document-structure.md is missing `{needle}`"
);
}
for linked in [
"mapping.md",
"analysis.md",
"references.md",
"package-format.md",
"heading-annotations-v1.md",
] {
assert!(
spec.contains(linked),
"spec/document-structure.md must link the single source {linked}"
);
}
assert!(
!root.join("spec/document-structure-v1.md").exists(),
"the document structure must have one current overview"
);
let readme = read(&root.join("README.md"));
assert!(
readme.contains("spec/document-structure.md"),
"README.md does not link the document structure contract"
);
let developers = read(&root.join("docs/developers/README.md"));
assert!(
developers.contains("document-structure.md"),
"docs/developers/README.md does not point authors at the structure contract"
);
}
#[test]
fn runtime_document_access_contract_is_documented_once() {
let root = repo_root();
let spec = read(&root.join("spec/document-access.md"));
for needle in [
"document.outline",
"document.read",
"document.not_loaded",
"document.unknown_unit",
"document.stale_source",
"document.too_large",
"half-open byte offsets",
] {
assert!(
spec.contains(needle),
"spec/document-access.md is missing `{needle}`"
);
}
assert!(
!root.join("spec/document-access-v1.md").exists(),
"the runtime document access contract must have one current specification"
);
let readme = read(&root.join("README.md"));
assert!(
readme.contains("spec/document-access.md"),
"README.md does not link the runtime document access spec"
);
let evaluation = read(&root.join("spec/evaluation.md"));
for builtin in ["document.outline", "document.read"] {
assert!(
evaluation.contains(builtin),
"spec/evaluation.md §8 is missing {builtin}"
);
}
assert!(
root.join("docs/adr/0074-document-runtime-read.md").exists(),
"the runtime document access decision is not recorded as an ADR"
);
let developers = read(&root.join("docs/developers/README.md"));
assert!(
developers.contains("document-access.md"),
"docs/developers/README.md does not point at the runtime document access spec"
);
}
+203
View File
@@ -0,0 +1,203 @@
//! Contract tests for the runtime document snapshot (`document.outline` /
//! `document.read`, marqdo-cli#24).
//!
//! The tests drive the real binary and compare every read with the public
//! Analysis revision 3 projection: same module/unit identity, same source
//! digest, same exact UTF-8 byte span. They also cover the structured failure
//! results (not loaded, unknown unit, stale source, too large).
#[path = "support/stdlib.rs"]
pub mod stdlib_support;
use std::path::{Path, PathBuf};
use std::process::Output;
struct TempDir(PathBuf);
impl TempDir {
fn new(tag: &str) -> Self {
let nanos = std::time::SystemTime::now()
.duration_since(std::time::UNIX_EPOCH)
.map(|duration| duration.as_nanos())
.unwrap_or(0);
let path = std::env::temp_dir().join(format!(
"marqdo-document-access-{tag}-{}-{nanos}",
std::process::id()
));
std::fs::create_dir_all(&path).unwrap();
Self(path)
}
fn path(&self) -> &Path {
&self.0
}
fn write(&self, relative: &str, contents: &str) {
let path = self.path().join(relative);
if let Some(parent) = path.parent() {
std::fs::create_dir_all(parent).unwrap();
}
std::fs::write(path, contents).unwrap();
}
}
impl Drop for TempDir {
fn drop(&mut self) {
let _ = std::fs::remove_dir_all(&self.0);
}
}
fn cli(args: &[&str], dir: &Path) -> Output {
stdlib_support::cli_command()
.args(args)
.current_dir(dir)
.output()
.unwrap()
}
fn run_program(dir: &Path) -> serde_json::Value {
let output = cli(&["run", "index.mq.md", "--output", "json"], dir);
assert!(
output.status.success(),
"run failed: {}",
String::from_utf8_lossy(&output.stderr)
);
let report: serde_json::Value = serde_json::from_slice(&output.stdout).unwrap();
let terminal = report["events"]
.as_array()
.unwrap()
.iter()
.find(|event| event["kind"] == "run.completed")
.expect("run.completed event");
terminal["payload"]["value"].clone()
}
fn fixture() -> TempDir {
let dir = TempDir::new("fixture");
dir.write(
"index.mq.md",
"---\nimport:\n other: ./other.mq.md\n---\n\n# @knowledge 主\n\n## 说明\n\n主正文。\n\n## @exec main\n\n\
**`纲 = document.outline()`**\n\n\
**`别的纲 = document.outline(\"root:default::other.mq.md\")`**\n\n\
**`读 = document.read(纲.module, \"root:default::index.mq.md#主/说明\")`**\n\n\
**`按锚点 = document.read(\"root:default::other.mq.md\", \"远程说明\")`**\n\n\
**`过期 = document.read(纲.module, \"说明\", \"sha256:0000000000000000000000000000000000000000000000000000000000000000\")`**\n\n\
**`缺模块 = document.read(\"root:default::missing.mq.md\", \"x\")`**\n\n\
**`超限 = document.read(纲.module, \"说明\", \"\", 2)`**\n\n\
**`限纲 = document.outline(纲.module, \"\", 1)`**\n\n\
`return [纲.ok, 纲.count, 纲.source_digest, 别的纲.ok, 别的纲.count, 读.ok, 读.text, 按锚点.ok, 按锚点.text, 过期.ok, 过期.code, 缺模块.ok, 缺模块.code, 超限.code, 限纲.code]`\n",
);
dir.write(
"other.mq.md",
"# @knowledge 远程\n\n## 远程说明\n\n远程正文。\n",
);
dir
}
#[test]
fn outline_and_read_match_the_public_analysis_projection() {
let dir = fixture();
let values = run_program(dir.path());
let items = values["items"].as_array().unwrap();
// Analysis is produced by the same candidate and the same load.
let artifact = dir.path().join("analysis.json");
let check = cli(
&["check", "index.mq.md", "--emit", artifact.to_str().unwrap()],
dir.path(),
);
assert!(check.status.success());
let analysis: serde_json::Value =
serde_json::from_slice(&std::fs::read(&artifact).unwrap()).unwrap();
let modules = analysis["modules"].as_array().unwrap();
let entry = modules
.iter()
.find(|module| module["id"] == "root:default::index.mq.md")
.unwrap();
let other = modules
.iter()
.find(|module| module["id"] == "root:default::other.mq.md")
.unwrap();
assert_eq!(items[0]["value"], serde_json::Value::Bool(true));
assert_eq!(
items[1]["decimal"]
.as_str()
.unwrap()
.parse::<usize>()
.unwrap(),
entry["units"].as_array().unwrap().len()
);
let entry_digest = entry["source_digest"].as_str().unwrap();
assert_eq!(items[2]["value"].as_str().unwrap(), entry_digest);
assert_eq!(items[3]["value"], serde_json::Value::Bool(true));
assert_eq!(
items[4]["decimal"]
.as_str()
.unwrap()
.parse::<usize>()
.unwrap(),
other["units"].as_array().unwrap().len()
);
// Exact source slice for the unit, byte-for-byte.
let read = items[6]["value"].as_str().unwrap();
let section = entry["units"]
.as_array()
.unwrap()
.iter()
.find(|unit| unit["id"] == "root:default::index.mq.md#主/说明")
.unwrap();
let start = section["span"]["start"].as_u64().unwrap() as usize;
let end = section["span"]["end"].as_u64().unwrap() as usize;
let source = entry["source"].as_str().unwrap();
assert_eq!(
read,
&source[start..end],
"read must be the exact section slice"
);
assert!(read.contains("主正文。"));
// Anchor read resolves to the same unit and exact text in the imported module.
let remote = items[8]["value"].as_str().unwrap();
let remote_section = other["units"]
.as_array()
.unwrap()
.iter()
.find(|unit| unit["id"] == "root:default::other.mq.md#远程/远程说明")
.unwrap();
let remote_start = remote_section["span"]["start"].as_u64().unwrap() as usize;
let remote_end = remote_section["span"]["end"].as_u64().unwrap() as usize;
assert_eq!(
remote,
&other["source"].as_str().unwrap()[remote_start..remote_end]
);
// Structured failures, not execution crashes.
assert_eq!(items[9]["value"], serde_json::Value::Bool(false));
assert_eq!(items[10]["value"], "document.stale_source");
assert_eq!(items[11]["value"], serde_json::Value::Bool(false));
assert_eq!(items[12]["value"], "document.not_loaded");
assert_eq!(items[13]["value"], "document.too_large");
assert_eq!(items[14]["value"], "document.too_large");
}
#[test]
fn document_read_anchors_use_canonical_unit_paths_and_utf8_bytes() {
let dir = TempDir::new("anchors");
dir.write(
"index.mq.md",
"# @knowledge 甲\n\n## 说明\n\n第一段。\n\n# @knowledge 乙\n\n## 说明\n\n第二段。\n\n## @exec main\n\n\
**`one = document.read(\"root:default::index.mq.md\", \"说明\")`**\n\n\
**`two = document.read(\"root:default::index.mq.md\", \"说明-2\")`**\n\n\
`return [one.ok, two.ok, one.text, two.text]`\n",
);
let values = run_program(dir.path());
let items = values["items"].as_array().unwrap();
assert_eq!(items[0]["value"], serde_json::Value::Bool(true));
assert_eq!(items[1]["value"], serde_json::Value::Bool(true));
assert!(items[2]["value"].as_str().unwrap().contains("第一段。"));
assert!(items[3]["value"].as_str().unwrap().contains("第二段。"));
assert_ne!(items[2]["value"], items[3]["value"]);
}
+376
View File
@@ -0,0 +1,376 @@
//! Contract tests for `spec/document-structure.md` (marqdo-cli#25).
//!
//! These drive the real binary and assert only the current, implemented
//! document-structure semantics: heading modes and inheritance, unit identity
//! and scope rules, anchor collision numbering, byte-exact spans, `index.mq.md`
//! entry/import meaning, and the link ≠ import ≠ call separation.
#[path = "support/stdlib.rs"]
pub mod stdlib_support;
use std::path::{Path, PathBuf};
use std::process::Output;
struct TempDir(PathBuf);
impl TempDir {
fn new(tag: &str) -> Self {
let nanos = std::time::SystemTime::now()
.duration_since(std::time::UNIX_EPOCH)
.map(|duration| duration.as_nanos())
.unwrap_or(0);
let path = std::env::temp_dir().join(format!(
"marqdo-document-structure-{tag}-{}-{nanos}",
std::process::id()
));
std::fs::create_dir_all(&path).unwrap();
Self(path)
}
fn path(&self) -> &Path {
&self.0
}
fn write(&self, relative: &str, contents: &str) {
let path = self.path().join(relative);
if let Some(parent) = path.parent() {
std::fs::create_dir_all(parent).unwrap();
}
std::fs::write(path, contents).unwrap();
}
fn write_bytes(&self, relative: &str, contents: &[u8]) {
let path = self.path().join(relative);
if let Some(parent) = path.parent() {
std::fs::create_dir_all(parent).unwrap();
}
std::fs::write(path, contents).unwrap();
}
}
impl Drop for TempDir {
fn drop(&mut self) {
let _ = std::fs::remove_dir_all(&self.0);
}
}
fn cli(args: &[&str], dir: &Path) -> Output {
stdlib_support::cli_command()
.args(args)
.current_dir(dir)
.output()
.unwrap()
}
fn stderr(output: &Output) -> String {
String::from_utf8_lossy(&output.stderr).to_string()
}
fn check_document(dir: &Path, document: &str, artifact: &Path) -> serde_json::Value {
let output = cli(
&["check", document, "--emit", artifact.to_str().unwrap()],
dir,
);
assert!(
output.status.success(),
"check {document} failed: {}",
stderr(&output)
);
serde_json::from_slice(&std::fs::read(artifact).unwrap()).unwrap()
}
fn units(analysis: &serde_json::Value) -> Vec<&serde_json::Value> {
analysis["modules"][0]["units"]
.as_array()
.unwrap()
.iter()
.collect()
}
fn unit<'a>(analysis: &'a serde_json::Value, path: &[&str]) -> &'a serde_json::Value {
let path: Vec<String> = path.iter().map(|segment| segment.to_string()).collect();
units(analysis)
.into_iter()
.find(|unit| {
unit["path"]
.as_array()
.unwrap()
.iter()
.map(|segment| segment.as_str().unwrap())
.eq(path.iter().map(String::as_str))
})
.unwrap_or_else(|| panic!("missing unit {path:?}"))
}
#[test]
fn heading_modes_inherit_from_the_nearest_ancestor_not_a_sibling() {
let dir = TempDir::new("modes");
dir.write(
"index.mq.md",
"# @knowledge 数学\n\n\
## @exec main\n\n`return 1`\n\n\
## 普通说明\n\n这段是知识叙述。\n\n\
### 子节\n\n更多知识。\n\n\
## @exec 计算力\n\n`return 2`\n\n\
### 细节\n\n`return 3`\n",
);
let artifact = dir.path().join("analysis.json");
let analysis = check_document(dir.path(), "index.mq.md", &artifact);
let root = &units(&analysis)[0];
assert_eq!(root["path"], serde_json::json!([]));
assert_eq!(root["kind"], "root");
assert_eq!(root["mode"], "knowledge");
assert_eq!(root["mode_origin"], "default");
let namespace = unit(&analysis, &["数学"]);
assert_eq!(namespace["kind"], "namespace");
assert_eq!(namespace["parent_id"], root["id"]);
let main = unit(&analysis, &["数学", "main"]);
assert_eq!(main["kind"], "function");
assert_eq!(main["mode"], "exec");
assert_eq!(main["mode_origin"], "explicit");
assert!(main["function"].is_string());
assert_eq!(main["parent_id"], namespace["id"]);
// A sibling heading without a marker inherits the Knowledge H1, never the
// preceding Exec H2.
let knowledge = unit(&analysis, &["数学", "普通说明"]);
assert_eq!(knowledge["kind"], "knowledge");
assert_eq!(knowledge["mode"], "knowledge");
assert_eq!(knowledge["mode_origin"], "inherited");
assert_eq!(knowledge["mode_source_unit_id"], namespace["id"]);
assert!(knowledge["function"].is_null());
// An H3 under an Exec H2 is Exec and belongs to that function.
let section = unit(&analysis, &["数学", "计算力", "细节"]);
assert_eq!(section["kind"], "section");
assert_eq!(section["mode"], "exec");
assert_eq!(section["mode_origin"], "inherited");
assert_eq!(
section["parent_id"],
unit(&analysis, &["数学", "计算力"])["id"]
);
assert_eq!(
section["function"],
unit(&analysis, &["数学", "计算力"])["function"]
);
// A level-3 section under Knowledge never becomes callable.
let knowledge_section = unit(&analysis, &["数学", "普通说明", "子节"]);
assert_eq!(knowledge_section["kind"], "section");
assert!(knowledge_section["function"].is_null());
}
#[test]
fn same_name_is_addressable_in_different_parents_but_rejected_in_one_scope() {
let allowed = TempDir::new("same-name-allowed");
allowed.write(
"index.mq.md",
"# @knowledge 甲\n\n## 说明\n\nA\n\n# @knowledge 乙\n\n## 说明\n\nB\n",
);
let analysis = check_document(
allowed.path(),
"index.mq.md",
&allowed.path().join("analysis.json"),
);
let first = unit(&analysis, &["甲", "说明"]);
let second = unit(&analysis, &["乙", "说明"]);
assert_ne!(first["id"], second["id"]);
let anchors = analysis["modules"][0]["anchors"].as_array().unwrap();
assert_eq!(anchors.len(), 4);
assert_eq!(
anchors
.iter()
.find(|anchor| anchor["anchor"] == "说明")
.unwrap()["unit_id"],
first["id"]
);
assert_eq!(
anchors
.iter()
.find(|anchor| anchor["anchor"] == "说明-2")
.unwrap()["unit_id"],
second["id"]
);
let rejected = TempDir::new("same-name-rejected");
rejected.write(
"index.mq.md",
"# @knowledge 数学\n\n## @exec 计算\n\n`return 1`\n\n## @exec 计算\n\n`return 2`\n",
);
let artifact = rejected.path().join("analysis.json");
let output = cli(
&["check", "index.mq.md", "--emit", artifact.to_str().unwrap()],
rejected.path(),
);
assert_eq!(output.status.code(), Some(1));
assert!(
stderr(&output).contains("sem.duplicate_unit_name"),
"unexpected stderr: {}",
stderr(&output)
);
assert!(
!artifact.exists(),
"a failed check must not leave an Analysis artifact"
);
}
#[test]
fn spans_are_half_open_utf8_bytes_even_with_bom_crlf_and_no_final_newline() {
let dir = TempDir::new("spans");
let mut bytes = Vec::new();
bytes.extend_from_slice(b"\xef\xbb\xbf"); // UTF-8 BOM
bytes.extend_from_slice("# @knowledge 数学\r\n\r\n## @exec 计算\r\n\r\n`return 1`".as_bytes()); // CRLF line endings, no trailing newline
dir.write_bytes("index.mq.md", &bytes);
let analysis = check_document(dir.path(), "index.mq.md", &dir.path().join("analysis.json"));
let module = &analysis["modules"][0];
let source = module["source"].as_str().unwrap();
assert_eq!(source.as_bytes(), bytes.as_slice());
assert_eq!(module["document"]["span"]["start"], 0);
assert_eq!(module["document"]["span"]["end"], bytes.len());
for unit in units(&analysis) {
let start = unit["span"]["start"].as_u64().unwrap() as usize;
let end = unit["span"]["end"].as_u64().unwrap() as usize;
assert!(start <= end && end <= bytes.len(), "span out of range");
assert!(
std::str::from_utf8(&bytes[start..end]).is_ok(),
"span is not on UTF-8 boundaries"
);
if let Some(heading) = unit["heading_span"].as_object() {
let hs = heading["start"].as_u64().unwrap() as usize;
let he = heading["end"].as_u64().unwrap() as usize;
assert_eq!(bytes[hs], b'#', "heading_span must start at the heading");
assert!(std::str::from_utf8(&bytes[hs..he]).is_ok());
}
}
// The function section runs to EOF because it is the last heading.
let function = unit(&analysis, &["数学", "计算"]);
assert_eq!(
function["span"]["end"].as_u64().unwrap() as usize,
bytes.len()
);
let heading_start = function["heading_span"]["start"].as_u64().unwrap() as usize;
assert_eq!(&bytes[heading_start..heading_start + 2], b"##");
}
#[test]
fn index_md_is_the_entry_and_a_directory_dependency_resolves_to_its_index() {
let dir = TempDir::new("index-entry");
dir.write(
"marqdo.yaml",
"project:\n name: demo\n version: 0.1.0\ndependencies:\n geo:\n path: ./geometry\n",
);
dir.write(
"geometry/index.mq.md",
"# @knowledge 几何\n\n## @exec 面积\n\n`return 6`\n",
);
dir.write(
"index.mq.md",
"---\nimport:\n geo: '@geo'\n---\n\n# @knowledge 主\n\n## @exec main\n\n`return 1`\n",
);
let lock = cli(&["lock"], dir.path());
assert!(lock.status.success(), "lock failed: {}", stderr(&lock));
let analysis = check_document(dir.path(), "index.mq.md", &dir.path().join("analysis.json"));
assert_eq!(
analysis["project"]["entry_module_id"],
"root:demo@0.1.0::index.mq.md"
);
let modules = analysis["modules"].as_array().unwrap();
assert_eq!(modules.len(), 2, "no implicit modules may be loaded");
let dependency = modules
.iter()
.find(|module| module["id"].as_str().unwrap().starts_with("dep:geo@"))
.expect("dependency module");
assert!(
dependency["id"]
.as_str()
.unwrap()
.ends_with("::index.mq.md"),
"a directory dependency resolves to its index.mq.md"
);
let root = modules
.iter()
.find(|module| module["id"] == "root:demo@0.1.0::index.mq.md")
.unwrap();
assert_eq!(
root["imports"][0]["resolved"], dependency["id"],
"the explicit import names the dependency index module"
);
assert!(
dependency["units"]
.as_array()
.unwrap()
.iter()
.any(|unit| unit["path"] == serde_json::json!(["几何", "面积"])),
"the dependency index is a normal document with normal units"
);
}
#[test]
fn a_markdown_link_is_neither_an_import_nor_a_call() {
let dir = TempDir::new("link-only");
dir.write(
"index.mq.md",
"# @knowledge 主\n\n[另一个文稿](other.mq.md)\n\n## @exec main\n\n`return 1`\n",
);
dir.write("other.mq.md", "# @knowledge 其他\n\n## 说明\n\n正文\n");
let plain = check_document(dir.path(), "index.mq.md", &dir.path().join("plain.json"));
assert_eq!(plain["modules"].as_array().unwrap().len(), 1);
let reference = &plain["modules"][0]["references"][0];
assert_eq!(reference["state"], "not_loaded");
assert!(plain["modules"][0]["imports"]
.as_array()
.unwrap()
.is_empty());
assert!(plain["modules"][0]["calls"].as_array().unwrap().is_empty());
// `check --refs` verifies local link targets through the explicit
// verification catalog; it still does not import the target or add it to
// the program, and the emitted Analysis keeps the loaded-only reference
// projection (`not_loaded` means "not part of this program", not "missing").
let refs_artifact = dir.path().join("refs.json");
let output = cli(
&[
"check",
"index.mq.md",
"--refs",
"--emit",
refs_artifact.to_str().unwrap(),
],
dir.path(),
);
assert!(output.status.success(), "{}", stderr(&output));
assert!(
!stderr(&output).contains("ref."),
"an existing local link target must not produce a refs diagnostic: {}",
stderr(&output)
);
let refs: serde_json::Value =
serde_json::from_slice(&std::fs::read(&refs_artifact).unwrap()).unwrap();
assert_eq!(refs["modules"].as_array().unwrap().len(), 1);
assert_eq!(refs["modules"][0]["references"][0]["state"], "not_loaded");
assert!(refs["modules"][0]["imports"].as_array().unwrap().is_empty());
assert!(refs["modules"][0]["calls"].as_array().unwrap().is_empty());
}
#[test]
fn unknown_mode_markers_are_still_hard_errors() {
let dir = TempDir::new("bad-marker");
dir.write("index.mq.md", "# @knowledge 数学\n\n## @foo 标题\n\n正文\n");
let artifact = dir.path().join("analysis.json");
let output = cli(
&["check", "index.mq.md", "--emit", artifact.to_str().unwrap()],
dir.path(),
);
assert_eq!(output.status.code(), Some(1));
assert!(
stderr(&output).contains("sem.invalid_mode_marker"),
"unexpected stderr: {}",
stderr(&output)
);
assert!(!artifact.exists());
}
+211
View File
@@ -0,0 +1,211 @@
//! Black-box tests for `marqdo inspect --environment` (marqdo-cli#26 §9.2).
//!
//! The report is the offline diagnostic export used by feedback tooling. These
//! tests drive the real binary and assert the stable schema, the honest
//! degraded-installation representation, the argument boundary and the
//! no-secret/no-absolute-path rule.
#[path = "support/stdlib.rs"]
pub mod stdlib_support;
use std::path::{Path, PathBuf};
use std::process::Output;
struct TempDir(PathBuf);
impl TempDir {
fn new(tag: &str) -> Self {
let nanos = std::time::SystemTime::now()
.duration_since(std::time::UNIX_EPOCH)
.map(|duration| duration.as_nanos())
.unwrap_or(0);
let path = std::env::temp_dir().join(format!(
"marqdo-environment-{tag}-{}-{nanos}",
std::process::id()
));
std::fs::create_dir_all(&path).unwrap();
Self(path)
}
fn path(&self) -> &Path {
&self.0
}
}
impl Drop for TempDir {
fn drop(&mut self) {
let _ = std::fs::remove_dir_all(&self.0);
}
}
fn cli(args: &[&str], dir: &Path) -> Output {
stdlib_support::cli_command()
.args(args)
.current_dir(dir)
.output()
.unwrap()
}
fn stdout(output: &Output) -> String {
String::from_utf8_lossy(&output.stdout).to_string()
}
fn json(output: &Output) -> serde_json::Value {
serde_json::from_slice(&output.stdout).unwrap_or_else(|error| {
panic!(
"stdout is not JSON: {error}\n{}",
String::from_utf8_lossy(&output.stdout)
)
})
}
#[test]
fn environment_report_is_stable_and_project_independent() {
let dir = TempDir::new("no-project");
let output = cli(&["inspect", "--environment", "--json"], dir.path());
assert!(
output.status.success(),
"inspect --environment failed: {}",
String::from_utf8_lossy(&output.stderr)
);
let report = json(&output);
assert_eq!(report["schema"], "marqdo.environment");
assert_eq!(report["schema_version"], 1);
assert_eq!(report["producer"]["name"], "marqdo");
assert_eq!(report["producer"]["version"], env!("CARGO_PKG_VERSION"));
let source_sha = &report["producer"]["source"]["sha"];
if let Some(sha) = source_sha.as_str() {
assert_eq!(sha.len(), 40, "embedded source SHA must be a full commit");
assert!(sha
.chars()
.all(|ch| ch.is_ascii_hexdigit() && !ch.is_ascii_uppercase()));
} else {
assert_eq!(report["producer"]["source"]["origin"], "unavailable");
}
assert!(report["platform"]["os"].is_string());
assert!(report["platform"]["arch"].is_string());
assert!(report["platform"]["strict"].is_object());
assert_eq!(report["protocols"]["analysis"], 3);
assert_eq!(report["protocols"]["observation"], 1);
assert_eq!(report["protocols"]["cli_tool"]["api_revision"], 1);
assert_eq!(report["protocols"]["package_lock"], 4);
assert_eq!(report["protocols"]["markdown_profile"], "marqdo.md.v1");
assert!(report["worker"]["status"].is_string());
assert!(report["bundle"]["status"].is_string());
assert!(report["diagnostics"].is_array());
// The report is deterministic: the same installation emits the same bytes.
let again = cli(&["inspect", "--environment", "--json"], dir.path());
assert_eq!(output.stdout, again.stdout);
}
#[test]
fn environment_report_never_leaks_paths_or_secrets() {
let dir = TempDir::new("no-leak");
let output = cli(&["inspect", "--environment", "--json"], dir.path());
assert!(output.status.success());
let text = stdout(&output);
assert!(!text.contains(dir.path().to_str().unwrap()), "{text}");
assert!(!text.contains("/root/"), "{text}");
assert!(!text.contains("\\Users\\"), "{text}");
for forbidden in [
"token",
"api_key",
"secret",
"password",
"BEGIN PRIVATE KEY",
] {
assert!(
!text.to_ascii_lowercase().contains(forbidden),
"report contains forbidden field {forbidden}: {text}"
);
}
// No project source is ever projected.
assert!(!text.contains("@exec"), "{text}");
assert!(!text.contains("source_bytes"), "{text}");
}
/// Write a syntactically valid Bundle whose declared digest matches its tree.
///
/// This exercises the report's verified path without network access; the real
/// product Bundle is verified by the stdlib/product tests.
fn write_valid_bundle(root: &Path) -> serde_json::Value {
std::fs::write(root.join("io.mq.md"), "# @knowledge io\n\n`print`\n").unwrap();
let digest = stdlib_support::tree_digest(root).unwrap();
let manifest = serde_json::json!({
"name": "marqdo-stdlib",
"version": "0.0.0-test",
"digest": digest,
});
std::fs::write(
root.join("stdlib.json"),
serde_json::to_string_pretty(&manifest).unwrap(),
)
.unwrap();
manifest
}
#[test]
fn verified_bundle_is_reported_with_its_public_identity() {
let bundle = TempDir::new("bundle");
let manifest = write_valid_bundle(bundle.path());
let dir = TempDir::new("bundle-project");
let output = stdlib_support::cli_command()
.args(["inspect", "--environment", "--json"])
.env("MARQDO_STDLIB_DIR", bundle.path())
.current_dir(dir.path())
.output()
.unwrap();
assert!(output.status.success());
let report = json(&output);
assert_eq!(report["bundle"]["status"], "verified");
assert_eq!(report["bundle"]["origin"], "explicit-env");
assert_eq!(report["bundle"]["name"], manifest["name"]);
assert_eq!(report["bundle"]["version"], manifest["version"]);
assert_eq!(report["bundle"]["tree_digest"], manifest["digest"]);
assert_eq!(
report["bundle"]["tree_digest"].as_str().unwrap(),
stdlib_support::tree_digest(bundle.path()).unwrap()
);
assert!(report["diagnostics"].as_array().unwrap().is_empty());
let text = stdout(&output);
assert!(!text.contains(bundle.path().to_str().unwrap()), "{text}");
}
#[test]
fn invalid_bundle_is_reported_as_data_with_a_stable_path_free_code() {
let bundle = TempDir::new("bad-bundle");
std::fs::write(
bundle.path().join("stdlib.json"),
"{\"name\":\"broken\",\"version\":\"0.0.0\",\"digest\":\"sha256:00\"}",
)
.unwrap();
let dir = TempDir::new("bad-bundle-project");
let output = stdlib_support::cli_command()
.args(["inspect", "--environment", "--json"])
.env("MARQDO_STDLIB_DIR", bundle.path())
.current_dir(dir.path())
.output()
.unwrap();
// A degraded installation is reported, not turned into a command failure.
assert!(output.status.success());
let report = json(&output);
assert_eq!(report["bundle"]["status"], "invalid");
assert_eq!(report["bundle"]["origin"], "explicit-env");
let diagnostics = report["diagnostics"].as_array().unwrap();
assert_eq!(diagnostics.len(), 1);
assert_eq!(diagnostics[0]["code"], "env.stdlib_digest_mismatch");
let text = stdout(&output);
assert!(!text.contains(bundle.path().to_str().unwrap()), "{text}");
}
#[test]
fn environment_is_exclusive_with_document_inspection() {
let dir = TempDir::new("exclusive");
let output = cli(&["inspect", "--environment", "--platform"], dir.path());
assert_eq!(output.status.code(), Some(2));
let stderr = String::from_utf8_lossy(&output.stderr);
assert!(
stderr.contains("cannot be used with"),
"unexpected stderr: {stderr}"
);
}
+7 -30
View File
@@ -1,11 +1,13 @@
//! R6 integration examples that do not require an official external repo.
#![cfg(unix)]
#[path = "support/stdlib.rs"]
pub mod stdlib_support;
#[path = "support/observation.rs"]
pub mod observation;
use std::path::Path;
use std::process::{Command, Output};
use std::process::Output;
fn repo() -> &'static Path {
Path::new(env!("CARGO_MANIFEST_DIR"))
@@ -16,7 +18,7 @@ fn repo() -> &'static Path {
}
fn cli(args: &[&str]) -> Output {
Command::new(env!("CARGO_BIN_EXE_marqdo"))
stdlib_support::cli_command()
.args(args)
.current_dir(repo())
.output()
@@ -27,31 +29,6 @@ fn stderr(output: &Output) -> 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]
fn addressable_memory_example_runs_through_the_cli() {
let output = cli(&["run", "examples/memory-buffer.mq.md", "--output", "json"]);
@@ -113,14 +90,14 @@ fn unknown_tool_name_installs_and_dispatches() {
.unwrap()
.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"])
.env("MARQDO_TOOL_HOME", &home)
.current_dir(repo())
.output()
.unwrap();
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", "."])
.env("MARQDO_TOOL_HOME", &home)
.current_dir(repo())
@@ -128,7 +105,7 @@ fn unknown_tool_name_installs_and_dispatches() {
.unwrap();
assert_eq!(run.status.code(), Some(0), "{}", stderr(&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"])
.env("MARQDO_TOOL_HOME", &home)
.current_dir(repo())
+3 -1
View File
@@ -4,6 +4,8 @@
//! sources, `marqdo lock` records their exact identity, and `check`/`run`
//! compare the current declaration with the lock before using any extension.
#![cfg(unix)]
#[path = "support/stdlib.rs"]
pub mod stdlib_support;
use std::path::{Path, PathBuf};
use std::process::{Command, Output};
@@ -47,7 +49,7 @@ fn repo() -> PathBuf {
}
fn cli(args: &[&str], dir: &Path) -> Output {
Command::new(env!("CARGO_BIN_EXE_marqdo"))
stdlib_support::cli_command()
.args(args)
.current_dir(dir)
.output()
+4 -2
View File
@@ -5,9 +5,11 @@
//! binary and assert that `check --emit`, `run` and `call` agree.
#![cfg(unix)]
#[path = "support/stdlib.rs"]
pub mod stdlib_support;
use std::path::{Path, PathBuf};
use std::process::{Command, Output};
use std::process::Output;
use std::sync::atomic::{AtomicU32, Ordering};
static COUNTER: AtomicU32 = AtomicU32::new(0);
@@ -41,7 +43,7 @@ impl Drop for TempDir {
}
fn cli(args: &[&str], dir: &Path) -> Output {
Command::new(env!("CARGO_BIN_EXE_marqdo"))
stdlib_support::cli_command()
.args(args)
.current_dir(dir)
.output()
+4 -2
View File
@@ -8,6 +8,8 @@
//!
//! Temporary directories live under the OS temp directory and are removed on
//! drop; the repository itself is never modified.
#[path = "support/stdlib.rs"]
pub mod stdlib_support;
#[path = "support/observation.rs"]
pub mod observation;
@@ -75,7 +77,7 @@ impl Drop for TempDir {
/// Run the CLI in `dir`.
fn cli(dir: &Path, args: &[&str]) -> Output {
Command::new(env!("CARGO_BIN_EXE_marqdo"))
stdlib_support::cli_command()
.args(args)
.current_dir(dir)
.output()
@@ -84,7 +86,7 @@ fn cli(dir: &Path, args: &[&str]) -> Output {
/// Run the CLI in `dir` with one extra environment variable.
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)
.current_dir(dir)
.env(key, value)
+4 -2
View File
@@ -4,9 +4,11 @@
//! checked-in examples.
#![cfg(unix)]
#[path = "support/stdlib.rs"]
pub mod stdlib_support;
use std::path::{Path, PathBuf};
use std::process::{Command, Output};
use std::process::Output;
use std::sync::atomic::{AtomicU32, Ordering};
static COUNTER: AtomicU32 = AtomicU32::new(0);
@@ -49,7 +51,7 @@ fn repo() -> PathBuf {
}
fn cli(args: &[&str], dir: &Path) -> Output {
Command::new(env!("CARGO_BIN_EXE_marqdo"))
stdlib_support::cli_command()
.args(args)
.current_dir(dir)
.output()
+5 -3
View File
@@ -4,6 +4,8 @@
//! stdout line stream exactly like an external consumer. They cover the P0
//! envelope/lifecycle/byte-fidelity contract and the P1 frame/value policy,
//! plus snapshot equivalence, truncation, live delivery and a broken pipe.
#[path = "support/stdlib.rs"]
pub mod stdlib_support;
use std::fs;
use std::io::{BufRead, BufReader, Read};
@@ -51,7 +53,7 @@ impl Drop for TempDir {
}
fn cli(dir: &Path, args: &[&str]) -> std::process::Output {
Command::new(env!("CARGO_BIN_EXE_marqdo"))
stdlib_support::cli_command()
.args(args)
.current_dir(dir)
.output()
@@ -670,7 +672,7 @@ fn live_chunks_arrive_while_the_program_is_still_running() {
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";
dir.write("index.mq.md", source);
let mut child = Command::new(env!("CARGO_BIN_EXE_marqdo"))
let mut child = stdlib_support::cli_command()
.args([
"run",
"index.mq.md",
@@ -723,7 +725,7 @@ fn broken_pipe_makes_the_run_fail_instead_of_running_forever() {
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";
dir.write("index.mq.md", source);
let mut child = Command::new(env!("CARGO_BIN_EXE_marqdo"))
let mut child = stdlib_support::cli_command()
.args([
"run",
"index.mq.md",
+5 -42
View File
@@ -1,13 +1,11 @@
//! 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"]
pub mod observation;
#[path = "support/stdlib.rs"]
pub mod stdlib_support;
use std::path::{Path, PathBuf};
use std::process::Command;
fn repo_root() -> PathBuf {
Path::new(env!("CARGO_MANIFEST_DIR"))
@@ -75,7 +73,7 @@ fn p2_algorithms_run_in_a_pure_no_foreign_no_plugin_host() {
"{criterion} fixture {name} uses forbidden host shortcut `{forbidden}`"
);
}
let output = Command::new(env!("CARGO_BIN_EXE_marqdo"))
let output = stdlib_support::cli_command()
.args([
"run",
path.to_str().unwrap(),
@@ -110,41 +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 bundle = stdlib_support::bundle_dir();
let path = bundle.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(&bundle)
.env("MARQDO_STDLIB_DIR", &bundle)
.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]
fn foreign_and_plugin_shortcuts_are_unavailable_in_the_pure_lane() {
let dir = tempfile::tempdir().unwrap();
@@ -154,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",
)
.unwrap();
let output = Command::new(env!("CARGO_BIN_EXE_marqdo"))
let output = stdlib_support::cli_command()
.args([
"run",
foreign.to_str().unwrap(),
@@ -180,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",
)
.unwrap();
let output = Command::new(env!("CARGO_BIN_EXE_marqdo"))
let output = stdlib_support::cli_command()
.args([
"run",
plugin.to_str().unwrap(),
+3 -5
View File
@@ -1,6 +1,8 @@
//! Package instance identity, transitive imports, pinned Git and environment
//! materialization (M0.6 R1/R5).
#![cfg(unix)]
#[path = "support/stdlib.rs"]
pub mod stdlib_support;
use std::path::{Path, PathBuf};
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 {
Command::new(binary())
stdlib_support::cli_command()
.args(args)
.current_dir(dir)
.output()
+5 -3
View File
@@ -1,5 +1,7 @@
//! Isolated plugin worker transport (ADR-0010).
#![cfg(unix)]
#[path = "support/stdlib.rs"]
pub mod stdlib_support;
use std::path::{Path, PathBuf};
use std::process::{Command, Output};
@@ -118,7 +120,7 @@ fn write_manifest(dir: &Path, sha: &str) {
}
fn run(dir: &Path) -> Output {
Command::new(env!("CARGO_BIN_EXE_marqdo"))
stdlib_support::cli_command()
.args([
"run",
dir.join("doc.mq.md").to_str().unwrap(),
@@ -167,7 +169,7 @@ fn worker_crash_is_isolated_from_the_host() {
"{stderr}"
);
// 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"])
.current_dir(repo())
.output()
@@ -235,7 +237,7 @@ fn write_capability_manifest(dir: &Path, sha: &str) {
}
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([
"run",
dir.join("doc.mq.md").to_str().unwrap(),
+4 -2
View File
@@ -1,7 +1,9 @@
//! Compat-B `打印` routing tests (ADR-0030).
#[path = "support/stdlib.rs"]
pub mod stdlib_support;
use std::path::{Path, PathBuf};
use std::process::{Command, Output};
use std::process::Output;
struct TempDir(PathBuf);
@@ -25,7 +27,7 @@ impl Drop for TempDir {
}
fn cli(dir: &Path, args: &[&str]) -> Output {
Command::new(env!("CARGO_BIN_EXE_marqdo"))
stdlib_support::cli_command()
.args(args)
.current_dir(dir)
.output()
+4 -1
View File
@@ -15,6 +15,9 @@
//! Other platforms must keep this file compiling but run no provider
//! assertions; the CLI itself fails closed with `ext.platform_unsupported`.
#![cfg(all(target_os = "linux", target_arch = "x86_64"))]
#[path = "support/stdlib.rs"]
pub mod stdlib_support;
#[path = "support/observation.rs"]
pub mod observation;
@@ -400,7 +403,7 @@ fn marker_text(path: &Path) -> String {
}
fn run_cli(dir: &Path, args: &[&str], marker: &Path) -> Output {
Command::new(cli_binary())
stdlib_support::cli_command()
.args(args)
.current_dir(dir)
.env(MARKER_ENV, marker)
+5 -3
View File
@@ -1,11 +1,13 @@
//! End-to-end resource stream tests through the CLI.
#[path = "support/stdlib.rs"]
pub mod stdlib_support;
#[path = "support/observation.rs"]
pub mod observation;
use std::io::Write;
use std::path::{Path, PathBuf};
use std::process::{Command, Output, Stdio};
use std::process::{Output, Stdio};
struct TempDir(PathBuf);
@@ -30,7 +32,7 @@ impl Drop for TempDir {
}
fn cli(dir: &Path, args: &[&str]) -> Output {
Command::new(env!("CARGO_BIN_EXE_marqdo"))
stdlib_support::cli_command()
.args(args)
.current_dir(dir)
.output()
@@ -38,7 +40,7 @@ fn cli(dir: &Path, args: &[&str]) -> 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)
.current_dir(dir)
.stdin(Stdio::piped())
+2 -3
View File
@@ -4,12 +4,11 @@
//! in the verified `stdlib.json` metadata. There is no `print_override`, no
//! runtime name special case and no hard-coded per-function scan.
#![cfg(unix)]
#[path = "support/stdlib.rs"]
pub mod stdlib_support;
use std::path::{Path, PathBuf};
use std::process::{Command, Output};
use std::process::Output;
use std::sync::atomic::{AtomicU32, Ordering};
static COUNTER: AtomicU32 = AtomicU32::new(0);
@@ -39,7 +38,7 @@ impl Drop for TempDir {
}
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);
for (key, value) in env {
command.env(key, value);
+1 -3
View File
@@ -1,10 +1,8 @@
//! 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::process::Command;
fn binary() -> &'static str {
env!("CARGO_BIN_EXE_marqdo")
@@ -15,7 +13,7 @@ fn stdlib_dir() -> PathBuf {
}
fn run(dir: &Path, stdlib: &Path, args: &[&str]) -> std::process::Output {
Command::new(binary())
stdlib_support::cli_command()
.args(args)
.current_dir(dir)
.env("MARQDO_STDLIB_DIR", stdlib)
-42
View File
@@ -1,42 +0,0 @@
//! CM-A08/P5 stdlib HTTP framing module tests.
#[path = "support/observation.rs"]
pub mod observation;
#[path = "support/stdlib.rs"]
pub mod stdlib_support;
use std::process::Command;
#[test]
fn stdlib_http_parses_chunked_responses_and_builds_requests() {
let bundle = stdlib_support::bundle_dir();
let output = Command::new(env!("CARGO_BIN_EXE_marqdo"))
.args(["run", "tests/http.mq.md", "--output", "json"])
.current_dir(&bundle)
.env("MARQDO_STDLIB_DIR", &bundle)
.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");
}
+119 -526
View File
@@ -1,9 +1,11 @@
//! 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
//! `stdlib/tests/`, and this lane runs the whole directory through the real
//! user import path (`std:` + the verified bundle), not through a conformance
//! fixture or a Rust shortcut.
//! The standard-library module sources and their self-tests live in the
//! component repositories; this lane proves what the CLI still owns: it loads
//! one verified offline Bundle, resolves the public `std:` surface, and routes
//! 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"]
pub mod observation;
@@ -11,554 +13,145 @@ pub mod observation;
#[path = "support/stdlib.rs"]
pub mod stdlib_support;
use std::io::Write;
use std::path::PathBuf;
use std::process::{Command, Stdio};
use std::sync::{Mutex, MutexGuard};
use std::process::{Command, Output};
static FS_LOCK: Mutex<()> = Mutex::new(());
fn lock_fs(name: &str) -> Option<MutexGuard<'static, ()>> {
if name == "fs.mq.md" {
Some(FS_LOCK.lock().unwrap_or_else(|error| error.into_inner()))
} else {
None
}
}
fn stdlib_dir() -> PathBuf {
stdlib_support::bundle_dir()
}
struct TestFile {
name: String,
stdin: &'static str,
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");
fn run_fixture(name: &str) -> (serde_json::Value, String) {
let bundle = stdlib_support::bundle_dir();
let fixture = stdlib_support::repo_root()
.join("tests")
.join("product-stdlib")
.join(format!("{name}.mq.md"));
let output: Output = Command::new(env!("CARGO_BIN_EXE_marqdo"))
.args([
"run",
fixture.to_str().expect("utf-8 fixture path"),
"--output",
"json",
])
.env("MARQDO_STDLIB_DIR", &bundle)
.current_dir(stdlib_support::repo_root())
.output()
.expect("run marqdo");
assert_eq!(
output.status.code(),
Some(0),
"{} failed: {}",
file.name,
"{name} failed: {}",
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]
fn every_public_stdlib_module_has_a_product_test() {
let names: Vec<String> = product_tests().into_iter().map(|file| file.name).collect();
assert_eq!(
names,
vec![
"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",
fn the_accepted_bundle_is_external_and_has_the_required_surface() {
let pin = stdlib_support::BundlePin::committed();
assert!(
pin.source_path.is_none(),
"Phase B: the accepted Bundle must not be vendored in this repository"
);
let bundle = stdlib_support::bundle_dir();
let manifest: serde_json::Value =
serde_json::from_slice(&std::fs::read(bundle.join("stdlib.json")).unwrap()).unwrap();
assert_eq!(manifest["name"], pin.name);
assert_eq!(manifest["version"], pin.version);
assert_eq!(manifest["digest"], pin.tree_digest);
assert_eq!(manifest["aliases_digest"], pin.aliases_digest);
for required in [
"io.mq.md",
"json.mq.md",
"path.mq.md",
"process.mq.md",
"random.mq.md",
"regex.mq.md",
"stream.mq.md",
"table.mq.md",
"io/console.mq.md",
"io/stream.mq.md",
"format.mq.md",
"text.mq.md",
"utf8.mq.md",
],
"a public stdlib module is missing a product test"
);
}
#[test]
fn the_whole_bundled_library_runs_through_std_imports() {
for file in product_tests() {
let _guard = lock_fs(&file.name);
let report = run_product_test(&file);
assert_eq!(report["run"]["status"], "ok", "{}", file.name);
assert_eq!(
observation::text(&report, "stdout.chunk"),
file.stdout,
"{} wrote unexpected stdout",
file.name
);
}
}
#[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);
"text/utf8.mq.md",
"data/json.mq.md",
"collections/table.mq.md",
"data/table.mq.md",
"fs/file.mq.md",
"path.mq.md",
] {
assert!(
!stdlib_dir().join("tests/out").exists(),
"the fs test did not remove its directory"
bundle.join(required).is_file(),
"the accepted Bundle is missing {required}"
);
}
assert!(
!bundle.join("tests").exists(),
"the accepted Bundle must not ship component self-tests"
);
}
#[test]
fn json_test_parses_and_formats_nested_values() {
let report = run_product_test(
product_tests()
.iter()
.find(|file| file.name == "json.mq.md")
.expect("json test"),
);
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"], "说\"好");
fn official_print_aliases_match_the_target_function_output() {
let (report, stdout) = run_fixture("print-routing");
assert_eq!(report["run"]["status"], "ok");
let lines: Vec<&str> = stdout.lines().collect();
assert_eq!(lines.len(), 6, "{stdout:?}");
for pair in [(0, 1), (2, 3), (4, 5)] {
assert_eq!(
items[3]["value"],
"[1, 2.5, -300.0, 0.4, {\"a\": 1.0}, \"x\"]"
lines[pair.0], lines[pair.1],
"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]
fn csv_test_parses_and_formats_quoted_rows() {
let report = run_product_test(
product_tests()
.iter()
.find(|file| file.name == "csv.mq.md")
.expect("csv test"),
fn std_surface_executes_against_the_official_bundle() {
let (report, stdout) = run_fixture("std-surface");
assert_eq!(stdout, "");
assert_eq!(
observation::terminal(&report)["value"],
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]
fn path_test_joins_and_normalizes_project_paths() {
let report = run_product_test(
product_tests()
.iter()
.find(|file| file.name == "path.mq.md")
.expect("path test"),
);
let items = observation::terminal(&report)["value"]["items"]
.as_array()
.expect("list");
assert_eq!(items[0]["value"], "a/b/c");
assert_eq!(items[1]["value"], "c.txt");
assert_eq!(items[2]["value"], "a/b");
assert_eq!(items[3]["value"], "txt");
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")
fn a_missing_explicit_bundle_fails_closed_without_fallback() {
let missing = stdlib_support::repo_root()
.join("target")
.join("does-not-exist-stdlib");
let fixture = stdlib_support::repo_root().join("tests/product-stdlib/std-surface.mq.md");
let output = Command::new(env!("CARGO_BIN_EXE_marqdo"))
.args([
"run",
fixture.to_str().expect("utf-8 fixture path"),
"--output",
"json",
])
.env("MARQDO_STDLIB_DIR", &missing)
.current_dir(stdlib_support::repo_root())
.output()
.expect("run marqdo --version");
let expected_stdout = String::from_utf8_lossy(&expected.stdout);
assert_eq!(
items[2]["value"].as_str().expect("process stdout"),
expected_stdout.as_ref(),
"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"
.expect("run marqdo");
assert_ne!(
output.status.code(),
Some(0),
"an invalid explicit MARQDO_STDLIB_DIR must fail even when a Bundle is installed"
);
let stderr = String::from_utf8_lossy(&output.stderr);
assert!(
console["events"]
.as_array()
.unwrap()
.iter()
.any(|event| event["payload"]["operation"] == "resource.read"
|| event["payload"]["operation"] == "resource.open"),
"console test did not go through a resource endpoint"
stderr.contains("stdlib") || stderr.contains("cannot open"),
"failure must name the Bundle: {stderr}"
);
}
-71
View File
@@ -1,71 +0,0 @@
//! CM-A08 table stdlib module tests.
#[path = "support/observation.rs"]
pub mod observation;
#[path = "support/stdlib.rs"]
pub mod stdlib_support;
use std::process::Command;
fn run_table_self_test() -> serde_json::Value {
let bundle = stdlib_support::bundle_dir();
let output = Command::new(env!("CARGO_BIN_EXE_marqdo"))
.args(["run", "tests/table.mq.md", "--output", "json"])
.current_dir(&bundle)
.env("MARQDO_STDLIB_DIR", &bundle)
.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 |"
);
}
+60 -9
View File
@@ -42,7 +42,9 @@ pub struct BundlePin {
pub name: String,
pub version: String,
pub source_commit: String,
pub source_path: PathBuf,
/// 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,
}
@@ -70,17 +72,39 @@ impl BundlePin {
let source = value
.get("source")
.unwrap_or_else(|| panic!("Bundle pin {} has no source object", path.display()));
let source_path = source
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!("Bundle pin {} has no source.path", path.display()));
validate_relative(source_path)
.unwrap_or_else(|error| panic!("Bundle pin {} source.path: {error}", path.display()));
.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: PathBuf::from(source_path),
source_path,
tree_digest: required_str(&value, "tree_digest", path),
aliases_digest: required_str(&value, "aliases_digest", path),
}
@@ -117,9 +141,16 @@ impl Bundle {
pub fn pinned() -> Self {
let pin = BundlePin::committed();
let explicit = std::env::var_os(BUNDLE_ENV).map(PathBuf::from);
let root = explicit
.clone()
.unwrap_or_else(|| repo_root().join(&pin.source_path));
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}",
@@ -252,6 +283,26 @@ 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();
@@ -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"]
pub mod observation;
@@ -6,7 +8,6 @@ pub mod observation;
use std::io::{Read, Write};
use std::net::TcpListener;
use std::path::Path;
use std::process::Command;
struct TempDir(std::path::PathBuf);
@@ -30,7 +31,11 @@ impl Drop for TempDir {
}
#[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 address = listener.local_addr().unwrap();
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();
assert!(String::from_utf8_lossy(&request[..count]).starts_with("GET / HTTP/1.1\r\n"));
stream
.write_all(
b"HTTP/1.1 200 OK\r\nContent-Type: text/plain\r\nContent-Length: 5\r\n\r\nhello",
)
.write_all(b"HTTP/1.1 200 OK\r\nContent-Length: 5\r\n\r\nhello")
.unwrap();
});
let dir = TempDir::new("client");
let dir = TempDir::new("roundtrip");
let program = format!(
r#"---
import:
http: "std:net/http"
编码: "std:text"
---
@@ -57,7 +59,7 @@ import:
`流 = 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)`
@@ -85,13 +87,11 @@ import:
`关闭 = resource.close(流)`
`响应 = http.解析响应(响应文本)`
`return [写入.ok, 读出.ok, 响应.状态, 响应.头["Content-Type"], 响应.体, 关闭.ok]`
`return [写入.ok, 写入.value.count == 请求长度, 读出.ok, 数量 > 0, 响应文本, 关闭.ok]`
"#
);
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([
"run",
"index.mq.md",
@@ -101,15 +101,6 @@ import:
"json",
])
.current_dir(dir.path())
.env(
"MARQDO_STDLIB_DIR",
Path::new(env!("CARGO_MANIFEST_DIR"))
.parent()
.unwrap()
.parent()
.unwrap()
.join("stdlib"),
)
.output()
.expect("run marqdo");
assert_eq!(
@@ -126,9 +117,12 @@ import:
.expect("list");
assert_eq!(items[0]["value"], true);
assert_eq!(items[1]["value"], true);
assert_eq!(items[2]["decimal"], "200");
assert_eq!(items[3]["value"], "text/plain");
assert_eq!(items[4]["value"], "hello");
assert_eq!(items[2]["value"], true);
assert_eq!(items[3]["value"], true);
assert_eq!(
items[4]["value"],
"HTTP/1.1 200 OK\r\nContent-Length: 5\r\n\r\nhello"
);
assert_eq!(items[5]["value"], true);
server.join().unwrap();
}
+6 -8
View File
@@ -2,6 +2,8 @@
//!
//! 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.
#[path = "support/stdlib.rs"]
pub mod stdlib_support;
use std::path::{Path, PathBuf};
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 {
Command::new(binary())
stdlib_support::cli_command()
.args(args)
.env("MARQDO_TOOL_HOME", home)
.output()
@@ -157,7 +155,7 @@ fn independent_sample_tools_consume_public_analysis_and_observation() {
let trace = dir.path().join("trace.json");
let root = repo_root();
let check = Command::new(binary())
let check = stdlib_support::cli_command()
.args([
"check",
"examples/multi-module/index.mq.md",
@@ -169,7 +167,7 @@ fn independent_sample_tools_consume_public_analysis_and_observation() {
.output()
.expect("run check");
assert!(check.status.success(), "check failed: {}", stderr(&check));
let run = Command::new(binary())
let run = stdlib_support::cli_command()
.args([
"run",
"examples/multi-module/index.mq.md",
@@ -354,7 +352,7 @@ fn tampered_binary_and_path_hijack_are_not_executed() {
permissions.set_mode(0o755);
std::fs::set_permissions(&hijack, permissions).unwrap();
}
let output = Command::new(binary())
let output = stdlib_support::cli_command()
.arg("hijack")
.env("MARQDO_TOOL_HOME", &home)
.env("PATH", &path_dir)
@@ -0,0 +1,49 @@
//! Read-only document snapshot exposed to the language runtime.
//!
//! The engine must not read project files, parse Markdown or depend on the
//! loader. The composition root builds one immutable snapshot of the modules
//! that were already statically loaded (`check`/`run`/`call` share the same
//! `prepare` step) and hands it to the host. The host exposes two read-only
//! operations over that snapshot; nothing here can execute code, load a module,
//! start a worker or access the network.
//!
//! Identity and spans follow the public Analysis revision 3 projection:
//! canonical module/unit ids, UTF-8 half-open byte spans, exact source text and
//! the module `source_digest`. Reading a section never re-parses the document.
use marqdo_span::Span;
/// One unit of a loaded document snapshot.
#[derive(Debug, Clone, PartialEq, Eq)]
pub struct DocumentUnit {
/// Canonical unit identity (same rendering as Analysis `units[].id`).
pub id: String,
/// Canonical heading path (empty for the document root).
pub path: Vec<String>,
/// Parent unit id (`None` for the root).
pub parent_id: Option<String>,
/// Heading level (0 for the root).
pub level: u8,
/// Effective mode: `exec` or `knowledge`.
pub mode: String,
/// GitHub-style navigation anchors naming this unit (sorted, unique).
pub anchors: Vec<String>,
/// Complete section span: heading through the next same-or-higher heading
/// or EOF. The root covers the whole source.
pub span: Span,
/// Heading span (`None` for the root).
pub heading_span: Option<Span>,
}
/// One statically loaded module in the snapshot.
#[derive(Debug, Clone, PartialEq, Eq)]
pub struct DocumentModule {
/// Canonical module identity (same rendering as Analysis `modules[].id`).
pub id: String,
/// SHA-256 of the exact source bytes, lowercase hex (no prefix).
pub source_digest: String,
/// Exact UTF-8 source text.
pub source: String,
/// Units in document order, root first.
pub units: Vec<DocumentUnit>,
}
+41
View File
@@ -142,6 +142,47 @@ pub trait Host {
))
}
/// Read-only outline of the statically loaded document snapshot.
///
/// `module` defaults to the calling module. `parent` filters direct
/// children of one unit id; `limit` bounds the number of returned units.
/// Default: unavailable for hosts that do not own a document snapshot.
/// The native CLI host returns a `{ok: ...}` result map; it never executes
/// project code or loads a module.
fn document_outline(
&mut self,
_module: Option<&str>,
_parent: Option<&str>,
_limit: usize,
ctx: &ExecutionContext,
) -> Result<Value, RuntimeError> {
Err(RuntimeError::new(
ErrorCategory::ResourceUnsupported,
ctx.span,
"this host does not provide a loaded document snapshot",
))
}
/// Read one exact section of the loaded document snapshot.
///
/// `unit` is a canonical unit id or one of its navigation anchors.
/// `expected_digest` optionally binds the read to one exact module source
/// digest; `max_bytes` bounds the returned text. Default: unavailable.
fn document_read(
&mut self,
_module: &str,
_unit: &str,
_expected_digest: Option<&str>,
_max_bytes: usize,
ctx: &ExecutionContext,
) -> Result<Value, RuntimeError> {
Err(RuntimeError::new(
ErrorCategory::ResourceUnsupported,
ctx.span,
"this host does not provide a loaded document snapshot",
))
}
/// Consume evaluation fuel.
fn consume_fuel(&mut self, amount: u64, span: Option<Span>) -> Result<(), RuntimeError>;
+2
View File
@@ -15,11 +15,13 @@
//! owned by the trusted host implementation that consumes this contract.
pub mod context;
pub mod document;
pub mod host;
pub mod observe;
pub mod resource;
pub use context::ExecutionContext;
pub use document::{DocumentModule, DocumentUnit};
pub use host::{Host, HostOp};
pub use observe::{FrameId, LoopTransfer, ParameterSource, RuntimeObservation};
pub use resource::ResourceRead;
+232 -1
View File
@@ -13,7 +13,7 @@ use crate::plugin::{
CapabilityHandler, HostTarget, LoadOptions, LoadedPlugin, PluginKind, PluginManifest,
};
use marqdo_host_contract::{
ExecutionContext, FrameId, Host, HostOp, ResourceRead, RuntimeObservation,
DocumentModule, ExecutionContext, FrameId, Host, HostOp, ResourceRead, RuntimeObservation,
};
use marqdo_plugin_abi::{ErrorKind as PluginErrorKind, PluginError};
use marqdo_span::Span;
@@ -81,6 +81,8 @@ pub struct StdHost {
resource_providers: BTreeMap<String, (String, SharedResourceProvider)>,
observation: Option<ObservationState>,
observation_error: Option<String>,
/// Immutable loaded-document snapshot for the read-only document builtins.
documents: Vec<DocumentModule>,
}
struct PluginSlot {
@@ -143,9 +145,18 @@ impl StdHost {
resource_providers: BTreeMap::new(),
observation: None,
observation_error: None,
documents: Vec::new(),
}
}
/// Attach the immutable loaded-document snapshot for `document.outline`
/// and `document.read`. The composition root builds it from the same
/// `prepare` step as Analysis; the host only serves exact bytes.
pub fn with_documents(mut self, documents: Vec<DocumentModule>) -> Self {
self.documents = documents;
self
}
/// Add one explicit TLS root certificate (DER) for `resource.open("tls")`.
///
/// System roots are always tried first; this adds a private CA for
@@ -622,6 +633,209 @@ impl Host for StdHost {
self.request_compatibility_operation(operation, args, ctx)
}
fn document_outline(
&mut self,
module: Option<&str>,
parent: Option<&str>,
limit: usize,
ctx: &ExecutionContext,
) -> Result<Value, RuntimeError> {
const DEFAULT_LIMIT: usize = 1024;
const MAX_LIMIT: usize = 4096;
let module_id = module.unwrap_or(&ctx.module_id);
let Some(document) = self
.documents
.iter()
.find(|candidate| candidate.id == module_id)
else {
return Ok(document_failure(
"document.not_loaded",
format!("module `{module_id}` is not part of the loaded snapshot"),
));
};
let limit = if limit == 0 { DEFAULT_LIMIT } else { limit };
if limit > MAX_LIMIT {
return Ok(document_failure(
"document.too_large",
format!("outline limit {limit} exceeds the maximum {MAX_LIMIT}"),
));
}
let units: Vec<_> = document
.units
.iter()
.filter(|unit| match parent.filter(|value| !value.is_empty()) {
None => true,
Some(parent) => unit.parent_id.as_deref() == Some(parent),
})
.collect();
if units.len() > limit {
return Ok(document_failure(
"document.too_large",
format!(
"{} matching units exceed the outline limit {limit}",
units.len()
),
));
}
let projected = units
.iter()
.map(|unit| {
let mut entry = BTreeMap::new();
entry.insert("id".to_string(), Value::text(unit.id.clone()));
entry.insert(
"path".to_string(),
Value::List(
unit.path
.iter()
.map(|part| Value::text(part.clone()))
.collect(),
),
);
entry.insert(
"parent_id".to_string(),
match &unit.parent_id {
Some(parent) => Value::text(parent.clone()),
None => Value::None,
},
);
entry.insert("level".to_string(), Value::int(unit.level as i64));
entry.insert("mode".to_string(), Value::text(unit.mode.clone()));
entry.insert(
"anchors".to_string(),
Value::List(
unit.anchors
.iter()
.map(|anchor| Value::text(anchor.clone()))
.collect(),
),
);
entry.insert("span".to_string(), span_value(unit.span));
entry.insert(
"heading_span".to_string(),
match unit.heading_span {
Some(span) => span_value(span),
None => Value::None,
},
);
Value::Map(entry)
})
.collect();
let mut result = BTreeMap::new();
result.insert("ok".to_string(), Value::Bool(true));
result.insert("module".to_string(), Value::text(document.id.clone()));
result.insert(
"source_digest".to_string(),
Value::text(document.source_digest.clone()),
);
result.insert("count".to_string(), Value::int(units.len() as i64));
result.insert("units".to_string(), Value::List(projected));
Ok(Value::Map(result))
}
fn document_read(
&mut self,
module: &str,
unit: &str,
expected_digest: Option<&str>,
max_bytes: usize,
ctx: &ExecutionContext,
) -> Result<Value, RuntimeError> {
const DEFAULT_MAX_BYTES: usize = 256 * 1024;
const MAX_READ_BYTES: usize = 1024 * 1024;
let Some(document) = self
.documents
.iter()
.find(|candidate| candidate.id == module)
else {
return Ok(document_failure(
"document.not_loaded",
format!("module `{module}` is not part of the loaded snapshot"),
));
};
if let Some(expected) = expected_digest.filter(|value| !value.is_empty()) {
if expected != document.source_digest {
return Ok(document_failure(
"document.stale_source",
format!(
"expected source digest {expected}, loaded snapshot is {}",
document.source_digest
),
));
}
}
let Some(selected) = document
.units
.iter()
.find(|candidate| candidate.id == unit)
.or_else(|| {
document
.units
.iter()
.find(|candidate| candidate.anchors.iter().any(|anchor| anchor == unit))
})
else {
return Ok(document_failure(
"document.unknown_unit",
format!("module `{module}` has no unit or anchor `{unit}`"),
));
};
let max_bytes = if max_bytes == 0 {
DEFAULT_MAX_BYTES
} else {
max_bytes
};
if max_bytes > MAX_READ_BYTES {
return Ok(document_failure(
"document.too_large",
format!("max_bytes {max_bytes} exceeds the maximum {MAX_READ_BYTES}"),
));
}
let span = selected.span;
if span.end < span.start || span.end > document.source.len() {
return Ok(document_failure(
"document.invalid_request",
"the selected section span is outside the snapshot source".to_string(),
));
}
if span.end - span.start > max_bytes {
return Ok(document_failure(
"document.too_large",
format!(
"section is {} bytes, above max_bytes {max_bytes}",
span.end - span.start
),
));
}
let Some(text) = document.source.get(span.start..span.end) else {
return Ok(document_failure(
"document.invalid_request",
"the selected section span is not on UTF-8 boundaries".to_string(),
));
};
let mut result = BTreeMap::new();
result.insert("ok".to_string(), Value::Bool(true));
result.insert("module".to_string(), Value::text(document.id.clone()));
result.insert("unit".to_string(), Value::text(selected.id.clone()));
result.insert(
"anchors".to_string(),
Value::List(
selected
.anchors
.iter()
.map(|anchor| Value::text(anchor.clone()))
.collect(),
),
);
result.insert(
"source_digest".to_string(),
Value::text(document.source_digest.clone()),
);
result.insert("span".to_string(), span_value(span));
result.insert("text".to_string(), Value::text(text.to_string()));
let _ = ctx;
Ok(Value::Map(result))
}
fn consume_fuel(&mut self, amount: u64, span: Option<Span>) -> Result<(), RuntimeError> {
if let Some(message) = &self.observation_error {
return Err(RuntimeError::new(
@@ -892,3 +1106,20 @@ pub fn arity(span: Option<Span>, name: &str, expected: usize, actual: usize) ->
format!("`{name}` expects {expected} argument(s), got {actual}"),
)
}
/// Project one exact byte span as `{start, end}`.
fn span_value(span: Span) -> Value {
let mut value = BTreeMap::new();
value.insert("start".to_string(), Value::int(span.start as i64));
value.insert("end".to_string(), Value::int(span.end as i64));
Value::Map(value)
}
/// One structured document-access failure (never an execution crash).
fn document_failure(code: &str, message: String) -> Value {
let mut value = BTreeMap::new();
value.insert("ok".to_string(), Value::Bool(false));
value.insert("code".to_string(), Value::text(code.to_string()));
value.insert("message".to_string(), Value::text(message));
Value::Map(value)
}
+21
View File
@@ -230,6 +230,25 @@ const TABLE_ROW: Builtin = Builtin {
named_only: false,
effectful: false,
};
const DOCUMENT_OUTLINE: Builtin = Builtin {
name: "document.outline",
aliases: &[],
params: &[opt("module"), opt("parent"), opt("limit")],
named_only: false,
effectful: false,
};
const DOCUMENT_READ: Builtin = Builtin {
name: "document.read",
aliases: &[],
params: &[
req("module"),
req("unit"),
opt("expected_digest"),
opt("max_bytes"),
],
named_only: false,
effectful: false,
};
const RESOURCE_OPEN: Builtin = Builtin {
name: "resource.open",
aliases: &[],
@@ -315,6 +334,8 @@ pub const BUILTINS: &[Builtin] = &[
TABLE_COLUMNS,
TABLE_ROW,
TABLE_CELL,
DOCUMENT_OUTLINE,
DOCUMENT_READ,
RESOURCE_OPEN,
RESOURCE_READ,
RESOURCE_WRITE,
+25
View File
@@ -0,0 +1,25 @@
//! Embed the release source commit when the build supplies it.
//!
//! `marqdo inspect --environment --json` reports the adjacent worker build
//! identity through the worker's offline `--build-info` command. The commit is
//! optional: a development build reports `null` rather than a guessed SHA.
fn main() {
println!("cargo:rerun-if-env-changed=MARQDO_BUILD_SOURCE_SHA");
let Ok(sha) = std::env::var("MARQDO_BUILD_SOURCE_SHA") else {
return;
};
let sha = sha.trim();
let valid = sha.len() == 40
&& sha
.chars()
.all(|ch| ch.is_ascii_hexdigit() && !ch.is_ascii_uppercase());
if valid {
println!("cargo:rustc-env=MARQDO_BUILD_SOURCE_SHA={sha}");
} else {
println!(
"cargo:warning=MARQDO_BUILD_SOURCE_SHA is not a full lowercase 40-hex commit; \
the worker build-info will not claim a source commit"
);
}
}
+27
View File
@@ -14,6 +14,15 @@ const ABI_VERSION: u32 = 1;
const MAX_FRAME_BYTES: usize = 1024 * 1024;
const ERROR_MAX: usize = 1024;
/// Offline build identity printed by `--build-info`.
///
/// `marqdo inspect --environment --json` runs this single-shot command to
/// report the adjacent worker version/SHA without opening a provider session
/// (marqdo-cli#26 §9.2).
const BUILD_INFO_SCHEMA: &str = "marqdo.build-info";
const BUILD_INFO_SCHEMA_VERSION: u32 = 1;
const BUILD_SOURCE_SHA: Option<&str> = option_env!("MARQDO_BUILD_SOURCE_SHA");
type AbiVersionFn = unsafe extern "C" fn() -> u32;
type OpenFn = unsafe extern "C" fn(*const c_char, *const c_char, *const c_char, *mut u64) -> i32;
type ReadFn = unsafe extern "C" fn(u64, *mut u8, u32, *mut u32, *mut i32) -> i32;
@@ -144,7 +153,25 @@ fn fail(message: &str) -> Json {
json!({"ok": false, "code": "host.error", "message": message})
}
/// Print one deterministic build-identity document and exit.
fn print_build_info() {
println!(
"{}",
json!({
"schema": BUILD_INFO_SCHEMA,
"schema_version": BUILD_INFO_SCHEMA_VERSION,
"product": "marqdo-provider-worker",
"version": env!("CARGO_PKG_VERSION"),
"source_sha": BUILD_SOURCE_SHA,
})
);
}
fn main() {
if std::env::args_os().nth(1).as_deref() == Some(std::ffi::OsStr::new("--build-info")) {
print_build_info();
return;
}
let Some(path) = std::env::args_os().nth(1) else {
eprintln!("usage: marqdo-provider-worker <c-abi-library>");
std::process::exit(2);
@@ -154,6 +154,19 @@ pub(crate) fn dispatch(
&module,
)
}
"document.outline" => {
let target = optional_text(&bound, "module", builtin, span)?;
let parent = optional_text(&bound, "parent", builtin, span)?;
let limit = optional_count(&bound, "limit", builtin, span)?;
interpreter.host_document_outline(target, parent, limit, span, &module)
}
"document.read" => {
let target = required_text(&bound, "module", builtin, span)?;
let unit = required_text(&bound, "unit", builtin, span)?;
let digest = optional_text(&bound, "expected_digest", builtin, span)?;
let max_bytes = optional_count(&bound, "max_bytes", builtin, span)?;
interpreter.host_document_read(target, unit, digest, max_bytes, span, &module)
}
"memory.new" => {
let initial_pages = page_count(take(&bound, "initial_pages", builtin, span)?, span)?;
let max_pages = page_count(take(&bound, "max_pages", builtin, span)?, span)?;
@@ -453,6 +466,63 @@ pub(crate) fn dispatch(
}
}
fn required_text(
bound: &BTreeMap<String, Value>,
name: &str,
builtin: &Builtin,
span: Option<Span>,
) -> Result<String, RuntimeError> {
match take(bound, name, builtin, span)? {
Value::Text(text) => Ok(text),
_ => Err(RuntimeError::type_error(
span,
format!("`{}` argument `{name}` must be Text", builtin.name),
)),
}
}
fn optional_text(
bound: &BTreeMap<String, Value>,
name: &str,
builtin: &Builtin,
span: Option<Span>,
) -> Result<Option<String>, RuntimeError> {
match bound.get(name) {
None => Ok(None),
Some(Value::Text(text)) => Ok(Some(text.clone())),
Some(_) => Err(RuntimeError::type_error(
span,
format!("`{}` argument `{name}` must be Text", builtin.name),
)),
}
}
fn optional_count(
bound: &BTreeMap<String, Value>,
name: &str,
builtin: &Builtin,
span: Option<Span>,
) -> Result<usize, RuntimeError> {
match bound.get(name) {
None => Ok(0),
Some(Value::Int(value)) => num_traits::ToPrimitive::to_usize(value)
.filter(|value| *value > 0)
.ok_or_else(|| {
RuntimeError::type_error(
span,
format!(
"`{}` argument `{name}` must be a positive Int",
builtin.name
),
)
}),
Some(_) => Err(RuntimeError::type_error(
span,
format!("`{}` argument `{name}` must be Int", builtin.name),
)),
}
}
fn take(
bound: &BTreeMap<String, Value>,
name: &str,
+41
View File
@@ -974,6 +974,47 @@ impl<'a> Interpreter<'a> {
}
/// Call a builtin-read host operation on behalf of a frame's module.
pub(crate) fn host_document_outline(
&mut self,
module: Option<String>,
parent: Option<String>,
limit: usize,
span: Option<Span>,
caller: &ModuleId,
) -> Result<Value, RuntimeError> {
let context = ExecutionContext::new(caller.to_string(), span);
self.host
.document_outline(module.as_deref(), parent.as_deref(), limit, &context)
.map_err(|mut error| {
error.mark_callsite();
error
})
}
pub(crate) fn host_document_read(
&mut self,
module: String,
unit: String,
expected_digest: Option<String>,
max_bytes: usize,
span: Option<Span>,
caller: &ModuleId,
) -> Result<Value, RuntimeError> {
let context = ExecutionContext::new(caller.to_string(), span);
self.host
.document_read(
&module,
&unit,
expected_digest.as_deref(),
max_bytes,
&context,
)
.map_err(|mut error| {
error.mark_callsite();
error
})
}
pub(crate) fn host_invoke(
&mut self,
op: HostOp,
+8
View File
@@ -78,6 +78,14 @@ pub mod codes {
pub const REF_INVALID: &str = "ref.invalid";
/// A Markdown reference target was not verified by the current catalog.
pub const REF_NOT_LOADED: &str = "ref.not_loaded";
/// The installed stdlib Bundle cannot be read (`inspect --environment`).
pub const ENV_STDLIB_UNREADABLE: &str = "env.stdlib_unreadable";
/// The installed stdlib Bundle is not a current verified Bundle.
pub const ENV_STDLIB_INVALID: &str = "env.stdlib_invalid";
/// The installed stdlib Bundle does not match its declared digest.
pub const ENV_STDLIB_DIGEST_MISMATCH: &str = "env.stdlib_digest_mismatch";
/// The adjacent provider worker did not report its build identity.
pub const ENV_WORKER_INFO_UNAVAILABLE: &str = "env.worker_info_unavailable";
/// The requested math operation is outside the supported subset.
pub const MATH_UNSUPPORTED: &str = "math.unsupported";
/// A foreign language kernel is not available on this machine.
+8 -2
View File
@@ -25,7 +25,7 @@
| 公开版本 | `Cargo.toml` 仍为 `0.1.0`,若干工具兼容样例 `<1` | 3.0.0-beta 发布前必须迁移验证 |
| 第三方入门 | README 有扩展示例、`spec/` 有协议;Tool v1 标头仍称 Proposed,plugin spec 某段称 Native only | 需要整合并去除失效状态文本 |
## 3. 两套必须明确分开的发布策略
## 3. 各发行阶段的发布策略
### 3.1 Beta(允许明确声明的非安全性缺口)
@@ -45,11 +45,17 @@
**可延期至后续 Beta 或稳定版:** Windows Native/Worker ABI、macOS Provider Worker、strict L2、uv/npm 自动建环境、分布式 registry、JIT、内置 Knowledge/Proof/View、成熟异步/并发模型、未经承诺的平台安装包。明确注明项目默认 `project` 模式不是 OS 沙箱,Worker 也不是完整沙箱。
### 3.2 Stable / LTS(不可用 Beta 例外替代)
### 3.2 RC
- 同 SHA 的归档烟测实际验证 strict 不可用时安全拒绝运行,经维护者批准后,RC 可按 `strict: unsupported` 发行。发布索引、支持范围及门禁记录仍绑定同一候选。通过标准与命令见 [发布手册](releasing.md#linux-rc-preconditions)。
- 已观测的隔离缺陷、未运行的烟测、过期证据均阻塞 RC。具备合格一次性 VM 后按同 SHA 取得 strict PASS,可声明相应支持。
### 3.3 Stable / LTS
- Stable `3.0.0`:在公开支持的 Linux 平台上所有承诺功能有安全/兼容/性能证据;公开协议与变更策略清楚;有迁移说明和至少一次真实使用者反馈周期。平台可继续限定 Linux,不要求通过虚假的“全平台 LTS”门禁。
- LTS(建议后续 `3.2.x`):冻结 `.mq.md` 语言语义、Analysis/Trace/Tool/Plugin/Provider 各自协议主版本和 lockfile 契约;提供安全修复流程、回归 CI、外部仓库兼容矩阵、从 3.0 及 2.9 迁移材料、发布渠道与公告模板。
- LTS 应提前承诺支持窗口(建议至少 12 个月,实际长短由维护资源决定),定义安全补丁与非破坏性修复回移规则,明确 API/ABI 哪些会不兼容;不因开发完成某一里程碑自动称 LTS。
- 一次性 VM 上的同 SHA strict G3 通过证据是 stable/LTS 的发布门禁。
- 默认不为旧 `cflmy/marqdo` 的历史语法或旧插件 ABI 建隐性兼容层。需要迁移的由独立迁移工具、教程和示例承担。
## 4. 3.0.0-beta.1 之前建议拆分的 5 个短 PR
+103 -23
View File
@@ -1,18 +1,16 @@
# Marqdo Implementation Status
Snapshot: **2026-11-25**, product version **`3.0.0-rc.4`** (prerelease,
released). Tag `v3.0.0-rc.4` at source SHA
**`452e9a32bd9e40dba427d4180691c58bab74449e`**; release:
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`**; release:
https://git.cflmy.cn/cflmy/marqdo-cli/releases/tag/v3.0.0-rc.3. The supported
platform is **Linux x86_64 (glibc 2.39)**. The rc.3 same-SHA gate aggregate is
[`evidence/ci/1e2a045cc78bf40972181abb44e7117c56cf4401/manifest.json`](evidence/ci/1e2a045cc78bf40972181abb44e7117c56cf4401/manifest.json)
(decision `RC_RELEASE_CANDIDATE`); its binary hashes are in that archive's
`RELEASE_INFO.json`, not in the rc.4 candidate. Previous prereleases:
`3.0.0-rc.2` at `9149ee40a48fcda692c5c112f66c465487d13dfb` and
`3.0.0-beta.1` at `2c7c4f31e7a388d3fcfa717a77067e696ed13854`. Do not copy a
SHA from a plan.
Snapshot: **2026-11-28**, product version **`3.0.0-rc.6`** (prerelease,
release candidate). Tag `v3.0.0-rc.6` on the tested release commit; release:
https://git.cflmy.cn/cflmy/marqdo-cli/releases/tag/v3.0.0-rc.6. The previous
release is `3.0.0-rc.5` at source SHA
**`c44b0f943875d563bb7c170f8ccd3fd56a82360f`**; release:
https://git.cflmy.cn/cflmy/marqdo-cli/releases/tag/v3.0.0-rc.5. The supported
platform is **Linux x86_64 (glibc 2.39)**. The RC.6 gate aggregate
(`RC_RELEASE_CANDIDATE`) is generated by `tools/ci/release_evidence.py`; the
same-SHA CI and evidence references are recorded in CLI issue #22 and the
release assets. Previous prereleases are recorded in their tagged release
notes; do not copy a SHA from a plan.
Current architecture overview:
[`architecture/CURRENT.md`](architecture/CURRENT.md).
@@ -21,9 +19,10 @@ Authoritative release policy:
evidence). Support matrix: [`../COMPATIBILITY.md`](../COMPATIBILITY.md).
Developer entry point: [`developers/README.md`](developers/README.md).
The rc.4 same-SHA gate aggregate is
The historical rc.4 same-SHA gate aggregate remains at
[`evidence/ci/452e9a32bd9e40dba427d4180691c58bab74449e/manifest.json`](evidence/ci/452e9a32bd9e40dba427d4180691c58bab74449e/manifest.json)
(decision `RC_RELEASE_CANDIDATE`). This file records what was actually executed.
(decision `RC_RELEASE_CANDIDATE`); it is not rc.6 evidence. This file records
what was actually executed.
"Implemented" does not mean "verified on every platform"; the evidence column
says which commands were run and where. Status is generated from executed commands/logs; a gate row without a
command, log or source path is a defect, not a state. Historical snapshots
@@ -33,11 +32,16 @@ as current status.
## RC candidate
The workspace reports `3.0.0-rc.4` and declares Rust 1.89 as its locked
minimum. Linux x86_64 on glibc 2.39 is the supported platform. The rc.4
manifest is green on its SHA with the documented strict-VM PASS and a
maintainer-approved shared-node performance `WARN`; stable/LTS still requires a
dedicated fixed node. The release records below refer to their tagged binaries.
The workspace reports `3.0.0-rc.6` and declares Rust 1.89 as its locked
minimum. Linux x86_64 on glibc 2.39 is the supported platform. rc.6 binds the
release archive, checksum, tested source SHA and actual external Bundle inputs
in `release-evidence.json`; the same-SHA Woodpecker `main` gate, deterministic
archive build, archive-only Ubuntu 24.04 cold install, migrated extensions,
frozen external conformance and a shared-host performance `WARN` are recorded
in CLI issue #22. The RC records `strict: unsupported` with same-SHA fail-closed
smoke evidence; a disposable-VM strict L1 PASS remains a stable/LTS gate, and
the shared-host performance exception does not carry over to stable/LTS. The
release records below refer to their tagged binaries.
## Current protocol integration
@@ -75,6 +79,57 @@ The `spec/` tree contains only current contracts; retired specifications are in
Git history and tagged archives. The earlier release records below describe
their tagged binaries and are not current protocol claims.
## 0.14 Runtime document access — issue #24 (unreleased)
Ordinary `.mq.md` programs can now read the loaded document snapshot through
`document.outline(module?, parent?, limit?)` and
`document.read(module, unit, expected_digest?, max_bytes?)`. The snapshot is
built during `prepare` from the same load as Analysis: canonical module/unit
ids, anchors, exact UTF-8 spans, source digests and source text; reads are pure
byte slices and never open files, parse Markdown, load modules dynamically or
execute project code. Expected states (not loaded, unknown unit, stale digest,
over budget) return structured `document.*` codes so programs can branch.
Spec: [`spec/document-access.md`](../spec/document-access.md); ADR-0074; tests:
`crates/cli/tests/document_access.rs` (Analysis-consistency, anchor/UTF-8 and
negative cases). No Analysis/Observation/Tool protocol change.
## 0.13 Document structure contract — issue #25 (unreleased)
[`spec/document-structure.md`](../spec/document-structure.md) now states the
current author/tool semantics in one place: heading mode inheritance (nearest
ancestor, never a sibling; only Exec H2 callable), unit identity and
`sem.duplicate_unit_name`, anchor slug collision numbering, byte-exact
half-open spans (BOM/CRLF/missing final newline), `index.mq.md` entry vs
directory-dependency import meaning, and the link ≠ import ≠ call separation.
It links the authoritative `mapping.md`/`analysis.md`/`references.md`/
`package-format.md` facts instead of duplicating them, marks heading annotations
as Proposed (not implemented) and lists the Analysis fields consumers may rely
on. Contract tests: `crates/cli/tests/document_structure.rs` (6 cases) plus
`docs_consistency`. No document-language syntax was added; no runtime behavior
changed.
## 0.12 Installed-environment diagnostic report — issue #26 §9.2 (unreleased)
`marqdo inspect --environment --json` emits the `marqdo.environment` v1 report:
product version, build-embedded source commit, platform (including the real
strict probe and glibc version), adjacent provider-worker build identity,
verified Bundle name/version/tree digest, current protocol revisions and
path-free diagnostics. It is offline and project-independent: it does not load
a module, start a provider session, open a plugin or print a path/credential.
* Spec: [`spec/environment.md`](../spec/environment.md).
* Tests: `crates/cli/tests/environment_report.rs` (schema, determinism,
no-leak, verified/invalid Bundle, argument exclusivity) and unit tests in
`crates/cli/src/environment.rs`.
* Release binding: the release build embeds `MARQDO_BUILD_SOURCE_SHA`;
`tools/release/package.py` refuses an archive whose binary reports another
commit, and `tools/release/smoke.py` re-verifies the extracted archive. CI's
`build` lane exports the variable before `cargo build --release`.
* Window/macOS native lanes are **UNVERIFIED**; the report is Linux-verified
only. This work is not part of the tagged rc.6 release record.
* Evidence: [`evidence/2026-11-30-cli-environment-and-document-contract.md`](evidence/2026-11-30-cli-environment-and-document-contract.md)
(source gates, workspace tests, archive identity binding and smoke PASS).
## 0.11 Explicit stdlib Bundle input — issue #11 Phase A (unreleased)
Phase A lands the build-input boundary only: the stdlib production sources and
@@ -118,7 +173,7 @@ evidence named by issue #11.
## 0.12 Engine / Host Contract boundary — issue #13 (unreleased candidate)
This is an **internal architecture candidate**, not a release. The product
version stays `3.0.0-rc.4`; no new tag or release claim is made. Baseline is
version stays `3.0.0-rc.5`; no new tag or release claim is made. Baseline is
`master` at `4bbefc92449ee480c8a2c89b0308feb4cda8d0e7`; the PR records the exact
candidate SHA and evidence is
[`evidence/2026-11-26-issue-13-engine-host-boundary.md`](evidence/2026-11-26-issue-13-engine-host-boundary.md).
@@ -193,6 +248,31 @@ This is an architecture correction, not a product/protocol change. Decision:
- ADR-0072 and the old issue-#15 evidence carry Superseded banners. The remote
replica is gone; Git history retains the decision/implementation record.
## 0.14 External ecosystem stdlib Bundle — issue #11 Phase B (unreleased candidate)
Phase B finishes the extraction ADR-0070 prepared: this repository has **no**
`stdlib/` source tree and no compile-time source fallback. The accepted Bundle
identity is the ecosystem pin:
`marqdo-stdlib@0.2.0`, source `cflmy/marqdo@48189243f7`, tree digest
`sha256:db905508...`, aliases digest `sha256:5f513c0f...` (17 modules, no
component self-tests). `tools/stdlib/bundle.py` requires an explicit
`--stdlib-dir`/`MARQDO_TEST_STDLIB_BUNDLE` for the accepted Bundle;
`tools/ci/fetch_ecosystem_bundle.py` materializes it from the pinned root
commit and component gitlinks.
Moved with their ownership: module self-tests and domain behaviour tests live
in the component repositories (six std repos, `marqdo-ext-http`,
`marqdo-ext-regex`, `marqdo-ext-archive`); the CLI product lane now verifies
the accepted Bundle's public surface and official `print`/`打印` routing
(`tests/product-stdlib/`), and the Table-split / print-format composition
assertions live in the root Bundle acceptance. The generic TCP endpoint
round-trip stays a CLI test (`tcp_round_trip.rs`); the HTTP-over-TCP domain
test moves to the HTTP package owner.
Runtime discovery is now only `MARQDO_STDLIB_DIR` then the installed sibling
`stdlib/` (no debug fallback). Bundle release packaging still ships the Bundle
next to the CLI, so installed behaviour is unchanged.
## 0.10 Closed public Analysis boundary — issue #10 (RC.4 released)
The candidate replaces the program-only Analysis projection in place under
@@ -205,7 +285,7 @@ Local evidence and raw numbers:
[`evidence/2026-11-25-rc.4-analysis-boundary.md`](evidence/2026-11-25-rc.4-analysis-boundary.md).
Executed 2026-11-25 in the local Linux x86_64 development container
(workspace `3.0.0-rc.4`, Rust 1.100.0):
(workspace `3.0.0-rc.5`, Rust 1.100.0):
```text
cargo fmt --all -- --check PASS
@@ -237,7 +317,7 @@ is a maintainer-approved shared-node `WARN` for this RC only; stable/LTS still
requires a dedicated fixed node. The gate aggregate is
[`evidence/ci/452e9a32bd9e40dba427d4180691c58bab74449e/manifest.json`](evidence/ci/452e9a32bd9e40dba427d4180691c58bab74449e/manifest.json)
(`RC_RELEASE_CANDIDATE`). Release
[notes and assets](https://git.cflmy.cn/cflmy/marqdo-cli/releases/tag/v3.0.0-rc.4).
[notes and assets](https://git.cflmy.cn/cflmy/marqdo-cli/releases/tag/v3.0.0-rc.5).
Downstream migration issues: `marqdo-view#6`, `marqdo-lint#4`.
## 0.9 Pre-stable protocol convergence — issue #8 (RC.3 candidate)
@@ -1,6 +1,7 @@
# ADR-0070 — One explicit stdlib Bundle build input (Phase A)
Status: **Accepted for implementation on the 3.0 prerelease line** (2026-11-26).
Status: **Phase A accepted and implemented (2026-11-26); Phase B accepted and
implemented on the 3.0 prerelease line (2026-11-27).**
Relates to: issue
[#11](https://git.cflmy.cn/cflmy/marqdo-cli/issues/11), ADR-0028 (bundled
stdlib and `std:` imports), ADR-0039 (deferred extraction), ADR-0058 (public
@@ -99,6 +100,31 @@ replacement evidence named by issue #11. This ADR records the Phase A input
boundary only; it does not authorize deleting sources or changing `std:`
semantics.
## Phase B implementation (2026-11-27)
The gate above was met by ecosystem issue #9's candidate combination, so the
pin and CI changed and the sources were removed:
* `tools/stdlib/bundle-pin.json` names
`source.kind = "ecosystem"`, `repository = cflmy/marqdo`, the exact root
commit that pins the component gitlinks, and the accepted digests. The pin no
longer records a vendored `source.path`.
* `crates/cli/src/stdlib.rs` has no compile-time source fallback in any build
profile; discovery is `MARQDO_STDLIB_DIR` then the installed sibling Bundle.
* The in-repo `stdlib/` tree is deleted. Module sources, self-tests and domain
behaviour tests live in the component repositories.
* `tools/ci/fetch_ecosystem_bundle.py` materializes the pinned Bundle from the
ecosystem root commit + stdlib gitlinks and verifies it against the pin;
Woodpecker and GitHub CI use it before product tests, packaging and
performance lanes.
* Product tests (`crates/cli/tests/stdlib_product.rs`) verify the CLI's own
responsibility against the external Bundle: required public surface,
`std:` execution and official alias routing. Composition fixtures whose
ownership is the ecosystem (Table split, print-format equivalence) live in
the root Bundle acceptance; removed CLI tests were not replaced by mocks.
* A missing `MARQDO_TEST_STDLIB_BUNDLE` fails the product lane closed; the
product contract never reads a sibling source tree.
## Consequences
* A packaging run can be pointed at a downloaded or separately built Bundle and
+84
View File
@@ -0,0 +1,84 @@
# ADR-0074 — Read-only loaded-document snapshot and two runtime document builtins
Status: **Accepted** (2026-11-30).
Related: [marqdo-cli#24](https://git.cflmy.cn/cflmy/marqdo-cli/issues/24),
`marqdo-ext-ai#2` (AI-U1), [ADR-0064](0064-new-builtin-hostop-value-and-top-level-command-policy.md),
[ADR-0069](0069-public-analysis-boundary.md), [ADR-0071](0071-engine-host-contract-boundary.md).
## Context
The public Analysis revision 3 projection already lets external tools see every
loaded module, unit identity, anchor and exact UTF-8 span. Ordinary `.mq.md`
programs have no equivalent runtime access: `ref("#anchor")` returns an inert
`Formula | Code | FunctionRef`, and there is no way to walk the loaded heading
tree or read one exact section without copying the CLI parser or reading host
files privately. The AI extension (AI-U1 / I08: select anchor → read exact
section → judge → compute → explain) is blocked on this, and any ordinary
document-navigation program has the same gap.
The engine must not read files or parse Markdown. The loader already holds one
immutable snapshot (`prepare` = the same load used by `check`, `run`, `call`,
`inspect` and Analysis), so the missing piece is a controlled projection of that
snapshot through the neutral Host contract.
## Decision
1. The composition root builds a read-only `DocumentModule` snapshot in the
`prepare`-derived load: canonical module id, exact source text, lowercase
SHA-256 source digest, and units in document order with canonical unit id,
path, parent id, level, effective mode, anchors, complete section span and
heading span. Only modules already loaded for this run are included (entry
plus explicit import closure); nothing is read from disk again.
2. `marqdo-host-contract` gains the neutral snapshot types and two default-
unavailable Host methods:
`document_outline(module?, parent?, limit)` and
`document_read(module, unit, expected_digest?, max_bytes)`.
The native host serves them from the snapshot; the embedded/test host may
leave them unavailable.
3. Two pure builtins expose them to programs: `document.outline` (all optional
`module`, `parent`, `limit`) and `document.read` (`module`, `unit`, optional
`expected_digest`, `max_bytes`). Both return structured result maps
(`{ok: true, ...}` / `{ok: false, code, message}`) so callers can branch on
stale sources, unknown units or budget failures instead of crashing.
4. Specification: `spec/document-access.md`; builtin table in
`spec/evaluation.md` §8. Analysis is unchanged; the snapshot and the
Analysis projection are produced from the same load and must agree on
module/unit ids, source digests and byte spans (contract test).
## Boundaries
- The engine continues to depend only on `marqdo-host-contract`; it never sees
the loader, filesystem, Markdown AST or host paths.
- The host only slices the immutable source by the frontend's exact section
span; it does not parse, normalise, execute `@knowledge`, expand links, or
start workers/models.
- No dynamic import, no extra files, no absolute paths, no second knowledge
body: the snapshot exposes only already-loaded modules, and the returned text
is the exact source slice.
- Budgets are explicit and bounded: outline limit (default 1024, max 4096),
read `max_bytes` (default 256 KiB, max 1 MiB), snapshot module count (128) and
total source bytes (16 MiB). Over-budget requests/installations report
`document.too_large`, never silent truncation.
## Rejected alternatives
- **Exposing host paths or a file-read builtin**: would let programs read
arbitrary files and bypass the package/import authority model.
- **A CLI Tool subprocess for reading**: adds a process boundary and a second
protocol for an in-process, already-loaded fact.
- **Copying the Markdown/unit index into the runtime**: duplicates the parser
and violates ADR-0071; the frontend already owns the authoritative index.
- **Returning runtime errors for expected states**: stale/unknown/too-large are
expected data states in document workflows; structured result maps let
ordinary control flow decide.
## Consequences
- AI-U1 can read exact sections from the same snapshot as Analysis; the AI
extension keeps its context boundary and does not need a second index.
- Ordinary programs can implement catalog/read/navigation flows with the same
bytes that `check --emit` reports.
- A new public builtin and Host surface exist; they are read-only and do not
add capabilities, grants, network access or execution paths.
- Future changes to unit identity/span semantics remain CLI-owned and must keep
this contract in lockstep.
+1 -1
View File
@@ -4,7 +4,7 @@ Status: **current architecture overview**. This file summarises the tree as it
is today. It is not a release promise, does not reopen a frozen ADR, and does not
replace `spec/` or a recorded test log.
- Baseline: `452e9a32bd9e40dba427d4180691c58bab74449e` (2026-11-25, tagged `v3.0.0-rc.4`; same-SHA evidence in `../STATUS.md` and `../evidence/ci/452e9a32bd9e40dba427d4180691c58bab74449e/manifest.json`).
- Baseline: `c44b0f943875d563bb7c170f8ccd3fd56a82360f` (rc.5, last published); the rc.6 release-candidate changes and same-SHA evidence are recorded in `../STATUS.md` and CLI issue #22.
- Normative behavior: `spec/`; frozen decisions: `docs/adr/`; executed evidence: `docs/STATUS.md` and `docs/evidence/`.
- This is the **single current overview**. Do not add a second running "current state" file;
update this file, `docs/STATUS.md` and an evidence file together.
+8 -7
View File
@@ -22,14 +22,15 @@ Bundle, runs the from-archive smoke and the frozen external conformance suite.
```text
contract (rust:1.100-bookworm, python3-jsonschema, both shipped binaries):
cargo build --locked -p marqdo-cli -p marqdo-provider-worker
real CLI check/run over the Observation fixtures
bash tools/ci/contract_lane.sh (real CLI check/run over the Observation fixtures)
analysis_consumer / observation_consumer / validate_protocols
stream==snapshot assertion (tools/ci/verify_observation_stream.py)
stale-Analysis rejection
dependency-direction gate (tools/ci/check_dependency_boundaries.py)
test (rust:1.100-bookworm, clippy/rustfmt, Node.js 22, MinGW, both binaries):
python3 tools/stdlib/bundle.py (verify the pinned Bundle)
python3 tools/ci/fetch_ecosystem_bundle.py (materialize the pinned ecosystem Bundle)
python3 tools/stdlib/bundle.py --stdlib-dir target/ecosystem-stdlib
cargo fmt --all -- --check
cargo clippy --workspace --all-targets -- -D warnings
cargo build --locked -p marqdo-provider-worker
@@ -44,7 +45,7 @@ test (rust:1.100-bookworm, clippy/rustfmt, Node.js 22, MinGW, both binaries):
cargo check --workspace --all-targets --target x86_64-pc-windows-gnu
independent-build (rust:1.100-bookworm, git, python3):
git archive HEAD, remove stdlib/, no ecosystem checkout
git archive HEAD, no stdlib source tree exists, no ecosystem checkout
cargo build --locked -p marqdo-cli -p marqdo-provider-worker
language-only check/call through the built CLI
stdlib-dependent run must fail closed; no stdlib/ next to the binary
@@ -54,7 +55,7 @@ minimum-rust (rust:1.89-bookworm):
build (depends on test, minimum-rust, contract):
cargo build --release --locked -p marqdo-cli -p marqdo-provider-worker
python3 tools/stdlib/bundle.py; package --stdlib-dir stdlib --bundle-pin ...
materialize the pinned Bundle; package --stdlib-dir target/ecosystem-stdlib --bundle-pin ...
from-archive smoke (tools/release/smoke.py)
frozen external conformance (tools/ci/run_frozen_extensions.sh, 7/7)
```
@@ -108,9 +109,9 @@ syntax; Debian bookworm's Node 18 fails those tests.
`cargo check --workspace --all-targets --target x86_64-pc-windows-gnu`
compile gate (native Windows/macOS runtime lanes stay on the GitHub matrix).
* **ADR-0070 explicit Bundle:** the `test` lane verifies
`tools/stdlib/bundle-pin.json` and runs the product suite once with an
explicit `MARQDO_TEST_STDLIB_BUNDLE`; the new `independent-build` lane builds
both binaries from a copy without `stdlib/` and requires the stdlib-dependent
`tools/stdlib/bundle-pin.json`, materializes the pinned ecosystem Bundle and
runs the product suite with an explicit `MARQDO_TEST_STDLIB_BUNDLE`; the
`independent-build` lane builds both binaries with no Bundle checkout and requires the stdlib-dependent
program to fail closed.
* The Woodpecker **build** lane and the GitHub **release-candidate** lane build
`marqdo` **and** `marqdo-provider-worker` and package both as siblings; the
+1 -1
View File
@@ -209,7 +209,7 @@ counts, harness responsibilities and known observations.
## 5. Coding conventions
* Rust edition 2021, `rust-version = 1.89`, workspace version `3.0.0-rc.4`.
* Rust edition 2021, `rust-version = 1.89`, workspace version `3.0.0-rc.6`.
* `unsafe` is forbidden in pure crates (for example `marqdo-expression` uses
`#![forbid(unsafe_code)]`); the ABI/loader crates contain the only
`unsafe` code and every block has a SAFETY comment explaining the contract.
+14 -3
View File
@@ -6,7 +6,7 @@ Rust structures, `marqdo-ir` internals, `inspect --ir`, relative paths into the
core checkout, or host memory layout. Adding a new domain function must not
require a core commit.
Product version for these docs: **`3.0.0-rc.4`** (Linux x86_64 candidate).
Product version for these docs: **`3.0.0-rc.6`** (Linux x86_64 candidate).
Current protocol contracts: Analysis, Observation, CLI Tool, Plugin ABI v1,
Foreign wire v1, Provider manifest v2, lock v4 and markdown profile
`marqdo.md.v1`. Product, protocol and package versions are independent; see
@@ -40,9 +40,15 @@ Foreign wire v1, Provider manifest v2, lock v4 and markdown profile
providers, extension selection and lock v4.
5. [analysis-observation.md](analysis-observation.md) — the public static/dynamic data
contracts and digest binding.
6. [compatibility.md](compatibility.md) — version axes, platform matrix and the
6. [document-structure.md](../../spec/document-structure.md) — heading modes,
units/anchors/spans, `index.mq.md` entry meaning and the link≠import≠call
separation (single author/tool overview).
7. [document-access.md](../../spec/document-access.md) — runtime
`document.outline`/`document.read` over the prepared snapshot: exact units,
spans, source digests and structured failure codes (ADR-0074).
8. [compatibility.md](compatibility.md) — version axes, platform matrix and the
prerelease policy.
7. [release-limits.md](release-limits.md) — the honest beta limitations (this
9. [release-limits.md](release-limits.md) — the honest beta limitations (this
file ships in the archive as `KNOWN_LIMITATIONS.md`).
The full worked handbook is
@@ -82,8 +88,13 @@ export MARQDO_BIN=/absolute/path/to/marqdo
# Put marqdo-provider-worker next to it for provider tests, exactly as the
# release archive does.
$MARQDO_BIN --version
$MARQDO_BIN inspect --environment --json # version, embedded source SHA, Bundle, protocols
```
The environment report is the supported way to record which CLI/Bundle a
consumer tested against; see [`../../spec/environment.md`](../../spec/environment.md).
It reads only installed identity and prints no host paths or credentials.
Compute the binary SHA-256 before and after your suite; it must not move. The
reference implementation of this gate is
[`marqdo-extension-conformance`](https://git.cflmy.cn/cflmy/marqdo-extension-conformance)
+3 -3
View File
@@ -6,9 +6,9 @@ This page summarizes the public support policy. The authoritative matrix is
## Version axes (do not conflate)
| Axis | `3.0.0-rc.4` value | Change rule |
| Axis | `3.0.0-rc.6` value | Change rule |
|---|---|---|
| Product / CLI | `3.0.0-rc.4` (candidate) | SemVer prerelease. See `CHANGELOG.md` for changes from the beta. |
| Product / CLI | `3.0.0-rc.6` (candidate) | SemVer prerelease. See `CHANGELOG.md` for changes from the beta. |
| Analysis | v3 | One writer and one current major for every project. New major for incompatible changes; consumers reject unknown majors. |
| Observation | v1 | One `run_id`/`seq` event sequence per execution; JSONL, JSON snapshot and file snapshot come from the same run. New major for incompatible required-field/ordering/redaction changes. |
| CLI Tool | revision 1 | Exact `requires.api_revision` plus optional exact `analysis`/`observation` integers; no version arrays or negotiation. |
@@ -41,7 +41,7 @@ values are off by default, and `--mode strict` refuses `--output jsonl` and
## Language compatibility
`3.0.0-rc.4` implements RFC-LANG-0002 only. Pre-RFC `.mq.md` source
`3.0.0-rc.6` implements RFC-LANG-0002 only. Pre-RFC `.mq.md` source
(Strong-execute / Emph-return / ordered-list branch / bullet-list loop /
block-quote call / first code-span signature) is **not executable**; there is no
`--legacy`, syntax switch or downgrade path. Migration is a rewrite task
+1 -1
View File
@@ -113,7 +113,7 @@ keyword or built-in. The selected provider is verified (schema version, target,
artifact SHA-256, duplicate kind, grant) before the sibling
`marqdo-provider-worker` starts; a missing helper is
`ext.worker_unavailable` and never falls back to `PATH` or in-process loading.
Linux x86_64 only for this beta; not an OS sandbox. Runnable example:
Linux x86_64 only for this prerelease line; not an OS sandbox. Runnable example:
`examples/provider-demo/` (build with its `build.sh`; the tracked manifest has a
zero digest template). Normative contract:
[`../../spec/resource-provider-v2.md`](../../spec/resource-provider-v2.md).
+5 -5
View File
@@ -1,15 +1,15 @@
# Quickstart: install and run
Product: `3.0.0-rc.4` (Linux x86_64 candidate). Install a **release archive**, not
Product: `3.0.0-rc.6` (Linux x86_64 candidate). Install a **release archive**, not
a source checkout, when you only consume Marqdo.
## 1. Install the archive
```bash
sha256sum -c marqdo-3.0.0-rc.4-x86_64-unknown-linux-gnu.tar.gz.sha256
tar -xzf marqdo-3.0.0-rc.4-x86_64-unknown-linux-gnu.tar.gz
cd marqdo-3.0.0-rc.4-x86_64-unknown-linux-gnu
./marqdo --version # marqdo 3.0.0-rc.4
sha256sum -c marqdo-3.0.0-rc.6-x86_64-unknown-linux-gnu.tar.gz.sha256
tar -xzf marqdo-3.0.0-rc.6-x86_64-unknown-linux-gnu.tar.gz
cd marqdo-3.0.0-rc.6-x86_64-unknown-linux-gnu
./marqdo --version # marqdo 3.0.0-rc.6
./marqdo --help
```
+9 -6
View File
@@ -1,4 +1,4 @@
# Marqdo 3.0.0-rc.4 — known limitations
# Marqdo 3.0.0-rc.6 — known limitations
This file ships in the release archive as `KNOWN_LIMITATIONS.md`. It is part of
the release record: it defines the platform and feature scope for the release candidate.
@@ -19,9 +19,12 @@ user and is not a security boundary against hostile code.
## `strict` isolation
`strict` is Linux-only and probe-gated. The RC release requires same-SHA
G3 evidence from a non-root disposable VM. The CLI fails closed when the
runtime probe is unavailable.
`strict` is Linux-only and probe-gated. A stable/LTS release requires
same-SHA G3 evidence from a non-root disposable VM. A release candidate may
record `strict: unsupported` when the packaged archive proves that strict mode
fails closed on the distribution test environment and the maintainer approves
the RC exception; it must not claim an isolation PASS. The CLI fails closed
whenever the runtime probe is unavailable.
Even when available:
@@ -57,11 +60,11 @@ Even when available:
## Compatibility and versioning
* `3.0.0-rc.4` is a **prerelease**. The changelog lists changes from the beta.
* `3.0.0-rc.6` is a **prerelease**. The changelog lists changes from the beta.
* The product version is independent of protocol versions: Analysis,
Observation, CLI Tool, Plugin ABI v1, Foreign wire v1, Provider manifest v2
and lock v4 keep their own identifiers.
* The official bundled stdlib keeps its independent package version `0.1.0`.
* The official bundled stdlib keeps its independent package version `0.3.0`.
A plugin `.mq.md` package version such as `0.1.0` is also independent.
* `project.marqdo` in `marqdo.yaml` is enforced in this release. SemVer
prerelease rules apply: `>=3.0.0,<4.0.0` does **not** accept a prerelease core. Packages and Tools can use a prerelease range such as
+1 -1
View File
@@ -20,7 +20,7 @@ marqdo-view/
examples/
```
`tool.json` for the `3.0.0-rc.4` candidate:
`tool.json` for the `3.0.0-rc.6` candidate:
```json
{
@@ -0,0 +1,76 @@
# Issue #11 Phase B — the accepted Bundle is the ecosystem artifact
Date: 2026-11-27.
Decision: [ADR-0070](../adr/0070-explicit-stdlib-bundle-build-input.md).
Parent: ecosystem issue [#9](https://git.cflmy.cn/cflmy/marqdo/issues/9) and
CLI issue [#11](https://git.cflmy.cn/cflmy/marqdo-cli/issues/11).
This is a **candidate record** for the Phase B change set. The repository has no
`stdlib/` source tree; the accepted Bundle identity is pinned to the ecosystem
root commit. CI evidence is recorded on the PR; the numbers below are the local
candidate host results.
## 1. Bundle identity
```json
{
"schema": "marqdo.stdlib-bundle-pin",
"schema_version": 1,
"name": "marqdo-stdlib",
"version": "0.2.0",
"source": {
"kind": "ecosystem",
"repository": "cflmy/marqdo",
"commit": "48189243f747d5f73d5a38a565010e64e2db74e7",
"producer": "scripts/build-stdlib.py"
},
"tree_digest": "sha256:db905508dde89763b9d43b47fc5d52c6a1d5445a91f3c86a550ced43e8aac9d7",
"aliases_digest": "sha256:5f513c0fdbb3c1e9829be3c9fa23a2d1e89cb8510073fb5eb1e8e2f5265a83bb"
}
```
`tools/ci/fetch_ecosystem_bundle.py` fetches that root commit, initializes the
six stdlib component gitlinks it records, runs the root-owned
`scripts/build-stdlib.py`, and verifies the produced Bundle against the pin.
The CLI never builds the Bundle from a branch or an unknown checkout.
## 2. Source ownership after Phase B
| Source | Owner |
| --- | --- |
| 17 default-Bundle modules (`clock`, `datetime`, `env`, `process`, `random`, `format`, `io*`, `path`, `fs/file`, `data/json`, `data/csv`, `collections/table`, `data/table`, `text*`) | six `marqdo-std-*` repositories |
| HTTP / regex / gzip domain modules | `marqdo-ext-http`, `marqdo-ext-regex`, `marqdo-ext-archive` explicit Packages |
| Module self-tests and domain behaviour tests | the owning component repository |
| Bundle assembly, digest/alias manifest, composition acceptance | `cflmy/marqdo` (root) |
| CLI loader/runtime, `std:` resolution, official alias routing, generic resources | `marqdo-cli` |
Removed from the CLI: `stdlib/` sources and self-tests, the debug source
fallback, `stdlib_http.rs`/`stdlib_table.rs`/`http_over_tcp.rs` domain tests and
the `stdlib/demo.mq.md` formatting test. The print/format equality and Table
split assertions moved to the root composition lane; the generic TCP round-trip
stays a CLI test (`tcp_round_trip.rs`); the HTTP loopback client test follows
the HTTP package owner (tracked as a follow-up on `marqdo-ext-http`).
## 3. Local candidate verification
Host: Linux x86_64, `rustc 1.100.0`, Python 3.14; Bundle materialized by
`tools/ci/fetch_ecosystem_bundle.py --out /root/work/marqdo/.build/cli-ecosystem-bundle`.
| Gate | Command | Result |
| --- | --- | --- |
| Bundle identity | `python3 tools/stdlib/bundle.py --stdlib-dir <bundle>` | PASS (matches pin) |
| Formatting | `cargo fmt --all -- --check` | PASS |
| Lints | `cargo clippy --workspace --all-targets -- -D warnings` | PASS |
| Workspace tests | `MARQDO_TEST_STDLIB_BUNDLE=<bundle> cargo test --workspace --locked` | 72 test binaries, 0 failed |
| Python tool tests | `MARQDO_TEST_STDLIB_BUNDLE=<bundle> python3 -m unittest discover -s tools/ci -p "test_*.py"` | 75 tests, OK |
| Product lane | `cargo test -p marqdo-cli --test stdlib_product` | 4 tests PASS (surface, aliases, `std:` execution, missing-Bundle fail-closed) |
| Independent build | `python3 tools/ci/independent_build.py` | see CI/PR record |
## 4. Unverified / follow-ups
- CI execution of this candidate is the gating evidence; it is recorded on the
PR rather than in this file.
- Release archive cold-install with the new Bundle and the root candidate
promotion are part of MIG-RELEASE (ecosystem issue #9), not this candidate.
- HTTP-over-TCP domain test migration to `marqdo-ext-http` and multi-platform
release evidence remain open; they are not claimed here.
@@ -0,0 +1,42 @@
# 3.0.0-rc.5 候选准备(未发布)
日期:2026-11-27。分支:`release/3.0.0-rc.5-candidate`。本文件记录**候选准备**,不是发布记录:没有 tag、没有 Gitea Release、没有上传资产。
## 范围
- 工作区版本 `3.0.0-rc.4` → `3.0.0-rc.5`(Cargo.toml/Cargo.lock),CHANGELOG 增加“unreleased candidate”区段。
- 内容基线:CLI `deadf6e`(外部 Bundle Phase B,无仓库内 `stdlib/` 树)+ 根外部 Bundle `marqdo-stdlib@0.2.0`(`digest sha256:db905508...`)。
- 其余当前文档仍描述上一个已发布 rc.4;正式发布前必须在冻结 SHA 上统一 README/COMPATIBILITY/STATUS/开发者文档并重跑门禁。候选分支不合并即不改变产品发布声明。
## 候选验证(本机)
- 见父仓 #2 证据 `docs/evidence/2026-11-27-issue2-release-readiness.md`:确定性归档、smoke、离线冷安装、三个迁出扩展、外部 conformance、std surface、坏摘要 fail-closed。
- 本分支版本化为 rc.5 后重新生成归档时,仅版本/元数据变化;发布前须在冻结 SHA 上重新执行全部命令并记录摘要。
## rc.5 候选归档(未发布)
- 候选提交 `9b21486`(版本/metadata + 性能 harness 修复),CLI `--release` 构建成功。
- 同输入连续两次 `package.py`:`marqdo-3.0.0-rc.5-x86_64-unknown-linux-gnu.tar.gz` sha256 均为 `446197adb3c23dde87abc389490602e27856d6eb172667208080c8072a5ddece`(确定性 PASS)。
- `smoke.py` PASS;Ubuntu 24.04/glibc 2.39、`--network none`、无 Cargo 冷安装 PASS(缺 Bundle fail-closed;语言-only 可运行)。
- 未上传、无 tag、无 Release;`SOURCE_SHA` = 候选提交。
## 性能门禁(G4)候选结果
- 迁移后发现真实 harness 缺口:`stdlib-print-demo` 工作负载仍引用已删除的 CLI 内 `stdlib/demo.mq.md`,外部 Bundle 候选无法测量。
- 修复(本候选分支):新增 `tools/perf/fixtures/print-demo.mq.md`,工作负载改名为 `print-demo` 并指向 fixture,重新记录 `tools/perf/expected/print-demo.json`;`performance.yml` 在 baseline worktree 中复制同一 `tools/perf`,保证两个二进制测同一工作负载。
- 本机共享节点 paired run(Intel i7-8565U,8 CPU,taskset pin,5 warmups/20 samples):baseline 为**上一发布 rc.4**(`452e9a32...`,同一 harness/工作负载/fixture),candidate 为 rc.5 归档二进制 + 外部 Bundle。`correctness=VERIFIED`,9/9 工作负载 COMPARED,最大 p50 +5.15%、最大 RSS +4.87%,`investigate=false`(均低于 15%/20% 阈值)。
- **仍不是 G4 PASS**:报告 `status=SMOKE`、`environment_approved=false`,本机节点未获维护者针对该 RC 的批准;按 RC 政策只能作为 shared-node WARN 候选,需维护者在获批节点/环境复跑并明确批准。
## Strict L1(BLOCKED,未运行)
- 本环境无 disposable VM;`bwrap` 无法创建命名空间(`bwrap: No permissions to create a new namespace`),`unshare -Ur` 被拒(`/proc/self/uid_map: Operation not permitted`),`runuser -u nobody` 被拒(`cannot set groups: Operation not permitted`)。
- `tests/security/run-lane.sh` 明确要求普通用户在 disposable VM/可信 self-hosted runner 上运行并拒绝 root;本机无法产生 strict 证据,记录 BLOCKED 而非 PASS。
## 未完成(阻塞发布,不冒充 PASS)
- 冻结候选 SHA 与文档/版本一致性;
- strict L1 独立 VM、非 root 同 SHA 证据;
- G4 性能固定节点或维护者批准的 shared-node WARN;
- 维护者显式 tag/Release 批准。
按 `docs/releasing.md`,自动化只可预备 RC 与证据,不得自行 tag/release。
@@ -0,0 +1,58 @@
# CLI 运行期文稿访问能力 — issue #24
Date: 2026-11-30. Branch: `codex/issue-24-document-runtime-read`.
Baseline CLI commit: `8ad2f2cffabcea1072f772b4748606eb01dd0744`
(the Bundle 0.3.0 pin merge; the candidate is the branch commit on top).
Issue: [marqdo-cli#24](https://git.cflmy.cn/cflmy/marqdo-cli/issues/24)
(AI-U1 for `marqdo-ext-ai`).
## 交付
- `marqdo-host-contract`:新增只读 `DocumentModule`/`DocumentUnit` 快照类型与
两个默认不可用的 Host 方法(`document_outline`、`document_read`);
引擎仍只依赖中立 Host contract。
- `crates/cli/src/document_snapshot.rs`:从 `prepare` 的同一加载快照构建模块目录
(canonical module/unit id、path/parent/level/mode/anchors、完整 section span、
heading span、source digest、exact source);只包含本次 run/call 已加载的模块
(入口 + 显式导入闭包),不再读盘/解析。
- 运行时 builtin:`document.outline(module?, parent?, limit?)` 与
`document.read(module, unit, expected_digest?, max_bytes?)`;返回结构化
result map(ok/失败 code),预期状态不崩溃。
- 原生宿主 `StdHost` 从快照做精确 byte slice;不执行文稿、不加载模块、不联网。
- 规范:`spec/document-access.md`、`spec/evaluation.md` §8;
ADR-0074;`spec/document-structure.md`/README/developers/STATUS 链接。
- 测试:`crates/cli/tests/document_access.rs` 2 例(与 `check --emit` Analysis
的 module/unit/digest/span 逐字节一致;跨模块 anchor 读取;stale/unknown/not_loaded/
too_large;同名标题 anchor 区分);`docs_consistency` 单一契约检查;
architecture boundary 的 builtin 评审表更新。
## 本地验证(Linux x86_64 / glibc 2.43;Bundle 0.3.0)
```text
cargo fmt --all -- --check PASS
cargo clippy --workspace --all-targets -- -D warnings PASS
MARQDO_TEST_STDLIB_BUNDLE=<0.3.0> cargo test --workspace --locked 641 passed, 0 failed, 2 ignored
cargo test -p marqdo-cli --test document_access 2 passed
cargo test -p marqdo-cli --test docs_consistency 10 passed
check_dependency_boundaries / check_engine_boundary / check_plugin_sdk PASS
independent_build PASS
```
手工探针(真实 CLI):
```text
document.outline() → {ok:true, count:4, source_digest:<same as Analysis>}
document.read(module, unit-id) → 精确 section 原文
document.read(module, "说明") → anchor 命中同一 unit
stale digest → {ok:false, code:"document.stale_source"}
unknown unit → {ok:false, code:"document.unknown_unit"}
```
## 已知限制 / 未验证
- 快照预算:≤128 模块、≤16 MiB 源码;outline limit 默认 1024/最大 4096;
read 默认 256 KiB/最大 1 MiB;超限返回 `document.too_large`,不静默裁剪。
- `check`/`inspect` 不执行,因此不暴露该能力;strict 子进程重新按同一 prepare
构建快照,不依赖父进程内存。
- Windows/macOS 原生 lane、strict VM 仍 UNVERIFIED(平台 runner 限制)。
- AI 扩展移除预写全文/词法兜底等消费切换在 ext-ai 侧另行验证。
@@ -0,0 +1,141 @@
# CLI 0f87f85 — offline environment report, release identity binding and document-structure contract
Date: 2026-11-30.
Repository: `cflmy/marqdo-cli`.
Candidate commit: `0f87f856dba28e34bbd2743d23b8f9b1fe96424a`
(branch `codex/issue-25-26-environment-document-contract`, PR
[#27](https://git.cflmy.cn/cflmy/marqdo-cli/pulls/27)).
Issues: [marqdo-cli#26](https://git.cflmy.cn/cflmy/marqdo-cli/issues/26) §9.2
(P1), [marqdo-cli#25](https://git.cflmy.cn/cflmy/marqdo-cli/issues/25),
[marqdo-cli#20](https://git.cflmy.cn/cflmy/marqdo-cli/issues/20) binding.
Parent tickets: `marqdo#55`, `marqdo#56`.
Executed host: Linux x86_64, glibc 2.43
(`rustc 1.100.0 (0ef1bc386 2026-11-09)`, `cargo 1.100.0 (3acc79c0c 2026-11-05)`,
Python 3.14.4). Windows/macOS native lanes were **not** run (no runner in this
environment) and remain `UNVERIFIED`.
## 1. Bundle input
`python3 tools/ci/fetch_ecosystem_bundle.py --out target/ecosystem-stdlib`
materialized the pinned ecosystem Bundle (pin commit
`48189243f747d5f73d5a38a565010e64e2db74e7`, components
`stdlib/{collections,data,fs,io,system,text}` at their pinned gitlinks):
```text
name: marqdo-stdlib
version: 0.2.0
tree_digest: sha256:db905508dde89763b9d43b47fc5d52c6a1d5445a91f3c86a550ced43e8aac9d7
aliases_digest: sha256:5f513c0fdbb3c1e9829be3c9fa23a2d1e89cb8510073fb5eb1e8e2f5265a83bb
files: 18
```
All workspace tests below ran with
`MARQDO_TEST_STDLIB_BUNDLE="$PWD/target/ecosystem-stdlib"`.
## 2. Source-level gates
| Command | Result |
|---|---|
| `cargo fmt --all -- --check` | PASS |
| `cargo clippy --workspace --all-targets -- -D warnings` | PASS |
| `cargo test --workspace --locked` | PASS: 638 passed, 0 failed, 2 ignored (74 suites) |
| `cargo test -p marqdo-cli --test docs_consistency` | PASS: 9 passed |
| `cargo test -p marqdo-cli --test environment_report` | PASS: 5 passed |
| `cargo test -p marqdo-cli --test document_structure` | PASS: 6 passed |
| `python3 tools/ci/check_dependency_boundaries.py` | PASS |
| `python3 tools/ci/check_engine_boundary.py` | PASS |
| `python3 tools/ci/check_plugin_sdk.py` | PASS |
| `python3 tools/ci/independent_build.py` | PASS (PASS payload, clean target dir) |
| `python3 -m unittest discover -s tools/ci -p 'test_*.py'` | PASS: 80 tests |
| `python3 -m unittest discover -s tools/ci -p 'test_release*.py'` | PASS: 29 tests (10 skipped by platform guards) |
Note: `cargo clippy` must be invoked as
`cargo clippy --workspace --all-targets -- -D warnings` (one `--`). A doubled
separator makes clippy-driver treat `-D` as a second input file; that failure
was a local invocation error, not a code failure.
## 3. `inspect --environment` probes
```console
$ marqdo inspect --environment --json
{"schema":"marqdo.environment","schema_version":1,
"producer":{"name":"marqdo","version":"3.0.0-rc.6",
"source":{"sha":null,"origin":"unavailable"}}, # dev binary
"platform":{"os":"linux","arch":"x86_64","family":"unix",
"libc":{"family":"glibc","version":"2.43"},
"strict":{"state":"unavailable","reason":"..."},"worker_processes":true},
"worker":{"name":"marqdo-provider-worker","status":"present",
"version":"3.0.0-rc.6","source_sha":null},
"bundle":{"status":"absent", ...},
"protocols":{"analysis":3,"observation":1,"cli_tool":{"version":1,"api_revision":1},
"plugin_abi":{"version":"1.0","major":1,"minor":0},
"provider_manifest":2,"package_lock":4,"markdown_profile":"marqdo.md.v1"},
"diagnostics":[]}
$ marqdo inspect --environment --platform # argument boundary
error: the argument '--environment' cannot be used with '--platform' # exit 2
```
The integration test also builds a valid synthetic Bundle and an invalid one:
`verified` identity is reported for the valid tree, and a digest mismatch is
reported as `status: invalid` + `env.stdlib_digest_mismatch` without printing
the Bundle path. Two consecutive invocations are byte-identical.
## 4. Release archive (identity binding, #20/#26)
Release build and archive were produced from the candidate commit with
`MARQDO_BUILD_SOURCE_SHA=0f87f856dba28e34bbd2743d23b8f9b1fe96424a`:
```console
$ cargo build --release --locked -p marqdo-cli -p marqdo-provider-worker
Finished `release` profile in 51.40s
$ python3 tools/release/package.py --source-sha 0f87f856... --version 3.0.0-rc.6 \
--stdlib-dir target/ecosystem-stdlib --bundle-pin tools/stdlib/bundle-pin.json
{"archive":"dist/marqdo-3.0.0-rc.6-x86_64-unknown-linux-gnu.tar.gz",
"sha256":"58f4ea3a317ac2cf311804f94462d49699b7f159d6ef308a60f2728dad707a9a",
"size":4928069,"source_sha":"0f87f856...","version":"3.0.0-rc.6",
"target":"x86_64-unknown-linux-gnu"}
$ python3 tools/release/smoke.py --archive dist/marqdo-3.0.0-rc.6-x86_64-unknown-linux-gnu.tar.gz --skip-strict
smoke: verified stdlib 0.2.0 tree=sha256:db905508... files=18
smoke: archive version 3.0.0-rc.6, source 0f87f856dba28e34bbd2743d23b8f9b1fe96424a
smoke: bundled stdlib missing -> fail-closed OK
smoke: language-only program runs without the bundled stdlib
smoke: PASS
```
`package.py` now runs the staged binary's `inspect --environment --json` and
refuses to stage when `producer.source.sha`/`worker.source_sha` differ from
`--source-sha`, when the Bundle is not `verified`, or when its tree digest
differs from the archived Bundle. `smoke.py` repeats the check from the
extracted archive. The PASS above therefore proves the archive carries the
exact release commit in both binaries and the exact shipped Bundle.
Strict mode is `UNVERIFIED` on this shared host (`bwrap` cannot create the
required namespaces); `smoke.py --skip-strict` records that honestly rather
than turning a refusal into a PASS.
## 5. CI
| Pipeline | Result |
|---|---|
| Woodpecker push [#155](https://ci.cflmy.cn/repos/1/pipeline/155) (candidate `0f87f856`) | PASS: clone, contract, test, independent-build, minimum-rust, build all success |
| Woodpecker pull_request [#156](https://ci.cflmy.cn/repos/1/pipeline/156) (PR #27) | PASS: same six steps success on the candidate tree |
| Woodpecker push (docs evidence commit, branch head) | re-runs the same six steps; result recorded in the PR once complete |
Steps `contract`/`test`/`independent-build`/`minimum-rust`/`build` are the
release-relevant lanes; the Windows `cargo check` cross gate runs inside
`test`, but native Windows/macOS runs remain out of scope here.
## 6. Not verified / limits
- Native macOS and Windows build/run lanes (§3 target matrix): no runner in
this environment; `UNVERIFIED`. Only the Linux cross-compile check runs.
- Strict VM lane (`bwrap` namespaces): `UNVERIFIED`; strict stays fail-closed.
- MQDH/consumer acceptance of the release archive: consumer repositories own
their own acceptance; this record proves the CLI-side archive identity only.
- A formal tagged Release is not created by this change: publication remains a
reviewed owner step (`docs/releasing.md` §6). The archive above is a local
candidate, not a published asset.
+43
View File
@@ -0,0 +1,43 @@
# Marqdo CLI 3.0.0-rc.5 release notes
Released as a Linux x86_64 (glibc 2.39) prerelease. Tag `v3.0.0-rc.5` on the
tagged release commit; the Gitea release carries the archive, its `.sha256` and
`RELEASE_INFO.json` inside the archive.
## What changed
- The standard library is one explicit external Bundle (`--stdlib-dir`, Bundle
pin) and the CLI repository no longer contains a `stdlib/` source tree
(marqdo-cli#11 Phase B). Contract lanes, product tests and the perf harness
materialize the ecosystem Bundle instead of an in-repo copy.
- The release archive still ships exactly one verified stdlib Bundle
(`marqdo-stdlib@0.2.0`).
- The migrated performance `print-demo` workload now uses a self-contained
fixture so the G4 comparison no longer depends on the removed in-repo stdlib
tree; the paired baseline is the previous release rc.4.
## Verification on this release cycle
| Gate | Result |
| --- | --- |
| Deterministic archive (same inputs built twice) | PASS |
| `smoke.py` | PASS |
| Archive-only Ubuntu 24.04/glibc 2.39, `--network none`, non-root, no Cargo | PASS |
| Migrated extensions http/regex/archive with the archive CLI + Bundle | PASS |
| Frozen external conformance with the archive CLI/RELEASE_INFO | PASS |
| std: surface (text/JSON/FS/path/datetime/table/Console) | PASS |
| Missing/tampered Bundle fail-closed | PASS |
| Disposable-VM strict L1, non-root, same SHA | **UNVERIFIED** (no VM/namespaces in the release environment; no PASS claimed) |
| G4 paired shared-node comparison | Shared-node only: 9/9 workloads compared, max p50 +5.15%, max RSS +4.87%, below thresholds; **not an approved-node G4 PASS** |
This release was explicitly approved by the maintainer with the two limitations
above recorded; stable/LTS still requires the disposable-VM strict lane and a
maintainer-approved fixed performance node.
## Known limitations
- Linux x86_64 is the only supported platform; macOS/Windows remain UNSUPPORTED
for this prerelease line.
- `strict` availability depends on host namespaces; unsupported hosts fail
closed and do not downgrade.
- See `docs/developers/release-limits.md` for the full list.
+60 -24
View File
@@ -73,8 +73,12 @@ unsupported/experimental in
Use the frozen-SHA build and archive checks above. Additionally:
- Strict L1 requires a same-SHA PASS on a disposable VM as a non-root user.
Record the strict evidence and verify the archived binary on that guest.
- Report strict L1 as `PASS` only with same-SHA evidence from a disposable VM
running as a non-root user. An RC may report `strict: unsupported` with
maintainer approval and a same-SHA archive smoke log which confirms strict
execution fails closed on the distribution test environment. A skipped
test or an observed isolation defect blocks publication. Stable and LTS
require the disposable-VM PASS.
- Measure the packaged CLI with 5 warmups and 20 samples or more for each of
the nine workloads, or for the changed boundary's representative fixture when
the gate is scoped by an accepted ADR. Compare against a correctness-verified
@@ -117,7 +121,7 @@ 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"))')"
sha="$(git rev-parse HEAD)"
python3 tools/release/package.py --version "$version" --source-sha "$sha" \
--stdlib-dir stdlib --bundle-pin tools/stdlib/bundle-pin.json
--stdlib-dir target/ecosystem-stdlib --bundle-pin tools/stdlib/bundle-pin.json
# dist/marqdo-<version>-x86_64-unknown-linux-gnu.tar.gz(+.sha256)
```
@@ -203,13 +207,34 @@ python3 tools/ci/release_evidence.py --profile beta --target-sha "$sha" \
missing, skipped, failed or SHA-mismatched gate is `DO_NOT_RELEASE`; never
hand-edit a manifest to PASS. For a Linux RC, use
`--profile rc --require-release` and declare both excluded platforms. If
the shared-node exception applies, pass
strict is unavailable, supply `strict_vm=UNSUPPORTED:<candidate-sha>:<smoke-log>`
and `--rc-strict-unsupported-approval <release-notes-reference>`. The smoke
log must show strict mode's explicit refusal from the packaged binary. If the
shared-node exception applies, pass
`--rc-shared-performance-approval <release-notes-reference>` and supply
`performance=WARN:<candidate-sha>:<comparison-evidence>`. Use the generated
`RC_RELEASE_CANDIDATE` decision before running the tagging commands.
Stable releases use `--profile stable --require-release` and require native
Windows and macOS PASS in addition to the Linux and contract gates.
### 5.1 Environment identity binding
Release builds must embed the release commit in both binaries:
```bash
export MARQDO_BUILD_SOURCE_SHA="$(git rev-parse HEAD)"
cargo build --release --locked -p marqdo-cli -p marqdo-provider-worker
```
`tools/release/package.py` runs the staged `marqdo inspect --environment --json`
and refuses to stage an archive unless `producer.source.sha` and
`worker.source_sha` equal `--source-sha` and the adjacent Bundle reports
`status: verified` with the archived `tree_digest`.
`tools/release/smoke.py` re-runs the same check from the extracted archive, so
a release asset cannot claim a source commit it was not built from. The report
is specified by [`../spec/environment.md`](../spec/environment.md); it never
prints credentials, Analysis content or absolute host paths.
## 6. Tagging and publication (owner approval required)
Only after all gates above are green on the frozen SHA:
@@ -221,8 +246,25 @@ git tag -a "v${version}" -m "Marqdo CLI v${version}" "$sha"
git push origin "v${version}"
```
Then create the Gitea release for the tag with `prerelease: true`, attach the
tarball and its `.sha256`, and include the release notes. The notes must state:
Before publication, use the existing Bundle producer and the exact Woodpecker
pipeline number to create the ecosystem release index. Build and cold-test the
archive with the `--bundle-pin` and Bundle directory below, as in sections 3–4.
The receipt is the root producer's build summary and stays with the release
evidence.
```bash
python3 tools/ci/fetch_ecosystem_bundle.py --out target/ecosystem-stdlib \
--receipt target/ecosystem-stdlib.receipt.json
# Run the existing package and smoke commands with that Bundle.
archive="dist/marqdo-${version}-x86_64-unknown-linux-gnu.tar.gz"
python3 tools/release/release_index.py --archive "$archive" \
--bundle-receipt target/ecosystem-stdlib.receipt.json \
--pipeline "$pipeline_number" > dist/release-evidence.json.tmp
mv dist/release-evidence.json.tmp dist/release-evidence.json
```
Create a Gitea draft for the tag with `prerelease: true` and attach the tarball,
its `.sha256`, and `release-evidence.json`. The notes must state:
* prerelease status, support lifetime and the Linux x86_64 platform scope;
* the breaking RFC-LANG-0002 language change and no legacy path;
@@ -232,21 +274,16 @@ tarball and its `.sha256`, and include the release notes. The notes must state:
* the checksum-integrity-not-signature caveat and the known-limitations file;
* the exact source SHA and links to the evidence manifest.
Example Gitea API shape (token with repository release permission; never commit
the token):
Download the draft's assets from Gitea and verify their sizes and digests against
the index. Compare the downloaded index to the local copy and verify the remote
tag points at the tested SHA. Publish the complete draft, then confirm the
public tag and asset set again. Resume an interrupted draft only for the same
tag, commit and matching assets. For an already published release, verify the
existing bytes and send any outstanding notification. Report a mismatch to the
release owner and stop. A failed notification is retried independently through
the root reconcile workflow, with its cron as the recovery path.
```bash
curl -X POST -H "Authorization: token $MARQDO_GIT_TOKEN" \
-H 'Content-Type: application/json' \
https://git.cflmy.cn/api/v1/repos/cflmy/marqdo-cli/releases \
-d '{"tag_name":"v3.0.0-beta.1","name":"Marqdo CLI 3.0.0-beta.1",
"prerelease":true,"draft":false,"body":"..."}'
curl -X POST -H "Authorization: token $MARQDO_GIT_TOKEN" \
-F "attachment=@dist/marqdo-3.0.0-beta.1-x86_64-unknown-linux-gnu.tar.gz" \
https://git.cflmy.cn/api/v1/repos/cflmy/marqdo-cli/releases/<id>/assets
```
The tag points at the tested SHA. Evidence files and the final STATUS update
Evidence files and the final STATUS update
may land in a **post-release docs commit** that references the tagged SHA, so
that the evidence never has to claim a SHA it cannot contain. Do not force-push,
do not tag a red commit, and do not upload macOS/Windows binaries unless those
@@ -254,10 +291,9 @@ platform lanes actually passed.
## 7. Rollback
- Missing/mismatched gate discovered after tagging: mark the release withdrawn,
delete the assets, keep the tag only if source/tag integrity is unaffected,
and ship a corrected prerelease (for example `3.0.0-beta.2`). Never delete a
failing test.
- Missing or mismatched gate discovered after tagging: record the withdrawal
in an issue, retain the published tag and assets for traceability, and ship
a corrected prerelease with a new tag (for example `3.0.0-beta.2`).
- Platform regression: remove that platform from `COMPATIBILITY.md`, the
release notes and the archive, then fix and re-run the gate.
- Security regression: set strict back to fail-closed/unsupported, publish a
+8 -4
View File
@@ -10,8 +10,9 @@ be registered as a dedicated self-hosted security runner.
> ([`architecture/RFC-LANG-0002-unified-semantics.md`](architecture/RFC-LANG-0002-unified-semantics.md)).
> The lane is only evidence for the **exact SHA in its
> `strict-evidence.json`**; a PASS at an older SHA or on another host is
> historical. Every candidate release must rerun `tests/security/run-lane.sh`
> and archive the evidence document. See [`STATUS.md`](STATUS.md).
> historical. A stable or LTS release must rerun `tests/security/run-lane.sh`
> and archive the evidence document. Linux RCs can use the approved
> fail-closed path in [the release procedure](releasing.md#linux-rc-preconditions).
**Do not run this on a daily host with valuable data.** The VM is disposable;
the commands below do not disable AppArmor or any global host protection.
@@ -38,9 +39,9 @@ export SOURCE_SHA="$(git rev-parse HEAD)" # reviewed commit, clean tree
mkdir -p .tools/vm && cd .tools/vm
# Replace with the reviewed dated release URL, never .../current/...
curl -L -o ubuntu-base.img \
https://cloud-images.ubuntu.com/releases/26.04/release-20261120/ubuntu-26.04-server-cloudimg-amd64.img
https://cloud-images.ubuntu.com/releases/resolute/release-20261108/ubuntu-26.04-server-cloudimg-amd64.img
curl -L -o SHA256SUMS \
https://cloud-images.ubuntu.com/releases/26.04/release-20261120/SHA256SUMS
https://cloud-images.ubuntu.com/releases/resolute/release-20261108/SHA256SUMS
grep 'ubuntu-26.04-server-cloudimg-amd64.img' SHA256SUMS | sha256sum -c -
sha256sum ubuntu-base.img | tee ubuntu-base.img.sha256
qemu-img create -f qcow2 -b ubuntu-base.img -F qcow2 \
@@ -159,6 +160,9 @@ mkdir -p ~/marqdo-${SOURCE_SHA}
tar -C ~/marqdo-${SOURCE_SHA} -xf ~/marqdo-${SOURCE_SHA}.tar
cd ~/marqdo-${SOURCE_SHA}
export PATH="$HOME/.cargo/bin:$PATH"
python3 tools/ci/fetch_ecosystem_bundle.py --out target/ecosystem-stdlib
export MARQDO_STDLIB_DIR="$PWD/target/ecosystem-stdlib"
export MARQDO_TEST_STDLIB_BUNDLE="$MARQDO_STDLIB_DIR"
export MARQDO_TESTED_SHA="$SOURCE_SHA"
export MARQDO_SOURCE_ARCHIVE="$HOME/marqdo-${SOURCE_SHA}.tar"
export MARQDO_SOURCE_ARCHIVE_SHA256="sha256:<digest from the host>"
+126
View File
@@ -0,0 +1,126 @@
# Marqdo Runtime Document Access
Current public contract for the read-only runtime view of already loaded
documents: the `document.outline` and `document.read` builtins. It is
implemented by the composition root's immutable snapshot
(`crates/cli/src/document_snapshot.rs`), the neutral Host contract
(`marqdo-host-contract`) and the native host (ADR-0074). Analysis revision 3
remains the static external projection; this contract lets ordinary `.mq.md`
programs read the same snapshot without a parser or host paths.
## 1. Snapshot scope and invariants
The snapshot contains exactly the modules `prepare` already loaded for this
`run`/`call`: the entry module plus its explicit import closure. `check` and
`inspect` never execute and therefore never expose it.
* Identity, ordering and spans match the Analysis revision 3 projection from
the same load: canonical module id, canonical unit id, `path`,
`parent_id`, level, effective mode, anchors, complete section `span`,
`heading_span`, module `source_digest` (lowercase hex SHA-256) and the exact
`source`.
* The section `span` is the heading through the next heading of the same or a
higher level, or EOF; the root covers the whole source. Spans are UTF-8
half-open byte offsets into the exact module `source`.
* Reading is pure and read-only: no file is opened, no module is loaded
dynamically, no Markdown is parsed, no `@knowledge` is executed, no link is
expanded, no worker/model/network is started.
* The same run is deterministic: the same snapshot returns the same bytes,
identities and ordering.
* Snapshot budget: at most 128 modules and 16 MiB total source bytes per run.
A project over budget keeps running, but document access reports
`document.too_large` instead of serving a truncated view.
## 2. `document.outline(module?, parent?, limit?)`
All arguments are optional.
| Argument | Meaning |
|---|---|
| `module` | Target loaded module id. Defaults to the calling module. |
| `parent` | Only direct children of this unit id. Empty/absent = all units. |
| `limit` | Maximum units to return. Default 1024, maximum 4096. |
Success result:
```json
{
"ok": true,
"module": "root:demo@0.1.0::index.mq.md",
"source_digest": "<64 lowercase hex>",
"count": 3,
"units": [
{
"id": "root:demo@0.1.0::index.mq.md#力学",
"path": ["力学"],
"parent_id": "root:demo@0.1.0::index.mq.md#",
"level": 1,
"mode": "knowledge",
"anchors": ["力学"],
"span": {"start": 0, "end": 120},
"heading_span": {"start": 0, "end": 12}
}
]
}
```
`units` is in document order (root first). The root has `path: []`,
`parent_id: null`, `level: 0`, `heading_span: null` and its `span` covers the
whole source. When more units match than `limit`, the result is
`{ok: false, code: "document.too_large", ...}` — units are never silently
dropped.
## 3. `document.read(module, unit, expected_digest?, max_bytes?)`
| Argument | Meaning |
|---|---|
| `module` | Target loaded module id (required). |
| `unit` | Canonical unit id **or** one of its navigation anchors (required). |
| `expected_digest` | Optional exact module source digest. Absent/empty = no binding. |
| `max_bytes` | Maximum returned text bytes. Default 262144, maximum 1048576. |
Success result:
```json
{
"ok": true,
"module": "root:demo@0.1.0::index.mq.md",
"unit": "root:demo@0.1.0::index.mq.md#力学/计算力",
"anchors": ["计算力"],
"source_digest": "<64 lowercase hex>",
"span": {"start": 100, "end": 180},
"text": "<exact UTF-8 source slice>"
}
```
`text` is exactly `source[span.start..span.end]` of the same snapshot; it is not
a copy of a second knowledge body or a re-rendered document. Calling programs
must treat it as data (never as system instructions).
## 4. Failure codes
Failures are result maps (`ok: false`), not execution crashes:
| Code | Meaning |
|---|---|
| `document.not_loaded` | The module is not part of this run's loaded snapshot. |
| `document.unknown_unit` | The module has no unit id or anchor matching `unit`. |
| `document.stale_source` | `expected_digest` is non-empty and differs from the loaded module digest. |
| `document.too_large` | A limit/size (outline units, section bytes, snapshot budget) is exceeded. |
| `document.invalid_request` | The selected span is outside the source or not on UTF-8 boundaries (defensive). |
Callers can branch on these codes with ordinary `if`/`else`; no exception or
second result protocol exists.
## 5. Non-goals
* No arbitrary file, directory, network or package-cache access.
* No dynamic import or loading of modules outside the prepared closure.
* No execution of `@exec` functions from a read; `document.read` never runs
project code.
* No new Markdown/document syntax, no AI-specific metadata and no second
document structure specification. The semantic authority remains
`spec/mapping.md`, `spec/analysis.md` and `spec/document-structure.md`.
* No guarantee about files changed on disk after preparation: the snapshot is
the prepared load, and `expected_digest` reports whether the caller and the
snapshot agree.
+191
View File
@@ -0,0 +1,191 @@
# Marqdo Document Structure and Entry Semantics
This is the author/tool-facing overview of **what a `.mq.md` document is** and
**how a document becomes a program**: heading modes, unit identity, anchors,
spans, `index.mq.md` entry meaning, and the three document relations (link,
import, call). It states only semantics that are implemented today.
Normative detail lives in one place per fact: syntax and the Markdown→program
mapping are
[`mapping.md`](mapping.md) / [`../docs/architecture/RFC-LANG-0002-unified-semantics.md`](../docs/architecture/RFC-LANG-0002-unified-semantics.md);
the public static projection is [`analysis.md`](analysis.md); link/reference
resolution is [`references.md`](references.md); package and entry resolution is
[`package-format.md`](package-format.md) plus [`references.md`](references.md)
§3.1. This document links those facts for readers and states the consumer
stability contract; it does not create a second specification.
## 1. Document root and heading modes
A document is one CommonMark/GFM AST. Headings are sibling blocks, so scopes
are derived from heading levels, never from container nesting.
| Heading | `kind` | Callable? | Notes |
|---|---|---|---|
| (document root) | `root` | no | Mode `knowledge`, level `0`, path `[]`. |
| H1 | `namespace` | no | Namespace for nested functions. |
| H2 with `@exec` | `function` | **yes** | The only callable document unit. |
| H2 with `@knowledge` | `knowledge` | no | Inert knowledge section. |
| H3–H6 | `section` | no | Section of the enclosing unit; never callable. |
Rules (implemented by `marqdo-frontend`):
* The **document root is Knowledge**. A document with no mode marker still has
a knowledge root and cannot be called.
* Only ATX headings may declare `@exec`/`@knowledge`; Setext headings never
declare. The marker must be the heading's first `Text` child; any other
`@word` marker is the hard error `sem.invalid_mode_marker` (there is no
per-file mode or second selector).
* A heading without a marker **inherits the nearest ancestor's effective
mode**, never a sibling's. Inheritance pops same-or-higher-level ancestors
first, which is why a `###` section under an Exec H2 is Exec while the next
`##` sibling under a Knowledge H1 is Knowledge.
* Only a level-2 Exec heading creates a `FunctionId`. A section inside it
reports the owning function; a section outside one has no function.
* Executable payloads outside an owning Exec H2 are
`sem.exec_without_function`. Prose is inert everywhere.
* Headings inside lists, block quotes or fenced code do not create units.
* Mode declarations are not a navigation feature: adding `@knowledge`/`@exec`
declares meaning, it does not select a different parser or execution path.
Heading annotations (`{#id}`-style) are **Proposed** in
[`heading-annotations-v1.md`](heading-annotations-v1.md) and are not current
capability: the CLI currently rejects unknown `@` markers with
`sem.invalid_mode_marker`. Do not build tools on the proposal.
## 2. Units, identity, anchors and spans
A heading that participates in the language creates an addressable **unit**.
The root is always `units[0]`; all units are in document order.
* `id` is the canonical identity and may contain escapes for `/`, `#` and `%`.
`path` is the authoritative structural name; consumers must not split `id`
into segments.
* `parent_id` is the nearest real ancestor unit (not the Markdown DOM parent).
* Two headings with the same canonical name in the **same scope** are a hard
error (`sem.duplicate_unit_name`); they are not auto-suffixed. The same name
under different parents is allowed and addressable by `path`/`id`.
* `anchors` is a separate namespace of navigation names derived from heading
text with the GitHub-style slug algorithm. Slug collisions get the numbered
suffix `-2`, `-3`, … in document order. An anchor is a navigation name, not
an identity: resolve it to `unit_id`, never to a function or execution right.
* `heading_span` is the original heading AST span. `span` is the complete
section range: from the heading start through the next heading of the same or
higher level, or EOF; it includes child headings and excludes the next
sibling. The root `span` covers the whole source including a BOM.
* All spans are **half-open UTF-8 byte offsets** into `modules[].source`.
Slicing `source.as_bytes()[span.start..span.end]` is exact, including for a
BOM, CRLF line endings, combining characters, a missing trailing newline and
multi-byte text. `analyze`/`check --emit` and `check --refs` are different
projections; bind a digest when mixing artifacts (see `analysis.md` §1).
## 3. `index.mq.md` and entry semantics
`index.mq.md` is an **ordinary `.mq.md` document**. The file name is a
convention, not a language keyword and not a second document type.
* The **project entry** is the file passed to `check`/`run`/`call`/`inspect`.
Analysis records it as `project.entry_module_id`; it must occur exactly once
in `modules`. A second entry of the same project gets its own Analysis and is
never merged by basename.
* `marqdo init` generates a starter `index.mq.md`. That is a project template
choice, not execution semantics.
* A **path dependency** whose `marqdo.yaml` `path:` names a directory resolves
to `<directory>/index.mq.md` when the dependency is imported; the loaded
module keeps the dependency's package instance identity
(`dep:<name>@<version>[#<digest>]::index.mq.md`). That is import resolution,
not "the project entry is whatever index file is nearby".
* Nothing scans directories, auto-loads `index.mq.md`, or treats a directory
link as an import. Imports come only from the explicit YAML front matter.
* An `index.mq.md` used as navigation content does not change execution. Any
`@exec` H2 in it is a normal callable function with normal capability rules;
links inside it are static references only.
* Unresolved imports/missing modules are diagnostics (`module.unresolved`,
`ref.*`); there is no fuzzy search or basename fallback. See
[`references.md`](references.md) §3 and §5.
## 4. Three relations: link, import, call
The three must not be conflated; none is inferred from another.
| Relation | Syntax | Effect | Public projection |
|---|---|---|---|
| **Link** | Markdown `[text](url)` / image | Static reference only. Never loads a module, never imports, never grants read/execute. | `modules[].references[]` with state `resolved`, `not_loaded`, `missing`, `ambiguous`, `external`, `outside_scope` or `invalid`. |
| **Import** | YAML front matter `import: {alias: target}` in a module | Loads exactly the named module (`@dependency`, `std:<relative>` or relative path). Explicit, depth-first, no directory scan. | `modules[].imports[]` with `resolved` module id or `null` for a diagnostic import. |
| **Call** | Expression inside an executable payload | Binds statically to one callable; runs only under `run`/`call` with capability authorization. | `modules[].calls[]` with state `function`, `builtin`, `plugin` or `unresolved`. |
Partition rules:
* A link **never** imports or executes. A document may link to a module it did
not import; ordinary Analysis reports its state honestly (`not_loaded` when
the catalog did not verify existence), and `check --refs` verifies local
files without adding them to the program.
* `ref("#anchor")` returns a static `Formula | Code | FunctionRef` handle; it
does not read a section body and does not grant execution.
* Only an Exec H2 function can be called; calling a knowledge unit, namespace,
section or plain Markdown heading is not part of the language.
* Dynamic (`unresolved`/`dynamic`) calls are legal runtime values; they do not
become a second binding table.
## 5. Authoring guidance (not a CLI enforcement layer)
`marqdo#55` defines repository-level documentation expectations (project
entry, navigation, minimum per-document purpose). The CLI does **not** enforce
those editorial rules: Markdown structure checks belong to `marqdo-lint`, and
navigation/index policy belongs to the consumer repository. A `.mq.md` document
must be independently meaningful to a human reader; adding a new document or a
new knowledge file must not require new CLI syntax.
## 6. Not supported / deferred
* Heading annotations (`heading-annotations-v1.md`, Proposed) and any
`{#id}`/attribute syntax.
* AI-specific metadata, decorators, sidecar indexes or a second document
format.
* Automatic execution of prose or knowledge paragraphs, or "execute this
section" navigation commands.
* A second mode selector (`map_v1`, `--legacy`, per-file syntax switch) or
compatibility fallback for retired syntax.
* Implicit imports from links, file names or directory scans; directory-based
project entry inference.
* Anchor-based execution rights: an anchor resolves to a unit identity only.
## 7. Consumer stability contract
Tools may rely on the following public projection without reading CLI source.
Changes require an Analysis schema/ADR change and consumer updates; there is
no private-structure dependency.
| Fact | Field | Stability |
|---|---|---|
| Project entry | `project.entry_module_id`, `project.root_id`, `project.identity_kind` | Stable. |
| Module identity | `modules[].id`, `package_instance_id`, `relative_path`, `source_digest`, `source` | Stable; bind `AnalysisDigest` when mixing projections. |
| Heading tree | `units[].id/path/parent_id/kind/name/level`, document order, root first | Stable. |
| Modes | `units[].mode`, `mode_origin`, `mode_source_unit_id`, `function` | Stable. |
| Navigation | `units[].heading_span/span`, `anchors[]` | Stable; byte offsets. |
| Relations | `imports[].resolved`, `references[]` states, `calls[]` states/targets | Stable vocabulary; see `analysis.md` §5–§7. |
| Inert payloads | `resources[]` `formula`/`code` kinds | Stable. |
A consumer that needs a structural fact not in that table must request an
Analysis field through the schema process; it must not parse Markdown or IR
privately. Lint/Knowledge/AI consumers specifically may depend on: entry module
identity, heading tree, mode/mode_source, anchors, exact spans, import/call
separation and reference states.
## 8. Contract tests
| Test | Asserts |
|---|---|
| `crates/cli/tests/document_structure.rs` | heading modes/inheritance, same-name scope rules, anchor collision numbering, byte-exact spans with BOM/CRLF/no-final-newline, `index.mq.md` entry and directory-dependency resolution, link≠import≠call, invalid `@word` rejection. |
| `crates/cli/tests/heading_inheritance.rs` | sibling/ancestor inheritance through real `check`/`run`/`call`. |
| `crates/cli/tests/conformance_semantics.rs` | mapping and diagnostics for unit/heading semantics. |
| `crates/cli/tests/analysis_boundary.rs` | Analysis v3 shape and consumer validation. |
## 9. Change rules
* New document-language semantics require a language ADR plus `spec/mapping.md`
and `RFC-LANG-0002` updates; a tool requirement alone is not a reason to add
syntax (`marqdo#55` §13.4).
* A new Analysis field requires an `analysis.md`/schema change and a consumer
candidate on the same contract; no private projection is exposed.
* No second document-structure specification is maintained here or in Lint,
Knowledge, AI or the parent repository. This page links the single sources.
+181
View File
@@ -0,0 +1,181 @@
# Marqdo Environment Report
Current public contract for `marqdo inspect --environment`. The command emits
one offline installation report used by user feedback, release evidence and
diagnostic tooling. It is implemented by the CLI composition root
(`crates/cli/src/environment.rs`); this document is the only normative
specification for its shape. Release binding is defined by
[marqdo-cli#20](https://git.cflmy.cn/cflmy/marqdo-cli/issues/20) and
[marqdo-cli#26](https://git.cflmy.cn/cflmy/marqdo-cli/issues/26) §9.2.
Schema name: `marqdo.environment`, current `schema_version: 1`.
## 1. Invariants
`inspect --environment`:
* never executes project code, loads a module, starts a provider session,
opens a plugin, or accesses the network;
* takes no document and is rejected by the argument parser when combined with
a project-inspection flag (`--ast`, `--units`, `--signature`, `--ir`,
`--refs`, `--platform`, `--extensions`, `--plugin`, `FILE`);
* prints no credential, no Analysis or source content, no user data and no
absolute host path — the Bundle name/version/digest and the product version
are the only installation identity shown;
* reports a degraded installation as data (`status` plus a stable
`diagnostics[].code`) and still exits `0`; the report is the diagnostic, not
a command failure. Argument misuse remains a `2` usage error;
* is deterministic for one installation: two invocations print identical bytes.
The adjacent provider worker is queried only through its single-shot
`--build-info` command, bounded to 750&nbsp;ms and killed on timeout. That is
not a provider session: no library is loaded and no framed request is sent.
## 2. Output
```json
{
"schema": "marqdo.environment",
"schema_version": 1,
"producer": {
"name": "marqdo",
"version": "3.0.0-rc.6",
"source": {
"sha": "63776735e924ade279cdf59d5c733dc24bfdabbb",
"origin": "embedded"
}
},
"platform": {
"os": "linux",
"arch": "x86_64",
"family": "unix",
"libc": {"family": "glibc", "version": "2.39"},
"strict": {"state": "unavailable", "reason": "bubblewrap cannot create the required namespaces: ..."},
"worker_processes": true
},
"worker": {
"name": "marqdo-provider-worker",
"status": "present",
"version": "3.0.0-rc.6",
"source_sha": "63776735e924ade279cdf59d5c733dc24bfdabbb"
},
"bundle": {
"status": "verified",
"origin": "sibling",
"name": "marqdo-stdlib",
"version": "0.3.0",
"tree_digest": "sha256:...",
"instance_id": "stdlib:marqdo-stdlib@0.3.0"
},
"protocols": {
"markdown_profile": "marqdo.md.v1",
"analysis": 3,
"observation": 1,
"cli_tool": {"version": 1, "api_revision": 1},
"plugin_abi": {"version": "1.0", "major": 1, "minor": 0},
"provider_manifest": 2,
"package_lock": 4
},
"diagnostics": []
}
```
### 2.1 Producer identity
| Field | Meaning |
|---|---|
| `producer.name` | Always `marqdo`. |
| `producer.version` | Product SemVer of the running binary (`marqdo --version` without the name prefix). |
| `producer.source.sha` | Full lowercase 40-hex commit embedded by the release build, or `null`. |
| `producer.source.origin` | `embedded` when the build supplied `MARQDO_BUILD_SOURCE_SHA`; otherwise `unavailable`. This is a build fact, not a claim: a development build reports `null`. |
`MARQDO_BUILD_SOURCE_SHA` is a build-time environment variable consumed by
`crates/cli/build.rs` and `crates/marqdo-provider-worker/build.rs`. It must be
the exact 40-hex release commit. The release pipeline sets it from
`CI_COMMIT_SHA`; `tools/release/package.py` refuses to stage an archive whose
binary does not report the `--source-sha` commit, and
`tools/release/smoke.py` re-verifies it from the archive alone.
### 2.2 Platform
| Field | Meaning |
|---|---|
| `platform.os`, `platform.arch` | `std::env::consts::OS` / `ARCH` of the running binary. |
| `platform.family` | `std::env::consts::FAMILY` (`unix`/`windows`). |
| `platform.libc` | `{"family": "glibc", "version": "<gnu_get_libc_version>"}` on linux-gnu, `{"family": "musl", "version": null}` on musl, `null` elsewhere. A version is a runtime fact, not a support claim. |
| `platform.strict` | The current strict-isolation probe result, `{"state": "available"|"unavailable", ...}` (ADR-0021). `unavailable` includes the probe refusal reason and is contractual. |
| `platform.worker_processes` | Whether the built host can spawn isolated worker processes. |
Platform support claims live only in [`COMPATIBILITY.md`](../COMPATIBILITY.md);
this report states what the running installation is, never that a platform is
supported.
### 2.3 Adjacent provider worker
| Field | Meaning |
|---|---|
| `worker.status` | `present` when `marqdo-provider-worker` is a regular file next to the running binary; `absent` otherwise. |
| `worker.version` | Worker product version from its `--build-info` document, or `null`. |
| `worker.source_sha` | Full lowercase 40-hex commit from the worker `--build-info` document, or `null`. |
When a present worker cannot produce a current build-info document within the
bound, the report keeps `status: present`, leaves both identity fields `null`,
and appends the `env.worker_info_unavailable` diagnostic. No path or error text
from the worker is projected.
### 2.4 Bundle
| Field | Meaning |
|---|---|
| `bundle.status` | `verified` (manifest/alias digests and tree digest match), `absent` (no `MARQDO_STDLIB_DIR` and no sibling `stdlib/`), or `invalid` (an explicit or sibling Bundle failed verification). |
| `bundle.origin` | `explicit-env` when `MARQDO_STDLIB_DIR` selected the Bundle, `sibling` when the adjacent `stdlib/` directory did, `null` when absent. |
| `bundle.name`, `bundle.version` | Declared Bundle identity, or `null`. |
| `bundle.tree_digest` | `sha256:` + verified content digest of all `.mq.md` files, or `null`. |
| `bundle.instance_id` | Canonical verified instance id, or `null`. |
An explicit `MARQDO_STDLIB_DIR` is authoritative: a bad value reports
`invalid` and does not silently fall back to a sibling Bundle. Bundle load
errors never project the underlying path: they map to `env.stdlib_unreadable`,
`env.stdlib_invalid` or `env.stdlib_digest_mismatch`.
### 2.5 Protocol versions
`protocols` repeats the current revisions of the contracts documented in
[`../COMPATIBILITY.md`](../COMPATIBILITY.md): markdown profile, Analysis,
Observation, CLI Tool revision/API revision, Plugin ABI, Resource Provider
manifest and lock. These are the revisions this binary is built to, not a
negotiation result for a project.
### 2.6 Diagnostics
`diagnostics` is a list of `{code, message}` records. Codes are stable and
path-free:
| Code | Meaning |
|---|---|
| `env.stdlib_unreadable` | The installed Bundle directory/manifest cannot be read. |
| `env.stdlib_invalid` | The installed Bundle is not a current verified Bundle. |
| `env.stdlib_digest_mismatch` | Tree or alias digests do not match the manifest. |
| `env.worker_info_unavailable` | An adjacent worker exists but did not report a current build identity. |
A verified installation reports an empty list. New codes are additive within
`schema_version: 1`; renaming or removing a code is a schema change.
## 3. Consumer usage
```sh
marqdo inspect --environment --json | jq -r '.producer.version, .platform.os,
.bundle.status, .bundle.tree_digest'
```
Human-readable output (no `--json`) prints the same facts as stable
`key: value` lines; scripts must use `--json`. Consumers that need the report
for feedback must attach it as text, not upload source or credentials.
## 4. Stability
The report is a public CLI output contract. Adding a field is compatible;
changing a field's meaning, removing it or changing a diagnostic code requires
a `schema_version` change and a consumer update. The report does not replace
Analysis (static project facts), Observation (execution facts) or CLI Tool
(revision negotiation), and must not be used as any of them.
+9
View File
@@ -367,6 +367,8 @@ host boundary. Names are stable; adding one requires a spec update.
| `table.columns` | `(table: Table) -> List` | header names in column order |
| `table.row` | `(table: Table, row: Int) -> List` | new list of row cells; non-negative coordinate |
| `table.cell` | `(table: Table, row: Int, column: Int) -> Value` | cell value; non-negative coordinates |
| `document.outline` | `(module?: Text, parent?: Text, limit?: Int) -> Map` | read-only outline of the prepared loaded-document snapshot; `{ok, module, source_digest, count, units}` (ADR-0074, spec/document-access.md) |
| `document.read` | `(module: Text, unit: Text, expected_digest?: Text, max_bytes?: Int) -> Map` | exact UTF-8 source slice of one loaded unit id/anchor; `{ok, module, unit, anchors, source_digest, span, text}` or a structured `document.*` failure (ADR-0074) |
| `resource.open` | `(kind: Text, descriptor: Text, rights: List) -> Resource` | capability-checked stream open (ADR-0025) |
| `resource.read` | `(handle, memory: Memory, offset: Int, max_bytes: Int) -> Result` | bounded chunk read into Memory; `{count,eof}` |
| `resource.write` | `(handle, memory: Memory, offset: Int, length: Int) -> Result` | bounded byte write; `{count}` |
@@ -377,6 +379,13 @@ host boundary. Names are stable; adding one requires a spec update.
| `foreign.run/call` | see `spec/foreign.md` | P5, capability-gated |
| `fs.read/write` | see `spec/security.md` | capability-gated |
The `document.*` builtins read the immutable snapshot prepared by the same
`prepare` step as Analysis. They never open files, parse Markdown, load a
module dynamically, execute project code or access the network; a read is a
byte-exact section slice. Expected data states (not loaded, unknown unit,
stale digest, over budget) are structured result maps, not execution errors.
See `spec/document-access.md` and ADR-0074.
`打印/print` is **Compat-C** (ADR-0031): the legacy `HostOp::Print` and its
`Value::display()` formatting path are removed. When a loaded module calls the
builtin, the loader injects `stdlib/io.mq.md` and sets a program-level
+1 -1
View File
@@ -1,6 +1,6 @@
# Marqdo Security Model (implemented status)
Status: describes enforcement in the `3.0.0-rc.4` candidate.
Status: describes enforcement in the `3.0.0-rc.6` candidate.
Normative implementation:
-102
View File
@@ -1,102 +0,0 @@
# marqdo-stdlib (bundled first slice)
This directory is the official, offline `marqdo-stdlib` bundle consumed by
`std:<path>` imports. The CLI verifies `stdlib.json.digest` before loading any
module; a mismatch is a hard error.
> **Migration status (RFC-LANG-0002): the sources here are still pre-RFC and
> do not yet use the current language syntax.** Every `.mq.md` module in this
> directory is written in the superseded mapping (unmarked H2 as function,
> `Strong` as execution, `Emph` as return, ordered-list branches, bullet-list
> loops, block-quote calls, first code-span signatures). They are **not**
> valid sources for the target language and are not syntax examples to copy.
> The bundled stdlib will be migrated together with the Rust frontend and
> expression parser; `stdlib.json` and this digest will then be regenerated in
> the same change. Do not claim the stdlib already uses the new syntax.
> Authority:
> [`docs/architecture/RFC-LANG-0002-unified-semantics.md`](../docs/architecture/RFC-LANG-0002-unified-semantics.md),
> normative summary [`spec/mapping.md`](../spec/mapping.md), status
> [`docs/STATUS.md`](../docs/STATUS.md).
- `format.mq.md` — value formatting (`显示`, list/map/table display, escaping)
- `text.mq.md` — compatibility UTF-8 encoding into `Memory`
- `text/utf8.mq.md` — `.mq.md` UTF-8 encoder and validating decoder
- `io.mq.md` — compatibility facade over `stream` and `console`
- `fs/file.mq.md` — bounded project-file read/write/copy over `resource.*`
- `io/stream.mq.md` — `写全部` / `写文本` with short-write and close checking
- `io/console.mq.md` — `读取行` / `打印` over `stdio/stdin` and `stdio/stdout`
- `demo.mq.md` — side-by-side comparison with builtin `打印`
- `data/json.mq.md` — recursive JSON parser/formatter, 128-depth bound, multi-value
- `data/csv.mq.md` — quoted single/multi-row CSV parser and formatter
- `data/table.mq.md` — value-returning table select/filter/sort/append/set/join/group/GFM
- `env.mq.md` — explicitly granted `env.get` names over `resource.request`
- `process.mq.md` — explicitly granted `process.run` with timeout/output caps
- `compress.mq.md` — deterministic gzip compress/decompress over byte lists
- `random.mq.md` — explicitly granted OS entropy bytes/integers
- `datetime.mq.md` — UTC ISO-8601 format/parse over Unix milliseconds (pure)
- `clock.mq.md` — project-mode `clock.now` over `resource.request`
- `path.mq.md` — lexical join/basename/dirname/extension/normalize (no I/O)
- `regex.mq.md` — pure subset matcher + host-backed groups/alternation/captures
- `net/http.mq.md` — byte-exact HTTP/1.1 parsing (chunked) and request builder
- `tests/` — product self-tests for every public module
(`clock`, `compress`, `console`, `csv`, `datetime`, `demo`, `env`, `format`, `fs`, `http`,
`io`, `json`, `path`, `process`, `random`, `regex`, `stream`, `table`, `text`, `utf8`)
The digest is a SHA-256 over sorted `*.mq.md` relative paths, a NUL, file
bytes, and a NUL. It excludes `stdlib.json` and non-`.mq.md` files. After any
module change, regenerate it with:
```bash
python3 - stdlib <<'PY'
import hashlib, json, sys
from pathlib import Path
root=Path(sys.argv[1])
h=hashlib.sha256()
for p in sorted(root.rglob('*.mq.md'), key=lambda p: p.relative_to(root).as_posix()):
h.update(p.relative_to(root).as_posix().encode()); h.update(b'\0')
h.update(p.read_bytes()); h.update(b'\0')
manifest=json.loads((root/'stdlib.json').read_text())
manifest['digest']='sha256:'+h.hexdigest()
(root/'stdlib.json').write_text(json.dumps(manifest, indent=2)+'\n')
PY
```
The version/digest are part of each stdlib module's package instance id, so a
different bundle cannot silently masquerade as the one a project was checked
against.
## Official public aliases (`public_aliases`)
`stdlib.json` can declare language-surface aliases that are bound as ordinary
`Marqdo` functions (ADR-0058). The current table contains:
```json
"public_aliases": [
{
"public_names": ["print", "打印"],
"target_module": "io.mq.md",
"target_function": "写值",
"expected_signature": "params(值)",
"effects": ["host"]
}
],
"aliases_digest": "sha256:<64 lowercase hex>"
```
Rules:
* Only this verified bundle may declare a public alias. Third-party packages
cannot claim `打印`/`print`, `std.*` or `marqdo.*` names.
* `aliases_digest` is the SHA-256 of the canonical alias encoding: for each
alias sorted by `(target_module, target_function)`, module bytes + NUL,
function bytes + NUL, then each public name sorted + NUL. The loader verifies
it together with the `.mq.md` tree digest before loading any module; a
tampered table is a load error.
* The loader loads `target_module` only when the program references one of the
`public_names`, then binds the call to the ordinary target `FunctionId`; the
runtime has no print branch and `Program.print_override` does not exist.
* `expected_signature` is checked against the target function's declared
parameters; a mismatch is a load error.
* Output/error/Trace behavior must remain byte-identical for an official
install; `tools/pack-stdlib.py` refuses to package a bundle whose
`aliases_digest` does not match `public_aliases`.
-10
View File
@@ -1,10 +0,0 @@
# @exec clock
## 现在
`params()`
返回项目模式下的 UTC Unix 毫秒。pure/strict 返回
permission.denied,与 resource.request 的其他操作一致。
`return resource.request("clock.now", [])`
-19
View File
@@ -1,19 +0,0 @@
# @exec compress
## 压缩
`params(文本)`
把 UTF-8 文本压缩为 gzip 字节列表(List<Int>,0–255)。输入上限
8 MiB;结果确定(不写入时间戳/文件名)。
`return resource.request("compress.gzip", [文本])`
## 解压
`params(字节列表)`
解压 gzip 字节列表并校验 UTF-8。输出上限 8 MiB;坏 gzip 返回
compress.invalid,非 UTF-8 返回 compress.not_utf8。
`return resource.request("compress.gunzip", [字节列表])`
-354
View File
@@ -1,354 +0,0 @@
# @exec csv
## 成功
`params(值)`
`return {ok: true, value: 值}`
## 失败
`params(代码, 消息)`
`return {ok: false, code: 代码, message: 消息}`
## 解析行
`params(文本)`
解析单行 CSV:逗号分隔、双引号包裹、"" 表示一个字面双引号。
不处理换行、多行字段或首尾空白。未闭合引号和未加引号字段中的双引号
返回可恢复错误。
**点 = text.codepoints(文本)**
**下标 = 0**
**字段 = ""**
**字段表 = []**
**引号内 = false**
**错误 = ""**
`while 下标 < 长度(点) and 错误 == ""`
**字符 = text.from_codepoint(点[下标])**
`if 引号内 and 字符 == "\""`
`if 下标 + 1 < 长度(点) and text.from_codepoint(点[下标 + 1]) == "\""`
**`字段 = 字段 + "\""`**
**下标 = 下标 + 2**
`else`
`if true`
**引号内 = false**
**下标 = 下标 + 1**
`end`
`end`
`else`
`if 引号内`
**字段 = 字段 + 字符**
**下标 = 下标 + 1**
`else`
`if 字符 == "\""`
`if 字段 == ""`
**引号内 = true**
**下标 = 下标 + 1**
`else`
`if true`
**错误 = "csv.invalid_quote"**
`end`
`end`
`else`
`if 字符 == ","`
**字段表 = list.append(字段表, 字段)**
**字段 = ""**
**下标 = 下标 + 1**
`else`
`if true`
**字段 = 字段 + 字符**
**下标 = 下标 + 1**
`end`
`end`
`end`
`end`
`end`
`end`
`if 错误 != ""`
`return 失败(错误, "未加引号字段中出现双引号")`
`else`
`if 引号内`
`return 失败("csv.unterminated_quote", "引号未闭合")`
`end`
`end`
`return 成功(list.concat(字段表, [字段]))`
## 格式化字段
`params(文本)`
含逗号、双引号、换行或回车的字段加引号,内部双引号写成 ""。
**点 = text.codepoints(文本)**
**下标 = 0**
**需要引号 = false**
`while 下标 < 长度(点) and not 需要引号`
**码点 = 点[下标]**
`if 码点 == 34 or 码点 == 44 or 码点 == 10 or 码点 == 13`
**需要引号 = true**
`else`
`if true`
**忽略 = 0**
`end`
`end`
**下标 = 下标 + 1**
`end`
`if not 需要引号`
`return 文本`
`end`
**`结果 = "\""`**
**下标 = 0**
`while 下标 < 长度(点)`
`if 点[下标] == 34`
**`结果 = 结果 + "\"\""`**
`else`
`if true`
**结果 = 结果 + text.from_codepoint(点[下标])**
`end`
`end`
**下标 = 下标 + 1**
`end`
``return 结果 + "\""``
## 格式化行
`params(列表)`
**结果 = ""**
**下标 = 0**
`while 下标 < 长度(列表)`
`if 下标 > 0`
**结果 = 结果 + ","**
`else`
`if true`
**忽略 = 0**
`end`
`end`
**结果 = 结果 + 格式化字段(文本(列表[下标]))**
**下标 = 下标 + 1**
`end`
`return 结果`
## 解析
`params(文本)`
解析多行 CSV(逗号分隔、双引号、"" 转义、CRLF/LF 行尾,引号内可含
换行)。返回 {ok:true, value:List<List<Text>>};未闭合引号和不合法
引号返回可恢复错误。
**点 = text.codepoints(文本)**
**下标 = 0**
**字段 = ""**
**当前行 = []**
**行 = []**
**引号内 = false**
**错误 = ""**
`while 下标 < 长度(点) and 错误 == ""`
**字符 = text.from_codepoint(点[下标])**
`if 引号内 and 字符 == "\""`
`if 下标 + 1 < 长度(点) and text.from_codepoint(点[下标 + 1]) == "\""`
**`字段 = 字段 + "\""`**
**下标 = 下标 + 2**
`else`
`if true`
**引号内 = false**
**下标 = 下标 + 1**
`end`
`end`
`else`
`if 引号内`
**字段 = 字段 + 字符**
**下标 = 下标 + 1**
`else`
`if 字符 == "\""`
`if 字段 == ""`
**引号内 = true**
**下标 = 下标 + 1**
`else`
`if true`
**错误 = "csv.invalid_quote"**
`end`
`end`
`else`
`if 字符 == ","`
**当前行 = list.append(当前行, 字段)**
**字段 = ""**
**下标 = 下标 + 1**
`else`
`if 字符 == "\n"`
**当前行 = list.append(当前行, 字段)**
**行 = list.append(行, 当前行)**
**当前行 = []**
**字段 = ""**
**下标 = 下标 + 1**
`else`
`if 字符 == "\r"`
**下标 = 下标 + 1**
`else`
`if true`
**字段 = 字段 + 字符**
**下标 = 下标 + 1**
`end`
`end`
`end`
`end`
`end`
`end`
`end`
`end`
`if 错误 != ""`
`return 失败(错误, "未加引号字段中出现双引号")`
`else`
`if 引号内`
`return 失败("csv.unterminated_quote", "引号未闭合")`
`else`
`if 字段 != "" or 长度(当前行) > 0`
**当前行 = list.append(当前行, 字段)**
**行 = list.append(行, 当前行)**
`end`
`end`
`end`
`return 成功(行)`
## 格式化
`params(行列表)`
**结果 = ""**
**行号 = 0**
`while 行号 < 长度(行列表)`
`if 行号 > 0`
**结果 = 结果 + "\n"**
`else`
`if true`
**忽略 = 0**
`end`
`end`
**结果 = 结果 + 格式化行(行列表[行号])**
**行号 = 行号 + 1**
`end`
`return 结果`
-920
View File
@@ -1,920 +0,0 @@
# @exec json
## 嵌套深度
`params(文本)`
按未转义字符串之外的 {/[ 计算最大嵌套深度。
**点 = text.codepoints(文本)**
**下标 = 0**
**深度 = 0**
**最大 = 0**
**字符串内 = false**
**转义 = false**
`while 下标 < 长度(点)`
**码点 = 点[下标]**
`if 字符串内`
`if 转义`
**转义 = false**
`else`
`if 码点 == 92`
**转义 = true**
`else`
`if 码点 == 34`
**字符串内 = false**
`else`
`if true`
**忽略 = 0**
`end`
`end`
`end`
`end`
`else`
`if 码点 == 34`
**字符串内 = true**
`else`
`if 码点 == 123 or 码点 == 91`
**深度 = 深度 + 1**
`if 深度 > 最大`
**最大 = 深度**
`else`
`if true`
**忽略 = 0**
`end`
`end`
`else`
`if 码点 == 125 or 码点 == 93`
`if 深度 > 0`
**深度 = 深度 - 1**
`else`
`if true`
**忽略 = 0**
`end`
`end`
`else`
`if true`
**忽略 = 0**
`end`
`end`
`end`
`end`
`end`
**下标 = 下标 + 1**
`end`
`return 最大`
## 解析
`params(文本)`
解析一个完整的 JSON 文本。值之后只允许空白;多余输入返回
json.trailing,嵌套超过 128 层返回 json.depth。成功结果只保留
{ok, value},不暴露内部游标。
**点 = text.codepoints(文本)**
`if 嵌套深度(文本) > 128`
`return 失败("json.depth", "嵌套深度超过 128")`
`end`
**结果 = 解析值(点, 0)**
`if not 结果.ok`
`return 结果`
`end`
**位置 = 跳过空白(点, 结果.next)**
`if 位置 != 长度(点)`
`return 失败("json.trailing", "值后存在多余输入")`
`end`
`return {ok: true, value: 结果.value}`
## 成功值
`params(值, 下一位置)`
`return {ok: true, value: 值, next: 下一位置}`
## 失败
`params(代码, 消息)`
`return {ok: false, code: 代码, message: 消息}`
## 是空白
`params(码点)`
`return 码点 == 32 or 码点 == 9 or 码点 == 10 or 码点 == 13`
## 是数字
`params(码点)`
`return 码点 >= 48 and 码点 <= 57`
## 跳过空白
`params(点, 位置)`
**当前 = 位置**
`while 当前 < 长度(点) and 是空白(点[当前])`
**当前 = 当前 + 1**
`end`
`return 当前`
## 匹配
`params(点, 位置, 文本)`
**目标 = text.codepoints(文本)**
**下标 = 0**
**结果 = true**
`while 下标 < 长度(目标) and 结果`
`if 位置 + 下标 >= 长度(点)`
**结果 = false**
`else`
`if 点[位置 + 下标] != 目标[下标]`
**结果 = false**
`else`
`if true`
**继续 = 0**
`end`
`end`
`end`
**下标 = 下标 + 1**
`end`
`return 结果`
## 片段
`params(点, 起点, 终点)`
**结果 = ""**
**下标 = 起点**
`while 下标 < 终点`
**结果 = 结果 + text.from_codepoint(点[下标])**
**下标 = 下标 + 1**
`end`
`return 结果`
## 解析数字
`params(点, 位置)`
JSON 数字:可选负号、整数位、可选小数位、可选指数;含 ./e 返回 Float。
**开始 = 位置**
**当前 = 位置**
`if text.from_codepoint(点[当前]) == "-"`
**当前 = 当前 + 1**
`else`
`if true`
**非负 = 0**
`end`
`end`
**整数位 = 0**
`while 当前 < 长度(点) and 是数字(点[当前])`
**整数位 = 整数位 + 1**
**当前 = 当前 + 1**
`end`
**有小数 = false**
**小数位 = 0**
`if 当前 < 长度(点) and text.from_codepoint(点[当前]) == "."`
**有小数 = true**
**当前 = 当前 + 1**
`while 当前 < 长度(点) and 是数字(点[当前])`
**小数位 = 小数位 + 1**
**当前 = 当前 + 1**
`end`
`else`
`if true`
**忽略 = 0**
`end`
`end`
**指数位 = 0**
**指数标记 = false**
`if 当前 < 长度(点) and (text.from_codepoint(点[当前]) == "e" or text.from_codepoint(点[当前]) == "E")`
**有小数 = true**
**指数标记 = true**
**当前 = 当前 + 1**
`if 当前 < 长度(点) and (text.from_codepoint(点[当前]) == "+" or text.from_codepoint(点[当前]) == "-")`
**当前 = 当前 + 1**
`else`
`if true`
**忽略指数符号 = 0**
`end`
`end`
`while 当前 < 长度(点) and 是数字(点[当前])`
**指数位 = 指数位 + 1**
**当前 = 当前 + 1**
`end`
`else`
`if 整数位 == 0`
`return 失败("json.invalid_number", "数字缺少整数位")`
`else`
`if 有小数 and not 指数标记 and 小数位 == 0`
`return 失败("json.invalid_number", "小数缺少位数")`
`else`
`if 指数标记 and 指数位 == 0`
`return 失败("json.invalid_number", "指数缺少位数")`
`end`
`end`
`end`
`end`
**原文 = 片段(点, 开始, 当前)**
`if 有小数`
`return 成功值(小数(原文), 当前)`
`end`
`return 成功值(整数(原文), 当前)`
## 十六进制值
`params(码点)`
`if 码点 >= 48 and 码点 <= 57`
`return 码点 - 48`
`else`
`if 码点 >= 65 and 码点 <= 70`
`return 码点 - 55`
`else`
`if 码点 >= 97 and 码点 <= 102`
`return 码点 - 87`
`end`
`end`
`end`
`return 0 - 1`
## 解析字符串
`params(点, 位置)`
**当前 = 位置 + 1**
**结果 = ""**
**完成 = false**
**错误 = ""**
`while 当前 < 长度(点) and not 完成 and 错误 == ""`
**码点 = 点[当前]**
`if 码点 == 34`
**完成 = true**
**当前 = 当前 + 1**
`else`
`if 码点 == 92`
`if 当前 + 1 >= 长度(点)`
**错误 = "json.invalid_escape"**
`else`
`if true`
**转义码点 = 点[当前 + 1]**
`if 转义码点 == 34`
**结果 = 结果 + text.from_codepoint(34)**
**当前 = 当前 + 2**
`else`
`if 转义码点 == 92`
**结果 = 结果 + text.from_codepoint(92)**
**当前 = 当前 + 2**
`else`
`if 转义码点 == 47`
**结果 = 结果 + text.from_codepoint(47)**
**当前 = 当前 + 2**
`else`
`if 转义码点 == 98`
**结果 = 结果 + text.from_codepoint(8)**
**当前 = 当前 + 2**
`else`
`if 转义码点 == 102`
**结果 = 结果 + text.from_codepoint(12)**
**当前 = 当前 + 2**
`else`
`if 转义码点 == 110`
**结果 = 结果 + text.from_codepoint(10)**
**当前 = 当前 + 2**
`else`
`if 转义码点 == 114`
**结果 = 结果 + text.from_codepoint(13)**
**当前 = 当前 + 2**
`else`
`if 转义码点 == 116`
**结果 = 结果 + text.from_codepoint(9)**
**当前 = 当前 + 2**
`else`
`if 转义码点 == 117`
`if 当前 + 5 >= 长度(点)`
**错误 = "json.invalid_escape"**
`else`
`if true`
**数字 = 十六进制值(点[当前 + 2]) * 4096 + 十六进制值(点[当前 + 3]) * 256 + 十六进制值(点[当前 + 4]) * 16 + 十六进制值(点[当前 + 5])**
`if 数字 < 0 or (数字 >= 55296 and 数字 <= 57343)`
**错误 = "json.invalid_escape"**
`else`
`if true`
**结果 = 结果 + text.from_codepoint(数字)**
**当前 = 当前 + 6**
`end`
`end`
`end`
`end`
`else`
`if true`
**错误 = "json.invalid_escape"**
`end`
`end`
`end`
`end`
`end`
`end`
`end`
`end`
`end`
`end`
`end`
`end`
`else`
`if true`
**结果 = 结果 + text.from_codepoint(码点)**
**当前 = 当前 + 1**
`end`
`end`
`end`
`end`
`if 错误 != ""`
`return 失败("json.invalid_string", "字符串转义无效")`
`else`
`if not 完成`
`return 失败("json.unexpected_eof", "字符串未闭合")`
`end`
`end`
`return 成功值(结果, 当前)`
## 解析对象
`params(点, 位置)`
`return 解析对象项(点, 位置 + 1, {})`
## 解析对象项
`params(点, 位置, 已解析)`
**位置 = 跳过空白(点, 位置)**
`if 位置 >= 长度(点)`
`return 失败("json.unexpected_eof", "对象未闭合")`
`end`
**当前 = text.from_codepoint(点[位置])**
`if 当前 == "}"`
`return 成功值(已解析, 位置 + 1)`
`end`
**键结果 = 解析字符串(点, 位置)**
`if not 键结果.ok`
`return 键结果`
`end`
**键 = 键结果.value**
**位置 = 跳过空白(点, 键结果.next)**
`if 位置 >= 长度(点)`
`return 失败("json.unexpected_eof", "对象缺少冒号")`
`else`
`if text.from_codepoint(点[位置]) != ":"`
`return 失败("json.invalid_object", "对象缺少冒号")`
`end`
`end`
**位置 = 跳过空白(点, 位置 + 1)**
**值结果 = 解析值(点, 位置)**
`if not 值结果.ok`
`return 值结果`
`end`
**新的已解析 = map.set(已解析, 键, 值结果.value)**
**位置 = 跳过空白(点, 值结果.next)**
`if 位置 >= 长度(点)`
`return 失败("json.unexpected_eof", "对象未闭合")`
`end`
**分隔 = text.from_codepoint(点[位置])**
`if 分隔 == ","`
`return 解析对象项(点, 位置 + 1, 新的已解析)`
`else`
`if 分隔 == "}"`
`return 成功值(新的已解析, 位置 + 1)`
`else`
`if true`
`return 失败("json.invalid_object", "对象缺少逗号或 }")`
`end`
`end`
`end`
## 解析值
`params(点, 位置)`
**位置 = 跳过空白(点, 位置)**
`if 位置 >= 长度(点)`
`return 失败("json.unexpected_eof", "需要值")`
`end`
**首 = text.from_codepoint(点[位置])**
**首码点 = 点[位置]**
`if 首码点 == 34`
`return 解析字符串(点, 位置)`
`else`
`if 首码点 == 123`
`return 解析对象(点, 位置)`
`else`
`if 首 == "["`
`return 解析数组(点, 位置)`
`else`
`if 首 == "-" or 是数字(点[位置])`
`return 解析数字(点, 位置)`
`else`
`if 首 == "t"`
`if 匹配(点, 位置, "true")`
`return 成功值(true, 位置 + 4)`
`else`
`if true`
`return 失败("json.invalid_literal", "无效字面量")`
`end`
`end`
`else`
`if 首 == "f"`
`if 匹配(点, 位置, "false")`
`return 成功值(false, 位置 + 5)`
`else`
`if true`
`return 失败("json.invalid_literal", "无效字面量")`
`end`
`end`
`else`
`if 首 == "n"`
`if 匹配(点, 位置, "null")`
`return 成功值(None, 位置 + 4)`
`else`
`if true`
`return 失败("json.invalid_literal", "无效字面量")`
`end`
`end`
`else`
`if true`
`return 失败("json.unexpected_token", "不支持的值")`
`end`
`end`
`end`
`end`
`end`
`end`
`end`
`end`
## 解析数组
`params(点, 位置)`
`return 解析数组项(点, 位置 + 1, [])`
## 解析数组项
`params(点, 位置, 已解析)`
**位置 = 跳过空白(点, 位置)**
`if 位置 >= 长度(点)`
`return 失败("json.unexpected_eof", "数组未闭合")`
`end`
**当前 = text.from_codepoint(点[位置])**
`if 当前 == "]"`
`return 成功值(已解析, 位置 + 1)`
`end`
**项 = 解析值(点, 位置)**
`if not 项.ok`
`return 项`
`end`
**新的已解析 = list.append(已解析, 项.value)**
**位置 = 跳过空白(点, 项.next)**
`if 位置 >= 长度(点)`
`return 失败("json.unexpected_eof", "数组未闭合")`
`end`
**分隔 = text.from_codepoint(点[位置])**
`if 分隔 == ","`
`return 解析数组项(点, 位置 + 1, 新的已解析)`
`else`
`if 分隔 == "]"`
`return 成功值(新的已解析, 位置 + 1)`
`else`
`if true`
`return 失败("json.invalid_array", "数组缺少逗号或 ]")`
`end`
`end`
`end`
## 格式化文本
`params(文本)`
**点 = text.codepoints(文本)**
**`结果 = "\""`**
**下标 = 0**
`while 下标 < 长度(点)`
**码点 = 点[下标]**
`if 码点 == 34`
**`结果 = 结果 + "\\\""`**
`else`
`if 码点 == 92`
**`结果 = 结果 + "\\\\"`**
`else`
`if 码点 == 10`
**`结果 = 结果 + "\\n"`**
`else`
`if 码点 == 9`
**`结果 = 结果 + "\\t"`**
`else`
`if 码点 == 13`
**`结果 = 结果 + "\\r"`**
`else`
`if true`
**结果 = 结果 + text.from_codepoint(码点)**
`end`
`end`
`end`
`end`
`end`
`end`
**下标 = 下标 + 1**
`end`
``return 结果 + "\""``
## 格式化列表
`params(列表)`
**结果 = "["**
**下标 = 0**
`while 下标 < 长度(列表)`
`if 下标 > 0`
**结果 = 结果 + ", "**
`else`
`if true`
**忽略 = 0**
`end`
`end`
**结果 = 结果 + 格式化(列表[下标])**
**下标 = 下标 + 1**
`end`
`return 结果 + "]"`
## 格式化对象
`params(映射)`
**键列表 = map.keys(映射)**
**结果 = "{"**
**下标 = 0**
`while 下标 < 长度(键列表)`
`if 下标 > 0`
**结果 = 结果 + ", "**
`else`
`if true`
**忽略 = 0**
`end`
`end`
**当前键 = 键列表[下标]**
**结果 = 结果 + 格式化文本(当前键) + ": " + 格式化(map.get(映射, 当前键))**
**下标 = 下标 + 1**
`end`
`return 结果 + "}"`
## 格式化
`params(值)`
**类别 = 类型(值)**
`if 类别 == "Text"`
`return 格式化文本(值)`
`else`
`if 类别 == "None"`
`return "null"`
`else`
`if 类别 == "Bool" or 类别 == "Int" or 类别 == "Float"`
`return 文本(值)`
`else`
`if 类别 == "List"`
`return 格式化列表(值)`
`else`
`if 类别 == "Map"`
`return 格式化对象(值)`
`end`
`end`
`end`
`end`
`end`
`return "null"`
## 解析多个
`params(文本)`
解析连续多个 JSON 值(空白分隔),返回 {ok:true, value:List}。
任一项失败时返回该项的错误,不返回部分结果。
**点 = text.codepoints(文本)**
**位置 = 跳过空白(点, 0)**
**结果 = []**
`while 位置 < 长度(点)`
**项 = 解析值(点, 位置)**
`if not 项.ok`
`return 项`
`end`
**结果 = list.append(结果, 项.value)**
**位置 = 跳过空白(点, 项.next)**
`end`
`return {ok: true, value: 结果}`
-416
View File
@@ -1,416 +0,0 @@
# @exec table
## 选择列
`params(数据, 列)`
**列名 = table.columns(数据)**
**结果行 = []**
**行号 = 0**
`while 行号 < 长度(数据)`
**行 = table.row(数据, 行号)**
**结果行 = list.append(结果行, [行[列]])**
**行号 = 行号 + 1**
`end`
`return 表([列名[列]], 结果行)`
## 过滤数值大于
`params(数据, 列, 阈值)`
**列名 = table.columns(数据)**
**结果行 = []**
**行号 = 0**
`while 行号 < 长度(数据)`
**行 = table.row(数据, 行号)**
`if 行[列] > 阈值`
**结果行 = list.append(结果行, 行)**
`else`
`if true`
**忽略 = 0**
`end`
`end`
**行号 = 行号 + 1**
`end`
`return 表(列名, 结果行)`
## 插入有序
`params(已排序, 行, 列)`
**新列表 = []**
**已插入 = false**
**下标 = 0**
`while 下标 < 长度(已排序)`
**当前行 = 已排序[下标]**
`if not 已插入 and 当前行[列] > 行[列]`
**新列表 = list.append(新列表, 行)**
**新列表 = list.append(新列表, 当前行)**
**已插入 = true**
`else`
`if true`
**新列表 = list.append(新列表, 当前行)**
`end`
`end`
**下标 = 下标 + 1**
`end`
`if not 已插入`
**新列表 = list.append(新列表, 行)**
`else`
`if true`
**忽略 = 0**
`end`
`end`
`return 新列表`
## 排序
`params(数据, 列)`
**列名 = table.columns(数据)**
**行数 = 长度(数据)**
**已排序 = []**
**下标 = 0**
`while 下标 < 行数`
**已排序 = 插入有序(已排序, table.row(数据, 下标), 列)**
**下标 = 下标 + 1**
`end`
`return 表(列名, 已排序)`
## 追加行
`params(数据, 行)`
**列名 = table.columns(数据)**
**所有行 = []**
**行号 = 0**
`while 行号 < 长度(数据)`
**所有行 = list.append(所有行, table.row(数据, 行号))**
**行号 = 行号 + 1**
`end`
`return 表(列名, list.append(所有行, 行))`
## 设置单元格
`params(数据, 目标行, 目标列, 值)`
**列名 = table.columns(数据)**
**新行表 = []**
**行号 = 0**
`while 行号 < 长度(数据)`
**行 = table.row(数据, 行号)**
`if 行号 == 目标行`
**新行 = []**
**列号 = 0**
`while 列号 < 长度(行)`
`if 列号 == 目标列`
**新行 = list.append(新行, 值)**
`else`
`if true`
**新行 = list.append(新行, 行[列号])**
`end`
`end`
**列号 = 列号 + 1**
`end`
**新行表 = list.append(新行表, 新行)**
`else`
`if true`
**新行表 = list.append(新行表, 行)**
`end`
`end`
**行号 = 行号 + 1**
`end`
`return 表(列名, 新行表)`
## 连接
`params(左, 右, 左列, 右列)`
**表头 = list.concat(table.columns(左), table.columns(右))**
**结果行 = []**
**左行号 = 0**
`while 左行号 < 长度(左)`
**左行 = table.row(左, 左行号)**
**键 = 左行[左列]**
**右行号 = 0**
`while 右行号 < 长度(右)`
**右行 = table.row(右, 右行号)**
`if 右行[右列] == 键`
**结果行 = list.append(结果行, list.concat(左行, 右行))**
`else`
`if true`
**忽略 = 0**
`end`
`end`
**右行号 = 右行号 + 1**
`end`
**左行号 = 左行号 + 1**
`end`
`return 表(表头, 结果行)`
## 分组
`params(数据, 键列, 值列)`
**结果 = {}**
**行号 = 0**
`while 行号 < 长度(数据)`
**行 = table.row(数据, 行号)**
**键 = 行[键列]**
**当前 = map.get(结果, 键)**
**列表 = []**
`if map.has(结果, 键)`
**列表 = 当前**
`else`
`if true`
**忽略 = 0**
`end`
`end`
**列表 = list.append(列表, 行[值列])**
**结果 = map.set(结果, 键, 列表)**
**行号 = 行号 + 1**
`end`
`return 结果`
## 连接片段
`params(片段)`
**结果 = ""**
**下标 = 0**
`while 下标 < 长度(片段)`
`if 下标 > 0`
**结果 = 结果 + " | "**
`else`
`if true`
**忽略 = 0**
`end`
`end`
**结果 = 结果 + 片段[下标]**
**下标 = 下标 + 1**
`end`
`return 结果`
## 连接行
`params(行列表)`
**结果 = ""**
**下标 = 0**
`while 下标 < 长度(行列表)`
`if 下标 > 0`
**结果 = 结果 + "\n"**
`else`
`if true`
**忽略 = 0**
`end`
`end`
**结果 = 结果 + 行列表[下标]**
**下标 = 下标 + 1**
`end`
`return 结果`
## 转义单元格
`params(值)`
**文本值 = 文本(值)**
**点 = text.codepoints(文本值)**
**结果 = ""**
**下标 = 0**
`while 下标 < 长度(点)`
`if 点[下标] == 124`
**结果 = 结果 + text.from_codepoint(92) + "|"**
`else`
`if 点[下标] == 10 or 点[下标] == 13`
**结果 = 结果 + " "**
`else`
`if true`
**结果 = 结果 + text.from_codepoint(点[下标])**
`end`
`end`
`end`
**下标 = 下标 + 1**
`end`
`return 结果`
## 转GFM
`params(数据)`
**列名 = table.columns(数据)**
**表头 = []**
**下标 = 0**
`while 下标 < 长度(列名)`
**表头 = list.append(表头, 转义单元格(列名[下标]))**
**下标 = 下标 + 1**
`end`
**行列表 = []**
**行列表 = list.append(行列表, "| " + 连接片段(表头) + " |")**
**分隔 = []**
**下标 = 0**
`while 下标 < 长度(列名)`
**分隔 = list.append(分隔, "---")**
**下标 = 下标 + 1**
`end`
**行列表 = list.append(行列表, "| " + 连接片段(分隔) + " |")**
**行号 = 0**
`while 行号 < 长度(数据)`
**行 = table.row(数据, 行号)**
**单元格 = []**
**列号 = 0**
`while 列号 < 长度(行)`
**单元格 = list.append(单元格, 转义单元格(行[列号]))**
**列号 = 列号 + 1**
`end`
**行列表 = list.append(行列表, "| " + 连接片段(单元格) + " |")**
**行号 = 行号 + 1**
`end`
`return 连接行(行列表)`
-340
View File
@@ -1,340 +0,0 @@
# @exec datetime
## 失败
`params(消息)`
`return {ok: false, code: "datetime.invalid", message: 消息}`
## 闰年
`params(年)`
`return 年 % 4 == 0 and (年 % 100 != 0 or 年 % 400 == 0)`
## 每月天数
`params(年, 月)`
`if 月 == 2`
`if 闰年(年)`
`return 29`
`end`
`return 28`
`else`
`if 月 == 4 or 月 == 6 or 月 == 9 or 月 == 11`
`return 30`
`end`
`end`
`return 31`
## 补零2
`params(值)`
`if 值 < 10`
`return "0" + 文本(值)`
`end`
`return 文本(值)`
## 补零3
`params(值)`
`if 值 < 10`
`return "00" + 文本(值)`
`else`
`if 值 < 100`
`return "0" + 文本(值)`
`end`
`end`
`return 文本(值)`
## 补零4
`params(值)`
`if 值 < 10`
`return "000" + 文本(值)`
`else`
`if 值 < 100`
`return "00" + 文本(值)`
`else`
`if 值 < 1000`
`return "0" + 文本(值)`
`end`
`end`
`end`
`return 文本(值)`
## 月份
`params(mp)`
`if mp < 10`
`return mp + 3`
`end`
`return mp - 9`
## 年份
`params(年, 月)`
`if 月 <= 2`
`return 年 + 1`
`end`
`return 年`
## 日期部件
`params(天)`
Howard Hinnant 的 civil-from-days 算法,输入为 1970-01-01 起的天数。
**z = 天 + 719468**
**era = z // 146097**
**doe = z - era * 146097**
**yoe = (doe - doe // 1460 + doe // 36524 - doe // 146096) // 365**
**年 = yoe + era * 400**
**doy = doe - (365 * yoe + yoe // 4 - yoe // 100)**
**mp = (5 * doy + 2) // 153**
**日 = doy - (153 * mp + 2) // 5 + 1**
**月 = 月份(mp)**
`return {年: 年份(年, 月), 月: 月, 日: 日}`
## 日期序号
`params(年, 月, 日)`
**y = 年**
`if 月 <= 2`
**y = y - 1**
`else`
`if true`
**忽略 = 0**
`end`
`end`
**era = y // 400**
**yoe = y - era * 400**
**m = 月**
`if 月 > 2`
**m = 月 - 3**
`else`
`if true`
**m = 月 + 9**
`end`
`end`
**doy = (153 * m + 2) // 5 + 日 - 1**
**doe = yoe * 365 + yoe // 4 - yoe // 100 + doy**
`return era * 146097 + doe - 719468`
## 是数字串
`params(文本)`
**点 = text.codepoints(文本)**
**结果 = 长度(点) > 0**
**下标 = 0**
`while 下标 < 长度(点) and 结果`
`if 点[下标] < 48 or 点[下标] > 57`
**结果 = false**
`else`
`if true`
**忽略 = 0**
`end`
`end`
**下标 = 下标 + 1**
`end`
`return 结果`
## 片段
`params(点, 起点, 终点)`
**结果 = ""**
**下标 = 起点**
`while 下标 < 终点`
**结果 = 结果 + text.from_codepoint(点[下标])**
**下标 = 下标 + 1**
`end`
`return 结果`
## 格式化
`params(毫秒)`
输出 UTC ISO-8601:YYYY-MM-DDTHH:MM:SSZ;毫秒非零时追加
.mmm。负数毫秒按 1970 前的 UTC 时间处理。
**秒 = 毫秒 // 1000**
**毫 = 毫秒 % 1000**
**天 = 秒 // 86400**
**日内 = 秒 % 86400**
**时 = 日内 // 3600**
**分 = 日内 % 3600 // 60**
**秒数 = 日内 % 60**
**日期 = 日期部件(天)**
**基 = 补零4(日期.年) + "-" + 补零2(日期.月) + "-" + 补零2(日期.日) + "T" + 补零2(时) + ":" + 补零2(分) + ":" + 补零2(秒数)**
`if 毫 == 0`
`return 基 + "Z"`
`end`
`return 基 + "." + 补零3(毫) + "Z"`
## 解析
`params(文本)`
解析 YYYY-MM-DDTHH:MM:SSZ 或带 .mmm 的 UTC 文本,返回 Unix 毫秒。
范围、闰年和格式错误都是可恢复 datetime.invalid。
**点 = text.codepoints(文本)**
`if 长度(点) < 20 or 长度(点) > 24`
`return 失败("长度不是 20–24 个码点")`
`else`
`if 点[4] != 45 or 点[7] != 45 or 点[10] != 84 or 点[13] != 58 or 点[16] != 58`
`return 失败("分隔符不符合 YYYY-MM-DDTHH:MM:SS")`
`end`
`end`
**年文本 = 片段(点, 0, 4)**
**月文本 = 片段(点, 5, 7)**
**日文本 = 片段(点, 8, 10)**
**时文本 = 片段(点, 11, 13)**
**分文本 = 片段(点, 14, 16)**
**秒文本 = 片段(点, 17, 19)**
`if not 是数字串(年文本) or not 是数字串(月文本) or not 是数字串(日文本) or not 是数字串(时文本) or not 是数字串(分文本) or not 是数字串(秒文本)`
`return 失败("日期时间分量必须是数字")`
`end`
**年 = 整数(年文本)**
**月 = 整数(月文本)**
**日 = 整数(日文本)**
**时 = 整数(时文本)**
**分 = 整数(分文本)**
**秒 = 整数(秒文本)**
**毫文本 = "0"**
**结束 = 20**
`if 长度(点) >= 24 and 点[19] == 46 and 点[23] == 90`
**毫文本 = 片段(点, 20, 23)**
**结束 = 24**
`else`
`if 长度(点) != 结束 or 点[结束 - 1] != 90`
`return 失败("必须以 Z 结尾")`
`else`
`if not 是数字串(毫文本)`
`return 失败("毫秒必须是数字")`
`end`
`end`
`end`
**毫 = 整数(毫文本)**
`if 年 < 1970 or 月 < 1 or 月 > 12 or 日 < 1 or 日 > 每月天数(年, 月)`
`return 失败("日期超出范围")`
`else`
`if 时 < 0 or 时 > 23 or 分 < 0 or 分 > 59 or 秒 < 0 or 秒 > 59`
`return 失败("时间超出范围")`
`end`
`end`
**毫秒 = 日期序号(年, 月, 日) * 86400000 + 时 * 3600000 + 分 * 60000 + 秒 * 1000 + 毫**
`return {ok: true, value: 毫秒}`
-30
View File
@@ -1,30 +0,0 @@
# @exec env
## 读取
`params(名称)`
读取一个显式授权的环境变量。名称是精确匹配,不支持 glob;未授权是
permission.denied,未设置是 env.not_found,非 UTF-8 是
env.not_unicode。
`return resource.request("env.get", [名称])`
## 存在
`params(名称)`
**结果 = 读取(名称)**
`if 结果.ok`
`return {ok: true, value: true}`
`else`
`if 结果.code == "env.not_found"`
`return {ok: true, value: false}`
`end`
`end`
`return 结果`
-334
View File
@@ -1,334 +0,0 @@
# @exec format
## 字节长度
`params(文本)`
**点 = text.codepoints(文本)**
**总字节 = 0**
**下标 = 0**
`while 下标 < 长度(点)`
**码点 = 点[下标]**
`if 码点 < 128`
**总字节 = 总字节 + 1**
`else`
`if 码点 < 2048`
**总字节 = 总字节 + 2**
`else`
`if 码点 < 65536`
**总字节 = 总字节 + 3**
`else`
`if true`
**总字节 = 总字节 + 4**
`end`
`end`
`end`
`end`
**下标 = 下标 + 1**
`end`
`return 总字节`
## 显示
`params(值)`
按语言值语义格式化,用于与内置 打印 的输出对照。
覆盖 Unit/None/Bool/Int/Float/Text/List/Map/Table/Formula/Code/
FunctionRef/PluginHandle/Memory/Resource。
**类别 = 类型(值)**
`if 类别 == "Unit"`
`return "Unit"`
`else`
`if 类别 == "None"`
`return "None"`
`else`
`if 类别 == "Text"`
`return 值`
`else`
`if 类别 == "List"`
`return 列表显示(值)`
`else`
`if 类别 == "Map"`
`return 映射显示(值)`
`else`
`if 类别 == "Table"`
`return 表格显示(值)`
`else`
`if 类别 == "Formula"`
`return "Formula(" + 转义文本(值.latex) + ")"`
`else`
`if 类别 == "Code"`
`return "Code(" + 转义文本(值.language) + ", " + 文本(字节长度(值.source)) + " bytes)"`
`else`
`if 类别 == "FunctionRef"`
`return "FunctionRef(" + 值.module + "::" + 值.name + ")"`
`else`
`if 类别 == "PluginHandle"`
`return "PluginHandle(" + 值.plugin + "::" + 值.export + ")"`
`else`
`if 类别 == "Memory"`
`return "Memory"`
`else`
`if 类别 == "Resource"`
`return "Resource"`
`else`
`if true`
`return 文本(值)`
`end`
`end`
`end`
`end`
`end`
`end`
`end`
`end`
`end`
`end`
`end`
`end`
`end`
## 列表显示
`params(列表)`
**结果 = "["**
**下标 = 0**
`while 下标 < 长度(列表)`
`if 下标 > 0`
**结果 = 结果 + ", "**
`else`
`if true`
**忽略 = 0**
`end`
`end`
**结果 = 结果 + 值显示(列表[下标])**
**下标 = 下标 + 1**
`end`
`return 结果 + "]"`
## 映射显示
`params(映射)`
**键 = map.keys(映射)**
**结果 = "{"**
**下标 = 0**
`while 下标 < 长度(键)`
`if 下标 > 0`
**结果 = 结果 + ", "**
`else`
`if true`
**忽略 = 0**
`end`
`end`
**当前键 = 键[下标]**
**结果 = 结果 + 当前键 + ": " + 值显示(map.get(映射, 当前键))**
**下标 = 下标 + 1**
`end`
`return 结果 + "}"`
## 表格显示
`params(表格)`
**列 = table.columns(表格)**
**结果 = "Table[" + 连接文本(列, " | ") + "]{"**
**行号 = 0**
`while 行号 < 长度(表格)`
`if 行号 > 0`
**结果 = 结果 + "; "**
`else`
`if true`
**忽略 = 0**
`end`
`end`
**行 = table.row(表格, 行号)**
**单元格 = []**
**列号 = 0**
`while 列号 < 长度(行)`
**单元格 = list.append(单元格, 显示(行[列号]))**
**列号 = 列号 + 1**
`end`
**结果 = 结果 + 连接文本(单元格, " | ")**
**行号 = 行号 + 1**
`end`
`return 结果 + "}"`
## 连接文本
`params(列表, 分隔)`
**结果 = ""**
**下标 = 0**
`while 下标 < 长度(列表)`
`if 下标 > 0`
**结果 = 结果 + 分隔**
`else`
`if true`
**忽略 = 0**
`end`
`end`
**结果 = 结果 + 列表[下标]**
**下标 = 下标 + 1**
`end`
`return 结果`
## 值显示
`params(值)`
列表/映射/表格内部使用 repr 语义:Text 带引号并转义,其它值递归显示。
**类别 = 类型(值)**
`if 类别 == "Text"`
`return 转义文本(值)`
`else`
`if true`
`return 显示(值)`
`end`
`end`
## 转义文本
`params(文本)`
**点 = text.codepoints(文本)**
**`结果 = "\""`**
**下标 = 0**
`while 下标 < 长度(点)`
**码点 = 点[下标]**
`if 码点 == 34`
**`结果 = 结果 + "\\\""`**
`else`
`if 码点 == 92`
**`结果 = 结果 + "\\\\"`**
`else`
`if 码点 == 10`
**`结果 = 结果 + "\\n"`**
`else`
`if 码点 == 9`
**`结果 = 结果 + "\\t"`**
`else`
`if 码点 == 13`
**`结果 = 结果 + "\\r"`**
`else`
`if true`
**结果 = 结果 + text.from_codepoint(码点)**
`end`
`end`
`end`
`end`
`end`
`end`
**下标 = 下标 + 1**
`end`
``return 结果 + "\""``
-237
View File
@@ -1,237 +0,0 @@
---
import:
utf8: "../text/utf8.mq.md"
---
# @exec file
## 读文本
`params(路径)`
以 UTF-8 读取一个有界的项目文件。文件在打开时整文件载入,上限 8 MiB;
结果使用可恢复 Result 形状。
**流 = resource.open("file", 路径, ["read"])**
**内存 = memory.new(128, 128)**
**读取 = resource.read(流, 内存, 0, 8388608)**
**关闭 = resource.close(流)**
`if not 读取.ok`
`return 读取`
`else`
`if not 关闭.ok`
`return 关闭`
`else`
`if true`
**文本 = utf8.解码(内存, 0, 读取.value.count)**
`if not 文本.ok`
`return 文本`
`else`
`if true`
`return {ok: true, value: 文本.value}`
`end`
`end`
`end`
`end`
`end`
## 写文本
`params(路径, 文本)`
把文本按 UTF-8 写入项目文件。路径必须已经通过 fs_write 授权;
文件只在 resource.close 成功时创建或覆盖,写入缓冲上限 8 MiB。
**内存 = memory.new(128, 128)**
**长度 = utf8.编码(文本, 内存, 0)**
**流 = resource.open("file", 路径, ["write"])**
**写入 = resource.write(流, 内存, 0, 长度)**
**关闭 = resource.close(流)**
`if not 写入.ok`
`return 写入`
`else`
`if not 关闭.ok`
`return 关闭`
`else`
`if true`
`return {ok: true, value: {count: 写入.value.count}}`
`end`
`end`
`end`
## 复制文件
`params(源, 目标)`
按字节复制一个有界的项目文件。源读取和目标写入分别需要
fs_read/fs_write 授权,结果值与 [写文本](#写文本) 相同。
**输入 = resource.open("file", 源, ["read"])**
**内存 = memory.new(128, 128)**
**读取 = resource.read(输入, 内存, 0, 8388608)**
**关闭输入 = resource.close(输入)**
`if not 读取.ok`
`return 读取`
`else`
`if not 关闭输入.ok`
`return 关闭输入`
`else`
`if true`
**输出 = resource.open("file", 目标, ["write"])**
**写入 = resource.write(输出, 内存, 0, 读取.value.count)**
**关闭输出 = resource.close(输出)**
`if not 写入.ok`
`return 写入`
`else`
`if not 关闭输出.ok`
`return 关闭输出`
`else`
`if true`
`return {ok: true, value: {count: 写入.value.count}}`
`end`
`end`
`end`
`end`
`end`
`end`
## 存在
`params(路径)`
`return resource.request("fs.exists", [路径])`
## 元数据
`params(路径)`
`return resource.request("fs.metadata", [路径])`
## 是文件
`params(路径)`
**元数据 = resource.request("fs.metadata", [路径])**
`if not 元数据.ok`
`return 元数据`
`else`
`if true`
`return {ok: true, value: 元数据.value.kind == "file"}`
`end`
`end`
## 是目录
`params(路径)`
**元数据 = resource.request("fs.metadata", [路径])**
`if not 元数据.ok`
`return 元数据`
`else`
`if true`
`return {ok: true, value: 元数据.value.kind == "directory"}`
`end`
`end`
## 列出目录
`params(路径)`
`return resource.request("fs.list", [路径])`
## 创建目录
`params(路径)`
`return resource.request("fs.mkdir", [路径])`
## 删除
`params(路径)`
删除一个文件或空目录。非空目录返回 fs.not_empty,不递归删除。
`return resource.request("fs.remove", [路径])`
## 重命名
`params(源, 目标)`
目标已存在时返回 fs.exists,不覆盖。
`return resource.request("fs.rename", [源, 目标])`
## 追加文本
`params(路径, 文本)`
把文本追加到项目文件;文件不存在时创建。仍受 8 MiB 单次读取上限和
fs_write 授权约束。
`return resource.request("fs.append", [路径, 文本])`
## 读取片段
`params(路径, 偏移, 长度)`
从偏移处读取最多 长度 字节,按 UTF-8 解码后返回文本。偏移/长度必须
是非负整数,长度上限 8 MiB。
`return resource.request("fs.read_at", [路径, 偏移, 长度])`
## 遍历
`params(路径)`
递归列出目录下的普通文件,返回相对项目根的路径列表。跳过符号链接,
深度上限 64,条目上限 4096。
`return resource.request("fs.walk", [路径])`
-40
View File
@@ -1,40 +0,0 @@
---
import:
format: "./format.mq.md"
stream: "./io/stream.mq.md"
console: "./io/console.mq.md"
---
# @exec io
## 写文本
`params(文本)`
`return stream.写文本(文本)`
## 写全部
`params(流, 内存, 起点, 长度)`
`return stream.写全部(流, 内存, 起点, 长度)`
## 写值
`params(值)`
按语言值语义格式化后输出,并追加换行。
`return stream.写文本(format.显示(值) + "\n")`
## 读取行
`params()`
`return console.读取行()`
## 打印
`params(值)`
`return console.打印(值)`
Loaded 100 of 154 files, more files were not shown because too many files have changed in this diff. Show more