Skip to content

Ignore sync errors in a consistent way#403

Merged
gusfcarvalho merged 2 commits into
mainfrom
imiell/ignore_sync_errors
Jun 1, 2026
Merged

Ignore sync errors in a consistent way#403
gusfcarvalho merged 2 commits into
mainfrom
imiell/ignore_sync_errors

Conversation

@ianmiell
Copy link
Copy Markdown
Contributor

@ianmiell ianmiell commented May 25, 2026

Summary by CodeRabbit

  • Bug Fixes

    • Improved logging robustness: shutdown now ignores certain benign system-level sync errors so they no longer cause spurious failures.
  • Tests

    • Added tests to verify the new logging error-handling behavior.

@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented May 25, 2026

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: ASSERTIVE

Plan: Pro Plus

Run ID: ecb4627e-ec5b-4602-b1fb-bb30ed350dec

📥 Commits

Reviewing files that changed from the base of the PR and between 2a86d2e and 25386ab.

📒 Files selected for processing (1)
  • cmd/run.go

📝 Walkthrough

Walkthrough

Adds a new internal/logging.IgnoreSyncError(err error) bool helper and updates multiple command modules to ignore benign Zap Sync() errors (nil, EINVAL, ENOTTY) when shutting down loggers; includes table-driven tests for the helper.

Changes

Logger Sync Error Filtering

Layer / File(s) Summary
Logger sync utility and test coverage
internal/logging/sync.go, internal/logging/sync_test.go
IgnoreSyncError(err error) bool added; returns true for nil, syscall.EINVAL, and syscall.ENOTTY. Table-driven test TestIgnoreSyncError validates behavior.
Digest command logger sync handling
cmd/digest.go
Imports internal/logging and changes deferred sugar.Sync() handlers in runDigestTest and runDigestPreview to use logging.IgnoreSyncError(err) instead of err != nil.
Risk-digest command logger sync handling
cmd/riskdigest.go
Imports internal/logging and updates deferred sugar.Sync() error handling to ignore errors filtered by logging.IgnoreSyncError.
Server command logger sync handling
cmd/run.go
Imports internal/logging and updates RunServer deferred zap sugar.Sync() handling to log only non-ignored errors via IgnoreSyncError.
User command logger sync handling
cmd/users/create.go, cmd/users/update.go
Imports internal/logging and change deferred logger.Sync() checks to suppress benign sync errors using logging.IgnoreSyncError.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Poem

🐰 I nibble at logs, gentle and neat,
ENOTTY and EINVAL I kindly defeat,
Five commands now hush the needless alarm,
A tidy sync hop, quiet and warm. 🥕

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 33.33% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title 'Ignore sync errors in a consistent way' accurately describes the main change: introducing a centralized IgnoreSyncError function and updating multiple files to use it consistently for handling Zap Sync() errors.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.


Comment @coderabbitai help to get the list of available commands and usage tips.

@gusfcarvalho gusfcarvalho enabled auto-merge (squash) June 1, 2026 20:02
@gusfcarvalho gusfcarvalho merged commit 4d3edbc into main Jun 1, 2026
5 checks passed
@gusfcarvalho gusfcarvalho deleted the imiell/ignore_sync_errors branch June 1, 2026 20:07
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