Skip to content

[plan] Handle ErrEventOverflow with user-friendly messages #5180

@github-actions

Description

@github-actions

Objective

Add graceful handling of fsnotify.ErrEventOverflow errors to provide user-friendly feedback when the kernel buffer overflows and events are lost.

Context

In pkg/cli/compile_command.go:912, the error handling currently treats all watcher errors equally. However, ErrEventOverflow is a specific condition that indicates the kernel's event buffer was full and some file system events were lost. This requires different handling to inform users clearly.

Approach

Enhance the error handler to detect overflow errors and provide actionable feedback:

case err, ok := <-watcher.Errors:
    if !ok {
        return fmt.Errorf("watcher error channel closed")
    }
    if errors.Is(err, fsnotify.ErrEventOverflow) {
        fmt.Fprintf(os.Stderr, console.FormatWarningMessage(
            "File system event buffer overflow - some changes may have been missed. " +
            "Consider using --verbose mode or reducing concurrent file modifications."))
    } else {
        compileLog.Printf("Watcher error: %v", err)
        if verbose {
            fmt.Printf("⚠️  Watcher error: %v\\n", err)
        }
    }

Files to Modify

  • Update: pkg/cli/compile_command.go (lines ~912+, error handling in watch loop)

Testing

  1. Simulate overflow conditions by rapidly modifying many workflow files simultaneously
  2. Verify overflow warning appears with clear, actionable message
  3. Ensure watch mode continues to function after overflow
  4. Test that other error types still produce appropriate log messages
  5. Verify message formatting is consistent with other console output

Acceptance Criteria

  • ErrEventOverflow is detected using errors.Is()
  • User-friendly warning message explains the issue
  • Message suggests potential solutions (verbose mode, reduce concurrent changes)
  • Uses console.FormatWarningMessage() for consistent formatting
  • Other error types continue to be logged appropriately
  • Watch mode remains functional after overflow condition

AI generated by Plan Command for discussion #5175

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions