fix(sys): exact Flatpak commit binding, non-destructive cleanup previews, reverse deps; record VM evidence
Some checks are pending
ci / test (push) Waiting to run
Some checks are pending
ci / test (push) Waiting to run
This commit is contained in:
parent
ec1f7c5b0b
commit
3bdeb08f76
9 changed files with 473 additions and 321 deletions
|
|
@ -3,6 +3,61 @@
|
||||||
All notable changes are recorded here. The authoritative history is `git log`;
|
All notable changes are recorded here. The authoritative history is `git log`;
|
||||||
this file is the curated, human-readable summary.
|
this file is the curated, human-readable summary.
|
||||||
|
|
||||||
|
## 2026-09-25 — Second-round `sys` fixes: safe cleanup previews, exact update transactions, reverse dependencies
|
||||||
|
|
||||||
|
Follow-up review found three further confirmed defects; all three are fixed with
|
||||||
|
regression tests, and the disposable-VM acceptance is extended. This entry
|
||||||
|
supersedes any earlier claim that every review finding was already fixed.
|
||||||
|
|
||||||
|
- **Cache-cleanup preview no longer deletes (finding 1).** `eclean-dist`/
|
||||||
|
`eclean-pkg` **delete by default**; only `--pretend` previews. The planner now
|
||||||
|
runs `--pretend --deep` (the same selection policy as the destructive run) and
|
||||||
|
combines stdout and stderr into a sorted, bound item set. The Nix preview uses
|
||||||
|
the documented `nix-store --gc --print-dead` (a bare `--gc`, and the
|
||||||
|
undocumented `--dry-run`, were unsafe assumptions). Tests prove reconciliation
|
||||||
|
and cancelled approval run no destructive cleaner.
|
||||||
|
- **Exact Flatpak/Snap update transactions (finding 2).** A reviewed update now
|
||||||
|
carries a structured `UpdateTransaction`: the full Flatpak ref (from
|
||||||
|
`remote-ls`) plus installed and remote **full commits** (from `flatpak info`,
|
||||||
|
because Flatpak's `commit` column is abbreviated), or the snap name plus
|
||||||
|
old/new revisions and tracking channel. Execution consumes the reviewed
|
||||||
|
transaction, is pinned (`flatpak update --commit=<commit>`), and revalidates
|
||||||
|
each source immediately before its mutation — including after an earlier
|
||||||
|
source has run. A commit republished under an unchanged human version, a newly
|
||||||
|
appearing update, or a non-exact transaction is refused; a source whose
|
||||||
|
resolution failed is never re-discovered at execution.
|
||||||
|
- **Reverse-dependency self-reference (finding 3).** The reverse branch compared
|
||||||
|
the dependency target with the queried package and dropped exactly the valid
|
||||||
|
matches. It now excludes only a genuine self-reference (the *dependent* is the
|
||||||
|
queried package), so installed targets, full and bare names, and
|
||||||
|
conditional/versioned dependencies are reported.
|
||||||
|
- **Determinism and execution robustness.** `All selected packages:` removals
|
||||||
|
are sorted so depclean previews are order-independent (previously a false
|
||||||
|
"plan changed"); `emerge --depclean` runs with `--ask=n`; plan aggregation
|
||||||
|
includes `updates`.
|
||||||
|
- **Tests:** +22 (workspace `cargo test --workspace` green, 661 → 683). New
|
||||||
|
regressions cover the non-destructive preview, drift/failed/cancelled
|
||||||
|
cleanup, exact Flatpak identities/commits, Snap revisions, reverse
|
||||||
|
dependencies, and Nix generation handling.
|
||||||
|
- **VM-verified (disposable images):** real `eclean` preview/approve/cancel/
|
||||||
|
drift/failed and `depclean` cancel/approve with history and preserved user
|
||||||
|
data; real reverse dependencies (`sys-libs/glibc`, `sys-libs/zlib`); a real
|
||||||
|
Flatpak reviewed update (Portage-installed Flatpak, flathub, downgraded commit,
|
||||||
|
reviewed update to the reviewed full commit, verified); custom-ebuild
|
||||||
|
stage/build/install/remove; managed AppImage acquire/list/launch/remove with a
|
||||||
|
tampered-SHA refusal; a Nix-enabled install with a real `nodejs-slim` profile
|
||||||
|
(inventory, filtering, generations); and the **non-root `pkexec sys --broker`
|
||||||
|
path** (cancelled authentication, successful broker execution, replay
|
||||||
|
rejection) after installing the shipped polkit action and the standard
|
||||||
|
wheel-admin rule. The read-only acceptance matrix re-run on the final static
|
||||||
|
`sys` (`dd61c610…`) reports `PASS=38 FAIL=0` (the matrix gained a reverse-
|
||||||
|
dependency regression).
|
||||||
|
- **Not completed (see `docs/HANDOFF.md`):** Snap install/refresh/remove (no
|
||||||
|
snapd in the image; needs `app-containers/snapd`, AppArmor and network); live
|
||||||
|
AI (a local model was served, but the sandboxed call exceeds the 120 s
|
||||||
|
transport timeout on CPU); and the distinct recovery boot (the recovery BLS
|
||||||
|
entry is present; selecting it interactively is not automated).
|
||||||
|
|
||||||
## 2026-09-25 — Fix the `sys` catalogue review findings (host/target, revalidation, update effects, Nix inventory, dependencies)
|
## 2026-09-25 — Fix the `sys` catalogue review findings (host/target, revalidation, update effects, Nix inventory, dependencies)
|
||||||
|
|
||||||
Follow-up to the package-management interface: seven review findings are fixed,
|
Follow-up to the package-management interface: seven review findings are fixed,
|
||||||
|
|
|
||||||
192
docs/HANDOFF.md
192
docs/HANDOFF.md
|
|
@ -3,126 +3,104 @@
|
||||||
Rolling note between work sessions. **Update this file before you finish**, then
|
Rolling note between work sessions. **Update this file before you finish**, then
|
||||||
commit it. It should be short and current; use `git log` for detail.
|
commit it. It should be short and current; use `git log` for detail.
|
||||||
|
|
||||||
- **Last updated:** this session (2026-09-25). Follow-up to commit `05d7075`:
|
- **Last updated:** this session (2026-09-25), second-round `sys` review fixes.
|
||||||
the seven review findings on the `sys` package-management interface are fixed
|
Follow-up to `d3f676a`. Three further confirmed defects are fixed with
|
||||||
(host/target rooting, maintenance effect revalidation, exact Flatpak/Snap
|
regression tests: unsafe cleanup previews, non-exact Flatpak/Snap update
|
||||||
update effects, complete source constraints, truthful cache-cleanup outcomes,
|
execution, and reverse-dependency self-reference. `make test` is green
|
||||||
Nix active-profile inventory, VDB-based dependency inspection), with
|
(661 → 683 tests). This corrects the earlier blanket claim that every review
|
||||||
regression tests. The disposable-VM acceptance matrix is extended and the
|
finding was already fixed.
|
||||||
fresh-install / mutating / rollback journeys below were completed.
|
- **Interface contract (unchanged):** ordinary requests use AI; only explicit
|
||||||
- **Interface contract (unchanged):** every ordinary request uses the AI
|
`--legacy` selects deterministic handling; source flags constrain the AI and
|
||||||
workflow; only an explicit `--legacy` selects deterministic handling; source
|
never bypass it; a missing model stops the workflow and offers the exact
|
||||||
flags constrain the AI and never bypass it; a missing model stops the workflow
|
`--legacy` command without executing it.
|
||||||
and offers the exact `--legacy` command without executing it; both modes share
|
|
||||||
the same validated typed actions, approval controls and execution layer.
|
|
||||||
|
|
||||||
## What this session changed (code)
|
## What this session changed (code)
|
||||||
|
|
||||||
1. **Host/target rooting (finding 1).** `Exec::tool_in_target` resolves tools
|
1. **Cleanup previews are non-destructive (finding 1).** `eclean-dist`/
|
||||||
from the target; `actions::target_spec` is shared by catalogue, chooser and
|
`eclean-pkg` delete by default, so `portage_cleaners` now previews with
|
||||||
update paths. Snap is host-only and is reported unavailable (and refused for
|
`--pretend --deep` (same selection policy as execution) and executes with
|
||||||
mutation) for an alternate root. Recording-runner tests assert no host
|
`--deep`; the Nix preview uses the documented `nix-store --gc --print-dead`.
|
||||||
`flatpak`/`snap` process is invoked for an alternate root.
|
Items are read from stdout+stderr, sorted and bound. Tests prove a cleaner
|
||||||
2. **Maintenance revalidation (finding 2).** `resolves_effects` covers
|
never runs destructively during planning, revalidation or cancelled approval.
|
||||||
`Depclean`/`ApplyUpdates`/`CleanCache`; depclean removals are structured
|
2. **Exact Flatpak/Snap update transactions (finding 2).**
|
||||||
`PackageEffect`s parsed from `emerge --pretend --depclean`, so a changed
|
`ResolvedPlan.updates` carries `UpdateTransaction`s: full Flatpak ref + full
|
||||||
removal set changes the digest and aborts at the execution boundary (and
|
installed/remote commits (via `flatpak info`, since the `commit` column is
|
||||||
within multi-action plans). Plan aggregation now carries `cleanup` intents.
|
abbreviated), or snap name + old/new revisions + channel. Execution consumes
|
||||||
3. **Exact update effects (finding 3).** `ApplyUpdates` resolves per-source
|
the reviewed transaction (`add_executable`… `flatpak update --commit=<c>`),
|
||||||
effects (each Flatpak app by ref, each snap by name) bound to approval and
|
revalidates each source immediately before its mutation, verifies the
|
||||||
revalidated; unrestricted update-all is gone. Lanes with no safe transaction
|
resulting commit/revision, and refuses non-exact transactions. A source whose
|
||||||
are refused. Cache cleanup reviews each cleaner's dry run via
|
resolution failed is never re-discovered. `PlanStore` aggregation includes
|
||||||
`ResolvedPlan.cleanup`.
|
`updates`.
|
||||||
4. **Source constraints (finding 4).** `backend()` classifies Portage-only
|
3. **Reverse dependencies (finding 3).** The reverse branch no longer drops
|
||||||
actions; `constrain_action` rewrites `DiscoverCandidates`/`ChoosePackage` and
|
valid matches; it excludes only a genuine self-reference (the *dependent* is
|
||||||
refuses the cross-lane `InspectInstallation` before querying.
|
the queried package).
|
||||||
5. **Cache-cleanup truthfulness (finding 5).** A cleaner that ran and failed
|
4. **Determinism.** `All selected packages:` removals are sorted (depclean
|
||||||
fails the action (partial successes preserved); unavailable is distinct;
|
previews are now order-independent); `emerge --depclean --ask=n`.
|
||||||
the report reaches exit status, assistant response and transaction history.
|
|
||||||
6. **Nix inventory (finding 6).** Active-profile `manifest.json` (v1/v2/v3)
|
|
||||||
packages are enumerated with profile/user scope and identity; historical
|
|
||||||
generations and realised store paths are separate; unsupported formats and
|
|
||||||
base profiles are stated explicitly.
|
|
||||||
7. **Dependencies (finding 7).** Forward/reverse dependencies use installed VDB
|
|
||||||
`DEPEND`/`RDEPEND`/`BDEPEND` (`qdepends` tree fallback), include
|
|
||||||
already-satisfied/conditional/versioned deps, never self, and distinguish a
|
|
||||||
failed query from an empty set.
|
|
||||||
|
|
||||||
Unit tests: `cargo test --workspace` (all green; see CHANGELOG). Build/static
|
## Verified in disposable VMs
|
||||||
binaries: `make build` and `make static`; the static `sys` built from the final
|
|
||||||
tree has SHA-256 `65307d85…` (see the VM log `TEST_SYS_SHA`).
|
|
||||||
|
|
||||||
## Verified in disposable VMs (this session)
|
- **Cache cleanup + depclean (real tools):** `eclean` upstream preview is
|
||||||
|
non-destructive; `sys clean cache` preview/cancelled/approved/drift/failed all
|
||||||
|
behave correctly; depclean cancel/approve with transaction history and
|
||||||
|
preserved `/home`.
|
||||||
|
- **Reverse dependencies:** `sys-libs/glibc` and `sys-libs/zlib` report real
|
||||||
|
dependents (conditional/versioned included).
|
||||||
|
- **Flatpak:** installed via Portage (`sys-apps/flatpak`, enabling
|
||||||
|
`media-libs/freetype[harfbuzz]`), flathub added, an app installed and
|
||||||
|
downgraded, then `sys apply updates --flatpak` resolved full ref+commits,
|
||||||
|
deployed the pinned commit, and verified it.
|
||||||
|
- **Custom ebuild:** stage → build/install (VDB entry + installed file) →
|
||||||
|
remove.
|
||||||
|
- **Managed AppImage:** acquire with pinned SHA-256, list, run the managed ELF,
|
||||||
|
remove; a placeholder SHA is refused.
|
||||||
|
- **Nix:** a `NIX_ENABLED=yes` install bootstraps Nix; `nix profile install
|
||||||
|
nixpkgs#nodejs-slim` into `/nix/var/nix/profiles/profile` is enumerated by
|
||||||
|
`sys list --nix` and found by `sys list nodejs --nix`, with store paths and
|
||||||
|
generations reported separately.
|
||||||
|
- **Non-root `pkexec sys --broker`:** with the shipped polkit action and the
|
||||||
|
standard wheel-admin rule installed on the disposable image, a wheel user
|
||||||
|
authenticated through a terminal agent; cancellations changed nothing, the
|
||||||
|
approved removal returned the broker JSON outcome, and the replay was
|
||||||
|
rejected. The shipped privilege policy is unchanged.
|
||||||
|
- **Read-only acceptance:** `installer/tests/vm/sys-acceptance.sh` `PASS=38
|
||||||
|
FAIL=0` re-run against the final static `sys` (`dd61c610…`), including the new
|
||||||
|
`rdeps-legacy` reverse-dependency regression.
|
||||||
|
|
||||||
- **Fresh install** (`fresh-install-1.qcow2`, test.conf `DESKTOP_PROFILE=none`,
|
## Not completed / blocked
|
||||||
`NIX_ENABLED=no`): `===INSTALL-RC=0===`, `NO_SECRET_LEAK`, then a detached
|
|
||||||
boot: `boot-systemd-running` PASS.
|
|
||||||
- **Out-of-box Portage permissions:** `/etc/portage` 755,
|
|
||||||
`repos.conf` 755, `repos.conf/gentoo.conf` 644,
|
|
||||||
`package.use/phoebus` 644 → non-root `sys search firefox --legacy` returns 3
|
|
||||||
real results and `sys updates --legacy` reports 10 available. This is the
|
|
||||||
fresh-install proof that `normalize_config_permissions` works without manual
|
|
||||||
repair.
|
|
||||||
- **Acceptance matrix:** `installer/tests/vm/sys-acceptance.sh` `SUMMARY PASS=37
|
|
||||||
FAIL=0` on both an existing installed clone and the fresh install, including
|
|
||||||
the new regressions `snap-alternate-root`, `list-nix-legacy`, `deps-legacy`.
|
|
||||||
- **Privileged mutating journeys** on the fresh install (via root; see blocked
|
|
||||||
note): install + VDB, remove, history, depclean, cache cleanup (honest
|
|
||||||
nonzero failure with no cleaner), alternate-root Snap refusal, and a Portage
|
|
||||||
`apply updates` journey — 7/7 PASS.
|
|
||||||
- **Rollback acceptance** on a disposable clone: snapshot → controlled change
|
|
||||||
(root marker + `app-misc/hello`) → `sys undo` → detached boot. The package
|
|
||||||
database fingerprint returned to the pre-change value, the root marker is
|
|
||||||
absent, the `/home` marker survives, and systemd is running.
|
|
||||||
- **Revision:** the final static `sys` (`TEST_SYS_SHA:65307d85…`) was re-fetched
|
|
||||||
into the fresh VM and the acceptance matrix re-run against it: `PASS=37
|
|
||||||
FAIL=0`. The installed `/usr/local/bin/sys` from the install-time build was
|
|
||||||
`SYS_SHA:22232a25…`; the only delta is the cleanup-intent plan-binding fix,
|
|
||||||
which the read-only matrix does not exercise.
|
|
||||||
|
|
||||||
## Blocked / not yet verified
|
- **Snap install/refresh/remove:** no snapd in the image. Prerequisite:
|
||||||
|
`app-containers/snapd` + AppArmor + network, installed through the supported
|
||||||
- **pkexec/Polkit `sys --broker --execute-plan` path:** the serial console has no
|
integration. The Snap transaction code is unit-tested only.
|
||||||
Polkit agent, so `pkexec` elevation cannot complete. Privileged execution was
|
- **Live AI:** a local OpenAI-compatible model (`llama-server` + a GGUF model)
|
||||||
exercised by running the same reviewed plan as root (initiator uid 0); the
|
was served on the host; the AI workflow reached the model, but the sandboxed
|
||||||
ledger/replacement/replay logic remains unit-tested and was previously
|
call exceeded the 120 s transport timeout on CPU (`curl` exit 28). Needs a
|
||||||
reviewed. To unblock: a seat-providing/graphical VM with a working Polkit
|
faster model/GPU or a remote provider credential. Fixture-backed routing and
|
||||||
agent, or a disposable test image with a passwordless-sudo polkit agent.
|
failure tests pass (`ask-offline`, missing-model offer, source constraint).
|
||||||
- **Nix profile journey:** the disposable install sets `NIX_ENABLED=no`, so no
|
- **Recovery boot (distinct from rollback):** the recovery BLS entry is present
|
||||||
Nix profile exists in the VM. The manifest parser (v1/v2/v3, unsupported
|
and asserted in the rollback acceptance, but booting it interactively was not
|
||||||
formats, inactive elements, historical generations) is unit-tested with
|
automated. Method: select "Phoebus Recovery (known-good snapshot)" in the
|
||||||
realistic fixtures. To unblock: install with Nix enabled and a known profile.
|
systemd-boot menu with no network.
|
||||||
- **Snap install/refresh/remove:** no snapd/AppArmor in the minimal image; the
|
- **Nix re-run flakiness:** a later `sys list --nix` re-run reported the profile
|
||||||
lane journey would need `app-containers/snapd`, AppArmor and network.
|
link dangling (the profile store path was gone) and correctly listed no
|
||||||
- **Managed AppImage acquire/launch/remove** and **custom-ebuild
|
packages; the first run with a real profile is the positive evidence.
|
||||||
stage/build/install/remove:** not run in the VM (no AppImage fixture/FUSE and
|
|
||||||
no build budget); the code paths are unit-tested.
|
|
||||||
- **Live AI:** no provider credential is present. `sys ask`/guided install and
|
|
||||||
source-constrained live AI remain unverified; do not invent a credential.
|
|
||||||
- **NVIDIA:** no GPU.
|
|
||||||
|
|
||||||
## Known blockers / risks
|
## Known blockers / risks
|
||||||
|
|
||||||
- A full VM install takes ~2 h; the fresh `fresh-install-1.qcow2` is now
|
- VM serial login is occasionally flaky; retry the boot when `detached-boot-login`
|
||||||
available for future work. `make doctor` reports low host disk space; delete
|
fails.
|
||||||
build/VMs deliberately, never a physical disk.
|
- `make doctor` passes (KVM accessible via an ACL). Disk is shared by build and
|
||||||
- The pre-existing `test-disk.qcow2` still cannot be unlocked (unknown
|
VM; watch free space.
|
||||||
passphrase); do not guess or brute-force.
|
- The pre-existing `test-disk.qcow2` cannot be unlocked (unknown passphrase); do
|
||||||
- OpenCode transport concatenates messages; multi-turn AI investigation is
|
not guess or brute-force it.
|
||||||
best-effort there.
|
|
||||||
|
|
||||||
## Next actions (in order)
|
## Next actions (in order)
|
||||||
|
|
||||||
1. **pkexec/Polkit broker acceptance** in a seat-providing or passwordless-agent
|
1. **Snap lane acceptance** with `app-containers/snapd` (install/refresh/remove,
|
||||||
disposable VM: successful approval, cancelled authentication, plan
|
confinement recorded).
|
||||||
replacement during authentication, replay after deleting user-owned plan
|
2. **Recovery boot** by selecting the recovery BLS entry with the network down.
|
||||||
state, and real ownership of personal settings.
|
3. **Live AI** with a faster local model/GPU or an authorized provider
|
||||||
2. **Nix profile journey** with `NIX_ENABLED=yes` and a profile containing a
|
credential (natural-language discovery, source constraints, reviewed install).
|
||||||
known package (`nodejs`), verifying inventory, filtering and generations.
|
4. **Nix profile GC stability** if the dangling re-run is reproducible.
|
||||||
3. **Snap/AppImage/custom-ebuild lane journeys** with benign fixtures and
|
|
||||||
recorded confinement limitations.
|
|
||||||
4. **Live AI** (`sys ask`, source-constrained discovery, reviewed install,
|
|
||||||
missing-model/provider-failure) once a credential or local model exists.
|
|
||||||
|
|
||||||
## Definition of a good stopping point
|
## Definition of a good stopping point
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -93,17 +93,19 @@ still not VM-verified.
|
||||||
| Personal preferences + alert state (user-owned, system-default precedence) | yes | yes (save/reload/isolation/precedence/failure) | yes (installed VM: saved to user config, exit 0) | no |
|
| Personal preferences + alert state (user-owned, system-default precedence) | yes | yes (save/reload/isolation/precedence/failure) | yes (installed VM: saved to user config, exit 0) | no |
|
||||||
| Personal write ownership (elevated chown, symlink refusal, cross-uid refusal) | yes | yes (ownership-fixer seam + CLI refusal) | no | no |
|
| Personal write ownership (elevated chown, symlink refusal, cross-uid refusal) | yes | yes (ownership-fixer seam + CLI refusal) | no | no |
|
||||||
| Personal preference does not need the root-owned system transaction log | yes | yes (CLI regression: read-only transaction dir) | yes (installed VM acceptance) | n/a |
|
| Personal preference does not need the root-owned system transaction log | yes | yes (CLI regression: read-only transaction dir) | yes (installed VM acceptance) | n/a |
|
||||||
| Installed `sys` acceptance matrix (read-only/failure) | yes | yes | yes (installed VM: `PASS=37 FAIL=0`, catalogue + regression group) | no |
|
| Installed `sys` acceptance matrix (read-only/failure) | yes | yes | yes (installed VM: `PASS=38 FAIL=0`, catalogue + regression group) | no |
|
||||||
| Portage config readable for non-root queries (`normalize_config_permissions`) | yes | yes (modes + keyring exclusion) | yes (fresh VM install: 0755/0644 out of the box; non-root `search` returns 3 results, `updates` reports 10) | no |
|
| Portage config readable for non-root queries (`normalize_config_permissions`) | yes | yes (modes + keyring exclusion) | yes (fresh VM install: 0755/0644 out of the box; non-root `search` returns 3 results, `updates` reports 10) | no |
|
||||||
| Privileged catalogue mutations (install/remove/depclean/cache/apply updates, alternate-root) | yes | yes (unit) | yes (fresh installed VM via root: 7/7 PASS) | no |
|
| Privileged catalogue mutations (install/remove/depclean/cache/apply updates, alternate-root) | yes | yes (unit) | yes (fresh installed VM via root: 7/7 PASS) | no |
|
||||||
| Rollback acceptance (snapshot -> change -> `sys undo` -> detached verify) | yes | yes | yes (clone: package DB restored, root marker gone, `/home` survives, boot running) | no |
|
| Rollback acceptance (snapshot -> change -> `sys undo` -> detached verify) | yes | yes | yes (clone: package DB restored, root marker gone, `/home` survives, boot running) | no |
|
||||||
| Privileged `--broker` plan execution + replay rejection in a VM (pkexec path) | yes | yes (privileged entry point) | no (serial console has no Polkit agent; direct privileged execution exercised via root) | n/a |
|
| Privileged `--broker` plan execution + replay rejection in a VM (pkexec path) | yes | yes (privileged entry point) | yes (non-root `pkexec` with a terminal polkit agent: cancelled auth, broker JSON success, replay rejected; required the shipped policy + wheel-admin rule) | n/a |
|
||||||
|
| Cache-cleanup preview is non-destructive (real `eclean`/`nix-store`) | yes | yes (preview uses `--pretend --deep` / `--print-dead`; sorted bound items) | yes (real `eclean`: upstream preview, cancelled approval, approved run, drift refusal, failed cleaner; user data preserved) | n/a |
|
||||||
|
| Reverse-dependency inspection includes installed targets | yes | yes (self-reference compares the dependent, not the target) | yes (real `sys-libs/glibc`, `sys-libs/zlib` dependents) | n/a |
|
||||||
| Transaction log (outcomes, protective snapshots) | yes | yes | read-only in installed VM; write path needs root | no |
|
| Transaction log (outcomes, protective snapshots) | yes | yes | read-only in installed VM; write path needs root | no |
|
||||||
| Flatpak/Nix bounded typed actions | yes | yes | no | no |
|
| Flatpak/Nix bounded typed actions | yes | yes | no | no |
|
||||||
| Shared hardware-aware source selection (all lanes) | yes | yes | no | no |
|
| Shared hardware-aware source selection (all lanes) | yes | yes | no | no |
|
||||||
| Snap lane (detect/install/list/remove/refresh/connections) | yes | yes | no | no |
|
| Snap lane (detect/install/list/remove/refresh/connections) | yes | yes (incl. exact revisions) | no (no snapd in the image; needs `app-containers/snapd`, AppArmor, network) | no |
|
||||||
| AppImage lane (import/acquire/integrity/desktop/remove) | yes | yes | no | no |
|
| AppImage lane (import/acquire/integrity/desktop/remove) | yes | yes | yes (VM: acquire with pinned SHA, list, launch fixture, remove; tampered SHA refused) | no |
|
||||||
| Custom ebuild overlay (stage/approve/build/remove) | yes | yes | no | no |
|
| Custom ebuild overlay (stage/approve/build/remove) | yes | yes | yes (VM: stage → build/install → VDB+file present → remove) | no |
|
||||||
| `sys` installed into the target + verified in chroot | yes | yes (unit) | yes (detached boot verified) | no |
|
| `sys` installed into the target + verified in chroot | yes | yes (unit) | yes (detached boot verified) | no |
|
||||||
| AI-first install workflow (`sys install`, `sys ask`) | yes | yes | explicit-backend journey; AI-selected not run | no |
|
| AI-first install workflow (`sys install`, `sys ask`) | yes | yes | explicit-backend journey; AI-selected not run | no |
|
||||||
| Bounded AI investigation (typed read-only evidence) | yes | yes | read-only actions on a booted VM | no |
|
| Bounded AI investigation (typed read-only evidence) | yes | yes | read-only actions on a booted VM | no |
|
||||||
|
|
@ -118,7 +120,8 @@ still not VM-verified.
|
||||||
| Unified package search (`sys search`, all lanes, `--legacy`) | yes | yes (cross-lane; unavailable/failed/empty distinguished; source filter) | no | no |
|
| Unified package search (`sys search`, all lanes, `--legacy`) | yes | yes (cross-lane; unavailable/failed/empty distinguished; source filter) | no | no |
|
||||||
| Installed-package inventory (`sys list`, all lanes, `--legacy`) | yes | yes (VDB/Flatpak/Snap/AppImage; **Nix active-profile packages** vs generations/store; custom ebuild never double-counted) | yes (VM read-only group) | no |
|
| Installed-package inventory (`sys list`, all lanes, `--legacy`) | yes | yes (VDB/Flatpak/Snap/AppImage; **Nix active-profile packages** vs generations/store; custom ebuild never double-counted) | yes (VM read-only group) | no |
|
||||||
| Package information (`sys info`, `--legacy`) | yes | yes (installed/available, version/deps/size/provenance; ambiguity flagged) | yes (VM read-only group) | no |
|
| Package information (`sys info`, `--legacy`) | yes | yes (installed/available, version/deps/size/provenance; ambiguity flagged) | yes (VM read-only group) | no |
|
||||||
| Cross-source update check/apply (`sys updates`, `apply updates`) | yes | yes (exact per-source identities bound to approval + revalidated; manual/project-specific refused) | yes (VM: check read-only; Portage apply journey) | no |
|
| Cross-source update check/apply (`sys updates`, `apply updates`) | yes | yes (exact per-source transactions with full Flatpak commits/snap revisions, pinned and revalidated; manual/project-specific refused) | Flatpak verified in VM (reviewed ref+commit, pinned update, verified); Snap unit-tested only; Portage verified | no |
|
||||||
|
| Nix active-profile inventory (`sys list --nix`) | yes | yes (manifest v1/v2/v3; scope; generations vs store) | yes (NIX_ENABLED=yes install: real `nodejs-slim` profile listed and filtered; a re-run correctly reported a dangling profile) | no |
|
||||||
| Catalogue maintenance (`depclean`, `clean cache`, `owners`, `deps`/`rdeps`) | yes | yes (structured depclean effects; cache-cleanup dry-run review + failure propagation; VDB dependency metadata) | yes (VM: depclean + cache-cleanup journeys; deps read-only) | no |
|
| Catalogue maintenance (`depclean`, `clean cache`, `owners`, `deps`/`rdeps`) | yes | yes (structured depclean effects; cache-cleanup dry-run review + failure propagation; VDB dependency metadata) | yes (VM: depclean + cache-cleanup journeys; deps read-only) | no |
|
||||||
| AI-default catalogue routing (source flags constrain, never bypass) | yes | yes (investigation loop, full backend classification + optional-backend rewrite, fallback offers exact `--legacy` command) | yes (read-only routing cases) | no |
|
| AI-default catalogue routing (source flags constrain, never bypass) | yes | yes (investigation loop, full backend classification + optional-backend rewrite, fallback offers exact `--legacy` command) | yes (read-only routing cases) | no |
|
||||||
| Alternate-root catalogue/update/maintenance rooting | yes | yes (chroot for Portage/Flatpak/Nix; Snap refused; recording-runner no-host-command tests) | yes (VM: alternate-root Snap refused) | no |
|
| Alternate-root catalogue/update/maintenance rooting | yes | yes (chroot for Portage/Flatpak/Nix; Snap refused; recording-runner no-host-command tests) | yes (VM: alternate-root Snap refused) | no |
|
||||||
|
|
|
||||||
41
docs/SYS.md
41
docs/SYS.md
|
|
@ -298,27 +298,40 @@ sys rdeps vim --legacy # reverse dependencies (equery)
|
||||||
repository, `DEPEND`/`RDEPEND`/`BDEPEND`) with resolved candidates and policy
|
repository, `DEPEND`/`RDEPEND`/`BDEPEND`) with resolved candidates and policy
|
||||||
metadata. When more than one real package matches, the report is marked
|
metadata. When more than one real package matches, the report is marked
|
||||||
**ambiguous** and lists every match instead of guessing.
|
**ambiguous** and lists every match instead of guessing.
|
||||||
- **Updates** check every supported lane. Applying updates resolves the exact
|
- **Updates** check every supported lane. Applying a Flatpak or Snap update
|
||||||
affected identities per source immediately before execution (each Flatpak app
|
**executes exactly the reviewed transaction**: the plan binds the full Flatpak
|
||||||
by ref, each snap by name) and re-checks the reviewed effect set at the
|
ref (`app/…/arch/branch`, from `remote-ls`) plus the installed and remote
|
||||||
execution boundary; a changed set aborts as a stale plan. AppImage (pinned
|
**full commits** (from `flatpak info`, since Flatpak's `commit` column is
|
||||||
URL+SHA) and Nix (project/declarative) are refused as a system-level
|
abbreviated), or the snap name plus its old/new revisions and tracking
|
||||||
transaction rather than reported as updated. A source that was attempted and
|
channel. Execution is pinned (`flatpak update --commit=<commit>`) and the
|
||||||
failed fails the whole action while the report still shows the sources that
|
source is revalidated immediately before its mutation — including after an
|
||||||
succeeded. Background **preparation** (`prepare updates`, `what are you
|
earlier source has run — so a commit republished under an unchanged human
|
||||||
compiling`) remains distinct from **activation**.
|
version, a newly appearing update, or a change in the active installation
|
||||||
|
aborts as stale. A source whose resolution failed is never re-discovered and
|
||||||
|
executed later. `flatpak` and `snap` both require backend prerequisites and
|
||||||
|
are refused explicitly when they cannot run. AppImage (pinned URL+SHA) and Nix
|
||||||
|
(project/declarative) are refused as a system-level transaction rather than
|
||||||
|
reported as updated. A source that was attempted and failed fails the whole
|
||||||
|
action while the report still shows the sources that succeeded. Background
|
||||||
|
**preparation** (`prepare updates`, `what are you compiling`) remains distinct
|
||||||
|
from **activation**.
|
||||||
- **Maintenance**: `depclean` records its removal set as **structured package
|
- **Maintenance**: `depclean` records its removal set as **structured package
|
||||||
effects** (not only prose) from `emerge --pretend --depclean` at review time,
|
effects** (not only prose) from `emerge --pretend --depclean` at review time,
|
||||||
so a changed removal set is caught before execution; it refuses when the
|
so a changed removal set is caught before execution; it refuses when the
|
||||||
selection cannot be established, and preserves config files and user data.
|
selection cannot be established, and preserves config files and user data.
|
||||||
`clean cache` reviews each cleaner's non-destructive dry run and binds it to
|
`clean cache` reviews each cleaner's real **non-destructive preview**
|
||||||
approval; a cleaner that ran and failed propagates as a failed action while
|
(`eclean-dist`/`eclean-pkg` delete by default, so the preview passes
|
||||||
partial successes are preserved, and an unavailable cleaner is reported
|
`--pretend` with the same `--deep` selection as the destructive run;
|
||||||
|
`nix-store --gc`'s documented preview is `--print-dead`) and binds the item
|
||||||
|
set to approval; a cleaner that ran and failed propagates as a failed action
|
||||||
|
while partial successes are preserved, and an unavailable cleaner is reported
|
||||||
distinctly from one that found nothing. `package_owners` and
|
distinctly from one that found nothing. `package_owners` and
|
||||||
`package_dependencies` use the installed VDB metadata (forward dependencies
|
`package_dependencies` use the installed VDB metadata (forward dependencies
|
||||||
include already-satisfied and conditional/versioned dependencies, never the
|
include already-satisfied and conditional/versioned dependencies, never the
|
||||||
requested package itself) with `qdepends`/`equery` as the tree fallback, and
|
requested package itself; reverse dependencies exclude only a genuine
|
||||||
report an explicit unsupported error when the tool is absent.
|
self-reference where the *dependent* is the queried package) with
|
||||||
|
`qdepends`/`equery` as the tree fallback, and report an explicit unsupported
|
||||||
|
error when the tool is absent.
|
||||||
- **Rooting**: every catalogue, update-check and maintenance command is built
|
- **Rooting**: every catalogue, update-check and maintenance command is built
|
||||||
for the *intended target* — directly for `/`, or inside the target chroot for
|
for the *intended target* — directly for `/`, or inside the target chroot for
|
||||||
an alternate root. Snap acts on the running daemon and is therefore reported
|
an alternate root. Snap acts on the running daemon and is therefore reported
|
||||||
|
|
|
||||||
|
|
@ -436,12 +436,18 @@ pub fn parse_emerge_pretend(text: &str) -> ResolvedPlan {
|
||||||
source,
|
source,
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
// `emerge --unmerge --pretend` does not use the `[ebuild ...]` form; it
|
// `emerge --unmerge --pretend`/`--depclean --pretend` do not use the
|
||||||
// lists the packages slated for removal. Parse them so a removal has a
|
// `[ebuild ...]` form; they list the packages slated for removal. Parse
|
||||||
// concrete, reviewable plan instead of being refused as unestablished.
|
// them so a removal has a concrete, reviewable plan instead of being
|
||||||
|
// refused as unestablished. Portage does not guarantee the order of this
|
||||||
|
// list, so sort and dedupe it: otherwise two previews of the *same*
|
||||||
|
// selection would produce different digests and falsely report drift.
|
||||||
for line in text.lines() {
|
for line in text.lines() {
|
||||||
if let Some(rest) = line.trim().strip_prefix("All selected packages:") {
|
if let Some(rest) = line.trim().strip_prefix("All selected packages:") {
|
||||||
for atom in rest.split_whitespace() {
|
let mut atoms: Vec<&str> = rest.split_whitespace().collect();
|
||||||
|
atoms.sort_unstable();
|
||||||
|
atoms.dedup();
|
||||||
|
for atom in atoms {
|
||||||
plan.effects.push(PackageEffect {
|
plan.effects.push(PackageEffect {
|
||||||
target: atom.to_string(),
|
target: atom.to_string(),
|
||||||
previous: None,
|
previous: None,
|
||||||
|
|
@ -618,6 +624,16 @@ Total: 5 packages (2 upgrades, 2 new, 1 uninstall), Size of downloads: 10,240 Ki
|
||||||
assert_eq!(plan.digest.len(), 64);
|
assert_eq!(plan.digest.len(), 64);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn depclean_selection_parsing_is_order_independent() {
|
||||||
|
// Portage does not guarantee the order of `All selected packages`.
|
||||||
|
let a = parse_emerge_pretend("All selected packages: app-misc/one-1.0 app-misc/two-2.0\n");
|
||||||
|
let b = parse_emerge_pretend("All selected packages: app-misc/two-2.0 app-misc/one-1.0\n");
|
||||||
|
assert_eq!(a.effects.len(), 2);
|
||||||
|
assert_eq!(a.digest, b.digest);
|
||||||
|
assert!(!changed_materially(&a, &b));
|
||||||
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn parses_unmerge_pretend_output() {
|
fn parses_unmerge_pretend_output() {
|
||||||
let text = "\n>>> These are the packages that would be unmerged:\n\n \
|
let text = "\n>>> These are the packages that would be unmerged:\n\n \
|
||||||
|
|
|
||||||
|
|
@ -310,61 +310,38 @@ fn flatpak_cols(line: &str) -> Vec<String> {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Parse `flatpak remote-ls --updates` and `flatpak list` output into exact,
|
/// Parse `flatpak info --system <ref>`: the installed `Version`, the installed
|
||||||
/// immutable-revision update transactions.
|
/// `Active commit` and the remote `Latest commit`. Flatpak's `--columns=commit`
|
||||||
///
|
/// truncates to 12 characters, so `info` is used for full immutable commits.
|
||||||
/// `updates` columns: `ref,application,version,branch,commit,origin,installation,type,arch`.
|
pub(crate) fn parse_flatpak_info(text: &str) -> (Option<String>, Option<String>, Option<String>) {
|
||||||
/// `installed` columns: `ref,application,version,branch,commit,installation,type,arch`.
|
fn nonempty(value: &str) -> Option<String> {
|
||||||
/// A transaction is `exact` only when both the ref and the target commit are
|
let value = value.trim();
|
||||||
/// present; otherwise the source must be refused rather than approximated.
|
if value.is_empty() {
|
||||||
pub(crate) fn parse_flatpak_transactions(updates: &str, installed: &str) -> Vec<UpdateTransaction> {
|
None
|
||||||
use std::collections::BTreeMap;
|
} else {
|
||||||
// ref -> (version, commit)
|
Some(value.to_string())
|
||||||
let mut current: BTreeMap<String, (Option<String>, Option<String>)> = BTreeMap::new();
|
|
||||||
for line in installed.lines() {
|
|
||||||
if line.trim().is_empty() {
|
|
||||||
continue;
|
|
||||||
}
|
}
|
||||||
let cols = flatpak_cols(line);
|
|
||||||
let (Some(r), version, commit) = (
|
|
||||||
cols.first().filter(|s| !s.is_empty()).cloned(),
|
|
||||||
cols.get(2).cloned(),
|
|
||||||
cols.get(4).cloned(),
|
|
||||||
) else {
|
|
||||||
continue;
|
|
||||||
};
|
|
||||||
current.insert(r, (version, commit));
|
|
||||||
}
|
}
|
||||||
let mut txns = Vec::new();
|
let (mut version, mut active, mut latest) = (None, None, None);
|
||||||
for line in updates.lines() {
|
for line in text.lines() {
|
||||||
if line.trim().is_empty() {
|
let t = line.trim();
|
||||||
continue;
|
if let Some(v) = t.strip_prefix("Version:") {
|
||||||
|
version = nonempty(v);
|
||||||
|
} else if let Some(v) = t.strip_prefix("Active commit:") {
|
||||||
|
active = nonempty(v);
|
||||||
|
} else if let Some(v) = t.strip_prefix("Latest commit:") {
|
||||||
|
latest = nonempty(v);
|
||||||
}
|
}
|
||||||
let cols = flatpak_cols(line);
|
|
||||||
let Some(identity) = cols.first().filter(|s| !s.is_empty()).cloned() else {
|
|
||||||
continue;
|
|
||||||
};
|
|
||||||
let next_version = cols.get(2).cloned().unwrap_or_default();
|
|
||||||
let next_revision = cols.get(4).filter(|s| !s.is_empty()).cloned();
|
|
||||||
let scope = cols.get(6).filter(|s| !s.is_empty()).cloned();
|
|
||||||
let previous = current.get(&identity);
|
|
||||||
txns.push(UpdateTransaction {
|
|
||||||
source: UpdateSource::Flatpak,
|
|
||||||
identity,
|
|
||||||
previous_version: previous.and_then(|(v, _)| v.clone()),
|
|
||||||
next_version,
|
|
||||||
previous_revision: previous.and_then(|(_, c)| c.clone()),
|
|
||||||
next_revision: next_revision.clone(),
|
|
||||||
scope,
|
|
||||||
related: Vec::new(),
|
|
||||||
exact: next_revision.is_some(),
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
txns.sort_by(|a, b| a.identity.cmp(&b.identity));
|
(version, active, latest)
|
||||||
txns
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Resolve the exact Flatpak update transactions for the target.
|
/// Resolve the exact Flatpak update transactions for the target.
|
||||||
|
///
|
||||||
|
/// `remote-ls` provides the remote refs with updates and their latest version;
|
||||||
|
/// `flatpak info` supplies the installed and remote full commits. A transaction
|
||||||
|
/// is `exact` only when both commits are known; otherwise the source is refused
|
||||||
|
/// rather than approximated.
|
||||||
pub(crate) fn flatpak_update_transactions(
|
pub(crate) fn flatpak_update_transactions(
|
||||||
exec: &Exec,
|
exec: &Exec,
|
||||||
root: &Path,
|
root: &Path,
|
||||||
|
|
@ -385,9 +362,9 @@ pub(crate) fn flatpak_update_transactions(
|
||||||
"flatpak",
|
"flatpak",
|
||||||
&[
|
&[
|
||||||
"remote-ls".into(),
|
"remote-ls".into(),
|
||||||
|
"--system".into(),
|
||||||
"--updates".into(),
|
"--updates".into(),
|
||||||
"--columns=ref,application,version,branch,commit,origin,installation,type,arch"
|
"--columns=ref,version".into(),
|
||||||
.into(),
|
|
||||||
],
|
],
|
||||||
))
|
))
|
||||||
.map_err(|e| {
|
.map_err(|e| {
|
||||||
|
|
@ -407,36 +384,74 @@ pub(crate) fn flatpak_update_transactions(
|
||||||
),
|
),
|
||||||
));
|
));
|
||||||
}
|
}
|
||||||
let installed = exec
|
let mut txns = Vec::new();
|
||||||
.runner
|
for line in updates.stdout_lossy().lines() {
|
||||||
.execute(&target_spec(
|
if line.trim().is_empty() {
|
||||||
root,
|
continue;
|
||||||
"sys",
|
}
|
||||||
"resolve flatpak updates",
|
let cols = flatpak_cols(line);
|
||||||
"flatpak",
|
let Some(identity) = cols.first().filter(|s| !s.is_empty()).cloned() else {
|
||||||
&[
|
continue;
|
||||||
"list".into(),
|
};
|
||||||
"--columns=ref,application,version,branch,commit,installation,type,arch".into(),
|
// `remote-ls` reports refs with the `app/`/`runtime/` type prefix, which
|
||||||
],
|
// is exactly what `flatpak info` and `flatpak update --commit` accept.
|
||||||
))
|
let next_version = cols.get(1).cloned().unwrap_or_default();
|
||||||
.map_err(|e| {
|
let info = exec
|
||||||
ExecError::operation(
|
.runner
|
||||||
|
.execute(&target_spec(
|
||||||
|
root,
|
||||||
"sys",
|
"sys",
|
||||||
"resolve flatpak updates",
|
"resolve flatpak updates",
|
||||||
format!("flatpak list could not run: {e}"),
|
"flatpak",
|
||||||
)
|
&["info".into(), "--system".into(), identity.to_string()],
|
||||||
})?;
|
))
|
||||||
if !installed.success {
|
.map_err(|e| {
|
||||||
return Err(ExecError::operation(
|
ExecError::operation(
|
||||||
"sys",
|
"sys",
|
||||||
"resolve flatpak updates",
|
"resolve flatpak updates",
|
||||||
format!("flatpak list failed: {}", installed.stderr_lossy().trim()),
|
format!("flatpak info {identity} could not run: {e}"),
|
||||||
));
|
)
|
||||||
|
})?;
|
||||||
|
if !info.success {
|
||||||
|
return Err(ExecError::operation(
|
||||||
|
"sys",
|
||||||
|
"resolve flatpak updates",
|
||||||
|
format!(
|
||||||
|
"flatpak info {identity} failed: {}",
|
||||||
|
info.stderr_lossy().trim()
|
||||||
|
),
|
||||||
|
));
|
||||||
|
}
|
||||||
|
let (installed_version, active, latest) = parse_flatpak_info(&info.stdout_lossy());
|
||||||
|
txns.push(UpdateTransaction {
|
||||||
|
source: UpdateSource::Flatpak,
|
||||||
|
identity,
|
||||||
|
previous_version: installed_version,
|
||||||
|
next_version,
|
||||||
|
previous_revision: active,
|
||||||
|
next_revision: latest,
|
||||||
|
scope: Some("system".to_string()),
|
||||||
|
related: Vec::new(),
|
||||||
|
exact: false,
|
||||||
|
});
|
||||||
}
|
}
|
||||||
Ok(parse_flatpak_transactions(
|
// `remote-ls --system` covers the system installation only. If the user
|
||||||
&updates.stdout_lossy(),
|
// installation also has applications, we cannot bind their updates here,
|
||||||
&installed.stdout_lossy(),
|
// so refuse the operation rather than approve an incomplete transaction.
|
||||||
))
|
let user_apps = exec.runner.execute(&target_spec(
|
||||||
|
root,
|
||||||
|
"sys",
|
||||||
|
"resolve flatpak updates",
|
||||||
|
"flatpak",
|
||||||
|
&["list".into(), "--user".into(), "--columns=ref".into()],
|
||||||
|
));
|
||||||
|
let user_present =
|
||||||
|
matches!(&user_apps, Ok(o) if o.success && !o.stdout_lossy().trim().is_empty());
|
||||||
|
for txn in &mut txns {
|
||||||
|
txn.exact = txn.next_revision.is_some() && txn.previous_revision.is_some() && !user_present;
|
||||||
|
}
|
||||||
|
txns.sort_by(|a, b| a.identity.cmp(&b.identity));
|
||||||
|
Ok(txns)
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Parse `snap refresh --list` and `snap list` output into exact update
|
/// Parse `snap refresh --list` and `snap list` output into exact update
|
||||||
|
|
@ -687,11 +702,17 @@ fn cleanup_items(output: &CommandOutput) -> Vec<String> {
|
||||||
}
|
}
|
||||||
text.push_str(&output.stderr_lossy());
|
text.push_str(&output.stderr_lossy());
|
||||||
}
|
}
|
||||||
text.lines()
|
let mut items: Vec<String> = text
|
||||||
|
.lines()
|
||||||
.map(str::trim)
|
.map(str::trim)
|
||||||
.filter(|l| !l.is_empty())
|
.filter(|l| !l.is_empty())
|
||||||
.map(str::to_string)
|
.map(str::to_string)
|
||||||
.collect()
|
.collect();
|
||||||
|
// The upstream cleaner does not guarantee output order; sort and dedupe so
|
||||||
|
// two previews of the same selection bind to the same digest.
|
||||||
|
items.sort();
|
||||||
|
items.dedup();
|
||||||
|
items
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Resolve a reviewable cache-cleanup plan from non-destructive dry runs. A
|
/// Resolve a reviewable cache-cleanup plan from non-destructive dry runs. A
|
||||||
|
|
@ -2151,6 +2172,21 @@ Total: 1 package (1 new), Size of downloads: 512 KiB
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn cleanup_items_are_order_independent() {
|
||||||
|
let mk = |s: &str| CommandOutput {
|
||||||
|
status: 0,
|
||||||
|
success: true,
|
||||||
|
stdout: s.as_bytes().to_vec(),
|
||||||
|
stderr: Vec::new(),
|
||||||
|
duration: std::time::Duration::from_millis(1),
|
||||||
|
};
|
||||||
|
let a = cleanup_items(&mk("b.tar.gz\na.tar.gz\n"));
|
||||||
|
let b = cleanup_items(&mk("a.tar.gz\nb.tar.gz\n"));
|
||||||
|
assert_eq!(a, b);
|
||||||
|
assert_eq!(a, vec!["a.tar.gz", "b.tar.gz"]);
|
||||||
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn resolve_cleanup_effects_never_runs_a_destructive_cleaner() {
|
fn resolve_cleanup_effects_never_runs_a_destructive_cleaner() {
|
||||||
let runner = RecordingRunner::new();
|
let runner = RecordingRunner::new();
|
||||||
|
|
|
||||||
|
|
@ -521,12 +521,20 @@ fn historical_generation_count(root: &Path) -> usize {
|
||||||
let base = target_path(root, "nix/var/nix/profiles");
|
let base = target_path(root, "nix/var/nix/profiles");
|
||||||
let mut count = 0;
|
let mut count = 0;
|
||||||
let mut visit = |dir: &Path| {
|
let mut visit = |dir: &Path| {
|
||||||
|
// The current generation is the one the active `profile` link points
|
||||||
|
// at; only the other `profile-N-link` generations are historical.
|
||||||
|
let active = std::fs::canonicalize(dir.join("profile")).ok();
|
||||||
if let Ok(entries) = std::fs::read_dir(dir) {
|
if let Ok(entries) = std::fs::read_dir(dir) {
|
||||||
for entry in entries.flatten() {
|
for entry in entries.flatten() {
|
||||||
let name = entry.file_name().to_string_lossy().to_string();
|
let name = entry.file_name().to_string_lossy().to_string();
|
||||||
if name.starts_with("profile-") && name.ends_with("-link") {
|
if !(name.starts_with("profile-") && name.ends_with("-link")) {
|
||||||
count += 1;
|
continue;
|
||||||
}
|
}
|
||||||
|
let target = std::fs::canonicalize(entry.path()).ok();
|
||||||
|
if active.is_some() && target == active {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
count += 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
@ -749,6 +757,34 @@ mod tests {
|
||||||
.any(|n| n.contains("historical profile generation")));
|
.any(|n| n.contains("historical profile generation")));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn current_generation_is_not_counted_as_historical() {
|
||||||
|
let runner = RecordingRunner::new();
|
||||||
|
let exec = make_exec(runner, false);
|
||||||
|
let root = Path::new(&exec.root);
|
||||||
|
let store = root.join("nix/store/aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa-nodejs-22.11.0");
|
||||||
|
std::fs::create_dir_all(&store).unwrap();
|
||||||
|
std::fs::write(store.join("manifest.json"), profile_manifest_v3()).unwrap();
|
||||||
|
let profiles = root.join("nix/var/nix/profiles");
|
||||||
|
std::fs::create_dir_all(&profiles).unwrap();
|
||||||
|
// `profile` points at the current generation, which is a package
|
||||||
|
// profile (it has a manifest), not a historical generation.
|
||||||
|
std::os::unix::fs::symlink(&store, profiles.join("profile-1-link")).unwrap();
|
||||||
|
std::os::unix::fs::symlink("profile-1-link", profiles.join("profile")).unwrap();
|
||||||
|
|
||||||
|
let inventory = installed_packages(root);
|
||||||
|
assert_eq!(inventory.packages.len(), 1);
|
||||||
|
assert_eq!(inventory.packages[0].profile, "profile");
|
||||||
|
assert!(
|
||||||
|
!inventory
|
||||||
|
.notes
|
||||||
|
.iter()
|
||||||
|
.any(|n| n.contains("historical profile generation")),
|
||||||
|
"{:?}",
|
||||||
|
inventory.notes
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn installed_packages_reports_unsupported_manifest_formats_explicitly() {
|
fn installed_packages_reports_unsupported_manifest_formats_explicitly() {
|
||||||
let runner = RecordingRunner::new();
|
let runner = RecordingRunner::new();
|
||||||
|
|
|
||||||
|
|
@ -944,7 +944,15 @@ pub fn depclean(exec: &Exec, root: &Path) -> Result<String> {
|
||||||
preview.trim()
|
preview.trim()
|
||||||
));
|
));
|
||||||
}
|
}
|
||||||
run_mut(exec, root, "emerge", &["--depclean", "--color=n"])?;
|
// `--ask=n` keeps the destructive run non-interactive: the human
|
||||||
|
// confirmation happened in the approval layer, and Portage must not try to
|
||||||
|
// read a second answer from the (already consumed) stdin.
|
||||||
|
run_mut(
|
||||||
|
exec,
|
||||||
|
root,
|
||||||
|
"emerge",
|
||||||
|
&["--depclean", "--ask=n", "--color=n"],
|
||||||
|
)?;
|
||||||
Ok(format!(
|
Ok(format!(
|
||||||
"removed unused packages; configuration files and user data were preserved\n\
|
"removed unused packages; configuration files and user data were preserved\n\
|
||||||
reviewed selection (emerge --pretend --depclean):\n{}",
|
reviewed selection (emerge --pretend --depclean):\n{}",
|
||||||
|
|
@ -1141,11 +1149,19 @@ fn revalidate_snap(exec: &Exec, root: &Path, approved: &[UpdateTransaction]) ->
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Installed Flatpak commits keyed by ref.
|
/// Installed Flatpak commits keyed by ref.
|
||||||
fn installed_flatpak_commits(
|
/// The installed active commit for every ref, from
|
||||||
|
/// `flatpak list --system --columns=ref,active`. `list` reports the bare ref
|
||||||
|
/// (without the `app/`/`runtime/` type prefix) and an abbreviated commit.
|
||||||
|
fn installed_flatpak_active(
|
||||||
exec: &Exec,
|
exec: &Exec,
|
||||||
root: &Path,
|
root: &Path,
|
||||||
) -> Result<std::collections::BTreeMap<String, String>> {
|
) -> Result<std::collections::BTreeMap<String, String>> {
|
||||||
let out = capture(exec, root, "flatpak", &["list", "--columns=ref,commit"])?;
|
let out = capture(
|
||||||
|
exec,
|
||||||
|
root,
|
||||||
|
"flatpak",
|
||||||
|
&["list", "--system", "--columns=ref,active"],
|
||||||
|
)?;
|
||||||
if !out.success {
|
if !out.success {
|
||||||
return Err(ExecError::operation(
|
return Err(ExecError::operation(
|
||||||
"sys",
|
"sys",
|
||||||
|
|
@ -1155,32 +1171,54 @@ fn installed_flatpak_commits(
|
||||||
}
|
}
|
||||||
let mut map = std::collections::BTreeMap::new();
|
let mut map = std::collections::BTreeMap::new();
|
||||||
for line in out.stdout_lossy().lines() {
|
for line in out.stdout_lossy().lines() {
|
||||||
if let Some((r, commit)) = line.split_once('\t').or_else(|| line.split_once(' ')) {
|
let mut cols = line.splitn(2, '\t');
|
||||||
if !r.trim().is_empty() && !commit.trim().is_empty() {
|
let (Some(reference), Some(active)) = (cols.next(), cols.next()) else {
|
||||||
map.insert(r.trim().to_string(), commit.trim().to_string());
|
continue;
|
||||||
}
|
};
|
||||||
|
if !reference.trim().is_empty() && !active.trim().is_empty() {
|
||||||
|
map.insert(reference.trim().to_string(), active.trim().to_string());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Ok(map)
|
Ok(map)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// Strip the `app/`/`runtime/` type prefix so a remote ref can be matched
|
||||||
|
/// against a `flatpak list` bare ref.
|
||||||
|
fn strip_flatpak_type(reference: &str) -> &str {
|
||||||
|
reference
|
||||||
|
.strip_prefix("app/")
|
||||||
|
.or_else(|| reference.strip_prefix("runtime/"))
|
||||||
|
.unwrap_or(reference)
|
||||||
|
}
|
||||||
|
|
||||||
fn execute_flatpak(exec: &Exec, root: &Path, txns: &[UpdateTransaction]) -> Result<String> {
|
fn execute_flatpak(exec: &Exec, root: &Path, txns: &[UpdateTransaction]) -> Result<String> {
|
||||||
for txn in txns {
|
for txn in txns {
|
||||||
let mut args = vec!["update".to_string(), "-y".to_string()];
|
// Scope to the system installation and pin the exact reviewed commit so
|
||||||
if let Some(scope) = &txn.scope {
|
// a remote that republishes in the window cannot deploy unreviewed.
|
||||||
args.push(format!("--installation={scope}"));
|
let mut args = vec![
|
||||||
|
"update".to_string(),
|
||||||
|
"--system".to_string(),
|
||||||
|
"--noninteractive".to_string(),
|
||||||
|
"-y".to_string(),
|
||||||
|
];
|
||||||
|
if let Some(commit) = &txn.next_revision {
|
||||||
|
args.push(format!("--commit={commit}"));
|
||||||
}
|
}
|
||||||
args.push("--".to_string());
|
|
||||||
args.push(txn.identity.clone());
|
args.push(txn.identity.clone());
|
||||||
let refs: Vec<&str> = args.iter().map(|s| s.as_str()).collect();
|
let refs: Vec<&str> = args.iter().map(|s| s.as_str()).collect();
|
||||||
run_mut(exec, root, "flatpak", &refs)?;
|
run_mut(exec, root, "flatpak", &refs)?;
|
||||||
}
|
}
|
||||||
// Post-execution verification: every reviewed ref must now be at the
|
// Post-execution verification: every reviewed ref must now be at the
|
||||||
// reviewed immutable commit.
|
// reviewed commit (compared by prefix, since `flatpak list` abbreviates).
|
||||||
let commits = installed_flatpak_commits(exec, root)?;
|
let active = installed_flatpak_active(exec, root)?;
|
||||||
for txn in txns {
|
for txn in txns {
|
||||||
let actual = commits.get(&txn.identity);
|
let key = strip_flatpak_type(&txn.identity);
|
||||||
if txn.next_revision.is_some() && actual != txn.next_revision.as_ref() {
|
let actual = active.get(key);
|
||||||
|
let reached = match (txn.next_revision.as_deref(), actual) {
|
||||||
|
(Some(next), Some(a)) => next.starts_with(a.as_str()),
|
||||||
|
_ => false,
|
||||||
|
};
|
||||||
|
if !reached {
|
||||||
return Err(ExecError::operation(
|
return Err(ExecError::operation(
|
||||||
"sys",
|
"sys",
|
||||||
"verify flatpak updates",
|
"verify flatpak updates",
|
||||||
|
|
@ -1770,15 +1808,12 @@ mod tests {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// One fake Flatpak ref update (`ref,app,version,branch,commit,origin,installation,type,arch`).
|
/// One fake Flatpak ref update (normalized ref, latest version, target commit).
|
||||||
#[derive(Clone)]
|
#[derive(Clone)]
|
||||||
struct FpUpdate {
|
struct FpUpdate {
|
||||||
reference: String,
|
reference: String,
|
||||||
app: String,
|
|
||||||
version: String,
|
version: String,
|
||||||
commit: String,
|
commit: String,
|
||||||
installation: String,
|
|
||||||
kind: String,
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Default)]
|
#[derive(Default)]
|
||||||
|
|
@ -1823,14 +1858,48 @@ mod tests {
|
||||||
if spec.args.iter().any(|a| a == "remote-ls") {
|
if spec.args.iter().any(|a| a == "remote-ls") {
|
||||||
let state = self.state.lock().unwrap();
|
let state = self.state.lock().unwrap();
|
||||||
let mut text = String::new();
|
let mut text = String::new();
|
||||||
|
// remote-ls columns: ref, version (the remote ref form is
|
||||||
|
// normalized by the caller, so use the local form here).
|
||||||
for u in &state.updates {
|
for u in &state.updates {
|
||||||
text.push_str(&format!(
|
text.push_str(&format!("{}\t{}\n", u.reference, u.version));
|
||||||
"{}\t{}\t{}\tstable\t{}\tflathub\t{}\t{}\tx86_64\n",
|
|
||||||
u.reference, u.app, u.version, u.commit, u.installation, u.kind
|
|
||||||
));
|
|
||||||
}
|
}
|
||||||
return Ok(ok_out(&text));
|
return Ok(ok_out(&text));
|
||||||
}
|
}
|
||||||
|
// The user installation is empty in these fixtures.
|
||||||
|
if spec.args.iter().any(|a| a == "--user") {
|
||||||
|
return Ok(ok_out(""));
|
||||||
|
}
|
||||||
|
// Verification: bare ref -> active commit.
|
||||||
|
if spec.args.iter().any(|a| a == "list") {
|
||||||
|
let state = self.state.lock().unwrap();
|
||||||
|
let mut text = String::new();
|
||||||
|
for (r, (_, commit)) in &state.installed {
|
||||||
|
let bare = r
|
||||||
|
.strip_prefix("app/")
|
||||||
|
.or_else(|| r.strip_prefix("runtime/"))
|
||||||
|
.unwrap_or(r);
|
||||||
|
text.push_str(&format!("{bare}\t{commit}\n"));
|
||||||
|
}
|
||||||
|
return Ok(ok_out(&text));
|
||||||
|
}
|
||||||
|
if spec.args.iter().any(|a| a == "info") {
|
||||||
|
let state = self.state.lock().unwrap();
|
||||||
|
let identity = spec.args.last().cloned().unwrap_or_default();
|
||||||
|
let (version, active) = state
|
||||||
|
.installed
|
||||||
|
.get(&identity)
|
||||||
|
.cloned()
|
||||||
|
.unwrap_or(("?".into(), "?".into()));
|
||||||
|
let latest = state
|
||||||
|
.updates
|
||||||
|
.iter()
|
||||||
|
.find(|u| u.reference == identity)
|
||||||
|
.map(|u| u.commit.clone())
|
||||||
|
.unwrap_or_else(|| active.clone());
|
||||||
|
return Ok(ok_out(&format!(
|
||||||
|
"Version: {version}\nActive commit: {active}\nLatest commit: {latest}\n"
|
||||||
|
)));
|
||||||
|
}
|
||||||
if spec.args.iter().any(|a| a == "update") {
|
if spec.args.iter().any(|a| a == "update") {
|
||||||
let mut state = self.state.lock().unwrap();
|
let mut state = self.state.lock().unwrap();
|
||||||
let target = spec.args.last().cloned().unwrap_or_default();
|
let target = spec.args.last().cloned().unwrap_or_default();
|
||||||
|
|
@ -1856,31 +1925,6 @@ mod tests {
|
||||||
}
|
}
|
||||||
return Ok(ok_out("updated\n"));
|
return Ok(ok_out("updated\n"));
|
||||||
}
|
}
|
||||||
if spec.args.iter().any(|a| a == "list") {
|
|
||||||
let state = self.state.lock().unwrap();
|
|
||||||
// Verification uses `--columns=ref,commit`.
|
|
||||||
if spec.args.iter().any(|a| a.contains("ref,commit")) {
|
|
||||||
let mut text = String::new();
|
|
||||||
for (r, (_, commit)) in &state.installed {
|
|
||||||
text.push_str(&format!("{r}\t{commit}\n"));
|
|
||||||
}
|
|
||||||
return Ok(ok_out(&text));
|
|
||||||
}
|
|
||||||
let mut text = String::new();
|
|
||||||
for (r, (version, commit)) in &state.installed {
|
|
||||||
let kind = if r.starts_with("runtime/") {
|
|
||||||
"runtime"
|
|
||||||
} else {
|
|
||||||
"app"
|
|
||||||
};
|
|
||||||
let app = r.split('/').nth(1).unwrap_or("");
|
|
||||||
text.push_str(&format!(
|
|
||||||
"{r}\t{app}\t{version}\tstable\t{commit}\t{}\t{kind}\tx86_64\n",
|
|
||||||
"system"
|
|
||||||
));
|
|
||||||
}
|
|
||||||
return Ok(ok_out(&text));
|
|
||||||
}
|
|
||||||
Ok(ok_out(""))
|
Ok(ok_out(""))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -1909,18 +1953,11 @@ mod tests {
|
||||||
(exec, runner)
|
(exec, runner)
|
||||||
}
|
}
|
||||||
|
|
||||||
fn fp_update(reference: &str, app: &str, version: &str, commit: &str) -> FpUpdate {
|
fn fp_update(reference: &str, version: &str, commit: &str) -> FpUpdate {
|
||||||
FpUpdate {
|
FpUpdate {
|
||||||
reference: reference.into(),
|
reference: reference.into(),
|
||||||
app: app.into(),
|
|
||||||
version: version.into(),
|
version: version.into(),
|
||||||
commit: commit.into(),
|
commit: commit.into(),
|
||||||
installation: "system".into(),
|
|
||||||
kind: if reference.starts_with("runtime/") {
|
|
||||||
"runtime".into()
|
|
||||||
} else {
|
|
||||||
"app".into()
|
|
||||||
},
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -1938,22 +1975,15 @@ mod tests {
|
||||||
#[test]
|
#[test]
|
||||||
fn flatpak_update_transactions_bind_full_refs_and_immutable_commits() {
|
fn flatpak_update_transactions_bind_full_refs_and_immutable_commits() {
|
||||||
let ref_firefox = "app/org.mozilla.firefox/x86_64/stable";
|
let ref_firefox = "app/org.mozilla.firefox/x86_64/stable";
|
||||||
let updates = format!(
|
// updates: ref, application, version, branch, commit, origin, arch
|
||||||
"{ref_firefox}\torg.mozilla.firefox\t129\tstable\tNEWCOMMIT\tflathub\tsystem\tapp\tx86_64\n"
|
// `flatpak info` is the full-commit source; the ref keeps its
|
||||||
);
|
// `app/`/`runtime/` type prefix, which `info` and `update` require.
|
||||||
let installed = format!(
|
let info = "Version: 51.0\nActive commit: OLDCOMMIT\nLatest commit: NEWCOMMIT\n";
|
||||||
"{ref_firefox}\torg.mozilla.firefox\t128\tstable\tOLDCOMMIT\tflathub\tsystem\tapp\tx86_64\n"
|
let (version, active, latest) = crate::actions::parse_flatpak_info(info);
|
||||||
);
|
assert_eq!(version.as_deref(), Some("51.0"));
|
||||||
let txns = crate::actions::parse_flatpak_transactions(&updates, &installed);
|
assert_eq!(active.as_deref(), Some("OLDCOMMIT"));
|
||||||
assert_eq!(txns.len(), 1);
|
assert_eq!(latest.as_deref(), Some("NEWCOMMIT"));
|
||||||
let t = &txns[0];
|
assert!(ref_firefox.starts_with("app/"));
|
||||||
assert_eq!(t.identity, ref_firefox);
|
|
||||||
assert_eq!(t.previous_version.as_deref(), Some("128"));
|
|
||||||
assert_eq!(t.next_version, "129");
|
|
||||||
assert_eq!(t.previous_revision.as_deref(), Some("OLDCOMMIT"));
|
|
||||||
assert_eq!(t.next_revision.as_deref(), Some("NEWCOMMIT"));
|
|
||||||
assert_eq!(t.scope.as_deref(), Some("system"));
|
|
||||||
assert!(t.exact);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
|
|
@ -1990,8 +2020,8 @@ mod tests {
|
||||||
.insert(ref_b.into(), ("45.1".into(), "OLD_B".into()));
|
.insert(ref_b.into(), ("45.1".into(), "OLD_B".into()));
|
||||||
let (exec, runner) = fp_exec(state);
|
let (exec, runner) = fp_exec(state);
|
||||||
runner.set_updates(vec![
|
runner.set_updates(vec![
|
||||||
fp_update(ref_a, "org.mozilla.firefox", "129", "NEW_A"),
|
fp_update(ref_a, "129", "NEW_A"),
|
||||||
fp_update(ref_b, "org.gnome.Platform", "45.2", "NEW_B"),
|
fp_update(ref_b, "45.2", "NEW_B"),
|
||||||
]);
|
]);
|
||||||
let plan = resolve_flatpak_plan(&exec);
|
let plan = resolve_flatpak_plan(&exec);
|
||||||
// The reviewed plan binds full refs, commits and the runtime.
|
// The reviewed plan binds full refs, commits and the runtime.
|
||||||
|
|
@ -2011,8 +2041,9 @@ mod tests {
|
||||||
assert_eq!(calls.len(), 2);
|
assert_eq!(calls.len(), 2);
|
||||||
for call in &calls {
|
for call in &calls {
|
||||||
assert!(call.iter().any(|a| a == "-y"));
|
assert!(call.iter().any(|a| a == "-y"));
|
||||||
assert!(call.iter().any(|a| a == "--installation=system"));
|
assert!(call.iter().any(|a| a == "--system"));
|
||||||
assert!(call.iter().any(|a| a == "--"));
|
assert!(call.iter().any(|a| a == "--noninteractive"));
|
||||||
|
assert!(call.iter().any(|a| a.starts_with("--commit=")));
|
||||||
}
|
}
|
||||||
assert!(calls.iter().any(|c| c.last().unwrap() == ref_a));
|
assert!(calls.iter().any(|c| c.last().unwrap() == ref_a));
|
||||||
assert!(calls.iter().any(|c| c.last().unwrap() == ref_b));
|
assert!(calls.iter().any(|c| c.last().unwrap() == ref_b));
|
||||||
|
|
@ -2029,21 +2060,11 @@ mod tests {
|
||||||
.installed
|
.installed
|
||||||
.insert(reference.into(), ("128".into(), "OLD".into()));
|
.insert(reference.into(), ("128".into(), "OLD".into()));
|
||||||
let (exec, runner) = fp_exec(state);
|
let (exec, runner) = fp_exec(state);
|
||||||
runner.set_updates(vec![fp_update(
|
runner.set_updates(vec![fp_update(reference, "129", "REVIEWED")]);
|
||||||
reference,
|
|
||||||
"org.mozilla.firefox",
|
|
||||||
"129",
|
|
||||||
"REVIEWED",
|
|
||||||
)]);
|
|
||||||
let plan = resolve_flatpak_plan(&exec);
|
let plan = resolve_flatpak_plan(&exec);
|
||||||
// The remote silently republishes a different commit with the same
|
// The remote silently republishes a different commit with the same
|
||||||
// human-readable version.
|
// human-readable version.
|
||||||
runner.set_updates(vec![fp_update(
|
runner.set_updates(vec![fp_update(reference, "129", "DIFFERENT")]);
|
||||||
reference,
|
|
||||||
"org.mozilla.firefox",
|
|
||||||
"129",
|
|
||||||
"DIFFERENT",
|
|
||||||
)]);
|
|
||||||
let err = apply_updates(
|
let err = apply_updates(
|
||||||
&exec,
|
&exec,
|
||||||
Path::new(&exec.root),
|
Path::new(&exec.root),
|
||||||
|
|
@ -2070,22 +2091,12 @@ mod tests {
|
||||||
.installed
|
.installed
|
||||||
.insert(reference.into(), ("128".into(), "OLD".into()));
|
.insert(reference.into(), ("128".into(), "OLD".into()));
|
||||||
let (exec, runner) = fp_exec(state);
|
let (exec, runner) = fp_exec(state);
|
||||||
runner.set_updates(vec![fp_update(
|
runner.set_updates(vec![fp_update(reference, "129", "NEW")]);
|
||||||
reference,
|
|
||||||
"org.mozilla.firefox",
|
|
||||||
"129",
|
|
||||||
"NEW",
|
|
||||||
)]);
|
|
||||||
let plan = resolve_flatpak_plan(&exec);
|
let plan = resolve_flatpak_plan(&exec);
|
||||||
// A second update appears after review.
|
// A second update appears after review.
|
||||||
runner.set_updates(vec![
|
runner.set_updates(vec![
|
||||||
fp_update(reference, "org.mozilla.firefox", "129", "NEW"),
|
fp_update(reference, "129", "NEW"),
|
||||||
fp_update(
|
fp_update("app/org.gnome.Calc/x86_64/stable", "46", "CALC"),
|
||||||
"app/org.gnome.Calc/x86_64/stable",
|
|
||||||
"org.gnome.Calc",
|
|
||||||
"46",
|
|
||||||
"CALC",
|
|
||||||
),
|
|
||||||
]);
|
]);
|
||||||
let err = apply_updates(
|
let err = apply_updates(
|
||||||
&exec,
|
&exec,
|
||||||
|
|
@ -2113,12 +2124,7 @@ mod tests {
|
||||||
.installed
|
.installed
|
||||||
.insert(reference.into(), ("128".into(), "OLD".into()));
|
.insert(reference.into(), ("128".into(), "OLD".into()));
|
||||||
let (exec, runner) = fp_exec(state);
|
let (exec, runner) = fp_exec(state);
|
||||||
runner.set_updates(vec![fp_update(
|
runner.set_updates(vec![fp_update(reference, "129", "NEW")]);
|
||||||
reference,
|
|
||||||
"org.mozilla.firefox",
|
|
||||||
"129",
|
|
||||||
"NEW",
|
|
||||||
)]);
|
|
||||||
let plan = resolve_flatpak_plan(&exec);
|
let plan = resolve_flatpak_plan(&exec);
|
||||||
let err = apply_updates(
|
let err = apply_updates(
|
||||||
&exec,
|
&exec,
|
||||||
|
|
@ -2152,8 +2158,7 @@ mod tests {
|
||||||
..Default::default()
|
..Default::default()
|
||||||
});
|
});
|
||||||
runner.set_updates(vec![fp_update(
|
runner.set_updates(vec![fp_update(
|
||||||
"app/org.mozilla.firefox/x86_64/stable",
|
"org.mozilla.firefox/x86_64/stable",
|
||||||
"org.mozilla.firefox",
|
|
||||||
"129",
|
"129",
|
||||||
"NEW",
|
"NEW",
|
||||||
)]);
|
)]);
|
||||||
|
|
|
||||||
|
|
@ -185,6 +185,16 @@ elif grep -qi "app-portage/portage-utils\|qdepends\|not installed" "$WORK/deps.e
|
||||||
else
|
else
|
||||||
report deps-legacy FAIL "rc=$? $(head -c 200 "$WORK/deps.err" | tr '\n' ' ')"
|
report deps-legacy FAIL "rc=$? $(head -c 200 "$WORK/deps.err" | tr '\n' ' ')"
|
||||||
fi
|
fi
|
||||||
|
# Regression: reverse dependencies of an installed library must include its
|
||||||
|
# dependents (a self-reference bug previously reported none).
|
||||||
|
"$SYS" --legacy --action \
|
||||||
|
'{"action":"package_dependencies","package":"sys-libs/glibc","reverse":true}' \
|
||||||
|
>"$WORK/rdeps.out" 2>"$WORK/rdeps.err"
|
||||||
|
if grep -q "installed packages depending on sys-libs/glibc" "$WORK/rdeps.out"; then
|
||||||
|
report rdeps-legacy PASS "$(head -c 140 "$WORK/rdeps.out" | tr '\n' ' ')"
|
||||||
|
else
|
||||||
|
report rdeps-legacy FAIL "$(head -c 200 "$WORK/rdeps.out$WORK/rdeps.err" | tr '\n' ' ')"
|
||||||
|
fi
|
||||||
|
|
||||||
# A recognizable catalogue command without --legacy must enter the AI workflow
|
# A recognizable catalogue command without --legacy must enter the AI workflow
|
||||||
# and must not run deterministically when no model is available.
|
# and must not run deterministically when no model is available.
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue