- Remove Makefile inline variable export (distro=arch) and invoke scripts via bash
- Add robust default in test-unit.sh and test-integration.sh:
: "${distro:=arch}"
- Prevent "unbound variable" errors under `set -u` when no distro is provided
- Pass `distro=arch` from Makefile into test scripts
- Replace hardcoded "arch" references with "${distro}"
- Update test-unit.sh and test-integration.sh to use dynamic image names
- Improve log output to reflect selected distro
https://chatgpt.com/share/6939c98a-d428-800f-8bb8-cf72e80ba80c
- Introduce `test-nix-flake-e2e.yml` workflow to run a full Arch-based virgin
environment test with Nix flakes enabled and shared Docker caches
- Ensure pkgmgr self-installation and flake-based installer path are exercised
- Update .gitignore with additional build artifacts, Debian packaging files,
and pkgmgr output directories
- Adjust install_repos integration test to patch resolve_command_for_repo
in the pipeline module and tighten DummyInstaller overrides
- Rewrite recursive capability integration tests to focus on layer
ordering and capability shadowing across Makefile, Python, Nix
and OS-package installers
- Extend recursive capabilities markdown with hierarchy diagram,
capability matrix, scenario matrix and link to the external
setup controller schema
https://chatgpt.com/share/69399857-4d84-800f-a636-6bcd1ab5e192
- Introduce explicit CLI layer model (os-packages, nix, python, makefile)
and central InstallationPipeline to orchestrate installers.
- Move installer orchestration out of install_repos() into
pkgmgr.actions.repository.install.pipeline, using layer precedence and
capability tracking.
- Add pkgmgr.actions.repository.install.layers to classify commands into
layers and compare priorities.
- Rework PythonInstaller to always use isolated environments:
PKGMGR_PIP override → active venv → per-repo venv under ~/.venvs/<identifier>,
avoiding system Python and PEP 668 conflicts.
- Adjust NixFlakeInstaller to install flake outputs based on repository
identity: pkgmgr/package-manager → pkgmgr (mandatory) + default (optional),
all other repos → default (mandatory).
- Tighten MakefileInstaller behaviour, add global
PKGMGR_DISABLE_MAKEFILE_INSTALLER switch, and simplify install target
detection.
- Rewrite resolve_command_for_repo() with explicit Repository typing,
better Python package detection, Nix/PATH resolution, and a
library-only fallback instead of raising on missing CLI.
- Update flake.nix devShell to provide python3 with pip and add pip as a
propagated build input.
- Remove deprecated/wip repository entries from config defaults and drop
the unused config/wip.yml.
https://chatgpt.com/share/69399157-86d8-800f-9935-1a820893e908
This update introduces Variant B behavior in the command resolver:
- If a repository explicitly defines the key \"command\" (even if its value is None),
resolve_command_for_repo() treats it as authoritative and returns immediately.
This allows library-only repositories to declare:
command: null
which disables CLI resolution entirely.
- As a result, Python package repositories without installed CLI entry points
no longer trigger SystemExit during update/install flows, as long as they set
command: null in their repo configuration.
The resolution logic is now bypassed for such repositories, skipping:
- Python package detection (src/*/__main__.py)
- PATH/Nix/venv binary lookup
- main.sh/main.py fallback evaluation
A new unit test suite has been added under
tests/unit/pkgmgr/core/command/test_resolve.py
covering:
1) Python package without installed command → SystemExit
2) Python package with installed command → returned correctly
3) Script repository fallback to main.py
4) Explicit command overrides all logic
This commit stabilizes update/install flows and ensures library-only
repositories behave as intended when no CLI command is provided.
https://chatgpt.com/share/69394a53-bc78-800f-995d-21099a68dd60
The pkgmgr proxy layer may intentionally terminate the process via
SystemExit(0). The previous test logic interpreted any SystemExit as a failure,
causing false negatives during `pkgmgr clone --all` E2E runs.
This patch updates `test_clone_all.py` to:
- accept SystemExit(0) as a successful run,
- only fail on non-zero exit codes,
- preserve diagnostic output for real failures.
This stabilizes the clone-all E2E test across proxy-triggered exits.
https://chatgpt.com/share/69393f6b-b854-800f-aabb-25811bbb8c74
- Use _resolve_repository_path() for explore, terminal and code commands
so tools no longer rely on a 'directory' key in the repository dict.
- Fall back to repositories_base_dir/repositories_dir via get_repo_dir()
when no explicit path-like key is present.
- Make VS Code workspace creation more robust (safe default for
directories.workspaces and UTF-8 when writing JSON).
- Add unit tests for handle_tools_command (explore, terminal, code) under
tests/unit/pkgmgr/cli/commands/test_tools.py.
- Add E2E/integration-style tests for the tools subcommands' --help
output under tests/e2e/test_tools_help.py, treating SystemExit(0) as
success.
This change fixes the KeyError: 'directory' when running 'pkgmgr code'
and verifies the behavior via unit and integration tests.
https://chatgpt.com/share/69393ca1-b554-800f-9967-abf8c4e3fea3
This commit introduces two new end-to-end integration tests:
• tests/e2e/test_clone_all.py
Runs: pkgmgr clone --all --clone-mode https --no-verification
Verifies that full HTTPS cloning of all configured repositories
works inside the test container environment.
• tests/e2e/test_update_all.py
Runs: pkgmgr update --all --clone-mode https --no-verification
Ensures that updating all repositories with HTTPS mode completes
successfully without raising exceptions.
Both tests:
- Provide extended diagnostics on SystemExit
- Reuse nix-profile cleanup helpers for consistent test environments
- Validate that `pkgmgr --help` works after execution
These tests complement the existing shallow-install integration test
and improve overall reliability of HTTPS clone/update workflows.
This commit adds a safety guard to create_ink() to prevent creation of
self-referential symlinks when the resolved command already lives at the
intended link target (e.g. ~/.local/bin/package-manager). Such a situation
previously resulted in broken shells with the error:
"zsh: too many levels of symbolic links"
Key changes:
- create_ink():
• Introduce early-abort guard when command == link_path
• Improve function signature and formatting
• Enhance alias creation messaging
- Added comprehensive unit tests under:
tests/unit/pkgmgr/core/command/test_ink.py
Tests cover:
• Self-referential command path → skip symlink creation
• Standard symlink + alias creation behaviour
This prevents pkgmgr from overwriting user-managed binaries inside ~/.local/bin
and ensures predictable, safe behaviour across all installer layers.
https://chatgpt.com/share/6938a43b-0eb8-800f-9545-6cb555ab406d
Update Debian, RPM, Nix flake, and Python installer unit tests to match the current
installer behavior and to run correctly inside the Nix development shell.
- DebianControlInstaller:
- Add clearer docstrings for supports() behavior.
- Relax final install assertion to accept dpkg -i, sudo dpkg -i, or
sudo apt-get install -y.
- Keep checks for apt-get update, apt-get build-dep, and dpkg-buildpackage.
- RpmSpecInstaller:
- Add docstrings for supports() conditions.
- Mock _prepare_source_tarball() to avoid touching the filesystem.
- Assert builddep, rpmbuild -ba, and sudo dnf install -y commands.
- NixFlakeInstaller:
- Ensure supports() and run() tests simulate a non-Nix-shell environment
via IN_NIX_SHELL and PKGMGR_DISABLE_NIX_FLAKE_INSTALLER.
- Verify that the old profile entry is removed and both pkgmgr and default
flake outputs are installed.
- Confirm _ensure_old_profile_removed() swallows SystemExit.
- PythonInstaller:
- Make supports() and run() tests ignore the real IN_NIX_SHELL environment.
- Assert that pip install . is invoked with cwd set to the repository
directory.
These changes make the unit tests stable in the Nix dev shell and align them
with the current installer implementations.
This commit adds the `pkgmgr_nix_store` volume mount (`/nix`) to all test
runners (unit, integration, container sanity checks, and E2E tests).
Previously only the Arch-based E2E container mounted a persistent `/nix`
store, causing all other distros (Debian, Ubuntu, Fedora, CentOS, etc.)
to download the entire Nix closure repeatedly during test runs.
Changes:
- Add `-v pkgmgr_nix_store:/nix` to:
- scripts/test/test-container.sh
- scripts/test/test-e2e.sh (remove Arch-only condition)
- scripts/test/test-unit.sh
- scripts/test/test-integration.sh
- Ensures all test containers reuse the same Nix store.
Benefits:
- Significantly faster test execution after the first run.
- Prevents redundant downloads from cache.nixos.org.
- Ensures consistent Nix environments across all test distros.
No functional changes to pkgmgr itself; only test infrastructure improved.
https://chatgpt.com/share/693890f5-2f54-800f-b47e-1925da85b434
- Update pkgmgr.actions.branch.open_branch() to resolve the base branch
via _resolve_base_branch(), preferring 'main' and falling back to
'master' when the preferred branch does not exist.
- Adjust the open_branch logic to:
- fetch from origin
- checkout the resolved base branch
- pull the resolved base branch
- create the feature branch
- push the new branch with upstream tracking
- Add and refine unit tests in tests/unit/pkgmgr/actions/test_branch.py
to cover:
- normal branch creation with explicit name and default base
- interactive name prompting when no name is provided
- error handling when fetch fails after successful base resolution
- fallback to 'master' when 'main' is missing.
- Clean up and clarify docstrings and comments for open_branch(),
close_branch(), and _resolve_base_branch(), and fix the module header
comment to match the new package path.
This fixes branch opening in repositories that still use 'master' as
their primary branch while keeping the default behavior for 'main'.
https://chatgpt.com/share/6938838f-7aac-800f-b130-924e07ef48b9
- Updated update_pyproject_version() to gracefully skip missing or unreadable pyproject.toml
- Added corresponding unit test ensuring missing file triggers no exception and no file creation
- Updated test wording for spec changelog section
- Ref: adjustments discussed in ChatGPT conversation (2025-12-09) - https://chatgpt.com/share/69388024-93e4-800f-a09f-bf78a6b9a53f
- NixFlakeInstaller:
- Skip when running inside a Nix dev shell (IN_NIX_SHELL).
- Add PKGMGR_DISABLE_NIX_FLAKE_INSTALLER kill-switch for CI/debugging.
- Ensure run() respects supports() and handles preview/allow_failure cleanly.
- DebianControlInstaller:
- Introduce _privileged_prefix() to handle sudo vs. root vs. no elevation.
- Avoid hard-coded sudo usage and degrade gracefully when neither sudo nor
root is available.
- Improve messaging around build-dep and .deb installation.
- RpmSpecInstaller:
- Prepare rpmbuild tree and source tarball in ~/rpmbuild/SOURCES based on
Name/Version from the spec file.
- Reuse a helper to resolve the rpmbuild topdir.
- Install built RPMs via dnf/yum when available, falling back to rpm -Uvh
to avoid file conflicts during upgrades.
- PythonInstaller:
- Skip pip-based installation inside Nix dev shells (IN_NIX_SHELL).
- Add PKGMGR_DISABLE_PYTHON_INSTALLER kill-switch.
- Make pip command resolution explicit and overridable via PKGMGR_PIP.
- Type-hint supports() and run() with RepoContext/InstallContext.
- Docker entrypoint:
- Add robust CA bundle detection for Nix, Git, Python requests and curl.
- Export NIX_SSL_CERT_FILE, SSL_CERT_FILE, REQUESTS_CA_BUNDLE and
GIT_SSL_CAINFO from a single detected CA path.
- Improve logging and section comments in the entrypoint script."
https://chatgpt.com/share/69387df8-bda0-800f-a053-aa9e2999dc84
This update introduces a configurable TEST_PATTERN variable in the Makefile,
allowing selective execution of unit, integration, and E2E tests without
modifying scripts.
Key changes:
- Add TEST_PATTERN (default: test_*.py) to Makefile and export it.
- Inject TEST_PATTERN into all test containers via `-e TEST_PATTERN=...`.
- Update test-unit.sh, test-integration.sh, and test-e2e.sh to use
`-p "$TEST_PATTERN"` instead of a hardcoded pattern.
- Ensure flexible test selection via:
make test-e2e TEST_PATTERN=test_install_pkgmgr_shallow.py
This enables fast debugging, selective test runs, and better developer
experience while keeping full compatibility with CI defaults.
https://chatgpt.com/share/69385400-2f14-800f-b093-bb03c8ef9c7f
This commit enhances the behaviour of pull_with_verification() and adds a
comprehensive unit test suite covering all control flows.
Changes:
- Added `preview` parameter to fully disable interaction and execution.
- Improved verification logic:
* Prompt only when not in preview, verification is enabled,
verification info exists, and verification failed.
* Skip prompts entirely when --no-verification is set.
- More explicit construction of `git pull` command with optional extra args.
- Improved messaging and formatting for clarity.
- Ensured directory existence is checked before any verification logic.
- Added detailed comments explaining logic and conditions.
Tests:
- New file tests/unit/pkgmgr/actions/repos/test_pull_with_verification.py
- Covers:
* Preview mode (no input, no subprocess)
* Verification failure – user rejects
* Verification failure – user accepts
* Verification success – immediate git call
* Missing repository directory – skip silently
* --no-verification flag bypasses prompts
* Command formatting with extra args
- Uses systematic mocking for identifier, repo-dir, verify_repository(),
subprocess.run(), and user input.
This significantly strengthens correctness, UX, and test coverage of the
repository pull workflow.
https://chatgpt.com/share/69384aaa-0c80-800f-b4b4-64e6fbdebd3b
In GitHub's Fedora-based CI containers the directory /nix may already exist
(e.g. from the base image or a previous build layer) and is often owned by
root:root. In this situation the Nix single-user installer aborts with:
"directory /nix exists, but is not writable by you"
This caused the container build to fail during `init-nix.sh`, leaving no
working `nix` binary on PATH. As a result, the runtime wrapper
(pkmgr-wrapper.sh) reported:
"[pkgmgr-wrapper] ERROR: 'nix' binary not found on PATH."
Local runs did not show the issue because a previous installation had already
created /nix with correct ownership.
This commit makes container-mode Nix initialization fully idempotent:
• If /nix does not exist → create it with owner nix:nixbld (existing logic).
• If /nix exists but has wrong owner/group → forcibly chown -R nix:nixbld.
• A warning is emitted if /nix remains non-writable after correction.
This guarantees that the Nix installer always has writable access to /nix
and prevents the installer from aborting in CI. As a result, `pkgmgr --help`
works again inside Fedora CI containers.
https://chatgpt.com/share/69384149-9dc8-800f-8148-55817ece8e21
This commit updates all GitHub Actions workflows and the Makefile to ensure
consistent behavior across unit, integration, end-to-end, and OS-container
tests.
Changes include:
CI Workflows:
- Rename workflows for clearer, more professional naming:
* "Test Distribution Containers" → "Test OS Containers"
* "Test package-manager (e2e)" → "Test End-To-End"
* "Test package-manager (unit)" → "Test Units"
* "Test package-manager (integration)" → "Test Code Integration"
- Remove explicit build steps from workflows; container creation is now
delegated to the Makefile via build-missing.
- Restrict test jobs to only build the Arch test container by setting:
DISTROS="arch"
Makefile:
- Add build-missing as a dependency to all test targets:
test-unit, test-integration, test-e2e, test-container
- Remove redundant build-missing call from the combined 'test' target,
since Make now ensures build-missing runs exactly once per invocation.
- Preserve existing target structure while ensuring container images are
built automatically on demand.
This makes the CI pipeline faster, more predictable, and removes duplicated
container build logic. All tests now use the same unified mechanism for
building missing images.
This commit introduces proper handling of the `ignore: true` flag in the
repository selection mechanism and adds comprehensive unit tests for both
`ignored.py` and `selected.py`.
- `get_selected_repos()` now filters ignored repositories in all implicit
selection modes:
• filter-only mode (string/category/tag)
• `--all` mode
• CWD-based selection
- Explicit identifiers (e.g. `pkgmgr install ignored-repo`) **bypass**
ignore filtering, so the user can still operate directly on ignored
repositories if they ask for them explicitly.
- Added `_maybe_filter_ignored()` helper to handle logic cleanly and allow
future extension (e.g. integrating a CLI flag `--include-ignored`).
Under `tests/unit/pkgmgr/core/repository`:
1. **test_ignored.py**
• Ensures `filter_ignored()` removes repos with `ignore: true`
• Ensures empty lists are handled correctly
2. **test_selected.py**
Comprehensive coverage of the selection logic:
• Explicit identifiers bypass ignore filtering
• Filter-only mode excludes ignored repos unless `include_ignored=True`
• `--all` mode excludes ignored repos unless explicitly overridden
• CWD-based detection filters ignored repos unless explicitly overridden
Before this change, ignored repositories still appeared in `pkgmgr list`,
`pkgmgr status`, and other commands using `get_selected_repos()`.
This was unintuitive and broke the expected semantics of the `ignore`
attribute.
The new logic ensures ignored repositories are truly invisible unless
explicitly requested.
https://chatgpt.com/share/69383b41-50a0-800f-a2b9-c680cd96d9e9
- Move the monolithic pkgmgr/actions/release.py implementation into the
pkgmgr.actions.release package, splitting concerns into versioning,
git_ops and files helpers.
- Extend the release orchestration to update Fedora/RPM %changelog
entries via update_spec_changelog(), reusing the same effective
release message as for CHANGELOG.md and debian/changelog.
- Wire the new update_spec_changelog() helper into _release_impl() so
every release keeps project, Debian and RPM metadata in sync.
- Add unit tests for update_spec_changelog() and for the updated release
orchestration behaviour in preview and real modes.
- Remove the deprecated pkgmgr/actions/release.py module.
See ChatGPT discussion: https://chatgpt.com/share/6938368e-0940-800f-92d3-f2ccfddab794