Skip to content

[enhancement] xpkg 描述符 mcpp 段未知键静默忽略(dependencies 误写无诊断,deps 才是正确键) #237

Description

@Sunrisepeak

现象

xpkg 描述符 mcpp = { ... } 段中的未知键被静默忽略,没有任何警告或报错。

实际踩坑路径:声明包间依赖时把 deps 误写成 dependencies(TOML manifest 里是
[dependencies],很自然地带过来),结果依赖被整体丢弃,报错发生在下游很远处
——依赖包的头文件找不到:

mcpp = {
    language = "c++23",
    include_dirs = { "gena" },
    sources = { "gena/toya.cpp" },
    dependencies = { ["compat.toyb"] = "0.1.0" },  -- 静默忽略;正确拼写是 deps
    ...
}
fatal error: toyb.h: No such file or directory

从报错完全看不出是描述符键拼错。(deps = { ["compat.toyb"] = "0.1.0" } 一切正常
——0.0.97 的 compat-依赖-compat 链路本身验证是通的,传递解析/头传播/链接闭包都对。)

期望

与 0.0.97 给 manifest 加的 closed-grammar 守卫([[x]] 非白名单段硬报错)对齐:
描述符 mcpp 段遇到未知键至少 warning,理想是硬报错(键集合是封闭的,
src/manifest/xpkg.cppm 的 else-if 链就是白名单)。dependencies 可特判提示
"did you mean deps"。

环境

mcpp 0.0.97 · linux x86_64

Activity

  1. Sunrisepeak commented on Jul 18, 2026

    @Sunrisepeak
    MemberAuthor

    补充实证(发完 issue 后发现):mcpp xpkg parse 对未知键已经硬报错——error: unknown mcpp-segment key 'dependencies' — silently ignored at build time by this mcpp version,且 mcpp-index 的 lint job 就走这条路,所以发布路径上这个坑已被拦住。剩余的口子只是 mcpp build 消费未 lint 过的描述符(本地 path index 开发场景)时静默忽略——如果这是 forward-compat 的刻意取舍,本 issue 可以直接关闭;否则可收窄为「build 时对未知键打一条 warning」。

  2. added 5 commits that reference this issue on Jul 18, 2026
  3. Sunrisepeak commented on Jul 18, 2026

    @Sunrisepeak
    MemberAuthor

    Fixed in 0.0.98 (#245). Unknown mcpp-segment keys now warn at build time with a did-you-mean (dependencies→deps); unit test XpkgUnknownKeys.CollectedAndDidYouMean.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions