refactor: Engine / Host Contract boundary, plugin ABI decoupling and governance gates (issue #13) #14

Merged
cflmy merged 2 commits from architecture/issue-13-engine-host-boundary into master 2026-11-26 19:29:14 +08:00
Owner

范围

按 issue #13 / ADR-0071 完成核心 M0–M3 边界工作,不改变语言语义与任何公共协议(Analysis 3 / Observation 1 / Tool 1 / Plugin ABI 1.0 / Value Wire 1 / Provider v2 / lock v4 均未变)。

  • 新增 marqdo-host-contract:Host/HostOp/ExecutionContext/ResourceRead/FrameId/ParameterSource/LoopTransfer/RuntimeObservation 唯一定义。
  • marqdo-runtime 只依赖中立契约;marqdo-host 实现契约,不反向依赖 runtime/frontend/IR。
  • marqdo-plugin-abi 收敛为纯契约(C ABI/wire/error);manifest/artifact/loader/worker 执行侧移入 marqdo-host::plugin;SDK 不再携带 loader/worker/host。
  • 新增真实独立消费者 tests/embedding(独立 workspace + lock):Markdown→frontend→IR→runtime、真实 fuel/stack/deadline/memory 限制、拒绝外部效果,并与真实 CLI 对同一 .mq.md 做值级差分。
  • 新增 tests/sdk-plugin:只用公开 SDK 构建第三方插件,用真实 CLI 显式 trust/grant 调用;篡改 artifact digest 被拒绝。
  • 架构门禁从“固定 crate 数量/固定路径”改为 Cargo metadata 责任依赖图 + 负例单测;保留原有安全/产品/协议/负例测试。
  • 文档入口收敛:ADR-0071、CURRENT 责任表、developers/architecture 索引、历史规划归档标注、STATUS 与证据。
  • 记录 keep in workspace 拆仓决策:不创建空的候选仓库;SDK 物理外迁、stdlib Phase B、regex/compress 迁移仍是独立后续工单。

验证(Linux x86_64,Rust 1.100 本机)

  • cargo fmt --all -- --check PASS
  • cargo clippy --workspace --all-targets --locked -D warnings PASS
  • cargo test --workspace --locked --no-fail-fast:636 passed / 0 failed / 2 ignored;基线 4bbefc9 为 633/0/2(无回退)
  • docs_consistency、architecture_boundaries、stdlib_product PASS
  • python3 tools/ci/check_dependency_boundaries.py PASS(54 个工具单测含负例)
  • python3 tools/ci/check_engine_boundary.py PASS(sum_to(10)=55、types 值级一致;燃料/栈/deadline/memory/资源拒绝)
  • python3 tools/ci/check_plugin_sdk.py PASS(真实 CLI 调用 Int 42;篡改 digest 拒绝)
  • Windows GNU 交叉 cargo check --workspace --all-targets --target x86_64-pc-windows-gnu PASS(仅交叉编译)

未验证 / 后续(不冒充 PASS)

  • 最低 Rust 1.89、Windows/macOS 原生 lane、strict VM、WASM probe、性能/RSS、冻结外部 conformance 与 release archive G05:本机 UNVERIFIED,由 CI lane 负责;WASM 当前是目标 std 缺失(E0463),非禁止的原生依赖。
  • stdlib Phase B(#11/#12)、SDK 物理仓库(S07/S08)、regex/compress 领域迁移、Foreign F-B:独立工单,未在本 PR 声称完成。

Evidence: docs/evidence/2026-11-26-issue-13-engine-host-boundary.md
ADR: docs/adr/0071-engine-host-contract-boundary.md

Refs #13

## 范围 按 issue #13 / ADR-0071 完成核心 M0–M3 边界工作,不改变语言语义与任何公共协议(Analysis 3 / Observation 1 / Tool 1 / Plugin ABI 1.0 / Value Wire 1 / Provider v2 / lock v4 均未变)。 - 新增 `marqdo-host-contract`:`Host`/`HostOp`/`ExecutionContext`/`ResourceRead`/`FrameId`/`ParameterSource`/`LoopTransfer`/`RuntimeObservation` 唯一定义。 - `marqdo-runtime` 只依赖中立契约;`marqdo-host` 实现契约,不反向依赖 runtime/frontend/IR。 - `marqdo-plugin-abi` 收敛为纯契约(C ABI/wire/error);manifest/artifact/loader/worker 执行侧移入 `marqdo-host::plugin`;SDK 不再携带 loader/worker/host。 - 新增真实独立消费者 `tests/embedding`(独立 workspace + lock):Markdown→frontend→IR→runtime、真实 fuel/stack/deadline/memory 限制、拒绝外部效果,并与真实 CLI 对同一 `.mq.md` 做值级差分。 - 新增 `tests/sdk-plugin`:只用公开 SDK 构建第三方插件,用真实 CLI 显式 trust/grant 调用;篡改 artifact digest 被拒绝。 - 架构门禁从“固定 crate 数量/固定路径”改为 Cargo metadata 责任依赖图 + 负例单测;保留原有安全/产品/协议/负例测试。 - 文档入口收敛:ADR-0071、CURRENT 责任表、developers/architecture 索引、历史规划归档标注、STATUS 与证据。 - 记录 **keep in workspace** 拆仓决策:不创建空的候选仓库;SDK 物理外迁、stdlib Phase B、regex/compress 迁移仍是独立后续工单。 ## 验证(Linux x86_64,Rust 1.100 本机) - `cargo fmt --all -- --check` PASS - `cargo clippy --workspace --all-targets --locked -D warnings` PASS - `cargo test --workspace --locked --no-fail-fast`:636 passed / 0 failed / 2 ignored;基线 `4bbefc9` 为 633/0/2(无回退) - `docs_consistency`、`architecture_boundaries`、`stdlib_product` PASS - `python3 tools/ci/check_dependency_boundaries.py` PASS(54 个工具单测含负例) - `python3 tools/ci/check_engine_boundary.py` PASS(sum_to(10)=55、types 值级一致;燃料/栈/deadline/memory/资源拒绝) - `python3 tools/ci/check_plugin_sdk.py` PASS(真实 CLI 调用 Int 42;篡改 digest 拒绝) - Windows GNU 交叉 `cargo check --workspace --all-targets --target x86_64-pc-windows-gnu` PASS(仅交叉编译) ## 未验证 / 后续(不冒充 PASS) - 最低 Rust 1.89、Windows/macOS 原生 lane、strict VM、WASM probe、性能/RSS、冻结外部 conformance 与 release archive G05:本机 UNVERIFIED,由 CI lane 负责;WASM 当前是目标 std 缺失(E0463),非禁止的原生依赖。 - stdlib Phase B(#11/#12)、SDK 物理仓库(S07/S08)、regex/compress 领域迁移、Foreign F-B:独立工单,未在本 PR 声称完成。 Evidence: `docs/evidence/2026-11-26-issue-13-engine-host-boundary.md` ADR: `docs/adr/0071-engine-host-contract-boundary.md` Refs #13
cflmy added 1 commit 2026-11-26 18:37:03 +08:00
Implements the core M0-M3 boundary work from issue #13 / ADR-0071 without
changing language semantics or any public protocol:

- add marqdo-host-contract owning Host/HostOp/ExecutionContext/ResourceRead
  and the runtime observation facts; the engine depends on it only.
- marqdo-runtime no longer links marqdo-host; the native host implements the
  contract and has no reverse edge to runtime/frontend/IR.
- reduce marqdo-plugin-abi to the public C ABI/wire/error contract; move
  manifest/artifact/loader/worker execution into marqdo-host::plugin so the
  SDK carries no loader/worker/host dependency.
- add a real independent consumer (tests/embedding, own workspace+lock) that
  runs Markdown -> frontend -> IR -> runtime with bounded budgets and explicit
  effect refusal, plus differential CLI comparison.
- add an SDK-only third-party plugin fixture and real CLI invocation gate.
- replace the frozen-crate architecture test with a reviewed responsibility
  graph enforced from Cargo metadata, with negative unit cases.
- consolidate current docs/entry: ADR-0071, CURRENT responsibility map,
  developers/architecture indexes, historical banners, STATUS and evidence.
- record keep-in-workspace for Engine/Native Host; no empty candidate repo.

Evidence: docs/evidence/2026-11-26-issue-13-engine-host-boundary.md
Refs #13
cflmy force-pushed architecture/issue-13-engine-host-boundary from d713aa068a to 9b4f0a0822 2026-11-26 18:37:03 +08:00 Compare
Author
Owner

与现有工单的落盘顺序

  • 本 PR 修改 crates/cli/tests/architecture_boundaries.rs、docs/STATUS.md 和 docs/architecture/CURRENT.md,与仍开启的 stdlib Phase A PR (#12) 有重叠。建议先合并本架构候选,再由 #12 基于新 master rebase;本 PR 不重复实现 stdlib Bundle 输入,也不修改 stdlib/ 生产源码/发布产物。
  • 本 PR 是 #13 的 M0–M3 核心候选;M4 的冻结 conformance、冷安装、strict、性能与生态同 SHA 证据在 CI/固定节点完成前,#13 保持开启,不冒充完成。
## 与现有工单的落盘顺序 - 本 PR 修改 `crates/cli/tests/architecture_boundaries.rs`、`docs/STATUS.md` 和 `docs/architecture/CURRENT.md`,与仍开启的 stdlib Phase A PR (#12) 有重叠。建议先合并本架构候选,再由 #12 基于新 master rebase;本 PR 不重复实现 stdlib Bundle 输入,也不修改 `stdlib/` 生产源码/发布产物。 - 本 PR 是 #13 的 M0–M3 核心候选;M4 的冻结 conformance、冷安装、strict、性能与生态同 SHA 证据在 CI/固定节点完成前,#13 保持开启,不冒充完成。
cflmy added 1 commit 2026-11-26 18:49:49 +08:00
Docs-only delta on top of the verified code SHA 9b4f0a0:
- Woodpecker PR pipeline #101 (test/minimum-rust/build all green, including
  archive smoke and frozen external conformance).
- domain-service ledger stays DEFERRED under ADR-0062 (no new domain op).
- STATUS/evidence update; no code, lock or protocol change.
Author
Owner

CI 状态(候选 e2162ad)

Woodpecker push pipeline #103 全部成功:clone / contract / test / minimum-rust / build。

  • test lane 实际执行并通过:fmt、clippy、cargo test --workspace、docs/architecture、check_dependency_boundaries.py、check_engine_boundary.py、check_plugin_sdk.py、tools/ci 单测、stdlib_product、Windows GNU 交叉 cargo check。
  • minimum-rust(rust:1.89)通过。
  • build lane 通过:release 二进制、同一 SHA 的确定性 archive、archive smoke、冻结外部 conformance。

上一轮 PR pipeline #100 的 provider_cli ETXTBSY 是既有的环境性偶发(同一代码直接重跑 #101 全绿);无代码改动。

仍未在本候选验证:native Windows/macOS 运行、strict VM、WASM probe、性能/RSS。证据文件:docs/evidence/2026-11-26-issue-13-engine-host-boundary.md。

## CI 状态(候选 `e2162ad`) Woodpecker **push pipeline #103** 全部成功:`clone` / `contract` / `test` / `minimum-rust` / `build`。 - `test` lane 实际执行并通过:fmt、clippy、`cargo test --workspace`、docs/architecture、`check_dependency_boundaries.py`、`check_engine_boundary.py`、`check_plugin_sdk.py`、tools/ci 单测、stdlib_product、Windows GNU 交叉 `cargo check`。 - `minimum-rust`(rust:1.89)通过。 - `build` lane 通过:release 二进制、同一 SHA 的确定性 archive、archive smoke、冻结外部 conformance。 上一轮 PR pipeline #100 的 `provider_cli` `ETXTBSY` 是既有的环境性偶发(同一代码直接重跑 #101 全绿);无代码改动。 仍未在本候选验证:native Windows/macOS 运行、strict VM、WASM probe、性能/RSS。证据文件:`docs/evidence/2026-11-26-issue-13-engine-host-boundary.md`。
Author
Owner

最终候选 e2162add2247a465c5684bed0f45e527a69f467a 的 CI 已全绿:

  • push pipeline #103:clone/contract/test/minimum-rust/build 全部 success;
  • PR pipeline #104:同样全部 success;
  • Gitea commit status:success。

代码 SHA 为 9b4f0a0,e2162ad 只是 docs-only 证据/台账更新(无代码、lock、协议改动)。因此 C11/G05 的候选证据绑定到同一代码树;M4 仍未验证的固定 lane(native Windows/macOS、strict VM、WASM probe、性能/RSS)保持 UNVERIFIED。SDK 物理外迁已另建 #15。

最终候选 `e2162add2247a465c5684bed0f45e527a69f467a` 的 CI 已全绿: - push pipeline #103:clone/contract/test/minimum-rust/build 全部 success; - PR pipeline #104:同样全部 success; - Gitea commit status:success。 代码 SHA 为 `9b4f0a0`,`e2162ad` 只是 docs-only 证据/台账更新(无代码、lock、协议改动)。因此 C11/G05 的候选证据绑定到同一代码树;M4 仍未验证的固定 lane(native Windows/macOS、strict VM、WASM probe、性能/RSS)保持 UNVERIFIED。SDK 物理外迁已另建 #15。
cflmy merged commit 2585915e16 into master 2026-11-26 19:29:14 +08:00
Sign in to join this conversation.
No Reviewers
No labels
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: cflmy/marqdo-cli#14