From ec0d792a605cf6afae6674e6ade28a22eecad1a7 Mon Sep 17 00:00:00 2001 From: eveselove Date: Sat, 20 Jun 2026 17:20:32 +0300 Subject: [PATCH] fix(hooks+docs): run pre-commit rust checks from rust/; fix rustdoc lints link MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit pre-commit ran `cargo fmt`/`cargo clippy` from the repo root, which has no Cargo.toml (workspace is in rust/) -> `cargo metadata` error -> commit rejected. This silently blocked forge from committing ANY .rs work: forge `_commit_work` calls git with check=False, so the rejection was swallowed and the task was falsely marked done/gate=ok with an empty commit (0 files). Run the rust checks in a `( cd rust && ... )` subshell so they work in worktrees too. Also fixes the rustdoc `unresolved link to lints` warning in agentforge-long-horizon ([lints] -> `lints`) — the dogfood task that exposed the hook bug. task 7894af1c Co-Authored-By: Claude Opus 4.8 --- bin/pre-commit | 4 ++-- rust/crates/agentforge-long-horizon/src/lib.rs | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/bin/pre-commit b/bin/pre-commit index 457d0b1..20c672d 100755 --- a/bin/pre-commit +++ b/bin/pre-commit @@ -27,10 +27,10 @@ done # 3. Rust checks if git diff --cached --name-only | grep -q '\.rs$'; then echo "→ Rust: cargo fmt check..." - cargo fmt -- --check || { echo "❌ Run 'cargo fmt' first"; exit 1; } + ( cd rust && cargo fmt --all -- --check ) || { echo "❌ Run 'cargo fmt --all' in rust/ first"; exit 1; } echo "→ Rust: cargo clippy..." - cargo clippy --workspace -- -D warnings || exit 1 + ( cd rust && cargo clippy --workspace -- -D warnings ) || exit 1 fi # 4. Python checks diff --git a/rust/crates/agentforge-long-horizon/src/lib.rs b/rust/crates/agentforge-long-horizon/src/lib.rs index 9ca3dfc..7bf54c1 100644 --- a/rust/crates/agentforge-long-horizon/src/lib.rs +++ b/rust/crates/agentforge-long-horizon/src/lib.rs @@ -6,7 +6,7 @@ //! ## Deep audit (2026-06-13): bottlenecks, logical errors, data races //! //! ### Data races / consistency -//! - Safe Rust + &mut self + [lints] forbid(unsafe_code) eliminates intra-process data races. +//! - Safe Rust + &mut self + `lints` forbid(unsafe_code) eliminates intra-process data races. //! - Cross-process races on shared ~/.agentforge/long_horizon/*.json remain possible (no flock). //! Mitigation (existing): atomic write via tmp+rename in checkpoints (reader never sees torn JSON). //! Added: force_persist_task + import_task use same atomic path.