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:
1 parent
0fe5f42a62
commit
a67f344b6b
88 files changed
+2633
-3503
No files matched your search
@@ -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` |
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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.
|
||||
Reference in new issue
Block a user