Skip to content

fix(errors): prioritize permission errors over 'does not exist' warnings#11

Merged
taigrr merged 1 commit intomasterfrom
cd/filtererr-priority-and-ci
Mar 6, 2026
Merged

fix(errors): prioritize permission errors over 'does not exist' warnings#11
taigrr merged 1 commit intomasterfrom
cd/filtererr-priority-and-ci

Conversation

@taigrr
Copy link
Owner

@taigrr taigrr commented Mar 6, 2026

Changes

Bug fix: filterErr error priority

filterErr checked does not exist before Interactive authentication required, so when systemd printed both (common for mask/unmask on non-installed units as a non-root user), the wrong error was returned — ErrDoesNotExist instead of ErrInsufficientPermissions.

Reordered checks so permission, bus, and masked errors take priority over existence warnings. The "does not exist, proceeding anyway" message from systemd is a warning, not a failure — the actual failure is the permission denial.

Tests

  • Added 3 new filterErr test cases covering mixed-stderr scenarios
  • Updated Mask/Unmask test expectations: masking nonexistent units in system mode as a non-root user correctly expects ErrInsufficientPermissions now

CI improvements

  • Install and start nginx so integration tests pass
  • Run tests as both user and root for full coverage
  • Upload both coverage profiles

Misc

  • Bump Go 1.26 → 1.26.1

Testing

  • go test -run TestFilterErr — all 14 cases pass
  • go test -run TestMask — all user cases pass
  • go test -run TestUnmask — all user cases pass
  • staticcheck ./... — clean

filterErr checked 'does not exist' before 'Interactive authentication
required', so when systemd printed both (common for mask/unmask on
non-installed units as a non-root user), the wrong error was returned.

Reorder checks so permission, bus, and masked errors take priority over
existence warnings. Add tests covering mixed-stderr scenarios.

Also:
- CI: install and start nginx so user + root tests pass
- CI: run tests as both user and root for full coverage
- Bump Go 1.26 → 1.26.1
@taigrr taigrr merged commit 038fbe1 into master Mar 6, 2026
1 of 2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant