Repository navigation
fix(xim,doctor): a package without an install hook receives its own archive, not the download directory (2026.9.14.1) - #596
Merged
Conversation
…rchive, not the download directory (2026.9.14.1) Every download landed in the shared runtime directory (<data>/runtimedir), every archive was extracted there too (installer.cpp:2831-2835, before this change), and when install_dir was still empty after hooks -- always for a package with no install() hook, and for a hook that does nothing -- stage_extracted_payload_ was handed that WHOLE shared directory and moved every entry in it: other packages' archives, their .lock/.meta/.part.* sidecars, and extracted trees. Its branch that strips a single top-level directory was unreachable for a real download (the archive file was always a second entry alongside the extracted tree), so the de facto layout every hookless install produced was un-stripped -- which 55 mcpp-index `mcpp = "*/.../mcpp.toml"` pointers and mcpp's own default manifest lookup depend on. Measured on this machine's mcpp registry: 221 of 401 version directories carried swept sidecars, 5.2 GiB of foreign archives. X1: a package without an install() hook no longer extracts into runtimedir at all. When staging is needed, its archive is extracted into a private, per-installation directory (<runtimedir>/.stage/<sanitized plan key>-<pid>/, same volume, RAII- removed on every exit path) and staged from there. A package WITH a hook still extracts beside its archive first (the hook's contract, xpkg-manifest-v1 Sec.8.2); if the hook leaves install_dir empty anyway (e.g. the patchelf case), the archive is extracted a second time, privately, and staged from there -- never from the shared directory. stage_extracted_payload_'s single-top-level-directory stripping branch is deleted: with a private extraction it would become reachable and strip the very layout the spec requires. Script and SubOS default installers are unaffected -- they fill install_dir before staging runs. X2: xpkg-manifest-v1.md Sec.6 now states the rule for a package that defines no install(): its install directory receives the entries of its own archive, laid out as the archive lays them out (top-level directory kept), and nothing else; the archive stays in the download cache. X3: `xlings self doctor` reports a payload (FindingKind::SweptPayload) whose top level carries the sweep's fingerprint -- xim:: swept_payload_marker checks for a zero-length "<name>.lock" paired with a sibling "<name>", a "<name>.meta" sidecar, or an entry ending in a download/archive extension. `--fix` repairs it through the existing repair ladder (repair_one in xself/repair.cpp): a swept payload already reads as successfully installed, so R2 alone (`xlings install`) would report "healed" without touching the contamination -- repair_one now skips R2 for the new RepairKind::SweptPayload and goes straight to R3 (remove, then install), so the reinstall reaches the private-extraction staging fallback with install_dir actually empty. X4: two new e2e scripts (hookless_install_stages_own_archive_test.sh, doctor_swept_payload_test.sh) and unit tests for detail_::stage_extracted_payload_, detail_::private_stage_dir_, and repair_one's R2 skip. Both e2e scripts avoid the network by pre-placing fixture archives with a matching sha256 at the exact path the downloader would have saved them to (downloader.cpp's cache-hit path). The positive/layout e2e fails on the released 2026.9.12.1 binary (a swept hooked-fixture archive lands inside hookless-multi-fixture's install_dir); the doctor e2e's D2 fails there too (self doctor reports nothing wrong, since FindingKind::SweptPayload/repair_swept_ did not exist). Version bumped to 2026.9.14.1 in mcpp.toml and src/core/config.cppm. mcpp.lock's ftxui entry moved from the `compat` to the `mcpplibs` namespace: the live xim/mcpplibs index has migrated it since this repo's lock was last committed, and this repo's pinned dev-mcpp (2026.8.8.4) re-resolves it that way on every fresh build regardless of this change (reproduced identically by `mcpp build` and `mcpp test` independently) -- included here because a stale lock entry an unrelated build step keeps silently rewriting is not something a future diff should have to explain. Refs mcpp-community/mcpp#636
…able tests/e2e/run_all.sh's TESTS array is an explicit manifest, not a glob -- a new *_test.sh file is otherwise never run by the "e2e" CI check (it only runs bash tests/e2e/run_all.sh build/release.tar.gz). Adds E2E-111/E2E-112 and chmod +x to match every other script in the directory. Refs mcpp-community/mcpp#636
…n a name Four fixes from review of 88e307f: 1. xim::swept_payload_marker false-positived on any top-level entry whose NAME merely looked like a download (ends in .tar.gz/.exe/..., or is named "*.meta") or on a NON-empty "*.lock" -- so a package whose own archive legitimately contains a top-level "setup.exe", "data.zip" or "notes.meta", or a bundled non-empty "yarn.lock", would be reported swept and `self doctor --fix` would remove-and-reinstall it on every run without ever converging. Rewritten to anchor on the downloader's own artifact: a candidate must be a ZERO-LENGTH regular "<name>.lock" (only ever written by the downloader, only ever in runtimedir), and even then counts only when one of three further facts about "<name>" holds -- a sibling "<name>" exists, "<name>" itself ends in a download extension (the orphan-lock shape), or a sibling "<name>.meta" exists. A bare filename, with no lock, is never enough. New unit tests cover both directions: SweptPayloadMarkerTest.ADownloadShapedNameAloneIsNot Flagged (setup.exe, data.zip, notes.meta, a non-empty yarn.lock) and one test per anchored shape (sibling pair, orphan lock, meta-only, plus a non-empty-lock and a directory-named-like-a-lock negative). doctor_swept_payload_test.sh's seeding now matches the anchored rule and gained a D1.5 that plants the bystander case and asserts doctor stays silent. 2. The finding's detail text and several comments cited "xlings#634", which is not an xlings issue -- corrected to mcpp-community/mcpp#636 throughout (payload.cpp/.cppm, doctor.cpp/.cppm, repair.cppm, the two e2e scripts, test_xim_install.cpp). 3. mcpp.lock's ftxui namespace move (compat -> mcpplibs) is reverted. It reproduces on every fresh `mcpp build`/`mcpp test` in this environment (the live index has moved the package since this repo's lock was committed), but every one of those local builds also SUCCEEDED against the reverted, origin/main lock -- mcpp re-resolves and does not fail -- so there is no build-time evidence this repo's lock needs to change, only that resolving it fresh produces a different, also-valid answer. Left for a change that is actually about ftxui. 4. A hookless package's staging extraction stopped reporting InstallPhase::Extracting once it moved into the private-staging branch (only the hook-contract extraction still did). Emits it there too, immediately before the private extract_archive_detailed call, so a large hookless archive still shows progress. Refs mcpp-community/mcpp#636
Member
Author
|
Review fixes pushed at
Local re-verification: |
Member
Author
|
All 9 CI checks are green on |
Sunrisepeak
pushed a commit
to mcpp-community/mcpp
that referenced
this pull request
Sep 14, 2026
kXlingsVersion and every pin check_version_pins.sh names move to the xlings release in which a package without an install hook receives its own archive (openxlings/xlings#596). The constant's comment records it as the third reason for the floor. Refs #636
7 of 8 tasks
Sunrisepeak
added a commit
to mcpp-community/mcpp
that referenced
this pull request
Sep 14, 2026
…ngs 2026.9.14.1 (2026.9.15.1, #636) (#639) * ci: workspace mcpp bootstrap pin -> 2026.9.14.3 (released + indexed); #634 ledger closed Version group 2 moves to 2026.9.14.3, released from 9b6a118 and named `latest` by the published xim index artifact `xim-index-ed04041`. The #634 implementation plan and the triage record are marked landed. The ledger closes every row with a reading (E1-E24 in mcpp#637, E25 in mcpp#638, P1-P9 in mcpp-plugins#24, I1 in mcpplibs/mcpp-index#426, R1-R4, V1-V4), and §9 records what landed, the sandbox readings on 2026.9.14.2, 2026.9.14.3 and the 2026.9.14.1 control, the ecosystem review, and two observations this work did not change. * docs(design): the build database of #636 and the two defects on the way to the latest xlings The record of the analysis, the plan and its self-review: xlings stages a hookless package from the shared download directory; a POSIX redirect in the vendored-xlings probe reaches cmd.exe on Windows; and mcpp emits an S1 build database from the plan without writing into the project. * fix(platform,xlings): a program probe is an argument vector, not a /bin/sh string The vendored-xlings version probe ran `<xlings> --version 2>/dev/null` as a command string. On Windows every command string reaches cmd.exe, which cannot open /dev/null: it printed "The system cannot find the path specified." in every command after the first, did not run xlings, and returned an empty version, so a Windows home never replaced a vendored xlings older than the pin. mcpp.platform.process gains capture_stdout: the program runs directly, its standard output is captured, its standard error is discarded and its standard input is empty; on Windows the redirect names cmd.exe's own null device. The xlings probe and the four other program probes that carried POSIX grammar on a path Windows reaches use it: the clean link specs, the libstdc++ fallback probe, the freestanding size report and the publish digest. Tests: capture_stdout unit tests (stdout only, exit code, empty stdin, environment, empty output for a missing program, the Windows command line); a version-probe unit test that runs a .bat through the real launcher on Windows; e2e 687 (no path error on the second command; an older vendored binary is replaced). * feat(emit): mcpp emit build-database, the plan as a build database written into nothing (#636) `mcpp emit build-database` plans as `mcpp build --configure-only` plans, with the same selectors, and prints the plan as an S1 build database (C++ Build Database: IDE Profile 0.2.0, a profile of WG21 P2977R2) without writing into the project. `--spec compile-commands` prints compile_commands.json entries instead; `--format json` wraps the document in the mcpp.build-database envelope; `-o <file>` writes it atomically. docs/specs/build-database.md (SPEC-005) states the rules. The document is S1 level 2: one set per package plus <package>:test and mcpp:std; visible-sets lists every other set, because the engine resolves imports over one module graph; each unit's arguments come from the record the compile database renders; ide.role is the declaration form the scanner read. Five engine changes make the no-write planning exact: - BuildOverrides::work_dir had two writes that ignored it (the multi-version mangling stage, and the root package's generated_files, which are now compared rather than written under plan_only); - the std module is described without being compiled (describe_std_module, the derivation ensure_built builds from); - the std units' commands are recovered from the commands mcpp runs, so the std cache identity does not change; - compile_commands and the build database render one UnitInvocation record; - the scanner records the module declaration form (ModuleDeclaration). mcpp.lock is read from the project and never written back; a difference is the warning MCPP_LOCK_WOULD_CHANGE. Planning narration goes to stderr through a descriptor-level redirect. A failure envelope omits data. Tests: BuildDatabase.* unit tests drive the real gcc and clang std command builders; Scanner.DeclarationFormIsRecordedAsRead; CompileCommandsEmit.UnitInvocationsAreTheCompileDatabaseArguments; WireGolden.NullDataIsOmitted; e2e 688 validates the output against the vendored S1 schema and uses --configure-only as the control leg for the no-write criterion. * fix(emit): a store package's build program inputs are not watched A store package's build program may declare inputs, and they were listed in `watch`; its files are fixed by the version its manifest and lock name, so only an editable package's declared inputs are inputs that can change. Found by running the command over lsp-mcpp, whose openkal-musl dependency declares its own mcpp.toml. * test(emit): the MSVC std units are recovered from their builder Drives msvc::std_module_build_commands and std_compat_build_commands, the command shape a Windows host with msvc@system runs (cd /d, a quoted cl.exe, /ifcOutput, /Fo:, 2>&1), through recover_invocation. * fix(emit): the selector digest separates values with newlines A \x1f separator followed by `f`, `c` or `a` (`\x1ffeatures`, `\x1fcap`, `\x1faccel`) is one longer hex escape; clang refuses it as out of range and every clang host failed to build the branch. GCC accepted it, which is why the Linux build did not see it. The sandbox verification script for the release is added alongside. * fix(scan): an entry source outside the globs is read by the scanner A target's entry source that no `sources` glob matched (a discovered test, a `main` outside the globs) had its imports read from line-leading `import` alone, in make_plan and again in the standard library check before planning. An import inside a comment or a raw string was therefore planned as one. Validating the lsp-mcpp repository's own build database against S1 found it: its scanner test was planned as importing three modules no source provides. scan_entry_file reads such a file with scan_file. The scanner's refusals (an import inside `#if`, a header unit, an extension without a role) were never applied on this path and are not applied now: a file it refuses yields the line-leading imports of its code, comments and raw strings removed, with the declaration form Unknown. Both readers now call it, so they cannot disagree about `import std`. Refs #636 * feat(emit): baseline and local arguments, private, and config-files The S1 SHOULD fields the lsp-mcpp validator reads, with values the plan determines: - `baseline-arguments` and `local-arguments`. A unit's arguments are its driver, the set's baseline, its local arguments and its own trailing `-c <source> -o <object>`, whose operands name the unit's source and object from its work directory. The baseline is the longest prefix every unit of the set shares; a prefix keeps argument order, which decides include search and macro definitions. - `private` is false: every module is visible to every set. - `config-files` lists what the driver reads without being named: the clang `<driver>.cfg` of resolve_clang_driver unless the units pass `--no-default-config`, and GCC's `lib/gcc/<triple>/<version>/specs` (or the major version) beside the driver. e2e 688 gains J (the decomposition, private, config-files) and K (the discovered test's imports inside a comment and a raw string are not `requires`); its F mapping compares paths with one separator, and the fixture's main.cpp is well-formed. SPEC-005 R3.2a, R3.6, R3.8 and R3.9a state the rules. Refs #636 * test(e2e): 687 plans in a home with its own configuration The macOS runner's inherited configuration names its ~/.xlings shim as the xlings binary, so nothing was vendored and the precondition failed before either criterion ran. The home now uses its own configuration, whose binary is the vendored one. Refs #636 * chore: bump version to 2026.9.15.1 mcpp.toml and MCPP_VERSION move together; the bootstrap pin stays at the released 2026.9.14.3. The changelog names the release on the three entries that land in it, and records the S1 fields and the entry-source scan. Refs #636 * chore(xlings): pin 2026.9.14.1 kXlingsVersion and every pin check_version_pins.sh names move to the xlings release in which a package without an install hook receives its own archive (openxlings/xlings#596). The constant's comment records it as the third reason for the floor. Refs #636 * docs(design): the execution record of #636 What landed in each repository, the five findings made while implementing, and the measurements taken so far, including lsp-mcpp's validator and its conformance runner against this mcpp. Refs #636 * docs(verify): a doctor control, the lock file named, and a dependency project Section D reads a clean store first, then requires the finding's label and the seeded lock file's name, and after --fix requires the reinstalled payload: no seeded file and */mcpp.toml present. Section C2 emits the build database of section B's project: the dependency's set, no watched store path, the S1 SHOULD fields, and an unchanged tree with target/ present. Sections that need python3 say so when it is missing. Refs #636 * docs(specs): SPEC-005's index row carries its last modification date Refs #636 * fix(emit): a plan that builds nothing writes no link specs prepare_build ran `g++ -dumpspecs` to write mcpp-clean-link.specs under plan_only. The file is read only by the link line, so the planning pass neither needs it nor should run the driver for it, and the compile arguments are the same without it (e2e 688 F still compares them with configure-only's). Found by an independent review of #639. e2e 688 criterion L measures what SPEC-005 R2.2 states: the fresh work directory holds the resolution record and no object, BMI or link specs, and a home whose build cache is empty stays without objects or BMIs while its document lists the std unit. Its control leg runs configure-only on a copy in the same home and sees the std module compiled. R2.2 now says what is true: nothing is compiled, and the toolchain is still queried as for `mcpp build`. Refs #636 --------- Co-authored-by: speak-agent <[email protected]>
This was referenced Sep 14, 2026
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
The defect (read at
59068d6, 2026.9.12.1): every download landed inthe shared runtime directory
<data>/runtimedir(
src/core/xim/installer.cppruntime_dir_,task.destDirnear line2575), every archive was extracted into that same directory
(
extract_archive_detailed(localFile, localFile.parent_path())near line2834, which returns the directory itself), and when
install_dirwasstill empty after hooks — always for a package with no
install()hook,and for a hook that does nothing —
stage_extracted_payload_(runtimedir, install_dir)(near lines 1121-1190, called near 3117) moved everyentry of the shared directory into that one package: other packages'
archives, their
.lock/.meta/.part.*sidecars, and extracted trees.Its branch that strips a single top-level directory (near line 1135) was
unreachable for a downloaded archive, because the archive file itself was
always a second entry beside the extracted tree — so the de facto layout
every hookless install has ever produced is un-stripped
(
<version>/<top-level-dir>/...), and 55 mcpp-index descriptors (mcpp = "*/…/mcpp.toml") plus mcpp's*/mcpp.tomldefault lookup depend on thatlayout. Measured on the reporting machine's mcpp registry: 221 of 401
version directories carried swept sidecars, 5.2 GiB of foreign archives.
The rule (new,
docs/spec/xpkg-manifest-v1.md§6): a package thatdefines no
install()receives in its install directory exactly theentries of its own archive, laid out as the archive lays them out (the
top-level directory is kept, never stripped), and nothing else; the
archive stays in the download cache.
The change:
src/core/xim/installer.cpp,installer.cppm) — a packagewithout an install hook no longer extracts into
runtimedirat all.When staging is actually needed (
!payloadInstalledandinstall_dirhas no entries), its archive is extracted into a private,
per-installation directory
(
<runtimedir>/.stage/<sanitized plan key>-<pid>/, same volume so thefinal move is a rename; RAII-removed on every exit path via the new
ScopedStageDir_) and staged from there. A package with an installhook still extracts beside its archive first — that is the hook's
contract (xpkg-manifest-v1 §8.2's example derives the extracted
directory from
install_file()). If the hook leavesinstall_dirempty anyway (e.g. the patchelf case noted near the auto-stamp comment),
the archive is extracted a second time, privately, and staged from
there — the staging fallback never reads
runtimediragain.stage_extracted_payload_'s single-top-level-directory strippingbranch is deleted: with a private extraction it would become
reachable and strip the very layout the spec now requires. Script
(pkgType 1) and SubOS (pkgType 4) default installers are unaffected —
they fill
install_dirbefore staging runs.docs/spec/xpkg-manifest-v1.md) — §6 states the rule above, inthe document's own language (Chinese), as declarative sentences.
src/core/xself/doctor.cpp,doctor.cppm,src/core/xself/repair.cpp,repair.cppm) —xlings self doctorreports a payload whose top level carries the sweep's fingerprint
(new
FindingKind::SweptPayload, detected by the newxim::swept_payload_marker: a zero-length<name>.lockpaired with asibling
<name>, a<name>.metasidecar, or an entry ending in adownload/archive extension).
--fixrepairs it by reusing theexisting reinstall ladder (
repair_oneinxself/repair.cpp) — but aswept payload already reads as successfully installed (the version
database agrees with it), so the ladder's cheap first rung (
xlings installalone) would report the finding "healed" without touching thecontamination.
repair_onenow skips that rung for the newRepairKind::SweptPayloadand goes straight to remove-then-install, sothe reinstall's
install_diris genuinely empty and reaches theprivate-extraction staging fallback. After
--fix, the directoryequals a fresh install.
Test plan
Build and unit tests:
New unit tests (all pass):
StageExtractedPayloadTest.*(4, regressionguard for the deleted stripping branch),
PrivateStageDirTest.*(3), andSelfRepairLadder.SweptPayloadSkipsReRegisterAndGoesStraightToRemoveAndInstallSelfRepairLadder.BrokenPayloadStillTriesReRegisterFirst.New e2e (both need no network — a fixture archive is pre-placed at the
exact path the downloader would have saved it to, with a matching
sha256, so downloader.cpp's cache-hit path never fetches the URL):
Negative leg, run against the released 2026.9.12.1 binary (this repo's
own
maincheckout, commit59068d6, built separately):Nearest existing e2e (all pass against the built binary, no regressions):
foreign_payload_reinstall_test.sh,self_doctor_test.sh,doctor_fix_convergence_test.sh,doctor_removed_not_reinstalled_test.sh,doctor_honest_verdict_test.sh,pkginfo_install_dir_test.sh,install_idempotent_test.sh,install_refresh_on_missing_test.sh,install_silent_failure_test.sh,config_install_no_implicit_dir_test.sh,script_type_install_test.sh(pkgType 1, confirms Script is unaffected),subos_xpkg_install_test.sh(pkgType 4, confirms SubOS is unaffected),fresh_xlings_home_install_test.sh.Not run:
elfpatch_install_verify_test.sh— its setup requires a packagedbuild/release.tar.gzfrom the release scripts, which was not built here(a plain
mcpp buildoutput does not satisfy it); the patchelfhook-that-does-nothing path it would exercise is covered instead by the
unit tests above and by the design reasoning in the PR description.
mcpp.lock:ftxui's entry moved from thecompatnamespace tomcpplibs— the live xim/mcpplibs index has migrated it since thisrepo's lock was last committed, and this repo's pinned dev-mcpp
(2026.8.8.4) re-resolves it that way on every fresh build regardless of
this change (reproduced identically, independently, by both
mcpp buildafter the version bump and by
mcpp test). Included so a stale entry anunrelated build step keeps silently rewriting does not surface in some
later, unrelated diff.
Refs mcpp-community/mcpp#636