Repository navigation
fix: a dependency means the package in its own index; a subos's user data leaves only when the user says so (2026.9.26.1) - #612
Merged
Conversation
…ex, decided once `xlings install xmake` failed with "package 'ncurses' is ambiguous" (printed twice) on a home listing `scode` as a peer index: xmake's bare `ncurses` was resolved against every index the USER configured, so what an official recipe meant depended on someone else's config, and its author could not test it. "Which package does dependency N of recipe R mean" had five answerers. Now one: - catalog: `resolve_dependency(spec, declarer, platform)`. An explicit `ns:name` is resolve_target, unchanged. A bare name is looked up in the declaring index first; if that index has the name, the answer comes from there -- a version or platform it cannot satisfy is an error naming it, never a reason to take another index's package of the same name. Only a name the declaring index lacks falls through to the global rule, and its ambiguity is worded for a dependency: no `xlings install <candidate>` (which ran and fixed nothing), but "the recipe has to name one" and `config --rm-index-repo` for repos the user added. resolve_target's tie-break moved into decide_(), shared. - resolver: dependencies resolve through their declarer, including the subos-pin fallback (a pin the declaring index cannot satisfy retries unpinned in the SAME index). Each choice is recorded as a DepEdge on the node; topoVisit reads the edges instead of re-resolving and hoping to agree. Failures are reported once (the loader fans a flat `deps` into both runtime and build lists) and carry their chain: `xim:[email protected] -> ncurses: ...`. - installer: resolved_deps / deps_exports and locate_dep_install_dir_ take the edge's node. They matched by name and took the FIRST hit, so with scode:ncurses and xim:ncurses in one plan the consumer's RPATH depended on the order an unordered_map was walked in. Edgeless plans keep the name match. - remove's dependents guard compares against what a consumer's install recorded (.xlings-resolution.json) when it has a record. - interface: `noDeps` was published as "Skip dependency installation" and never read. It is refused (E_INVALID_INPUT, exit 2) and dropped from the schemas. Measured on the isolated repro homes: the user's config (explicit scode + xim) with the unmodified bare-ncurses recipe now plans xim:glibc + xim:ncurses + xim:xmake; `noDeps: true` is refused.
…only when the user says so Two defects, measured on 2026.9.20.1, that share their files. INDEX IDENTITY (D2') An index_repos entry naming a sub-index the default index declares (same name, same url) was a SECOND repository: synced again into data/<name>, and ranked as a primary index -- so listing `scode` explicitly, which is the only way to pin it with `xlings index use`, made it a peer of `xim` and every name the two share ambiguous. Now `classify_index_entry` answers what an entry is: - DeclaredSubIndex: configuration for that sub-index. Synced once, in the sub-index tree, with the entry's version/artifact/source overlaid; loaded at sub-index rank (a home not yet updated keeps reading its old copy, same rank). `effective_repo_dir` is the one answer to "where is it on disk" for sync, catalog, `xlings index` and overlay. - NameCollision (same name, another url): refused by `config --index-repo` and NDJSON `add_repo`, reported by doctor, never guessed between. - `xlings config --rm-index-repo <name>`: the command the dependency-ambiguity message needs to print, which did not exist. - doctor: the dead `data/<name>` copy is a Notice; `--fix` deletes it (index data is derived) and records it. SUBOS USER DATA Rule (AGENTS.md): what a reinstall can put back any flow may delete; a subos's home and any file xlings cannot prove it owns only a deletion the USER initiated, once they confirmed. Measured before this change: - `subos remove` / NDJSON `remove_subos` deleted the whole tree, home included, with no question and exit 0. Now it asks, naming the path and what the home holds; with nobody to ask it deletes nothing and exits 2, and an agent is told what would go and that `"yes": true` is the user's call. `-y` / `"yes": true` are the explicit auto-confirm. - `subos new X` over an unregistered X/ silently adopted it and said "created"; a later remove then deleted files xlings never made. Adopting is now confirmed the same way and reported as "adopted"; a failed create rolls back only what that run made. - doctor told an unreadable subos config to `xlings subos remove <name>`. `--fix` now keeps the bad file as .xlings.json.corrupt-<time> and writes a fresh one; unregistered subos directories are reported with their size and never touched. - `self clean`'s GC treated an unreadable subos config as "uses nothing" and collected its packages; it now refuses and names the subos. Payload paths are parsed by component (backslash records matched nothing). - `self install` deleted every top-level entry of XLINGS_HOME except data/, subos/ and .xlings.json -- on every upgrade, unasked. It now replaces only what the release ships; its overwrite question lists each subos and its home. - `self uninstall --keep-data` printed "data: KEEP" and deleted every subos home. It now keeps subos/ too, and the summary names the homes. - `self clean` no longer removes `<home>/.xlings` when that is an xlings home. Mechanics: confirm::ask() is the only producer of confirm::UserConfirmed, and subos::userdata::delete_subos -- the one whole-subos deletion -- takes one, so an unconfirmed path cannot call it. It refuses the subos root, `current`, symlinks and (Linux) a tree with a live mount. Every destructive operation now appends to <XLINGS_HOME>/logs/destructive.ndjson (what, how big, how confirmed, command, parent process): the loss that prompted this could not be attributed because nothing recorded it. tools/lint_subos_remove_all.sh (in xlings-ci-linux) fails any other remove_all on a subos path. Interface: remove_subos and create_subos gain `yes`; ErrorEvent is unchanged. Tests that remove a subos pass -y / yes:true; the interface lifecycle test pins the refusal and the hint; self_uninstall T7 pins --keep-data keeping homes.
…ions are made - e2e E2E-118 dep_declarer_scope_test.sh: four local indexes planned with plan_install (no network). A recipe's bare dep resolves in its own index (AC1); a bare name the user types stays ambiguous (AC2); a version the declaring index lacks is an error, not a switch (AC2b); one report with its chain and no install advice (AC4); the printed --rm-index-repo remedy, run, gets the plan through (AC5); an entry configuring a declared sub-index stays one sub-index, a second url is refused, doctor --fix deletes the old copy (AC1b/AC6); noDeps is refused (AC7). On the released 2026.9.20.1 it fails at AC1 with the original "is ambiguous" printed twice. - e2e E2E-119 subos_user_data_test.sh: remove asks and, unanswered, deletes nothing (CLI and interface, with the agent told the decision is the user's); -y / yes:true removes and is logged with how it was confirmed; '..' and 'current' are refused by the entry point; a live bind mount stops deletion (SKIP where unprivileged mount namespaces are unavailable -- the parser has a unit test); adoption needs -y and says "adopted"; an unreadable subos config is repaired not removed; GC refuses and names the subos; self clean keeps $HOME/.xlings when XLINGS_HOME=$HOME. Fails on 2026.9.20.1 at AC10. - release_self_install_test: a second install keeps a user directory and a subos home. - Found while testing, fixed here: `self clean` printed "clean ok" and exited 0 right under a refused GC; the GC path split and the uninstall summary did not compile under libc++ ([email protected] gate); the mountinfo parser is split out for the unit test. - AGENTS.md: "SubOS user data" (the rule, what is never a way to delete, how it is enforced, read logs/destructive.ndjson first) and "Dependency names resolve in the declaring index". - NDJSON spec §7.1/§7.2, quick-start, xlings-usage skill: confirmation, yes, noDeps. Command reference regenerated. Design, analysis and implementation plan under .agents/.
- A `subos new` the state lock refused leaves its skeleton on disk (the directories are laid down before the locked commit), and the retry then asked to "adopt" our own leftovers (home_config_lock_test, E2E-33). Adoption now asks only when the directory holds user data -- files under home/ or files xlings does not manage -- which a bare skeleton does not. - create() used the non-throwing create_directories and ignored the result, so a read-only home surfaced three steps later as a failed write reported as an internal bug instead of "not writable" (doctor_honest_verdict S7, E2E-98). Back to the throwing overload. - `subos new --from` passes -y through to create(), so the "re-run with -y" hint it can print is runnable there too. - Version 2026.9.26.1 (mcpp.toml + config.cppm).
Sunrisepeak
marked this pull request as ready for review
September 25, 2026 18:03
Sunrisepeak
added a commit
that referenced
this pull request
Sep 25, 2026
…ode page and never exits silently (2026.9.26.2) mcpp#693 reports that on Windows, running mcpp --version from a directory whose name contains a character outside the system's ANSI code page (for example U+1F9EA) exits with 0xC0000409 and prints nothing. Measured on a GitHub windows-latest runner (ACP 1252): the process that dies is xlings, not the released mcpp.exe. Both `xlings --version` and the xlings shim `mcpp.exe` (a copy of xlings.exe) exit 0xC0000409 with no output when the working directory is outside the ACP, and work normally in ASCII directories and in directories whose non-ASCII characters fall inside cp1252. A debugger session recorded an unhandled C++ exception whose message is "No mapping for the Unicode character exists in the target multi-byte code page" — the MSVC STL throwing std::system_error while narrowing a std::filesystem::path through the ANSI code page. src/main.cpp installed no try/catch, so the exception reached std::terminate, abort, and a fast-fail exit roughly eleven frames into start-up, before any command ran. Three changes. A UTF-8 activeCodePage application manifest is now embedded in xlings.exe. mcpp.toml gains a [resources] section compiling res/xlings.rc, a hand-written resource script that embeds res/xlings.exe.manifest at ordinal 1 (CREATEPROCESS_MANIFEST_RESOURCE_ID) as RT_MANIFEST (24). On Windows 10 1903 and later, this manifest makes the process's own ANSI code page UTF-8: std::filesystem::path::string() then returns UTF-8 instead of throwing, and the -A Win32 APIs accept UTF-8. [resources] compiles only on PE targets, so the Linux and macOS builds are unaffected; a local Linux build with the change applied produced no resource-related output. The manifest is listed under [resources] extra-inputs as well, because mcpp's .rc scanner recognises the MANIFEST keyword but not the numeric resource type (24) used here, and an undeclared input would not trigger a relink when the manifest changes. The shims xlings creates on Windows are hard links or file copies of xlings.exe (create_shim in src/core/xself/init.cpp), so they carry the same manifest. src/main.cpp now runs everything after argv handling — the owner-anchored home lookup, Config::paths(), capture_ambient_home_env(), the profile auto-upgrade, cli::run, and shim_dispatch — inside a try/catch, reporting std::exception and any other exception through xlings::log::error (the convention xlings::cli::run's own top-level handler already uses) and returning a non-zero exit code, instead of letting the exception reach std::terminate. xlings::cli::run already wraps its own dispatch; shim_dispatch and everything that runs before either of them did not have a handler. This is the fallback for hosts where the manifest has no effect — Windows older than 1903, or a build where the resource could not be embedded — and turns a silent, unattributable crash into a reported error. The macOS _Exit behaviour after dispatch is unchanged. .github/workflows/xlings-ci-windows.yml runs a new regression step, tests/e2e/ansi_code_page_directory_test.ps1, right after the release build. The script asserts the runner's registry ANSI code page is not already 65001 (otherwise the step could not exercise the code path it exists to test), builds a directory name from code points — so the workflow source stays ASCII — combining CJK characters and the U+1F9EA character from the original report, and in that directory runs the freshly built xlings.exe --version (asserting exit code 0 and the expected version string) and xlings.exe config (exercising the project-config search from that working directory). It then extracts the manifest from the built executable with mt.exe and asserts it declares activeCodePage. Version 2026.9.20.1 -> 2026.9.26.2 (mcpp.toml, src/core/config.cppm). #612 merged 2026.9.26.1 for an unrelated fix while this change was in review, so this PR takes the next number in the day's sequence rather than reusing one already released.
This was referenced Sep 25, 2026
Merged
Sunrisepeak
added a commit
that referenced
this pull request
Sep 25, 2026
…d never exits silently (#613) * fix(main,resources,ci): xlings runs in a directory outside the ANSI code page and never exits silently (2026.9.26.2) mcpp#693 reports that on Windows, running mcpp --version from a directory whose name contains a character outside the system's ANSI code page (for example U+1F9EA) exits with 0xC0000409 and prints nothing. Measured on a GitHub windows-latest runner (ACP 1252): the process that dies is xlings, not the released mcpp.exe. Both `xlings --version` and the xlings shim `mcpp.exe` (a copy of xlings.exe) exit 0xC0000409 with no output when the working directory is outside the ACP, and work normally in ASCII directories and in directories whose non-ASCII characters fall inside cp1252. A debugger session recorded an unhandled C++ exception whose message is "No mapping for the Unicode character exists in the target multi-byte code page" — the MSVC STL throwing std::system_error while narrowing a std::filesystem::path through the ANSI code page. src/main.cpp installed no try/catch, so the exception reached std::terminate, abort, and a fast-fail exit roughly eleven frames into start-up, before any command ran. Three changes. A UTF-8 activeCodePage application manifest is now embedded in xlings.exe. mcpp.toml gains a [resources] section compiling res/xlings.rc, a hand-written resource script that embeds res/xlings.exe.manifest at ordinal 1 (CREATEPROCESS_MANIFEST_RESOURCE_ID) as RT_MANIFEST (24). On Windows 10 1903 and later, this manifest makes the process's own ANSI code page UTF-8: std::filesystem::path::string() then returns UTF-8 instead of throwing, and the -A Win32 APIs accept UTF-8. [resources] compiles only on PE targets, so the Linux and macOS builds are unaffected; a local Linux build with the change applied produced no resource-related output. The manifest is listed under [resources] extra-inputs as well, because mcpp's .rc scanner recognises the MANIFEST keyword but not the numeric resource type (24) used here, and an undeclared input would not trigger a relink when the manifest changes. The shims xlings creates on Windows are hard links or file copies of xlings.exe (create_shim in src/core/xself/init.cpp), so they carry the same manifest. src/main.cpp now runs everything after argv handling — the owner-anchored home lookup, Config::paths(), capture_ambient_home_env(), the profile auto-upgrade, cli::run, and shim_dispatch — inside a try/catch, reporting std::exception and any other exception through xlings::log::error (the convention xlings::cli::run's own top-level handler already uses) and returning a non-zero exit code, instead of letting the exception reach std::terminate. xlings::cli::run already wraps its own dispatch; shim_dispatch and everything that runs before either of them did not have a handler. This is the fallback for hosts where the manifest has no effect — Windows older than 1903, or a build where the resource could not be embedded — and turns a silent, unattributable crash into a reported error. The macOS _Exit behaviour after dispatch is unchanged. .github/workflows/xlings-ci-windows.yml runs a new regression step, tests/e2e/ansi_code_page_directory_test.ps1, right after the release build. The script asserts the runner's registry ANSI code page is not already 65001 (otherwise the step could not exercise the code path it exists to test), builds a directory name from code points — so the workflow source stays ASCII — combining CJK characters and the U+1F9EA character from the original report, and in that directory runs the freshly built xlings.exe --version (asserting exit code 0 and the expected version string) and xlings.exe config (exercising the project-config search from that working directory). It then extracts the manifest from the built executable with mt.exe and asserts it declares activeCodePage. Version 2026.9.20.1 -> 2026.9.26.2 (mcpp.toml, src/core/config.cppm). #612 merged 2026.9.26.1 for an unrelated fix while this change was in review, so this PR takes the next number in the day's sequence rather than reusing one already released. * test(windows): the ANSI code page regression script is plain ASCII, as its comment says --------- Co-authored-by: speak-agent <[email protected]>
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
Two problems, one release (2026.9.26.1). Design and measurements:
.agents/docs/2026-09-25-dep-name-resolution-optimization-plan.md(analysis:2026-09-25-bare-dep-ambiguity-analysis.md, plan:.agents/plans/2026-09-26-dep-scope-and-subos-user-data-impl.md).1. A recipe's bare dependency means the package in its own index
xlings install xmakefailed on 2026.9.20.1 for any home that listsscodeinindex_repos:The bare
ncursesinxim:xmakewas resolved against every index the user configured; the suggested installs ran and fixed nothing. "Which package does dependency N of recipe R mean" had five answerers (resolver ×2, installer ×2, remove guard).PackageCatalog::resolve_dependency(spec, declarer, platform): a bare name is looked up in the declaring index first; a version/platform it lacks is an error naming it, never a switch to another index's package. Only a name it lacks falls through to the global rule, and that ambiguity is worded for a dependency (the recipe must name one;config --rm-index-repofor repos the user added).DepEdge; topo-sort, installer (resolved_deps/deps_exports, build-dep dirs) and the remove guard read the edge instead of re-matching names (the installer took the FIRST name match in plan order).xim:[email protected] -> ncurses: ….noDeps(published, never read) is refused and dropped from the schemas.2. One identity per index (D2')
An
index_reposentry matching a declared sub-index (same name + url) — the only way to pin it withxlings index use— was synced a second time and ranked as a peer ofxim. It is now configuration for that sub-index: one directory (effective_repo_dir), sub-index rank; same name with another url is refused.xlings config --rm-index-repoadded; doctor reports and--fixdeletes the deaddata/<name>copy.3. A subos's user data leaves only when the user says so
Maintainer rule: derived data (payloads, links, shims) may go in any flow; a subos home and any file xlings cannot prove it owns only in a deletion the user initiated and confirmed (terminal,
-y,"yes": true). Measured before:subos remove/remove_subosdeleted the home, no question, exit 0subos new Xsilently adopted an unregisteredX/("created")subos remove--fixkeeps the file as.xlings.json.corrupt-<time>, writes a fresh one; unregistered dirs reported, never touchedself cleancollected packages of a subos it could not readself cleanexits 1self installdeleted every non-data/subos top-level entry on each upgradeself uninstall --keep-datadeleted every subos homesubos/too; summary names the homesconfirm::ask()is the only producer ofconfirm::UserConfirmed;subos::userdata::delete_subos(the one whole-subos deletion) requires it and refuses the subos root,current, symlinks, live mounts. Every destructive operation appends to<XLINGS_HOME>/logs/destructive.ndjson.tools/lint_subos_remove_all.shin CI.Compatibility
remove_subos.yes,create_subos.yes);ErrorEventunchanged.subos remove/remove_subosneeds-y/"yes": true;self uninstall --keep-datakeeps subos; explicit sub-index entries rank as sub-indexes (a barezlibprefersximagain).Tests
dep_declarer_scope_test.sh(E2E-118),subos_user_data_test.sh(E2E-119) — both FAIL on the released 2026.9.20.1 binary and pass here;release_self_install_test.shgains the keep-user-files case; tests that remove a subos pass-y.mcpp testgreen on [email protected] and [email protected].