Skip to content

Commit 30ce01c

Browse files
Sunrisepeakclaude
andauthored
Official mcpp.plugins and mcpp.platforms move into pkgs/mcpp/ (plan T2); the descriptor audit follows a move (#870)
* Official mcpp.plugins and mcpp.platforms move into pkgs/mcpp/ (plan T2) A pure rename: file names and published rows are unchanged. The member selection is by identity and selects the same members before and after (tests/select_members.py). Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com> * The descriptor audit follows a move: a renamed descriptor is audited against the file it came from tests/autoupdate/ci.py refused any removed descriptor path, so the official packages could not move into pkgs/mcpp/ although every published version was kept. git's rename detection maps the new path to the old one and the version checks run against it; a deletion, or a move that drops a version, is still refused (tests/autoupdate/test_ci.py). Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com> --------- Co-authored-by: Claude Sonnet 5.5 <noreply@anthropic.com>
1 parent 708522b commit 30ce01c

7 files changed

Lines changed: 49 additions & 5 deletions

File tree

‎.agents/docs/2026-11-21-mcpp-build-plugin-naming-plan.md‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -259,7 +259,7 @@ T0 评审
259259
| T1 + T4 mcpp-index | 合并为一个 PR #868(3057883):文档 + lint + `pkgs/mcpp/` 的第一个文件 + 老包冻结 + 成员 + 验收步骤;CI 全部通过(含 CI 固定的 mcpp 2026.11.18.1 上跑 `slint-rule`、`slint-ui`) |
260260
| 发布验收 | 索引发布后,`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` 仍可解析、构建 |
261261
| T5 mcpp issue | 一个 issue:mcpp-community/mcpp#993(只提 issue,没有 PR) |
262-
| 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`,要同步 |
262+
| 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 行)引用旧路径,要同步 |
263263

264264
对 §6 的回写:
265265
- **U1**(客户端从 `pkgs/mcpp/` 解析):已确认,在 CI 固定的 mcpp 与已发布的索引上都成功。

‎CHANGELOG.md‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99

1010
### Added
1111

12+
- **官方的 mcpp.plugins 与 mcpp.platforms 搬进 `pkgs/mcpp/`**(纯重命名,文件名不变,已发布的行字节不变;构建插件规范 docs/build-plugins.md 的布局)。成员选择按身份匹配,搬迁前后选出的成员集合一致(`tests/select_members.py`);客户端按描述符声明的身份扫描 `pkgs` 的子目录,与 `pkgs/mwrap/` 相同。
1213
- **构建插件的命名与布局规范(docs/build-plugins.md)与第一个新形态的包 mcpplibs.mplugin.slint 1.19.0。** 构建插件的 id 是 `<owner>.mplugin.<name>`,模块名与 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`(`<owner>.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`。
1314
- **mcpplibs.slintgen 冻结:** 被 mcpplibs.mplugin.slint 取代;1.19.0.1 与 1.19.0.2 的行与归档保持原样、仍可使用,不再有新版本,描述写明 FROZEN。写了老 id 的工程改依赖名即可迁移;只依赖封装包的工程不受影响。
1415
- **compat.slint 声明它以 `dlopen` 加载的库。** libslint_cpp 的 winit 与 femtovg 后端加载的 X11、xcb、Xcursor、Xi、Xrender、

‎pkgs/r/rules-cuda.lua‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
-- SUPERSEDED (2026-09-05). The CUDA rule now lives in the official plugin
2-
-- collection `mcpp:plugins` (pkgs/m/mcpp.plugins.lua) as `mcpp.rules.cuda`,
2+
-- collection `mcpp:plugins` (pkgs/mcpp/mcpp.plugins.lua) as `mcpp.rules.cuda`,
33
-- selected by the feature `rules-cuda`. This descriptor stays so a project
44
-- pinned to mcpplibs:rules-cuda@0.1.0 keeps resolving; nothing new depends
55
-- on it, and it receives no further versions.

‎tests/autoupdate/ci.py‎

Lines changed: 22 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,23 @@ def base_descriptors(base: str) -> set[str]:
2424
return {name for name in files.splitlines() if name.endswith(".lua")}
2525

2626

27+
def moved_descriptors(base: str) -> dict[str, str]:
28+
"""New path -> old path of the descriptors git sees as renamed since `base`.
29+
30+
A descriptor's identity is what it declares, not where its file is: a move
31+
(the official packages into pkgs/mcpp/, docs/build-plugins.md) keeps every
32+
published version, and is audited against the file it came from."""
33+
out = subprocess.check_output(
34+
["git", "diff", "--name-status", "-M", "--diff-filter=R", base, "HEAD", "--", "pkgs"],
35+
cwd=ROOT, text=True)
36+
moved = {}
37+
for line in out.splitlines():
38+
_status, old, new = line.split("\t")
39+
if old.endswith(".lua") and new.endswith(".lua"):
40+
moved[new] = old
41+
return moved
42+
43+
2744
def immutable_commit_snapshot(info: dict) -> bool:
2845
"""Commit archives have no release-version substitution to automate."""
2946
urls = []
@@ -52,12 +69,14 @@ def audit(base: str, output: Path):
5269
manual = []
5370
previous = base_descriptors(base)
5471
infos = inventory(ROOT)
55-
removed = previous - {info["path"] for info in infos}
72+
moved = moved_descriptors(base)
73+
removed = previous - {info["path"] for info in infos} - set(moved.values())
5674
if removed:
5775
raise RuntimeError(f"existing descriptors removed: {sorted(removed)}")
5876
for info in infos:
59-
if info["path"] in previous:
60-
before = subprocess.check_output(["git", "show", f"{base}:{info['path']}"], cwd=ROOT).decode()
77+
origin = moved.get(info["path"], info["path"])
78+
if origin in previous:
79+
before = subprocess.check_output(["git", "show", f"{base}:{origin}"], cwd=ROOT).decode()
6180
# `revision` exists to replace a payload under an unchanged
6281
# version, so it must be allowed to change that version block.
6382
# Applying the updater's byte-for-byte append-only guard here would

‎tests/autoupdate/test_ci.py‎

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -239,6 +239,30 @@ def test_added_descriptor_and_removed_historical_descriptor(self):
239239
with self.assertRaisesRegex(RuntimeError, "existing descriptors removed"):
240240
ci.audit("HEAD", root / "coverage.json")
241241

242+
def test_a_moved_descriptor_is_audited_against_the_file_it_came_from(self):
243+
with tempfile.TemporaryDirectory() as directory:
244+
root = Path(directory)
245+
pkgs = root / "pkgs/f"
246+
pkgs.mkdir(parents=True)
247+
(pkgs / "compat.old.lua").write_text(descriptor("old"))
248+
git = lambda *args: subprocess.run(
249+
["git", "-c", "user.name=Test", "-c", "user.email=test@example.com", *args],
250+
cwd=root, check=True, capture_output=True)
251+
for args in (("init",), ("add", "."), ("commit", "-m", "baseline")):
252+
git(*args)
253+
with patch.object(ci, "ROOT", root):
254+
# Moved with every row kept: fine.
255+
(root / "pkgs/mcpp").mkdir()
256+
git("mv", "pkgs/f/compat.old.lua", "pkgs/mcpp/compat.old.lua")
257+
git("commit", "-m", "move")
258+
ci.audit("HEAD~1", root / "coverage.json")
259+
# Moved and a published version dropped: still refused.
260+
moved = root / "pkgs/mcpp/compat.old.lua"
261+
moved.write_text(moved.read_text().replace('["1.0.0"]', '["9.9.9"]'))
262+
git("commit", "-am", "drop a version")
263+
with self.assertRaisesRegex(RuntimeError, "existing version removed"):
264+
ci.audit("HEAD~2", root / "coverage.json")
265+
242266
def test_revision_allows_packaging_fix_but_not_resource_drift(self):
243267
with tempfile.TemporaryDirectory() as directory:
244268
root = Path(directory)

0 commit comments

Comments
 (0)