Skip to content

feat: support sway+swaylock for screen saver lock check#372

Merged
am-on merged 3 commits intomainfrom
feat/support-sway-lock
Sep 19, 2025
Merged

feat: support sway+swaylock for screen saver lock check#372
am-on merged 3 commits intomainfrom
feat/support-sway-lock

Conversation

@am-on
Copy link
Collaborator

@am-on am-on commented Sep 18, 2025

Ref: #129

@github-actions
Copy link

github-actions bot commented Sep 18, 2025

Merging this branch will increase overall coverage

Impacted Packages Coverage Δ 🤖
github.com/ParetoSecurity/agent/checks/linux 89.75% (+0.24%) 👍
Total 46.50%

Coverage by file

Changed files (no unit tests)

Changed File Coverage Δ Total Covered Missed 🤖
github.com/ParetoSecurity/agent/checks/linux/password_unlock.go 91.23% (+2.66%) 57 (+22) 52 (+21) 5 (+1) 👍

Please note that the "Total", "Covered", and "Missed" counts above refer to code statements instead of lines of code. The value in brackets refers to the test coverage of that file in the old version of the code.

Changed unit test files

  • github.com/ParetoSecurity/agent/checks/linux/password_unlock_test.go

Copy link
Member

@zupo zupo left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That looks like it was a major PITA to figure out how to test, good job.

@am-on am-on force-pushed the feat/support-sway-lock branch from ca79447 to d322d68 Compare September 18, 2025 08:32
Comment on lines +103 to +104
if _, err := lookPath("sway"); err == nil {
f.passed = f.checkSway()
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Logic bug: The function unconditionally overwrites f.passed with the result of f.checkSway(), ignoring previous successful checks from GNOME or KDE. This means if GNOME passes but Sway fails (or vice versa), the final result will only reflect the Sway check. The logic should use OR (||) to preserve any previous successful results: f.passed = f.passed || f.checkSway() or use an early return pattern when a check passes.

Suggested change
if _, err := lookPath("sway"); err == nil {
f.passed = f.checkSway()
if _, err := lookPath("sway"); err == nil {
f.passed = f.passed || f.checkSway()

Spotted by Diamond

Fix in Graphite


Is this helpful? React 👍 or 👎 to let us know.

@am-on am-on force-pushed the feat/support-sway-lock branch 3 times, most recently from b3412ce to 86f6586 Compare September 18, 2025 09:03
@am-on am-on force-pushed the feat/support-sway-lock branch from 634a00a to 978fbb8 Compare September 19, 2025 02:32
@am-on am-on merged commit 72878e8 into main Sep 19, 2025
34 checks passed
@am-on am-on deleted the feat/support-sway-lock branch September 19, 2025 02:47
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.

3 participants