Skip to content

Rewrite XML watcher in Rust#2

Merged
batonac merged 3 commits intomainfrom
copilot/rewrite-in-rust
Dec 18, 2025
Merged

Rewrite XML watcher in Rust#2
batonac merged 3 commits intomainfrom
copilot/rewrite-in-rust

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented Dec 18, 2025

Replaces the bash/inotifywait implementation with a Rust binary for improved performance, reliability, and maintainability.

Core Changes

  • File watching: notify crate with async I/O (tokio) replaces inotifywait
  • HTTP client: reqwest with structured JSON payloads via serde
  • Logging: env_logger with RUST_LOG environment variable control
  • Error handling: Propagated errors with detailed logging instead of silent failures

Configuration Changes

  • Removed INCLUDE_FILENAME environment variable (filename always included in payload)
  • Added RUST_LOG for log level control (trace/debug/info/warn/error)

Build System

  • Updated flake.nix to build Rust binary with rust-overlay and rustPlatform.buildRustPackage
  • Docker image now contains single static binary instead of bash + coreutils + inotify-tools + curl + jq

Implementation Details

#[derive(Debug, Clone)]
struct Config {
    watch_dir: PathBuf,
    webhook_url: String,
    webhook_method: String,
    include_content: bool,
}

Event handling uses notify::EventKind::Create only (not Modify) to prevent duplicate webhook triggers on file write completion.

Webhook dispatch is fully async with 500ms delay to ensure files are fully written before reading.

Original prompt

This section details on the original issue you should resolve

<issue_title>Rewrite in rust</issue_title>
<issue_description></issue_description>

Comments on the Issue (you are @copilot in this section)


💬 We'd love your input! Share your thoughts on Copilot coding agent in our 2 minute survey.

Copilot AI and others added 2 commits December 18, 2025 01:10
Co-authored-by: batonac <4996285+batonac@users.noreply.github.com>
Co-authored-by: batonac <4996285+batonac@users.noreply.github.com>
Copilot AI changed the title [WIP] Rewrite codebase in Rust Rewrite XML watcher in Rust Dec 18, 2025
Copilot AI requested a review from batonac December 18, 2025 01:19
@batonac batonac marked this pull request as ready for review December 18, 2025 01:22
@batonac batonac merged commit 3d8ff21 into main Dec 18, 2025
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.

Rewrite in rust

2 participants