diff --git a/.agents/docs/2026-11-21-mcpp-build-plugin-naming-plan.md b/.agents/docs/2026-11-21-mcpp-build-plugin-naming-plan.md index 0e10a662..46c264e1 100644 --- a/.agents/docs/2026-11-21-mcpp-build-plugin-naming-plan.md +++ b/.agents/docs/2026-11-21-mcpp-build-plugin-naming-plan.md @@ -259,7 +259,7 @@ T0 评审 | T1 + T4 mcpp-index | 合并为一个 PR #868(3057883):文档 + lint + `pkgs/mcpp/` 的第一个文件 + 老包冻结 + 成员 + 验收步骤;CI 全部通过(含 CI 固定的 mcpp 2026.11.18.1 上跑 `slint-rule`、`slint-ui`) | | 发布验收 | 索引发布后,`check_installed_template.py --published-index` 在 GLOBAL 与 CN 两个镜像上冷装 `mcpplibs.mwrap.slint@1.19.0.3`:hello 模板无头 counter = 3,7 个许可证文件逐字节一致,重定位后的应用包通过;新 id `mcpplibs.mplugin.slint@1.19.0` 从已发布索引直接解析并运行;冻结的 `mcpplibs.slintgen@1.19.0.2` 仍可解析、构建 | | T5 mcpp issue | 一个 issue:mcpp-community/mcpp#993(只提 issue,没有 PR) | -| T2 官方两包搬迁 | **推后,未做。** 原因:索引的下限 `min_mcpp = "2026.9.18.3"` 早于 mwrap 目录(2026-10-25)的引入,没有验证过下限版本的客户端能否从 `pkgs/mcpp/` 找到已有的 `mcpp.plugins`;它被几乎所有工程使用,而搬迁没有使用方的收益。新包不受影响(旧客户端本来就不会请求它们)。若要做:先在 2026.9.18.3 上用 `pkgs/mcpp/` 的索引解析 `mcpp.plugins`,再单独开 PR;mcpp-plugins 的 README(155 行)也引用了 `pkgs/m/mcpp.plugins.lua`,要同步 | +| T2 官方两包搬迁 | 单独的 PR:`mcpp.plugins`、`mcpp.platforms` 纯 `git mv` 进 `pkgs/mcpp/`;成员选择搬迁前后一致(`select_members.py`);全量 CI(CI 固定的 mcpp 上跑所有用到 mcpp.plugins 的成员)通过后合入。**残余风险:** 索引下限 `min_mcpp = 2026.9.18.3` 的客户端是否按身份扫描子目录没有直接验证(我用下限客户端做的本地实验没有读到候选索引,改坏校验和也照常成功,所以没有判别力);依据是 `docs/mwrap.md` 对客户端行为的说明、`pkgs/mwrap/` 同样依赖这一点、以及固定版本与最新版本上的实测。mcpp-plugins 的 README(155 行)引用旧路径,要同步 | 对 §6 的回写: - **U1**(客户端从 `pkgs/mcpp/` 解析):已确认,在 CI 固定的 mcpp 与已发布的索引上都成功。 diff --git a/CHANGELOG.md b/CHANGELOG.md index 3e845d5e..9cfdb5e3 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -9,6 +9,7 @@ ### Added +- **官方的 mcpp.plugins 与 mcpp.platforms 搬进 `pkgs/mcpp/`**(纯重命名,文件名不变,已发布的行字节不变;构建插件规范 docs/build-plugins.md 的布局)。成员选择按身份匹配,搬迁前后选出的成员集合一致(`tests/select_members.py`);客户端按描述符声明的身份扫描 `pkgs` 的子目录,与 `pkgs/mwrap/` 相同。 - **构建插件的命名与布局规范(docs/build-plugins.md)与第一个新形态的包 mcpplibs.mplugin.slint 1.19.0。** 构建插件的 id 是 `.mplugin.`,模块名与 C++ 命名空间就是这个 id(`mcpplibs.mplugin.slint`、`mcpplibs::mplugin::slint`),`mcpp.*` 保留给官方;`mplugin` 是种类段,如同封装包的 `mwrap`,所以引擎不被遮蔽,规则代码直接写 `mcpp::…`,在 CI 固定的 mcpp(2026.11.18.1)上实测零警告。描述符放在新目录 `pkgs/mcpp/`(完整 id 作文件名;目录是 mcpp 自己加载的包,身份仍以描述符声明为准)。新增 lint:`tests/check_mplugin_layout.lua`(`.mplugin` ↔ `pkgs/mcpp/`,owner 与 name 是标识符);`check_reserved_namespace.lua` 另拒绝 owner 为 `mcpp`、保留名、`platforms` 与种类段(`tests/test_check_mplugin.py`)。`mcpplibs.mplugin.slint@1.19.0` 的归档是 slint-m 的 `mwrap-1.19.0.3`(同一字节、GLOBAL 与 CN),规则版本与封装包修订脱钩;`mcpplibs.mwrap.slint@1.19.0.3` 把规则 reexport,使用方仍只依赖封装包。成员 tests/mwrap/slint-rule 只测 build.mcpp 对该描述符的解析与规则运行(构建包与库包分开测)。设计与实施计划见 `.agents/docs/2026-11-21-mcpp-build-plugin-naming-plan.md`。 - **mcpplibs.slintgen 冻结:** 被 mcpplibs.mplugin.slint 取代;1.19.0.1 与 1.19.0.2 的行与归档保持原样、仍可使用,不再有新版本,描述写明 FROZEN。写了老 id 的工程改依赖名即可迁移;只依赖封装包的工程不受影响。 - **compat.slint 声明它以 `dlopen` 加载的库。** libslint_cpp 的 winit 与 femtovg 后端加载的 X11、xcb、Xcursor、Xi、Xrender、 diff --git a/pkgs/m/mcpp.platforms.lua b/pkgs/mcpp/mcpp.platforms.lua similarity index 100% rename from pkgs/m/mcpp.platforms.lua rename to pkgs/mcpp/mcpp.platforms.lua diff --git a/pkgs/m/mcpp.plugins.lua b/pkgs/mcpp/mcpp.plugins.lua similarity index 100% rename from pkgs/m/mcpp.plugins.lua rename to pkgs/mcpp/mcpp.plugins.lua diff --git a/pkgs/r/rules-cuda.lua b/pkgs/r/rules-cuda.lua index 7136295c..a697e027 100644 --- a/pkgs/r/rules-cuda.lua +++ b/pkgs/r/rules-cuda.lua @@ -1,5 +1,5 @@ -- SUPERSEDED (2026-09-05). The CUDA rule now lives in the official plugin --- collection `mcpp:plugins` (pkgs/m/mcpp.plugins.lua) as `mcpp.rules.cuda`, +-- collection `mcpp:plugins` (pkgs/mcpp/mcpp.plugins.lua) as `mcpp.rules.cuda`, -- selected by the feature `rules-cuda`. This descriptor stays so a project -- pinned to mcpplibs:rules-cuda@0.1.0 keeps resolving; nothing new depends -- on it, and it receives no further versions. diff --git a/tests/autoupdate/ci.py b/tests/autoupdate/ci.py index 4cdf6c49..12dcc20e 100644 --- a/tests/autoupdate/ci.py +++ b/tests/autoupdate/ci.py @@ -24,6 +24,23 @@ def base_descriptors(base: str) -> set[str]: return {name for name in files.splitlines() if name.endswith(".lua")} +def moved_descriptors(base: str) -> dict[str, str]: + """New path -> old path of the descriptors git sees as renamed since `base`. + + A descriptor's identity is what it declares, not where its file is: a move + (the official packages into pkgs/mcpp/, docs/build-plugins.md) keeps every + published version, and is audited against the file it came from.""" + out = subprocess.check_output( + ["git", "diff", "--name-status", "-M", "--diff-filter=R", base, "HEAD", "--", "pkgs"], + cwd=ROOT, text=True) + moved = {} + for line in out.splitlines(): + _status, old, new = line.split("\t") + if old.endswith(".lua") and new.endswith(".lua"): + moved[new] = old + return moved + + def immutable_commit_snapshot(info: dict) -> bool: """Commit archives have no release-version substitution to automate.""" urls = [] @@ -52,12 +69,14 @@ def audit(base: str, output: Path): manual = [] previous = base_descriptors(base) infos = inventory(ROOT) - removed = previous - {info["path"] for info in infos} + moved = moved_descriptors(base) + removed = previous - {info["path"] for info in infos} - set(moved.values()) if removed: raise RuntimeError(f"existing descriptors removed: {sorted(removed)}") for info in infos: - if info["path"] in previous: - before = subprocess.check_output(["git", "show", f"{base}:{info['path']}"], cwd=ROOT).decode() + origin = moved.get(info["path"], info["path"]) + if origin in previous: + before = subprocess.check_output(["git", "show", f"{base}:{origin}"], cwd=ROOT).decode() # `revision` exists to replace a payload under an unchanged # version, so it must be allowed to change that version block. # Applying the updater's byte-for-byte append-only guard here would diff --git a/tests/autoupdate/test_ci.py b/tests/autoupdate/test_ci.py index e746dcd9..869d64dc 100644 --- a/tests/autoupdate/test_ci.py +++ b/tests/autoupdate/test_ci.py @@ -239,6 +239,30 @@ def test_added_descriptor_and_removed_historical_descriptor(self): with self.assertRaisesRegex(RuntimeError, "existing descriptors removed"): ci.audit("HEAD", root / "coverage.json") + def test_a_moved_descriptor_is_audited_against_the_file_it_came_from(self): + with tempfile.TemporaryDirectory() as directory: + root = Path(directory) + pkgs = root / "pkgs/f" + pkgs.mkdir(parents=True) + (pkgs / "compat.old.lua").write_text(descriptor("old")) + git = lambda *args: subprocess.run( + ["git", "-c", "user.name=Test", "-c", "user.email=test@example.com", *args], + cwd=root, check=True, capture_output=True) + for args in (("init",), ("add", "."), ("commit", "-m", "baseline")): + git(*args) + with patch.object(ci, "ROOT", root): + # Moved with every row kept: fine. + (root / "pkgs/mcpp").mkdir() + git("mv", "pkgs/f/compat.old.lua", "pkgs/mcpp/compat.old.lua") + git("commit", "-m", "move") + ci.audit("HEAD~1", root / "coverage.json") + # Moved and a published version dropped: still refused. + moved = root / "pkgs/mcpp/compat.old.lua" + moved.write_text(moved.read_text().replace('["1.0.0"]', '["9.9.9"]')) + git("commit", "-am", "drop a version") + with self.assertRaisesRegex(RuntimeError, "existing version removed"): + ci.audit("HEAD~2", root / "coverage.json") + def test_revision_allows_packaging_fix_but_not_resource_drift(self): with tempfile.TemporaryDirectory() as directory: root = Path(directory)