Repository navigation
feat(xvm): add provider-scoped binding group registration - #384
Merged
Merged
Conversation
This was referenced Jul 26, 2026
Sunrisepeak
added a commit
that referenced
this pull request
Jul 26, 2026
* docs(agents): xvm group transaction review, design and plan Add the PR #384 review, the target architecture, and the staged implementation plan for the 0.4.70 release train. - review: verify the five root causes against origin/main, record two silent regressions (includedir no longer written, headers never carry a group), the removal-fallback coherence gap, and the before/after user-experience comparison - design: three-layer state model (Catalog / Selection / Materialization), group promoted to a top-level table, commit-then-reconcile so the filesystem stops participating in the transaction, doctor as the reconciler - plan: single release/0.4.70 integration branch, P0-P4 plus an R integration stage, 18 scenario-level acceptance assertions, and a seamless-upgrade contract (U1-U7) including downgrade safety * docs(agents): record the CI prerequisites the plan had assumed The plan assumed a PR landing on the integration branch would be gated by CI. It was not: all six workflows only triggered on main/master, so a PR based on release/0.4.70 got no checks at all. A second, pre-existing problem surfaced next -- every workflow restored an ~800 MB mcpp cache and then deleted the payload directory it had just restored. Add P-1 covering both (fixed in #386) plus the unresolved upstream fetch instability, and note that it gates R.3's three-platform-green requirement without changing that requirement. * docs(agents): bound the merge exception during the upstream outage CI cannot go green while P-1.3 lasts, and review of intermediate PRs is delegated. Both facts need a written boundary so 'upstream is broken' does not become a general waiver. Allow a PR to land on the integration branch only when the local build and test suite are green AND the CI failure carries the known upstream fetch signature, before any of this repo's code is compiled. Any other failure signature still blocks. R.3 is unchanged: the branch has to be re-run green on all three platforms before it is proposed to main, so this defers verification rather than skipping it.
Sunrisepeak
marked this pull request as ready for review
July 26, 2026 06:50
Member
Author
合入集成分支 — 本地验证记录依 #385 计划 §3.1.1(上游故障期的有界合入例外)合入 本地验证(干净的 detached worktree,
|
This was referenced Jul 26, 2026
Sunrisepeak
added a commit
that referenced
this pull request
Jul 26, 2026
The selection layer fails closed, so a malformed or dangling release makes `xlings use` refuse. That is correct, but doctor only knew about shims and payloads, so the refusal was a dead end: nothing in xlings could name the offending entry and the user was left reading versions.json by hand. Add xvm::inspect_binding_state, a pure function over (db, workspace) that checks the invariants the selection layer relies on: every active version is registered every release resolves, with all members present members of one release are active together, or not at all Each finding carries the XvmUserError code, the entry, the JSON Pointer when the problem is metadata-level, and a hint naming the command that fixes it. A release short one member is reported once, not once per member. Pre-0.4.70 databases carry no group metadata and are not flagged. Pure by construction -- no Config, no filesystem, no network -- so every case is reachable from a unit test and doctor stays a renderer. Read-only. Repair lands separately: deactivating a group or dropping metadata should be spelled out before it happens. Not included, and worth recording why. The plan called for bindingIntegrityIssues to stop being serialized, on the grounds that derived data should not become stored state. Implementing it failed seven tests from #384 that assert the opposite, and they are right: an entry whose bindingGroup did not parse holds no group in memory, so rewriting the record without the marker would drop the malformed value entirely and silently launder a corrupt entry into a healthy group-less one -- back to the mixed-toolchain risk, with nothing left to show it happened. The real defect is that rewriting an unparsed record loses information either way; fixing it means preserving the original JSON for such entries, which is its own change.
This was referenced Jul 26, 2026
Sunrisepeak
added a commit
that referenced
this pull request
Jul 26, 2026
…includedir (#406) `bindingHeaders` records every header directory a release declares, on the group root, and #384 serialized it, parsed it, validated it and round-tripped it through the version database. Nothing ever read it. Materialization went through `VData::includedir` instead -- a single string the installer writes on the root with last-op-wins semantics. For a release declaring one header directory the two agree. For one declaring two they do not: install materializes both, because it walks the effect list, while `xlings use` only ever remembers the last. Switching away left the other directories' headers in the sysroot and switching in never brought the new release's copies. The sysroot held a mix of two releases -- the exact state the binding-group work exists to make unrepresentable, reached through the header path instead of the member path. `xvm::group_header_assets(db, target, version)` resolves any member of a release to the group's declared list, falling back to `includedir` when there is none -- 0.4.69 state has no `bindingHeaders`, and neither does a registration outside a provider group. The switch planner, the removal teardown and the removal fallback all go through it. Header assets also move from MemberSwitch to UseSwitchPlan, because they belong to the release rather than to any member of it. Per-member lists would link the same directory once per member, and -- worse -- the loop applied them one member at a time, so member B's removal of the outgoing release could delete links member A had just installed for the incoming one, for every header name the two versions share. Which, for two versions of one toolchain, is all of them. The plan now carries the two lists deduplicated and disjoint, and `cmd_use` applies all removals before any install. `destinationPrefix` is honored too. No recipe can set it today -- libxpkg's `xvm.setup` takes a bare `includedir` -- but it is part of the persisted model and round-trips, and a serialized field materialization ignores is what this change is removing, not adding. `attach_legacy_header_dir` still writes `includedir`, now for one reason only: 0.4.69 switches headers by reading it and knows nothing about `bindingHeaders`, so dropping it would make a downgrade silently stop moving headers. The release notes promise the rollback is safe. Reachability, stated plainly: no recipe in the official index declares header directories at all, and `xvm.setup` can only declare one per call (a second call is refused as a duplicate registration). So the multiplicity this fixes is currently unreachable through the public recipe API. The E2E fixture pushes the second op onto `_XVM_OPS` directly to exercise it. Verified: 6 new unit cases (XvmGroupHeaders) + 2 for the destination prefix; E2E-32 extended with a second header directory. Reverting the resolver fails 3 of the unit cases and E2E-32 scenario 2, which reports the sysroot holding 1.0.0's `include/` while the workspace and `include-fixed/` are on 2.0.0.
Sunrisepeak
added a commit
that referenced
this pull request
Jul 27, 2026
* fix(xvm): let doctor repair a dangling legacy binding edge
Found by finally running the real-toolchain check the plan had carried from
the start and never executed. On a real installation:
0.4.68 xlings use gcc 15.1.0 -> gcc -> 15.1.0
2026.7.27.0 xlings use gcc 15.1.0 -> refused,
"a member of this release is registered at no such
version"; nothing was changed
`[email protected]` carries a pairwise binding edge to `[email protected]`, an
anchor registered only at 16.1.0. The fail-closed resolution added in #384 is
right to refuse an unresolvable release -- what was missing is any way out.
`doctor` did not report it, because its INV-4 pass only inspects entries that
carry a `bindingGroup` and everything written before 0.4.70 does not. `--fix`
could not repair it. The hint said "reinstall the package", which works but
is a heavy answer to a stale edge, and nothing pointed the user at it. For an
upgrade sold as seamless, that is the opposite.
An edge whose destination version does not exist carries no information: it
cannot name a member anyone could switch to, it can only cause a refusal. So
dropping it is repair without guessing, which is exactly what separates it
from the incoherent-release case that `--fix` deliberately will not resolve.
doctor now reports these as `xvm-legacy-edge-dangling` and `--fix` drops
them, before the deactivation pass so that pass does not see this problem
wearing another shape.
Deliberately narrow: an edge recorded under a version that is *also* absent
is left alone. Resolution always starts from a real (target, version), so
such an edge is unreachable and cannot cause the refusal this fixes. On the
same real installation that is 12 of 32 -- inert, and touching them would be
cleanup rather than repair.
Measured on that installation: 20 edges dropped, `use gcc 15.1.0` works
again, and 16.1.0 still resolves as a two-member release rather than
collapsing into standalone entries.
Verified: 6 new cases (XvmDanglingEdge), one of which reproduces the refusal
before anything is repaired so the fix cannot pass vacuously. 458 tests, 11
binaries green.
* docs(release): document the dangling-edge repair path for upgraders
An upgrade from 0.4.68/0.4.69 can hit a `use` that is refused where it
previously worked: legacy pairwise edges may point at versions that are no
longer registered, and fail-closed resolution rejects the whole release.
The notes now say what to run. Without it the user's only visible option was
the reinstall the error hinted at, which is a heavy answer to a stale edge --
and doctor did not surface the finding in the first place.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
This draft introduces the provider-scoped binding-group foundation required
for coherent multi-program toolchains such as GCC (
gcc,g++, headers, andlibraries).
RegistrationBatch, validate thecomplete batch first, then apply it atomically
unrelated existing state
leaving partial mutations
.agents/docsWhy
XVM previously treated each target independently. Package hooks could therefore
register or remove members one at a time, and active/version metadata did not
carry a canonical provider-group identity. For coupled toolchains this allows
mixed releases and incomplete state—for example, selecting one GCC member
without proving that
gcc,g++, runtime libraries, and headers belong to thesame provider release.
This change establishes a fail-closed group identity:
All member entry points resolve through that identity. Provider metadata is
validated before mutation, and legacy entries cannot borrow provider-owned
target metadata.
Architecture
Canonical selection
src/core/xvm/bindings.cppmcentralizes group parsing, integrity checks,canonical member/root resolution, and deterministic diagnostics. Complete
selections are provider-scoped and carry exact member versions.
Strict state validation
XVM DB/config loading validates binding metadata both at JSON boundaries and
when constructing in-memory state. Invalid group shapes,
duplicate/conflicting members, partial provider metadata, and illegal root
migration fail closed.
Two-phase registration
src/core/xvm/registration.cppmbuilds and validates an immutable registrationbatch before applying any DB changes. The apply phase registers a complete
group in one operation and no longer exposes partially registered members when
a later effect fails.
Exact removal authority
src/core/xvm/removal.cppmderives removal plans from exact provider-ownedselections. Uninstall paths cannot fall back to target-only or bare-version
deletion and cannot remove versions belonging to another provider.
Validation
All valid build/test commands used isolated
HOME,XLINGS_HOME, XDGdirectories, temp directories, and a private
MCPP_HOME; they did notintentionally use the host xlings environment.
skips across 11 binaries
git diff --check origin/main...HEAD: passedOne known network-dependent package fixture was excluded from the deterministic
direct-binary loop; no passing claim is made for that external-network case.
Draft boundary / follow-up
This PR currently contains the reviewed selection, validation, registration,
and exact-removal foundation. It does not yet claim the final end-to-end
xlings use gcc 15/16switch behavior. The locked filesystemmaterialization transaction, version-scoped shim dispatch, self-switch safety,
diagnostics/E2E coverage, and version bump remain follow-up work before this
draft is ready to merge.
The branch deliberately excludes the current uncommitted switch-planner work
until it passes its own contract review and isolated verification.