Skip to content

fix(hooks): use handle_keyboard_interrupt in protect_example_ino - #2550

Merged
zackees merged 1 commit into
masterfrom
fix/protect-example-ino-kbi-handler
May 30, 2026
Merged

zackees merged 1 commit into
masterfrom
fix/protect-example-ino-kbi-handler

Conversation

@zackees

@zackees zackees commented May 30, 2026 •

Copy link
Copy Markdown
Member

Summary

`bash lint` was failing with `KBI002` on `ci/hooks/protect_example_ino.py:38`. Switch to the canonical pattern from `ci/util/boot_wait.py`:

```python
except KeyboardInterrupt as ki:
from ci.util.global_interrupt_handler import handle_keyboard_interrupt
handle_keyboard_interrupt(ki)
raise
```

No behaviour change.

Test plan

  • `bash lint` passes (was failing with KBI002)
  • hook still exits 2 / passes / blocks per existing semantics

Summary by CodeRabbit

  • Chores
    • Improved keyboard interrupt handling in build CI processes for better error management.

Review Change Stack

The KBI002 linter requires every `except KeyboardInterrupt` block to
either call `_thread.interrupt_main()` or `handle_keyboard_interrupt(ki)`
before re-raising. The previous bare `except KeyboardInterrupt: raise`
was added when the fail-fast handling for JSONDecodeError was introduced
and tripped the KBI002 check on `bash lint`.

Match the canonical pattern used in `ci/util/boot_wait.py`:

    except KeyboardInterrupt as ki:
        from ci.util.global_interrupt_handler import handle_keyboard_interrupt
        handle_keyboard_interrupt(ki)
        raise
@coderabbitai

coderabbitai Bot commented May 30, 2026 •

Copy link
Copy Markdown

Caution

Review failed

The pull request is closed.

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: 6eb5b836-c5a3-44ef-ad27-5907293fd955

📥 Commits

Reviewing files that changed from the base of the PR and between 755d87e and fa8607a.

📒 Files selected for processing (1)
  • ci/hooks/protect_example_ino.py

📝 Walkthrough

Walkthrough

The PR updates the build hook's KeyboardInterrupt handling to use a shared project handler, replacing a bare exception block with a call to handle_keyboard_interrupt before re-raising the exception.

Changes

Unified Keyboard Interrupt Handling

Layer / File(s) Summary
Shared keyboard interrupt handler integration
ci/hooks/protect_example_ino.py
The hook captures KeyboardInterrupt as ki, imports handle_keyboard_interrupt, calls it with the exception, and re-raises for consistent exception handling across CI scripts.

Estimated code review effort

🎯 1 (Trivial) | ⏱️ ~5 minutes

Possibly related PRs

  • FastLED/FastLED#2537: Directly related as it introduced the protect_example_ino.py hook that this PR now enhances with shared interrupt handler integration.

Poem

A rabbit caught mid-hop—no time to say goodbye,
But now a gentle handler helps the signal pass on by,
Shared code at last! No more exception reinvention,
One shared interrupt—a bright CI intervention. 🐰✨

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix/protect-example-ino-kbi-handler

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

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

@zackees
zackees merged commit 99e75b3 into master May 30, 2026
5 of 7 checks passed
@zackees
zackees deleted the fix/protect-example-ino-kbi-handler branch May 30, 2026 20:02
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