Skip to content

chore: migrate descriptors to SPEC-001 short-name identity (mcpp 0.0.106)#120

Open
Sunrisepeak wants to merge 3 commits into
mainfrom
chore/spec001-short-name-migration
Open

chore: migrate descriptors to SPEC-001 short-name identity (mcpp 0.0.106)#120
Sunrisepeak wants to merge 3 commits into
mainfrom
chore/spec001-short-name-migration

Conversation

@Sunrisepeak

Copy link
Copy Markdown
Member

What

mcpp 0.0.106 restores the canonical identity form: namespace carries the hierarchy, name is a single atomic segment.

namespace = "compat", name = "compat.zlib"   ->   name = "zlib"

45 descriptors migrated. The 3 namespace-less public module packages (imgui / ffmpeg / opencv) are unchanged — a bare name IS their full identity.

Why the rule flipped

0.0.105 briefly required the opposite (name spelled as the fully-qualified <namespace>.<name>). That was an encoding constraint, not a design rule — it existed only because mcpp re-derived the wire name instead of using the literal package.name it had already read. 0.0.106 uses the literal, and the constraint disappears.

Full normative text: mcpp docs/spec/package-identity.md (SPEC-001), landed in mcpp-community/mcpp#280.

Three short names now repeat across namespaces

imgui, ffmpeg and lua — compat's versus the default namespace's, and compat's lua versus mcpplibs.capi's.

That is legal: identity is the PAIR, and only the pair must be unique. It needs xlings >= 0.4.69 (openxlings/xlings#381), which keys the index by (namespace, name); mcpp 0.0.106 bundles it.

Verified against a local path index built from this branch:

request resolves to store dir
[dependencies] imgui mcpplibs:imgui mcpplibs-x-imgui
[dependencies.compat] imgui compat:imgui compat-x-imgui

No ambiguity — the namespace-less descriptors take the index's default namespace, so the pairs differ.

Lint inverted to match

check_package_name.lua now requires name to be atomic and the hierarchy to live in namespace. The legacy fully-qualified spelling stays accepted (the prefix is stripped before judging), so nothing published before this is invalidated — this repo simply no longer uses it.

No filename lint: the filename is not part of identity. mcpp 0.0.106 discovers descriptors by declared identity, falling back to a scan when the recommended names miss, so a descriptor may be called anything. <name>.lua / <namespace>.<name>.lua remain recommended because they hit the fast path.

Floor bump is NOT optional

min_mcpp / latest_mcpp0.0.106, in lock-step with the CI pin. A client older than 0.0.106 re-derives <ns>.<short>, misses the short-name key, and reports a bare E_NOT_FOUND with nothing pointing at the cause. The index.toml floor is what turns that into a clear E0006 upgrade message instead.

Verification

Run locally against the actually released mcpp 0.0.106 (xlings install mcpp@0.0.106, bundling xlings 0.4.69):

  • 48/48 descriptors pass lua syntax, mirror-URL, identity lint and mcpp xpkg parse.
  • Identity pairs (namespace, name) are unique; no name still carries a dot.
  • Counterexamples behave as specified: non-atomic short name rejected, dotted name without a namespace rejected, legacy FQN accepted.

Docs: docs/repository-and-schema.md gains a 包身份 section (rules, the three same-short-name pairs, why filenames are free-form); CI-behaviour and local-lint sections updated.

…106)

mcpp 0.0.106 restores the canonical identity form: `namespace` carries the
hierarchy, `name` is a single atomic segment. 0.0.105 briefly required the
opposite (name spelled as the fully-qualified `<namespace>.<name>`), which was
an encoding constraint rather than a design rule — it existed only because mcpp
re-derived the wire name instead of using the literal it had already read.

  namespace = "compat", name = "compat.zlib"   ->   name = "zlib"

45 descriptors migrated; the 3 namespace-less public module packages
(imgui/ffmpeg/opencv) are unchanged — a bare name IS their full identity.

Three short names now repeat across namespaces: `imgui`, `ffmpeg` and `lua`
(compat's versus the default namespace's, and compat's `lua` versus
mcpplibs.capi's). That is legal — identity is the PAIR, and only the pair has
to be unique. It needs xlings >= 0.4.69 (openxlings/xlings#381), which keys the
index by (namespace, name); 0.0.106 bundles it. Verified against a local path
index: bare `imgui` resolves to `mcpplibs:imgui` and `[dependencies.compat]
imgui` resolves to `compat:imgui`, each installing to its own store dir.

check_package_name.lua is inverted to match: `name` must be atomic, hierarchy
belongs in `namespace`, and the legacy fully-qualified spelling stays accepted
(the prefix is stripped before judging) so nothing published before this is
invalidated. No filename lint — the filename is not part of identity.

min_mcpp/latest_mcpp move to 0.0.106 in lock-step with the CI pin. This one is
NOT optional: a client older than 0.0.106 re-derives `<ns>.<short>`, misses the
short-name key, and reports a bare E_NOT_FOUND with nothing pointing at the
cause.

Verified locally: all 48 descriptors pass the inverted lint; identity pairs are
unique; no `name` still carries a dot; the three counterexamples (non-atomic
short name, dotted name without a namespace, legacy FQN) each behave as
specified.
CI caught a real conflict the short-name migration introduced:

    build_index failed: duplicate package identity 'compat:ffmpeg'

`imgui`, `ffmpeg` and `opencv` declared `namespace = ""`, meaning "inherit the
index's default namespace". 11 workspace members register this repo as
`[indices] compat = { path = ... }`, so under those members the repo default IS
`compat` — and the namespace-less descriptors became `compat:ffmpeg` /
`compat:imgui`, colliding head-on with the freshly shortened `compat.ffmpeg`
and `compat.imgui`.

The migration exposed it, but the fragility is older and independent of it: a
namespace-less descriptor's identity depends on the NAME THE CONSUMER HAPPENS
TO REGISTER THE INDEX UNDER. The same repo mounted as `compat` and as `default`
gives those three packages two different identities. That is exactly what
SPEC-001 exists to remove — identity should be what the descriptor declares.

So rather than reverting the two colliding descriptors to the legacy spelling
(which would have unblocked CI while leaving the trap armed), declare the
namespace outright:

    namespace = "",          name = "imgui"     ->   namespace = "mcpplibs"

Identity is now context-free. Verified by simulating all three registration
styles (repo default = mcpplibs / compat / default): zero duplicate identities
in every case, where before `compat` produced two.

Consumers are unaffected: a bare `imgui` still resolves via the default-namespace
search path, and `[dependencies.compat] imgui` still resolves to compat's.
Checked against the released mcpp 0.0.106 with the index mounted as `compat` —
builds clean, no duplicate-identity error.

48/48 descriptors still pass the lua lint and `mcpp xpkg parse`.
…gration

Shortening every `package.name` (SPEC-001) also changed how a descriptor must
ADDRESS another package: `pkginfo.install_dir("compat:xcb-proto")`, not the old
`compat:compat.xcb-proto`. Two install hooks kept the old spelling, and neither
failed where the mistake was:

  * compat.xcb could not find xcb-proto's XML, so c_client.py never ran and the
    install aborted with a bare `[xcb] failed`. libxcb.so was never built, and
    CI reported it three levels downstream as
    `libX11.so: undefined reference to xcb_connection_has_error` in gui-stack,
    imgui-module and imgui-window.

  * compat.x11 only checked the lookup for nil, never `os.isdir`, so it carried
    on with a directory that does not exist and generated its keysym tables from
    no headers at all — silently, with a successful build.

Both now try the SPEC-001 spelling first and keep the pre-SPEC-001 ones as
fallbacks, so these descriptors still resolve against an unmigrated index.
compat.x11 gets the same isdir guard compat.xcb already had.

Add tests/check_cross_package_refs.lua to the lint job: it resolves every
`pkginfo.install_dir`/`build_dep` string against the identities the repository
actually declares. A reference into a foreign namespace (xim:python) is skipped,
and a ladder of spellings only needs one that resolves, so legacy fallbacks stay
legal. Matching is against the literal `package.name`, deliberately not a
normalised form — normalising the dots away would have called the broken
reference resolvable.

Verified with mcpp 0.0.106 against this branch: gui-stack 5/5, imgui-module 1/1,
imgui-window 1/1. Reverting the descriptor fix makes the lint flag exactly these
two references and nothing else.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant