Refactor and small fixes #179

Merged
schmelczer merged 17 commits from asch/refactor into main 2025-12-07 16:42:23 +00:00
schmelczer commented 2025-12-07 16:06:37 +00:00 (Migrated from github.com)
No description provided.
copilot-pull-request-reviewer[bot] (Migrated from github.com) reviewed 2025-12-07 16:40:45 +00:00
copilot-pull-request-reviewer[bot] (Migrated from github.com) left a comment

Pull request overview

This PR refactors event listener management throughout the codebase by introducing a reusable EventListeners class, removes the clap-verbosity-flag dependency in favor of a custom LogLevel enum, and includes various code quality improvements such as fixing indentation, adding test cleanup, and improving file watching in the CLI.

Key Changes:

  • Introduced EventListeners utility class to standardize event listener management across the codebase
  • Replaced clap-verbosity-flag with custom LogLevel enum for better control over logging configuration
  • Updated file watcher implementation to use the watcher package for more reliable file system monitoring

Reviewed changes

Copilot reviewed 51 out of 168 changed files in this pull request and generated 7 comments.

Show a summary per file
File Description
sync-server/src/utils/log_level.rs New LogLevel enum with conversion to tracing levels
sync-server/src/config/logging_config.rs Added log_level field to configuration with default value
sync-server/src/main.rs Updated to use LogLevel from config instead of CLI args
sync-server/src/cli/args.rs Removed clap-verbosity-flag dependency
sync-server/Cargo.toml Removed clap-verbosity-flag from dependencies
sync-server/src/utils/rotating_file_writer.rs Added test cleanup to prevent interference between tests
frontend/sync-client/src/utils/data-structures/event-listeners.ts New EventListeners utility class for managing event subscriptions
frontend/sync-client/src/utils/remove-from-array.ts New helper function for efficient array item removal
frontend/sync-client/src/tracing/logger.ts Refactored to use EventListeners class
frontend/sync-client/src/sync-client.ts Exposed event listeners as public getters
frontend/local-client-cli/src/file-watcher.ts Replaced fs.watch with watcher package for better rename detection
frontend/package.json Changed from tabs to spaces and added eclint
scripts/check.sh Added eclint fix step to enforce editor config
docs/architecture/data-flow.md Fixed ASCII diagram formatting
.editorconfig Added markdown to indent configuration

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

## Pull request overview This PR refactors event listener management throughout the codebase by introducing a reusable `EventListeners` class, removes the `clap-verbosity-flag` dependency in favor of a custom `LogLevel` enum, and includes various code quality improvements such as fixing indentation, adding test cleanup, and improving file watching in the CLI. **Key Changes:** - Introduced `EventListeners` utility class to standardize event listener management across the codebase - Replaced `clap-verbosity-flag` with custom `LogLevel` enum for better control over logging configuration - Updated file watcher implementation to use the `watcher` package for more reliable file system monitoring ### Reviewed changes Copilot reviewed 51 out of 168 changed files in this pull request and generated 7 comments. <details> <summary>Show a summary per file</summary> | File | Description | | ---- | ----------- | | sync-server/src/utils/log_level.rs | New LogLevel enum with conversion to tracing levels | | sync-server/src/config/logging_config.rs | Added log_level field to configuration with default value | | sync-server/src/main.rs | Updated to use LogLevel from config instead of CLI args | | sync-server/src/cli/args.rs | Removed clap-verbosity-flag dependency | | sync-server/Cargo.toml | Removed clap-verbosity-flag from dependencies | | sync-server/src/utils/rotating_file_writer.rs | Added test cleanup to prevent interference between tests | | frontend/sync-client/src/utils/data-structures/event-listeners.ts | New EventListeners utility class for managing event subscriptions | | frontend/sync-client/src/utils/remove-from-array.ts | New helper function for efficient array item removal | | frontend/sync-client/src/tracing/logger.ts | Refactored to use EventListeners class | | frontend/sync-client/src/sync-client.ts | Exposed event listeners as public getters | | frontend/local-client-cli/src/file-watcher.ts | Replaced fs.watch with watcher package for better rename detection | | frontend/package.json | Changed from tabs to spaces and added eclint | | scripts/check.sh | Added eclint fix step to enforce editor config | | docs/architecture/data-flow.md | Fixed ASCII diagram formatting | | .editorconfig | Added markdown to indent configuration | </details> --- 💡 <a href="/schmelczer/vault-link/new/main/.github/instructions?filename=*.instructions.md" class="Link--inTextBlock" target="_blank" rel="noopener noreferrer">Add Copilot custom instructions</a> for smarter, more guided reviews. <a href="https://docs.github.com/en/copilot/customizing-copilot/adding-repository-custom-instructions-for-github-copilot" class="Link--inTextBlock" target="_blank" rel="noopener noreferrer">Learn how to get started</a>.
@ -6,7 +6,7 @@ on:
pull_request:
copilot-pull-request-reviewer[bot] (Migrated from github.com) commented 2025-12-07 16:40:44 +00:00

The cron schedule * * * * * runs every minute, which is very frequent for E2E tests. This will consume significant CI resources. Consider if this frequency is intentional compared to the previous */30 * * * * (every 30 minutes).

    - cron: '*/30 * * * *'
The cron schedule `* * * * *` runs every minute, which is very frequent for E2E tests. This will consume significant CI resources. Consider if this frequency is intentional compared to the previous `*/30 * * * *` (every 30 minutes). ```suggestion - cron: '*/30 * * * *' ```
@ -143,1 +140,4 @@
│ }
┌─────────┐
copilot-pull-request-reviewer[bot] (Migrated from github.com) commented 2025-12-07 16:40:43 +00:00

Inconsistent ASCII art formatting. The line should use consistent dashes: └───┬────┘ instead of └───┬─-───┘.

└───┬────┘
Inconsistent ASCII art formatting. The line should use consistent dashes: `└───┬────┘` instead of `└───┬─-───┘`. ```suggestion └───┬────┘ ```
@ -177,0 +171,4 @@
│ type: "file_updated",
│ path: "notes/daily.md",
│ version: 43
│ }
copilot-pull-request-reviewer[bot] (Migrated from github.com) commented 2025-12-07 16:40:43 +00:00

Inconsistent ASCII art formatting. The line should use consistent dashes: └───┬────┘ instead of └───┬────-┘.

└───┬────┘
Inconsistent ASCII art formatting. The line should use consistent dashes: `└───┬────┘` instead of `└───┬────-┘`. ```suggestion └───┬────┘ ```
@ -206,1 +204,3 @@
└────┬────┘
┌─────────┐
│ Client │
└───-─┬───┘
copilot-pull-request-reviewer[bot] (Migrated from github.com) commented 2025-12-07 16:40:44 +00:00

Inconsistent ASCII art formatting. The line should use consistent dashes: └───┬────┘ instead of └───┬─-───┘.

Inconsistent ASCII art formatting. The line should use consistent dashes: `└───┬────┘` instead of `└───┬─-───┘`.
@ -233,3 +230,1 @@
├─► 4. Broadcast deletion
└─► 5. ACK to sender
│ 3. Mark as deleted in DB
copilot-pull-request-reviewer[bot] (Migrated from github.com) commented 2025-12-07 16:40:44 +00:00

Inconsistent ASCII art formatting. The line should use consistent dashes: └───┬────┘ instead of └───┬─-───┘.

└───┬────┘
Inconsistent ASCII art formatting. The line should use consistent dashes: `└───┬────┘` instead of `└───┬─-───┘`. ```suggestion └───┬────┘ ```
copilot-pull-request-reviewer[bot] (Migrated from github.com) commented 2025-12-07 16:40:44 +00:00

Inconsistent ASCII art formatting. The line should use consistent dashes: └───┬────┘ instead of └───┬─=───┘.

Inconsistent ASCII art formatting. The line should use consistent dashes: `└───┬────┘` instead of `└───┬─=───┘`.
copilot-pull-request-reviewer[bot] (Migrated from github.com) commented 2025-12-07 16:40:44 +00:00

Inconsistent ASCII art formatting. The line should use consistent dashes: └────┬───┘ instead of └───-─┬───┘.

    └────┬───┘
Inconsistent ASCII art formatting. The line should use consistent dashes: `└────┬───┘` instead of `└───-─┬───┘`. ```suggestion └────┬───┘ ```
Sign in to join this conversation.
No description provided.