candidate: pin CLI Phase B and derive every artifact from the root candidate
ci/woodpecker/push/eco Pipeline failed
ci/woodpecker/pr/eco Pipeline failed

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
This commit is contained in:
cflmy committed 2026-11-27 01:07:31 +08:00
1 parent 48189243f7
commit 380d4f95a3
9 files changed
+514 -35

No files matched your search

+1 -1
Submodule cli updated: 452e9a32bd...72f57beee0.
+1 -1
View File
@@ -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 <Bundle>` 生成发行归档;随后 Conformance、View、Knowledge、Prove、Lint 与根 `acceptance-stdlib.py` 全部使用同一安装后二进制与相邻 Bundle。任何消费者都不能决定 CLI 版本,也不再有浮动或隐式制品。
- 组件验收只读取传入制品,不自行下载未知版本;开发目录覆盖入口(如 `MARQDO_STDLIB_DIR`)不得当作发行行为。缺失、摘要不符或平台不符必须拒绝。
## 影响范围与调度
+3 -2
View File
@@ -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 功能历史索引
@@ -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 <work>/stdlib` 由固定组件 gitlink 生成唯一 Bundle;
2. 从根固定的 `cli/` 提交构建 CLI 与 Provider Worker;
3. `cli/tools/release/package.py --source-sha <cli SHA> --version <workspace version> --stdlib-dir <Bundle>` 生成发行归档与 `RELEASE_INFO.json`;
4. `cli/tools/release/smoke.py` 验证归档、`SOURCE_SHA`、stdlib 摘要与语言-only 运行;
5. `scripts/acceptance-stdlib.py --cli <installed> --bundle <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 <dir>` | 两次构建一致,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=<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 <Bundle>` + `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。
+11
View File
@@ -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"}
+69 -31
View File
@@ -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)"
@@ -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
]
]
}
@@ -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"
}
}
@@ -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`