Skip to content

fix(ci): handle missing server log files in cleanup steps#769

Closed
TimeToBuildBob wants to merge 1 commit intoActivityWatch:masterfrom
TimeToBuildBob:fix/ci-log-cleanup
Closed

fix(ci): handle missing server log files in cleanup steps#769
TimeToBuildBob wants to merge 1 commit intoActivityWatch:masterfrom
TimeToBuildBob:fix/ci-log-cleanup

Conversation

@TimeToBuildBob
Copy link
Contributor

@TimeToBuildBob TimeToBuildBob commented Feb 22, 2026

Summary

  • Fixes false CI failures on the aw-server-rust master test matrix entry
  • When the server writes logs to stdout/stderr instead of files, the glob ~/.cache/activitywatch/log/*/*.log has no matches, causing bash to treat it as a literal string → cat/mv fails → step fails → job shows as red

Fix

  • Use shopt -s nullglob so unmatched globs expand to nothing
  • Switch mv glob to a for-loop that handles the empty case gracefully

Context

Re-submission of #768 which was mistakenly closed — #767 (date range picker fix) was merged but is unrelated to this CI issue. The log cleanup failure still occurs on every PR's aw-server-rust master matrix entry.


Important

Fixes CI false failures by handling missing log files with shopt -s nullglob and a for-loop in nodejs.yml.

This description was created by Ellipsis for ccc77c4. You can customize this summary. It will automatically update as commits are pushed.

When aw-server-rust doesn't produce log files (e.g. logs go to
stdout/stderr instead of files), the glob pattern in the cleanup
steps fails because bash treats unmatched globs as literal strings.

Fix: use `shopt -s nullglob` so unmatched globs expand to nothing,
and switch `mv` to a for-loop that handles the empty case.

This was causing false CI failures on the "aw-server-rust master"
test matrix entry for every PR.
Copy link
Contributor

@ellipsis-dev ellipsis-dev bot left a comment

Choose a reason for hiding this comment

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

Important

Looks good to me! 👍

Reviewed everything up to ccc77c4 in 5 seconds. Click for details.
  • Reviewed 26 lines of code in 1 files
  • Skipped 0 files when reviewing.
  • Skipped posting 0 draft comments. View those below.
  • Modify your settings and rules to customize what types of comments Ellipsis leaves. And don't forget to react with 👍 or 👎 to teach Ellipsis.

Workflow ID: wflow_IdHOhFLWNdIo4mzL

You can customize Ellipsis by changing your verbosity settings, reacting with 👍 or 👎, replying to comments, or adding code review rules.

@greptile-apps
Copy link
Contributor

greptile-apps bot commented Feb 22, 2026

Greptile Summary

This PR fixes false CI failures in the aw-server-rust master test matrix entry. When the server writes logs to stdout/stderr instead of files, the glob pattern ~/.cache/activitywatch/log/*/*.log has no matches, causing bash to treat it as a literal string and making cat and mv commands fail.

The fix applies two changes:

  • Adds shopt -s nullglob so unmatched globs expand to nothing instead of literal strings
  • Replaces the mv glob command with a for-loop that gracefully handles the empty case

Both the "Print server logs to console" and "Move logs to subdir" steps are now properly protected against missing log files. The changes are minimal, targeted, and preserve the existing behavior when log files do exist.

Confidence Score: 5/5

  • This PR is safe to merge with minimal risk
  • The fix is a straightforward bash scripting improvement that addresses a specific CI failure scenario. The changes use standard bash best practices (shopt -s nullglob and for-loops) to handle missing files gracefully. Both modified steps are cleanup/logging operations with if: ${{ always() }} guards, so they don't affect the core test logic. The fix has no impact on the actual application code.
  • No files require special attention

Important Files Changed

Filename Overview
.github/workflows/nodejs.yml Adds nullglob handling and for-loop to prevent CI failures when log files are missing

Last reviewed commit: ccc77c4

Copy link
Contributor

@greptile-apps greptile-apps bot left a comment

Choose a reason for hiding this comment

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

1 file reviewed, no comments

Edit Code Review Agent Settings | Greptile

@codecov
Copy link

codecov bot commented Feb 22, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 25.60%. Comparing base (1393ec6) to head (ccc77c4).
⚠️ Report is 2 commits behind head on master.

Additional details and impacted files
@@           Coverage Diff           @@
##           master     #769   +/-   ##
=======================================
  Coverage   25.60%   25.60%           
=======================================
  Files          30       30           
  Lines        1746     1746           
  Branches      306      306           
=======================================
  Hits          447      447           
  Misses       1277     1277           
  Partials       22       22           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@ErikBjare
Copy link
Member

I'm pretty sure the root cause was ActivityWatch/aw-server-rust#565 which was merged?

We just need another commit to master/rerun CI to address/verify this, or?

@ErikBjare
Copy link
Member

Actually, master seems to be passing?

@TimeToBuildBob
Copy link
Contributor Author

Right, aw-server-rust#565 fixed the root cause (server now writes log files to the expected location). If master CI is passing now, this PR is just a defensive fix — handles the edge case where log files are missing for any reason so the cleanup step doesn't fail.

Happy to close this if you think it's unnecessary now, or merge it as a robustness improvement. Your call!

@ErikBjare
Copy link
Member

Closing, we should fail on the empty case as it suggests logs weren't being written or picked up.

@ErikBjare ErikBjare closed this Feb 23, 2026
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.

2 participants