Conversation
There was a problem hiding this comment.
Pull request overview
This PR aligns the internal live-refresh watchdog handler with watchdog’s expected event handler interface by making _FileChangeHandler subclass FileSystemEventHandler, and updates tests accordingly.
Changes:
- Make
_FileChangeHandlerinherit fromwatchdog.events.FileSystemEventHandlerand callsuper().__init__(). - Remove the
observer.schedule(... )argument-type ignore now that the handler matches watchdog’s expected type. - Add a unit test asserting
_FileChangeHandlerinherits fromFileSystemEventHandler.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
src/copilot_usage/cli.py |
Updates the watchdog handler to subclass FileSystemEventHandler, enabling type-compatible scheduling without an ignore. |
tests/copilot_usage/test_cli.py |
Adds a test to lock in the new inheritance relationship for _FileChangeHandler. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
- _FileChangeHandler now inherits from watchdog.events.FileSystemEventHandler - Added super().__init__() call in __init__ - Removed # noqa: ANN001 suppression from dispatch - Removed # type: ignore[arg-type] from observer.schedule() - Added test verifying inheritance and dispatch behavior Closes #67 Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
2709250 to
1cc6e78
Compare
This was referenced Mar 15, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
_FileChangeHandlernow properly inherits fromwatchdog.events.FileSystemEventHandlerinstead of relying on duck typing.Changes
src/copilot_usage/cli.py:FileSystemEventHandlerfromwatchdog.events_FileChangeHandlerinherits fromFileSystemEventHandlersuper().__init__()call# noqa: ANN001fromdispatch# type: ignore[arg-type]fromobserver.schedule()tests/copilot_usage/test_cli.py:test_inherits_from_filesystemeventhandlerverifyingisinstancecheck and dispatch behaviorVerification
All CI checks pass locally:
ruff check✅ruff format✅pyright— 0 errors ✅pytest— 381 passed, 96.65% coverage ✅Closes #67
Warning
The following domain was blocked by the firewall during workflow execution:
astral.shTo allow these domains, add them to the
network.allowedlist in your workflow frontmatter:See Network Configuration for more information.