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.
This commit is contained in:
cflmy committed 2026-11-24 20:57:13 +08:00
1 parent 682eae82b6
commit d11b261aca
19 files changed
+196 -117

No files matched your search

+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.
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`
(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`
+38 -42
View File
@@ -1,17 +1,17 @@
# Compatibility and support matrix
Snapshot: product version **`3.0.0-beta.1`** (prerelease), branch `master`,
tagged `v3.0.0-beta.1` at source SHA `2c7c4f31e7a388d3fcfa717a77067e696ed13854`. This file records what was actually verified and
separates it from what is only implemented. The supported release platform is
**Linux x86_64 (glibc)**; everything else is experimental and not claimed for
this beta. Executed status and same-SHA evidence are in
[`docs/STATUS.md`](docs/STATUS.md), and SHA-bound external evidence is under
[`docs/evidence/extension/`](docs/evidence/extension/README.md).
Snapshot: candidate product version **`3.0.0-rc.3`** (prerelease). The last
published prerelease is `3.0.0-rc.2` at source SHA
`9149ee40a48fcda692c5c112f66c465487d13dfb`. This file records what was
actually verified and separates it from what is only implemented. The
supported release platform is **Linux x86_64 (glibc 2.39)**; everything else is
experimental and not claimed for this prerelease. Executed status and
SHA-bound evidence are in [`docs/STATUS.md`](docs/STATUS.md) and under
[`docs/evidence/`](docs/evidence/extension/README.md).
The `3.0.0-rc.3` candidate targets Linux x86_64 on glibc 2.39 and
includes the post-beta changes below. See the
[RC acceptance procedure](docs/releasing.md). The platform evidence table
records the beta and subsequent development verification.
The `3.0.0-rc.3` candidate includes the post-beta protocol convergence below.
See the [RC acceptance procedure](docs/releasing.md). The platform evidence
table records the beta, rc.1/rc.2 and candidate verification.
## 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`. |
| 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
`(break)` or `(continue)`. Calls, bindings, fields and identifiers within
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,
remove the argument or keep it through an explicit `params(...)` declaration.
`marqdo-lint 0.1.0` reads legacy Analysis v2 documents. Its control layout
alignment for `else if` and its Analysis v3 support require an update in
that tool.
The current Analysis contract is `schema_version: 3` for every project, so an
external tool that still reads Analysis v2 must be updated before it can
consume this candidate's `check --emit` output.
## 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. |
| 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). |
| Analysis | v2/v3 | Projects with loop transfers emit v3. Other projects emit v2. Consumers reject unknown majors. |
| Trace | v2 | Binds to the exact Analysis bytes; unknown majors rejected. |
| 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 | v1 | Manifest schema, SemVer negotiation and whole-bundle digest are stable for v1. |
| Analysis | v3 | One writer and one current major for every project, including projects without loop transfers. Consumers reject other majors; the retired v2 selector, schema and documents are gone (ADR-0068). |
| Observation | v1 | One `run_id`/`seq` event sequence per execution, delivered as JSONL, JSON snapshot or file snapshot from the same run. Values are opt-in and bounded; consumers reject other identifiers (spec/observation.md). |
| 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. |
| 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). |
| 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`). |
| 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** |
| 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 |
| Analysis v2 / Trace v2 + Python consumers | PASS | 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 |
| Tool Protocol v1 + 3 independent consumers | PASS | UNVERIFIED | UNVERIFIED |
| Analysis v3 + Observation v1 + Python consumers | PASS (same-SHA CI contract lane and archive smoke; independent consumers) | UNVERIFIED | UNVERIFIED |
| CLI Tool revision 1 + independent consumers | PASS | UNVERIFIED | UNVERIFIED |
| Native ABI (`plugin inspect`, trusted call) | PASS (C fixture) | UNVERIFIED (host-native fixture) | **UNSUPPORTED** |
| Worker ABI + `fs.read` bridge | PASS (Unix) | UNVERIFIED | **UNSUPPORTED** (Unix-gated) |
| Foreign Python/Node | PASS (system `python3`/`node`) | UNVERIFIED | UNVERIFIED |
@@ -149,14 +147,15 @@ the Windows C ABI/provider paths remain fail-closed.
rlimits and wall-clock/output supervision; the child verifies `PID 1`,
`NoNewPrivs`, `CapEff=0`, a non-initial uid map and no non-loopback network.
- Refused before launch: `--allow-read`, `--allow-write`, `--allow-foreign`,
`--allow-plugin`, `--plugin`, `--trust-native-plugin`, `--kernel`,
`--trace-file`.
`--allow-plugin`, `--plugin`, `--trust-native-plugin`, `--kernel`;
`--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
not implemented and must not be inferred from L1 passing.
## 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
Foreign kernels; `git` for Git dependencies.
- `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
(`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
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
fixtures for the generic Tool protocol, not product features.
- 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;
the Windows lane is a Linux-hosted compile gate only.
produced for the 3.0 prerelease line. macOS/Windows native artifacts are not
claimed; the Windows lane is a Linux-hosted compile gate only.
## Release decision
**`3.0.0-beta.1` prerelease — approved as a Linux x86_64 beta with explicitly
recorded gaps.** The beta profile in
[`docs/MARQDO_3_0_PRERELEASE_PLAN.md`](docs/MARQDO_3_0_PRERELEASE_PLAN.md) §3.1
was used, not the stable profile: Linux is the only supported platform,
macOS/Windows are declared unsupported/experimental, G4 is a Beta-only `WARN`
on the fixed Woodpecker agent, and strict policy and frozen-binary conformance
are recorded with same-SHA evidence in [`docs/STATUS.md`](docs/STATUS.md) and
[`docs/evidence/ci/2c7c4f31e7a388d3fcfa717a77067e696ed13854/manifest.json`](docs/evidence/ci/2c7c4f31e7a388d3fcfa717a77067e696ed13854/manifest.json)
(`BETA_RELEASE_CANDIDATE`). Release:
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.0.0-rc.3` prerelease candidate — Linux x86_64 only.** The RC profile in
[`docs/MARQDO_3_0_PRERELEASE_PLAN.md`](docs/MARQDO_3_0_PRERELEASE_PLAN.md) §3 is
used, not the stable profile: Linux is the only supported platform,
macOS/Windows are declared UNSUPPORTED for this scope, strict L1 requires
same-SHA disposable-VM evidence and G4 performance is recorded as a
maintainer-approved shared-node `WARN` for this named RC. The aggregate decision
and per-gate evidence are bound to the candidate SHA in
[`docs/STATUS.md`](docs/STATUS.md) and the release assets. A prerelease does not
imply stable `3.0.0` or LTS; the stable gate remains stricter and separate.
+2 -2
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.
`run`/`call`/`check` never fetch or rewrite the lock.
* **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,
capability dropping, rlimits, a wall-clock supervisor and child
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
Bubblewrap supervisor only when its runtime probe passes; otherwise it exits
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
strict.
* **Native plugins run in-process** and require an explicit unsafe trust flag.
+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
/// 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 {
match place {
PlaceTarget::Local { name, .. } => Value::String(name.clone()),
+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
);
}
}
}
}
+1 -1
View File
@@ -3,7 +3,7 @@
//! The frontend resolves every statically visible call site exactly once and
//! 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
//! 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
//! serialized.
//!
+1 -1
View File
@@ -491,7 +491,7 @@ pub struct Program {
pub external_callables: Vec<callable::CallableDescriptor>,
/// 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
/// table; the runtime never re-resolves names.
#[serde(skip)]
+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` |
| 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` |
| 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` |
| `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` |
@@ -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` |
| 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` |
| 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` |
| 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` |
+2 -2
View File
@@ -18,7 +18,7 @@ their date.
```text
marqdo-cli/
├── Cargo.toml workspace (15 crates, resolver 2)
├── Cargo.toml workspace (16 crates, resolver 2)
├── AGENTS.md operator rules for contributors/agents
├── README.md user-facing quickstart and limits
├── docs/
@@ -209,7 +209,7 @@ counts, harness responsibilities and known observations.
## 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
`#![forbid(unsafe_code)]`); the ABI/loader crates contain the only
`unsafe` code and every block has a SAFETY comment explaining the contract.
+2 -1
View File
@@ -38,6 +38,7 @@ has opted into this disclosure. Program output and explicit returned values
can themselves contain sensitive data.
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
[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 |
|---|---|---|
| Product / CLI | `3.0.0-rc.2` | SemVer prerelease. See `CHANGELOG.md` for changes from the beta. |
| Analysis | v2 | New major for incompatible changes; consumers reject unknown majors. |
| Trace | v2 | New major for incompatible changes; binds to exact Analysis bytes. |
| Execution Events | v1 | One-line NDJSON stream; new major for incompatible required-field/ordering/redaction changes. Consumers reject unknown majors. |
| CLI Tool | v1 | Frozen manifest/negotiation/bundle contract for v1. |
| Product / CLI | `3.0.0-rc.3` (candidate) | SemVer prerelease. See `CHANGELOG.md` for changes from the beta. |
| Analysis | v3 | One writer and one current major for every project. New major for incompatible changes; consumers reject unknown majors. |
| Observation | v1 | One `run_id`/`seq` event sequence per execution; JSONL, JSON snapshot and file snapshot come from the same run. New major for incompatible required-field/ordering/redaction changes. |
| CLI Tool | revision 1 | Exact `requires.api_revision` plus optional exact `analysis`/`observation` integers; no version arrays or negotiation. |
| Plugin ABI | v1 (`1.0`) | Frozen C layout and version negotiation. |
| Foreign wire | v1 | One-shot request envelope. |
| 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. |
| Plugin/tool/example packages | their own | Independent SemVer. |
`project.marqdo` and a tool's `compatibility.marqdo` are **enforced product
ranges**. Prerelease cores require a prerelease range such as
`project.marqdo` is an **enforced product range**; a tool declares its exact
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.
## 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
OS sandboxes. `pure`/`project` are execution modes, not security boundaries.
Execution Events v1 is a live observation protocol: it is not a capability
grant, values are off by default, and `--mode strict` currently refuses
`--output jsonl` explicitly (no downgrade).
Observation v1 is a live observation protocol: it is not a capability grant,
values are off by default, and `--mode strict` refuses `--output jsonl` and
`--observation-file` explicitly (no downgrade).
## Language compatibility
+7 -7
View File
@@ -49,8 +49,8 @@ Even when available:
wire-incompatible kernels.
* **CLI tools**: a tool is an ordinary user-authorized executable and does
**not** inherit `pure`/`project`/`strict` guarantees from the documents it
reads. `MARQDO_BIN`, `MARQDO_TOOL_PROTOCOL`, `MARQDO_PROTOCOL_ANALYSIS` and
`MARQDO_PROTOCOL_TRACE` are the only helpers the CLI injects.
reads. `MARQDO_BIN` and `MARQDO_API_REVISION` are the only helpers the CLI
injects; version negotiation was removed.
* **Extension selection** (`marqdo.yaml.extensions`, lock v4) is never
authorization. `--allow-plugin`, `--allow-provider` and `--allow-foreign`
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
an untrusted Git URL does not make the code trustworthy.
## Execution Events v1
## Observation
* Implemented: live stdout/stderr chunks, lifecycle/terminal events, call
instance ids, branch/loop/effect events, explicit bounded value observation.
* Not implemented: memory region/budget metadata (OBS-06/P2), raw memory
content, breakpoints/stepping/time travel, and a bidirectional debug
protocol. Do not infer a debugger from this protocol.
* `--mode strict` currently rejects `--output jsonl` explicitly; there is no
silent fallback to `project`.
* `--mode strict` rejects `--output jsonl` and `--observation-file` before
launch; there is no silent fallback to `project`.
* The live lane is tested on Linux x86_64; macOS/Windows are unverified for
this option for this candidate.
* In-process native plugins are rejected in event mode
(`ext.event_stream_unsupported_native_plugin`) because they share the process
* In-process native plugins are rejected with an active machine destination
(`ext.observation_unsupported_native_plugin`) because they share the process
and can write the protocol fd directly; worker plugins remain usable.
* Observation lowers confidentiality when values are explicitly enabled. Text
needs a second opt-in; View/agents must not enable these flags by default.
+2 -2
View File
@@ -1,6 +1,6 @@
# 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
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,
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
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
deterministic. Stdout/stderr from host operations are separated: program
stdout and program stderr are captured separately, diagnostics/traces go to the
CLI stderr, and `--json` output never mixes with any program output. JSON
reports `stdout` and `stderr` as separate strings.
CLI stderr, and a machine destination never mixes program bytes with
diagnostics. The Observation contract commits program bytes as separate
`stdout.chunk` and `stderr.chunk` events.
## 8. Builtins v1
+1 -1
View File
@@ -296,4 +296,4 @@ security negatives.
remain authoritative and must not be skipped for a refactor.
- Forbidden in both phases: persistent Python/Node sessions, Notebook-cell
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 -3
View File
@@ -353,9 +353,12 @@ resolver.
## 7. JSON output
`check`, `inspect`, `run`, `call`, `plugin inspect`, `add`, `remove`, `lock`
and `sync` accept `--json` and print a single JSON object on stdout. Relevant
package shapes:
`check`, `inspect`, `plugin inspect`, `add`, `remove`, `lock` and `sync`
accept `--json` and print a single JSON object on stdout. `run` and `call` use
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":[...]}`
* `sync`: `{"command":"sync","success":true,"locked":<bool>,"packages":[...]}`
+3 -3
View File
@@ -240,9 +240,9 @@ Token lifecycle:
## 7. Error codes and exit codes
Manifest/CLI option failures exit 2; load/verification/spawn failures exit 1;
`permission.denied` exits 1. With `--json` the CLI emits exactly one JSON
document with a `code` (nested under `error.code` for these structured
errors).
`permission.denied` exits 1. With a machine destination the CLI publishes
exactly one terminal event: a `run.rejected` event whose `payload.error.code`
carries the same code.
| Code | Stage | Trigger |
|---|---|---|
+42 -33
View File
@@ -12,7 +12,7 @@ Normative implementation:
| Host dispatch and per-op checks | `crates/marqdo-host/src/host.rs` |
| Project-rooted filesystem | `crates/marqdo-host/src/fs.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 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` |
@@ -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". |
| `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:
@@ -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
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
observed by `inspect --platform` is a snapshot, not a permanent promise. The
runtime therefore re-probes before launching; a failure after a successful
probe is a refusal, never a fallback.
`--json` consumers must receive **exactly one** JSON document on stdout for
every outcome:
A strict run supports text output and one `--output json` Observation snapshot
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
bytes and exit code are forwarded unchanged;
* a control-plane failure (probe, supervisor spawn, namespace construction,
timeout, capture) produces one CLI error document
`{"command": ..., "success": false, "error": ..., "code": ...}`;
* output that is empty or is not exactly one JSON document is rejected as
`strict.child_invalid`; raw supervisor text is never forwarded as program
stdout.
The parent never executes project code. A control-plane failure (probe,
supervisor spawn, namespace construction, timeout, capture) prints the
diagnostic on stderr and, when a snapshot destination is active, finishes the
parent's snapshot as `incomplete` without a terminal event; an empty or invalid
child document is `strict.child_invalid` and raw supervisor text is never
forwarded as program stdout. Consumers treat an incomplete delivery as no
evidence about the final execution outcome.
The stable codes are `strict.probe_unavailable`, `strict.spawn_failed`,
`strict.namespace_failure`, `strict.timeout`, `strict.resource_limit`,
`strict.child_invalid`, `strict.identity_invalid` and
`strict.namespace_failure`, `strict.launch_failed`, `strict.timeout`,
`strict.resource_limit`, `strict.child_invalid`, `strict.identity_invalid` and
`strict.unsupported_grant` (ADR-0053). A marker alone never authorizes strict
execution: Linux verifies the namespace/privilege identity, and every other
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
hosts an in-process math kernel.
## 4. Effect tracing
## 4. Effect observation
`EffectTrace` records one entry per `Host::invoke` when enabled
(`--trace`, or implicitly `--json` for `run`/`call`). Entry fields:
An effect is one `effect` event in the current Observation contract
([`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
{"op":"print","module":"hello.mq.md","span":{"start":43,"end":57},
"duration_micros":3,"result":"ok"}
{"frame_id":"f1","operation":"print","result_code":"ok",
"module_id":"root:default::hello.mq.md","span":{"start":43,"end":57}}
```
* `op` is the stable `HostOp::name()` (`foreign.run`, `foreign.call`,
`fs.read`, `fs.write`, `plugin.invoke`, ...); `resource.request` traces the
operation name in its semantic metadata instead of a `HostOp` variant;
* `module` is the initiating module id; `span` is the call site when known;
* `result` is `"ok"` or the failure code (for example
* `operation` is the concrete host operation (`print`, `foreign.run`,
`fs.read`, `fs.write`, `plugin.invoke`, `resource.request`, ...); resource
operations report their concrete name (`fs.exists`, `fs.metadata`, ...);
* `module_id` is the initiating module; `span` is the call site when known;
* `result_code` is `"ok"` or the failure code (for example
`permission.denied`);
* argument values and file contents are **not** recorded, so ordinary secrets
do not leak into traces by design. Paths are also not recorded today.
* In text mode trace entries are printed to stderr (`trace: ...`); in JSON
mode they are a `trace` array next to separate program `stdout`/`stderr`
strings. Program output is always separate from diagnostics/trace, and
`stdio/stderr` never shares the `stdout` buffer.
do not leak into the observation by design. Paths are not recorded either.
* Program output is committed as `stdout.chunk`/`stderr.chunk` byte events and
never shares a buffer with diagnostics. An in-process native plugin is
refused in observation mode (`ext.observation_unsupported_native_plugin`)
because it can write directly to the inherited fds.
## 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).
7. Budgets do not cover all allocation paths (for example list/table growth
inside the interpreter is bounded only by fuel and memory).
8. `--json` run output includes the full program stdout string; that is the
program's own output, not a host secret, but it is embedded in the JSON
document consumers must parse.
8. An Observation snapshot contains the program's own stdout and stderr bytes
as base64 byte events. That is the program's output, not a host secret, but
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 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)`
(`crates/cli/src/commands.rs`), so CLI JSON consumers see the same typed
representation.
The `run.completed` event of the current Observation snapshot embeds
`"value": to_wire(outcome.value)` (`crates/cli/src/observation.rs`), so CLI
consumers see the same typed representation. A result containing a
non-transferable handle has a null value and names its type.
## 6. Compatibility rules