ext(00-08): RFC-EXT-0003 core/extension boundary, math detach and release stdlib

Implements issue #3 (RFC-EXT-0003) slices on the post-3.0.0-beta.1 tree.

PR-00/01/H-06: reproduce and fix sibling heading mode inheritance.
build_units now pops the current and same-or-higher-level headings from the
ancestor stack before deriving the inherited mode, so an unmarked heading can never
inherit the previous sibling. Covered by the units matrix, conformance fixtures
22/23, and black-box heading_inheritance through check --emit/run/call.

PR-02/H-08: the deterministic release archive now ships the complete verified
stdlib/ tree. package.py and smoke.py recompute the runtime tree/alias digests,
record them in RELEASE_INFO.json.stdlib, and fail on mismatch; smoke removes the
bundle and requires a fail-closed run. Release discovery no longer falls back to the
compile-time source tree (debug builds keep that development convenience).

PR-03/H-04: one marqdo_host::CORE_RESOURCE_KINDS registry is used by both the CLI
provider-manifest validator and every trusted host registration path; all six core
kinds are rejected as provider name or declared kind before registration.
H-03: docs/architecture/resource-operations.md records every reviewed
resource_request operation and architecture_boundaries pins the exact allowlist; new
domain operations are forbidden in core (ADR-0062).

PR-04/H-01: remove math.parse/eval/substitute/simplify/differentiate from
BUILTINS, HostOp, the runtime, the host kernel and the workspace
(crates/marqdo-math deleted). Formula stays inert; Int/Float arithmetic stays.
Math algorithms are a pure examples/math-library package plus an optional
examples/math-backend ABI plugin that requests the math.compute capability
(ADR-0061). Removed calls are static symbol.unknown; the math import namespace is
released again. Tests/examples/specs migrated; new math_library black-box test.

PR-05/06 Step A: ADR-0060 classifies @exec/@knowledge as the closed Core Modes
and specifies the Proposed metadata-only Heading Annotations v1 (target 3.1,
sem.invalid_mode_marker unchanged, Analysis v2 unchanged). ADR-0063 records the
foreign F-A retention and deferred F-B removal.

Docs/status/compatibility/changelog and the RFC-EXT-0003 evidence file are updated.
Full local gate: cargo fmt PASS, clippy -D warnings PASS, workspace tests 586
passed/0 failed/2 ignored, python tools/ci 28 passed.
This commit is contained in:
cflmy committed 2026-11-22 18:57:33 +08:00
1 parent 0fe5f42a62
commit a67f344b6b
88 files changed
+2633 -3503

No files matched your search

+77
View File
@@ -139,6 +139,83 @@ fixture test when `python3` + `jsonschema` are available (the Woodpecker test
lane installs `python3-jsonschema` and also runs the consumer against a real
`--event-stream jsonl` invocation).
## 0.6 Post-beta core/extension boundary — RFC-EXT-0003 (unreleased)
This section records work **after** the `v3.0.0-beta.1` tag. It is not part of the
tagged beta archive and no new tag or stable release has been created. Design
input: issue `#3` (RFC-EXT-0003). Frozen decisions: ADR-0060 (Core Modes /
Heading Annotations), ADR-0061 (math detach), ADR-0062 (`resource_request`
ownership / core resource kinds), ADR-0063 (foreign F-A). Executed evidence:
[`evidence/2026-11-22-rfc-ext-0003-core-hardcoding.md`](evidence/2026-11-22-rfc-ext-0003-core-hardcoding.md).
### 0.6.1 Implemented / fixed
- **H-06 sibling heading inheritance:** `build_units` now removes the current and
all same-or-higher-level headings from the ancestor stack before deriving the
inherited mode. An unmarked heading inherits the nearest **ancestor**, never the
previous sibling. Reproduced with the two audit documents first, then covered by
the `units` matrix, conformance fixtures 22/23 and black-box
`heading_inheritance` (`check --emit`, `run`, `call`).
- **H-08 release archive stdlib:** the deterministic archive now contains the
complete `stdlib/` tree; `RELEASE_INFO.json.stdlib` records name, version,
tree/alias digests, file count and file list. `package.py` and `smoke.py`
recompute both digests with the runtime algorithm and fail on mismatch; smoke
removes the bundle and requires a fail-closed run (no source fallback). Release
discovery only falls back to the compile-time source tree in debug builds.
- **H-04 core resource kinds:** `marqdo_host::CORE_RESOURCE_KINDS` is the single
registry used by the CLI manifest validator and every trusted host registration
path; all six core kinds are rejected as a provider name and as a declared kind
before registration.
- **H-01 math domain API removed (breaking):** the five `math.*` builtins,
`HostOp` variants, runtime arms and `crates/marqdo-math` are deleted. A call is a
static `symbol.unknown`; `Formula` stays inert. Math algorithms are a pure
`.mq.md` package (`examples/math-library/`) and an optional explicitly selected
ABI backend that requests the `math.compute` capability
(`examples/math-backend/`). The historical `math` import namespace is released.
`math.compute` stays a capability category, not a core solver.
- **H-03 `resource_request` ownership:** the reviewed operation table and policy
are in [`architecture/resource-operations.md`](architecture/resource-operations.md);
`architecture_boundaries::resource_request_operation_allowlist_is_reviewed` extracts
the literals and fails on an unreviewed operation. New domain operations are
forbidden in the core.
### 0.6.2 Proposed / deferred (not implemented, not claimed)
- **H-05/H-07/H-13 Heading Annotations v1:** `@exec`/`@knowledge` are frozen as
the only Core Modes and alone decide execution. A declarative, metadata-only
heading annotation layer is **Proposed** (ADR-0060,
[`spec/heading-annotations-v1.md`](../spec/heading-annotations-v1.md), target
`3.1.x`). This build still rejects an unknown `@foo` with
`sem.invalid_mode_marker`; no annotation manifest, `annotation.unknown`,
Analysis v3 or sidecar exists yet. Not advertised as available.
- **H-02/F-B foreign:** the one-shot permission-gated `foreign.run/call` and the
dynamic `KernelRegistry` remain the controlled OS-boundary primitive (F-A);
removal (F-B) needs a versioned generic process/worker capability and the same
security negatives. ADR-0063, [`spec/foreign.md`](../spec/foreign.md) §8.
- Still deferred: full Math CAS/solver, persistent Foreign sessions, notebook
execution, Analysis v3/sidecar, Windows/macOS native gates, strict L2.
### 0.6.3 Executed gate (Linux x86_64, Rust 1.100.0)
```text
cargo fmt --all -- --check PASS
cargo clippy --workspace --all-targets -- -D warnings PASS
cargo test --workspace --locked PASS: 586 passed, 0 failed, 2 ignored
python3 -m unittest discover -s tools/ci -p 'test_*.py' PASS: 28 passed
cargo test -p marqdo-cli --test heading_inheritance PASS: 4 passed
cargo test -p marqdo-cli --test math_library PASS: 2 passed
cargo test -p marqdo-host --test resource_streams PASS: 34 passed
cargo test -p marqdo-cli provider_manifest PASS: 9 passed
cargo test -p marqdo-cli --test conformance_semantics PASS: 22/23/74/75 goldens
```
The archive/stdlib digests, cold-install smoke, independent `ubuntu:24.04`
container and external frozen-binary conformance are executed on the implementation
commit and recorded with exact hashes in
[`evidence/2026-11-22-rfc-ext-0003-core-hardcoding.md`](evidence/2026-11-22-rfc-ext-0003-core-hardcoding.md)
§5–§7. This is local evidence, not a same-SHA CI pipeline or a tagged release;
platform claim remains Linux x86_64.
## 1. Historical: pre-beta remote baseline and evidence
> **Historical record.** Everything in §1 onward was executed before the
@@ -0,0 +1,74 @@
# ADR-0060: Heading modes are core; heading annotations are declarative metadata
Status: Accepted (RFC-EXT-0003 H-05/H-07/H-13, post-`3.0.0-beta.1`).
Implementation status: **core-mode classification is implemented and tested;
Heading Annotations v1 is Proposed and not implemented in this build** (targeted
at `3.1.x`). This ADR does not itself make annotations available.
Related: RFC-LANG-0002, ADR-0052, [`spec/mapping.md`](../../spec/mapping.md),
[`spec/heading-annotations-v1.md`](../../spec/heading-annotations-v1.md).
## Context
`@exec`/`@knowledge` look like decorators, which invites the idea that a plugin
could redefine them, or add `@agent`/`@test` decorators that change whether a
section executes. That would make the same document executable in one installation
and inert in another, break `check` ↔ `run` binding equality, and let third-party
code affect capability and safety. At the same time, tools genuinely need
non-executable heading metadata (test selection, View folding, proof
obligations).
The current parser (`crates/marqdo-frontend/src/units.rs::heading_declaration`)
already treats a heading's first plain `Text` prefix as a closed mode token and
rejects any other leading `@foo` with `sem.invalid_mode_marker`
(`tests/negative/01-invalid-mode-marker-case.expected.json`). Analysis v2
`units[]` projects only `id/kind/name/level/span/function`; a `section`,
`knowledge` or `namespace` unit does not carry its effective mode or annotation
source.
## Decision
1. **Two layers, one executor.**
- **Core Mode** is the closed set `{@exec, @knowledge}`. It alone decides
whether a heading is callable/executable. Unmarked headings inherit the
nearest ancestor mode (see `spec/mapping.md` §1.2, including the H-06
bugfix). There is no third executable mode and no plugin-defined mode.
- **Heading Annotations** are an open, declarative, metadata-only extension
layer. They never decide execution.
2. **Annotation syntax v1** (Proposed): an ATX heading's first plain `Text` prefix
may contain at most one core mode followed by zero or more
`@namespace.identifier` annotations, then the semantic title. No parameters in
v1; annotations do not inherit; `semantic_name`/`FunctionId`/anchors are derived
only from the core mode + normalized title. A malformed/unknown annotation is a
static error (`annotation.unknown` or `annotation.malformed`), not silently
plain prose; ordinary body text may discuss `@foo`, and a heading-only spelling
escape is part of the proposal.
3. **No authority.** An annotation may not add/remove callability, rewrite the AST
or IR, reorder statements, change budgets, grant a capability, load native code
or change an already-bound CallBinding. The runtime ignores annotations.
4. **Registration is data, not parse-time code.** Allowed annotations come from
explicitly declared, version-pinned project/dependency resources (a static
manifest referenced from `marqdo.yaml`), bound to project/lock identity and
digest. Duplicate ownership, conflicting names, unknown versions and digest
mismatches fail at `check` without executing anything.
5. **Analysis projection is versioned.** Do **not** silently add
`effective_mode`, `mode_origin` or `annotations` to Analysis v2 `units[]`.
Use a new Analysis v3 or a separate `heading-annotations.v1` sidecar carrying
unit id, effective core mode, explicit/inherited origin, annotations, source
module/span, function/unit id, and manifest owner/digest. Existing
Analysis v2 consumers continue to validate unchanged.
6. **Step split.** Step A (accepted here) is this contract + parser test design +
identity/schema prototype; Step B (3.1) implements descriptor loading, index,
conflict checks, the sidecar/v3 projection and independent consumers. Until Step B
ships, docs/STATUS must say Proposed/not implemented.
## Consequences
- Core-mode behaviour (`@exec`/`@knowledge` + ancestor inheritance) is stable and
cannot be overridden by installed tools; the H-06 fix changes only the buggy
sibling case.
- Tool authors get a safe metadata channel without a plugin parse hook; the runtime
never needs to know tool names.
- Analysis v2 stays byte-compatible; new metadata needs a versioned sidecar/v3 and an
independent black-box consumer before it can be claimed.
- `check` and `run` still agree on every call site regardless of which tools are
installed.
@@ -0,0 +1,64 @@
# ADR-0061: Detach the domain math kernel from the core
Status: Accepted (post-`3.0.0-beta.1`, RFC-EXT-0003 H-01/H-10/H-11).
Related: RFC-LANG-0002, ADR-0025, ADR-0032, ADR-0052, ADR-0062.
This ADR is an intentional **prerelease incompatibility**; it does not promise
zero-cost migration for `3.0.0-beta.1` users.
## Context
The core exposed five domain functions as first-class builtins:
- `math.parse`, `math.eval`, `math.substitute` over an exact-rational subset;
- `math.simplify`, `math.differentiate` declared but returning
`math.unsupported`.
They required a core crate (`crates/marqdo-math`) in the host dependency graph,
reserved the `math` import namespace forever, made the `HostOp` enum grow with a
domain, and were not a complete CAS. Every new math algorithm would either grow
the core or be blocked by the reserved namespace. The beta audit (H-01, T-MATH-05/06)
recorded this as unintended domain ownership.
## Decision
1. **Remove the API from the core surface.** Delete the five `Builtin` entries,
the five `HostOp` variants, their dispatch/runtime arms, the reserved
`math` namespace as a builtin, and the `marqdo-math` workspace crate. A call
to `math.parse/eval/substitute/simplify/differentiate` is a static
`symbol.unknown`; there is no `math.unsupported` runtime fallback and no old
compatibility parser.
2. **Keep only language primitives.** `Int`/`Float` literals, ordinary
arithmetic/comparison/control flow, and the inert Markdown `Formula` value
(a `$$...$$` block referenced with `ref("#anchor")`) stay in the core. The
core never evaluates a `Formula`.
3. **Algorithms move out.**
- Preferred: a pure `.mq.md` package exposing ordinary Exec H2 functions
(`examples/math-library/` shows gcd + a consumer importing it as `math` now
that the namespace is released).
- Hot path / external data: an explicitly selected Plugin ABI v1 backend that
requests the `math.compute` capability (`examples/math-backend/`). Selection
is not authorization: native needs `--trust-native-plugin` and every plugin
needs `--allow-plugin NAME`; without the grant it is `permission.denied`.
4. **`math.compute` stays.** `CORE_CAPABILITIES` may continue to name
`math.compute` as a capability **category** requested by an ABI compute
backend. It is not a promise that the core ships a solver, parser or evaluator,
and pure language arithmetic never requires it.
5. **One binding, no fallback.** `check`, `run` and `call` see the same static
result for a removed name. New math functions require neither `BUILTINS`,
`HostOp`, `Host`, `Value`, `resource_request` nor a CLI rebuild.
## Consequences
- Beta users of `math.*` must migrate; `CHANGELOG`/`spec/math.md` carry the
removed-name list, the `symbol.unknown` behaviour and a pure-package example.
- A `math` import alias is accepted again because no builtin namespace reserves it;
`ext.import_namespace_conflict` no longer fires for `math`.
- The host no longer links `marqdo-math`; `cargo tree -p marqdo-host`/`-p marqdo-cli`
contain no math crate. An architecture gate
(`architecture_boundaries.rs`) fails if the crate or `HostOp::Math*` returns.
- The exact-rational engine is deleted rather than kept as dead core code. External
libraries own their numeric contracts; API and precision are their responsibility.
- No Analysis v2, Trace v2, Value wire or capability wire version changes: only a
builtin/HostOp surface and one crate are removed, and the static error code is
the existing `symbol.unknown`.
- No OS sandbox, performance or CAS claim is made.
@@ -0,0 +1,62 @@
# ADR-0062: Resource-operation ownership and core resource kinds
Status: Accepted (post-`3.0.0-beta.1`, RFC-EXT-0003 H-03 / H-04).
Supersedes nothing; refines ADR-0025, ADR-0033, ADR-0041–0050 and
[`spec/resource-provider-v2.md`](../../spec/resource-provider-v2.md).
## Context
`Host::resource_request` had grown a mixed catalogue: operating-system
primitives (`process.run`, `fs.*`, `env.get`, `clock.now`, `random.bytes`) next to
convenience services implemented inside the host (`regex.*`, `compress.*`).
Nothing recorded which entries were intentional core surface and which were domain
convenience that should become external extensions. Separately, six resource kinds
were reserved by `spec/resource-provider-v2.md`, but the trusted host registration
path only rejected `stdio` and `file`; only the CLI manifest validator had the full
list. A host caller (`register_resource_provider`, `register_c_resource_provider`,
`register_worker_resource_provider`, `register_provider_package`) could therefore
register a provider named `tcp` or declaring `tls` and shadow core dispatch.
## Decision
### 1. One core resource-kind registry
`marqdo_host::CORE_RESOURCE_KINDS` is the single source of truth:
`stdio`, `file`, `tcp`, `tls`, `udp`, `tcp-listener`. Both the CLI provider
manifest validator and every host registration path use it. A provider whose `name`
is a core kind, or which declares a core kind, is rejected before it enters the
resource table with `ResourceUnsupported` (CLI: `ext.manifest_invalid`). A change
to the list requires this ADR and the spec to change with it.
### 2. Two operation classes
`resource_request` is closed over the following reviewed operations:
| Class | Operations | Owner |
|---|---|---|
| Core OS primitive | `process.run`, `env.get`, `clock.now`, `random.bytes`, `fs.read_at`, `fs.append`, `fs.walk`, `fs.exists`, `fs.metadata`, `fs.list`, `fs.mkdir`, `fs.remove`, `fs.rename` | host / OS |
| Host-held built-in service | `regex.match`, `regex.captures`, `compress.gzip`, `compress.gunzip` | host library, existing grants |
`regex.*` and `compress.*` are existing host-held services with their own
ADRs; they are not a precedent for adding more domain functions to the host.
Project mode and the corresponding capability grant are required for every entry.
### 3. Extension boundary rule
New business or domain operations **must not** be added to `resource_request`.
A domain function belongs in a pure `.mq.md` package, a Callable Plugin ABI
backend, or a Resource Provider — selected and authorized through the normal
extension path. Adding an operation to the core table requires a new accepted ADR and
an update to [`docs/architecture/resource-operations.md`](../architecture/resource-operations.md),
`spec/resource-provider-v2.md` and the architecture gate
`crates/cli/tests/architecture_boundaries.rs`.
## Consequences
- A host-side provider can no longer shadow a core kind even when it did not pass
through the CLI validator; the CLI and host fail with consistent wording.
- The reviewed operation list is executable evidence: the architecture test extracts
the literals from `resource_request` and fails on unrecorded additions.
- `regex.*` / `compress.*` keep working unchanged; moving them out is a separate
ADR and is not implied by this one.
- No CLI flag, language keyword, wire version or Analysis/Trace schema changes.
@@ -0,0 +1,56 @@
# ADR-0063: Foreign kernel transition — retain F-A, defer F-B
Status: Accepted (RFC-EXT-0003 H-02/H-12, post-`3.0.0-beta.1`).
Related: ADR-0020, ADR-0044, ADR-0062, [`spec/foreign.md`](../../spec/foreign.md).
## Context
The core exposes permission-gated one-shot `foreign.run`/`foreign.call` plus a
`KernelRegistry` whose default descriptors are Python/Node but which already
accepts dynamically registered languages. The audit (H-02) observed that:
`foreign.*` is a controlled **OS process boundary**, not a domain function; the
high-level batching/validation/orchestration around it should be a `.mq.md` package;
and removing the primitive before a generic process/stream capability exists would
push OS behaviour into an unregulated worker without improving safety.
Two legitimate but conflicting goals: "the frontend/runtime should not know each
external language API" (already true — registration is dynamic) versus "Foreign must
disappear from the core to count as decoupled" (not automatically true — some layer
must own the real OS process/IO boundary).
## Decision
**F-A (current, retained):** keep the existing permission-gated one-shot
`foreign.run`/`foreign.call` and the dynamic `KernelRegistry` as the controlled
OS-boundary primitive.
- No new language-specific `Builtin`, `HostOp` or runtime branch may be added.
New languages register through `KernelRegistry::register`; Python/Node are only
default descriptors, not the only extension channel.
- High-level orchestration (sequencing, batching, validation, error normalization)
belongs in `.mq.md` packages, not in the host.
- Grants, digest/target checks, timeout, output caps, typed wire and environment
binding stay exactly as `spec/foreign.md` specifies; the security negatives are
not weakened by this ADR. Without `--allow-foreign` the call is
`permission.denied`; `pure`/`strict` fail closed.
**F-B (deferred, needs its own ADR + release):** removing `foreign.*` from the
core requires first a versioned generic Process/Worker capability contract with at
least: program/argv, controlled stdio, isolation level, timeout and process-tree
reaping, output budget, environment identity, lifecycle and cancellation
semantics. It must demonstrate frozen-binary behavioural equivalence and keep the
same permission, digest, timeout, wire and output-limit negatives. Until then the
core keeps the primitive and we do not claim it was removed.
**Forbidden in both phases:** persistent Python/Node sessions, Notebook-cell
execution, `@python`-style heading auto-execution, and a second foreign runtime
inside View; streaming stays in Execution Events, not a second network protocol.
## Consequences
- The core is honest: it owns a controlled foreign primitive and documents it.
- Adding a new language needs zero Rust/core changes (T-FOREIGN-01 remains the
acceptance test); the default descriptor table may later become a verified static
config, but that is not required to decouple domains.
- F-B stays open and tracked; docs/STATUS records it as deferred rather than as
implemented.
+13 -1
View File
@@ -46,4 +46,16 @@ Files: `0001`–`0050`, plus:
print magic;
* `0059-runtime-observability-and-execution-events.md` — typed host
observation facade, Execution Events v1 JSONL boundary, frame identity and
selected-value policy.
selected-value policy;
* `0060-heading-modes-and-extensible-annotations.md` — `@exec`/`@knowledge`
are the closed Core Modes; metadata-only Heading Annotations v1 is Proposed
(target 3.1), Analysis v2 unchanged;
* `0061-detach-domain-math-kernel-from-core.md` — remove `math.*` builtins,
`HostOp` variants and `marqdo-math`; pure package + optional ABI backend take
over; `Formula`/`math.compute` boundaries;
* `0062-resource-operation-ownership-and-core-kinds.md` — single
`CORE_RESOURCE_KINDS` registry, two `resource_request` operation classes and
the reviewed architecture gate;
* `0063-foreign-kernel-transition-fa.md` — retain the permission-gated one-shot
foreign primitive as F-A; F-B removal requires a versioned generic
process/worker capability.
+22 -5
View File
@@ -34,6 +34,18 @@ replace `spec/` or a recorded test log.
> Trace v2 are unchanged. This is locally tested on the post-baseline tree
> ([`../STATUS.md`](../STATUS.md) §0.5) and is not part of the tagged beta
> archive or its same-SHA evidence.
>
> **Post-baseline core/extension boundary (RFC-EXT-0003, ADR-0060–0063).** The
> core call surface no longer owns the domain math kernel (`math.*` removed;
> `crates/marqdo-math` deleted; ADR-0061), sibling heading mode inheritance is
> fixed (H-06), the release archive must ship the verified `stdlib/` (H-08), one
> `CORE_RESOURCE_KINDS` registry guards every provider registration path
> (H-04), `resource_request` operation ownership is enforced by an architecture
> gate (H-03), and the foreign one-shot primitive is explicitly retained as F-A
> (ADR-0063). Heading Annotations v1 is **Proposed/not implemented** (ADR-0060,
> target `3.1.x`) and must not be documented as available. Executed evidence:
> [`../STATUS.md`](../STATUS.md) §0.6 and
> [`../evidence/2026-11-22-rfc-ext-0003-core-hardcoding.md`](../evidence/2026-11-22-rfc-ext-0003-core-hardcoding.md).
## 1. Four state dimensions
@@ -43,8 +55,8 @@ platform".
| Dimension | Current state | Source |
|---|---|---|
| Implemented | Rust workspace `3.0.0-beta.1`: RFC-LANG-0002 Markdown/frontend/IR, v2 statement parser, tree-walk runtime, `Memory`, capability host, Tool/Analysis/Trace, Plugin ABI, Foreign kernels, migrated bundled stdlib, CLI composition root; post-baseline Execution Events v1 observation (ADR-0059) | `Cargo.toml`, `crates/`, `stdlib/` |
| Tested locally | `cargo test --workspace --locked`: **630 passed, 0 failed, 2 ignored** on the post-baseline observability tree (Linux x86_64); `cargo fmt --check` and `clippy -D warnings` clean. Historical baseline: 599 passed before Execution Events v1, 507 at `9c1723d`. | `docs/STATUS.md` §0.5, `docs/evidence/2026-11-22-ext-implementation.md` |
| Implemented | Rust workspace `3.0.0-beta.1`: RFC-LANG-0002 Markdown/frontend/IR, v2 statement parser, tree-walk runtime, `Memory`, capability host, Tool/Analysis/Trace, Plugin ABI, Foreign kernels, migrated bundled stdlib, CLI composition root; post-baseline Execution Events v1 (ADR-0059), core/extension boundary RFC-EXT-0003 (ADR-0060–0063: math domain API removed, one core resource-kind registry, reviewed `resource_request`, F-A foreign retained), heading annotations only **Proposed** | `Cargo.toml`, `crates/`, `stdlib/` |
| Tested locally | `cargo test --workspace --locked`, `cargo fmt --all -- --check`, `clippy -D warnings`, release archive smoke and an independent `ubuntu:24.04` cold-install run on the RFC-EXT-0003 tree (Linux x86_64); exact counts and logs are in `docs/STATUS.md` §0.6 and the RFC-EXT-0003 evidence file. Historical baselines stay in earlier sections. | `docs/STATUS.md` §0.6, `docs/evidence/2026-11-22-rfc-ext-0003-core-hardcoding.md` |
| Bundled stdlib released | In-repo bundle `marqdo-stdlib@0.1.0`, SHA-256 digest verified before loading; it is **not** an external registry package | `stdlib/stdlib.json`, `stdlib/README.md` |
| Multi-platform verified | Linux local gate is the only executed lane here; Windows/macOS native lanes are **UNVERIFIED**, and the GitHub security lane remains a **VM-only** gate | `docs/STATUS.md` §1, §4 |
@@ -54,9 +66,10 @@ platform".
user .mq.md programs / agents / research workflows
|
stdlib/*.mq.md (versioned and digest-checked in this repository)
core / collections / text / encoding / data / math
core / collections / text / encoding / data
io / console / stream / fs / net / process
memory / alloc + portable pure algorithms
(math algorithms are external: examples/math-library + ABI backend)
|
language semantics: Markdown -> AST -> frontend -> IR
|
@@ -107,7 +120,7 @@ Current Rust dependency edges (documented, not proposed):
marqdo-cli -> marqdo-runtime -> marqdo-host
marqdo-cli -> marqdo-package, marqdo-sandbox, marqdo-frontend, ...
marqdo-runtime -> marqdo-ir, marqdo-expression, marqdo-value
marqdo-host -> marqdo-plugin-abi, marqdo-foreign, marqdo-sandbox, marqdo-math
marqdo-host -> marqdo-plugin-abi, marqdo-foreign, marqdo-sandbox
```
`marqdo-runtime -> marqdo-host` is the current direction. Do not add a second
@@ -124,7 +137,11 @@ review RFC, not a new crate per provider.
| project file read | `resource.open("file", path, ["read"])`; path/grant checked; bounded | implemented, project mode | `resource_streams`, `stdlib_product` |
| project file write | `resource.open("file", path, ["write"])`; buffers until `close`, never flush-on-drop | implemented, project mode | `resource_streams`, `stdlib_product` |
| `std:fs/file` | `读文本/写文本/复制文件/存在/元数据/列出目录/创建目录/删除/重命名/追加文本/读取片段/遍历` over `resource.*`; bounded at 8 MiB | implemented; no watch/binary offset read | `stdlib_product` |
| `resource.request` | `resource.request("fs.exists|metadata|list|mkdir|remove|rename", paths)`; project mode, grant-checked, recoverable fs Result | implemented `fs.*`; no seek/append/watch | `resource_streams`, `stdlib_product` |
| `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` |
| 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` |
| `std:path` | `path.连接/文件名/目录名/扩展名/规范/是否绝对`; lexical only | implemented (no I/O) | `stdlib_product` |
+5
View File
@@ -24,6 +24,7 @@ input and evidence. It is not a second running-status page.
| [Runtime observability RFC-OBS-0001](RFC-OBS-0001-runtime-observability.md) | **Adopted and implemented (P0/P1)** | Typed host observation, Execution Events v1 NDJSON, frame identity, selected bounded values; P2 memory metadata remains deferred. |
| [Compute machine RFC-0001](../MARQDO_COMPUTE_MACHINE_RFC_0001.md) | **Proposed** | Opaque `Memory`, addressable regions, wire/host rejection. Compute semantics are unchanged by the syntax rewrite; its `.mq.md` examples are historical spelling. |
| [Core and stdlib migration RFC-0002](../MARQDO_COMPUTE_CORE_STDLIB_MIGRATION_RFC_0002.md) | **Proposed** | Minimum core, `.mq.md` stdlib and system-capability migration. The stdlib source migration is complete; current status is recorded in ../STATUS.md. |
| RFC-EXT-0003 core/extension boundary (issue #3) | **Adopted slices in ADR-0060–0063** | H-01/H-03/H-04/H-05/H-06/H-07/H-08/H-02 decisions; heading annotations are Step A (Proposed), foreign F-B deferred. See [`resource-operations.md`](resource-operations.md) and `spec/heading-annotations-v1.md`. |
The implemented first slices of these RFCs are recorded in `CURRENT.md` and
`../STATUS.md`; the RFC text itself never proves that code exists.
@@ -67,6 +68,10 @@ The implemented first slices of these RFCs are recorded in `CURRENT.md` and
| Host regex extension | [0050](../adr/0050-host-regex-extension.md) | Accepted (project-mode groups/alternation/captures) |
| Byte-exact HTTP framing | [0051](../adr/0051-byte-exact-http-framing.md) | Accepted (byte-list HTTP/1.1) |
| Runtime observability / Execution Events v1 | [0059](../adr/0059-runtime-observability-and-execution-events.md) | Accepted and implemented (P0/P1); memory metadata P2 deferred |
| Core modes and heading annotations | [0060](../adr/0060-heading-modes-and-extensible-annotations.md) | Core modes implemented; Heading Annotations v1 **Proposed/not implemented** (target 3.1) |
| Detach domain math kernel | [0061](../adr/0061-detach-domain-math-kernel-from-core.md) | Accepted and implemented; `math.*` removed, pure package + ABI backend |
| Resource operations and core kinds | [0062](../adr/0062-resource-operation-ownership-and-core-kinds.md) | Accepted and implemented; architecture gate pins the reviewed lists |
| Foreign F-A transition | [0063](../adr/0063-foreign-kernel-transition-fa.md) | Accepted: retained F-A primitive; F-B deferred |
| Table physical storage (T1/T2/T3), strict stdin/stderr/file/network resources | — | **Not decided**; do not implement by implication |
## Evidence and status
+55
View File
@@ -0,0 +1,55 @@
# Core resource-operation ownership
Status: **reviewed and enforced** (ADR-0062, RFC-EXT-0003 H-03/H-04).
This page is the ownership record for every operation reachable through
`Host::resource_request`. Adding an entry here is a product decision, not an
implementation detail; the architecture gate
`crates/cli/tests/architecture_boundaries.rs::resource_request_operation_allowlist_is_reviewed`
extracts the literals from the host source and fails on any unreviewed change.
## Dispatch rules
- Every operation requires `SandboxMode::Project`; `pure` and `strict` refuse all
resource operations with `PermissionDenied`.
- `Memory`/resource handles never cross this API; path arguments are `Text`.
- Operation-level grants are checked before any host action (`check_process`,
`check_read`, `check_write`, `check_entropy`, `check_env`, network grants).
- The `fs.*` family is the only prefix-dispatched group; its sub-operations are
listed explicitly below.
## Reviewed operation table
| Operation | Class | Owner / implementation | Authorization | Evidence |
|---|---|---|---|---|
| `process.run` | Core OS primitive | `crate::process::run_process` | exact program grant (`--allow-program`) | ADR-0044; `crates/marqdo-host/tests/resource_streams.rs` |
| `env.get` | Core OS primitive | host environment | exact-name env grant | ADR-0043 |
| `clock.now` | Core OS primitive | `SystemTime` | project mode | ADR-0042 |
| `random.bytes` | Core OS primitive | OS entropy | explicit entropy grant (`--allow-random`) | ADR-0046 |
| `fs.read_at` | Core OS primitive | `ProjectFs::request("read_at")` | read grant | ADR-0045 |
| `fs.append` | Core OS primitive | `ProjectFs::request("append")` | write grant | ADR-0045 |
| `fs.walk` | Core OS primitive | `ProjectFs::request("walk")` | read grant | ADR-0045 |
| `fs.exists` | Core OS primitive | `ProjectFs::request("exists")` | read grant | ADR-0041 |
| `fs.metadata` | Core OS primitive | `ProjectFs::request("metadata")` | read grant | ADR-0041 |
| `fs.list` | Core OS primitive | `ProjectFs::request("list")` | read grant | ADR-0041 |
| `fs.mkdir` | Core OS primitive | `ProjectFs::request("mkdir")` | write grant | ADR-0041 |
| `fs.remove` | Core OS primitive | `ProjectFs::request("remove")` | write grant | ADR-0041 |
| `fs.rename` | Core OS primitive | `ProjectFs::request("rename")` | write grant on both paths | ADR-0041 |
| `regex.match` | Host-held built-in service | host regex library | project mode | ADR-0050 |
| `regex.captures` | Host-held built-in service | host regex library | project mode | ADR-0050 |
| `compress.gzip` | Host-held built-in service | host gzip library | project mode | ADR-0049 |
| `compress.gunzip` | Host-held built-in service | host gzip library | project mode | ADR-0049 |
`regex.*` and `compress.*` are existing host-held convenience services. They
do not create a general extension mechanism: no new domain operation may follow
them into the core.
## Forbidden additions
- No domain/business operation (math, text, graphics, networking protocol,
database, …) may be added to `resource_request`. Ship it as a pure `.mq.md`
package, a Callable Plugin ABI export, or a Resource Provider.
- No new language keyword, builtin name or CLI flag is added by this table.
- No provider may use or declare a core kind: the single list lives in
`marqdo_host::CORE_RESOURCE_KINDS` and is enforced by both the CLI validator
and trusted host registration.
- The removed `math.*` builtins (ADR-0061) are not coming back through this API.
+7 -10
View File
@@ -45,7 +45,7 @@ marqdo-cli/
│ ├── security.md modes, capabilities, budgets, trust
│ ├── package-format.md marqdo.yaml / marqdo.lock / init
│ ├── plugin-abi.md C ABI v1, SDK, host lifecycle
│ ├── math.md Formula subset and math.* semantics
│ ├── math.md removed core math outlook + migration (ADR-0061)
│ ├── foreign.md Python/Node kernel protocol
│ ├── tool-v1.md generic external Tool Protocol v1
│ ├── analysis-v2.md public Analysis v2 projection (v1 historical)
@@ -58,12 +58,11 @@ marqdo-cli/
│ ├── marqdo-markdown/ comrak profile, canonical AST, front matter
│ ├── marqdo-ir/ Module/Unit/Function/Stmt IR, builtin table
│ ├── marqdo-frontend/ units/modes, map, payloads, signature, infer, calls
│ ├── marqdo-math/ Formula parser/evaluator (exact rationals)
│ ├── marqdo-foreign/ Python/Node one-shot kernel supervisor
│ ├── marqdo-sandbox/ modes + platform capability detection
│ ├── marqdo-plugin-abi/ C ABI mirrors, manifest, artifact, loader, wire
│ ├── marqdo-plugin-sdk/ Rust plugin SDK and `mq_plugin_entry!`
│ ├── marqdo-host/ CapabilityHost, budgets, FS, math/foreign/plugin adapters
│ ├── marqdo-host/ CapabilityHost, budgets, FS, foreign/plugin adapters, core resource kinds
│ ├── marqdo-runtime/ tree-walk interpreter, value ops, builtins
│ ├── marqdo-package/ marqdo.yaml / marqdo.lock types + discovery
│ └── cli/ composition root: flags, commands, loader, output
@@ -88,9 +87,8 @@ expression -> span
markdown -> span, comrak (no semantic crate!)
ir -> span, expression
frontend -> markdown, expression, ir, value
host -> value, math, foreign, sandbox
host -> value, foreign, sandbox
runtime -> ir, value, host, expression
math -> value
foreign -> value
plugin-abi -> value
plugin-sdk -> plugin-abi
@@ -209,8 +207,8 @@ counts, harness responsibilities and known observations.
## 5. Coding conventions
* Rust edition 2021, `rust-version = 1.82`, workspace version `0.1.0`.
* `unsafe` is forbidden in pure crates (`marqdo-math`, `marqdo-expression` use
* Rust edition 2021, `rust-version = 1.82`, workspace version `3.0.0-beta.1`.
* `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.
* No panics on untrusted input: Markdown, expressions, LaTeX, wire data,
@@ -261,7 +259,6 @@ Harness map (`crates/cli/tests/`):
Crate-level tests worth knowing:
* `marqdo-expression` — grammar/priority/nesting/limit tests;
* `marqdo-math/tests/kernel.rs` — exact arithmetic, bounds, equations, unsupported constructs;
* `marqdo-foreign/tests/kernels.rs` — real python3/node (skips if absent), timeout, output caps, env, wire protocol;
* `marqdo-plugin-abi/tests/loader_unix.rs` — compiles the C demo with `cc`, loads it, ABI-mismatch/negative cases (skips without `cc`);
* `marqdo-runtime/tests/interpreter.rs` — recursion, loops, returns, budgets, ambiguity;
@@ -281,8 +278,8 @@ $B call examples/factorial.mq.md 数学.阶乘 --arg n=5 # prints 120
$B check examples/references.mq.md
$B inspect examples/references.mq.md --refs
$B inspect examples/hello.mq.md --ast --json
$B run examples/math.mq.md # has no main: use call
$B call examples/math.mq.md 数学.计算圆面积
$B call examples/math.mq.md 数学.计算圆面积 # pure arithmetic, no math.* builtin
$B call examples/math-library-demo.mq.md main # imports a pure math library
$B run examples/python-foreign.mq.md --allow-foreign # needs python3
$B run examples/multi-module/index.mq.md
(cd examples/multi-module && ../../$B lock && ../../$B sync --locked)
+29
View File
@@ -163,3 +163,32 @@ Your external repository must pass with an unchanged CLI binary:
The reference suite is
[`marqdo-extension-conformance`](https://git.cflmy.cn/cflmy/marqdo-extension-conformance);
the core's evidence generator is `tools/ci/verify_extension_contracts.py`.
## 6. Optional math ABI backend (post core math removal)
After the `math.*` builtins were removed (ADR-0061) an accelerated math function
is just an ordinary callable plugin export. `examples/math-backend/` exports
`math_backend.add` through the same frozen ABI v1 and requests the
`math.compute` **capability category**; `math.compute` does not promise any
core solver. Selection is not authorization:
```bash
./examples/math-backend/build.sh
marqdo check examples/math-backend/demo.mq.md --plugin examples/math-backend/build
marqdo run examples/math-backend/demo.mq.md \
--plugin examples/math-backend/build --trust-native-plugin --allow-plugin math.backend
# 42 ; without the grant: permission.denied
```
A pure package is still preferred; see
[`libraries.md`](libraries.md) §6. Domain operations must not be added to the
core `resource_request` table (ADR-0062).
## 7. Heading annotations are Proposed, not implemented
`@exec`/`@knowledge` are the closed Core Modes and alone decide execution;
third-party heading annotations are a **Proposed** metadata-only contract
(ADR-0060, target `3.1.x`). This build still rejects an unknown leading `@foo`
with `sem.invalid_mode_marker`; there is no annotation manifest,
`annotation.unknown`, Analysis v3 or sidecar yet. Do not document annotations as
available until Step B ships: [`../../spec/heading-annotations-v1.md`](../../spec/heading-annotations-v1.md).
+20
View File
@@ -126,3 +126,23 @@ diagnostics. For negative cases expect hard errors, never prose fallback:
- State that the package is pure `.mq.md` and needs no plugin/provider/kernel.
- Version the package independently of the CLI (`0.1.0` here is the package
version, not the product version).
## 6. Math libraries after the core math removal
The core `math.*` builtins (`math.parse/eval/substitute/simplify/differentiate`)
were removed after `3.0.0-beta.1` by
[ADR-0061](../adr/0061-detach-domain-math-kernel-from-core.md); a call is now
a static `symbol.unknown` and `crates/marqdo-math` is gone. Pure `.mq.md` is the
preferred replacement and the historical `math` import alias is available again:
```bash
# examples/math-library/index.mq.md + ../math-library-demo.mq.md
marqdo call examples/math-library-demo.mq.md main # 6
```
Keep signatures/behaviour in your own library contract; the core promises no
arithmetic beyond `Int`/`Float`, comparison and control flow, and no formula
evaluator (`Formula` Markdown stays inert). For a hot path, an explicitly selected
Plugin ABI export may request the `math.compute` capability
(`examples/math-backend/`); grants and trust flags are unchanged
(`docs/developers/extensions.md`). Migration: [`../../spec/math.md`](../../spec/math.md).
@@ -0,0 +1,149 @@
# RFC-EXT-0003 (issue #3) — core/extension boundary evidence
Status: **executed evidence, post-`3.0.0-beta.1` tree.**
Audit baseline: `eeea01d672c07b6be7d6444031d1619309dc88ab` (issue #3).
Frozen decisions: ADR-0060, ADR-0061, ADR-0062, ADR-0063.
This file is the executed companion to `docs/STATUS.md` §0.6 and the ADRs; the
plan text in the issue never counts as evidence.
## 1. Status matrix (audit item → implementation → evidence)
| Item | Status | Implementation | Executed evidence |
|---|---|---|---|
| H-06 sibling heading inheritance | **FIXED** | `build_units` pops `level >= current` before deriving the inherited mode (`crates/marqdo-frontend/src/units.rs`) | `units` matrix (12 tests), `conformance_semantics` fixtures 22/23, black-box `heading_inheritance` (check --emit/run/call) |
| H-08 stdlib in the release archive | **FIXED** | `package.py` stages and digest-verifies `stdlib/`; `RELEASE_INFO.json.stdlib`; release discovery no longer falls back to the compile-time tree; `smoke.py` re-verifies and fails closed | `tools/ci/test_release_archive.py` (5 tests), archive + smoke + independent `ubuntu:24.04` container runs in §5–§6 |
| H-04 provider reserved core kinds | **FIXED** | single `marqdo_host::CORE_RESOURCE_KINDS` used by CLI manifest validation and all trusted host registration paths | `resource_streams` (34 tests incl. all six names/kinds), `provider_manifest::every_core_kind_is_rejected_as_name_and_as_kind` |
| H-01 math domain API removed | **REMOVED (breaking, announced)** | five builtins/HostOps/runtime arms/`marqdo-math` deleted; pure package + optional ABI backend; `Formula` inert; `math.compute` stays a capability category | `math_library` black-box (pure package call = 6, ABI backend = 42, no grant = `permission.denied`, removed `math.eval` = `symbol.unknown`), `conformance_semantics` 74/75, `architecture_boundaries::domain_math_kernel_is_not_part_of_the_core` |
| H-03 `resource_request` ownership | **REVIEWED + GATED** | full owner/classification table in `docs/architecture/resource-operations.md`; exact reviewed allowlist pinned in `architecture_boundaries::resource_request_operation_allowlist_is_reviewed`; new domain ops forbidden (ADR-0062) | `architecture_boundaries` gate test passes on the SQL-free allowlist (`process.run`, `regex.*`, `compress.*`, `random.bytes`, `env.get`, `clock.now`, `fs.*`) |
| H-05/H-07/H-13 heading annotations | **PROPOSED, NOT IMPLEMENTED** | closed Core Modes classified; metadata-only Heading Annotations v1 contract + sidecar/Analysis-v3 decision in ADR-0060 and `spec/heading-annotations-v1.md`; parser still rejects `@foo` with `sem.invalid_mode_marker` | `tests/negative/01-invalid-mode-marker-case.expected.json`; no annotation code exists to test — future T-ANNO rows are explicitly FUTURE |
| H-02 foreign boundary | **F-A RETAINED, F-B DEFERRED** | one-shot permission-gated `foreign.run/call` + dynamic `KernelRegistry` kept, no new language-specific builtin/HostOp; ADR-0063 and `spec/foreign.md` §8 | existing `marqdo-foreign/tests/kernels.rs`, CLI kernel/foreign tests and `smoke.py` foreign case unchanged |
| H-11 `math.compute` | **KEPT AS CAPABILITY CATEGORY** | still in `CORE_CAPABILITIES`/`Capabilities::math`; no core solver behind it; ABI backend example requests it | `math_library` ABI backend run (42), no-grant negative (`permission.denied`), capability tests |
## 2. Code-path recheck versus the audit SHA
- `crates/marqdo-frontend/src/units.rs`: the audit's `inherited`-before-pop order is
gone; pop happens first. Covered by the sibling cases and the three entry points.
- `crates/cli/src/stdlib.rs::discover`: the compile-time source fallback is now
behind `#[cfg(debug_assertions)]`; a release build only loads an explicit
`MARQDO_STDLIB_DIR` or the executable-sibling `stdlib/`; the new
`sibling_stdlib_is_found_without_environment_override` test covers discovery.
- `tools/release/package.py::stage`: `copy_tree(STDLIB, stage_dir / "stdlib")`,
`verify_stdlib()` and `RELEASE_INFO.stdlib` are present; both digests are computed
identically to the runtime.
- `crates/marqdo-host/src/host/providers.rs`: both the provider name and every
declared kind are checked against the shared six-kind registry before the table is
mutated (previously only `""`/`stdio`/`file`).
- `crates/marqdo-host/src/host.rs::resource_request`: reviewed allowlist from the
audit is `process.run`, `regex.match`, `regex.captures`, `compress.gzip`,
`compress.gunzip`, `random.bytes`, `env.get`, `clock.now`, `fs.{read_at,append,walk,exists,metadata,list,mkdir,remove,rename}`.
- `crates/marqdo-ir/src/builtins.rs`, `marqdo-runtime`, `marqdo-host`: no `math.*`
remaining; `crates/marqdo-math` directory is deleted and absent from the workspace.
## 3. Targeted tests (executed)
```text
cargo test -p marqdo-frontend PASS (47)
cargo test -p marqdo-frontend units PASS (12; new sibling matrix)
cargo test -p marqdo-cli --test heading_inheritance PASS (4)
cargo test -p marqdo-cli --test conformance_semantics PASS (1; 22/23/74/75 goldens)
cargo test -p marqdo-cli --test math_library PASS (2)
cargo test -p marqdo-cli --test callable_resolution PASS (14)
cargo test -p marqdo-cli --test properties PASS (2)
cargo test -p marqdo-cli --test integration_cli PASS (23)
cargo test -p marqdo-cli --test negative PASS (3)
cargo test -p marqdo-host PASS (all suites; resource_streams 34)
cargo test -p marqdo-cli provider_manifest PASS (9)
python3 -m unittest discover -s tools/ci -p 'test_*.py' PASS (28)
```
`test result: FAILED` was observed only for the `docs_consistency` link
check before this file existed; the full gate in §4 was rerun after creating it.
## 4. Full gate (executed, rerun after this evidence file exists)
```text
cargo fmt --all -- --check PASS
cargo clippy --workspace --all-targets -- -D warnings PASS
cargo test --workspace --locked PASS (counts below)
python3 -m unittest discover -s tools/ci -p 'test_*.py' PASS (28)
```
Counts: **586 passed, 0 failed, 2 ignored** across the workspace; Python
`tools/ci` suite: **28 passed**.
### 4.1 Final full-gate counts
```text
cargo test --workspace --locked PASS: 586 passed, 0 failed, 2 ignored
cargo fmt --all -- --check PASS
cargo clippy --workspace --all-targets -- -D warnings PASS
python3 -m unittest discover -s tools/ci -p 'test_*.py' PASS: 28 passed
```
## 5. Release archive (executed after the implementation commit)
```text
cargo build --release --locked -p marqdo-cli -p marqdo-provider-worker
python3 tools/release/package.py --source-sha <SHA> --version 3.0.0-beta.1
python3 tools/release/smoke.py --archive dist/marqdo-3.0.0-beta.1-x86_64-unknown-linux-gnu.tar.gz
```
`RELEASE_INFO.json` records: `source_sha=<SHA>`,
`binaries.marqdo.sha256=<BIN_SHA>`,
`binaries.marqdo-provider-worker.sha256=<WORKER_SHA>`,
`stdlib.tree_digest=<TREE_DIGEST>`, `stdlib.aliases_digest=<ALIAS_DIGEST>`,
`stdlib.file_count=<N>`; archive `.sha256=<ARCHIVE_SHA>`.
Smoke results: stdlib digests verified; `stdlib.hidden` negative fails closed;
`examples/math-library-demo.mq.md main` → `6`;
`examples/math-backend` → `42` with grant and `permission.denied` without;
removed `math.eval` → `symbol.unknown`; all pre-existing archive checks PASS.
Full stdout is appended in the follow-up evidence commit.
## 6. Independent runtime container (executed)
`docker run --rm -v dist:/dist:ro ubuntu:24.04` extracts **only the archive** into
a fresh directory (no source tree, no `/build`, no Cargo; Ubuntu 24.04, glibc 2.39)
and runs:
```text
./marqdo --version
./marqdo --help
./marqdo run examples/hello.mq.md
./marqdo check examples/multi-module/index.mq.md --emit /tmp/analysis.json
./marqdo call examples/math-library-demo.mq.md main
./marqdo call examples/factorial.mq.md 阶乘 --arg n=5
```
Result: **CONTAINER_RESULT** (exact output appended in the follow-up evidence
commit). The binary's required GLIBC symbols are ≤ 2.39, so this is a real stdlib
test, not a dynamic-linker artefact.
## 7. External frozen-binary conformance (executed)
`marqdo-extension-conformance` (separate repository) is run with the
unchanged release binary:
```bash
python3 tools/ci/verify_extension_contracts.py --cli <release-marqdo> \
--fixtures /root/work/marqdo-extension-conformance \
--tested-sha <SHA> --out docs/evidence/extension/<SHA>/manifest.json
```
Result: **EXT_RESULTS** — the manifest records `cli_binary_sha256`,
`fixture_repo_sha`, 7/7 categories and no failures; the CLI hash did not change
during the suite. Exact JSON is committed at
`docs/evidence/extension/<SHA>/manifest.json` in the follow-up evidence commit.
## 8. Explicit deferrals / not claimed
- Heading annotations are **Proposed only**; no manifest loader, sidecar, Analysis
v3, `annotation.unknown`, or parser change has shipped (target `3.1.x`).
- Foreign F-B removal is deferred; `foreign.*` remains the controlled F-A primitive.
- No compatibility parser for `math.*`, no second Markdown→IR mapping, no built-in
View/Notebook, no AI/Quantum/Math `HostOp` was added.
- `math.compute` promises no solver; regex/compress remain host-held services, not a
general extension mechanism.
- No stable tag/release was created by this work; platform claim stays Linux x86_64.
- Not claimed/missing: full Math API/CAS, persistent Foreign sessions, Windows/macOS
native gates, strict L2, performance improvement.
+44 -6
View File
@@ -91,10 +91,18 @@ python3 tools/release/package.py --version "$version" --source-sha "$sha"
```
Contents: `marqdo` **and** `marqdo-provider-worker` in the same directory,
`LICENSE-*`, `README.md`, `CHANGELOG.md`, `COMPATIBILITY.md`,
the **complete verified `stdlib/` bundle** (`stdlib.json`, every `.mq.md` module
and self-test), `LICENSE-*`, `README.md`, `CHANGELOG.md`, `COMPATIBILITY.md`,
`RELEASE_INFO.json`, `SOURCE_SHA`, `KNOWN_LIMITATIONS.md`, `spec/`,
`docs/developers/`, `examples/` (with host-built plugin/provider artifacts so
the examples run without a compiler) and `tests/consumers/`.
`docs/developers/`, `examples/` (with host-built plugin/provider/math-backend
artifacts so the examples run without a compiler) and `tests/consumers/`.
`RELEASE_INFO.json` records the stdlib `name`, `version`, `tree_digest`,
`aliases_digest`, `file_count` and `files`. `package.py` recomputes both digests
with the same canonical algorithm as the runtime and refuses to package a mismatch
with `stdlib/stdlib.json` (RFC-EXT-0003 H-08 / T-PKG-04). The bundled stdlib is a
runtime requirement, not a build-machine side effect: a release binary must never
fall back to the compile-time source path.
Do not publish an archive with only the CLI, with a mismatched worker target, or
with a checksum that does not match the bytes.
@@ -109,12 +117,42 @@ python3 tools/release/smoke.py \
--archive dist/marqdo-*.tar.gz
```
It verifies the `.sha256`, `RELEASE_INFO.json`/`SOURCE_SHA`, offline
It verifies the `.sha256`, `RELEASE_INFO.json`/`SOURCE_SHA`, both stdlib
digests against `stdlib/stdlib.json` and the staged tree, offline
`--version`/`--help`, `check`/`run`/`call`, lock/sync, Analysis v2 and Trace v2
consumers, Tool install/dispatch, native + worker plugin transports, a foreign
kernel, Resource Provider v2 through the shipped worker (positive,
unauthorized and missing-helper fail-closed), and strict mode when the host
actually supports it. A failure is a release blocker.
unauthorized and missing-helper fail-closed), the pure math package and optional
math ABI backend, the removed `math.*` → `symbol.unknown` path, and strict mode
when the host actually supports it.
It also moves the bundled `stdlib/` aside and requires `run examples/hello.mq.md`
to fail closed with an explicit stdlib/print/symbol diagnostic: passing with a
compile-machine source fallback is a release blocker (T-PKG-03).
### Independent runtime container (required, T-PKG-01/02)
The cold-install gate must run in a container that receives **only the archive
bytes** — no source directory, no `/build`, no Cargo — and extracts them itself:
```bash
docker run --rm -v "$PWD/dist:/dist:ro" ubuntu:24.04 sh -c '
set -eu
mkdir -p /opt/marqdo
tar -xzf /dist/marqdo-<version>-x86_64-unknown-linux-gnu.tar.gz -C /opt/marqdo
cd /opt/marqdo/marqdo-<version>-x86_64-unknown-linux-gnu
./marqdo --version
./marqdo --help >/dev/null
./marqdo run examples/hello.mq.md
./marqdo check examples/multi-module/index.mq.md --emit /tmp/analysis.json
./marqdo call examples/math-library-demo.mq.md main
./marqdo call examples/factorial.mq.md 阶乘 --arg n=5
'
```
Run this on the same Linux x86_64 glibc baseline as the release support
matrix. If the binary needs a newer GLIBC than the runtime image, that is a real
release defect, not a stdlib failure; do not report the ABI error as a stdlib PASS.
## 5. Release evidence manifest