Compare commits

..
Author SHA1 Message Date
cflmy 328cc5c61b fix(impact): load the impact report before assembling the evidence record
ci/woodpecker/pr/eco Pipeline was successful
ci/woodpecker/push/eco Pipeline is running
The candidate evidence heredoc referenced the report without reading it after the
rebase; define the report from <work>/impact.json (or None when no accepted ref
was available) before building the record.
2026-11-27 02:05:33 +08:00
cflmy 520931ca34 feat(impact): recursive candidate impact analysis over the union graph
Implement the ECO-02 impact contract: compare the recursively expanded
(global_id, parent, remote, SHA, state) identities of an accepted root commit
and a candidate, expand domain gitlink changes to child identities, close over
the reverse requires graph built from the union of both revisions, add parent
domains, then reach a fixed point over checks_with. An unexpandable domain is
reported UNVERIFIED and widens the affected set to the full candidate instead of
skipping (--fail-on-unverified makes it fatal).

integration.sh runs it against the accepted root ref (PR target branch or
origin/main) and records changed/affected/checks_with/fallback in the candidate
evidence JSON. Five contract tests build real temporary Git repositories,
including a domain gitlink change and the conservative fallback.

Refs cflmy/marqdo#7
2026-11-27 02:05:22 +08:00
cflmy f17e23aeec docs: record the promoted stdlib migration combination and M4 cold install
ci/woodpecker/pr/eco Pipeline was successful
ci/woodpecker/push/eco Pipeline was successful
The root candidate is promoted: main pins CLI Phase B (no in-repo stdlib
sources) and the six migrated stdlib components; the root CI candidate passed
with one derived CLI/Worker/Bundle artifact and all consumers. Record the
promotion, the required check pipeline, the release-level offline cold install
result, the archive identity caveat (example binaries built locally differ from
the CI archive) and the remaining non-blocking follow-ups.

Also fix the integration evidence JSON: root_commit must name the root
candidate commit, with cli_source_sha separate.

Refs cflmy/marqdo#9
2026-11-27 01:51:06 +08:00
cflmy f4e292e7b0 fix(integration): scope the CLI target directory to the CLI build
ci/woodpecker/pr/eco Pipeline was successful
ci/woodpecker/push/eco Pipeline was canceled
The exported CARGO_TARGET_DIR leaked into the consumer repositories, so View's
package script built into the CLI target directory and then failed to find its
own release binary. Only the pinned CLI build names that target directory.
2026-11-27 01:40:57 +08:00
cflmy e7324edc0f candidate: pin the merged CLI Phase B commit
ci/woodpecker/push/eco Pipeline is pending
ci/woodpecker/pr/eco Pipeline failed
CLI PR #17 was fast-forward merged; the root candidate now pins the accepted
CLI Phase B commit (the earlier candidate commit plus the CI-only contract-lane
and Bundle-materialization fixes). Evidence updated with the merged identity.

Refs cflmy/marqdo#9, cflmy/marqdo-cli#11
2026-11-27 01:32:53 +08:00
cflmy c190ffb184 fix(integration): build the pinned CLI into its own target directory
ci/woodpecker/push/eco Pipeline failed
ci/woodpecker/pr/eco Pipeline was canceled
The release packager resolves both binaries from the CLI checkout's target
directory, so the candidate build must happen there; the previous external
CARGO_TARGET_DIR left the package step with no release binary. Keeps one build
and one artifact identity.
2026-11-27 01:22:13 +08:00
cflmy 380d4f95a3 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
2026-11-27 01:07:31 +08:00
cflmy 48189243f7 fix(acceptance): pass the explicit negative-gate environment
ci/woodpecker/pr/eco Pipeline was successful
ci/woodpecker/push/eco Pipeline was successful
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
2026-11-27 00:26:57 +08:00
cflmy 4fade3e981 candidate: pin the explicit-package extensions and gate their consumption
ci/woodpecker/push/eco Pipeline was canceled
ci/woodpecker/pr/eco Pipeline failed
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
2026-11-27 00:10:11 +08:00
cflmy 0c7430ede0 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
2026-11-26 23:51:22 +08:00
cflmy 8fa728b302 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.
2026-11-26 23:47:57 +08:00
24 changed files with 1324 additions and 64 deletions

No files matched your search

+1 -1
Submodule cli updated: 452e9a32bd...deadf6edee.
+20 -14
View File
@@ -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"
+1 -1
View File
@@ -23,7 +23,7 @@
- **聚合准入**:功能拆分须至少有一种独立价值(独立维护责任、显著不同依赖/安全/平台边界、独立版本与制品、可重复独立验收)。若两个仓库几乎每个 PR 都必须一起改动且接口未稳定,应先收敛合同或合并,不能无限拆分。
- **工具目录**(`tools/`)暂不聚合,现有四个 Tool 保持原路径。
**当前状态**(以 [components.toml](../components.toml) 与 [迁移台账](MIGRATION.md) 为准):根仓库有六个直属 active 组件(`cli`、`conformance`、`view`、`knowledge`、`prove`、`lint`)。九个标准库和十八个独立扩展是根层的 planned 子模块。`extensions/web` 是 planned 领域子模块,Design 和 Preview 由 Web 领域仓挂载。`marqdo-stdlib` 聚合和 `web-components` 仍在计划中。
**当前状态**(以 [components.toml](../components.toml) 与 [迁移台账](MIGRATION.md) 为准):根仓库有六个核心/工具 active 组件(`cli`、`conformance`、`view`、`knowledge`、`prove`、`lint`)和六个已交付源码的 active 标准库组件(`std-collections/data/fs/io/system/text`)。`std-core/encoding/net` 与十八个独立扩展仍是根层 planned 子模块。`extensions/web` 是 planned 领域子模块,Design 和 Preview 由 Web 领域仓挂载。`marqdo-stdlib` 聚合和 `web-components` 仍在计划中。
## 语言与产品层(不因仓库变多而改变)
+2 -2
View File
@@ -52,12 +52,12 @@ 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`)不得当作发行行为。缺失、摘要不符或平台不符必须拒绝。
## 影响范围与调度
比较已接受根提交与候选递归展开的 `(global_id, parent, remote, SHA, state)`;领域指针变化必须展开差异,不能只标记父节点。变更叶子加入集合后,取反向传递依赖闭包,再加所在祖先领域及需要协同验收的 `checks_with`(固定点去重、不作为构建先决);公共协议/权限/根集成逻辑变化触发相应全量 conformance 与消费者。删除或移动组件用新旧图并集计算受影响者。无法确定影响范围时全量而非跳过;正式发行执行所有 active 组件与完整测试。
根 `scripts/impact.py` 比较已接受根提交与候选递归展开的 `(global_id, parent, remote, SHA, state)`:领域指针变化展开到子组件身份,不能只标记父节点;变更叶子加入集合后,取 `requires` 新旧图并集的反向传递依赖闭包,再加所在祖先领域及 `checks_with` 固定点(协同验收不是构建先决)。领域无法展开(缺对象/检出)时结果标 UNVERIFIED 并**全量**扩大范围,不静默跳过;`--fail-on-unverified` 可把该情形变成硬失败。`integration.sh` 将报告写入候选证据(changed/affected/checks_with/fallback),正式发行仍执行所有 active 组件与完整测试。
## 工单路由与状态
+12 -10
View File
@@ -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 删除仓内官方源树只在组件替代与根组合验收通过后执行,不同时进行核心重构。
@@ -143,12 +143,14 @@ 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 |
| 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 候选 |
| 组件接收(源码+断言) | 候选已推送(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) | 候选已合并为显式 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 仓已无 `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) |
| 根组合与切换 | **已晋升**:`main` = `f4e292e`,固定 CLI Phase B `deadf6e` 与六个 std/三个 ext 组件;根生态 CI(pipeline 38)PASS | [M3 证据](evidence/2026-11-27-stdlib-m3-candidate.md)、[根 PR #12](https://git.cflmy.cn/cflmy/marqdo/pulls/12) |
| M4 发行级验收 | 离线冷安装 PASS(`ubuntu:24.04 --network none`,归档 `sha256:377d2787...`);多平台不在本线支持矩阵 | [M3 证据的晋升章节](evidence/2026-11-27-stdlib-m3-candidate.md#晋升与-m4-验收) |
## v2 功能历史索引
+1 -1
View File
@@ -35,7 +35,7 @@
## 标准库
每个仓库交付可独立测试的模块,共同组成默认 Bundle。聚合仓库 `marqdo-stdlib` 尚未创建,九个 `std-*` 当前保持根 catalog 的 planned 直属记录;CLI 内置标准库仍是现行发行权威,迁移完成前不得声称拆分完成。迁移的基线、模块/函数与断言台账、冻结发布路径见 [迁移台账](MIGRATION.md) 的“标准库源码归位迁移”一节;唯一 Bundle 生产者是根 `scripts/build-stdlib.py`,组合验收入口是 `scripts/acceptance-stdlib.py`。
每个仓库交付可独立测试的模块,共同组成默认 Bundle。标准库源码归位已完成并晋升:六个交付源码的 `std-*` 在根 catalog 为 active,`std-core/encoding/net` 保持 planned 且不入 Bundle;CLI 已无内置标准库源树,唯一 Bundle 由根 `scripts/build-stdlib.py` 从固定 gitlink 生成,组合验收为 `scripts/acceptance-stdlib.py`。迁移基线、模块/函数与断言台账、冻结发布路径见 [迁移台账](MIGRATION.md) 的“标准库源码归位迁移”一节。`marqdo-stdlib` 聚合仓库仍未建立;发行级冷安装已通过,后续缺陷回各责任仓。
| 仓库 | 要完成的任务 |
| --- | --- |
@@ -0,0 +1,72 @@
# 标准库源码归位 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) |
| 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 已迁为显式 Package(`index.mq.md` + `marqdo.yaml`,消费者经 `@alias` 导入),不进入默认 Bundle;其源码候选已合并到各自仓库 main,根候选固定对应提交并执行显式 Package 消费门禁(`kind = "explicit-package"`)。
## 唯一 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=<RC.4 由 452e9a3 构建> 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 <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;篡改拒绝 |
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 已成为显式 Package 且组件内测试通过;本候选的根组合门禁只验证了独立 Package 行为,尚未验证真实应用项目的 `git` 依赖锁定/同步与发布分发,也尚未从默认 Bundle 删除后验证既有 `std:` 用户的迁移提示(按合同不保留 fallback)。
- 未做完整产品归档冷安装(新 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 <verified-marqdo> --work build/accept
# 可选:--pack-tool <cli>/tools/pack-stdlib.py(Phase A 之后)
```
@@ -0,0 +1,54 @@
# 标准库源码归位 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 合并提交 `deadf6e`) |
| CLI Phase B 合并 | `cflmy/marqdo-cli@deadf6edeea6dd0f5abf51c47e80204fd851baf0`(PR #17 fast-forward 合并;Phase B 代码提交 `72f57be`,另含 CI 脚本修复;`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。
## 晋升与 M4 验收(2026-11-27)
- CLI Phase B [PR #17](https://git.cflmy.cn/cflmy/marqdo-cli/pulls/17) fast-forward 合并,`master` = `deadf6e`(contract/test/independent-build/minimum-rust/build 全绿)。
- 根 [PR #12](https://git.cflmy.cn/cflmy/marqdo/pulls/12) fast-forward 合并,`main` = `f4e292e7b09057c77e2a9293b40051be2666c4f8`;根树固定 CLI Phase B 与六个 std、三个 ext 提交,六个 stdlib 组件 active。
- 根生态 CI 必须门禁 `ci/woodpecker/pr/eco` PASS([pipeline 38](https://ci.cflmy.cn/repos/6/pipeline/38/1)):一次候选派生 Bundle(`sha256:db9055...`)→ 从 cli gitlink 构建 CLI/Worker → `package.py --stdlib-dir`(归档 `sha256:0827ba4b...`)→ smoke → 根 acceptance(组件 entry、显式 Package、组合、负例)→ Conformance/View/Knowledge/Prove/Lint 全部同一安装后二进制与相邻 Bundle。
- 发行级离线冷安装:在本机对同一晋升组合(根 `f4e292e`、CLI `deadf6e`、Bundle `db9055`)重新打包(归档 `sha256:377d2787...`)并执行 `cli/tools/release/cold-install.sh`(`ubuntu:24.04`、`--network none`、非 root 用户):PASS——安装后打印、`check`、示例运行、隐藏 Bundle 时 fail-closed、仅语言程序可运行均符合门禁。
- 两个归档 SHA 不同是因为示例插件二进制由本机构建产生,不是同一构建环境的确定性证据;确定性打包证据以 CI 同一环境两次构建为准。发行归档身份以 CI/发布记录为准,本文件只记录晋升组合与冷安装通过。
仍保留为后续(不阻塞本轮关闭):Windows/macOS 不在本线发行支持矩阵;`marqdo-ext-http` 的 HTTP-over-TCP loopback 领域测试;ECO-02 的递归影响分析自动化。
+55 -2
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"}
@@ -169,6 +180,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,14 +225,34 @@ 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
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(
@@ -219,6 +270,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"
@@ -231,6 +283,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
+333
View File
@@ -0,0 +1,333 @@
#!/usr/bin/env python3
"""Recursive impact analysis between an accepted root commit and a candidate.
Compares the recursively expanded governance tree of two root revisions. A
component identity is `(global_id, parent, remote, SHA, state)`; a domain
gitlink change is expanded to its child identities so leaf changes are visible
even when the parent pointer did not change as a string.
The affected set is computed in the order the development contract requires:
1. changed or removed leaves;
2. reverse transitive closure over `requires` edges from the union of both
graphs (removed edges cannot hide a consumer);
3. parent domains of affected components;
4. `checks_with` fixed point (co-validation is not a build prerequisite).
When a domain cannot be expanded (missing object/checkout) the result is marked
UNVERIFIED and the whole domain is treated as affected rather than silently
skipping it.
"""
from __future__ import annotations
import argparse
import json
import subprocess
import sys
import tomllib
from pathlib import Path
ROOT = Path(__file__).resolve().parents[1]
SCHEMA = "marqdo.impact"
SCHEMA_VERSION = 1
class ImpactError(Exception):
pass
def git(repo: Path, *args: str) -> bytes:
result = subprocess.run(["git", "-C", str(repo), *args], capture_output=True)
if result.returncode != 0:
raise ImpactError(
f"git {' '.join(args)} failed in {repo}: "
f"{result.stderr.decode(errors='replace').strip()}"
)
return result.stdout
def show(repo: Path, revision: str, path: str) -> bytes | None:
result = subprocess.run(
["git", "-C", str(repo), "show", f"{revision}:{path}"], capture_output=True
)
return result.stdout if result.returncode == 0 else None
def resolve(repo: Path, revision: str) -> str:
try:
return (
git(repo, "rev-parse", "--verify", revision + "^{commit}")
.decode()
.strip()
)
except ImpactError as error:
raise ImpactError(f"cannot resolve revision {revision!r}: {error}") from error
def tree_entries(repo: Path, revision: str) -> dict[str, tuple[str, str]]:
output = git(repo, "ls-tree", "-r", "-z", revision)
entries: dict[str, tuple[str, str]] = {}
for record in output.split(b"\0"):
if not record:
continue
header, _, raw_path = record.partition(b"\t")
fields = header.decode().split()
if len(fields) != 3:
raise ImpactError(f"invalid tree record in {repo}@{revision}")
mode, _kind, sha = fields
entries[raw_path.decode()] = (mode, sha)
return entries
def submodule_urls(repo: Path, revision: str) -> dict[str, str]:
"""Map `.gitmodules` path to URL at a revision (authority for remotes)."""
raw = show(repo, revision, ".gitmodules")
if raw is None:
return {}
config = git(
repo, "config", "--null", "--blob", f"{revision}:.gitmodules", "--list"
)
urls: dict[str, str] = {}
pending: dict[str, dict[str, str]] = {}
for record in config.split(b"\0"):
if not record:
continue
key, _, value = record.decode(errors="replace").partition("\n")
parts = key.split(".")
if len(parts) == 4 and parts[0] == "submodule" and parts[3] in ("path", "url"):
pending.setdefault(parts[1], {})[parts[3]] = value
for fields in pending.values():
if "path" in fields and "url" in fields:
urls[fields["path"]] = fields["url"]
return urls
def read_catalog(repo: Path, revision: str, label: str) -> list[dict]:
raw = show(repo, revision, "components.toml")
if raw is None:
raise ImpactError(f"{label}: revision {revision} has no components.toml")
try:
catalog = tomllib.loads(raw.decode())
except (UnicodeDecodeError, tomllib.TOMLDecodeError) as error:
raise ImpactError(f"{label}: invalid components.toml: {error}") from error
components = catalog.get("component")
if not isinstance(components, list):
raise ImpactError(f"{label}: components.toml has no [[component]] entries")
return components
def load_graph(
repo: Path, revision: str, label: str, depth: int = 0
) -> tuple[dict[str, dict], list[str]]:
"""Expand one governance layer (root then domains) into global identities."""
components = read_catalog(repo, revision, label)
entries = tree_entries(repo, revision)
urls = submodule_urls(repo, revision)
gitlinks = {path: sha for path, (mode, sha) in entries.items() if mode == "160000"}
graph: dict[str, dict] = {}
unverified: list[str] = []
for component in components:
component_id = component.get("id")
path = component.get("path")
if not isinstance(component_id, str) or not isinstance(path, str):
raise ImpactError(f"{label}: component without id/path")
sha = gitlinks.get(path)
identity = {
"id": component_id,
"parent": None,
"path": path,
"remote": urls.get(path),
"sha": sha,
"state": component.get("state"),
"kind": component.get("kind"),
"requires": sorted(component.get("requires", [])),
"checks_with": sorted(component.get("checks_with", [])),
"layer": label,
}
graph[component_id] = identity
if component.get("kind") != "domain" or depth > 0:
continue
domain_repo = repo / path
if sha is None or not (domain_repo / ".git").exists():
unverified.append(
f"{label}: domain {component_id} ({path}) cannot be expanded: "
"missing gitlink or checkout"
)
continue
try:
children, child_unverified = load_graph(
domain_repo, sha, f"domain {component_id}", depth + 1
)
except ImpactError as error:
unverified.append(
f"{label}: domain {component_id} ({path})@{sha} cannot be expanded: {error}"
)
continue
unverified.extend(child_unverified)
for child_id, child in children.items():
if child_id in graph:
raise ImpactError(f"{label}: duplicate global id {child_id}")
child["parent"] = component_id
graph[child_id] = child
return graph, unverified
def identity_fields(component: dict) -> tuple:
return (
component.get("parent"),
component.get("remote"),
component.get("sha"),
component.get("state"),
tuple(component.get("requires", [])),
tuple(component.get("checks_with", [])),
)
def changed_components(
accepted: dict[str, dict], candidate: dict[str, dict]
) -> list[dict]:
changed = []
for component_id in sorted(set(accepted) | set(candidate)):
before = accepted.get(component_id)
after = candidate.get(component_id)
if before is None:
changed.append({"id": component_id, "reason": "added"})
continue
if after is None:
changed.append({"id": component_id, "reason": "removed"})
continue
if before.get("sha") != after.get("sha"):
changed.append({"id": component_id, "reason": "sha"})
elif before.get("state") != after.get("state"):
changed.append({"id": component_id, "reason": "state"})
elif before.get("remote") != after.get("remote"):
changed.append({"id": component_id, "reason": "remote"})
elif before.get("parent") != after.get("parent"):
changed.append({"id": component_id, "reason": "parent"})
elif before.get("requires") != after.get("requires") or before.get(
"checks_with"
) != after.get("checks_with"):
changed.append({"id": component_id, "reason": "dependencies"})
return changed
def affected_set(
accepted: dict[str, dict], candidate: dict[str, dict], changed: list[dict]
) -> tuple[list[str], list[str], list[str]]:
graph = {**accepted, **candidate}
dependents: dict[str, set[str]] = {component_id: set() for component_id in graph}
for component in graph.values():
for dependency in component.get("requires", []):
dependents.setdefault(dependency, set()).add(component["id"])
affected = {item["id"] for item in changed}
queue = list(affected)
while queue:
current = queue.pop()
for consumer in dependents.get(current, set()):
if consumer not in affected:
affected.add(consumer)
queue.append(consumer)
domains = set()
for component_id in list(affected):
parent = graph[component_id].get("parent")
while parent:
if parent not in affected:
domains.add(parent)
parent = graph[parent].get("parent") if parent in graph else None
co_validation: set[str] = set()
while True:
additions = set()
for component_id in affected:
for partner in graph[component_id].get("checks_with", []):
if partner not in affected:
additions.add(partner)
if not additions:
break
affected |= additions
co_validation |= additions
return sorted(affected), sorted(domains), sorted(co_validation)
def analyze(accepted_ref: str, candidate_ref: str) -> dict:
accepted_revision = resolve(ROOT, accepted_ref)
candidate_revision = resolve(ROOT, candidate_ref)
accepted, accepted_unverified = load_graph(ROOT, accepted_revision, "root")
candidate, candidate_unverified = load_graph(ROOT, candidate_revision, "root")
changed = changed_components(accepted, candidate)
affected, domains, co_validation = affected_set(accepted, candidate, changed)
unverified = accepted_unverified + candidate_unverified
fallback = None
if unverified:
# Undetermined scope must widen, never silently skip.
affected = sorted(set(accepted) | set(candidate))
domains = []
co_validation = []
fallback = "full"
return {
"schema": SCHEMA,
"schema_version": SCHEMA_VERSION,
"accepted": {"ref": accepted_ref, "revision": accepted_revision},
"candidate": {"ref": candidate_ref, "revision": candidate_revision},
"counts": {
"accepted_components": len(accepted),
"candidate_components": len(candidate),
"changed": len(changed),
"affected": len(affected),
},
"changed": changed,
"affected": affected,
"domain_ancestors": domains,
"checks_with": co_validation,
"fallback": fallback,
"unverified": unverified,
}
def main(argv: list[str]) -> int:
parser = argparse.ArgumentParser(description=__doc__)
parser.add_argument("--accepted", required=True, help="accepted root revision")
parser.add_argument("--candidate", default="HEAD", help="candidate root revision")
parser.add_argument("--out", default=None)
parser.add_argument("--json", action="store_true")
parser.add_argument(
"--fail-on-unverified",
action="store_true",
help="exit 2 when a domain cannot be expanded",
)
args = parser.parse_args(argv)
try:
report = analyze(args.accepted, args.candidate)
except ImpactError as error:
print(f"impact: error: {error}", file=sys.stderr)
return 1
text = json.dumps(report, ensure_ascii=False, indent=2) + "\n"
if args.out:
Path(args.out).write_text(text)
if args.json:
print(text, end="")
else:
print(
f"accepted {report['accepted']['revision'][:12]} "
f"candidate {report['candidate']['revision'][:12]}"
)
print(
f"changed={report['counts']['changed']} "
f"affected={report['counts']['affected']}"
)
for item in report["changed"]:
print(f" changed {item['id']}: {item['reason']}")
print("affected: " + ", ".join(report["affected"]))
if report["checks_with"]:
print("co-validation: " + ", ".join(report["checks_with"]))
if report["fallback"]:
print("fallback: full (impact scope undetermined)")
for note in report["unverified"]:
print(f"UNVERIFIED: {note}", file=sys.stderr)
if args.fail_on_unverified and report["unverified"]:
return 2
return 0
if __name__ == "__main__":
raise SystemExit(main(sys.argv[1:]))
+104 -24
View File
@@ -1,10 +1,17 @@
#!/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")/.."
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
@@ -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,35 +30,74 @@ 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"
# Recursive impact analysis against the accepted root commit: the change set
# comes from the recursively expanded (global_id, parent, remote, SHA, state)
# identities, then reverse `requires` closure, parent domains and `checks_with`
# fixed point. An undetermined scope widens to the full candidate.
accepted_ref="${MARQDO_ACCEPTED_REF:-}"
if [[ -z "$accepted_ref" && -n "${CI_COMMIT_TARGET_BRANCH:-}" ]] \
&& git rev-parse --verify "origin/$CI_COMMIT_TARGET_BRANCH" >/dev/null 2>&1; then
accepted_ref="origin/$CI_COMMIT_TARGET_BRANCH"
elif [[ -z "$accepted_ref" ]] && git rev-parse --verify origin/main >/dev/null 2>&1; then
accepted_ref="origin/main"
fi
if [[ -n "$accepted_ref" ]]; then
python3 scripts/impact.py --accepted "$accepted_ref" --candidate HEAD \
--out "$work/impact.json"
fi
export MARQDO_BIN
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"
# 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)"
# The CLI release packager resolves its binaries from the pinned CLI checkout's
# own target directory; keep this build there so the package step consumes the
# same artifacts without a second build. Do not export CARGO_TARGET_DIR: the
# consumer repositories build into their own target directories.
CARGO_TARGET_DIR="$root/cli/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"
@@ -87,7 +134,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
@@ -105,4 +151,38 @@ 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.
root_commit="$(git rev-parse HEAD)"
python3 - "$work" "$root_commit" "$source_sha" "$bundle_digest" "$bundle_aliases" "$archive" <<'PY'
import hashlib, json, pathlib, sys
work = pathlib.Path(sys.argv[1])
archive = pathlib.Path(sys.argv[6])
impact_path = work / "impact.json"
impact = json.loads(impact_path.read_text()) if impact_path.is_file() else None
evidence = {
"schema": "marqdo.ecosystem-integration",
"schema_version": 1,
"root_commit": sys.argv[2],
"cli_source_sha": sys.argv[3],
"stdlib_tree_digest": sys.argv[4],
"stdlib_aliases_digest": sys.argv[5],
"archive": archive.name,
"archive_sha256": "sha256:" + hashlib.sha256(archive.read_bytes()).hexdigest(),
"impact": (
{
"changed": impact["changed"],
"affected": impact["affected"],
"checks_with": impact["checks_with"],
"fallback": impact["fallback"],
"unverified": impact["unverified"],
}
if impact
else None
),
"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`
+274
View File
@@ -0,0 +1,274 @@
"""Recursive impact analysis contract tests (ECO-02 / issue #7).
Builds real temporary Git repositories for two root candidates and asserts the
ordering required by the development contract: changed leaves, reverse
`requires` closure over the union graph, parent domains, then `checks_with`
fixed point; undetermined scope widens to the full candidate instead of being
skipped.
"""
import importlib.util
import os
import subprocess
import tempfile
import unittest
from pathlib import Path
SCRIPT = Path(__file__).resolve().parents[2] / "scripts" / "impact.py"
SPEC = importlib.util.spec_from_file_location("impact", SCRIPT)
impact = importlib.util.module_from_spec(SPEC)
SPEC.loader.exec_module(impact)
GIT_ENV = {
"GIT_AUTHOR_NAME": "test",
"GIT_AUTHOR_EMAIL": "test@example.invalid",
"GIT_COMMITTER_NAME": "test",
"GIT_COMMITTER_EMAIL": "test@example.invalid",
}
def git(cwd, *args, check=True):
env = os.environ.copy()
env.update(GIT_ENV)
result = subprocess.run(
["git", "-C", str(cwd), *args], capture_output=True, env=env
)
if check and result.returncode != 0:
raise AssertionError(
f"git {' '.join(args)} failed: {result.stderr.decode(errors='replace')}"
)
return result.stdout.decode()
def init(path: Path) -> Path:
path.mkdir(parents=True, exist_ok=True)
git(path, "init", "-q")
return path
def write(path: Path, data) -> None:
path.parent.mkdir(parents=True, exist_ok=True)
path.write_bytes(data if isinstance(data, bytes) else data.encode())
def commit(repo: Path, message: str = "fixture") -> str:
git(repo, "add", "-A")
git(repo, "commit", "-q", "-m", message)
return git(repo, "rev-parse", "HEAD").strip()
def component(**fields) -> str:
lines = ["[[component]]"]
for key, value in fields.items():
if isinstance(value, list):
rendered = "[" + ", ".join(f'"{item}"' for item in value) + "]"
else:
rendered = f'"{value}"'
lines.append(f"{key} = {rendered}")
return "\n".join(lines)
def catalog(*components: str) -> str:
return "\n\n".join(components) + "\n"
def leaf(base: Path, name: str, files: dict[str, str]) -> str:
repo = init(base / name)
for relative, data in files.items():
write(repo / relative, data)
return commit(repo)
def root_repo(
path: Path, catalog_text: str, links: dict[str, str], urls: dict[str, str] | None = None
) -> str:
init(path)
write(path / "components.toml", catalog_text)
if urls:
modules = ["[submodule \"x\"]"]
lines = []
for link_path, url in urls.items():
lines.extend([f"\tpath = {link_path}", f"\turl = {url}"])
write(path / ".gitmodules", "\n".join(modules + lines) + "\n")
git(path, "add", ".gitmodules")
git(path, "add", "components.toml")
for link_path, sha in links.items():
git(path, "update-index", "--add", "--cacheinfo", f"160000,{sha},{link_path}")
git(path, "commit", "-q", "-m", "root fixture")
return git(path, "rev-parse", "HEAD").strip()
COMPONENTS_V1 = catalog(
component(id="cli", path="cli", kind="core", state="active", owner="t", scope="s",
requires=[], checks_with=[], release="base"),
component(id="std-core", path="stdlib/core", kind="stdlib", state="active", owner="t",
scope="s", requires=["cli"], checks_with=[], release="base"),
component(id="std-text", path="stdlib/text", kind="stdlib", state="active", owner="t",
scope="s", requires=["cli", "std-core"], checks_with=["probe"], release="base"),
component(id="probe", path="tools/probe", kind="tool", state="active", owner="t",
scope="s", requires=["cli"], checks_with=["std-text"], release="optional"),
component(id="tool", path="tools/tool", kind="tool", state="active", owner="t",
scope="s", requires=["cli"], checks_with=[], release="optional"),
)
class ImpactTest(unittest.TestCase):
def setUp(self):
self.tmp = tempfile.TemporaryDirectory()
self.base = Path(self.tmp.name)
self.root = self.base / "root"
self.original_root = impact.ROOT
def tearDown(self):
impact.ROOT = self.original_root
self.tmp.cleanup()
def make_tree(self, catalog_text: str, leaves: dict[str, str]) -> str:
return root_repo(self.root, catalog_text, {path: leaves[name] for name, path in {
"cli": "cli", "std-core": "stdlib/core", "std-text": "stdlib/text",
"probe": "tools/probe", "tool": "tools/tool",
}.items() if name in leaves})
def leaf_shas(self):
return {
"cli": leaf(self.base, "cli", {"README.md": "cli"}),
"std-core": leaf(self.base, "core", {"modules/core.mq.md": "# core\n"}),
"std-text": leaf(self.base, "text", {"modules/text.mq.md": "# text\n"}),
"probe": leaf(self.base, "probe", {"README.md": "probe"}),
"tool": leaf(self.base, "tool", {"README.md": "tool"}),
}
def analyze(self, first: str, second: str):
impact.ROOT = self.root
return impact.analyze(first, second)
def test_changed_leaf_closes_over_requires_then_checks_with(self):
leaves = self.leaf_shas()
first = self.make_tree(COMPONENTS_V1, leaves)
leaves["std-core"] = leaf(self.base, "core2", {"modules/core.mq.md": "# core v2\n"})
second = root_repo(
self.root,
COMPONENTS_V1,
{
"cli": leaves["cli"],
"stdlib/core": leaves["std-core"],
"stdlib/text": leaves["std-text"],
"tools/probe": leaves["probe"],
"tools/tool": leaves["tool"],
},
)
report = self.analyze(first, second)
self.assertEqual(
[(c["id"], c["reason"]) for c in report["changed"]],
[("std-core", "sha")],
)
self.assertEqual(report["affected"], ["probe", "std-core", "std-text"])
self.assertEqual(report["checks_with"], ["probe"])
self.assertNotIn("tool", report["affected"])
def test_removed_component_and_its_checks_with_partner_are_affected(self):
leaves = self.leaf_shas()
first = self.make_tree(COMPONENTS_V1, leaves)
without_text = catalog(
component(id="cli", path="cli", kind="core", state="active", owner="t",
scope="s", requires=[], checks_with=[], release="base"),
component(id="std-core", path="stdlib/core", kind="stdlib", state="active",
owner="t", scope="s", requires=["cli"], checks_with=[], release="base"),
component(id="probe", path="tools/probe", kind="tool", state="active", owner="t",
scope="s", requires=["cli"], checks_with=["std-text"], release="optional"),
component(id="tool", path="tools/tool", kind="tool", state="active", owner="t",
scope="s", requires=["cli"], checks_with=[], release="optional"),
)
second = root_repo(
self.root,
without_text,
{
"cli": leaves["cli"],
"stdlib/core": leaves["std-core"],
"tools/probe": leaves["probe"],
"tools/tool": leaves["tool"],
},
)
report = self.analyze(first, second)
self.assertIn({"id": "std-text", "reason": "removed"}, report["changed"])
self.assertIn("probe", report["affected"])
def test_dependency_change_is_reported_and_widens_scope(self):
leaves = self.leaf_shas()
first = self.make_tree(COMPONENTS_V1, leaves)
changed_text = COMPONENTS_V1.replace(
'requires = ["cli", "std-core"]', 'requires = ["cli", "std-core", "tool"]'
)
second = self.make_tree(changed_text, leaves)
report = self.analyze(first, second)
self.assertEqual(
[(c["id"], c["reason"]) for c in report["changed"]],
[("std-text", "dependencies")],
)
self.assertIn("std-text", report["affected"])
def test_domain_gitlink_change_expands_to_child_identity(self):
child = init(self.root / "extensions/web")
write(child / "components.toml", catalog(
component(id="web-design", path="design", kind="stdlib", state="planned",
owner="t", scope="s", requires=["cli"], checks_with=[], release="base"),
))
design = leaf(self.base, "design", {"index.mq.md": "# design v1\n"})
git(child, "add", "components.toml")
git(child, "update-index", "--add", "--cacheinfo", f"160000,{design},design")
git(child, "commit", "-q", "-m", "domain v1")
domain_v1 = git(child, "rev-parse", "HEAD").strip()
root_catalog = catalog(
component(id="cli", path="cli", kind="core", state="active", owner="t",
scope="s", requires=[], checks_with=[], release="base"),
component(id="web", path="extensions/web", kind="domain", state="planned",
owner="t", scope="s", requires=[], checks_with=[], release="none"),
)
first = root_repo(
self.root,
root_catalog,
{"cli": leaf(self.base, "cli2", {"README.md": "cli"}), "extensions/web": domain_v1},
{"extensions/web": "https://git.example.invalid/web.git"},
)
design_v2 = leaf(self.base, "design2", {"index.mq.md": "# design v2\n"})
git(child, "update-index", "--cacheinfo", f"160000,{design_v2},design")
git(child, "commit", "-q", "-m", "domain v2")
domain_v2 = git(child, "rev-parse", "HEAD").strip()
second = root_repo(
self.root,
root_catalog,
{"cli": leaf(self.base, "cli3", {"README.md": "cli"}), "extensions/web": domain_v2},
{"extensions/web": "https://git.example.invalid/web.git"},
)
report = self.analyze(first, second)
self.assertIn("web", [c["id"] for c in report["changed"]])
self.assertIn("web-design", [c["id"] for c in report["changed"]])
self.assertIn("web-design", report["affected"])
def test_unexpandable_domain_widens_to_full_scope(self):
root_catalog = catalog(
component(id="cli", path="cli", kind="core", state="active", owner="t",
scope="s", requires=[], checks_with=[], release="base"),
component(id="web", path="extensions/web", kind="domain", state="planned",
owner="t", scope="s", requires=[], checks_with=[], release="none"),
)
cli = leaf(self.base, "cli4", {"README.md": "cli"})
first = root_repo(
self.root, root_catalog,
{"cli": cli, "extensions/web": leaf(self.base, "web1", {"README.md": "web"})},
{"extensions/web": "https://git.example.invalid/web.git"},
)
second = root_repo(
self.root, root_catalog,
{"cli": cli, "extensions/web": leaf(self.base, "web2", {"README.md": "web2"})},
{"extensions/web": "https://git.example.invalid/web.git"},
)
# The root fixture points at a plain repository without a components.toml.
report = self.analyze(first, second)
self.assertTrue(report["unverified"])
self.assertEqual(report["fallback"], "full")
self.assertEqual(report["affected"], ["cli", "web"])
if __name__ == "__main__":
unittest.main()