Skip to content

fix: inherit _FileChangeHandler from FileSystemEventHandler (#67)#69

Merged
microsasa merged 1 commit intomainfrom
fix/67-file-change-handler-inheritance-f4e58e5b9ddf5308
Mar 15, 2026
Merged

fix: inherit _FileChangeHandler from FileSystemEventHandler (#67)#69
microsasa merged 1 commit intomainfrom
fix/67-file-change-handler-inheritance-f4e58e5b9ddf5308

Conversation

@microsasa
Copy link
Owner

Summary

_FileChangeHandler now properly inherits from watchdog.events.FileSystemEventHandler instead of relying on duck typing.

Changes

  • src/copilot_usage/cli.py:

    • Import FileSystemEventHandler from watchdog.events
    • _FileChangeHandler inherits from FileSystemEventHandler
    • Added super().__init__() call
    • Removed # noqa: ANN001 from dispatch
    • Removed # type: ignore[arg-type] from observer.schedule()
  • tests/copilot_usage/test_cli.py:

    • Added test_inherits_from_filesystemeventhandler verifying isinstance check and dispatch behavior

Verification

All CI checks pass locally:

  • ruff check
  • ruff format
  • pyright — 0 errors ✅
  • pytest — 381 passed, 96.65% coverage ✅

Closes #67

Generated by Issue Implementer ·

Warning

⚠️ Firewall blocked 1 domain

The following domain was blocked by the firewall during workflow execution:

  • astral.sh

To allow these domains, add them to the network.allowed list in your workflow frontmatter:

network:
  allowed:
    - defaults
    - "astral.sh"

See Network Configuration for more information.

@microsasa microsasa added the aw Created by agentic workflow label Mar 15, 2026
Copilot AI review requested due to automatic review settings March 15, 2026 13:49
@microsasa microsasa enabled auto-merge March 15, 2026 13:49
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

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

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 _FileChangeHandler inherit from watchdog.events.FileSystemEventHandler and call super().__init__().
  • Remove the observer.schedule(... ) argument-type ignore now that the handler matches watchdog’s expected type.
  • Add a unit test asserting _FileChangeHandler inherits from FileSystemEventHandler.

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>
@microsasa microsasa force-pushed the fix/67-file-change-handler-inheritance-f4e58e5b9ddf5308 branch from 2709250 to 1cc6e78 Compare March 15, 2026 17:28
@microsasa microsasa merged commit 1cc6e78 into main Mar 15, 2026
5 checks passed
@microsasa microsasa deleted the fix/67-file-change-handler-inheritance-f4e58e5b9ddf5308 branch March 16, 2026 07:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

aw Created by agentic workflow

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[aw][code health] _FileChangeHandler should inherit from watchdog FileSystemEventHandler

2 participants