Skip to content

Fix Windows build: cfg-gate Unix-only imports and helpers - #77

Open
HellaDopeWC wants to merge 1 commit into
ReinaMacCredy:mainfrom
HellaDopeWC:fix/windows-deny-warnings
Open

Fix Windows build: cfg-gate Unix-only imports and helpers#77
HellaDopeWC wants to merge 1 commit into
ReinaMacCredy:mainfrom
HellaDopeWC:fix/windows-deny-warnings

Conversation

@HellaDopeWC

@HellaDopeWC HellaDopeWC commented Jul 28, 2026

Copy link
Copy Markdown

The crate denies all warnings ([lints.rust] warnings = deny), and on Windows targets several items are compiled but only used by cfg(unix) code paths, so unused_imports/dead_code warnings become hard errors and cargo install fails.

Gate the Unix-only items behind #[cfg(unix)]:

  • gate_lock.rs: OpenOptions, io::Read, PathBuf, anyhow::Result and the git module import; the two lockfile-name constants; LockKind::file_name; read_holder; lock_path. All are used only by the flock-based Unix serialization path — the cfg(not(unix)) fallbacks never touch them.
  • run/append.rs: CString/c_char, thread, Duration imports and the OPEN_EVENT_FILE_RETRIES constant, used only by the cfg(unix) event-file open/retry path.

No behavior change on any platform. cargo check and clippy --all-targets stay clean on Linux; cargo install now succeeds on x86_64-pc-windows-msvc without RUSTFLAGS=--cap-lints=warn.

Summary by CodeRabbit

  • Bug Fixes
    • Improved compatibility for non-Unix platforms by restricting Unix-specific file locking and retry behavior to supported systems.
    • Prevented platform-specific build issues in cross-platform environments.

The crate denies all warnings ([lints.rust] warnings = deny), and on
Windows targets several items are compiled but only used by cfg(unix)
code paths, so unused_imports/dead_code warnings become hard errors and
cargo install fails.

Gate the Unix-only items behind #[cfg(unix)]:

- gate_lock.rs: OpenOptions, io::Read, PathBuf, anyhow::Result and the
  git module import; the two lockfile-name constants; LockKind::file_name;
  read_holder; lock_path. All are used only by the flock-based Unix
  serialization path — the cfg(not(unix)) fallbacks never touch them.
- run/append.rs: CString/c_char, thread, Duration imports and the
  OPEN_EVENT_FILE_RETRIES constant, used only by the cfg(unix) event-file
  open/retry path.

No behavior change on any platform. cargo check and clippy --all-targets
stay clean on Linux; cargo install now succeeds on x86_64-pc-windows-msvc
without RUSTFLAGS=--cap-lints=warn.
@gemini-code-assist

Copy link
Copy Markdown

Caution

The consumer version of Gemini Code Assist on GitHub has been sunset. All code review activity has officially ceased.

@greptile-apps greptile-apps Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Your trial has ended. Reactivate Greptile to resume code reviews.

@coderabbitai

coderabbitai Bot commented Jul 28, 2026

Copy link
Copy Markdown

Review Change Stack

📝 Walkthrough

Walkthrough

The changes restrict Unix-specific imports, constants, methods, and helper functions in lock management and event appending to Unix builds.

Changes

Unix compilation gates

Layer / File(s) Summary
Gate Unix-only lock and append code
src/domain/gate_lock.rs, src/domain/run/append.rs
Unix-specific lockfile imports, methods, helpers, event retry constants, and thread usage are conditionally compiled with #[cfg(unix)].

Estimated code review effort: 1 (Trivial) | ~5 minutes

Suggested reviewers: reinamaccredy

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately summarizes the main change: cfg-gating Unix-only code to fix Windows builds.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

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.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@src/domain/run/append.rs`:
- Around line 1-8: Update retry_open_event_file_at and its call chain so
Unix-only symbols OPEN_EVENT_FILE_RETRIES, thread, and Duration are never
referenced by non-Unix builds. Gate open_event_file, retry_open_event_file_at,
and every caller consistently with #[cfg(unix)], or provide a non-Unix
implementation that avoids those symbols.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: 8958a8a1-fe5c-448d-8361-eac004700a16

📥 Commits

Reviewing files that changed from the base of the PR and between ef87d0d and 2fd9208.

📒 Files selected for processing (2)
  • src/domain/gate_lock.rs
  • src/domain/run/append.rs

Comment thread src/domain/run/append.rs
Comment on lines +1 to +8
#[cfg(unix)]
use std::ffi::{CString, c_char};
use std::fs::{self, File};
use std::io::{self, Read, Seek, SeekFrom, Write};
use std::path::Path;
#[cfg(unix)]
use std::thread;
#[cfg(unix)]

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🎯 Functional Correctness | 🔴 Critical | ⚡ Quick win

Do not gate symbols that remain referenced unconditionally.

retry_open_event_file_at is still compiled on every target, but it references OPEN_EVENT_FILE_RETRIES, thread, and Duration, all now restricted to Unix. This causes Windows compilation to fail with unresolved names. Either gate the entire retry helper and its callers with #[cfg(unix)], or keep the required constant/imports available on non-Unix targets.

Proposed fix direction
 #[cfg(unix)]
 const OPEN_EVENT_FILE_RETRIES: usize = 8;

+#[cfg(unix)]
 fn retry_open_event_file_at(repo_root: &Path, relative_path: &Path) -> io::Result<File> {

Ensure open_event_file and every caller are gated consistently, or provide a non-Unix implementation that does not use these Unix-only symbols.

Also applies to: 22-23

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@src/domain/run/append.rs` around lines 1 - 8, Update retry_open_event_file_at
and its call chain so Unix-only symbols OPEN_EVENT_FILE_RETRIES, thread, and
Duration are never referenced by non-Unix builds. Gate open_event_file,
retry_open_event_file_at, and every caller consistently with #[cfg(unix)], or
provide a non-Unix implementation that avoids those symbols.

Copy link
Copy Markdown
Owner

Thank you for reporting this and for taking the time to put together a fix.

Maestro is currently undergoing a substantial vNext architecture refoundation, but that work has not been published to the remote repository yet. As a result, the current main branch still represents the older implementation.

Maestro also doesn’t fully support native Windows yet, and vNext may significantly change the areas touched by this patch. I’ve noted this issue, and once vNext is complete, I’ll fix it as part of bringing full native Windows support to Maestro.

Thank you again for investigating this. Your findings and patch will be helpful when I work on Windows support after vNext.

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.

2 participants