Commit Graph

89 Commits

Author SHA1 Message Date
342f10f38b ci: drop Go 1.25 from matrix (go.mod requires 1.26) 2026-03-05 22:37:56 +00:00
e9dc88f83a ci: add staticcheck lint job and Go version matrix for unit tests 2026-03-05 22:35:33 +00:00
597a4f9d72 Merge pull request #33 from gogrlx/cd/openbsd-detect-and-tests
fix(detect): wire up ports package for OpenBSD detection
2026-03-05 12:29:34 -05:00
8a9bba55cf Merge pull request #34 from gogrlx/cd/apt-test-coverage
fix(apt): fix extractURL multi-token options parsing and add unit tests
2026-03-05 12:26:45 -05:00
8075e74393 Merge pull request #35 from gogrlx/cd/pacman-test-coverage
test(pacman): add comprehensive unit tests for pure functions
2026-03-05 12:26:23 -05:00
ad45cfaef5 test(pacman): add comprehensive unit tests for pure functions
Add parse_test.go with edge case tests for parseList, parseSearch,
and parseInfo (empty input, whitespace, missing fields, colons in
values, no-repo names, partial installed markers).

Add helpers_test.go with tests for formatTargets, buildArgs option
combinations, parseUpgrades (standard + fallback format),
parseGroupPkgSet (duplicates, single-field lines), and interface
checks.

Coverage: 16.2% -> 24.1%.
2026-03-05 10:02:36 +00:00
6c8d0d367b fix(apt): fix extractURL multi-token options parsing and add unit tests
- Fix bug in extractURL where multi-token option blocks like
  [arch=amd64 signed-by=/path/key.gpg] were not properly skipped,
  causing the option value to be returned instead of the URL
- Add comprehensive unit tests for parseList, parseSearch, parseInfo
  edge cases (empty input, missing fields, special characters)
- Add unit tests for normalizeName and parseArch covering all
  supported Debian architectures and edge cases
- Add unit tests for formatTargets, buildArgs (all option combos),
  and extractURL (basic, options, signed-by)
- Coverage: apt package 7.5% -> 17.1%
2026-03-05 09:33:36 +00:00
90ca983200 fix(detect): wire up ports package for OpenBSD detection
The ports package was fully implemented but detect_openbsd.go still
returned nil candidates with a stale TODO. Wire up ports.New() so
OpenBSD systems can auto-detect their package manager.

Also adds:
- Unit tests for GetCapabilities with mock managers (base + full)
- Unit tests for Locker mutual exclusion
- Edge case tests for ports parser (empty input, whitespace, fallback)
- Minor dep updates (charmbracelet/ultraviolet, charmbracelet/x)
2026-03-05 09:03:38 +00:00
397e865107 Merge pull request #32 from gogrlx/cd/update-deps
chore(deps): update all dependencies
2026-03-01 10:49:14 -05:00
6ff778c857 fix(test): use non-installed package in dpkg/rpm Install_Unsupported tests
The tests expected Install("tree") to error because dpkg/rpm need
a .deb/.rpm file path. But "tree" is pre-installed in CI containers,
so the code short-circuits to "unchanged" and returns nil.

Use a non-existent package name instead to exercise the actual
install failure path.
2026-03-01 07:32:55 +00:00
f85e215981 fix: update apt/dpkg integration tests for 2-value Install/Remove returns 2026-03-01 01:44:50 +00:00
4e90abc6a3 fix: update integration tests for Install/Remove multi-return signature 2026-03-01 00:47:23 +00:00
e7018f3602 chore(deps): update all dependencies 2026-02-28 08:00:44 +00:00
e4844cca05 Merge cd/upgrade-packages: add PackageUpgrader interface (#31) 2026-02-28 07:26:52 +00:00
8306da6223 refactor(apt): build upgrade args directly instead of post-hoc insertion
Avoids fragile slice manipulation when injecting --only-upgrade flag.
2026-02-28 07:26:48 +00:00
f2eff01ab4 feat: add PackageUpgrader interface for targeted package upgrades
Add optional PackageUpgrader interface with UpgradePackages method
that upgrades specific installed packages (unlike Upgrade which
upgrades everything).

Each backend uses native upgrade commands:
- apt: apt-get install --only-upgrade
- dnf: dnf upgrade <pkg>
- pacman: pacman -S <pkg>
- apk: apk upgrade <pkg>
- pkg (FreeBSD): pkg upgrade <pkg>
- flatpak: flatpak update <pkg>
- snap: snap refresh <pkg>

Non-installed packages are filtered out and returned as Unchanged.

Closes #31
2026-02-28 07:26:11 +00:00
5629e41aeb style: goimports formatting 2026-02-28 07:09:07 +00:00
83d92be37a refactor(snack): merge GroupIsInstalled into Grouper interface
GroupQuerier was an unnecessary indirection — GroupIsInstalled is a group
operation and belongs on Grouper. No v1 stability guarantee, so breaking
the interface is fine.
2026-02-28 07:08:34 +00:00
bbb745434e Merge remote-tracking branch 'origin/copilot/add-isheld-method-to-holder-interface' into cd/integration-copilot-prs 2026-02-28 07:07:25 +00:00
c55027f9b7 merge: resolve pacman capabilities conflict (keep both interfaces) 2026-02-28 07:07:21 +00:00
b0e39036de Merge remote-tracking branch 'origin/copilot/add-install-remove-changes-reporting' into cd/integration-copilot-prs 2026-02-28 07:07:00 +00:00
ae56fb541d Merge remote-tracking branch 'origin/copilot/add-group-is-installed-check' into cd/integration-copilot-prs 2026-02-28 07:07:00 +00:00
copilot-swe-agent[bot]
a3e4827e5e Fix Reinstall, version-pinned, error propagation, and DryRun bugs in Install/Remove pre-filter
Co-authored-by: taigrr <8261498+taigrr@users.noreply.github.com>
2026-02-28 06:59:51 +00:00
copilot-swe-agent[bot]
6032f55925 Fix DNF isHeld to reuse listHeld instead of passing pkg to versionlock list
Co-authored-by: taigrr <8261498+taigrr@users.noreply.github.com>
2026-02-28 06:55:21 +00:00
copilot-swe-agent[bot]
22dda8684d Move GroupIsInstalled to separate GroupQuerier optional interface
Co-authored-by: taigrr <8261498+taigrr@users.noreply.github.com>
2026-02-28 06:54:28 +00:00
copilot-swe-agent[bot]
ec303b665f Add DryRunner implementation to dpkg package
Co-authored-by: taigrr <8261498+taigrr@users.noreply.github.com>
2026-02-28 06:54:06 +00:00
copilot-swe-agent[bot]
73d546235e detect: replace sync.Once with atomic.Pointer for race-safe caching and Reset()
Co-authored-by: taigrr <8261498+taigrr@users.noreply.github.com>
2026-02-28 06:51:41 +00:00
copilot-swe-agent[bot]
3d6baf3314 Add InstallResult and RemoveResult types; update Manager interface and all implementations
Co-authored-by: taigrr <8261498+taigrr@users.noreply.github.com>
2026-02-28 06:33:17 +00:00
copilot-swe-agent[bot]
34578efcad Update all package managers to return InstallResult/RemoveResult
Change Install and Remove method signatures across all package manager
implementations (apt, apk, dnf, pacman, rpm, dpkg, snap, flatpak, ports,
pkg) to match the updated Manager interface.

- Wrapper files: update Install/Remove to return (snack.InstallResult, error)
  and (snack.RemoveResult, error) respectively
- Platform files (_linux.go, _openbsd.go, _freebsd.go): implement pre-check
  logic using isInstalled() to classify packages as unchanged or to-process,
  run command on actionable packages only, then collect results with version()
- Stub files (_other.go): return (snack.InstallResult{}, ErrUnsupportedPlatform)
  and (snack.RemoveResult{}, ErrUnsupportedPlatform)
- DNF special case: add v5 bool parameter to internal install/remove functions
  and thread d.v5 from the wrapper; update Purge to discard the result
- cmd/snack/main.go: update install/remove commands to discard InstallResult/
  RemoveResult and return only the error to cobra

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
2026-02-28 06:31:01 +00:00
copilot-swe-agent[bot]
135e7c70f4 Add IsHeld method to Holder interface and implement in apt/dnf backends
Co-authored-by: taigrr <8261498+taigrr@users.noreply.github.com>
2026-02-28 06:24:07 +00:00
copilot-swe-agent[bot]
dec1516387 Add GroupIsInstalled to Grouper interface with pacman and dnf implementations
Co-authored-by: taigrr <8261498+taigrr@users.noreply.github.com>
2026-02-28 06:23:21 +00:00
copilot-swe-agent[bot]
9f943e9097 Add DryRunner interface and DryRun capability for dry-run support detection
Co-authored-by: taigrr <8261498+taigrr@users.noreply.github.com>
2026-02-28 06:22:26 +00:00
copilot-swe-agent[bot]
68ec5cb659 detect: cache Default() result with sync.Once, add Reset()
Co-authored-by: taigrr <8261498+taigrr@users.noreply.github.com>
2026-02-28 06:18:45 +00:00
copilot-swe-agent[bot]
c1ae8c4fac Initial plan 2026-02-28 06:18:16 +00:00
copilot-swe-agent[bot]
434c367687 Initial plan 2026-02-28 06:17:59 +00:00
copilot-swe-agent[bot]
3ecd9f6220 Initial plan 2026-02-28 06:17:44 +00:00
copilot-swe-agent[bot]
da5b1eb5db Initial plan 2026-02-28 06:16:46 +00:00
copilot-swe-agent[bot]
52d276bf43 Initial plan 2026-02-28 06:15:57 +00:00
470a3c5f98 Merge pull request #17 from gogrlx/dependabot/go_modules/golang.org/x/crypto-0.45.0
chore(deps): bump golang.org/x/crypto from 0.43.0 to 0.45.0
2026-02-26 01:52:04 -05:00
787a35dcd9 Merge pull request #20 from gogrlx/cd/exhaustive-containertests
test: exhaustive integration tests + codecov
2026-02-25 22:18:55 -05:00
5b3517e5a8 fix(dnf): add dnf5 versionlock parser, relax test assertions
- Add parseVersionLockDNF5 for dnf5's 'Package name: <name>' format
- Wire v5 flag through listHeld
- Relax apt ListRepos (DEB822 format may yield empty)
- Relax snap Info version assertion (uninstalled snaps)
- Add unit test for parseVersionLockDNF5
2026-02-26 03:15:47 +00:00
aa34f1d896 fix(test): relax assertions for cross-distro compatibility
- apk: Search_NoResults may return error instead of empty
- apt: Info may not populate Description; ListRepos URL may be empty
- pacman: Groups may not exist in minimal containers
- dnf: FileList_NotInstalled doesn't guarantee ErrNotInstalled sentinel;
  GroupInfo_NotFound may return empty instead of error;
  Holder tests nested under Hold (skip all if versionlock unavailable)
- flatpak: Info/Version may not work on all app IDs after install
2026-02-26 03:10:55 +00:00
387e951b86 fix: use snack.Manager interface type for type assertions, drop coverpkg 2026-02-26 02:53:39 +00:00
b12f956e45 test: exhaustive integration tests with codecov
- Root package unit tests: Targets, TargetNames, ApplyOptions, error sentinels
- Every provider integration test now covers:
  - All Manager interface methods (positive + negative cases)
  - GetCapabilities verification (assert expected interfaces)
  - VersionQuerier: LatestVersion, ListUpgrades, UpgradeAvailable, VersionCmp
  - Holder: Hold, ListHeld, Unhold (apt, dnf)
  - Cleaner: Autoremove, Clean
  - FileOwner: FileList, Owner (+ not-found cases)
  - RepoManager: ListRepos (apt, dnf, flatpak)
  - KeyManager: ListKeys (apt, dnf)
  - Grouper: GroupList, GroupInfo (pacman, dnf)
  - NameNormalizer: NormalizeName, ParseArch table tests (apt, dpkg, dnf, rpm)
- Containertest matrix: 5 distros (debian, alpine, arch, fedora39, fedora-latest)
- CI: coverage profiles uploaded per-job, merged in codecov job
- Added .gitignore for coverage files
2026-02-26 02:50:48 +00:00
d2efcebb9e Merge pull request #19 from gogrlx/cd/dnf5-full-coverage
feat(dnf): dnf5 addRepo fix + expanded test coverage
2026-02-25 21:44:19 -05:00
f4b9679504 feat(dnf): fix dnf5 addRepo compatibility, expand test coverage
- Fix addRepo to use 'config-manager addrepo --from-repofile=' for dnf5
  (dnf4 uses 'config-manager --add-repo')
- Add fedora:latest (dnf5) to containertest matrix
- Add IsDNF5 detection integration test
- Add RepoManager and NameNormalizer integration test coverage
- Rename containertest fedora entry to fedora-dnf4 for clarity
2026-02-26 02:40:11 +00:00
3737d54d12 Merge pull request #18 from gogrlx/cd/dnf5-support
feat(dnf): add dnf5 compatibility
2026-02-25 21:13:58 -05:00
beb4c51219 feat(dnf): add dnf5 compatibility
Detect dnf5 at startup via 'dnf --version' output and route to
version-specific parsers and command arguments.

Key changes:
- DNF struct caches v5 detection result
- New parse_dnf5.go with parsers for all dnf5 output formats
- stripPreamble() removes dnf5 repository loading noise
- Command arguments adjusted: --installed, --upgrades, --available
- CI matrix expanded with fedora:latest (dnf5) alongside fedora:39 (dnf4)
- Full backward compatibility with dnf4 preserved
2026-02-26 02:11:27 +00:00
dependabot[bot]
d85d256104 chore(deps): bump golang.org/x/crypto from 0.43.0 to 0.45.0
Bumps [golang.org/x/crypto](https://github.com/golang/crypto) from 0.43.0 to 0.45.0.
- [Commits](https://github.com/golang/crypto/compare/v0.43.0...v0.45.0)

---
updated-dependencies:
- dependency-name: golang.org/x/crypto
  dependency-version: 0.45.0
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>
2026-02-26 02:08:05 +00:00
61e9c99ac0 Merge pull request #16 from gogrlx/cd/testcontainers
feat: add testcontainers-based local integration tests
2026-02-25 21:06:27 -05:00