From 8fa728b302fa29caf8268a758eb4b0e90431d780 Mon Sep 17 00:00:00 2001 From: cflmy Date: Thu, 26 Nov 2026 23:47:57 +0800 Subject: [PATCH 1/5] candidate: pin the six migrated stdlib components and activate their entries M2 candidate for cflmy/marqdo#9: pin std-text/std-system/std-io/std-fs/ std-data/std-collections at the exact receiving-repo candidate commits, activate them in the root catalog with their own scripts/test.sh entry, and extend integration.sh with the root acceptance-stdlib gate. The previous requires arrays were design inputs, not real dependencies: the migrated modules import only CLI language/host builtins and same-repository siblings, so every active stdlib component now requires only cli (the Table pair also declares the coordinated checks_with). core/encoding/net stay planned and do not join the Bundle. --- components.toml | 34 ++++++++++++++++++++-------------- scripts/integration.sh | 10 +++++++++- stdlib/collections | 2 +- stdlib/data | 2 +- stdlib/fs | 2 +- stdlib/io | 2 +- stdlib/system | 2 +- stdlib/text | 2 +- 8 files changed, 35 insertions(+), 21 deletions(-) diff --git a/components.toml b/components.toml index 5a85fb2..08bcb9b 100644 --- a/components.toml +++ b/components.toml @@ -93,23 +93,25 @@ release = "base" id = "std-collections" path = "stdlib/collections" kind = "stdlib" -state = "planned" +state = "active" owner = "cflmy" scope = "List、Map 和 Table 值操作" -requires = ["cli", "std-core"] -checks_with = [] +requires = ["cli"] +checks_with = ["std-data"] release = "base" +entry = "scripts/test.sh" [[component]] id = "std-text" path = "stdlib/text" kind = "stdlib" -state = "planned" +state = "active" owner = "cflmy" scope = "Unicode 文本、字节值与 UTF-8" -requires = ["cli", "std-core", "std-collections"] +requires = ["cli"] checks_with = [] release = "base" +entry = "scripts/test.sh" [[component]] id = "std-encoding" @@ -126,45 +128,49 @@ release = "base" id = "std-data" path = "stdlib/data" kind = "stdlib" -state = "planned" +state = "active" owner = "cflmy" scope = "JSON、CSV、TOML 与 GFM 数据转换" -requires = ["cli", "std-collections", "std-text", "std-encoding"] -checks_with = [] +requires = ["cli"] +checks_with = ["std-collections"] release = "base" +entry = "scripts/test.sh" [[component]] id = "std-io" path = "stdlib/io" kind = "stdlib" -state = "planned" +state = "active" owner = "cflmy" scope = "Console、Stream、格式化和官方 print 别名" -requires = ["cli", "std-core", "std-text"] +requires = ["cli"] checks_with = [] release = "base" +entry = "scripts/test.sh" [[component]] id = "std-fs" path = "stdlib/fs" kind = "stdlib" -state = "planned" +state = "active" owner = "cflmy" scope = "文件、目录与路径" -requires = ["cli", "std-io", "std-text"] +requires = ["cli"] checks_with = [] release = "base" +entry = "scripts/test.sh" [[component]] id = "std-system" path = "stdlib/system" kind = "stdlib" -state = "planned" +state = "active" owner = "cflmy" scope = "时钟、UTC、环境、进程与随机" -requires = ["cli", "std-text", "std-io"] +requires = ["cli"] checks_with = [] release = "base" +entry = "scripts/test.sh" [[component]] id = "std-net" diff --git a/scripts/integration.sh b/scripts/integration.sh index a33c308..ca13d2b 100755 --- a/scripts/integration.sh +++ b/scripts/integration.sh @@ -4,7 +4,7 @@ set -euo pipefail cd "$(dirname "$0")/.." root="$PWD" active="$(python3 scripts/check-layout.py --checkouts --active-paths)" -expected=$'cli\ntests/conformance\ntools/knowledge\ntools/lint\ntools/prove\ntools/view' +expected=$'cli\nstdlib/collections\nstdlib/data\nstdlib/fs\nstdlib/io\nstdlib/system\nstdlib/text\ntests/conformance\ntools/knowledge\ntools/lint\ntools/prove\ntools/view' if [[ "$active" != "$expected" ]]; then echo "UNVERIFIED: update the integration plan for the changed active component set" >&2 exit 1 @@ -45,6 +45,14 @@ source_sha="$(git -C cli rev-parse HEAD)" test "$(cat "$(dirname "$MARQDO_BIN")/SOURCE_SHA")" = "$source_sha" sha256sum "$archive" "$MARQDO_BIN" "$(dirname "$MARQDO_BIN")/marqdo-provider-worker" +# Standard-library source relocation candidate: the root producer builds the one +# Bundle from the pinned component gitlinks; active component entries, the +# cross-repository composition fixtures and the fail-closed negatives all run +# against the same verified CLI artifact. +python3 scripts/acceptance-stdlib.py \ + --cli "$MARQDO_BIN" --work "$work/stdlib-acceptance" \ + --evidence "$work/stdlib-acceptance.json" + python3 cli/tools/release/smoke.py --archive "$archive" python3 cli/tools/ci/verify_extension_contracts.py \ --source-repo cli --tested-sha "$source_sha" --cli "$MARQDO_BIN" \ diff --git a/stdlib/collections b/stdlib/collections index 0851e1f..4907652 160000 --- a/stdlib/collections +++ b/stdlib/collections @@ -1 +1 @@ -Subproject commit 0851e1f8a05256dc50a9930df5deedbb7cd8f481 +Subproject commit 490765226866ac74b7365471c202e7638187bff8 diff --git a/stdlib/data b/stdlib/data index e3c9488..848af7a 160000 --- a/stdlib/data +++ b/stdlib/data @@ -1 +1 @@ -Subproject commit e3c9488dcac424fdcfe705ed049db7775d6ca16b +Subproject commit 848af7a357ceda2cfc20721b93406cf4be705889 diff --git a/stdlib/fs b/stdlib/fs index 3ef21c7..63bceae 160000 --- a/stdlib/fs +++ b/stdlib/fs @@ -1 +1 @@ -Subproject commit 3ef21c7de018b3ed29e95dedac276ef3b475e544 +Subproject commit 63bceae58736f13770c7eead02535726d08c19d0 diff --git a/stdlib/io b/stdlib/io index 945e76e..e18b0b1 160000 --- a/stdlib/io +++ b/stdlib/io @@ -1 +1 @@ -Subproject commit 945e76eed8adb589ea00fb5343138d5b99cdf0ea +Subproject commit e18b0b1b40fcc6adcb42b5ab9fe1c9c04e9b8263 diff --git a/stdlib/system b/stdlib/system index e1c4da4..053ddb0 160000 --- a/stdlib/system +++ b/stdlib/system @@ -1 +1 @@ -Subproject commit e1c4da4cc5f2940604242066067cfae111b0c428 +Subproject commit 053ddb0e59dc016b9c7833f115d14fa04e721d48 diff --git a/stdlib/text b/stdlib/text index 9f1e862..c2a7d32 160000 --- a/stdlib/text +++ b/stdlib/text @@ -1 +1 @@ -Subproject commit 9f1e862953f018f76bef6f35dc142a0c021154b7 +Subproject commit c2a7d327e5d1914db8952562614707c112a07da1 -- 2.54.1 From 0c7430ede006ea87f688751e7845678fb92f180f Mon Sep 17 00:00:00 2001 From: cflmy Date: Thu, 26 Nov 2026 23:51:22 +0800 Subject: [PATCH 2/5] docs: record the stdlib M2 candidate identity, gates and unverified scope Evidence for the pinned six-component candidate: two byte-identical Bundle builds (0.2.0, tree digest sha256:db9055...), both verified CLI identities, component entries, cross-repository composition (including byte-equal Table split), fail-closed negatives, adjacent offline install and deterministic CLI packaging. The file explicitly keeps the unchanged main combination, the existing consumer gates, CLI Phase B and the ext migrations as UNVERIFIED. Refs cflmy/marqdo#9 --- docs/MIGRATION.md | 10 +-- .../2026-11-26-stdlib-m2-candidate.md | 68 +++++++++++++++++++ 2 files changed, 73 insertions(+), 5 deletions(-) create mode 100644 docs/evidence/2026-11-26-stdlib-m2-candidate.md diff --git a/docs/MIGRATION.md b/docs/MIGRATION.md index 1a1d659..54f9853 100644 --- a/docs/MIGRATION.md +++ b/docs/MIGRATION.md @@ -143,12 +143,12 @@ Conformance 使用 CLI 已固定的真实 fixture 提交。 | 项 | 状态 | 证据 | | --- | --- | --- | | M0 盘点与派单 | 完成 | 本节、9 个接收仓 issue #1、[marqdo#9](https://git.cflmy.cn/cflmy/marqdo/issues/9) 评论 | -| 组件接收(源码+断言) | 候选已推送(6 个 std 仓) | [std-text PR #2](https://git.cflmy.cn/cflmy/marqdo-std-text/pulls/2)、[std-system PR #2](https://git.cflmy.cn/cflmy/marqdo-std-system/pulls/2)、[std-io PR #2](https://git.cflmy.cn/cflmy/marqdo-std-io/pulls/2)、[std-fs PR #2](https://git.cflmy.cn/cflmy/marqdo-std-fs/pulls/2)、[std-data PR #2](https://git.cflmy.cn/cflmy/marqdo-std-data/pulls/2)、[std-collections PR #2](https://git.cflmy.cn/cflmy/marqdo-std-collections/pulls/2) | +| 组件接收(源码+断言) | 候选已推送(6 个 std 仓,同候选配对) | [std-text PR #2](https://git.cflmy.cn/cflmy/marqdo-std-text/pulls/2)、[std-system PR #2](https://git.cflmy.cn/cflmy/marqdo-std-system/pulls/2)、[std-io PR #2](https://git.cflmy.cn/cflmy/marqdo-std-io/pulls/2)、[std-fs PR #2](https://git.cflmy.cn/cflmy/marqdo-std-fs/pulls/2)、[std-data PR #2](https://git.cflmy.cn/cflmy/marqdo-std-data/pulls/2)、[std-collections PR #2](https://git.cflmy.cn/cflmy/marqdo-std-collections/pulls/2) | | 领域模块(http/regex/archive) | 未开始 | ext-http/ext-regex/ext-archive issue #1 | -| Bundle 唯一生产者 | 脚本与契约测试已落地,待根候选验收 | `scripts/build-stdlib.py`、`scripts/stdlib-bundle.json`、`tests/integration/test_build_stdlib.py` | -| 组合验收入口 | 已落地,待根候选执行 | `scripts/acceptance-stdlib.py`、`tests/integration/composition/` | -| CLI 旧源树删除 | 未开始(等待根组合验收) | [marqdo-cli#11](https://git.cflmy.cn/cflmy/marqdo-cli/issues/11) Phase B | -| 根组合与切换 | 未开始 | 本仓 MIG-RELEASE 候选 | +| Bundle 唯一生产者 | 已实现,M2 候选真实构建两次逐字节一致 | `scripts/build-stdlib.py`、`scripts/stdlib-bundle.json`、`tests/integration/test_build_stdlib.py` | +| 组合验收入口 | M2 候选 PASS(组件 entry + 跨仓组合 + 负例 + 相邻离线安装 + CLI 确定性打包) | `scripts/acceptance-stdlib.py`、[M2 候选证据](evidence/2026-11-26-stdlib-m2-candidate.md)、[根 PR #11](https://git.cflmy.cn/cflmy/marqdo/pulls/11) | +| CLI 旧源树删除 | 未开始(等待根组合验收与 CLI PR 合并) | [marqdo-cli#11](https://git.cflmy.cn/cflmy/marqdo-cli/issues/11) Phase B、[CLI PR #12](https://git.cflmy.cn/cflmy/marqdo-cli/pulls/12) | +| 根组合与切换 | M2 候选已验证,未晋升;主分支仍为迁移前组合 `484cb10` | M2 候选分支 `migration/stdlib-m2-candidate`、[证据](evidence/2026-11-26-stdlib-m2-candidate.md) | ## v2 功能历史索引 diff --git a/docs/evidence/2026-11-26-stdlib-m2-candidate.md b/docs/evidence/2026-11-26-stdlib-m2-candidate.md new file mode 100644 index 0000000..847031c --- /dev/null +++ b/docs/evidence/2026-11-26-stdlib-m2-candidate.md @@ -0,0 +1,68 @@ +# 标准库源码归位 M2 候选证据(2026-11-26) + +父仓工单:[cflmy/marqdo#9](https://git.cflmy.cn/cflmy/marqdo/issues/9)。本文件记录 **M2 候选组合**的真实执行结果,是候选证据,不是已发布声明。根主分支仍保持迁移前组合(`484cb10`);本候选只有在 CLI Phase A 与六个接收仓 PR 合并、且完整生态门禁通过后才可晋升。 + +## 候选身份 + +| 对象 | 身份 | +| --- | --- | +| 根候选分支 | `migration/stdlib-m2-candidate`(本文档提交前树 `8fa728b302fa29caf8268a758eb4b0e90431d780`) | +| 根主分支基线 | `484cb10d66db9b92f0527499642ae6abddb3ef29`(未改动) | +| CLI gitlink(未变) | `cflmy/marqdo-cli@452e9a32bd9e40dba427d4180691c58bab74449e`(RC.4 组合) | +| CLI Phase A 候选(仅用于打包/验证,PR #12) | `cflmy/marqdo-cli@f8b82d414328d92b31865fed05e68223f7bee917` | +| std-text | `cflmy/marqdo-std-text@c2a7d327e5d1914db8952562614707c112a07da1`(PR #2) | +| std-system | `cflmy/marqdo-std-system@053ddb0e59dc016b9c7833f115d14fa04e721d48`(PR #2) | +| std-io | `cflmy/marqdo-std-io@e18b0b1b40fcc6adcb42b5ab9fe1c9c04e9b8263`(PR #2) | +| std-fs | `cflmy/marqdo-std-fs@63bceae58736f13770c7eead02535726d08c19d0`(PR #2) | +| std-data | `cflmy/marqdo-std-data@848af7a357ceda2cfc20721b93406cf4be705889`(PR #2) | +| std-collections | `cflmy/marqdo-std-collections@490765226866ac74b7365471c202e7638187bff8`(PR #2) | + +`std-core`、`std-encoding`、`std-net` 保持 `planned`,不加入 Bundle;HTTP/Regex/Archive 领域模块仍未迁移(ext-* issue #1),不进入默认 Bundle。 + +## 唯一 Bundle 制品 + +`scripts/build-stdlib.py` 从上述根 gitlink 组合,两次干净构建逐字节一致: + +| 字段 | 值 | +| --- | --- | +| name / version | `marqdo-stdlib` / `0.2.0`(内容变化显式升版本;摘要算法不变) | +| tree digest | `sha256:db905508dde89763b9d43b47fc5d52c6a1d5445a91f3c86a550ced43e8aac9d7` | +| aliases digest | `sha256:5f513c0fdbb3c1e9829be3c9fa23a2d1e89cb8510073fb5eb1e8e2f5265a83bb`(与迁移前一致) | +| 模块数 | 17(仅模块;`tests/`、`demo.mq.md`、`net/http`、`regex`、`compress` 均不在默认 Bundle) | +| 打包归档 | `marqdo-stdlib-0.2.0.tar.gz`,`sha256:212cca32f10ecfa0cdedfa976f7726db5e01cdb0e664a41ae26d4b34a8fd7048`(CLI Phase A `tools/pack-stdlib.py` 两次输出逐字节一致) | + +## 门禁结果 + +| 门禁 | 命令 | 结果 | +| --- | --- | --- | +| 根布局 | `python3 scripts/check-layout.py` | PASS | +| 递归布局 | `python3 scripts/check-layout.py --checkouts` | PASS(33 个固定子树;6 个 active stdlib entry 存在且工作区干净) | +| 根集成测试 | `python3 -m unittest discover -s tests/integration` | Ran 56 tests,OK(含 9 个 Bundle 生产者契约测试) | +| 组件独立验收 | `MARQDO_BIN= MARQDO_STDLIB_DIR=<新 Bundle> scripts/test.sh`(各仓) | 6/6 PASS,共 17 个 case(collections 1、text 2、data 3、io 4、fs 2、system 5) | +| 跨仓组合 | `scripts/acceptance-stdlib.py --cli --bundle <新 Bundle>` | PASS:官方 `print`/`打印` 别名、Table 值操作+GFM 跨模块、默认 Bundle smoke | +| Table 等价性 | 组合 fixture 终值与迁移前原 `stdlib/tests/table.mq.md` 终值 | 逐字节一致 | +| 失败负例 | 缺显式 Bundle、篡改模块摘要 | 均按预期失败(exit 1),不静默回退 | +| 相邻安装离线运行 | 把新 Bundle 放到 CLI 二进制旁 `stdlib/`,不设 `MARQDO_STDLIB_DIR` | PASS(默认离线安装路径可用) | +| CLI 打包 | Phase A `pack-stdlib.py --stdlib-dir <新 Bundle>` ×2 + 篡改输入 | 确定性 PASS;篡改拒绝 | + +CLI 身份(sha256):由 `452e9a3` 构建的 RC.4 二进制 `sha256:0377b855...`;Phase A 合并 master(`f8b82d4`)二进制 `sha256:6ede3b9e...`。两者对同一 Bundle 的组件与组合门禁结果一致。 + +## 未验证 / 待办 + +- 完整 `scripts/integration.sh` 的既有消费者门禁(Conformance/View/Knowledge/Prove/Lint)本轮**未执行**:该流程仍取冻结 RC.4 制品,本次未替换为统一制品输入(ECO-02,marqdo#7);不能把本次 PASS 当作生态发行验收。 +- CLI Phase B(删除仓内官方标准库源树、pin 切换)未做,等待 CLI PR #12 合并与本候选组件 PR 合并。 +- HTTP/Regex/Archive 领域模块迁移未完成(ext-* issue #1),默认 Bundle 因此移除这三个模块但尚未提供显式 Package 消费证据。 +- 未做完整产品归档冷安装(新 Bundle + 新 CLI 发行归档)与多平台证据;Windows/macOS 未验证。 +- 根主分支未改动,回退方式为放弃本候选分支,迁移前组合 `484cb10` 仍可检出。 + +## 复现 + +```sh +git checkout migration/stdlib-m2-candidate +git submodule update --init --recursive +python3 scripts/check-layout.py --checkouts +python3 -m unittest discover -s tests/integration +python3 scripts/build-stdlib.py --out build/stdlib +python3 scripts/acceptance-stdlib.py --cli --work build/accept +# 可选:--pack-tool /tools/pack-stdlib.py(Phase A 之后) +``` -- 2.54.1 From 4fade3e981dd3bc857d0c3ba5570325380f4aa99 Mon Sep 17 00:00:00 2001 From: cflmy Date: Fri, 27 Nov 2026 00:10:11 +0800 Subject: [PATCH 3/5] candidate: pin the explicit-package extensions and gate their consumption Pin ext-http/ext-regex/ext-archive at the merged explicit-Package candidates (they stay planned, never join the default Bundle) and extend the root acceptance gate to run any extension checkout that publishes the current package layout (marqdo.yaml + index.mq.md + scripts/test.sh). Record the actual package-entry decision in the ledger and evidence: the three domain modules are consumed through the public @alias import after marqdo lock, with the original domain tests and baseline terminal values preserved. Refs cflmy/marqdo#9 --- docs/MIGRATION.md | 10 ++--- .../2026-11-26-stdlib-m2-candidate.md | 8 +++- extensions/archive | 2 +- extensions/http | 2 +- extensions/regex | 2 +- scripts/acceptance-stdlib.py | 40 +++++++++++++++++++ 6 files changed, 54 insertions(+), 10 deletions(-) diff --git a/docs/MIGRATION.md b/docs/MIGRATION.md index 54f9853..6568816 100644 --- a/docs/MIGRATION.md +++ b/docs/MIGRATION.md @@ -101,9 +101,9 @@ Conformance 使用 CLI 已固定的真实 fixture 提交。 | `path.mq.md` | [std-fs#1](https://git.cflmy.cn/cflmy/marqdo-std-fs/issues/1) | `path.mq.md` | 8 | | `text.mq.md` | [std-text#1](https://git.cflmy.cn/cflmy/marqdo-std-text/issues/1) | `text.mq.md`(`utf8编码` 薄封装) | 1 | | `text/utf8.mq.md` | [std-text#1](https://git.cflmy.cn/cflmy/marqdo-std-text/issues/1) | `text/utf8.mq.md`(唯一编解码实现) | 10 | -| `net/http.mq.md` | [ext-http#1](https://git.cflmy.cn/cflmy/marqdo-ext-http/issues/1) | 显式 Package 模块,**不进入默认 Bundle**,不再是 `std:` | 11 | -| `regex.mq.md` | [ext-regex#1](https://git.cflmy.cn/cflmy/marqdo-ext-regex/issues/1) | 显式 Package 模块,**不进入默认 Bundle**,不再是 `std:` | 22 | -| `compress.mq.md` | [ext-archive#1](https://git.cflmy.cn/cflmy/marqdo-ext-archive/issues/1) | 显式 Package 模块,**不进入默认 Bundle**,不再是 `std:` | 2 | +| `net/http.mq.md` | [ext-http#1](https://git.cflmy.cn/cflmy/marqdo-ext-http/issues/1) | 显式 Package 入口 `index.mq.md`,**不进入默认 Bundle**,不再是 `std:` | 11 | +| `regex.mq.md` | [ext-regex#1](https://git.cflmy.cn/cflmy/marqdo-ext-regex/issues/1) | 显式 Package 入口 `index.mq.md`,**不进入默认 Bundle**,不再是 `std:` | 22 | +| `compress.mq.md` | [ext-archive#1](https://git.cflmy.cn/cflmy/marqdo-ext-archive/issues/1) | 显式 Package 入口 `index.mq.md`,**不进入默认 Bundle**,不再是 `std:` | 2 | | `demo.mq.md` | 不设接收仓;根 Bundle 组合 fixture | 不作为公开安装模块 | 2 | `std-core`、`std-encoding`、`std-net` 没有与之对应的旧模块:本轮不发空工单、不激活、不要求补齐未来规划;若已实现模块被本期 Bundle 实际依赖,再按真实依赖补充工单。 @@ -132,7 +132,7 @@ Conformance 使用 CLI 已固定的真实 fixture 提交。 3. **Table 切分**:值操作以 `std:collections/table` 为唯一权威,GFM 序列化以 `std:data/table` 为唯一权威;不保留旧 `std:data/table` 的值操作兼容转发,已知消费者在同一候选内更新。 4. **Text 去重**:UTF-8 编解码唯一实现在 `text/utf8.mq.md`,`text.mq.md#utf8编码` 为保留公开名称的薄封装。 5. **IO 别名**:`io.mq.md` 保持官方 `print`/`打印` 的别名目标 `写值`,签名与 effects 不变;别名元数据仍由 Bundle 生产者生成。 -6. **三个领域模块**:HTTP/Regex/Archive 迁入既有扩展仓并退出默认 Bundle,不保留隐藏的 `std:` fallback;CLI 现有 `regex.*`/`compress.*` 宿主请求是历史例外,本轮不删除也不新增同类请求,彻底消除另开工单。 +6. **三个领域模块**:HTTP/Regex/Archive 迁入既有扩展仓,按现行 Package 布局以 `index.mq.md` 为唯一公开入口(消费者经 `@alias` 显式依赖),退出默认 Bundle,不保留隐藏的 `std:` fallback;HTTP 的 bundle 内相对 import 改为公开 `std:text/utf8`。CLI 现有 `regex.*`/`compress.*` 宿主请求是历史例外,本轮不删除也不新增同类请求,彻底消除另开工单。 7. **`demo.mq.md`**:不作为公开库模块,转为根 Bundle 组合 fixture,避免为了放置文件创建无独立责任的新仓库。 8. **staging 不是发行**:迁移期为了隔离测试,允许用基线 Bundle 覆盖组件模块并重算 digest 的 staging 组合;它不是官方发布源,最终只有根唯一生产路径。 9. **CLI 侧最小修改**:Phase A 显式制品输入已落地;Phase B 删除仓内官方源树只在组件替代与根组合验收通过后执行,不同时进行核心重构。 @@ -144,7 +144,7 @@ Conformance 使用 CLI 已固定的真实 fixture 提交。 | --- | --- | --- | | M0 盘点与派单 | 完成 | 本节、9 个接收仓 issue #1、[marqdo#9](https://git.cflmy.cn/cflmy/marqdo/issues/9) 评论 | | 组件接收(源码+断言) | 候选已推送(6 个 std 仓,同候选配对) | [std-text PR #2](https://git.cflmy.cn/cflmy/marqdo-std-text/pulls/2)、[std-system PR #2](https://git.cflmy.cn/cflmy/marqdo-std-system/pulls/2)、[std-io PR #2](https://git.cflmy.cn/cflmy/marqdo-std-io/pulls/2)、[std-fs PR #2](https://git.cflmy.cn/cflmy/marqdo-std-fs/pulls/2)、[std-data PR #2](https://git.cflmy.cn/cflmy/marqdo-std-data/pulls/2)、[std-collections PR #2](https://git.cflmy.cn/cflmy/marqdo-std-collections/pulls/2) | -| 领域模块(http/regex/archive) | 未开始 | ext-http/ext-regex/ext-archive issue #1 | +| 领域模块(http/regex/archive) | 候选已合并为显式 Package | [ext-http PR #2](https://git.cflmy.cn/cflmy/marqdo-ext-http/pulls/2)、[ext-regex PR #2](https://git.cflmy.cn/cflmy/marqdo-ext-regex/pulls/2)、[ext-archive PR #2](https://git.cflmy.cn/cflmy/marqdo-ext-archive/pulls/2) | | Bundle 唯一生产者 | 已实现,M2 候选真实构建两次逐字节一致 | `scripts/build-stdlib.py`、`scripts/stdlib-bundle.json`、`tests/integration/test_build_stdlib.py` | | 组合验收入口 | M2 候选 PASS(组件 entry + 跨仓组合 + 负例 + 相邻离线安装 + CLI 确定性打包) | `scripts/acceptance-stdlib.py`、[M2 候选证据](evidence/2026-11-26-stdlib-m2-candidate.md)、[根 PR #11](https://git.cflmy.cn/cflmy/marqdo/pulls/11) | | CLI 旧源树删除 | 未开始(等待根组合验收与 CLI PR 合并) | [marqdo-cli#11](https://git.cflmy.cn/cflmy/marqdo-cli/issues/11) Phase B、[CLI PR #12](https://git.cflmy.cn/cflmy/marqdo-cli/pulls/12) | diff --git a/docs/evidence/2026-11-26-stdlib-m2-candidate.md b/docs/evidence/2026-11-26-stdlib-m2-candidate.md index 847031c..8520212 100644 --- a/docs/evidence/2026-11-26-stdlib-m2-candidate.md +++ b/docs/evidence/2026-11-26-stdlib-m2-candidate.md @@ -16,8 +16,11 @@ | std-fs | `cflmy/marqdo-std-fs@63bceae58736f13770c7eead02535726d08c19d0`(PR #2) | | std-data | `cflmy/marqdo-std-data@848af7a357ceda2cfc20721b93406cf4be705889`(PR #2) | | std-collections | `cflmy/marqdo-std-collections@490765226866ac74b7365471c202e7638187bff8`(PR #2) | +| ext-http(显式 Package) | `cflmy/marqdo-ext-http@368b33d241`(PR #2,合并后精确 SHA 以根 gitlink 为准) | +| ext-regex(显式 Package) | `cflmy/marqdo-ext-regex@6e7e633798`(PR #2) | +| ext-archive(显式 Package) | `cflmy/marqdo-ext-archive@aba6b60934`(PR #2) | -`std-core`、`std-encoding`、`std-net` 保持 `planned`,不加入 Bundle;HTTP/Regex/Archive 领域模块仍未迁移(ext-* issue #1),不进入默认 Bundle。 +`std-core`、`std-encoding`、`std-net` 保持 `planned`,不加入 Bundle。HTTP/Regex/Archive 已迁为显式 Package(`index.mq.md` + `marqdo.yaml`,消费者经 `@alias` 导入),不进入默认 Bundle;其源码候选已合并到各自仓库 main,根候选固定对应提交并执行显式 Package 消费门禁(`kind = "explicit-package"`)。 ## 唯一 Bundle 制品 @@ -41,6 +44,7 @@ | 组件独立验收 | `MARQDO_BIN= MARQDO_STDLIB_DIR=<新 Bundle> scripts/test.sh`(各仓) | 6/6 PASS,共 17 个 case(collections 1、text 2、data 3、io 4、fs 2、system 5) | | 跨仓组合 | `scripts/acceptance-stdlib.py --cli --bundle <新 Bundle>` | PASS:官方 `print`/`打印` 别名、Table 值操作+GFM 跨模块、默认 Bundle smoke | | Table 等价性 | 组合 fixture 终值与迁移前原 `stdlib/tests/table.mq.md` 终值 | 逐字节一致 | +| 显式 Package 消费 | `scripts/acceptance-stdlib.py` 内 http/regex/archive 各自 `scripts/test.sh`(临时消费者工程 + `marqdo lock` + `@alias` 导入) | PASS(原领域测试终值与迁移前基线一致) | | 失败负例 | 缺显式 Bundle、篡改模块摘要 | 均按预期失败(exit 1),不静默回退 | | 相邻安装离线运行 | 把新 Bundle 放到 CLI 二进制旁 `stdlib/`,不设 `MARQDO_STDLIB_DIR` | PASS(默认离线安装路径可用) | | CLI 打包 | Phase A `pack-stdlib.py --stdlib-dir <新 Bundle>` ×2 + 篡改输入 | 确定性 PASS;篡改拒绝 | @@ -51,7 +55,7 @@ CLI 身份(sha256):由 `452e9a3` 构建的 RC.4 二进制 `sha256:0377b855 - 完整 `scripts/integration.sh` 的既有消费者门禁(Conformance/View/Knowledge/Prove/Lint)本轮**未执行**:该流程仍取冻结 RC.4 制品,本次未替换为统一制品输入(ECO-02,marqdo#7);不能把本次 PASS 当作生态发行验收。 - CLI Phase B(删除仓内官方标准库源树、pin 切换)未做,等待 CLI PR #12 合并与本候选组件 PR 合并。 -- HTTP/Regex/Archive 领域模块迁移未完成(ext-* issue #1),默认 Bundle 因此移除这三个模块但尚未提供显式 Package 消费证据。 +- HTTP/Regex/Archive 已成为显式 Package 且组件内测试通过;本候选的根组合门禁只验证了独立 Package 行为,尚未验证真实应用项目的 `git` 依赖锁定/同步与发布分发,也尚未从默认 Bundle 删除后验证既有 `std:` 用户的迁移提示(按合同不保留 fallback)。 - 未做完整产品归档冷安装(新 Bundle + 新 CLI 发行归档)与多平台证据;Windows/macOS 未验证。 - 根主分支未改动,回退方式为放弃本候选分支,迁移前组合 `484cb10` 仍可检出。 diff --git a/extensions/archive b/extensions/archive index 527650e..aba6b60 160000 --- a/extensions/archive +++ b/extensions/archive @@ -1 +1 @@ -Subproject commit 527650e726e11a1d6957b2ed946d2f5e440686ca +Subproject commit aba6b60934a1e25162a09022e4caf953bde20e6b diff --git a/extensions/http b/extensions/http index f2dde42..368b33d 160000 --- a/extensions/http +++ b/extensions/http @@ -1 +1 @@ -Subproject commit f2dde4234c53739887dd5ef5307075a2d49a4c0b +Subproject commit 368b33d241ca2d51a0111e5189d40d9ad02437e6 diff --git a/extensions/regex b/extensions/regex index 5458dff..6e7e633 160000 --- a/extensions/regex +++ b/extensions/regex @@ -1 +1 @@ -Subproject commit 5458dff039a84357af5dc83ad11044050df12675 +Subproject commit 6e7e6337980ef6fd9ec7af6589a0007bfdc0e794 diff --git a/scripts/acceptance-stdlib.py b/scripts/acceptance-stdlib.py index bd20407..63edfab 100755 --- a/scripts/acceptance-stdlib.py +++ b/scripts/acceptance-stdlib.py @@ -169,6 +169,26 @@ def load_components() -> list[dict]: ] +def load_explicit_packages() -> list[dict]: + """Planned extensions that already publish an explicit Package entry. + + A component is gated as an explicit package only when its pinned checkout + carries the current package layout (``marqdo.yaml`` + ``index.mq.md`` + + ``scripts/test.sh``); it is never silently loaded into the default Bundle. + """ + catalog = tomllib.loads((ROOT / "components.toml").read_text()) + packages = [] + for component in catalog["component"]: + if component.get("kind") != "extension": + continue + checkout = ROOT / component["path"] + if (checkout / "marqdo.yaml").is_file() and ( + checkout / "index.mq.md" + ).is_file() and (checkout / "scripts" / "test.sh").is_file(): + packages.append(component) + return packages + + def component_gates(cli: str, bundle: Path) -> list[dict]: results = [] for component in load_components(): @@ -194,6 +214,26 @@ def component_gates(cli: str, bundle: Path) -> list[dict]: "output": output, } ) + for component in load_explicit_packages(): + entry = ROOT / component["path"] / "scripts" / "test.sh" + env = os.environ.copy() + env["MARQDO_BIN"] = cli + env["MARQDO_STDLIB_DIR"] = str(bundle) + result = run([str(entry)], cwd=ROOT / component["path"], env=env) + output = (result.stdout + result.stderr).decode(errors="replace").strip() + if result.returncode != 0: + raise AcceptanceError( + f"explicit package {component['id']} failed: {output}" + ) + results.append( + { + "id": component["id"], + "entry": "scripts/test.sh", + "kind": "explicit-package", + "status": "PASS", + "output": output, + } + ) return results -- 2.54.1 From 48189243f747d5f73d5a38a565010e64e2db74e7 Mon Sep 17 00:00:00 2001 From: cflmy Date: Fri, 27 Nov 2026 00:26:57 +0800 Subject: [PATCH 4/5] fix(acceptance): pass the explicit negative-gate environment The fail-closed gates must run with MARQDO_STDLIB_DIR explicitly pointed at a missing or tampered Bundle; inheriting the caller environment let a CLI with an adjacent valid Bundle fall back and made the missing-bundle negative pass. Reproduced with an installed CLI that has stdlib/ next to the binary. Refs cflmy/marqdo#9 --- scripts/acceptance-stdlib.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/scripts/acceptance-stdlib.py b/scripts/acceptance-stdlib.py index 63edfab..979d162 100755 --- a/scripts/acceptance-stdlib.py +++ b/scripts/acceptance-stdlib.py @@ -240,8 +240,8 @@ def component_gates(cli: str, bundle: Path) -> list[dict]: def negative_gates(cli: str, bundle: Path, work: Path) -> list[dict]: results = [] - def expect_failure(name, command): - result = run(command) + def expect_failure(name, command, env_for_gate): + result = run(command, env=env_for_gate) if result.returncode == 0: raise AcceptanceError(f"negative gate {name} unexpectedly passed") results.append( @@ -259,6 +259,7 @@ def negative_gates(cli: str, bundle: Path, work: Path) -> list[dict]: expect_failure( "missing-explicit-bundle", [cli, "run", str(ROOT / "tests/integration/composition/default-bundle.mq.md")], + env, ) tampered = work / "tampered-bundle" @@ -271,6 +272,7 @@ def negative_gates(cli: str, bundle: Path, work: Path) -> list[dict]: expect_failure( "tampered-module-digest", [cli, "run", str(ROOT / "tests/integration/composition/default-bundle.mq.md")], + env, ) return results -- 2.54.1 From 380d4f95a3152252e9fd759fc72b0c86ed6a5745 Mon Sep 17 00:00:00 2001 From: cflmy Date: Fri, 27 Nov 2026 01:07:31 +0800 Subject: [PATCH 5/5] candidate: pin CLI Phase B and derive every artifact from the root candidate MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit M3 candidate for cflmy/marqdo#9: the root cli gitlink now points at the CLI Phase B commit that removed the in-repo stdlib sources and pinned the accepted ecosystem Bundle. scripts/integration.sh no longer takes a CLI artifact from View's frozen RC.4 script. One candidate derives every input: the root-owned Bundle producer assembles the Bundle from pinned gitlinks, the CLI and Worker are built from the pinned cli commit, the release archive is packaged with --stdlib-dir, and Conformance/View/Knowledge/Prove/Lint plus acceptance-stdlib all use that same installed binary and adjacent Bundle. Evidence records the exact identities. Composition gains the print-format equivalence fixture (moved from the CLI) and a pure-mode Table case; the root acceptance compares stdout line pairs so the official print/打印 aliases must produce identical formatting. Refs cflmy/marqdo#9, cflmy/marqdo-cli#11 --- cli | 2 +- docs/DEVELOPMENT.md | 2 +- docs/MIGRATION.md | 5 +- .../2026-11-27-stdlib-m3-candidate.md | 43 +++ scripts/acceptance-stdlib.py | 11 + scripts/integration.sh | 100 ++++-- .../composition/cases/print-routing.json | 27 ++ .../composition/cases/table-pure.json | 317 ++++++++++++++++++ .../composition/print-routing.mq.md | 42 +++ 9 files changed, 514 insertions(+), 35 deletions(-) create mode 100644 docs/evidence/2026-11-27-stdlib-m3-candidate.md create mode 100644 tests/integration/composition/cases/print-routing.json create mode 100644 tests/integration/composition/cases/table-pure.json create mode 100644 tests/integration/composition/print-routing.mq.md diff --git a/cli b/cli index 452e9a3..72f57be 160000 --- a/cli +++ b/cli @@ -1 +1 @@ -Subproject commit 452e9a32bd9e40dba427d4180691c58bab74449e +Subproject commit 72f57beee0d07990e6e4813f4c6cc485e8eba303 diff --git a/docs/DEVELOPMENT.md b/docs/DEVELOPMENT.md index 6bcc243..366d6b4 100644 --- a/docs/DEVELOPMENT.md +++ b/docs/DEVELOPMENT.md @@ -52,7 +52,7 @@ bash scripts/integration.sh # 生态候选:真实 CLI 制品 + - 生态候选使用**固定、可验证**的 CLI/Worker/Stdlib 候选制品;输入必须绑定 CLI gitlink SHA、目标平台、归档/二进制/Bundle digest、工具链与锁。 - 标准库 Bundle 的唯一生产者是根仓库的 `scripts/build-stdlib.py`:它从根提交的精确组件 gitlink 读取各 active `kind = "stdlib"` 组件的 `modules/`,校验发布路径(只发布 `.mq.md`、拒绝 symlink/子模块/大小写与 NFC 冲突、`tests/` 不入库),生成现行 `stdlib.json`(tree digest + aliases digest),配置在 `scripts/stdlib-bundle.json`。版本变化必须显式(`--baseline-manifest` 拒绝同版本不同摘要)。组件仓继续拥有源码与测试,根不复制模块。 - 组合验收入口是根仓库的 `scripts/acceptance-stdlib.py`:只接受显式 `--cli` 与 `--bundle`(或按根 gitlink 构建),运行各 active 组件的 `entry`、跨仓组合 fixture(别名、Table 切分、默认 Bundle smoke)和必须失败的负例;提供 `--pack-tool` 时用 CLI 自己的打包器做两次确定性打包并核对摘要。CLI 自身打包请使用 Phase A 之后的 `--stdlib-dir` 输入,不再默认读取 CLI 源码树。 -- 当前候选的冻结制品适配器以正式 RC.4 为基线,临时从 View 的 `frozen-beta.sh` 获取;这属于待替换的过渡实现,CLI 版本不得由任一消费者决定。主仓库统一制品准备落地后,在此切换并记录证据。 +- 统一制品输入已落地(ECO-02 核心):`scripts/integration.sh` 不再从 View 的冻结脚本取 CLI 制品,而是由同一根候选派生全部输入——根唯一生产者 `scripts/build-stdlib.py` 按固定 gitlink 生成 Bundle;`cli/` 固定提交构建 CLI 与 Worker;`cli/tools/release/package.py --stdlib-dir ` 生成发行归档;随后 Conformance、View、Knowledge、Prove、Lint 与根 `acceptance-stdlib.py` 全部使用同一安装后二进制与相邻 Bundle。任何消费者都不能决定 CLI 版本,也不再有浮动或隐式制品。 - 组件验收只读取传入制品,不自行下载未知版本;开发目录覆盖入口(如 `MARQDO_STDLIB_DIR`)不得当作发行行为。缺失、摘要不符或平台不符必须拒绝。 ## 影响范围与调度 diff --git a/docs/MIGRATION.md b/docs/MIGRATION.md index 6568816..acfc865 100644 --- a/docs/MIGRATION.md +++ b/docs/MIGRATION.md @@ -147,8 +147,9 @@ Conformance 使用 CLI 已固定的真实 fixture 提交。 | 领域模块(http/regex/archive) | 候选已合并为显式 Package | [ext-http PR #2](https://git.cflmy.cn/cflmy/marqdo-ext-http/pulls/2)、[ext-regex PR #2](https://git.cflmy.cn/cflmy/marqdo-ext-regex/pulls/2)、[ext-archive PR #2](https://git.cflmy.cn/cflmy/marqdo-ext-archive/pulls/2) | | Bundle 唯一生产者 | 已实现,M2 候选真实构建两次逐字节一致 | `scripts/build-stdlib.py`、`scripts/stdlib-bundle.json`、`tests/integration/test_build_stdlib.py` | | 组合验收入口 | M2 候选 PASS(组件 entry + 跨仓组合 + 负例 + 相邻离线安装 + CLI 确定性打包) | `scripts/acceptance-stdlib.py`、[M2 候选证据](evidence/2026-11-26-stdlib-m2-candidate.md)、[根 PR #11](https://git.cflmy.cn/cflmy/marqdo/pulls/11) | -| CLI 旧源树删除 | 未开始(等待根组合验收与 CLI PR 合并) | [marqdo-cli#11](https://git.cflmy.cn/cflmy/marqdo-cli/issues/11) Phase B、[CLI PR #12](https://git.cflmy.cn/cflmy/marqdo-cli/pulls/12) | -| 根组合与切换 | M2 候选已验证,未晋升;主分支仍为迁移前组合 `484cb10` | M2 候选分支 `migration/stdlib-m2-candidate`、[证据](evidence/2026-11-26-stdlib-m2-candidate.md) | +| CLI 旧源树删除 | 候选完成:CLI 仓已无 `stdlib/` 源树、无编译期 fallback,pin 指向生态 Bundle | [marqdo-cli#11](https://git.cflmy.cn/cflmy/marqdo-cli/issues/11)、[CLI PR #17](https://git.cflmy.cn/cflmy/marqdo-cli/pulls/17)、[Phase B 证据](https://git.cflmy.cn/cflmy/marqdo-cli/src/branch/migration/cli-stdlib-phase-b/docs/evidence/2026-11-27-issue-11-phase-b.md) | +| 统一 CLI/Worker/Bundle 制品输入(ECO-02 核心) | 已落地:integration.sh 由同一根候选派生全部输入,不再使用 View 冻结制品 | 根 `scripts/integration.sh`、[marqdo#7](https://git.cflmy.cn/cflmy/marqdo/issues/7) | +| 根组合与切换 | M3 候选:固定 CLI Phase B 与组件提交,待 CI/晋升;主分支仍为迁移前组合 `484cb10` | [M3 证据](evidence/2026-11-27-stdlib-m3-candidate.md)、根 PR #12 | ## v2 功能历史索引 diff --git a/docs/evidence/2026-11-27-stdlib-m3-candidate.md b/docs/evidence/2026-11-27-stdlib-m3-candidate.md new file mode 100644 index 0000000..446b1fd --- /dev/null +++ b/docs/evidence/2026-11-27-stdlib-m3-candidate.md @@ -0,0 +1,43 @@ +# 标准库源码归位 M3 候选证据(2026-11-27) + +父仓工单:[cflmy/marqdo#9](https://git.cflmy.cn/cflmy/marqdo/issues/9)。 +本文件记录 **M3 候选组合**(源码所有权切换 + 统一制品输入)的候选证据,不是已完成发行声明。主分支仍保持迁移前组合 `484cb10`,根 PR #12 只有在 CI 通过且 CLI Phase B 合并后才晋升。 + +## 候选身份 + +| 对象 | 身份 | +| --- | --- | +| 根候选 | `migration/stdlib-m2-candidate`(CLI Phase B 固定为 `72f57be`) | +| CLI Phase B 候选 | `cflmy/marqdo-cli@72f57beee0d07990e6e4813f4c6cc485e8eba303`(PR #17;`stdlib/` 已删除,pin 指向生态 Bundle) | +| 生态 Bundle | `marqdo-stdlib@0.2.0`,source `cflmy/marqdo@48189243f7`,tree digest `sha256:db905508...`,aliases digest `sha256:5f513c0f...`(17 模块 + manifest) | +| 组件固定 | 六个 std 与三个 ext 的已合并候选 SHA(M2 证据同一组) | +| 发行归档(本地候选) | `marqdo-3.0.0-rc.4-x86_64-unknown-linux-gnu.tar.gz`,`sha256:9a926010ffe8e7353ee18b65fc568ced8bbf4b09b7592713f1213e2f3e3d40f9`(CLI `72f57be` + 新 Bundle) | + +## 统一制品输入(ECO-02 核心) + +根 `scripts/integration.sh` 不再读取 View 的冻结 RC.4 脚本;一次候选内派生全部输入: + +1. `scripts/build-stdlib.py --out /stdlib` 由固定组件 gitlink 生成唯一 Bundle; +2. 从根固定的 `cli/` 提交构建 CLI 与 Provider Worker; +3. `cli/tools/release/package.py --source-sha --version --stdlib-dir ` 生成发行归档与 `RELEASE_INFO.json`; +4. `cli/tools/release/smoke.py` 验证归档、`SOURCE_SHA`、stdlib 摘要与语言-only 运行; +5. `scripts/acceptance-stdlib.py --cli --bundle ` 跑组件 entry、显式 Package、组合 fixture 与失败负例; +6. Conformance、View、Knowledge、Prove、Lint 使用同一安装后二进制与相邻 Bundle。 + +## 本地候选验证 + +| 门禁 | 命令 | 结果 | +| --- | --- | --- | +| 根布局 | `python3 scripts/check-layout.py --checkouts` | PASS(含 6 个 active stdlib entry 与 9 个固定组件) | +| Bundle | `python3 scripts/build-stdlib.py --out ` | 两次构建一致,digest `sha256:db9055...` | +| CLI Phase B | `cargo fmt` / `clippy -D warnings` / `cargo test --workspace`(显式 Bundle) | fmt/clippy PASS;72 个测试二进制 PASS | +| CLI 工具测试 | `MARQDO_TEST_STDLIB_BUNDLE= python3 -m unittest discover -s tools/ci` | 75 tests OK | +| 独立构建 | `python3 tools/ci/independent_build.py` | PASS(无 stdlib 源树、无兄弟 Bundle,语言-only 运行成功,依赖 std 的程序 fail-closed) | +| 发行归档 | `package.py --stdlib-dir ` + `smoke.py --archive` | PASS(stdlib 0.2.0 摘要校验、缺失 Bundle fail-closed、language-only 运行) | +| 验收脚本 | `scripts/acceptance-stdlib.py` 本地 M2 版 | PASS(6 组件 + 3 显式 Package + 4 组合 + 2 负例) | + +## 未验证 / 待办 + +- 完整根 CI(`scripts/integration.sh` 含 View/Knowledge/Prove/Lint 消费者)在候选分支执行,结果记录在 PR #12/评论,不以本地部分运行替代。 +- 根晋升(合并 CLI PR #17 与根 PR #12、climo gitlink 与制品同一候选)属 MIG-RELEASE。 +- 完整产品归档冷安装(docker `--network none`)、多平台、ext-http loopback 领域测试仍待补;如需标记为发行门禁必须另行执行,不得以本文件冒充 PASS。 diff --git a/scripts/acceptance-stdlib.py b/scripts/acceptance-stdlib.py index 979d162..0117afb 100755 --- a/scripts/acceptance-stdlib.py +++ b/scripts/acceptance-stdlib.py @@ -157,6 +157,17 @@ def run_case(cli: str, bundle: Path, case: dict) -> dict: raise AcceptanceError( f"composition case {case['name']} stdout changed: {stdout!r}" ) + lines = stdout.splitlines() + for left, right in case.get("stdout_line_pairs", []): + if left >= len(lines) or right >= len(lines): + raise AcceptanceError( + f"composition case {case['name']} has no line pair {left}/{right}" + ) + if lines[left] != lines[right]: + raise AcceptanceError( + f"composition case {case['name']}: line {left} differs from line {right}: " + f"{lines[left]!r} != {lines[right]!r}" + ) return {"name": case["name"], "status": "PASS"} diff --git a/scripts/integration.sh b/scripts/integration.sh index ca13d2b..b56fa21 100755 --- a/scripts/integration.sh +++ b/scripts/integration.sh @@ -1,4 +1,11 @@ #!/usr/bin/env bash +# Ecosystem integration for one exact candidate combination. +# +# Inputs are the pinned root gitlinks: the root-owned Bundle producer assembles +# the one stdlib Bundle, the CLI/Worker are built from the pinned `cli` commit, +# the release archive is packaged with that explicit Bundle, and every consumer +# runs against that same installed binary + adjacent Bundle. There is no +# implicit artifact from View, no floating branch and no network-selected CLI. set -euo pipefail cd "$(dirname "$0")/.." @@ -15,6 +22,7 @@ work="$(mktemp -d "$root/.integration-work/run.XXXXXX")" echo "integration evidence: $work" exec > >(tee "$work/run.log") 2>&1 set -x + git rev-parse HEAD git submodule status --recursive uname -m @@ -22,43 +30,54 @@ ldd --version cargo --version python3 --version python3 -c 'import jsonschema' +python3 scripts/check-layout.py --checkouts > "$work/layout.txt" +cat "$work/layout.txt" -unset MARQDO_STDLIB_DIR -export CARGO_HOME="${CARGO_HOME:-$HOME/.cargo}" -mkdir "$work/frozen" -frozen="$root/tools/view/scripts/frozen-beta.sh" -metadata="$("$frozen" metadata)" -artifact="$(sed -n 's/^artifact=//p' <<<"$metadata")" -if [[ -n "${MARQDO_INTEGRATION_ARCHIVE:-}" ]]; then - archive="$(realpath "$MARQDO_INTEGRATION_ARCHIVE")" - archive_sha="$(sed -n 's/^archive_sha=//p' <<<"$metadata")" - printf '%s %s\n' "$archive_sha" "$archive" | sha256sum -c - - tar -xzf "$archive" -C "$work/frozen" - MARQDO_BIN="$work/frozen/$artifact/marqdo" - "$frozen" verify "$MARQDO_BIN" -else - MARQDO_BIN="$("$frozen" fetch "$work/frozen")" - archive="$work/frozen/$artifact.tar.gz" -fi -export MARQDO_BIN +# 1. One Bundle, produced by the root-owned producer from the pinned gitlinks. +python3 scripts/build-stdlib.py --out "$work/stdlib" | tee "$work/bundle.json" +bundle_digest="$(python3 -c 'import json,sys; print(json.load(sys.stdin)["tree_digest"])' < "$work/bundle.json")" +bundle_aliases="$(python3 -c 'import json,sys; print(json.load(sys.stdin)["aliases_digest"])' < "$work/bundle.json")" +test -f "$work/stdlib/stdlib.json" + +# 2. CLI and Worker from the exact pinned CLI gitlink. source_sha="$(git -C cli rev-parse HEAD)" -test "$(cat "$(dirname "$MARQDO_BIN")/SOURCE_SHA")" = "$source_sha" -sha256sum "$archive" "$MARQDO_BIN" "$(dirname "$MARQDO_BIN")/marqdo-provider-worker" - -# Standard-library source relocation candidate: the root producer builds the one -# Bundle from the pinned component gitlinks; active component entries, the -# cross-repository composition fixtures and the fail-closed negatives all run -# against the same verified CLI artifact. -python3 scripts/acceptance-stdlib.py \ - --cli "$MARQDO_BIN" --work "$work/stdlib-acceptance" \ - --evidence "$work/stdlib-acceptance.json" +export CARGO_TARGET_DIR="$work/target" +cargo build --manifest-path cli/Cargo.toml --locked --release \ + -p marqdo-cli -p marqdo-provider-worker +version="$(python3 -c ' +import pathlib, tomllib +data = tomllib.loads(pathlib.Path("cli/Cargo.toml").read_text()) +print(data["workspace"]["package"]["version"]) +')" +# 3. The release archive takes the Bundle as one explicit input. +python3 cli/tools/release/package.py \ + --source-sha "$source_sha" --version "$version" \ + --stdlib-dir "$work/stdlib" --out-dir "$work/dist" | tee "$work/package.json" +archive="$(find "$work/dist" -maxdepth 1 -name 'marqdo-*.tar.gz' -print -quit)" python3 cli/tools/release/smoke.py --archive "$archive" +mkdir -p "$work/install" +tar -xzf "$archive" -C "$work/install" +installed="$(find "$work/install" -mindepth 1 -maxdepth 1 -type d -print -quit)" +MARQDO_BIN="$installed/marqdo" +export MARQDO_BIN +test "$(cat "$installed/SOURCE_SHA")" = "$source_sha" +test "$(python3 -c 'import json,sys; print(json.load(open(sys.argv[1]))["version"])' "$installed/stdlib/stdlib.json")" = "$(python3 -c 'import json,sys; print(json.load(open(sys.argv[1]))["version"])' "$work/stdlib/stdlib.json")" +sha256sum "$archive" "$MARQDO_BIN" "$installed/marqdo-provider-worker" + +# 4. Root stdlib acceptance: component entries, explicit Packages, composition +# fixtures and fail-closed negatives with the same installed CLI/Bundle. +python3 scripts/acceptance-stdlib.py \ + --cli "$MARQDO_BIN" --bundle "$work/stdlib" \ + --work "$work/stdlib-acceptance" --evidence "$work/stdlib-acceptance.json" + +# 5. Frozen independent public-contract fixtures against the same CLI. python3 cli/tools/ci/verify_extension_contracts.py \ --source-repo cli --tested-sha "$source_sha" --cli "$MARQDO_BIN" \ - --release-info "$(dirname "$MARQDO_BIN")/RELEASE_INFO.json" \ + --release-info "$installed/RELEASE_INFO.json" \ --fixtures tests/conformance --out "$work/conformance.json" +# 6. Existing consumers, same installed binary and adjacent Bundle. ( cd tools/view export MARQDO_TOOL_HOME="$work/view-registry" @@ -95,7 +114,6 @@ python3 cli/tools/ci/verify_extension_contracts.py \ exit 1 fi ) - ( cd tools/knowledge MARQDO_TEST_BIN="$MARQDO_BIN" cargo test --locked --test core_cli --test compile @@ -113,4 +131,24 @@ python3 cli/tools/ci/verify_extension_contracts.py \ "$MARQDO_BIN" tool remove lint ) -echo "PASS: ecosystem RC.4 candidate checks" +# 7. Evidence identity for the accepted candidate. +python3 - "$work" "$source_sha" "$bundle_digest" "$bundle_aliases" "$archive" <<'PY' +import hashlib, json, pathlib, sys +work = pathlib.Path(sys.argv[1]) +archive = pathlib.Path(sys.argv[5]) +evidence = { + "schema": "marqdo.ecosystem-integration", + "schema_version": 1, + "root_commit": sys.argv[2], + "cli_source_sha": sys.argv[2], + "stdlib_tree_digest": sys.argv[3], + "stdlib_aliases_digest": sys.argv[4], + "archive": archive.name, + "archive_sha256": "sha256:" + hashlib.sha256(archive.read_bytes()).hexdigest(), + "status": "PASS", +} +(work / "integration-evidence.json").write_text(json.dumps(evidence, indent=2) + "\n") +print(json.dumps(evidence, indent=2)) +PY + +echo "PASS: ecosystem candidate (single CLI/Worker/Bundle artifact, consumers green)" diff --git a/tests/integration/composition/cases/print-routing.json b/tests/integration/composition/cases/print-routing.json new file mode 100644 index 0000000..16bb05d --- /dev/null +++ b/tests/integration/composition/cases/print-routing.json @@ -0,0 +1,27 @@ +{ + "schema": "marqdo.stdlib-test-case", + "schema_version": 1, + "name": "print-routing", + "file": "print-routing.mq.md", + "args": [], + "stdin": "", + "env": {}, + "expected_stdout": "[\"文本\", 2, 1.5, [3, true], {a: 1, b: \"x\"}, None]\n[\"文本\", 2, 1.5, [3, true], {a: 1, b: \"x\"}, None]\nTable[名称 | 分数]{甲 | 87; 乙 | 92}\nTable[名称 | 分数]{甲 | 87; 乙 | 92}\n[Formula(\"a = 1\"), Code(\"text\", 9 bytes), FunctionRef(root:default::print-routing.mq.md::演示函数)]\n[Formula(\"a = 1\"), Code(\"text\", 9 bytes), FunctionRef(root:default::print-routing.mq.md::演示函数)]\n", + "expected_terminal": { + "type": "none" + }, + "stdout_line_pairs": [ + [ + 0, + 1 + ], + [ + 2, + 3 + ], + [ + 4, + 5 + ] + ] +} diff --git a/tests/integration/composition/cases/table-pure.json b/tests/integration/composition/cases/table-pure.json new file mode 100644 index 0000000..b8b300b --- /dev/null +++ b/tests/integration/composition/cases/table-pure.json @@ -0,0 +1,317 @@ +{ + "schema": "marqdo.stdlib-test-case", + "schema_version": 1, + "name": "table-pure", + "file": "table.mq.md", + "args": [ + "--mode", + "pure" + ], + "stdin": "", + "env": {}, + "expected_stdout": "", + "expected_terminal": { + "items": [ + { + "header": [ + "分数" + ], + "rows": [ + [ + { + "decimal": "87", + "type": "int" + } + ], + [ + { + "decimal": "92", + "type": "int" + } + ], + [ + { + "decimal": "71", + "type": "int" + } + ] + ], + "type": "table" + }, + { + "header": [ + "名称", + "分数" + ], + "rows": [ + [ + { + "type": "text", + "value": "甲" + }, + { + "decimal": "87", + "type": "int" + } + ], + [ + { + "type": "text", + "value": "乙" + }, + { + "decimal": "92", + "type": "int" + } + ] + ], + "type": "table" + }, + { + "header": [ + "名称", + "分数" + ], + "rows": [ + [ + { + "type": "text", + "value": "丙" + }, + { + "decimal": "71", + "type": "int" + } + ], + [ + { + "type": "text", + "value": "甲" + }, + { + "decimal": "87", + "type": "int" + } + ], + [ + { + "type": "text", + "value": "乙" + }, + { + "decimal": "92", + "type": "int" + } + ] + ], + "type": "table" + }, + { + "header": [ + "名称", + "分数" + ], + "rows": [ + [ + { + "type": "text", + "value": "甲" + }, + { + "decimal": "87", + "type": "int" + } + ], + [ + { + "type": "text", + "value": "乙" + }, + { + "decimal": "92", + "type": "int" + } + ], + [ + { + "type": "text", + "value": "丙" + }, + { + "decimal": "71", + "type": "int" + } + ], + [ + { + "type": "text", + "value": "丁" + }, + { + "decimal": "65", + "type": "int" + } + ] + ], + "type": "table" + }, + { + "header": [ + "名称", + "分数" + ], + "rows": [ + [ + { + "type": "text", + "value": "甲" + }, + { + "decimal": "99", + "type": "int" + } + ], + [ + { + "type": "text", + "value": "乙" + }, + { + "decimal": "92", + "type": "int" + } + ], + [ + { + "type": "text", + "value": "丙" + }, + { + "decimal": "71", + "type": "int" + } + ] + ], + "type": "table" + }, + { + "header": [ + "名称", + "分数", + "名称", + "等级" + ], + "rows": [ + [ + { + "type": "text", + "value": "甲" + }, + { + "decimal": "87", + "type": "int" + }, + { + "type": "text", + "value": "甲" + }, + { + "type": "text", + "value": "B" + } + ], + [ + { + "type": "text", + "value": "乙" + }, + { + "decimal": "92", + "type": "int" + }, + { + "type": "text", + "value": "乙" + }, + { + "type": "text", + "value": "A" + } + ] + ], + "type": "table" + }, + { + "entries": { + "a": { + "items": [ + { + "decimal": "1", + "type": "int" + }, + { + "decimal": "3", + "type": "int" + } + ], + "type": "list" + }, + "b": { + "items": [ + { + "decimal": "2", + "type": "int" + } + ], + "type": "list" + } + }, + "type": "map" + }, + { + "header": [ + "名称", + "分数" + ], + "rows": [ + [ + { + "type": "text", + "value": "甲" + }, + { + "decimal": "87", + "type": "int" + } + ], + [ + { + "type": "text", + "value": "乙" + }, + { + "decimal": "92", + "type": "int" + } + ], + [ + { + "type": "text", + "value": "丙" + }, + { + "decimal": "71", + "type": "int" + } + ] + ], + "type": "table" + }, + { + "type": "text", + "value": "| 名称 | 分数 |\n| --- | --- |\n| 甲 | 87 |\n| 乙 | 92 |\n| 丙 | 71 |" + } + ], + "type": "list" + } +} diff --git a/tests/integration/composition/print-routing.mq.md b/tests/integration/composition/print-routing.mq.md new file mode 100644 index 0000000..4d37ad0 --- /dev/null +++ b/tests/integration/composition/print-routing.mq.md @@ -0,0 +1,42 @@ +--- +import: + io: "std:io" +--- + +## @exec 演示函数 + +`return 1` + +## @exec main + +### @knowledge 公式 + +$$a = 1$$ + +### @knowledge 代码 + +```text +print(1) +``` + +### @exec 主流程 + +**列表 = ["文本", 2, 1.5, [3, true], {a: 1, b: "x"}, None]** + +> **io.写值(列表)** + +> **打印(列表)** + +**表格 = 表(["名称", "分数"], [["甲", 87], ["乙", 92]])** + +> **io.写值(表格)** + +> **打印(表格)** + +**特殊 = [ref("#公式"), ref("#代码"), ref("#演示函数")]** + +> **io.写值(特殊)** + +> **打印(特殊)** + +`return None` -- 2.54.1