Repository navigation
fix(xim): "not found" was said about packages that are right there in the index - #550
Merged
Merged
Conversation
… the index
Measured on Linux with the index synced:
$ xlings search msvc
◆ xim:msvc Microsoft Visual C++ compiler toolset (portable, pinned...)
$ xlings info msvc
[error] package 'msvc' not found
Both commands, same machine, same index, opposite answers. `search` is
right: the package exists. `info` filters candidates by platform and then
reports an empty result with the only message it had.
"does not exist" and "exists, but has no build for this platform" are
different facts, and reporting the second as the first sends the reader
looking for a package that is sitting in the index they just synced.
resolve_target now distinguishes them and names where the package IS
available:
[error] package 'msvc' has no build for linux (available on: windows)
The mechanism was already half-built: `build_matches_` has a `forSearch`
flag that keeps a candidate whose version selection came up empty for the
current platform -- exactly the set needed here -- and it had NO caller
setting it to true. A parameter with no caller is not a feature, and in
this case the one place it was written for is the one place that was not
using it.
Applies to every windows-only package on a Linux host (msvc, windows-sdk,
curl) and symmetrically to linux-only packages on Windows.
E2E-76 caught it, and the failure is worth keeping in the comment because it
states the opposite of the truth while naming the platform it calls
unsupported:
package '[email protected]' has no build for linux
(available on: linux, macosx, windows)
^^^^^
9.9.9 does not exist anywhere. The package is fine on linux; the VERSION is
not. `collect_matches_` comes back empty for both reasons and I had folded
them together.
`platforms_offering_` now requires the REQUESTED version to resolve on a
platform before naming it -- via `select_version_`, the same function the
resolution path uses, so the two cannot disagree about what "available"
means. When no platform has that version the list is empty and the message
falls back to "not found", which is what E2E-76 asserts and what is true.
Worth noting how it was caught: unit-level, the function did exactly what I
wrote. The unit of this defect is a whole command's output, and only the
e2e is written at that unit.
The new "has no build for <platform> (available on: ...)" had no test at all -- I verified it by hand. An error message with no test is a message that drifts. E2E-76 already covered one direction (a version nobody has must still say "not found"), which is what caught the defect in the first place. The other direction had nothing: a second fixture, built only for platforms this host is not, must be reported as such and must NAME where it is available. Each direction alone is satisfiable by a wrong implementation -- the one that shipped in the first commit passed the second and failed the first. The `not found` check is an `if`, not `grep ... && FAILURES+=(...)`: under `set -e` that compound returns grep's status, so the PASSING case (grep finds nothing) would kill the script with no output. Same shape §9.3 of the four-defect doc recorded.
…R red
self_doctor_depth_test.sh: line 123:
/proc/24781/task/24781/children: No such file or directory
The walk tested `[[ -r ... ]]` and then read the file. It polls every 2ms
while the process tree is actively spawning and reaping, so the entry can
vanish in between -- and under `set -e` that read kills the whole test.
It surfaced on a PR that changed one error message, which is the tell: a gate
that fails for reasons unrelated to the change under it stops being usable as
evidence about that change.
Read with failure tolerated instead. A child that has already exited is not a
child this needs to count. One subprocess per pid per poll is affordable
here; a flaky gate is not.
Sunrisepeak
added a commit
that referenced
this pull request
Aug 16, 2026
…y say it does not know (2026.8.17.1) Six places wrote the `subos_info` block. Five asked one helper; the sixth -- `installer.cpp`, reached whenever a package declares `subos_env` -- wrote the `DEFAULT_RUNTIME` constant directly and never called `preserved_runtime` at all. That is #547: measured on a real home, 2 of the 5 subos that HAD a block declared [email protected] while `lib/libc.so.6` pointed into the 2.39 payload, and 17 of the 32 without one would have been declared 2.44 by the next install that touched them. The hardest part of the shape is that five of the six were right, so "is there a single entry point" answered yes. Not a seventh entry point ------------------------- The first plan added `subos repair --all`, a `subos use` hook and a doctor sweep. Measuring instead of designing overturned its premise: the lazy backfill ALREADY exists (`xim install` does it), so coverage was never the defect -- content was. `subos use` is also the wrong hook: XLINGS_ACTIVE_SUBOS is an inherited env var the profile reads without running any xlings code, so a `--global` user runs `subos use` once in their life. So: no new command, no new flag. `runtime_for(dir, doc, Intent, requested)` with sources ordered recorded binding > --runtime (Create only) > workspace active runtime > sysroot lib*/libc.so.6 > DEFAULT_RUNTIME (Create only) and the ONLY difference between Create and Describe is that last line. All seven call sites migrated; `preserved_runtime` deleted in this commit so a site left behind is a compile error rather than something to grep for. The sysroot source is the only OBSERVATION here. Every other answer is something a previous run wrote down, which is how two records came to be wrong in the same direction and agree. "Unknown" is now expressible ---------------------------- I6 required a well-formed binding, so a describe with no evidence had two options: invent one, or emit a block `--fix` rewrites forever. It invented one. Relaxed to "present means well formed; absent is legal", which makes "written before subos_info existed" and "we looked and could not tell" distinguishable. No schema bump -- every reader in the tree already guards on `is_binding`. Provenance is no longer fabricated: `created_*` for Create, `described_*` for Describe, I8 accepts either. Requiring `created_*` is precisely what forced every backfill to invent a creation date -- on the measured home `default` and `gfxbuild` carry a byte-identical one, being described in the same run rather than created in the same second. Two findings: SubosRuntimeDrift (declaration vs sysroot; reported, never repaired -- which side is the accident is not decidable here) and SubosRuntimeUnknown (Notice, counts as nothing). `subos new --from X --runtime Y` no longer discards Y in silence. #551 follow-ups --------------- The rollback branch `remove_all`d the staging directory, which held the files it had already moved. Writing the test showed the defect is deeper: "roll back to untouched" was never reachable, because `remove_all` is not atomic and has already deleted what it could before it reports failure. The reachable invariant is that leftovers must not read as an installed package -- so `Partial` stamps them incomplete, which `install_state` checks first. Trash moved out of the version namespace (7 places read `xpkgs/<pkg>/*` as versions and not one skips dotfiles), given a real sweep, and moved out of an anonymous namespace so it can be tested at all. #550 / #552 ----------- - Removed the `forSearch` parameter #550 added to `collect_matches_`, which has no caller -- the exact defect that PR was about. - #552's `index_revision_` is a second answerer to a question `get_repo_head_hash` already answered, and unlike it, blind to the artifact-managed index (no `.git`). Merged into one, plus packed-refs support the old one also lacked, and CR stripping the new one applied on one read path and not the other. - The `xlings update` advice is now gated on the index actually being stale. Windows CI ---------- `TaskManager.PromptHandling` polled for a fixed 1s and flaked on main with a commit that was green on its PR branch; the failure skipped all 15 following steps, so a Windows-only fix landed with zero end-to-end signal. Deadline-based waits with a diagnostic on timeout, and the unit step no longer gates the E2E suite (its verdict is re-asserted at the end of the job). Verification: 42 unit binaries green; new E2E-82 covers six scenarios and is RED on the pre-change binary (S3 reports `declared '[email protected]'` over a 2.39 sysroot -- #547 verbatim). The `Partial` branch is unreachable on POSIX and is deliberately not asserted end to end; its verdict function is driven with real leftovers instead. Analysis: .agents/docs/2026-08-17-547-and-three-merged-prs-review.md Notes: .agents/docs/2026-08-17-release-2026.8.17.1-notes.md
Sunrisepeak
added a commit
that referenced
this pull request
Aug 16, 2026
…y say it does not know (2026.8.17.1) (#553) * fix(subos,xim): one answer to "what runtime is this subos", and it may say it does not know (2026.8.17.1) Six places wrote the `subos_info` block. Five asked one helper; the sixth -- `installer.cpp`, reached whenever a package declares `subos_env` -- wrote the `DEFAULT_RUNTIME` constant directly and never called `preserved_runtime` at all. That is #547: measured on a real home, 2 of the 5 subos that HAD a block declared [email protected] while `lib/libc.so.6` pointed into the 2.39 payload, and 17 of the 32 without one would have been declared 2.44 by the next install that touched them. The hardest part of the shape is that five of the six were right, so "is there a single entry point" answered yes. Not a seventh entry point ------------------------- The first plan added `subos repair --all`, a `subos use` hook and a doctor sweep. Measuring instead of designing overturned its premise: the lazy backfill ALREADY exists (`xim install` does it), so coverage was never the defect -- content was. `subos use` is also the wrong hook: XLINGS_ACTIVE_SUBOS is an inherited env var the profile reads without running any xlings code, so a `--global` user runs `subos use` once in their life. So: no new command, no new flag. `runtime_for(dir, doc, Intent, requested)` with sources ordered recorded binding > --runtime (Create only) > workspace active runtime > sysroot lib*/libc.so.6 > DEFAULT_RUNTIME (Create only) and the ONLY difference between Create and Describe is that last line. All seven call sites migrated; `preserved_runtime` deleted in this commit so a site left behind is a compile error rather than something to grep for. The sysroot source is the only OBSERVATION here. Every other answer is something a previous run wrote down, which is how two records came to be wrong in the same direction and agree. "Unknown" is now expressible ---------------------------- I6 required a well-formed binding, so a describe with no evidence had two options: invent one, or emit a block `--fix` rewrites forever. It invented one. Relaxed to "present means well formed; absent is legal", which makes "written before subos_info existed" and "we looked and could not tell" distinguishable. No schema bump -- every reader in the tree already guards on `is_binding`. Provenance is no longer fabricated: `created_*` for Create, `described_*` for Describe, I8 accepts either. Requiring `created_*` is precisely what forced every backfill to invent a creation date -- on the measured home `default` and `gfxbuild` carry a byte-identical one, being described in the same run rather than created in the same second. Two findings: SubosRuntimeDrift (declaration vs sysroot; reported, never repaired -- which side is the accident is not decidable here) and SubosRuntimeUnknown (Notice, counts as nothing). `subos new --from X --runtime Y` no longer discards Y in silence. #551 follow-ups --------------- The rollback branch `remove_all`d the staging directory, which held the files it had already moved. Writing the test showed the defect is deeper: "roll back to untouched" was never reachable, because `remove_all` is not atomic and has already deleted what it could before it reports failure. The reachable invariant is that leftovers must not read as an installed package -- so `Partial` stamps them incomplete, which `install_state` checks first. Trash moved out of the version namespace (7 places read `xpkgs/<pkg>/*` as versions and not one skips dotfiles), given a real sweep, and moved out of an anonymous namespace so it can be tested at all. #550 / #552 ----------- - Removed the `forSearch` parameter #550 added to `collect_matches_`, which has no caller -- the exact defect that PR was about. - #552's `index_revision_` is a second answerer to a question `get_repo_head_hash` already answered, and unlike it, blind to the artifact-managed index (no `.git`). Merged into one, plus packed-refs support the old one also lacked, and CR stripping the new one applied on one read path and not the other. - The `xlings update` advice is now gated on the index actually being stale. Windows CI ---------- `TaskManager.PromptHandling` polled for a fixed 1s and flaked on main with a commit that was green on its PR branch; the failure skipped all 15 following steps, so a Windows-only fix landed with zero end-to-end signal. Deadline-based waits with a diagnostic on timeout, and the unit step no longer gates the E2E suite (its verdict is re-asserted at the end of the job). Verification: 42 unit binaries green; new E2E-82 covers six scenarios and is RED on the pre-change binary (S3 reports `declared '[email protected]'` over a 2.39 sysroot -- #547 verbatim). The `Partial` branch is unreachable on POSIX and is deliberately not asserted end to end; its verdict function is driven with real leftovers instead. Analysis: .agents/docs/2026-08-17-547-and-three-merged-prs-review.md Notes: .agents/docs/2026-08-17-release-2026.8.17.1-notes.md * fix(subos): a rebuild must not delete a creation record either Review of the previous commit turned up two things. `describe_block` — the four Describe sites were repeating the same five-line spec, and the three things they all have to get right are exactly the three that were easy to get wrong: Describe intent, the runtime from `runtime_for` rather than a constant, and carrying a genuine creation record across. That last one was missing. A rebuild fires because the block is INVALID, which can be true for reasons that have nothing to do with provenance (a corrupted `envs`), and a subos that really was created by `subos new` has a real `created_at` in the block being replaced. Writing only `described_at` over it deletes a fact -- the mirror image of inventing one, which is what this whole change is about. Carried only as a complete pair: half a record satisfies neither I8 nor a reader. And a correction to the notes. They claimed an old client "won't judge a new block broken", which is wrong: an old `validate_block` reports `RuntimeMalformed` for an absent runtime and its `--fix` re-declares the subos against its own era's DEFAULT_RUNTIME. That is the downgrade path, not the upgrade one, and it has no test -- only that paragraph -- so the paragraph now says so instead of claiming the opposite. * fix(self): a fresh home's default subos is a CREATION, not a description `ensure_home_layout` runs on install and on update, so `ensure_subos_manifest_` is doing one of two different things depending on which. Marking it unconditionally Describe -- which reads correctly, since the function exists for the upgrade path -- left a brand-new home's `default` recording no runtime at all, because Describe is forbidden from falling back to the default and a fresh home has nothing to observe. Caught by E2E-67/S1, which asserts a fresh subos records the current default. That test was written for the opposite failure (a default bump silently re-declaring existing subos) and it caught this one, which is the argument for keeping both halves of the rule under test. The fork is the same one `subos.cpp` already applies at its own: does the config file exist, sampled before anything writes one. not exists -> this run is making the subos; the default is what "nobody said otherwise" means exists -> it predates this run; nothing may be invented (#547) `installer.cpp`'s missing-config path stays Describe, and that is not the same case: `subos new` writes the manifest before any install runs, so `xim install` can only ever meet a subos whose config was lost, never a fresh one. E2E-82 gains a pointer to E2E-67 rather than a copy of it -- the Create half is already gated, and two tests asserting one rule is one of them going stale. * docs: what implementation overturned in the #547 plan, and what it did not reach Five of the plan's claims did not survive contact with the code, and the repo convention is that a plan keeps its wrong turns -- deleting them deletes the reasoning, and the next person re-derives it. The two worth reading are §10.1 (the rollback fix the plan asked for was a restatement of an impossible promise; `remove_all` has already destroyed what it could before it reports failure) and §10.3 (`self init` is a CREATION on a fresh home, caught by a test written for the opposite failure). §11 is the honest ledger: three items are marked not done, including the five `remove_all` sites this PR made reusable but did not converge. * fix(xim): compare filesystem iterators against the sentinel, not a default-constructed one `it != fs::recursive_directory_iterator{}` is a Linux-only spelling that looks portable. libc++ -- the toolchain the macOS and Windows legs use -- gives the filesystem iterators only `operator==(default_sentinel_t)` under C++20, so it does not compile there at all. Carried over verbatim when `remove_payload_dir` moved out of installer.cpp, along into the new test file. The rest of this tree already uses `std::default_sentinel` (installer.cpp's extract loop); a comment at the loop now says why, so it does not come back the next time something is moved. Verified locally rather than by pushing and waiting: `mcpp build --toolchain [email protected]` reproduces the macOS compile in seconds. Checked in both directions -- reintroducing the old spelling reproduces the CI error verbatim, and the whole unit suite (42 binaries) passes with the toolchain default switched to llvm, which is what covers the test file since macOS runs `mcpp test` too. * docs: the drift finding, measured on the real home in both directions Fires on exactly the two subos §2 predicted from the data -- including the mcpp-test from the issue -- and stays silent on the three whose declaration and sysroot agree. A check that only ever warns and a check that only ever stays quiet look identical when you measure one direction. * docs: correct an inherited claim about packed-refs, and name a side effect Two things this PR was asking of everything else and had not done to itself. 1. The comment said packed-refs is "the common shape for a freshly cloned index". That was inherited from the reader this replaces and repeated in the analysis doc without checking. It does not survive measurement: all four index repos on this machine have BOTH a packed-refs and a loose refs/heads/<branch>, and `git clone` writes the loose ref for the branch it checks out. What produces a packed-only ref is `git gc` / `git pack-refs`. Still a real fallback, just not the default path -- and worth being exact about, since a fallback believed to be the common path is one nobody tests. 2. `get_repo_head_hash` is also the parsed-index cache key (catalog.cpp:504). It used to return empty when the loose ref was absent, which DISABLES the cache and rebuilds the whole index on every install/search. Adding packed-refs support means those repos start hitting the cache. That is an improvement, and it is outside what "fix the error message" implies, so it is written down rather than left to be discovered. * docs(spec): record the known-unknown runtime and the created/described split The schema spec is what downstream reads to know what it may find in a `subos_info` block, and it now describes two states that did not exist: * `runtime` may be ABSENT, meaning "we looked and could not tell" -- a third state distinct from both "no block" (old format) and a real declaration. Consumers should degrade and say why rather than substitute a default, which is exactly what xlings itself used to do. * `described_at`/`described_by` for a block written about a SubOS that already existed, satisfying the provenance invariant alongside `created_*` rather than forcing a backfill to fabricate one. * docs: why the five remove_all sites are not a drop-in convergence The ledger said 'not done', which reads as 'not got to yet'. Looking at the two that matter says otherwise: `payload_trash_root` derives from an `xpkgs` ancestor so a rename cannot cross filesystems, and a subos directory has none; `self uninstall` is deleting the home the trash would live in. And `subos remove` already reports its failure rather than swallowing it, so it is 'harder to use on Windows', not 'says something untrue'. 'Not done' and 'cannot be done this way' look identical in a checklist. * tools: verify a release by reading the artifacts, not the job statuses Every release job in this repo can go green having changed nothing, and the four checks that catch it each have an obvious method that does not work: * `gh release view` (GraphQL) and `gh api .../releases` (REST) have disagreed for minutes at a time -- REST is the one to trust; * a sha256 sidecar on its own only proves the sidecar and the recipe agree with each other, so the archives are downloaded and hashed here; * `bump-index` opens a PR and merges nothing, so `latest` is read directly off index main, in all three platform tables, and open index PRs are listed rather than assumed absent; * a gitcode asset answers 401 to HEAD and 206 to a ranged GET even when truncated, so presence is proved by a full download and a hash compare against the GitHub copy. That procedure existed only as prose. Prose does not run, and this round is largely about the difference between a documented remedy and one that works -- so it is a script, and it was validated against 2026.8.14.1 (all four checks pass) before being committed, rather than written against the release it is meant to check. * fix(xim): the "not found" message named one index twice and ran off the line Found by RENDERING it, which is the one check its reader gets and the author usually does not: [error] package 'x' not found in the synced index (xim@288efe5, scode@78fe9f0, dsh@ef98638, awesome@45dfd93, d2x@25a5070, scode@78fe9f0) that index was synced 72 minutes ago Three defects in three lines. The same repo reached through the project and the global list is ONE snapshot and was printed twice, which reads as a bug in the message itself. Six of them ran past 160 columns. And "that index", singular, described six. Now deduped, capped at three with `+N more`, and the age folded onto the first line: [error] package 'x' not found in the synced index (xim@288efe5, scode@78fe9f0, dsh@ef98638, +2 more), synced 72 minutes ago if it was just published, the index may not carry it yet — run `xlings update` And the reader itself finally has tests. `get_repo_revision_label` is a pure function over a directory, so the fixtures were always cheap -- the reason it had none is that the version it replaces lived in a .cpp where nothing could reach it. Ten cases: loose ref, packed-refs, packed-refs with CRLF, a ref name that is a prefix of another, detached HEAD, an artifact index with no .git at all, neither, an unresolvable ref, and both directions of the sync age. The CRLF case was checked in both directions: removing the strip makes it fail and nothing else, which is the point -- a CRLF packed-refs used to read as "no revision" and silently print the older message. * fix(doctor): the drift finding named a file it had not read It said "lib/libc.so.6 points into X". The probe behind it spans four directories and seven names, so on a musl subos the link that actually answered is `lib64/ld-musl-x86_64.so.1` and the message named a file that does not exist there. That is this PR's own subject matter -- a message stating more than it checked -- so `sysroot_runtime` now reports which link answered, and the finding names it: subos 'mcpp-test' declares runtime [email protected], but lib/libc.so.6 points into [email protected] -- a binary built here links against [email protected], ... subos 'default' declares runtime [email protected], but lib64/ld-musl-x86_64.so.1 points into [email protected] -- ... Both rendered and checked, the second against a fixture home built for it. The out-param is optional, so existing callers and tests are untouched, and it is left alone when there is no observation -- asserted, because an out-param written on the failure path is how a caller ends up reporting a stale value. * docs: this bug class already reached mcpp once, and release.yml says so Not a discovery of ours -- it is written in the release workflow's own env block, explaining why the bootstrap pin was moved forward: v2026.8.8.1 stamped `subos_info.runtime` from a CONSTANT when it created the default SubOS -- `[email protected]` on a home that then resolved and ran glibc 2.44. ... mcpp-community/mcpp#406 was that lie surfacing two repos away. Same shape, same field, the version pair reversed. That time it was handled by pinning past the instance. This change removes the class: a constant appears only where a human could have said otherwise, and everywhere else the answer is observed or left absent. Worth recording because an incident that has already been worked around once is the strongest available evidence that the workaround was at the wrong level.
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
Measured on Linux with the index synced:
Both commands, same machine, same index, opposite answers.
searchis right: the package exists.infofilters candidates by platform and then reports an empty result with the only message it had."does not exist" and "exists, but has no build for this platform" are different facts, and reporting the second as the first sends the reader looking for a package that is sitting in the index they just synced.
resolve_targetnow distinguishes them and names where the package is available:The mechanism was already half-built
build_matches_has aforSearchflag that keeps a candidate whose version selection came up empty for the current platform — exactly the set needed here — and it had no caller setting it to true. A parameter with no caller is not a feature, and in this case the one place it was written for is the one place that was not using it.Scope
Applies to every windows-only package on a Linux host (
msvc,windows-sdk,curl) and symmetrically to linux-only packages on Windows. No change to the success path: when a match exists, nothing new runs.Test plan
xlings subos use msvc-verify --sandbox --cmd "xlings update -y && xlings info msvc"on Linux after feat(windows-sdk): add the Windows SDK as an xlings payload package xim-pkgindex#626–628 publishedmsvcmcpp buildon this checkout fails before reaching my change, on a pre-existingmcpplibs.xpkg.lua_stdlib: failed to read compiled modulefrom[email protected](reproduced with the change stashed). Relying on CI for the compile; will fix whatever it reports.