Author SHA1 Message Date
cflmy 1e2a045cc7 perf: time the execution path, not the opt-in Observation document
ci/woodpecker/push/main Pipeline was successful
ci/woodpecker/manual/performance Pipeline was successful
The first rc.3 perf comparison reused the old workload commands but switched
them to `run/call --output json`, so the candidate was timed while producing
thousands of structural events that the beta baseline never emitted. The result
was a reproducible +240..+375% p50 and +130% RSS delta caused by the
measurement, not by the program's execution cost.

- Give each run/call workload a correctness command (current Observation
  snapshot, full contract digest) and a measurement command (plain execution
  path, committed text digest).
- Verify the correctness digest once per workload and the measurement digest on
  every timed sample; a wrong or changed output is never timed.
- Re-record the expected digests and extend the tooling tests.
- A protocol document that is produced only on request must not be billed as
  an execution regression.
2026-11-24 22:25:30 +08:00
cflmy f211568c42 docs: record the reviewed candidate status and mark the beta guide historical
ci/woodpecker/manual/performance Pipeline failed
ci/woodpecker/push/main Pipeline was successful
- docs/STATUS.md: snapshot the 3.0.0-rc.3 candidate, publish the reviewed local
  gate counts (607 workspace tests, docs-consistency 7, tools/ci 41) and add
  the review-closure record; label the earlier pipeline #70 results as the
  first pre-review candidate build.
- Mark the beta-era third-party integration guide as historical and point to
  the current spec/ and developer entry points from README and
  docs/developers/README.md.
2026-11-24 21:14:11 +08:00
cflmy 765c8350b0 fix: keep snapshots free of host paths and use the documented error phases
- runtime_error_json reports module_id/relative_path/line/column only; an
  absolute host path is environment data and must not be embedded in a
  shareable Observation snapshot.
- A bad --arg is a pre-start option error: report phase "options" as the
  schema defines instead of "prepare".
- Document that any provider transport failure, including an over-budget
  request frame, kills and reaps the helper and is never retried.
2026-11-24 21:06:05 +08:00
cflmy 847cf9fe33 docs: record the rc.3 release record, licensing and CI lanes truthfully
- CHANGELOG: add the Apache-2.0-only licensing change, the removed --trace
  path, the contract/test CI split with the checked-in stream verifier, the
  analysis-observation rename, and the post-review fixes; replace the stale
  pipeline #70/archive claim with the evidence-bound wording.
- docs/ci.md: describe the actual contract, test, minimum-rust and build lanes,
  the manual performance workflow and the new docs gate.
- Annotate RFC-OBS-0001, ADR-0059 and the Execution Events evidence as
  historical so their retired spec references are not read as current.
2026-11-24 20:59:50 +08:00
cflmy d11b261aca docs: make the current contracts describe the binary that exists
- spec/security.md: replace the retired --json/EffectTrace/--trace-file
  sections with the current strict output contract (text or one snapshot from
  the verified child, live/file destinations refused) and Observation effect
  events; drop the deleted trace.rs implementation row.
- spec/package-format.md, spec/value-wire.md, spec/evaluation.md,
  spec/resource-provider-v2.md, spec/foreign.md: describe the current
  --output/--observation-file and Observation events instead of run/call
  --json and Execution Events.
- spec/analysis.md: a load failure removes the previous artifact, not only a
  compile error.
- COMPATIBILITY.md and docs/developers/*: current axes are Analysis v3,
  Observation v1 and CLI Tool revision 1; Rust 1.89; rc.3 candidate status.
- Fix the Analysis v2 / Trace v2 / trace-file references in README,
  architecture overview, contributor guide, tool example, source comments and
  AGENTS.md.
- Add a docs-consistency gate that fails when spec/ or the current developer
  guides document a retired interface or a deleted spec path.
2026-11-24 20:57:13 +08:00
cflmy 682eae82b6 perf: measure run/call through the current Observation snapshot
The nine G4 workloads still requested the retired `run/call --json` option,
so every non-check workload exited 2 and was recorded as CORRECTNESS_FAIL; the
RC performance gate could not run at all.

- Request `--output json` for run/call workloads and re-record the committed
  expected digests.
- Pin correctness to the current snapshot: terminal status/result, committed
  stdout/stderr byte digests, and ordered event-kind counts with a sequence
  digest. Run ids, wall-clock stamps and host paths are excluded, so a correct
  program keeps one stable digest.
- Add tooling tests for the workload catalogue and digest stability.
2026-11-24 20:48:26 +08:00
cflmy 44a118003f fix: close rc.3 review defects in strict destinations and Analysis cleanup
- Reject strict live/file observation destinations before opening a session:
  a rejected destination no longer writes a partial JSONL stream or snapshot.
- Remove a previous `check --emit` artifact when the project cannot be loaded,
  not only when it has compile errors, so a consumer can never bind a run to a
  stale Analysis document.
- Report the concrete `fs.exists|metadata|list|mkdir|remove|rename` effect
  operation instead of collapsing all six into `resource.request`.
- Preserve the plugin ABI frame codes through the shared worker transport:
  an over-limit frame is `worker_frame_too_large` and an encode failure is
  `worker_encode_failed`, not a generic `worker_frame_invalid`.
- Give the event and snapshot schemas the same capture `level` enum and
  document the levels in spec/observation.md.
- Add a regression test for each fix.
2026-11-24 20:43:23 +08:00
cflmy 238e4065c1 ci: use a checked-in verifier for the one-run stream/snapshot assertion
ci/woodpecker/push/main Pipeline was successful
2026-11-24 19:31:50 +08:00
cflmy 72d49ab2a1 Merge pull request 'Protocol convergence for 3.0.0-rc.3 (issue #8)' (#9) from architecture/issue-8-protocols into master
ci/woodpecker/push/main Pipeline was canceled
One current contract per public boundary: Analysis single writer, Observation replaces Trace/Execution Events, exact CLI Tool requirements, shared worker transport, rejected retired formats.

Same-SHA CI: https://ci.cflmy.cn/repos/1/pipeline/71
2026-11-24 19:23:26 +08:00
53 changed files with 2070 additions and 1028 deletions

No files matched your search

+1 -9
View File
@@ -28,15 +28,7 @@ steps:
python3 tests/consumers/analysis_consumer.py /tmp/control-analysis.json --require-transfers 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 --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 tests/consumers/observation_consumer.py --validate-schema --analysis /tmp/control-analysis.json /tmp/control-events.jsonl
- | - python3 tools/ci/verify_observation_stream.py /tmp/control-events.jsonl /tmp/control-observation.json
set -eu
python3 - <<'PY'
import json, pathlib
events = [json.loads(line) for line in pathlib.Path("/tmp/control-events.jsonl").read_bytes().splitlines()]
snapshot = json.loads(pathlib.Path("/tmp/control-observation.json").read_text())
assert snapshot["events"] == events, "stream and snapshot must be one event sequence"
print("stream and snapshot share one event sequence")
PY
- | - |
set -eu set -eu
cp /tmp/control-analysis.json /tmp/analysis-stale.json cp /tmp/control-analysis.json /tmp/analysis-stale.json
+1 -1
View File
@@ -3,7 +3,7 @@
**Start here:** read `docs/architecture/RFC-LANG-0002-unified-semantics.md` — it is the single current language authority — and its normative summary `spec/mapping.md` + `spec/expression.ebnf`. Then read `docs/DEVELOPMENT_BLUEPRINT.md` (architecture baseline; its language-mapping sections are historical), `docs/STATUS.md` (what is actually implemented, including the landed RFC-LANG-0002 migration), the relevant `spec/` files, `docs/adr/` for decisions at their date, `docs/contributor-guide.md`, and `tests/README.md` plus the conformance fixtures. Do not assume any current implementation or legacy Marqdo syntax is authoritative. **Start here:** read `docs/architecture/RFC-LANG-0002-unified-semantics.md` — it is the single current language authority — and its normative summary `spec/mapping.md` + `spec/expression.ebnf`. Then read `docs/DEVELOPMENT_BLUEPRINT.md` (architecture baseline; its language-mapping sections are historical), `docs/STATUS.md` (what is actually implemented, including the landed RFC-LANG-0002 migration), the relevant `spec/` files, `docs/adr/` for decisions at their date, `docs/contributor-guide.md`, and `tests/README.md` plus the conformance fixtures. Do not assume any current implementation or legacy Marqdo syntax is authoritative.
For next-phase work, the authoritative release policy for the current For next-phase work, the authoritative release policy for the current
`3.0.0-beta.1` line is `docs/MARQDO_3_0_PRERELEASE_PLAN.md` (beta gates, 3.0 prerelease line is `docs/MARQDO_3_0_PRERELEASE_PLAN.md` (beta gates,
REL-01..REL-05, version axes, LTS conditions). `docs/STABLE_RELEASE_IMPLEMENTATION.md` REL-01..REL-05, version axes, LTS conditions). `docs/STABLE_RELEASE_IMPLEMENTATION.md`
(stable gates G-A/G-B/G-C) is historical roadmap input for the later stable (stable gates G-A/G-B/G-C) is historical roadmap input for the later stable
release; it does not override the 3.0 prerelease plan. Also read `docs/CORE_STABILIZATION_AND_ECOSYSTEM_GATE.md` release; it does not override the 3.0 prerelease plan. Also read `docs/CORE_STABILIZATION_AND_ECOSYSTEM_GATE.md`
+49 -15
View File
@@ -1,20 +1,27 @@
# Changelog # Changelog
All notable changes to the Marqdo CLI workspace. Product version All notable changes to the Marqdo CLI workspace. Published prereleases:
`3.0.0-beta.1` was tagged on 2026-11-22 at source `3.0.0-beta.1` (2026-11-22, source
`2c7c4f31e7a388d3fcfa717a77067e696ed13854` `2c7c4f31e7a388d3fcfa717a77067e696ed13854`),
([release](https://git.cflmy.cn/cflmy/marqdo-cli/releases/tag/v3.0.0-beta.1)); `3.0.0-rc.1` (source `f7a5a7b0163bf5229ed09adfffd892f9899e6667`) and
the next section collects post-beta `3.0.0-rc.2` (source `9149ee40a48fcda692c5c112f66c465487d13dfb`); the next
changes. Current protocol contracts are Analysis, Observation, CLI Tool, section collects changes for the current `3.0.0-rc.3` candidate. 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 Plugin ABI v1, Foreign wire v1, Provider manifest v2 and lock v4; independent
package versions (including the bundled stdlib `0.1.0`) are versioned package versions (including the bundled stdlib `0.1.0`) are versioned
separately and do not follow the product version. Dates use ISO 8601. 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.3 (candidate) ## 3.0.0-rc.3 (candidate)
- The Rust workspace, CLI version output and protocol producers report - The Rust workspace, CLI version output and protocol producers report
`3.0.0-rc.3`. The locked workspace requires Rust 1.89 and targets Linux `3.0.0-rc.3`. The locked workspace requires Rust 1.89 and targets Linux
x86_64 on glibc 2.39. x86_64 on glibc 2.39.
- **Licensing:** the workspace is now Apache-2.0 only. `Cargo.toml` declares
`license = "Apache-2.0"` and the dual-licensed `LICENSE-MIT` file is removed;
the archive ships `LICENSE-APACHE` only. This is a repository-licensing
change, not a protocol or language change.
### Single current public contracts — issue #8 (breaking) ### Single current public contracts — issue #8 (breaking)
@@ -36,7 +43,9 @@ automatic migration.
the same execution. `run_id`, `seq`, frame identity, terminal semantics, the same execution. `run_id`, `seq`, frame identity, terminal semantics,
capture budgets and privacy rules are defined once in capture budgets and privacy rules are defined once in
[`spec/observation.md`](spec/observation.md). The retired `--json`, [`spec/observation.md`](spec/observation.md). The retired `--json`,
`--trace-file` and `--event-stream` options are rejected. `--trace-file`, `--event-stream` and `--trace` options are rejected, and the
in-process effect-trace document is gone: effects are `effect` observation
events.
- **CLI Tool requirements are single exact values.** `tool.json` declares - **CLI Tool requirements are single exact values.** `tool.json` declares
`requires.api_revision` (required) plus optional exact `analysis` and `requires.api_revision` (required) plus optional exact `analysis` and
`observation` integers. Version arrays and intersection negotiation are `observation` integers. Version arrays and intersection negotiation are
@@ -53,7 +62,30 @@ automatic migration.
explicit regeneration/reinstall instruction; no migrator runs. explicit regeneration/reinstall instruction; no migrator runs.
- **`spec/` now contains only current contracts.** Retired specifications are - **`spec/` now contains only current contracts.** Retired specifications are
available in Git history and tagged archives. ADRs covering retired public available in Git history and tagged archives. ADRs covering retired public
contracts carry a Historical header. contracts carry a Historical header. `docs/developers/analysis-trace.md` was
replaced by `analysis-observation.md`.
- **CI is a protocol consumer.** A fast `contract` lane builds both shipped
binaries and drives the real CLI through the independent Python consumers,
while the full `test` lane runs fmt/clippy/tests/docs/architecture gates.
`tools/ci/verify_observation_stream.py` (checked in, unit-tested) asserts
that one run's JSONL stream and JSON snapshot are the same event sequence.
### Review fixes after the first candidate build
- A rejected strict observation destination no longer emits a partial JSONL
stream: `--output jsonl` and `--observation-file` are refused before any
session opens.
- `check --emit` removes a previous Analysis artifact when the project cannot
be loaded, not only when it has compile errors.
- Filesystem resource requests report their concrete effect operation
(`fs.exists`, `fs.metadata`, `fs.list`, `fs.mkdir`, `fs.remove`,
`fs.rename`) instead of a generic `resource.request`.
- The shared worker transport preserves the plugin ABI frame codes
`worker_frame_too_large` and `worker_encode_failed`.
- The event and snapshot schemas agree on the capture `level` enum.
- The G4 workload catalogue uses `run`/`call --output json` and pins the
current snapshot in its correctness digest; the previously retired `--json`
flag made every non-check workload fail correctness verification.
Migration for consumers: Migration for consumers:
@@ -78,13 +110,15 @@ Migration for consumers:
- `crates/cli/tests/architecture_boundaries.rs` forbids a second worker - `crates/cli/tests/architecture_boundaries.rs` forbids a second worker
framing implementation and pins the workspace layer list; framing implementation and pins the workspace layer list;
`docs_consistency` keeps one current overview and resolving links. `docs_consistency` keeps one current overview and resolving links.
- Same-SHA Linux CI [pipeline #70](https://ci.cflmy.cn/repos/1/pipeline/70) - Same-SHA Linux CI, the deterministic archive build, the from-archive smoke,
passed all lanes, produced archive sha256 the cold-install container check and the frozen external conformance suite
`d6ef6297a7ba5297af758a0b00da5c6e0f4b69f40363afc4ddc180654e70ac37`, passed (fixtures at `015ff8ac15417b7ebbdb31ce2be2dab5362a1eba`) are recorded in the
the from-archive smoke and the frozen external conformance suite 7/7 with per-gate evidence bound to the release SHA; see
fixtures at `015ff8ac15417b7ebbdb31ce2be2dab5362a1eba`. [`docs/releasing.md`](docs/releasing.md) and [`docs/STATUS.md`](docs/STATUS.md).
- Publication still requires the RC strict-VM and G4 performance evidence - The RC strict-L1 disposable-VM lane and the G4 shared-node comparison
described in [`docs/releasing.md`](docs/releasing.md). (maintainer-approved `WARN` for this named RC, with the environment and
limits recorded in the release notes) complete the RC gate set; the archive
sha256 for the tagged SHA is published with the release assets.
## 3.0.0-rc.2 (candidate) ## 3.0.0-rc.2 (candidate)
+38 -42
View File
@@ -1,17 +1,17 @@
# Compatibility and support matrix # Compatibility and support matrix
Snapshot: product version **`3.0.0-beta.1`** (prerelease), branch `master`, Snapshot: candidate product version **`3.0.0-rc.3`** (prerelease). The last
tagged `v3.0.0-beta.1` at source SHA `2c7c4f31e7a388d3fcfa717a77067e696ed13854`. This file records what was actually verified and published prerelease is `3.0.0-rc.2` at source SHA
separates it from what is only implemented. The supported release platform is `9149ee40a48fcda692c5c112f66c465487d13dfb`. This file records what was
**Linux x86_64 (glibc)**; everything else is experimental and not claimed for actually verified and separates it from what is only implemented. The
this beta. Executed status and same-SHA evidence are in supported release platform is **Linux x86_64 (glibc 2.39)**; everything else is
[`docs/STATUS.md`](docs/STATUS.md), and SHA-bound external evidence is under experimental and not claimed for this prerelease. Executed status and
[`docs/evidence/extension/`](docs/evidence/extension/README.md). SHA-bound evidence are in [`docs/STATUS.md`](docs/STATUS.md) and under
[`docs/evidence/`](docs/evidence/extension/README.md).
The `3.0.0-rc.3` candidate targets Linux x86_64 on glibc 2.39 and The `3.0.0-rc.3` candidate includes the post-beta protocol convergence below.
includes the post-beta changes below. See the See the [RC acceptance procedure](docs/releasing.md). The platform evidence
[RC acceptance procedure](docs/releasing.md). The platform evidence table table records the beta, rc.1/rc.2 and candidate verification.
records the beta and subsequent development verification.
## Language source syntax (breaking change) ## Language source syntax (breaking change)
@@ -65,9 +65,9 @@ evidence: [`docs/evidence/2026-11-22-rfc-ext-0003-core-hardcoding.md`](docs/evid
| Heading Annotations v1 (H-05/H-07) | **Proposed, not implemented.** This build still rejects unknown `@foo` with `sem.invalid_mode_marker`; no annotation manifest, `annotation.unknown` or heading annotations projection exists yet. Target `3.1.x`; ADR-0060 and `spec/heading-annotations-v1.md`. | | Heading Annotations v1 (H-05/H-07) | **Proposed, not implemented.** This build still rejects unknown `@foo` with `sem.invalid_mode_marker`; no annotation manifest, `annotation.unknown` or heading annotations projection exists yet. Target `3.1.x`; ADR-0060 and `spec/heading-annotations-v1.md`. |
| Foreign removal F-B (H-02) | **Deferred, not claimed.** The one-shot permission-gated `foreign.*` primitive remains (F-A); its grants/digest/timeout/wire/output negatives are unchanged and must not be skipped. ADR-0063 and `spec/foreign.md` §8. | | Foreign removal F-B (H-02) | **Deferred, not claimed.** The one-shot permission-gated `foreign.*` primitive remains (F-A); its grants/digest/timeout/wire/output negatives are unchanged and must not be skipped. ADR-0063 and `spec/foreign.md` §8. |
## Structured control flow (RFC-CTRL-0005, RC.2) ## Structured control flow (RFC-CTRL-0005, RC.2 and later)
The RC.2 candidate reserves `break` and `continue` only as complete The RC.2 and RC.3 candidates reserve `break` and `continue` only as complete
payloads. An existing standalone identifier read can be written as payloads. An existing standalone identifier read can be written as
`(break)` or `(continue)`. Calls, bindings, fields and identifiers within `(break)` or `(continue)`. Calls, bindings, fields and identifiers within
expressions retain their meaning. Two separate carriers containing `else` and expressions retain their meaning. Two separate carriers containing `else` and
@@ -77,9 +77,9 @@ Parameter inference ignores reads after a definite transfer. When upgrading
a caller that passed an argument inferred solely from unreachable code, a caller that passed an argument inferred solely from unreachable code,
remove the argument or keep it through an explicit `params(...)` declaration. remove the argument or keep it through an explicit `params(...)` declaration.
`marqdo-lint 0.1.0` reads legacy Analysis v2 documents. Its control layout The current Analysis contract is `schema_version: 3` for every project, so an
alignment for `else if` and its Analysis v3 support require an update in external tool that still reads Analysis v2 must be updated before it can
that tool. consume this candidate's `check --emit` output.
## Public protocol versions ## Public protocol versions
@@ -88,14 +88,13 @@ that tool.
| Markdown profile | `marqdo.md.v1` | Frozen parser/options. The RFC-LANG-0002 mapping rewrite keeps this profile; the source-language break is tracked above, not by a new profile id. | | Markdown profile | `marqdo.md.v1` | Frozen parser/options. The RFC-LANG-0002 mapping rewrite keeps this profile; the source-language break is tracked above, not by a new profile id. |
| Language / CLI | `3.0.0-rc.3` (candidate) | SemVer prerelease: breaking changes inside the 3.0 beta line are allowed and announced in the changelog. The `.mq.md` source language changed incompatibly (RFC-LANG-0002); there is no old-syntax execution path or downgrade. CLI flags may change with a changelog note; `strict` refusal is contractual. | | Language / CLI | `3.0.0-rc.3` (candidate) | SemVer prerelease: breaking changes inside the 3.0 beta line are allowed and announced in the changelog. The `.mq.md` source language changed incompatibly (RFC-LANG-0002); there is no old-syntax execution path or downgrade. CLI flags may change with a changelog note; `strict` refusal is contractual. |
| `marqdo.lock` | v4 | v3 is rejected with an explicit `marqdo lock` migration error; v1/v2 are rejected with a relock instruction; `run`/`call`/`check` never rewrite or fetch the lock. `extensions:` records manifest/artifact identity (integrity, not publisher auth). | | `marqdo.lock` | v4 | v3 is rejected with an explicit `marqdo lock` migration error; v1/v2 are rejected with a relock instruction; `run`/`call`/`check` never rewrite or fetch the lock. `extensions:` records manifest/artifact identity (integrity, not publisher auth). |
| Analysis | v2/v3 | Projects with loop transfers emit v3. Other projects emit v2. Consumers reject unknown majors. | | 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). |
| Trace | v2 | Binds to the exact Analysis bytes; unknown majors rejected. | | 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). |
| Execution Events | v1 | Live NDJSON for `run/call --event-stream jsonl`; independent version axis. Values are opt-in and bounded; unknown majors rejected. Not yet part of the tagged beta archive (post-beta addition). | | CLI Tool | revision 1 | `requires.api_revision` is one exact integer; `analysis`/`observation` are optional exact integers. Version arrays and intersection negotiation are rejected with a reinstall instruction. |
| CLI Tool | v1 | Manifest schema, SemVer negotiation and whole-bundle digest are stable for v1. |
| Plugin ABI | v1 | Struct layout/version negotiation frozen; `--trust-native-plugin` is required for in-process loading. The static manifest signature is authoritative; `run` reconciles loaded exports/signatures/owners/artifact digests exactly (`ext.plugin_binding_mismatch`); ABI v1 defaults are rejected. | | Plugin ABI | v1 | Struct layout/version negotiation frozen; `--trust-native-plugin` is required for in-process loading. The static manifest signature is authoritative; `run` reconciles loaded exports/signatures/owners/artifact digests exactly (`ext.plugin_binding_mismatch`); ABI v1 defaults are rejected. |
| Resource Provider manifest | v2 | `schema_version: 2`, `abi: c-abi-1`, `transport: worker`; v1 is rejected (`ext.unsupported_provider_schema`), no silent migration. CLI `--provider`/`--allow-provider`; trusted worker, not an OS sandbox. The six core kinds come from one `marqdo_host::CORE_RESOURCE_KINDS` registry and are rejected as a provider name or kind (ADR-0062). | | Resource Provider manifest | v2 | `schema_version: 2`, `abi: c-abi-1`, `transport: worker`; v1 is rejected (`ext.unsupported_provider_schema`), no silent migration. CLI `--provider`/`--allow-provider`; trusted worker, not an OS sandbox. The six core kinds come from one `marqdo_host::CORE_RESOURCE_KINDS` registry and are rejected as a provider name or kind (ADR-0062). |
| Callable resolution | ADR-0054 | One registry + one binding pass; `check` and `run` bind the same `CallSiteKey`; no runtime name fallback. Import aliases colliding with builtin/plugin dotted namespaces are rejected. The `math` namespace is no longer a builtin namespace (ADR-0061). | | Callable resolution | ADR-0054 | One registry + one binding pass; `check` and `run` bind the same `CallSiteKey`; no runtime name fallback. Import aliases colliding with builtin/plugin dotted namespaces are rejected. The `math` namespace is no longer a builtin namespace (ADR-0061). |
| Analysis `calls[].state/target` | v2 (projection) | Now projected from the unique binding; official stdlib aliases appear as `function`. Schema/version unchanged; private binding table not serialized. | | 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`). | | 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. | | Foreign wire | v1 | One-shot request envelope; provider descriptors are explicit. |
@@ -119,9 +118,8 @@ portable/tested locally but the native platform lane has not run here;
| Resource Provider v2 CLI (`--provider`/`--allow-provider`, worker helper) | PASS (linux/x86_64; real C sensor + helper) | **FAIL-CLOSED** (`ext.platform_unsupported`) | **UNSUPPORTED** | | Resource Provider v2 CLI (`--provider`/`--allow-provider`, worker helper) | PASS (linux/x86_64; real C sensor + helper) | **FAIL-CLOSED** (`ext.platform_unsupported`) | **UNSUPPORTED** |
| Capability handler registry (`fs.read` handler, audit, unavailable) | PASS | UNVERIFIED | UNVERIFIED | | Capability handler registry (`fs.read` handler, audit, unavailable) | PASS | UNVERIFIED | UNVERIFIED |
| External conformance repository (`marqdo-extension-conformance`, frozen CLI) | PASS (`--release` binary sha256 `28e3776d…`, fixture repo `e4b7352c…`; see `docs/evidence/extension/6a7bb983.../manifest.json`) | UNVERIFIED | UNVERIFIED | | External conformance repository (`marqdo-extension-conformance`, frozen CLI) | PASS (`--release` binary sha256 `28e3776d…`, fixture repo `e4b7352c…`; see `docs/evidence/extension/6a7bb983.../manifest.json`) | UNVERIFIED | UNVERIFIED |
| Analysis v2 / Trace v2 + Python consumers | PASS | UNVERIFIED | UNVERIFIED | | Analysis v3 + Observation v1 + Python consumers | PASS (same-SHA CI contract lane and archive smoke; independent consumers) | UNVERIFIED | UNVERIFIED |
| Execution Events v1 (`--event-stream jsonl`, P0/P1) | PASS locally (14 CLI contract tests + 8 host + 4 runtime; independent Python schema consumer); post-beta, not in the tagged archive | UNVERIFIED | UNVERIFIED | | CLI Tool revision 1 + independent consumers | PASS | UNVERIFIED | UNVERIFIED |
| Tool Protocol v1 + 3 independent consumers | PASS | UNVERIFIED | UNVERIFIED |
| Native ABI (`plugin inspect`, trusted call) | PASS (C fixture) | UNVERIFIED (host-native fixture) | **UNSUPPORTED** | | Native ABI (`plugin inspect`, trusted call) | PASS (C fixture) | UNVERIFIED (host-native fixture) | **UNSUPPORTED** |
| Worker ABI + `fs.read` bridge | PASS (Unix) | UNVERIFIED | **UNSUPPORTED** (Unix-gated) | | Worker ABI + `fs.read` bridge | PASS (Unix) | UNVERIFIED | **UNSUPPORTED** (Unix-gated) |
| Foreign Python/Node | PASS (system `python3`/`node`) | UNVERIFIED | UNVERIFIED | | Foreign Python/Node | PASS (system `python3`/`node`) | UNVERIFIED | UNVERIFIED |
@@ -149,14 +147,15 @@ the Windows C ABI/provider paths remain fail-closed.
rlimits and wall-clock/output supervision; the child verifies `PID 1`, rlimits and wall-clock/output supervision; the child verifies `PID 1`,
`NoNewPrivs`, `CapEff=0`, a non-initial uid map and no non-loopback network. `NoNewPrivs`, `CapEff=0`, a non-initial uid map and no non-loopback network.
- Refused before launch: `--allow-read`, `--allow-write`, `--allow-foreign`, - Refused before launch: `--allow-read`, `--allow-write`, `--allow-foreign`,
`--allow-plugin`, `--plugin`, `--trust-native-plugin`, `--kernel`, `--allow-plugin`, `--plugin`, `--trust-native-plugin`, `--kernel`;
`--trace-file`. `--output jsonl` and `--observation-file` are refused because the supervisor
owns the output channel.
- Strict L2 (letting Worker/Foreign/native plugin run inside the sandbox) is - Strict L2 (letting Worker/Foreign/native plugin run inside the sandbox) is
not implemented and must not be inferred from L1 passing. not implemented and must not be inferred from L1 passing.
## Minimum environment ## Minimum environment
- Rust 1.82+ (verified with 1.100.0). - Rust 1.89+ (locked minimum; verified with 1.100.0).
- Linux/macOS: a C compiler for Native ABI fixtures; Python/Node only for - Linux/macOS: a C compiler for Native ABI fixtures; Python/Node only for
Foreign kernels; `git` for Git dependencies. Foreign kernels; `git` for Git dependencies.
- `strict` additionally requires Bubblewrap and a kernel/environment that - `strict` additionally requires Bubblewrap and a kernel/environment that
@@ -175,7 +174,7 @@ the Windows C ABI/provider paths remain fail-closed.
* The external conformance suite is a mandatory **additional** release gate * The external conformance suite is a mandatory **additional** release gate
(`docs/releasing.md` §7); it does not replace G3/G4/native lanes. (`docs/releasing.md` §7); it does not replace G3/G4/native lanes.
## Explicitly unsupported in this beta ## Explicitly unsupported in this prerelease
- Pre-RFC `.mq.md` source syntax (Strong-execute / Emph-return / ordered-list - Pre-RFC `.mq.md` source syntax (Strong-execute / Emph-return / ordered-list
branch / bullet-list loop / block-quote call / first code-span signature). branch / bullet-list loop / block-quote call / first code-span signature).
@@ -190,20 +189,17 @@ the Windows C ABI/provider paths remain fail-closed.
sessions, and general-purpose CAS. The three `sample-*` tools are test sessions, and general-purpose CAS. The three `sample-*` tools are test
fixtures for the generic Tool protocol, not product features. fixtures for the generic Tool protocol, not product features.
- Tagged Windows/macOS release archives: only the Linux x86_64 archive is - Tagged Windows/macOS release archives: only the Linux x86_64 archive is
produced for `3.0.0-beta.1`. macOS/Windows native artifacts are not claimed; produced for the 3.0 prerelease line. macOS/Windows native artifacts are not
the Windows lane is a Linux-hosted compile gate only. claimed; the Windows lane is a Linux-hosted compile gate only.
## Release decision ## Release decision
**`3.0.0-beta.1` prerelease — approved as a Linux x86_64 beta with explicitly **`3.0.0-rc.3` prerelease candidate — Linux x86_64 only.** The RC profile in
recorded gaps.** The beta profile in [`docs/MARQDO_3_0_PRERELEASE_PLAN.md`](docs/MARQDO_3_0_PRERELEASE_PLAN.md) §3 is
[`docs/MARQDO_3_0_PRERELEASE_PLAN.md`](docs/MARQDO_3_0_PRERELEASE_PLAN.md) §3.1 used, not the stable profile: Linux is the only supported platform,
was used, not the stable profile: Linux is the only supported platform, macOS/Windows are declared UNSUPPORTED for this scope, strict L1 requires
macOS/Windows are declared unsupported/experimental, G4 is a Beta-only `WARN` same-SHA disposable-VM evidence and G4 performance is recorded as a
on the fixed Woodpecker agent, and strict policy and frozen-binary conformance maintainer-approved shared-node `WARN` for this named RC. The aggregate decision
are recorded with same-SHA evidence in [`docs/STATUS.md`](docs/STATUS.md) and and per-gate evidence are bound to the candidate SHA in
[`docs/evidence/ci/2c7c4f31e7a388d3fcfa717a77067e696ed13854/manifest.json`](docs/evidence/ci/2c7c4f31e7a388d3fcfa717a77067e696ed13854/manifest.json) [`docs/STATUS.md`](docs/STATUS.md) and the release assets. A prerelease does not
(`BETA_RELEASE_CANDIDATE`). Release: imply stable `3.0.0` or LTS; the stable gate remains stricter and separate.
https://git.cflmy.cn/cflmy/marqdo-cli/releases/tag/v3.0.0-beta.1. Beta status
does not imply stable `3.0.0` or LTS; the stable gate remains stricter and
separate.
+3 -3
View File
@@ -215,7 +215,7 @@ rules are [`RFC-LANG-0002`](docs/architecture/RFC-LANG-0002-unified-semantics.md
`lock`, strict `sync --locked` with atomic `.marqdo/env` materialization. `lock`, strict `sync --locked` with atomic `.marqdo/env` materialization.
`run`/`call`/`check` never fetch or rewrite the lock. `run`/`call`/`check` never fetch or rewrite the lock.
* **P4 security core** — capability-checked host operations, project-relative * **P4 security core** — capability-checked host operations, project-relative
FS globs with traversal rejection, budgets, effect trace, `pure`/`project` FS globs with traversal rejection, budgets, Observation effect events, `pure`/`project`
modes, and **Linux `strict` mode** using Bubblewrap namespaces, no-new-privs, modes, and **Linux `strict` mode** using Bubblewrap namespaces, no-new-privs,
capability dropping, rlimits, a wall-clock supervisor and child capability dropping, rlimits, a wall-clock supervisor and child
self-verification (ADR-0021). It is probe-gated and verified in a disposable self-verification (ADR-0021). It is probe-gated and verified in a disposable
@@ -251,7 +251,7 @@ cargo clippy --workspace --all-targets -- -D warnings
* **Strict is Linux-only and L1-only.** `--mode strict` enables the * **Strict is Linux-only and L1-only.** `--mode strict` enables the
Bubblewrap supervisor only when its runtime probe passes; otherwise it exits Bubblewrap supervisor only when its runtime probe passes; otherwise it exits
1. It supports pure Marqdo arithmetic and rejects Foreign, plugins, kernels, 1. It supports pure Marqdo arithmetic and rejects Foreign, plugins, kernels,
external grants and trace files (exit 2). Worker plugins provide external grants and live/file observation destinations (exit 2). Worker plugins provide
crash/address-space isolation, not an OS sandbox, and are not allowed in crash/address-space isolation, not an OS sandbox, and are not allowed in
strict. strict.
* **Native plugins run in-process** and require an explicit unsafe trust flag. * **Native plugins run in-process** and require an explicit unsafe trust flag.
@@ -327,7 +327,7 @@ tests/ conformance/negative corpus (see tests/README.md)
* [`docs/developers/README.md`](docs/developers/README.md) — third-party and * [`docs/developers/README.md`](docs/developers/README.md) — third-party and
integrator entry point (libraries, tools, plugins, kernels, providers, integrator entry point (libraries, tools, plugins, kernels, providers,
Analysis/Trace consumers, compatibility). Analysis/Trace consumers, compatibility).
* [`docs/MARQDO_THIRD_PARTY_INTEGRATION_GUIDE.md`](docs/MARQDO_THIRD_PARTY_INTEGRATION_GUIDE.md) * [`docs/MARQDO_THIRD_PARTY_INTEGRATION_GUIDE.md`](docs/MARQDO_THIRD_PARTY_INTEGRATION_GUIDE.md) — beta-era integration handbook (historical; current contracts are `spec/`)
— end-to-end third-party integration handbook. — end-to-end third-party integration handbook.
* [`docs/STABLE_RELEASE_IMPLEMENTATION.md`](docs/STABLE_RELEASE_IMPLEMENTATION.md) * [`docs/STABLE_RELEASE_IMPLEMENTATION.md`](docs/STABLE_RELEASE_IMPLEMENTATION.md)
— historical stable-release roadmap input (its own header marks it Proposed — historical stable-release roadmap input (its own header marks it Proposed
+1 -1
View File
@@ -238,7 +238,7 @@ fn function_json(function: &Function) -> Value {
/// Project an assignment place. Local targets keep the v1 string form; the new /// Project an assignment place. Local targets keep the v1 string form; the new
/// index target is an additive object so existing consumers that compare the /// index target is an additive object so existing consumers that compare the
/// local `target` string are unaffected (Analysis v2, ADR-0022). /// local `target` string are unaffected (Analysis v3, ADR-0022).
fn place_json(place: &PlaceTarget) -> Value { fn place_json(place: &PlaceTarget) -> Value {
match place { match place {
PlaceTarget::Local { name, .. } => Value::String(name.clone()), PlaceTarget::Local { name, .. } => Value::String(name.clone()),
+2 -2
View File
@@ -418,7 +418,8 @@ fn runtime_location_json(
if let Some(located) = project.locate(module_id, span) { if let Some(located) = project.locate(module_id, span) {
location["line"] = json!(located.line); location["line"] = json!(located.line);
location["column"] = json!(located.column); location["column"] = json!(located.column);
location["file"] = json!(located.file.path.display().to_string()); // Attribution for a shareable snapshot is the project-relative
// path; an absolute host path is environment data, not contract.
location["relative_path"] = json!(located.file.module_id.relative_path); location["relative_path"] = json!(located.file.module_id.relative_path);
} }
} }
@@ -444,7 +445,6 @@ fn runtime_error_json(error: &RuntimeError, project: &LoadedProject) -> serde_js
"span": location["span"], "span": location["span"],
"line": location["line"], "line": location["line"],
"column": location["column"], "column": location["column"],
"file": location["file"],
"relative_path": location["relative_path"], "relative_path": location["relative_path"],
"frames": frames, "frames": frames,
}) })
+9 -1
View File
@@ -11,7 +11,15 @@ pub fn check(
) -> i32 { ) -> i32 {
let prepared = match prepare_project(file, json, plugins) { let prepared = match prepare_project(file, json, plugins) {
Ok(prepared) => prepared, Ok(prepared) => prepared,
Err(code) => return code, Err(code) => {
// A failed check never leaves a success artifact behind: a consumer
// must not be able to bind `run` to a previous Analysis after the
// project stopped loading or compiling.
if let Some(path) = emit {
let _ = std::fs::remove_file(path);
}
return code;
}
}; };
let mut project = prepared.loaded; let mut project = prepared.loaded;
if refs { if refs {
+18 -18
View File
@@ -21,16 +21,25 @@ pub fn execute(
); );
return 2; return 2;
} }
// Strict runs project code under the isolation supervisor, which owns
// stdout. A live JSONL stream or a file destination would bypass that
// supervisor, so reject the destination before any session is opened: an
// unsupported destination must never produce a partial stream.
if settings.mode == "strict"
&& (observation.output == OutputFormat::Jsonl || observation.file.is_some())
{
return fail(
None,
"strict",
"strict.unsupported_grant",
"strict mode supports text and JSON snapshots on stdout; it rejects live or file destinations",
2,
);
}
// Open before preparation so option, compile and authorization failures // Open before preparation so option, compile and authorization failures
// can still publish a rejection on the requested observation destination. // can still publish a rejection on the requested observation destination.
let strict_destination_rejected = settings.mode == "strict" let events = if observation.enabled() {
&& (observation.output == OutputFormat::Jsonl || observation.file.is_some()); match ObservationSession::open(observation) {
let mut destinations = observation.clone();
if strict_destination_rejected {
destinations.file = None;
}
let events = if destinations.enabled() {
match ObservationSession::open(&destinations) {
Ok(events) => Some(events), Ok(events) => Some(events),
Err(error) => return transport_failure(&error), Err(error) => return transport_failure(&error),
} }
@@ -38,18 +47,9 @@ pub fn execute(
None None
}; };
let stream = events.as_ref(); let stream = events.as_ref();
if strict_destination_rejected {
return fail(
stream,
"strict",
"strict.unsupported_grant",
"strict mode supports text and JSON snapshots on stdout; it rejects live or file destinations",
2,
);
}
let named_args = match named_args { let named_args = match named_args {
Ok(args) => args, Ok(args) => args,
Err(message) => return fail(stream, "prepare", "cli.invalid_argument", &message, 2), Err(message) => return fail(stream, "options", "cli.invalid_argument", &message, 2),
}; };
let options = PrepareOptions { let options = PrepareOptions {
plugins: settings.plugins.clone(), plugins: settings.plugins.clone(),
+25
View File
@@ -337,6 +337,31 @@ fn failed_check_removes_stale_analysis() {
assert!(!target.exists(), "stale success artifact must be removed"); assert!(!target.exists(), "stale success artifact must be removed");
} }
#[test]
fn check_that_cannot_load_the_project_removes_stale_analysis() {
let dir = TempDir::new("analysis-load-error");
write(dir.path(), "index.mq.md", "## @exec main\n\n`return 1`\n");
let target = dir.path().join("analysis.json");
let first = cli(
dir.path(),
&["check", "index.mq.md", "--emit", target.to_str().unwrap()],
);
assert_eq!(first.status.code(), Some(0), "{first:?}");
assert!(target.exists());
// The load failure happens before the compile-error cleanup branch, so the
// remove must also cover the prepare path.
let failed = cli(
dir.path(),
&["check", "missing.mq.md", "--emit", target.to_str().unwrap()],
);
assert_ne!(failed.status.code(), Some(0), "{failed:?}");
assert!(
!target.exists(),
"a load failure must not leave the previous Analysis in place"
);
}
#[test] #[test]
fn snapshot_records_calls_effects_and_status_without_secrets() { fn snapshot_records_calls_effects_and_status_without_secrets() {
let dir = TempDir::new("trace"); let dir = TempDir::new("trace");
+69
View File
@@ -231,3 +231,72 @@ fn ci_configuration_uses_only_current_protocols() {
} }
} }
} }
/// The current contract documents must describe the interface that exists.
/// A retired option or a path to a deleted spec in `spec/` or the current
/// developer guides is a release-record defect: consumers would implement a
/// contract the binary does not accept. Historical ADRs, evidence and
/// `docs/history/` keep their original text and are intentionally excluded.
#[test]
fn current_contract_documents_do_not_reference_retired_interfaces() {
let root = repo_root();
let mut files = vec![
"COMPATIBILITY.md".to_string(),
"README.md".to_string(),
"docs/ci.md".to_string(),
"docs/architecture/CURRENT.md".to_string(),
];
for directory in ["spec", "docs/developers", "examples"] {
let base = root.join(directory);
let mut stack = vec![base];
while let Some(path) = stack.pop() {
for entry in std::fs::read_dir(&path).expect("read contract docs") {
let path = entry.unwrap().path();
if path.is_dir() {
stack.push(path);
} else if path.extension().and_then(|ext| ext.to_str()) == Some("md") {
files.push(
path.strip_prefix(&root)
.unwrap()
.to_string_lossy()
.to_string(),
);
}
}
}
}
let retired = [
"--trace-file",
"--event-stream",
"EffectTrace",
"crates/marqdo-host/src/trace.rs",
"spec/trace-v1.md",
"spec/trace-v2.md",
"spec/execution-events-v1.md",
"spec/analysis-v1.md",
"spec/analysis-v2.md",
"spec/tool-v1.md",
"worker_frame_invalid for an over-limit",
];
for relative in files {
let text = read(&root.join(&relative));
for (number, line) in text.lines().enumerate() {
for token in retired {
if !line.contains(token) {
continue;
}
// A sentence that explicitly marks the interface as retired or
// removed is documentation of the migration, not a claim that
// it is available.
let explained = line.contains("retired")
|| line.contains("removed")
|| line.contains("no longer");
assert!(
explained,
"{relative}:{} still documents retired `{token}`",
number + 1
);
}
}
}
}
+2 -13
View File
@@ -989,22 +989,11 @@ fn runtime_error_in_imported_module_reports_that_module() {
); );
assert_eq!(error["relative_path"], "physics.mq.md"); assert_eq!(error["relative_path"], "physics.mq.md");
assert!( assert!(
error["file"] error.get("file").is_none(),
.as_str() "a shareable snapshot must not embed an absolute host path: {error}"
.unwrap_or_default()
.ends_with("physics.mq.md"),
"{}",
error["file"]
); );
let line = error["line"].as_u64().unwrap_or(0); let line = error["line"].as_u64().unwrap_or(0);
assert!(line >= 5, "expected the failing statement line, got {line}"); assert!(line >= 5, "expected the failing statement line, got {line}");
assert!(
!error["file"]
.as_str()
.unwrap_or_default()
.ends_with("index.mq.md"),
"must not blame the entry file"
);
let human = cli(dir.path(), &["run", "index.mq.md"]); let human = cli(dir.path(), &["run", "index.mq.md"]);
assert_exit(&human, 1, "human rendering also fails"); assert_exit(&human, 1, "human rendering also fails");
+43
View File
@@ -878,3 +878,46 @@ fn loop_transfers_are_ordered_structural_events_with_source_spans() {
assert_eq!(statement["span"], span); assert_eq!(statement["span"], span);
} }
} }
#[test]
fn strict_mode_rejects_live_and_file_destinations_before_opening_a_stream() {
let dir = TempDir::new("strict-destinations");
dir.write("index.mq.md", BASIC);
let snapshot = dir.path().join("snapshot.json");
let snapshot_arg = snapshot.to_str().unwrap().to_string();
for args in [
vec![
"run",
"index.mq.md",
"--mode",
"strict",
"--output",
"jsonl",
],
vec![
"run",
"index.mq.md",
"--mode",
"strict",
"--output",
"text",
"--observation-file",
snapshot_arg.as_str(),
],
] {
let output = cli(dir.path(), &args);
assert_eq!(output.status.code(), Some(2), "{args:?}: {output:?}");
assert!(
output.stdout.is_empty(),
"a rejected strict destination must not emit a partial stream: {}",
String::from_utf8_lossy(&output.stdout)
);
let stderr = String::from_utf8_lossy(&output.stderr);
assert!(stderr.contains("strict.unsupported_grant"), "{stderr}");
assert!(
!snapshot.exists(),
"a rejected strict destination must not publish a snapshot file"
);
}
}
@@ -516,7 +516,7 @@ impl StdHost {
_ => unreachable!(), _ => unreachable!(),
} }
let result = self.fs.request(name, &paths, ctx.span)?; let result = self.fs.request(name, &paths, ctx.span)?;
self.observe_effect("resource.request", "ok", ctx); self.observe_effect(&format!("fs.{name}"), "ok", ctx);
Ok(result) Ok(result)
} }
_ => { _ => {
+31
View File
@@ -333,8 +333,39 @@ fn transport_error(error: TransportError) -> PluginError {
"plugin.crashed", "plugin.crashed",
format!("worker frame I/O failed: {error}"), format!("worker frame I/O failed: {error}"),
), ),
// The shared transport classifies an over-limit or unencodable frame
// before anything is written. Keep the boundary-specific codes the
// plugin ABI has always reported instead of flattening them into
// `worker_frame_invalid`.
TransportError::Frame(FrameError::Encode(error)) => {
PluginError::wire("worker_encode_failed", error.to_string())
}
TransportError::Frame(FrameError::Length(length)) => PluginError::wire(
"worker_frame_too_large",
format!("worker frame is {length} bytes"),
),
TransportError::Frame(other) => { TransportError::Frame(other) => {
PluginError::wire("worker_frame_invalid", other.to_string()) PluginError::wire("worker_frame_invalid", other.to_string())
} }
} }
} }
#[cfg(test)]
mod tests {
use super::*;
#[test]
fn transport_errors_keep_the_boundary_specific_codes() {
let too_large = transport_error(TransportError::Frame(FrameError::Length(9 * 1024 * 1024)));
assert_eq!(too_large.code, "worker_frame_too_large");
let over_limit = transport_error(TransportError::Frame(FrameError::PartialPayload {
expected: 10,
actual: 3,
}));
assert_eq!(over_limit.code, "worker_frame_invalid");
let closed = transport_error(TransportError::Closed);
assert_eq!(closed.code, "plugin.crashed");
}
}
+73
View File
@@ -462,3 +462,76 @@ fn value_encoding_is_selected_bounded_and_handle_safe() {
assert_eq!(state, ValueState::Unsupported); assert_eq!(state, ValueState::Unsupported);
assert!(value.is_none()); assert!(value.is_none());
} }
#[test]
fn filesystem_operations_report_the_concrete_effect_name() {
let dir = std::env::temp_dir().join(format!(
"marqdo-host-fs-effect-{}-{}",
std::process::id(),
std::time::SystemTime::now()
.duration_since(std::time::UNIX_EPOCH)
.unwrap()
.as_nanos()
));
std::fs::create_dir_all(&dir).unwrap();
std::fs::write(dir.join("data.txt"), b"x").unwrap();
std::fs::create_dir_all(dir.join("sub")).unwrap();
let events = Rc::new(RefCell::new(Vec::new()));
let mut host = StdHost::new(
SandboxMode::Project,
Capabilities::project().allow_read("**").allow_write("**"),
dir.clone(),
)
.with_observation(
ObservationConfig::default(),
Box::new(Recorder {
events: Rc::clone(&events),
fail: false,
}),
);
let ctx = context();
for (operation, args) in [
("fs.exists", vec![Value::Text("data.txt".to_string())]),
("fs.metadata", vec![Value::Text("data.txt".to_string())]),
("fs.list", vec![Value::Text("sub".to_string())]),
("fs.mkdir", vec![Value::Text("created".to_string())]),
("fs.remove", vec![Value::Text("created".to_string())]),
(
"fs.rename",
vec![
Value::Text("data.txt".to_string()),
Value::Text("moved.txt".to_string()),
],
),
] {
host.resource_request(operation, args, &ctx)
.unwrap_or_else(|error| panic!("{operation}: {error}"));
}
let operations: Vec<String> = events
.borrow()
.iter()
.filter_map(|event| match event {
Recorded::Effect {
operation,
result_code,
} => {
assert_eq!(result_code, "ok");
Some(operation.clone())
}
_ => None,
})
.collect();
assert_eq!(
operations,
[
"fs.exists",
"fs.metadata",
"fs.list",
"fs.mkdir",
"fs.remove",
"fs.rename",
],
"each filesystem request must report its concrete operation"
);
let _ = std::fs::remove_dir_all(&dir);
}
+1 -1
View File
@@ -3,7 +3,7 @@
//! The frontend resolves every statically visible call site exactly once and //! The frontend resolves every statically visible call site exactly once and
//! records the decision here. The runtime only dispatches by this table: it //! records the decision here. The runtime only dispatches by this table: it
//! never re-resolves a qualified name and never guesses a plugin from a string //! never re-resolves a qualified name and never guesses a plugin from a string
//! prefix. The table is internal IR (not part of Analysis/Trace v2 wire //! prefix. The table is internal IR (not part of the Analysis/Observation wire
//! contracts) and is deliberately skipped when a [`crate::Program`] is //! contracts) and is deliberately skipped when a [`crate::Program`] is
//! serialized. //! serialized.
//! //!
+1 -1
View File
@@ -491,7 +491,7 @@ pub struct Program {
pub external_callables: Vec<callable::CallableDescriptor>, pub external_callables: Vec<callable::CallableDescriptor>,
/// Resolved static call bindings (RFC-EXT-0001 §4.2, ADR-0054). /// Resolved static call bindings (RFC-EXT-0001 §4.2, ADR-0054).
/// ///
/// Internal IR: deliberately skipped on the wire so Analysis/Trace v2 /// Internal IR: deliberately skipped on the wire so Analysis v3/Observation v1
/// consumers are unaffected. A prepared program always carries a complete /// consumers are unaffected. A prepared program always carries a complete
/// table; the runtime never re-resolves names. /// table; the runtime never re-resolves names.
#[serde(skip)] #[serde(skip)]
@@ -1,5 +1,14 @@
# Marqdo 3.x 第三方开发者接入手册 # Marqdo 3.x 第三方开发者接入手册
> **历史文档(beta 时代记录)。** 本文于 `3.0.0-beta.1` 上验证并随其发布。
> beta 时代的 Analysis v2、Trace v2、Tool Protocol v1 与
> `run/call --trace-file` 等接口已被 [ADR-0068](adr/0068-single-current-public-contracts.md)
> 原地替换:当前契约是 Analysis v3、Observation v1、CLI Tool revision 1。
> 请以 `spec/`([analysis](spec/analysis.md)、[observation](spec/observation.md)、
> [cli-tool](spec/cli-tool.md))和
> [`developers/README.md`](developers/README.md) 为当前入口;本文仅作 beta
> 接洽流程与迁移背景保留,其中出现的旧命令/旧协议名不代表当前 CLI 可用。
>
> 状态:**随 `3.0.0-beta.1` 发布**(Linux x86_64 beta)。产品版本为 `3.0.0-beta.1`;协议版本独立:Analysis v2、Trace v2、Tool v1、Plugin ABI v1、Foreign wire v1、Provider manifest v2、Lock v4、Markdown profile `marqdo.md.v1`。官方 stdlib 包版本 `0.1.0`、插件/工具/示例包版本也都是独立版本轴,不随产品版本变化。 > 状态:**随 `3.0.0-beta.1` 发布**(Linux x86_64 beta)。产品版本为 `3.0.0-beta.1`;协议版本独立:Analysis v2、Trace v2、Tool v1、Plugin ABI v1、Foreign wire v1、Provider manifest v2、Lock v4、Markdown profile `marqdo.md.v1`。官方 stdlib 包版本 `0.1.0`、插件/工具/示例包版本也都是独立版本轴,不随产品版本变化。
> >
> 本文是入门与工程接洽流程;与已发布二进制冲突时,以该版本 `--help`、`--version`、`spec/` 和 release notes 为准。本文所有命令片段都已在 `3.0.0-beta.1` 二进制上验证;未验证的可能平台行为会明确标注为 UNVERIFIED/UNSUPPORTED,绝不默认为支持。 > 本文是入门与工程接洽流程;与已发布二进制冲突时,以该版本 `--help`、`--version`、`spec/` 和 release notes 为准。本文所有命令片段都已在 `3.0.0-beta.1` 二进制上验证;未验证的可能平台行为会明确标注为 UNVERIFIED/UNSUPPORTED,绝不默认为支持。
+49 -22
View File
@@ -1,12 +1,11 @@
# Marqdo Implementation Status # Marqdo Implementation Status
Snapshot: **2026-11-22**, product version **`3.0.0-beta.1`** (prerelease, tag Snapshot: **2026-11-24**, product version **`3.0.0-rc.3`** (prerelease
`v3.0.0-beta.1`). Released platform: **Linux x86_64 (glibc)**. Tagged source candidate). Last published prerelease: `3.0.0-rc.2` at source SHA
SHA: **`2c7c4f31e7a388d3fcfa717a77067e696ed13854`**; release: **`9149ee40a48fcda692c5c112f66c465487d13dfb`**; last published beta
https://git.cflmy.cn/cflmy/marqdo-cli/releases/tag/v3.0.0-beta.1. The `3.0.0-beta.1` at **`2c7c4f31e7a388d3fcfa717a77067e696ed13854`**. The released
same-SHA evidence aggregate is platform is **Linux x86_64 (glibc 2.39)**. The RC gate aggregate for this
[`evidence/ci/2c7c4f31e7a388d3fcfa717a77067e696ed13854/manifest.json`](evidence/ci/2c7c4f31e7a388d3fcfa717a77067e696ed13854/manifest.json) candidate is bound to the candidate SHA; its binary hashes are in the archive's
(decision `BETA_RELEASE_CANDIDATE`); binary hashes are in the archive's
`RELEASE_INFO.json`. Do not copy a SHA from a plan. `RELEASE_INFO.json`. Do not copy a SHA from a plan.
Current architecture overview: Current architecture overview:
@@ -76,19 +75,21 @@ path. Policy: [ADR-0068](adr/0068-single-current-public-contracts.md) and
section records commands executed on the candidate tree; it is local Linux section records commands executed on the candidate tree; it is local Linux
evidence, not a same-SHA CI or archive gate. evidence, not a same-SHA CI or archive gate.
Executed 2026-11-24 on Linux x86_64 (workspace `3.0.0-rc.3`, Rust 1.93.1): Executed 2026-11-24 on the reviewed candidate tree, Linux x86_64
(workspace `3.0.0-rc.3`, Rust 1.100.0):
```text ```text
cargo fmt --all -- --check PASS cargo fmt --all -- --check PASS
cargo clippy --workspace --all-targets -- -D warnings PASS cargo clippy --workspace --all-targets -- -D warnings PASS
cargo test --workspace --locked PASS: 601 passed, 0 failed, 2 ignored cargo test --workspace --locked PASS: 607 passed, 0 failed, 2 ignored
cargo test -p marqdo-cli --test architecture_boundaries PASS: 12 passed cargo test -p marqdo-cli --test architecture_boundaries PASS: 12 passed
cargo test -p marqdo-cli --test docs_consistency PASS: 5 passed cargo test -p marqdo-cli --test docs_consistency PASS: 7 passed
cargo test -p marqdo-cli --test observation PASS: 15 passed cargo test -p marqdo-cli --test observation PASS: 16 passed
cargo test -p marqdo-cli --test analysis_observation PASS: 10 passed cargo test -p marqdo-cli --test analysis_observation PASS: 23 passed
cargo test -p marqdo-cli --test tool_protocol PASS: 7 passed cargo test -p marqdo-cli --test tool_protocol PASS: 7 passed
cargo test -p marqdo-cli --test extension_selection PASS: 14 passed cargo test -p marqdo-cli --test extension_selection PASS: 14 passed
cargo test -p marqdo-worker-ipc PASS: 5 passed cargo test -p marqdo-worker-ipc PASS: 5 passed
python3 -m unittest discover -s tools/ci -p "test_*.py" PASS: 41 tests
``` ```
Black-box consumer run against the real `target/debug/marqdo`: Black-box consumer run against the real `target/debug/marqdo`:
@@ -107,7 +108,7 @@ observation_consumer.py stream.jsonl --analysis stale-analysis.json rejected
marqdo --version marqdo 3.0.0-rc.3 marqdo --version marqdo 3.0.0-rc.3
``` ```
Same-SHA CI on Linux x86_64 Same-SHA CI on the first (pre-review) candidate build, Linux x86_64
([pipeline #70](https://ci.cflmy.cn/repos/1/pipeline/70), commit ([pipeline #70](https://ci.cflmy.cn/repos/1/pipeline/70), commit
`5a89a137c7f76f6c31744a4e8f8d4dbc0af623ef`): the fast `contract` lane, the full `5a89a137c7f76f6c31744a4e8f8d4dbc0af623ef`): the fast `contract` lane, the full
Rust `test` lane (fmt, clippy, workspace tests, docs/architecture gates, Windows Rust `test` lane (fmt, clippy, workspace tests, docs/architecture gates, Windows
@@ -119,16 +120,42 @@ passed the from-archive smoke, and passed the frozen external conformance suite
(callable registry, plugin worker, foreign kernel, provider CLI, pinned package, (callable registry, plugin worker, foreign kernel, provider CLI, pinned package,
tool Analysis consumer, negative security). tool Analysis consumer, negative security).
The detailed local log and the CI addendum are in The detailed local log and that CI addendum are in
[`evidence/2026-11-24-rc.3-protocol-convergence-local.md`](evidence/2026-11-24-rc.3-protocol-convergence-local.md). [`evidence/2026-11-24-rc.3-protocol-convergence-local.md`](evidence/2026-11-24-rc.3-protocol-convergence-local.md);
they describe the protocol convergence itself. The reviewed candidate's own
same-SHA CI, archive and gate evidence are recorded in the release evidence
bound to the released SHA.
Release status: the tree, contracts, archive and same-SHA Linux CI are ready for ### 0.9.1 Review closure on the candidate tree
`3.0.0-rc.3`, but **publication is not authorized by this evidence**. The RC
profile in [`releasing.md`](releasing.md) additionally requires a same-SHA A code review of the first candidate build found and closed these defects
strict-L1 PASS on a disposable VM as a non-root user and fixed-node G4 (regression test for each):
performance evidence (or the recorded maintainer exception). Neither exists
here; the CI host truthfully reports `strict: unavailable` fail-closed. Do not - A strict run no longer emits a partial JSONL stream for a destination it
tag or publish `v3.0.0-rc.3` from this section. refuses; live and file destinations are rejected before any session opens.
- `check --emit` removes a previous Analysis artifact when the project cannot
be loaded, not only when it has compile errors.
- Filesystem resource requests report their concrete effect operation
(`fs.exists`, `fs.metadata`, `fs.list`, `fs.mkdir`, `fs.remove`,
`fs.rename`).
- The shared worker transport preserves `worker_frame_too_large` and
`worker_encode_failed` for the plugin boundary.
- Observation error locations no longer embed an absolute host path, and
pre-start option errors use the documented `options` phase.
- The event and snapshot schemas agree on the capture `level` enum.
- The G4 workload catalogue measures `run`/`call` through `--output json`; the
retired `--json` flag had made every non-check workload fail correctness.
- `spec/` and the current developer guides were brought back in line with the
binary, and a docs-consistency gate now fails when a retired interface or a
deleted spec path returns.
Release status: this section records local Linux evidence and the same-SHA CI
for the candidate. Publication additionally requires the RC profile gates in
[`releasing.md`](releasing.md) — same-SHA disposable-VM strict L1, clean
install, frozen extensions, version compatibility and G4 performance (the
maintainer-approved shared-node `WARN` for this named RC). Those results are
recorded in the evidence bound to the released SHA and in the release assets;
an unavailable strict host is fail-closed, never a downgrade.
## 0. Beta release record — `3.0.0-beta.1` ## 0. Beta release record — `3.0.0-beta.1`
@@ -6,9 +6,10 @@
- **Status:** Accepted - **Status:** Accepted
- **Date:** 2026-11-22 - **Date:** 2026-11-22
- **Decision owners:** CLI, runtime and host maintainers - **Decision owners:** CLI, runtime and host maintainers
- **Inputs:** [RFC-OBS-0001](../architecture/RFC-OBS-0001-runtime-observability.md) - **Inputs:** RFC-OBS-0001 (issue `#1` of `cflmy/marqdo-cli`), Trace v2,
(issue `#1` of `cflmy/marqdo-cli`), [Trace v2](../../spec/trace-v2.md), Analysis v2 and Tool Protocol v1. Those documents were retired in place by
[Analysis v2](../../spec/analysis-v2.md), [Tool Protocol v1](../../spec/tool-v1.md) [ADR-0068](0068-single-current-public-contracts.md) and are available at
their tagged commits, not in the current `spec/` tree.
## Context ## Context
+2 -2
View File
@@ -183,7 +183,7 @@ review RFC, not a new crate per provider.
| `resource.request` | the reviewed operation allowlist (`process.run`, `regex.*`, `compress.*`, `random.bytes`, `env.get`, `clock.now`, `fs.*`) in `docs/architecture/resource-operations.md`; project mode + grants, ADR-0062 | implemented; **new domain operations forbidden**; architecture gate pins the list | `resource_streams`, `architecture_boundaries::resource_request_operation_allowlist_is_reviewed` | | `resource.request` | the reviewed operation allowlist (`process.run`, `regex.*`, `compress.*`, `random.bytes`, `env.get`, `clock.now`, `fs.*`) in `docs/architecture/resource-operations.md`; project mode + grants, ADR-0062 | implemented; **new domain operations forbidden**; architecture gate pins the list | `resource_streams`, `architecture_boundaries::resource_request_operation_allowlist_is_reviewed` |
| core resource kinds | one `marqdo_host::CORE_RESOURCE_KINDS` registry used by CLI manifest validation and every host registration API | implemented; all six core kinds rejected as provider name/kind before registration (H-04) | `resource_streams`, `provider_manifest::every_core_kind_is_rejected_as_name_and_as_kind` | | core resource kinds | one `marqdo_host::CORE_RESOURCE_KINDS` registry used by CLI manifest validation and every host registration API | implemented; all six core kinds rejected as provider name/kind before registration (H-04) | `resource_streams`, `provider_manifest::every_core_kind_is_rejected_as_name_and_as_kind` |
| `math.*` domain API | removed after `3.0.0-beta.1`; call is `symbol.unknown`; `Formula` stays inert; external pure package + optional ABI backend; `math.compute` stays a plugin capability category (H-01/H-11) | **removed** from `BUILTINS`/`HostOp`/host/runtime/workspace; `examples/math-library/`, `examples/math-backend/` | `math_library`, `conformance_semantics`, `architecture_boundaries::domain_math_kernel_is_not_part_of_the_core` | | `math.*` domain API | removed after `3.0.0-beta.1`; call is `symbol.unknown`; `Formula` stays inert; external pure package + optional ABI backend; `math.compute` stays a plugin capability category (H-01/H-11) | **removed** from `BUILTINS`/`HostOp`/host/runtime/workspace; `examples/math-library/`, `examples/math-backend/` | `math_library`, `conformance_semantics`, `architecture_boundaries::domain_math_kernel_is_not_part_of_the_core` |
| Heading modes / annotations | `@exec`/`@knowledge` are the closed Core Modes; unmarked headings inherit the nearest ancestor (H-06); third-party heading annotations are **Proposed** metadata only, Analysis v2 unchanged (H-05/H-07) | core mode: implemented; annotations: Proposed/not implemented, target `3.1.x` | `heading_inheritance`, `units`, negative `sem.invalid_mode_marker`; future T-ANNO in `spec/heading-annotations-v1.md` | | Heading modes / annotations | `@exec`/`@knowledge` are the closed Core Modes; unmarked headings inherit the nearest ancestor (H-06); third-party heading annotations are **Proposed** metadata only, Analysis v3 unchanged (H-05/H-07) | core mode: implemented; annotations: Proposed/not implemented, target `3.1.x` | `heading_inheritance`, `units`, negative `sem.invalid_mode_marker`; future T-ANNO in `spec/heading-annotations-v1.md` |
| Foreign F-A | permission-gated one-shot `foreign.run`/`foreign.call` + dynamic `KernelRegistry`; F-B removal deferred (H-02) | retained; no new language-specific builtin/HostOp; existing grants/digest/timeout/wire/output negatives unchanged | `marqdo-foreign/tests/kernels`, `smoke.py` foreign/kernel cases, `examples/kernel-mock` | | Foreign F-A | permission-gated one-shot `foreign.run`/`foreign.call` + dynamic `KernelRegistry`; F-B removal deferred (H-02) | retained; no new language-specific builtin/HostOp; existing grants/digest/timeout/wire/output negatives unchanged | `marqdo-foreign/tests/kernels`, `smoke.py` foreign/kernel cases, `examples/kernel-mock` |
| `std:data/json` | `json.解析/解析多个/格式化`; nested Value, 128-depth bound, recoverable errors | implemented (recursive, multi-value; no streaming) | `stdlib_product` | | `std:data/json` | `json.解析/解析多个/格式化`; nested Value, 128-depth bound, recoverable errors | implemented (recursive, multi-value; no streaming) | `stdlib_product` |
| `std:data/csv` | `csv.解析行/解析/格式化行/格式化`; quoted single/multi-row, CRLF, quoted newlines | implemented (no streaming) | `stdlib_product` | | `std:data/csv` | `csv.解析行/解析/格式化行/格式化`; quoted single/multi-row, CRLF, quoted newlines | implemented (no streaming) | `stdlib_product` |
@@ -199,7 +199,7 @@ review RFC, not a new crate per provider.
| `std:net/http` | byte-exact HTTP/1.1 parse/build; chunk sizes are byte counts; text wrapper compatible | implemented (pure `.mq.md`) | `stdlib_http` | | `std:net/http` | byte-exact HTTP/1.1 parse/build; chunk sizes are byte counts; text wrapper compatible | implemented (pure `.mq.md`) | `stdlib_http` |
| HTTP/1.1 | `stdlib/net/http.mq.md`: status/header/chunked-byte parse, request build | implemented over an already-authorized TCP stream; not a DNS/TLS client | `stdlib_http`, `http_over_tcp`, `stdlib_product` | | HTTP/1.1 | `stdlib/net/http.mq.md`: status/header/chunked-byte parse, request build | implemented over an already-authorized TCP stream; not a DNS/TLS client | `stdlib_http`, `http_over_tcp`, `stdlib_product` |
| print / official stdlib aliases | `打印`/`print` are verified `stdlib.json` public aliases bound to `io.mq.md::写值`; ordinary Marqdo calls, no `print_override`, no runtime branch, no `HostOp::Print` | implemented (ADR-0058) | `stdlib_alias_routing`, `print_routing`, `stdlib_product` | | print / official stdlib aliases | `打印`/`print` are verified `stdlib.json` public aliases bound to `io.mq.md::写值`; ordinary Marqdo calls, no `print_override`, no runtime branch, no `HostOp::Print` | implemented (ADR-0058) | `stdlib_alias_routing`, `print_routing`, `stdlib_product` |
| callable resolution | one registry + one `bind_program_calls` pass; `check`/`run`/`inspect`/Analysis share `CallSiteKey` bindings; plugin exports reconcile exactly with static manifests; no runtime name fallback | implemented (ADR-0054) | `callable_resolution`, `plugin_worker`, `analysis_trace` | | callable resolution | one registry + one `bind_program_calls` pass; `check`/`run`/`inspect`/Analysis share `CallSiteKey` bindings; plugin exports reconcile exactly with static manifests; no runtime name fallback | implemented (ADR-0054) | `callable_resolution`, `plugin_worker`, `analysis_observation` |
| resource provider v2 CLI | `--provider`/`--allow-provider` select and authorize a `provider.json` schema-2 `c-abi-1` worker artifact; manifest/artifact/grants/duplicate kinds verified before spawn; sibling helper only | implemented linux/x86_64; other platforms fail closed (ADR-0055) | `provider_cli` | | resource provider v2 CLI | `--provider`/`--allow-provider` select and authorize a `provider.json` schema-2 `c-abi-1` worker artifact; manifest/artifact/grants/duplicate kinds verified before spawn; sibling helper only | implemented linux/x86_64; other platforms fail closed (ADR-0055) | `provider_cli` |
| capability handlers | trusted handler registry executes granted capabilities under budget/audit; missing handler is `capability.unavailable`; `fs.read` is the first real handler | implemented (ADR-0057) | `capability_handlers` | | capability handlers | trusted handler registry executes granted capabilities under budget/audit; missing handler is `capability.unavailable`; `fs.read` is the first real handler | implemented (ADR-0057) | `capability_handlers` |
| strict mode | only the pure/Math execution path and the built-in stdout console channel; project/foreign/plugin/tool/trace/file/network grants are rejected | implemented L1; L2 not implemented | `tests/security`, `resource_streams`, `stdlib_product` | | strict mode | only the pure/Math execution path and the built-in stdout console channel; project/foreign/plugin/tool/trace/file/network grants are rejected | implemented L1; L2 not implemented | `tests/security`, `resource_streams`, `stdlib_product` |
@@ -1,9 +1,9 @@
# RFC-OBS-0001: Runtime observability and real-time execution events # RFC-OBS-0001: Runtime observability and real-time execution events
> **Status:** Accepted and implemented at the level recorded in > **Status:** Historical design input. [ADR-0068](../adr/0068-single-current-public-contracts.md)
> [`docs/STATUS.md`](../STATUS.md); this file is the frozen design input. > replaced Execution Events v1 and Trace v2 with the single current
> The normative protocol contract is > [Observation contract](../../spec/observation.md); the retired spec named
> [`spec/execution-events-v1.md`](../../spec/execution-events-v1.md). > below exists only in Git history and in tagged archives.
> >
> **Source:** issue `#1` of `cflmy/marqdo-cli`, filed 2026-11-22 against > **Source:** issue `#1` of `cflmy/marqdo-cli`, filed 2026-11-22 against
> `master@eeea01d672c07b6be7d6444031d1619309dc88ab`. It is reproduced here so > `master@eeea01d672c07b6be7d6444031d1619309dc88ab`. It is reproduced here so
+25 -22
View File
@@ -18,52 +18,55 @@ and the Windows cross-target compile check; `build` packages the archive, runs
the from-archive smoke and the frozen external conformance suite. the from-archive smoke and the frozen external conformance suite.
```text ```text
contract: contract (rust:1.100-bookworm, python3-jsonschema, both shipped binaries):
cargo build --locked -p marqdo-cli -p marqdo-provider-worker cargo build --locked -p marqdo-cli -p marqdo-provider-worker
real CLI check/run over the Observation fixtures real CLI check/run over the Observation fixtures
analysis_consumer / observation_consumer / validate_protocols analysis_consumer / observation_consumer / validate_protocols
stream==snapshot assertion and stale-Analysis rejection stream==snapshot assertion (tools/ci/verify_observation_stream.py)
stale-Analysis rejection
test: test (rust:1.100-bookworm, clippy/rustfmt, Node.js 22, MinGW, both binaries):
rustup component add clippy rustfmt
apt install curl/ca-certificates/python3/python3-jsonschema + Node.js 22
cargo fmt --all -- --check cargo fmt --all -- --check
cargo clippy --workspace --all-targets -- -D warnings cargo clippy --workspace --all-targets -- -D warnings
cargo build --locked -p marqdo-cli -p marqdo-provider-worker cargo build --locked -p marqdo-provider-worker
cargo test --workspace --locked cargo test --workspace --locked
check + run tests/consumers/fixtures/observation/basic.mq.md docs_consistency / architecture_boundaries / stdlib_product
analysis_consumer.py / observation_consumer.py (stream + snapshot)
check + run the nested-loop control-flow conformance fixture
validate_protocols.py / analysis_consumer.py --require-transfers
observation_consumer.py (stream, snapshot, stale-Analysis rejection)
stream JSONL == snapshot events assertion
cargo test -p marqdo-cli --test docs_consistency
cargo test -p marqdo-cli --test architecture_boundaries
cargo test -p marqdo-cli --test stdlib_product
python3 -m unittest discover -s tools/ci -p "test_*.py" python3 -m unittest discover -s tools/ci -p "test_*.py"
rustup target add x86_64-pc-windows-gnu rustup target add x86_64-pc-windows-gnu
cargo check --workspace --all-targets --target x86_64-pc-windows-gnu cargo check --workspace --all-targets --target x86_64-pc-windows-gnu
build (depends on test): minimum-rust (rust:1.89-bookworm):
cargo check --locked --workspace --all-targets
build (depends on test, minimum-rust, contract):
cargo build --release --locked -p marqdo-cli -p marqdo-provider-worker cargo build --release --locked -p marqdo-cli -p marqdo-provider-worker
package + cold-install smoke (current Analysis/Observation contracts) package the deterministic archive for $CI_COMMIT_SHA
from-archive smoke (tools/release/smoke.py)
frozen external conformance (tools/ci/run_frozen_extensions.sh, 7/7)
``` ```
A separate manual workflow, [`.woodpecker/performance.yml`](../.woodpecker/performance.yml),
builds the beta baseline and the candidate archive on the shared Woodpecker
agent and records the nine G4 comparisons. Its reports stay `SMOKE`; only the
maintainer-approved RC `WARN` exception can use them (see
[`releasing.md`](releasing.md) and [`performance.md`](performance.md)).
The pipeline is a protocol consumer itself: it must exercise only the current The pipeline is a protocol consumer itself: it must exercise only the current
Analysis and Observation contracts. `docs_consistency::ci_configuration_uses_only_current_protocols` Analysis and Observation contracts. `docs_consistency::ci_configuration_uses_only_current_protocols`
fails if a retired option or consumer name returns. fails if a retired option or consumer name returns, and
`current_contract_documents_do_not_reference_retired_interfaces` extends the
same rule to `spec/` and the current developer guides.
Node.js 22 is required because the optional foreign-kernel tests use ES-module Node.js 22 is required because the optional foreign-kernel tests use ES-module
syntax; Debian bookworm's Node 18 fails those tests. syntax; Debian bookworm's Node 18 fails those tests.
> **Language contract note.** `cargo test --workspace` includes conformance > **Language contract note.** `cargo test --workspace` includes conformance
> fixtures that execute `.mq.md` source under > fixtures that execute `.mq.md` source under
> [RFC-LANG-0002](architecture/RFC-LANG-0002-unified-semantics.md). The > [RFC-LANG-0002](architecture/RFC-LANG-0002-unified-semantics.md). A red
> implementation, stdlib digest and corpus are green at `ffd1cc9`; a red
> executable-source suite is a real regression, not an expected migration > executable-source suite is a real regression, not an expected migration
> state. Do not "fix" it by restoring the old mapper or regenerating goldens; > state. Do not "fix" it by restoring the old mapper or regenerating goldens;
> see [`STATUS.md`](STATUS.md). The pipeline definition itself > see [`STATUS.md`](STATUS.md). The lanes above are the current definition; it
> (fmt/clippy/test/build, security lane, platform gaps) is unchanged. > changes only with this document.
## What this pipeline does not cover ## What this pipeline does not cover
+2 -2
View File
@@ -18,7 +18,7 @@ their date.
```text ```text
marqdo-cli/ marqdo-cli/
├── Cargo.toml workspace (15 crates, resolver 2) ├── Cargo.toml workspace (16 crates, resolver 2)
├── AGENTS.md operator rules for contributors/agents ├── AGENTS.md operator rules for contributors/agents
├── README.md user-facing quickstart and limits ├── README.md user-facing quickstart and limits
├── docs/ ├── docs/
@@ -209,7 +209,7 @@ counts, harness responsibilities and known observations.
## 5. Coding conventions ## 5. Coding conventions
* Rust edition 2021, `rust-version = 1.82`, workspace version `3.0.0-beta.1`. * Rust edition 2021, `rust-version = 1.89`, workspace version `3.0.0-rc.3`.
* `unsafe` is forbidden in pure crates (for example `marqdo-expression` uses * `unsafe` is forbidden in pure crates (for example `marqdo-expression` uses
`#![forbid(unsafe_code)]`); the ABI/loader crates contain the only `#![forbid(unsafe_code)]`); the ABI/loader crates contain the only
`unsafe` code and every block has a SAFETY comment explaining the contract. `unsafe` code and every block has a SAFETY comment explaining the contract.
+3 -1
View File
@@ -41,7 +41,9 @@ Foreign wire v1, Provider manifest v2, lock v4 and markdown profile
file ships in the archive as `KNOWN_LIMITATIONS.md`). file ships in the archive as `KNOWN_LIMITATIONS.md`).
The full worked handbook is The full worked handbook is
[`../MARQDO_THIRD_PARTY_INTEGRATION_GUIDE.md`](../MARQDO_THIRD_PARTY_INTEGRATION_GUIDE.md). [`../MARQDO_THIRD_PARTY_INTEGRATION_GUIDE.md`](../MARQDO_THIRD_PARTY_INTEGRATION_GUIDE.md)
(beta-era integration handbook, kept as a historical record; the current
contracts are the pages above and `spec/`).
Normative contracts live in [`../../spec/`](../../spec/); this directory is a Normative contracts live in [`../../spec/`](../../spec/); this directory is a
task-oriented map, not a second specification. task-oriented map, not a second specification.
+2 -1
View File
@@ -38,6 +38,7 @@ has opted into this disclosure. Program output and explicit returned values
can themselves contain sensitive data. can themselves contain sensitive data.
Update integrations that previously used the retired run/call JSON, Update integrations that previously used the retired run/call JSON,
Trace or Execution Events options. Use the commands above, remove the old Trace, Execution Events or retired run/call options. Use the commands above,
remove the old
reader, and rebuild and reinstall the Tool with the reader, and rebuild and reinstall the Tool with the
[current manifest](../../spec/cli-tool.md). [current manifest](../../spec/cli-tool.md).
+9 -10
View File
@@ -8,11 +8,10 @@ This page summarizes the public support policy. The authoritative matrix is
| Axis | `3.0.0-rc.3` value | Change rule | | Axis | `3.0.0-rc.3` value | Change rule |
|---|---|---| |---|---|---|
| Product / CLI | `3.0.0-rc.2` | SemVer prerelease. See `CHANGELOG.md` for changes from the beta. | | Product / CLI | `3.0.0-rc.3` (candidate) | SemVer prerelease. See `CHANGELOG.md` for changes from the beta. |
| Analysis | v2 | New major for incompatible changes; consumers reject unknown majors. | | Analysis | v3 | One writer and one current major for every project. New major for incompatible changes; consumers reject unknown majors. |
| Trace | v2 | New major for incompatible changes; binds to exact Analysis bytes. | | 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. |
| Execution Events | v1 | One-line NDJSON stream; new major for incompatible required-field/ordering/redaction changes. Consumers reject unknown majors. | | CLI Tool | revision 1 | Exact `requires.api_revision` plus optional exact `analysis`/`observation` integers; no version arrays or negotiation. |
| CLI Tool | v1 | Frozen manifest/negotiation/bundle contract for v1. |
| Plugin ABI | v1 (`1.0`) | Frozen C layout and version negotiation. | | Plugin ABI | v1 (`1.0`) | Frozen C layout and version negotiation. |
| Foreign wire | v1 | One-shot request envelope. | | Foreign wire | v1 | One-shot request envelope. |
| Provider manifest | v2 | `schema_version: 2`, `abi: c-abi-1`, `transport: worker`. | | Provider manifest | v2 | `schema_version: 2`, `abi: c-abi-1`, `transport: worker`. |
@@ -21,8 +20,8 @@ This page summarizes the public support policy. The authoritative matrix is
| Bundled stdlib | `0.1.0` | Independent package version; not the product version. | | Bundled stdlib | `0.1.0` | Independent package version; not the product version. |
| Plugin/tool/example packages | their own | Independent SemVer. | | Plugin/tool/example packages | their own | Independent SemVer. |
`project.marqdo` and a tool's `compatibility.marqdo` are **enforced product `project.marqdo` is an **enforced product range**; a tool declares its exact
ranges**. Prerelease cores require a prerelease range such as current protocol requirements in `requires`. Prerelease cores require a prerelease range such as
`>=3.0.0-beta.1,<4.0.0`; `>=3.0.0,<4.0.0` does not match the RC. `>=3.0.0-beta.1,<4.0.0`; `>=3.0.0,<4.0.0` does not match the RC.
## Candidate platform scope ## Candidate platform scope
@@ -36,9 +35,9 @@ ranges**. Prerelease cores require a prerelease range such as
Strict is Linux-only and probe-gated. Plugin/provider worker transports are not Strict is Linux-only and probe-gated. Plugin/provider worker transports are not
OS sandboxes. `pure`/`project` are execution modes, not security boundaries. OS sandboxes. `pure`/`project` are execution modes, not security boundaries.
Execution Events v1 is a live observation protocol: it is not a capability Observation v1 is a live observation protocol: it is not a capability grant,
grant, values are off by default, and `--mode strict` currently refuses values are off by default, and `--mode strict` refuses `--output jsonl` and
`--output jsonl` explicitly (no downgrade). `--observation-file` explicitly (no downgrade).
## Language compatibility ## Language compatibility
+7 -7
View File
@@ -49,8 +49,8 @@ Even when available:
wire-incompatible kernels. wire-incompatible kernels.
* **CLI tools**: a tool is an ordinary user-authorized executable and does * **CLI tools**: a tool is an ordinary user-authorized executable and does
**not** inherit `pure`/`project`/`strict` guarantees from the documents it **not** inherit `pure`/`project`/`strict` guarantees from the documents it
reads. `MARQDO_BIN`, `MARQDO_TOOL_PROTOCOL`, `MARQDO_PROTOCOL_ANALYSIS` and reads. `MARQDO_BIN` and `MARQDO_API_REVISION` are the only helpers the CLI
`MARQDO_PROTOCOL_TRACE` are the only helpers the CLI injects. injects; version negotiation was removed.
* **Extension selection** (`marqdo.yaml.extensions`, lock v4) is never * **Extension selection** (`marqdo.yaml.extensions`, lock v4) is never
authorization. `--allow-plugin`, `--allow-provider` and `--allow-foreign` authorization. `--allow-plugin`, `--allow-provider` and `--allow-foreign`
are still required. are still required.
@@ -77,19 +77,19 @@ Archives are accompanied by SHA256 checksums and `RELEASE_INFO.json`
integrity only; they are **not** a publisher signature. A digest obtained from integrity only; they are **not** a publisher signature. A digest obtained from
an untrusted Git URL does not make the code trustworthy. an untrusted Git URL does not make the code trustworthy.
## Execution Events v1 ## Observation
* Implemented: live stdout/stderr chunks, lifecycle/terminal events, call * Implemented: live stdout/stderr chunks, lifecycle/terminal events, call
instance ids, branch/loop/effect events, explicit bounded value observation. instance ids, branch/loop/effect events, explicit bounded value observation.
* Not implemented: memory region/budget metadata (OBS-06/P2), raw memory * Not implemented: memory region/budget metadata (OBS-06/P2), raw memory
content, breakpoints/stepping/time travel, and a bidirectional debug content, breakpoints/stepping/time travel, and a bidirectional debug
protocol. Do not infer a debugger from this protocol. protocol. Do not infer a debugger from this protocol.
* `--mode strict` currently rejects `--output jsonl` explicitly; there is no * `--mode strict` rejects `--output jsonl` and `--observation-file` before
silent fallback to `project`. launch; there is no silent fallback to `project`.
* The live lane is tested on Linux x86_64; macOS/Windows are unverified for * The live lane is tested on Linux x86_64; macOS/Windows are unverified for
this option for this candidate. this option for this candidate.
* In-process native plugins are rejected in event mode * In-process native plugins are rejected with an active machine destination
(`ext.event_stream_unsupported_native_plugin`) because they share the process (`ext.observation_unsupported_native_plugin`) because they share the process
and can write the protocol fd directly; worker plugins remain usable. and can write the protocol fd directly; worker plugins remain usable.
* Observation lowers confidentiality when values are explicitly enabled. Text * Observation lowers confidentiality when values are explicitly enabled. Text
needs a second opt-in; View/agents must not enable these flags by default. needs a second opt-in; View/agents must not enable these flags by default.
@@ -6,8 +6,9 @@
- **Source SHA:** `1d3dca7c1832eb9468e96384d9805a3812a303e4` (post-beta tree; - **Source SHA:** `1d3dca7c1832eb9468e96384d9805a3812a303e4` (post-beta tree;
the tagged beta is `2c7c4f31e7a388d3fcfa717a77067e696ed13854` and does **not** the tagged beta is `2c7c4f31e7a388d3fcfa717a77067e696ed13854` and does **not**
contain this feature). contain this feature).
- **Normative contract:** [`spec/execution-events-v1.md`](../../spec/execution-events-v1.md), - **Normative contract at that time:** `spec/execution-events-v1.md` (retired
schema `spec/schemas/execution-events-v1.schema.json`, decision by [ADR-0068](../adr/0068-single-current-public-contracts.md); the current
contract is [`spec/observation.md`](../../spec/observation.md)), decision
[ADR-0059](../adr/0059-runtime-observability-and-execution-events.md). [ADR-0059](../adr/0059-runtime-observability-and-execution-events.md).
This file records commands actually executed on Linux x86_64 with Rust This file records commands actually executed on Linux x86_64 with Rust
+2 -2
View File
@@ -1,6 +1,6 @@
# Unknown-name CLI tool example # Unknown-name CLI tool example
This directory is a complete Tool Protocol v1 package. Nothing named This directory is a complete CLI Tool (revision 1) package. Nothing named
`benchmark` exists in the Marqdo CLI source; after installation the unknown `benchmark` exists in the Marqdo CLI source; after installation the unknown
top-level command is dispatched by the registry. top-level command is dispatched by the registry.
@@ -13,7 +13,7 @@ marqdo tool remove benchmark
The executable receives the remaining arguments verbatim, inherits stdio/cwd, The executable receives the remaining arguments verbatim, inherits stdio/cwd,
and its exit code is propagated. `MARQDO_API_REVISION=1` and `MARQDO_BIN` are and its exit code is propagated. `MARQDO_API_REVISION=1` and `MARQDO_BIN` are
provided for tools that need `check --emit`/`run --trace-file`. provided for tools that need `check --emit`/`run --output json`.
A Tool is a user-run native process. It is **not** a C ABI plugin, a foreign A Tool is a user-run native process. It is **not** a C ABI plugin, a foreign
kernel, or a program inside the `.mq.md` sandbox. kernel, or a program inside the `.mq.md` sandbox.
+3 -2
View File
@@ -333,8 +333,9 @@ refuses to run (see `security.md`).
For a fixed source, mode, capabilities and budget, evaluation is For a fixed source, mode, capabilities and budget, evaluation is
deterministic. Stdout/stderr from host operations are separated: program deterministic. Stdout/stderr from host operations are separated: program
stdout and program stderr are captured separately, diagnostics/traces go to the stdout and program stderr are captured separately, diagnostics/traces go to the
CLI stderr, and `--json` output never mixes with any program output. JSON CLI stderr, and a machine destination never mixes program bytes with
reports `stdout` and `stderr` as separate strings. diagnostics. The Observation contract commits program bytes as separate
`stdout.chunk` and `stderr.chunk` events.
## 8. Builtins v1 ## 8. Builtins v1
+1 -1
View File
@@ -296,4 +296,4 @@ security negatives.
remain authoritative and must not be skipped for a refactor. remain authoritative and must not be skipped for a refactor.
- Forbidden in both phases: persistent Python/Node sessions, Notebook-cell - Forbidden in both phases: persistent Python/Node sessions, Notebook-cell
execution, `@python` heading auto-execution, and a second foreign runtime in View. execution, `@python` heading auto-execution, and a second foreign runtime in View.
Streaming stays in Execution Events v1, not a second foreign network protocol. Streaming stays in the Observation contract, not a second foreign network protocol.
+6 -1
View File
@@ -30,6 +30,9 @@ the [event schema](schemas/observation-event.schema.json) for the exact
fields. Reject other format identifiers, unknown kinds and invalid payloads. fields. Reject other format identifiers, unknown kinds and invalid payloads.
- `stream.opened` is first, with producer, capture policy and budget limits. - `stream.opened` is first, with producer, capture policy and budget limits.
The capture level is `base` (lifecycle only), `structural` (frame, branch,
loop and effect events) or `values` (explicitly selected names); the
snapshot `capture` metadata repeats the same level.
- `run.started` binds an entry, mode and source. `source.root_id` and - `run.started` binds an entry, mode and source. `source.root_id` and
`source.analysis_digest` identify the exact Analysis JSON emitted by `source.analysis_digest` identify the exact Analysis JSON emitted by
`check --emit` for the same project and static options. The digest is `check --emit` for the same project and static options. The digest is
@@ -52,7 +55,9 @@ fields. Reject other format identifiers, unknown kinds and invalid payloads.
Structural and selected-value events may stop at that point. Lifecycle Structural and selected-value events may stop at that point. Lifecycle
and committed byte chunks remain subject to their own execution and and committed byte chunks remain subject to their own execution and
output limits. The interpreter continues under unchanged program limits. output limits. The interpreter continues under unchanged program limits.
- `run.completed` contains the explicit return using [Value Wire](value-wire.md). - Error locations in `run.failed` carry `module_id`, `relative_path`, `line` and
`column`; a snapshot never embeds an absolute host path. `run.completed`
contains the explicit return using [Value Wire](value-wire.md).
A result containing a non-transferable handle has a null wire value and A result containing a non-transferable handle has a null wire value and
identifies its type. An explicit result, like a program print, can itself identifies its type. An explicit result, like a program print, can itself
contain sensitive data. `run.failed` follows a started run and contains contain sensitive data. `run.failed` follows a started run and contains
+6 -3
View File
@@ -353,9 +353,12 @@ resolver.
## 7. JSON output ## 7. JSON output
`check`, `inspect`, `run`, `call`, `plugin inspect`, `add`, `remove`, `lock` `check`, `inspect`, `plugin inspect`, `add`, `remove`, `lock` and `sync`
and `sync` accept `--json` and print a single JSON object on stdout. Relevant accept `--json` and print a single JSON object on stdout. `run` and `call` use
package shapes: the observation destinations instead (`--output text|json|jsonl` and
`--observation-file`), because one execution publishes one event sequence
([observation.md](observation.md)); the retired `--json` flag is rejected.
Relevant package shapes:
* `lock`: `{"command":"lock","success":true,"packages":[...]}` * `lock`: `{"command":"lock","success":true,"packages":[...]}`
* `sync`: `{"command":"sync","success":true,"locked":<bool>,"packages":[...]}` * `sync`: `{"command":"sync","success":true,"locked":<bool>,"packages":[...]}`
+8 -3
View File
@@ -223,6 +223,11 @@ Token lifecycle:
6. Provider error codes map to existing categories: `permission.denied`, 6. Provider error codes map to existing categories: `permission.denied`,
`resource.closed`, `resource.exhausted`, `resource.unsupported`, otherwise `resource.closed`, `resource.exhausted`, `resource.unsupported`, otherwise
`host.error`. `host.error`.
7. Any transport failure — including a request frame that exceeds the 1 MiB
budget or a malformed reply — kills and reaps the helper. The peer is never
reused after a protocol error, so a program that sends an oversized request
must expect subsequent calls to that provider to fail closed rather than
silently truncate the payload.
## 6. Authorization ## 6. Authorization
@@ -240,9 +245,9 @@ Token lifecycle:
## 7. Error codes and exit codes ## 7. Error codes and exit codes
Manifest/CLI option failures exit 2; load/verification/spawn failures exit 1; Manifest/CLI option failures exit 2; load/verification/spawn failures exit 1;
`permission.denied` exits 1. With `--json` the CLI emits exactly one JSON `permission.denied` exits 1. With a machine destination the CLI publishes
document with a `code` (nested under `error.code` for these structured exactly one terminal event: a `run.rejected` event whose `payload.error.code`
errors). carries the same code.
| Code | Stage | Trigger | | Code | Stage | Trigger |
|---|---|---| |---|---|---|
@@ -81,6 +81,7 @@
"properties": { "properties": {
"level": { "level": {
"enum": [ "enum": [
"base",
"structural", "structural",
"values" "values"
] ]
+42 -33
View File
@@ -12,7 +12,7 @@ Normative implementation:
| Host dispatch and per-op checks | `crates/marqdo-host/src/host.rs` | | Host dispatch and per-op checks | `crates/marqdo-host/src/host.rs` |
| Project-rooted filesystem | `crates/marqdo-host/src/fs.rs` | | Project-rooted filesystem | `crates/marqdo-host/src/fs.rs` |
| Budgets | `crates/marqdo-host/src/budget.rs` | | Budgets | `crates/marqdo-host/src/budget.rs` |
| Effect tracing | `crates/marqdo-host/src/trace.rs` | | Observation events (effects included) | `crates/marqdo-host/src/observe.rs`, `crates/cli/src/observation.rs` |
| Foreign adapter | `crates/marqdo-host/src/kernels.rs` | | Foreign adapter | `crates/marqdo-host/src/kernels.rs` |
| Foreign child processes | `crates/marqdo-foreign/src/lib.rs` | | Foreign child processes | `crates/marqdo-foreign/src/lib.rs` |
| Plugin loading / in-process plugin calls | `crates/marqdo-host/src/host.rs` (`load_plugin`, `op_plugin_invoke`), `crates/marqdo-plugin-abi/src/loader.rs` | | Plugin loading / in-process plugin calls | `crates/marqdo-host/src/host.rs` (`load_plugin`, `op_plugin_invoke`), `crates/marqdo-plugin-abi/src/loader.rs` |
@@ -28,7 +28,7 @@ Normative implementation:
|---|---|---| |---|---|---|
| `pure` | No external I/O; memory computation and budgets only. | **Enforced.** `Capabilities::pure()` = `console`, `math` only; every FS/foreign/plugin grant flag makes the CLI exit 2 with "pure mode prohibits external I/O grants". | | `pure` | No external I/O; memory computation and budgets only. | **Enforced.** `Capabilities::pure()` = `console`, `math` only; every FS/foreign/plugin grant flag makes the CLI exit 2 with "pure mode prohibits external I/O grants". |
| `project` | Operator-approved project resources under `CapabilityHost` + bounded resources. | **Enforced for the implemented operations.** Defaults equal `pure`; `--allow-read`, `--allow-write`, `--allow-net`, `--allow-env`, `--allow-process`, `--allow-random`, `--allow-foreign`, `--allow-plugin` add grants. `resource.open` supports stdin read, separate stdout/stderr write, granted project-file read/write (ADR-0025/0026/0040), granted in-process provider kinds (ADR-0033) and granted TCP/UDP/listener/TLS streams, including DNS names after an exact host grant (ADR-0034/0047/0048); process/device remain unsupported. Sandboxing is cooperative (in-process checks), not OS isolation; in-process providers are trusted, not sandboxed. | | `project` | Operator-approved project resources under `CapabilityHost` + bounded resources. | **Enforced for the implemented operations.** Defaults equal `pure`; `--allow-read`, `--allow-write`, `--allow-net`, `--allow-env`, `--allow-process`, `--allow-random`, `--allow-foreign`, `--allow-plugin` add grants. `resource.open` supports stdin read, separate stdout/stderr write, granted project-file read/write (ADR-0025/0026/0040), granted in-process provider kinds (ADR-0033) and granted TCP/UDP/listener/TLS streams, including DNS names after an exact host grant (ADR-0034/0047/0048); process/device remain unsupported. Sandboxing is cooperative (in-process checks), not OS isolation; in-process providers are trusted, not sandboxed. |
| `strict` | Untrusted documents under real OS isolation. | **Linux: enforced when the runtime probe passes (ADR-0021).** `resource.open` is **refused** in strict except for the existing `stdio/stdout` console channel (console grant); stdin/stderr, file/TCP/provider/process resources remain refused until a provider passes the isolation lane (CM-A11, ADR-0030/0034/0040). `PlatformCapabilities::detect()` runs a real Bubblewrap smoke test; success reports `Available { mechanism }`, failure reports `Unavailable { reason }`. Strict L1 supports the interpreter, console and the read-only bundled stdlib (published at `/run/marqdo-stdlib` for the Compat-C print chain); `--allow-read/--allow-write/--allow-net/--allow-env/--allow-process/--allow-random/--allow-foreign/--allow-plugin/--plugin/--trust-native-plugin/--kernel/--trace-file` are rejected with exit 2. macOS/Windows and Linux hosts without the mechanisms remain `Unavailable`; there is **no fallback** to an unrestricted process. | | `strict` | Untrusted documents under real OS isolation. | **Linux: enforced when the runtime probe passes (ADR-0021).** `resource.open` is **refused** in strict except for the existing `stdio/stdout` console channel (console grant); stdin/stderr, file/TCP/provider/process resources remain refused until a provider passes the isolation lane (CM-A11, ADR-0030/0034/0040). `PlatformCapabilities::detect()` runs a real Bubblewrap smoke test; success reports `Available { mechanism }`, failure reports `Unavailable { reason }`. Strict L1 supports the interpreter, console and the read-only bundled stdlib (published at `/run/marqdo-stdlib` for the Compat-C print chain); `--allow-read/--allow-write/--allow-net/--allow-env/--allow-process/--allow-random/--allow-foreign/--allow-plugin/--plugin/--trust-native-plugin/--kernel` are rejected with exit 2. macOS/Windows and Linux hosts without the mechanisms remain `Unavailable`; there is **no fallback** to an unrestricted process. |
`marqdo inspect <file> --platform` prints the detection report, for example: `marqdo inspect <file> --platform` prints the detection report, for example:
@@ -57,28 +57,32 @@ produces no IR and therefore cannot cause a host effect at all. No heading
annotation, keyword or Markdown container can grant a file/network/process annotation, keyword or Markdown container can grant a file/network/process
capability, and permission flags never change the AST→IR result. capability, and permission flags never change the AST→IR result.
### 1.2 Strict failure and `--json` contract ### 1.2 Strict failure and output contract
Strict execution is a two-phase operation: detect, then launch. Availability Strict execution is a two-phase operation: detect, then launch. Availability
observed by `inspect --platform` is a snapshot, not a permanent promise. The observed by `inspect --platform` is a snapshot, not a permanent promise. The
runtime therefore re-probes before launching; a failure after a successful runtime therefore re-probes before launching; a failure after a successful
probe is a refusal, never a fallback. probe is a refusal, never a fallback.
`--json` consumers must receive **exactly one** JSON document on stdout for A strict run supports text output and one `--output json` Observation snapshot
every outcome: on stdout. The verified child executes the program under the isolation
supervisor and produces that one snapshot document itself; its stdout bytes and
exit code are forwarded unchanged. A live JSONL stream and a file destination
(`--observation-file`) are refused before launch with
`strict.unsupported_grant` and exit 2: the supervisor owns the only channel and
a rejected destination never emits a partial stream.
* a verified child in `--json` mode produces that document itself and its The parent never executes project code. A control-plane failure (probe,
bytes and exit code are forwarded unchanged; supervisor spawn, namespace construction, timeout, capture) prints the
* a control-plane failure (probe, supervisor spawn, namespace construction, diagnostic on stderr and, when a snapshot destination is active, finishes the
timeout, capture) produces one CLI error document parent's snapshot as `incomplete` without a terminal event; an empty or invalid
`{"command": ..., "success": false, "error": ..., "code": ...}`; child document is `strict.child_invalid` and raw supervisor text is never
* output that is empty or is not exactly one JSON document is rejected as forwarded as program stdout. Consumers treat an incomplete delivery as no
`strict.child_invalid`; raw supervisor text is never forwarded as program evidence about the final execution outcome.
stdout.
The stable codes are `strict.probe_unavailable`, `strict.spawn_failed`, The stable codes are `strict.probe_unavailable`, `strict.spawn_failed`,
`strict.namespace_failure`, `strict.timeout`, `strict.resource_limit`, `strict.namespace_failure`, `strict.launch_failed`, `strict.timeout`,
`strict.child_invalid`, `strict.identity_invalid` and `strict.resource_limit`, `strict.child_invalid`, `strict.identity_invalid` and
`strict.unsupported_grant` (ADR-0053). A marker alone never authorizes strict `strict.unsupported_grant` (ADR-0053). A marker alone never authorizes strict
execution: Linux verifies the namespace/privilege identity, and every other execution: Linux verifies the namespace/privilege identity, and every other
platform rejects `MARQDO_STRICT_ACTIVE` outright (ADR-0053). platform rejects `MARQDO_STRICT_ACTIVE` outright (ADR-0053).
@@ -270,28 +274,32 @@ foreign child processes and worker plugins are terminated by the host (kill on
timeout/output overflow). Native plugins are not OS-limited; the core no longer timeout/output overflow). Native plugins are not OS-limited; the core no longer
hosts an in-process math kernel. hosts an in-process math kernel.
## 4. Effect tracing ## 4. Effect observation
`EffectTrace` records one entry per `Host::invoke` when enabled An effect is one `effect` event in the current Observation contract
(`--trace`, or implicitly `--json` for `run`/`call`). Entry fields: ([`observation.md`](observation.md)); it is emitted through the same
`ObservationSink` as lifecycle events when a machine destination is active
(`--output json`, `--output jsonl` or `--observation-file`). There is no
`--trace` flag, no separate trace file and no trace array in another document.
Event payload fields:
```json ```json
{"op":"print","module":"hello.mq.md","span":{"start":43,"end":57}, {"frame_id":"f1","operation":"print","result_code":"ok",
"duration_micros":3,"result":"ok"} "module_id":"root:default::hello.mq.md","span":{"start":43,"end":57}}
``` ```
* `op` is the stable `HostOp::name()` (`foreign.run`, `foreign.call`, * `operation` is the concrete host operation (`print`, `foreign.run`,
`fs.read`, `fs.write`, `plugin.invoke`, ...); `resource.request` traces the `fs.read`, `fs.write`, `plugin.invoke`, `resource.request`, ...); resource
operation name in its semantic metadata instead of a `HostOp` variant; operations report their concrete name (`fs.exists`, `fs.metadata`, ...);
* `module` is the initiating module id; `span` is the call site when known; * `module_id` is the initiating module; `span` is the call site when known;
* `result` is `"ok"` or the failure code (for example * `result_code` is `"ok"` or the failure code (for example
`permission.denied`); `permission.denied`);
* argument values and file contents are **not** recorded, so ordinary secrets * argument values and file contents are **not** recorded, so ordinary secrets
do not leak into traces by design. Paths are also not recorded today. do not leak into the observation by design. Paths are not recorded either.
* In text mode trace entries are printed to stderr (`trace: ...`); in JSON * Program output is committed as `stdout.chunk`/`stderr.chunk` byte events and
mode they are a `trace` array next to separate program `stdout`/`stderr` never shares a buffer with diagnostics. An in-process native plugin is
strings. Program output is always separate from diagnostics/trace, and refused in observation mode (`ext.observation_unsupported_native_plugin`)
`stdio/stderr` never shares the `stdout` buffer. because it can write directly to the inherited fds.
## 5. Foreign kernels: process isolation, not a sandbox ## 5. Foreign kernels: process isolation, not a sandbox
@@ -409,6 +417,7 @@ Neither command executes project code. Specifically:
(ADR-0014, `value-wire.md` §4.1). (ADR-0014, `value-wire.md` §4.1).
7. Budgets do not cover all allocation paths (for example list/table growth 7. Budgets do not cover all allocation paths (for example list/table growth
inside the interpreter is bounded only by fuel and memory). inside the interpreter is bounded only by fuel and memory).
8. `--json` run output includes the full program stdout string; that is the 8. An Observation snapshot contains the program's own stdout and stderr bytes
program's own output, not a host secret, but it is embedded in the JSON as base64 byte events. That is the program's output, not a host secret, but
document consumers must parse. selected value observation and text consent lower confidentiality; consumers
must treat a snapshot like the program output it embeds.
+4 -3
View File
@@ -158,9 +158,10 @@ The following are **not** bounded by `WireLimits` in
| Foreign kernel stdin | `{"wire_version":1,"kind":"request","input":<typed value or null>}` (`crates/marqdo-foreign/src/lib.rs`) | `input` is a `to_wire(value)` result, or JSON `null` when absent. | | Foreign kernel stdin | `{"wire_version":1,"kind":"request","input":<typed value or null>}` (`crates/marqdo-foreign/src/lib.rs`) | `input` is a `to_wire(value)` result, or JSON `null` when absent. |
| Foreign typed return (`foreign.call`) | stdout must be exactly one typed value | decoded with `from_wire` and default limits. | | Foreign typed return (`foreign.call`) | stdout must be exactly one typed value | decoded with `from_wire` and default limits. |
The `--json` output of `run`/`call` embeds `"value": to_wire(outcome.value)` The `run.completed` event of the current Observation snapshot embeds
(`crates/cli/src/commands.rs`), so CLI JSON consumers see the same typed `"value": to_wire(outcome.value)` (`crates/cli/src/observation.rs`), so CLI
representation. consumers see the same typed representation. A result containing a
non-transferable handle has a null value and names its type.
## 6. Compatibility rules ## 6. Compatibility rules
+144
View File
@@ -0,0 +1,144 @@
"""Tests for the performance workload catalogue and correctness digest.
The G4 release gate runs one fixed release binary over nine workloads. A
retired CLI option or a digest that changes per invocation silently turns a
correctness-verified measurement into CORRECTNESS_FAIL, so both are pinned
here.
"""
import importlib.util
import json
import pathlib
import unittest
ROOT = pathlib.Path(__file__).resolve().parents[2]
WORKLOADS = ROOT / "tools" / "perf" / "workloads.json"
RUNNER = ROOT / "tools" / "perf" / "runner.py"
def load_runner():
spec = importlib.util.spec_from_file_location("marqdo_perf_runner", RUNNER)
module = importlib.util.module_from_spec(spec)
spec.loader.exec_module(module)
return module
def snapshot(run_id: str, status: str, value, extra_file: str = "/tmp/index.mq.md"):
return {
"schema": "marqdo.observation",
"schema_version": 1,
"run": {"id": run_id, "status": status, "source": None},
"capture": {},
"events": [
{
"schema": "marqdo.observation",
"schema_version": 1,
"run_id": run_id,
"seq": 0,
"kind": "stream.opened",
"payload": {"producer": {"name": "marqdo", "version": "3.0.0-rc.3"}},
},
{
"schema": "marqdo.observation",
"schema_version": 1,
"run_id": run_id,
"seq": 1,
"kind": "run.started",
"payload": {"entry": "e::index.mq.md::main", "started_unix_ms": 1795523668882},
},
{
"schema": "marqdo.observation",
"schema_version": 1,
"run_id": run_id,
"seq": 2,
"kind": "run.completed",
"payload": {"status": status, "value": value, "value_type": "Int"},
},
],
}
class WorkloadCatalogueTest(unittest.TestCase):
def test_run_and_call_workloads_use_the_current_output_option(self):
catalogue = json.loads(WORKLOADS.read_text(encoding="utf-8"))
workloads = catalogue["workloads"]
self.assertEqual(len(workloads), 9)
for workload in workloads:
argv = workload["argv"]
if workload["kind"] in ("run", "call"):
self.assertIn(
["--output", "json"],
[argv[index : index + 2] for index in range(len(argv))],
f"{workload['name']} must request the current Observation snapshot",
)
self.assertNotIn(
"--json",
argv,
f"{workload['name']} still passes the retired run/call flag",
)
else:
self.assertIn("--json", argv)
class DualCommandWorkloadTest(unittest.TestCase):
def test_run_and_call_workloads_separate_correctness_from_timing(self):
catalogue = json.loads(WORKLOADS.read_text(encoding="utf-8"))
for workload in catalogue["workloads"]:
if workload["kind"] not in ("run", "call"):
self.assertNotIn("measure_argv", workload)
continue
measure = workload.get("measure_argv")
self.assertIsNotNone(measure, f"{workload['name']} lacks measure_argv")
self.assertNotIn("--output", measure)
self.assertNotIn("--json", measure)
self.assertEqual(measure[0], workload["argv"][0])
class DigestStabilityTest(unittest.TestCase):
def setUp(self):
self.runner = load_runner()
def test_observation_digest_ignores_run_identity_and_paths(self):
first = self.runner.wire_digest(snapshot("run-1", "ok", 120))
second = self.runner.wire_digest(
snapshot("run-2", "ok", 120, extra_file="/other/host/index.mq.md")
)
self.assertEqual(first, second)
def test_observation_digest_tracks_the_result(self):
ok = self.runner.wire_digest(snapshot("run-1", "ok", 120))
wrong = self.runner.wire_digest(snapshot("run-1", "ok", 121))
failed = self.runner.wire_digest(snapshot("run-1", "error", 120))
self.assertNotEqual(ok, wrong)
self.assertNotEqual(ok, failed)
def test_observation_digest_tracks_the_event_stream(self):
document = snapshot("run-1", "ok", 120)
truncated = dict(document)
truncated["events"] = document["events"][:2]
self.assertNotEqual(
self.runner.wire_digest(document), self.runner.wire_digest(truncated)
)
def test_measured_text_digest_ignores_the_checkout_path(self):
runner = self.runner
first = runner.text_digest(b"output 120\n")
second = runner.text_digest(b"output 120\n")
self.assertEqual(first, second)
self.assertNotEqual(first, runner.text_digest(b"output 121\n"))
def test_check_document_keeps_the_command_digest(self):
report = {
"command": "check",
"success": True,
"diagnostics": [{"code": "sem.x", "severity": "error", "line": 1, "column": 2, "message": "m"}],
"stdout": "",
"stderr": "",
}
normalized = self.runner.normalize(report)
self.assertEqual(normalized["command"], "check")
self.assertEqual(len(normalized["diagnostics"]), 1)
if __name__ == "__main__":
unittest.main()
@@ -0,0 +1,81 @@
"""Tests for the one-run Observation stream/snapshot verifier."""
import json
import pathlib
import subprocess
import sys
import tempfile
import unittest
ROOT = pathlib.Path(__file__).resolve().parents[2]
SCRIPT = ROOT / "tools" / "ci" / "verify_observation_stream.py"
def event(seq: int, kind: str) -> dict:
return {
"schema": "marqdo.observation",
"schema_version": 1,
"run_id": "run-1",
"seq": seq,
"kind": kind,
"payload": {},
}
def write(path: pathlib.Path, value) -> pathlib.Path:
if isinstance(value, list):
path.write_text(
"".join(json.dumps(item) + "\n" for item in value), encoding="utf-8"
)
else:
path.write_text(json.dumps(value), encoding="utf-8")
return path
class VerifyObservationStreamTest(unittest.TestCase):
def run_script(self, stream, snapshot):
with tempfile.TemporaryDirectory() as name:
directory = pathlib.Path(name)
stream_path = write(directory / "stream.jsonl", stream)
snapshot_path = write(directory / "snapshot.json", snapshot)
return subprocess.run(
[sys.executable, str(SCRIPT), str(stream_path), str(snapshot_path)],
capture_output=True,
text=True,
)
def test_identical_stream_and_snapshot_pass(self):
events = [event(0, "stream.opened"), event(1, "run.completed")]
snapshot = {
"schema": "marqdo.observation",
"schema_version": 1,
"run": {"id": "run-1", "status": "ok", "source": None},
"capture": {},
"events": events,
}
result = self.run_script(events, snapshot)
self.assertEqual(result.returncode, 0, result.stderr)
def test_divergent_event_fails(self):
stream = [event(0, "stream.opened"), event(1, "run.completed")]
snapshot = {
"schema": "marqdo.observation",
"schema_version": 1,
"run": {"id": "run-1", "status": "ok", "source": None},
"capture": {},
"events": [event(0, "stream.opened"), event(1, "run.failed")],
}
result = self.run_script(stream, snapshot)
self.assertEqual(result.returncode, 1, result.stderr)
self.assertIn("differ", result.stderr)
def test_retired_format_fails(self):
events = [event(0, "stream.opened")]
retired = dict(events[0], schema="marqdo.execution-events")
result = self.run_script([retired], {"events": [events[0]]})
self.assertEqual(result.returncode, 1)
self.assertIn("current Observation", result.stderr)
if __name__ == "__main__":
unittest.main()
+65
View File
@@ -0,0 +1,65 @@
#!/usr/bin/env python3
"""Assert that one Observation run's JSONL stream and JSON snapshot agree.
Usage:
python3 tools/ci/verify_observation_stream.py STREAM.jsonl SNAPSHOT.json
Exit 0 when the snapshot's events are exactly the stream's events, 1 when they
differ or a document is not a current Observation artifact. Both destinations
must come from the same execution; this check never re-runs the program.
"""
from __future__ import annotations
import json
import pathlib
import sys
def load_events(path: pathlib.Path, *, snapshot: bool) -> list:
raw = path.read_bytes()
if snapshot:
document = json.loads(raw.decode("utf-8"))
if document.get("schema") != "marqdo.observation":
raise SystemExit(f"{path}: not a current Observation snapshot")
events = document.get("events")
else:
if raw and not raw.endswith(b"\n"):
raise SystemExit(f"{path}: interrupted JSONL record")
events = [json.loads(line) for line in raw.splitlines()]
if not isinstance(events, list) or not events:
raise SystemExit(f"{path}: no Observation events")
for event in events:
if event.get("schema") != "marqdo.observation":
raise SystemExit(f"{path}: event is not current Observation")
return events
def main(argv: list[str]) -> int:
if len(argv) != 3:
print(
"usage: verify_observation_stream.py STREAM.jsonl SNAPSHOT.json",
file=sys.stderr,
)
return 2
stream = load_events(pathlib.Path(argv[1]), snapshot=False)
snapshot = load_events(pathlib.Path(argv[2]), snapshot=True)
if stream != snapshot:
for index, (left, right) in enumerate(zip(stream, snapshot)):
if left != right:
print(
f"stream and snapshot differ at seq {left.get('seq', index)}",
file=sys.stderr,
)
break
else:
print(
f"stream has {len(stream)} events, snapshot has {len(snapshot)}",
file=sys.stderr,
)
return 1
print(f"stream and snapshot share {len(stream)} events from one run")
return 0
if __name__ == "__main__":
raise SystemExit(main(sys.argv))
+10 -2
View File
@@ -8,8 +8,16 @@ workload whose wire output did not match the committed expected digest.
* Build one release binary with `cargo build --release --locked -p marqdo-cli` * Build one release binary with `cargo build --release --locked -p marqdo-cli`
and keep it fixed for the whole run. The report records its SHA256, the and keep it fixed for the whole run. The report records its SHA256, the
`Cargo.lock` digest, `rustc -vV`, source SHA and profile. `Cargo.lock` digest, `rustc -vV`, source SHA and profile.
* Correctness comes first: every warmup run is parsed and hashed. A mismatch * Correctness comes first. Each workload has one correctness command and one
is `CORRECTNESS_FAIL`; its faster wall time is never reported. measurement command. For `run`/`call` the correctness command requests the
current Observation snapshot (`--output json`) and its digest pins the
terminal status/result, the committed stdout/stderr byte digests and the
ordered event-kind counts; the measurement command is the same program
without the opt-in observability destination, and every timed sample must
reproduce the committed text digest. A mismatch is `CORRECTNESS_FAIL`; its
faster wall time is never reported. Comparing the timed execution path
against the baseline execution path is the point: an opt-in protocol document
must not be billed as a product regression.
* Approved-node release evidence needs at least 5 warmups and 20 samples per * Approved-node release evidence needs at least 5 warmups and 20 samples per
workload on a dedicated, stable node. A maintainer-approved shared-node workload on a dedicated, stable node. A maintainer-approved shared-node
RC comparison needs the same sample counts in at least three paired runs. RC comparison needs the same sample counts in at least three paired runs.
+286 -254
View File
@@ -1,297 +1,329 @@
{ {
"measure_argv": [
"run",
"tests/conformance/semantics/55-first-fit-free-list-allocator.mq.md"
],
"measure_sha256": "sha256:e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855",
"normalized": { "normalized": {
"command": "run", "events": {
"stderr": "", "by_kind": {
"stdout": "", "branch.eval": 134,
"success": true, "call.enter": 255,
"value": { "call.exit": 255,
"items": [ "effect": 249,
{ "loop.iteration": 40,
"entries": { "parameter.observed": 558,
"ok": { "return": 255,
"type": "bool", "run.completed": 1,
"value": true "run.started": 1,
"stream.opened": 1,
"variable.assigned": 507
},
"count": 2256,
"sequence_sha256": "sha256:7ef37396e4e92c246a44e144f5532b8cefe460cb9bffe4897a561cf42f6a2b4b"
},
"schema": "marqdo.observation",
"status": "ok",
"stderr": {
"bytes": 0,
"sha256": "sha256:e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855"
},
"stdout": {
"bytes": 0,
"sha256": "sha256:e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855"
},
"terminal": {
"status": "ok",
"value": {
"items": [
{
"entries": {
"ok": {
"type": "bool",
"value": true
},
"value": {
"decimal": "16",
"type": "int"
}
}, },
"value": { "type": "map"
"decimal": "16",
"type": "int"
}
}, },
"type": "map" {
}, "entries": {
{ "ok": {
"entries": { "type": "bool",
"ok": { "value": true
"type": "bool", },
"value": true "value": {
"decimal": "32",
"type": "int"
}
}, },
"value": { "type": "map"
"decimal": "32",
"type": "int"
}
}, },
"type": "map" {
}, "entries": {
{ "ok": {
"entries": { "type": "bool",
"ok": { "value": true
"type": "bool", },
"value": true "value": {
"decimal": "16",
"type": "int"
}
}, },
"value": { "type": "map"
"decimal": "16",
"type": "int"
}
}, },
"type": "map" {
}, "entries": {
{ "ok": {
"entries": { "type": "bool",
"ok": { "value": true
"type": "bool", },
"value": true "value": {
"decimal": "16",
"type": "int"
}
}, },
"value": { "type": "map"
"decimal": "16",
"type": "int"
}
}, },
"type": "map" {
}, "entries": {
{ "ok": {
"entries": { "type": "bool",
"ok": { "value": true
"type": "bool", },
"value": true "value": {
"decimal": "32",
"type": "int"
}
}, },
"value": { "type": "map"
"decimal": "32",
"type": "int"
}
}, },
"type": "map" {
}, "entries": {
{ "ok": {
"entries": { "type": "bool",
"ok": { "value": true
"type": "bool", },
"value": true "value": {
"decimal": "56",
"type": "int"
}
}, },
"value": { "type": "map"
"decimal": "56",
"type": "int"
}
}, },
"type": "map" {
}, "entries": {
{ "ok": {
"entries": { "type": "bool",
"ok": { "value": true
"type": "bool", },
"value": true "value": {
"decimal": "56",
"type": "int"
}
}, },
"value": { "type": "map"
"decimal": "56",
"type": "int"
}
}, },
"type": "map" {
}, "entries": {
{ "ok": {
"entries": { "type": "bool",
"ok": { "value": true
"type": "bool", },
"value": true "value": {
"decimal": "72",
"type": "int"
}
}, },
"value": { "type": "map"
"decimal": "72",
"type": "int"
}
}, },
"type": "map" {
}, "entries": {
{ "ok": {
"entries": { "type": "bool",
"ok": { "value": true
"type": "bool", },
"value": true "value": {
"decimal": "96",
"type": "int"
}
}, },
"value": { "type": "map"
"decimal": "96",
"type": "int"
}
}, },
"type": "map" {
}, "entries": {
{ "ok": {
"entries": { "type": "bool",
"ok": { "value": true
"type": "bool", },
"value": true "value": {
"decimal": "112",
"type": "int"
}
}, },
"value": { "type": "map"
"decimal": "112",
"type": "int"
}
}, },
"type": "map" {
}, "entries": {
{ "code": {
"entries": { "type": "text",
"code": { "value": "alloc.no_space"
"type": "text", },
"value": "alloc.no_space" "message": {
"type": "text",
"value": "没有足够的空闲空间"
},
"ok": {
"type": "bool",
"value": false
}
}, },
"message": { "type": "map"
"type": "text",
"value": "没有足够的空闲空间"
},
"ok": {
"type": "bool",
"value": false
}
}, },
"type": "map" {
}, "entries": {
{ "ok": {
"entries": { "type": "bool",
"ok": { "value": true
"type": "bool", },
"value": true "value": {
"decimal": "16",
"type": "int"
}
}, },
"value": { "type": "map"
"decimal": "16",
"type": "int"
}
}, },
"type": "map" {
}, "entries": {
{ "ok": {
"entries": { "type": "bool",
"ok": { "value": true
"type": "bool", },
"value": true "value": {
"decimal": "32",
"type": "int"
}
}, },
"value": { "type": "map"
"decimal": "32",
"type": "int"
}
}, },
"type": "map" {
}, "entries": {
{ "ok": {
"entries": { "type": "bool",
"ok": { "value": true
"type": "bool", },
"value": true "value": {
"decimal": "48",
"type": "int"
}
}, },
"value": { "type": "map"
"decimal": "48",
"type": "int"
}
}, },
"type": "map" {
}, "entries": {
{ "ok": {
"entries": { "type": "bool",
"ok": { "value": true
"type": "bool", },
"value": true "value": {
"decimal": "16",
"type": "int"
}
}, },
"value": { "type": "map"
"decimal": "16",
"type": "int"
}
}, },
"type": "map" {
}, "entries": {
{ "code": {
"entries": { "type": "text",
"code": { "value": "alloc.no_space"
"type": "text", },
"value": "alloc.no_space" "message": {
"type": "text",
"value": "没有足够的空闲空间"
},
"ok": {
"type": "bool",
"value": false
}
}, },
"message": { "type": "map"
"type": "text",
"value": "没有足够的空闲空间"
},
"ok": {
"type": "bool",
"value": false
}
}, },
"type": "map" {
}, "entries": {
{ "ok": {
"entries": { "type": "bool",
"ok": { "value": true
"type": "bool", },
"value": true "value": {
"type": "none"
}
}, },
"value": { "type": "map"
"type": "none"
}
}, },
"type": "map" {
}, "entries": {
{ "code": {
"entries": { "type": "text",
"code": { "value": "alloc.double_free"
"type": "text", },
"value": "alloc.double_free" "message": {
"type": "text",
"value": "块已在空闲链表"
},
"ok": {
"type": "bool",
"value": false
}
}, },
"message": { "type": "map"
"type": "text",
"value": "块已在空闲链表"
},
"ok": {
"type": "bool",
"value": false
}
}, },
"type": "map" {
}, "decimal": "33",
{ "type": "int"
"decimal": "33", },
"type": "int" {
}, "decimal": "22",
{ "type": "int"
"decimal": "22", },
"type": "int" {
}, "decimal": "33",
{ "type": "int"
"decimal": "33", },
"type": "int" {
}, "decimal": "33",
{ "type": "int"
"decimal": "33", },
"type": "int" {
}, "decimal": "22",
{ "type": "int"
"decimal": "22", },
"type": "int" {
}, "decimal": "44",
{ "type": "int"
"decimal": "44", },
"type": "int" {
}, "decimal": "55",
{ "type": "int"
"decimal": "55", },
"type": "int" {
}, "decimal": "66",
{ "type": "int"
"decimal": "66", },
"type": "int" {
}, "decimal": "77",
{ "type": "int"
"decimal": "77", }
"type": "int" ],
} "type": "list"
], },
"type": "list" "value_type": "List"
} }
}, },
"schema": "marqdo.perf.expected.v1", "schema": "marqdo.perf.expected.v1",
"wire_sha256": "sha256:039ec1523726f48375f1fb5fafdfe849e296e1ee39b8a4820a0a0970cf3f8c3b", "wire_sha256": "sha256:1fc8f64612fe89c66cc38884f31ba2a883c3962a36d431b4e8d224ce8a58922b",
"workload": "allocator-free-list" "workload": "allocator-free-list"
} }
+64 -32
View File
@@ -1,42 +1,74 @@
{ {
"measure_argv": [
"run",
"tests/conformance/semantics/63-memory-bytecode-vm.mq.md"
],
"measure_sha256": "sha256:e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855",
"normalized": { "normalized": {
"command": "run", "events": {
"stderr": "", "by_kind": {
"stdout": "", "branch.eval": 51,
"success": true, "call.enter": 7,
"value": { "call.exit": 7,
"items": [ "effect": 28,
{ "loop.iteration": 34,
"entries": { "parameter.observed": 14,
"ok": { "return": 7,
"type": "bool", "run.completed": 1,
"value": true "run.started": 1,
"stream.opened": 1,
"variable.assigned": 66
},
"count": 217,
"sequence_sha256": "sha256:218b342c70a1388d8f9e5ba5843c828ea53fa01c31ddae171c023dd581423f3a"
},
"schema": "marqdo.observation",
"status": "ok",
"stderr": {
"bytes": 0,
"sha256": "sha256:e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855"
},
"stdout": {
"bytes": 0,
"sha256": "sha256:e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855"
},
"terminal": {
"status": "ok",
"value": {
"items": [
{
"entries": {
"ok": {
"type": "bool",
"value": true
},
"value": {
"decimal": "36",
"type": "int"
}
}, },
"value": { "type": "map"
"decimal": "36",
"type": "int"
}
}, },
"type": "map" {
}, "entries": {
{ "ok": {
"entries": { "type": "bool",
"ok": { "value": true
"type": "bool", },
"value": true "value": {
"decimal": "42",
"type": "int"
}
}, },
"value": { "type": "map"
"decimal": "42", }
"type": "int" ],
} "type": "list"
}, },
"type": "map" "value_type": "List"
}
],
"type": "list"
} }
}, },
"schema": "marqdo.perf.expected.v1", "schema": "marqdo.perf.expected.v1",
"wire_sha256": "sha256:418131f5780815da5716d84ed5c00269760a881856cce67e0f4c8b42d417c7ec", "wire_sha256": "sha256:35b915e08c3f69fa0f6375565caaee21393a707d35852d03734b4b9c9643a5c0",
"workload": "bytecode-vm" "workload": "bytecode-vm"
} }
+41 -17
View File
@@ -1,24 +1,48 @@
{ {
"measure_argv": [
"call",
"examples/factorial.mq.md",
"数学.阶乘",
"--arg",
"n=5"
],
"measure_sha256": "sha256:97b912eb4a61df5f806ca6239dde3e1a4f51ad20aced1642cbb83dc510a5fa6b",
"normalized": { "normalized": {
"command": "call", "events": {
"diagnostics": [ "by_kind": {
{ "branch.eval": 9,
"code": "sem.inferred_signature", "call.enter": 5,
"column": 1, "call.exit": 5,
"line": 3, "parameter.observed": 5,
"message": "function signature was inferred; declare it with `params(...)`", "return": 5,
"severity": "warning" "run.completed": 1,
} "run.started": 1,
], "stream.opened": 1,
"stderr": "", "variable.assigned": 4
"stdout": "", },
"success": true, "count": 36,
"value": { "sequence_sha256": "sha256:1c776fb38bbfa9cfb32e907385b18e75d84df3e62d96fee7859a739054513daf"
"decimal": "120", },
"type": "int" "schema": "marqdo.observation",
"status": "ok",
"stderr": {
"bytes": 0,
"sha256": "sha256:e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855"
},
"stdout": {
"bytes": 0,
"sha256": "sha256:e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855"
},
"terminal": {
"status": "ok",
"value": {
"decimal": "120",
"type": "int"
},
"value_type": "Int"
} }
}, },
"schema": "marqdo.perf.expected.v1", "schema": "marqdo.perf.expected.v1",
"wire_sha256": "sha256:0cbd8ab0b0e9e671e7e54f707ff2de00181b2721924b7fdec998ff9611873275", "wire_sha256": "sha256:34c724c5abc46f3c38875cf90c23e70e8f4048124a8571665f00f30bbbfab758",
"workload": "factorial-run" "workload": "factorial-run"
} }
+60 -29
View File
@@ -1,36 +1,67 @@
{ {
"measure_argv": [
"run",
"tests/conformance/semantics/71-http-parser.mq.md"
],
"measure_sha256": "sha256:e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855",
"normalized": { "normalized": {
"command": "run", "events": {
"stderr": "", "by_kind": {
"stdout": "", "branch.eval": 545,
"success": true, "call.enter": 34,
"value": { "call.exit": 34,
"items": [ "loop.iteration": 756,
{ "parameter.observed": 90,
"decimal": "200", "return": 34,
"type": "int" "run.completed": 1,
}, "run.started": 1,
{ "stream.opened": 1,
"type": "text", "variable.assigned": 1548
"value": "OK" },
}, "count": 3044,
{ "sequence_sha256": "sha256:d394bf12395c193818794d34de4fef9f6a9048eb63235f30ce53a6785c4a2ab5"
"type": "text", },
"value": "text/plain" "schema": "marqdo.observation",
}, "status": "ok",
{ "stderr": {
"type": "text", "bytes": 0,
"value": "hello world" "sha256": "sha256:e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855"
}, },
{ "stdout": {
"type": "text", "bytes": 0,
"value": "GET /health HTTP/1.1\r\nAccept: text/plain\r\nHost: example.test\r\n\r\n" "sha256": "sha256:e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855"
} },
], "terminal": {
"type": "list" "status": "ok",
"value": {
"items": [
{
"decimal": "200",
"type": "int"
},
{
"type": "text",
"value": "OK"
},
{
"type": "text",
"value": "text/plain"
},
{
"type": "text",
"value": "hello world"
},
{
"type": "text",
"value": "GET /health HTTP/1.1\r\nAccept: text/plain\r\nHost: example.test\r\n\r\n"
}
],
"type": "list"
},
"value_type": "List"
} }
}, },
"schema": "marqdo.perf.expected.v1", "schema": "marqdo.perf.expected.v1",
"wire_sha256": "sha256:540f8dd9a2071d40c1f07d82961e0e0174822e123c828ffc5d2a06cc880052ed", "wire_sha256": "sha256:1617796958d6b8e30c65884f26640f1072cde6037158e3abf0a196ecb9e39712",
"workload": "http-parser" "workload": "http-parser"
} }
+220 -189
View File
@@ -1,199 +1,230 @@
{ {
"measure_argv": [
"run",
"tests/conformance/semantics/62-json-array-parser.mq.md"
],
"measure_sha256": "sha256:e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855",
"normalized": { "normalized": {
"command": "run", "events": {
"stderr": "", "by_kind": {
"stdout": "", "branch.eval": 632,
"success": true, "call.enter": 341,
"value": { "call.exit": 341,
"items": [ "loop.iteration": 208,
{ "parameter.observed": 567,
"entries": { "return": 341,
"next": { "run.completed": 1,
"decimal": "20", "run.started": 1,
"type": "int" "stream.opened": 1,
}, "variable.assigned": 700
"ok": { },
"type": "bool", "count": 3133,
"value": true "sequence_sha256": "sha256:cac83ea2856c09d105554b0e0d3bd1ed3d2541c19af51bddf236ab9b6e87f354"
}, },
"value": { "schema": "marqdo.observation",
"items": [ "status": "ok",
{ "stderr": {
"decimal": "1", "bytes": 0,
"type": "int" "sha256": "sha256:e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855"
}, },
{ "stdout": {
"decimal": "23", "bytes": 0,
"type": "int" "sha256": "sha256:e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855"
}, },
{ "terminal": {
"items": [ "status": "ok",
{ "value": {
"decimal": "4", "items": [
"type": "int" {
}, "entries": {
{ "next": {
"decimal": "5", "decimal": "20",
"type": "int" "type": "int"
}
],
"type": "list"
},
{
"decimal": "-6",
"type": "int"
}
],
"type": "list"
}
},
"type": "map"
},
{
"entries": {
"code": {
"type": "text",
"value": "json.invalid_array"
},
"message": {
"type": "text",
"value": "数组缺少逗号或 ]"
},
"ok": {
"type": "bool",
"value": false
}
},
"type": "map"
},
{
"entries": {
"code": {
"type": "text",
"value": "json.unexpected_eof"
},
"message": {
"type": "text",
"value": "数组未闭合"
},
"ok": {
"type": "bool",
"value": false
}
},
"type": "map"
},
{
"entries": {
"next": {
"decimal": "35",
"type": "int"
},
"ok": {
"type": "bool",
"value": true
},
"value": {
"entries": {
"a": {
"decimal": "1",
"type": "int"
},
"b": {
"items": [
{
"type": "bool",
"value": true
},
{
"type": "none"
},
{
"type": "text",
"value": "说\"好"
}
],
"type": "list"
}
}, },
"type": "map" "ok": {
} "type": "bool",
}, "value": true
"type": "map" },
}, "value": {
{ "items": [
"entries": { {
"next": { "decimal": "1",
"decimal": "6", "type": "int"
"type": "int"
},
"ok": {
"type": "bool",
"value": true
},
"value": {
"type": "text",
"value": "a\nb"
}
},
"type": "map"
},
{
"entries": {
"next": {
"decimal": "37",
"type": "int"
},
"ok": {
"type": "bool",
"value": true
},
"value": {
"items": [
{
"decimal": "1",
"type": "int"
},
{
"type": "float",
"value": 2.5
},
{
"type": "float",
"value": -300.0
},
{
"type": "float",
"value": 0.4
},
{
"entries": {
"a": {
"type": "float",
"value": 1.0
}
}, },
"type": "map" {
}, "decimal": "23",
{ "type": "int"
"type": "text", },
"value": "x" {
} "items": [
], {
"type": "list" "decimal": "4",
} "type": "int"
},
{
"decimal": "5",
"type": "int"
}
],
"type": "list"
},
{
"decimal": "-6",
"type": "int"
}
],
"type": "list"
}
},
"type": "map"
}, },
"type": "map" {
}, "entries": {
{ "code": {
"type": "text", "type": "text",
"value": "[1, 2.5, -300.0, 0.4, {\"a\": 1.0}, \"x\"]" "value": "json.invalid_array"
} },
], "message": {
"type": "list" "type": "text",
"value": "数组缺少逗号或 ]"
},
"ok": {
"type": "bool",
"value": false
}
},
"type": "map"
},
{
"entries": {
"code": {
"type": "text",
"value": "json.unexpected_eof"
},
"message": {
"type": "text",
"value": "数组未闭合"
},
"ok": {
"type": "bool",
"value": false
}
},
"type": "map"
},
{
"entries": {
"next": {
"decimal": "35",
"type": "int"
},
"ok": {
"type": "bool",
"value": true
},
"value": {
"entries": {
"a": {
"decimal": "1",
"type": "int"
},
"b": {
"items": [
{
"type": "bool",
"value": true
},
{
"type": "none"
},
{
"type": "text",
"value": "说\"好"
}
],
"type": "list"
}
},
"type": "map"
}
},
"type": "map"
},
{
"entries": {
"next": {
"decimal": "6",
"type": "int"
},
"ok": {
"type": "bool",
"value": true
},
"value": {
"type": "text",
"value": "a\nb"
}
},
"type": "map"
},
{
"entries": {
"next": {
"decimal": "37",
"type": "int"
},
"ok": {
"type": "bool",
"value": true
},
"value": {
"items": [
{
"decimal": "1",
"type": "int"
},
{
"type": "float",
"value": 2.5
},
{
"type": "float",
"value": -300.0
},
{
"type": "float",
"value": 0.4
},
{
"entries": {
"a": {
"type": "float",
"value": 1.0
}
},
"type": "map"
},
{
"type": "text",
"value": "x"
}
],
"type": "list"
}
},
"type": "map"
},
{
"type": "text",
"value": "[1, 2.5, -300.0, 0.4, {\"a\": 1.0}, \"x\"]"
}
],
"type": "list"
},
"value_type": "List"
} }
}, },
"schema": "marqdo.perf.expected.v1", "schema": "marqdo.perf.expected.v1",
"wire_sha256": "sha256:d6f795f43eb1ae4c3d2f04254b8135f71d717ef8a649efdf7785f172b5381011", "wire_sha256": "sha256:c9833930c28ef238a606db40b33005338e75b83cf9ad98ffaa16f6d9f371a12a",
"workload": "json-parser" "workload": "json-parser"
} }
+153 -123
View File
@@ -1,130 +1,160 @@
{ {
"measure_argv": [
"run",
"tests/conformance/semantics/70-matrix-multiply.mq.md"
],
"measure_sha256": "sha256:e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855",
"normalized": { "normalized": {
"command": "run", "events": {
"stderr": "", "by_kind": {
"stdout": "", "call.enter": 2,
"success": true, "call.exit": 2,
"value": { "loop.iteration": 25,
"items": [ "parameter.observed": 2,
{ "return": 2,
"items": [ "run.completed": 1,
{ "run.started": 1,
"items": [ "stream.opened": 1,
{ "variable.assigned": 54
"decimal": "1", },
"type": "int" "count": 90,
}, "sequence_sha256": "sha256:a2b99c523f389a8efd203f54a88f4c9c4ecefe03cf453a3c18ab255913423327"
{ },
"decimal": "2", "schema": "marqdo.observation",
"type": "int" "status": "ok",
}, "stderr": {
{ "bytes": 0,
"decimal": "3", "sha256": "sha256:e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855"
"type": "int" },
} "stdout": {
], "bytes": 0,
"type": "list" "sha256": "sha256:e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855"
}, },
{ "terminal": {
"items": [ "status": "ok",
{ "value": {
"decimal": "4", "items": [
"type": "int" {
}, "items": [
{ {
"decimal": "5", "items": [
"type": "int" {
}, "decimal": "1",
{ "type": "int"
"decimal": "6", },
"type": "int" {
} "decimal": "2",
], "type": "int"
"type": "list" },
} {
], "decimal": "3",
"type": "list" "type": "int"
}, }
{ ],
"items": [ "type": "list"
{ },
"items": [ {
{ "items": [
"decimal": "7", {
"type": "int" "decimal": "4",
}, "type": "int"
{ },
"decimal": "8", {
"type": "int" "decimal": "5",
} "type": "int"
], },
"type": "list" {
}, "decimal": "6",
{ "type": "int"
"items": [ }
{ ],
"decimal": "9", "type": "list"
"type": "int" }
}, ],
{ "type": "list"
"decimal": "10", },
"type": "int" {
} "items": [
], {
"type": "list" "items": [
}, {
{ "decimal": "7",
"items": [ "type": "int"
{ },
"decimal": "11", {
"type": "int" "decimal": "8",
}, "type": "int"
{ }
"decimal": "12", ],
"type": "int" "type": "list"
} },
], {
"type": "list" "items": [
} {
], "decimal": "9",
"type": "list" "type": "int"
}, },
{ {
"items": [ "decimal": "10",
{ "type": "int"
"items": [ }
{ ],
"decimal": "58", "type": "list"
"type": "int" },
}, {
{ "items": [
"decimal": "64", {
"type": "int" "decimal": "11",
} "type": "int"
], },
"type": "list" {
}, "decimal": "12",
{ "type": "int"
"items": [ }
{ ],
"decimal": "139", "type": "list"
"type": "int" }
}, ],
{ "type": "list"
"decimal": "154", },
"type": "int" {
} "items": [
], {
"type": "list" "items": [
} {
], "decimal": "58",
"type": "list" "type": "int"
} },
], {
"type": "list" "decimal": "64",
"type": "int"
}
],
"type": "list"
},
{
"items": [
{
"decimal": "139",
"type": "int"
},
{
"decimal": "154",
"type": "int"
}
],
"type": "list"
}
],
"type": "list"
}
],
"type": "list"
},
"value_type": "List"
} }
}, },
"schema": "marqdo.perf.expected.v1", "schema": "marqdo.perf.expected.v1",
"wire_sha256": "sha256:c5edb02098191e081a143b8f5d23424fcc43172643a44912cdc8ae17ace99cc2", "wire_sha256": "sha256:b975ac00d3e9d4d01d7e0fd26e0fde152333b254d38e7e1c4195bde824e97f32",
"workload": "matrix-multiply" "workload": "matrix-multiply"
} }
+40 -7
View File
@@ -1,14 +1,47 @@
{ {
"measure_argv": [
"run",
"stdlib/demo.mq.md"
],
"measure_sha256": "sha256:4f5fcde6b4073511330c50f15bf07db13abc2cf0cf71de777e8e23ca870220fe",
"normalized": { "normalized": {
"command": "run", "events": {
"stderr": "", "by_kind": {
"stdout": "[\"文本\", 2, 1.5, [3, true], {a: 1, b: \"x\"}, None]\n[\"文本\", 2, 1.5, [3, true], {a: 1, b: \"x\"}, None]\nTable[名称 | 分数]{甲 | 87; 乙 | 92}\nTable[名称 | 分数]{甲 | 87; 乙 | 92}\n[Formula(\"a = 1\"), Code(\"text\", 9 bytes), FunctionRef(root:default::demo.mq.md::演示函数)]\n[Formula(\"a = 1\"), Code(\"text\", 9 bytes), FunctionRef(root:default::demo.mq.md::演示函数)]\n", "branch.eval": 1956,
"success": true, "call.enter": 131,
"value": { "call.exit": 131,
"type": "none" "effect": 404,
"loop.iteration": 810,
"parameter.observed": 166,
"return": 131,
"run.completed": 1,
"run.started": 1,
"stdout.chunk": 6,
"stream.opened": 1,
"variable.assigned": 2533
},
"count": 6271,
"sequence_sha256": "sha256:e17ea3ebe3ecd40f9e619f06e3bd9d4370d34616caf02a6099bbffe0f686522d"
},
"schema": "marqdo.observation",
"status": "ok",
"stderr": {
"bytes": 0,
"sha256": "sha256:e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855"
},
"stdout": {
"bytes": 380,
"sha256": "sha256:4f5fcde6b4073511330c50f15bf07db13abc2cf0cf71de777e8e23ca870220fe"
},
"terminal": {
"status": "ok",
"value": {
"type": "none"
},
"value_type": "None"
} }
}, },
"schema": "marqdo.perf.expected.v1", "schema": "marqdo.perf.expected.v1",
"wire_sha256": "sha256:80dfbfb894544b5cd4281999a67deaa9ce4fb19ef32d160fb4ee72dbd615d03c", "wire_sha256": "sha256:7bed5196b8cd52d1de12561f445bc2271dd5e91ed9c4065ebf79d0cb22d8a826",
"workload": "stdlib-print-demo" "workload": "stdlib-print-demo"
} }
+114 -83
View File
@@ -1,94 +1,125 @@
{ {
"measure_argv": [
"run",
"tests/conformance/semantics/65-table-sort-stdlib.mq.md"
],
"measure_sha256": "sha256:e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855",
"normalized": { "normalized": {
"command": "run", "events": {
"stderr": "", "by_kind": {
"stdout": "", "branch.eval": 9,
"success": true, "call.enter": 5,
"value": { "call.exit": 5,
"items": [ "loop.iteration": 10,
{ "parameter.observed": 11,
"header": [ "return": 5,
"名称", "run.completed": 1,
"分数" "run.started": 1,
], "stream.opened": 1,
"rows": [ "variable.assigned": 35
[ },
{ "count": 83,
"type": "text", "sequence_sha256": "sha256:287e3f01941c53559c4113fceded4612a1f6c8ff44d2c19712aebf3c9034a172"
"value": "甲" },
}, "schema": "marqdo.observation",
{ "status": "ok",
"decimal": "87", "stderr": {
"type": "int" "bytes": 0,
} "sha256": "sha256:e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855"
},
"stdout": {
"bytes": 0,
"sha256": "sha256:e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855"
},
"terminal": {
"status": "ok",
"value": {
"items": [
{
"header": [
"名称",
"分数"
], ],
[ "rows": [
{ [
"type": "text", {
"value": "乙" "type": "text",
}, "value": "甲"
{ },
"decimal": "92", {
"type": "int" "decimal": "87",
} "type": "int"
}
],
[
{
"type": "text",
"value": "乙"
},
{
"decimal": "92",
"type": "int"
}
],
[
{
"type": "text",
"value": "丙"
},
{
"decimal": "71",
"type": "int"
}
]
], ],
[ "type": "table"
{ },
"type": "text", {
"value": "丙" "header": [
}, "名称",
{ "分数"
"decimal": "71",
"type": "int"
}
]
],
"type": "table"
},
{
"header": [
"名称",
"分数"
],
"rows": [
[
{
"type": "text",
"value": "丙"
},
{
"decimal": "71",
"type": "int"
}
], ],
[ "rows": [
{ [
"type": "text", {
"value": "甲" "type": "text",
}, "value": "丙"
{ },
"decimal": "87", {
"type": "int" "decimal": "71",
} "type": "int"
}
],
[
{
"type": "text",
"value": "甲"
},
{
"decimal": "87",
"type": "int"
}
],
[
{
"type": "text",
"value": "乙"
},
{
"decimal": "92",
"type": "int"
}
]
], ],
[ "type": "table"
{ }
"type": "text", ],
"value": "乙" "type": "list"
}, },
{ "value_type": "List"
"decimal": "92",
"type": "int"
}
]
],
"type": "table"
}
],
"type": "list"
} }
}, },
"schema": "marqdo.perf.expected.v1", "schema": "marqdo.perf.expected.v1",
"wire_sha256": "sha256:12b61dcd9955cb7e137c705e51e29d58322d9525993681170f2dded48e94ee97", "wire_sha256": "sha256:d09caebb0ee91b593a8798f67a082ee38c008ea41274eeef3c05b2a4236081d1",
"workload": "table-sort" "workload": "table-sort"
} }
+181 -52
View File
@@ -17,6 +17,8 @@ performance evidence.
""" """
import argparse import argparse
import base64
from collections import Counter
import hashlib import hashlib
import json import json
import os import os
@@ -64,8 +66,72 @@ def git_sha(repo: Path) -> str:
return output(["git", "-C", str(repo), "rev-parse", "HEAD"]) or "unknown" return output(["git", "-C", str(repo), "rev-parse", "HEAD"]) or "unknown"
OBSERVATION_SCHEMA = "marqdo.observation"
# Run-specific or host-specific payload fields never contribute to correctness.
VOLATILE_PAYLOAD_KEYS = {"file", "started_unix_ms"}
def _stable(value):
"""Drop run/host-specific data from an observation payload."""
if isinstance(value, dict):
return {
key: _stable(item)
for key, item in value.items()
if key not in VOLATILE_PAYLOAD_KEYS
}
if isinstance(value, list):
return [_stable(item) for item in value]
if isinstance(value, str):
return value.replace(str(ROOT), "<repo>")
return value
def _committed_bytes(chunks: list[str]) -> dict:
data = b"".join(base64.b64decode(chunk) for chunk in chunks)
return {
"bytes": len(data),
"sha256": f"sha256:{hashlib.sha256(data).hexdigest()}",
}
def normalize(document: dict) -> dict: def normalize(document: dict) -> dict:
"""Canonical subset used for correctness: no timings, no trace, no paths.""" """Canonical subset used for correctness: no timings, no run ids, no paths."""
if document.get("schema") == OBSERVATION_SCHEMA:
# Current `run`/`call --output json` snapshot: one execution event
# sequence. The run id, wall-clock start and absolute paths are
# per-invocation. Correctness pins the terminal status/result, the
# committed stdout/stderr bytes and the ordered event kinds (count,
# per-kind totals and a sequence digest) without storing thousands of
# structural payloads in the repository.
events = document.get("events") or []
kinds = [event.get("kind") or "" for event in events]
counts = Counter(kinds)
terminal = _stable(events[-1].get("payload")) if events else None
return {
"schema": OBSERVATION_SCHEMA,
"status": (document.get("run") or {}).get("status"),
"terminal": terminal,
"stdout": _committed_bytes(
[
event["payload"]["data_base64"]
for event in events
if event.get("kind") == "stdout.chunk"
]
),
"stderr": _committed_bytes(
[
event["payload"]["data_base64"]
for event in events
if event.get("kind") == "stderr.chunk"
]
),
"events": {
"count": len(events),
"sequence_sha256": "sha256:"
+ hashlib.sha256("\n".join(kinds).encode("utf-8")).hexdigest(),
"by_kind": dict(sorted(counts.items())),
},
}
payload = {} payload = {}
for key in ("command", "success", "value", "stdout", "stderr", "errors"): for key in ("command", "success", "value", "stdout", "stderr", "errors"):
if key in document: if key in document:
@@ -93,28 +159,37 @@ def expected_path(name: str) -> Path:
return EXPECTED / f"{name}.json" return EXPECTED / f"{name}.json"
def load_expected(name: str) -> str | None: def text_digest(data: bytes) -> str:
"""Digest of measured text output with the checkout path normalised."""
normalized = data.replace(str(ROOT).encode(), b"<repo>")
return f"sha256:{hashlib.sha256(normalized).hexdigest()}"
def load_expected(name: str) -> dict | None:
path = expected_path(name) path = expected_path(name)
if not path.is_file(): if not path.is_file():
return None return None
return json.loads(path.read_text())["wire_sha256"] return json.loads(path.read_text())
def record_expected(name: str, document: dict) -> None: def record_expected(
name: str,
document: dict,
measure_stdout: bytes | None,
measure_argv: list[str] | None,
) -> None:
EXPECTED.mkdir(parents=True, exist_ok=True) EXPECTED.mkdir(parents=True, exist_ok=True)
payload = {
"schema": "marqdo.perf.expected.v1",
"workload": name,
"wire_sha256": wire_digest(document),
"normalized": normalize(document),
}
if measure_stdout is not None:
payload["measure_sha256"] = text_digest(measure_stdout)
payload["measure_argv"] = measure_argv
expected_path(name).write_text( expected_path(name).write_text(
json.dumps( json.dumps(payload, ensure_ascii=False, sort_keys=True, indent=2) + "\n"
{
"schema": "marqdo.perf.expected.v1",
"workload": name,
"wire_sha256": wire_digest(document),
"normalized": normalize(document),
},
ensure_ascii=False,
sort_keys=True,
indent=2,
)
+ "\n"
) )
@@ -242,62 +317,116 @@ def run_workload(
prefix = [] prefix = []
if cpu_list: if cpu_list:
prefix = [shutil.which("taskset") or "taskset", "-c", cpu_list] prefix = [shutil.which("taskset") or "taskset", "-c", cpu_list]
argv = prefix + [str(binary)] + workload["argv"] # Correctness and measurement are separate commands for run/call: the
# machine document (Observation snapshot) pins the full public contract,
# while timing copies the plain execution path so an opt-in observability
# contract is not compared against a summary document.
correctness_argv = prefix + [str(binary)] + workload["argv"]
measured_argv = prefix + [str(binary)] + (workload.get("measure_argv") or workload["argv"])
env = dict(os.environ) env = dict(os.environ)
env.pop("MARQDO_STDLIB_DIR", None) env.pop("MARQDO_STDLIB_DIR", None)
if not (binary.parent / "stdlib" / "stdlib.json").is_file(): if not (binary.parent / "stdlib" / "stdlib.json").is_file():
env["MARQDO_STDLIB_DIR"] = str(ROOT / "stdlib") env["MARQDO_STDLIB_DIR"] = str(ROOT / "stdlib")
env.setdefault("NO_COLOR", "1") env.setdefault("NO_COLOR", "1")
expected = load_expected(name) expected_document = load_expected(name)
expected = expected_document.get("wire_sha256") if expected_document else None
expected_measure = (
expected_document.get("measure_sha256") if expected_document else None
)
result = { result = {
"name": name, "name": name,
"kind": workload.get("kind", "run"), "kind": workload.get("kind", "run"),
"source": workload["source"], "source": workload["source"],
"argv": workload["argv"], "argv": workload["argv"],
} }
if workload.get("measure_argv"):
result["measure_argv"] = workload["measure_argv"]
correctness = "VERIFIED" correctness = "VERIFIED"
warmup_samples: list[dict] = [] warmup_samples: list[dict] = []
measured: list[dict] = [] measured: list[dict] = []
# Correctness is checked on every warmup execution; a wrong result is never measure_stdout: bytes | None = None
# timed and can never become a "fast" regression sample.
for index in range(warmups + samples): # One correctness preflight per workload: the machine document must match
code, usage, wall, stdout, stderr = spawn_capture( # the committed contract digest before anything is timed.
argv, ROOT, env, timeout code, _usage, _wall, stdout, stderr = spawn_capture(
) correctness_argv, ROOT, env, timeout
if code != 0: )
correctness = "CORRECTNESS_FAIL" if code != 0:
result["error"] = ( correctness = "CORRECTNESS_FAIL"
f"exit {code}: {stderr.decode('utf-8', 'replace')[:500]}" result["error"] = f"exit {code}: {stderr.decode('utf-8', 'replace')[:500]}"
) else:
break
try: try:
document = json.loads(stdout) document = json.loads(stdout)
except json.JSONDecodeError as error: except json.JSONDecodeError as error:
correctness = "CORRECTNESS_FAIL" correctness = "CORRECTNESS_FAIL"
result["error"] = f"invalid JSON: {error}" result["error"] = f"invalid JSON: {error}"
break document = None
digest = wire_digest(document) if document is not None:
if record: digest = wire_digest(document)
record_expected(name, document) if workload.get("measure_argv"):
expected = digest code, _usage, _wall, measure_stdout, stderr = spawn_capture(
if expected is None: measured_argv, ROOT, env, timeout
correctness = "UNVERIFIED_NO_EXPECTED" )
elif digest != expected: if code != 0:
correctness = "CORRECTNESS_FAIL" correctness = "CORRECTNESS_FAIL"
result["error"] = ( result["error"] = (
f"wire digest mismatch: expected {expected}, got {digest}" f"measurement probe exit {code}: "
f"{stderr.decode('utf-8', 'replace')[:500]}"
)
document = None
if record and document is not None:
record_expected(
name, document, measure_stdout, workload.get("measure_argv")
)
expected = digest
if measure_stdout is not None:
expected_measure = text_digest(measure_stdout)
if document is not None:
if expected is None:
correctness = "UNVERIFIED_NO_EXPECTED"
elif digest != expected:
correctness = "CORRECTNESS_FAIL"
result["error"] = (
f"wire digest mismatch: expected {expected}, got {digest}"
)
elif measure_stdout is not None:
probe = text_digest(measure_stdout)
if expected_measure is None:
correctness = "UNVERIFIED_NO_EXPECTED"
elif probe != expected_measure:
correctness = "CORRECTNESS_FAIL"
result["error"] = (
"measurement output mismatch: expected "
f"{expected_measure}, got {probe}"
)
# Timing loop: only a verified workload contributes samples, and every
# sample's output must match the committed measurement digest.
if correctness == "VERIFIED":
for index in range(warmups + samples):
code, usage, wall, stdout, stderr = spawn_capture(
measured_argv, ROOT, env, timeout
) )
break if code != 0:
sample = { correctness = "CORRECTNESS_FAIL"
"wall_ms": wall * 1000.0, result["error"] = (
"user_ms": usage["user_ms"], f"exit {code}: {stderr.decode('utf-8', 'replace')[:500]}"
"sys_ms": usage["sys_ms"], )
"max_rss_kb": usage["max_rss_kb"], break
} if expected_measure is not None and text_digest(stdout) != expected_measure:
if index < warmups: correctness = "CORRECTNESS_FAIL"
warmup_samples.append(sample) result["error"] = "measurement output changed between samples"
else: break
measured.append(sample) sample = {
"wall_ms": wall * 1000.0,
"user_ms": usage["user_ms"],
"sys_ms": usage["sys_ms"],
"max_rss_kb": usage["max_rss_kb"],
}
if index < warmups:
warmup_samples.append(sample)
else:
measured.append(sample)
result["correctness"] = correctness result["correctness"] = correctness
if correctness != "VERIFIED": if correctness != "VERIFIED":
+51 -8
View File
@@ -21,7 +21,15 @@
"数学.阶乘", "数学.阶乘",
"--arg", "--arg",
"n=5", "n=5",
"--json" "--output",
"json"
],
"measure_argv": [
"call",
"examples/factorial.mq.md",
"数学.阶乘",
"--arg",
"n=5"
] ]
}, },
{ {
@@ -31,7 +39,12 @@
"argv": [ "argv": [
"run", "run",
"tests/conformance/semantics/55-first-fit-free-list-allocator.mq.md", "tests/conformance/semantics/55-first-fit-free-list-allocator.mq.md",
"--json" "--output",
"json"
],
"measure_argv": [
"run",
"tests/conformance/semantics/55-first-fit-free-list-allocator.mq.md"
] ]
}, },
{ {
@@ -41,7 +54,12 @@
"argv": [ "argv": [
"run", "run",
"tests/conformance/semantics/62-json-array-parser.mq.md", "tests/conformance/semantics/62-json-array-parser.mq.md",
"--json" "--output",
"json"
],
"measure_argv": [
"run",
"tests/conformance/semantics/62-json-array-parser.mq.md"
] ]
}, },
{ {
@@ -51,7 +69,12 @@
"argv": [ "argv": [
"run", "run",
"tests/conformance/semantics/65-table-sort-stdlib.mq.md", "tests/conformance/semantics/65-table-sort-stdlib.mq.md",
"--json" "--output",
"json"
],
"measure_argv": [
"run",
"tests/conformance/semantics/65-table-sort-stdlib.mq.md"
] ]
}, },
{ {
@@ -61,7 +84,12 @@
"argv": [ "argv": [
"run", "run",
"tests/conformance/semantics/63-memory-bytecode-vm.mq.md", "tests/conformance/semantics/63-memory-bytecode-vm.mq.md",
"--json" "--output",
"json"
],
"measure_argv": [
"run",
"tests/conformance/semantics/63-memory-bytecode-vm.mq.md"
] ]
}, },
{ {
@@ -71,7 +99,12 @@
"argv": [ "argv": [
"run", "run",
"tests/conformance/semantics/70-matrix-multiply.mq.md", "tests/conformance/semantics/70-matrix-multiply.mq.md",
"--json" "--output",
"json"
],
"measure_argv": [
"run",
"tests/conformance/semantics/70-matrix-multiply.mq.md"
] ]
}, },
{ {
@@ -81,7 +114,12 @@
"argv": [ "argv": [
"run", "run",
"tests/conformance/semantics/71-http-parser.mq.md", "tests/conformance/semantics/71-http-parser.mq.md",
"--json" "--output",
"json"
],
"measure_argv": [
"run",
"tests/conformance/semantics/71-http-parser.mq.md"
] ]
}, },
{ {
@@ -91,7 +129,12 @@
"argv": [ "argv": [
"run", "run",
"stdlib/demo.mq.md", "stdlib/demo.mq.md",
"--json" "--output",
"json"
],
"measure_argv": [
"run",
"stdlib/demo.mq.md"
] ]
} }
] ]