The tree is not clean under ward exec cargo-fmt #82

Closed
opened 2026-08-06 20:10:30 +00:00 by coilyco-ops · 1 comment
Member

Symptom

cargo fmt --all -- --config tab_spaces=2, the exact command behind ward exec cargo-fmt, rewrites five committed files that no current work touched. Against 668c1ad:

crates/factory_cli/src/main.rs:49
crates/factory_sim/src/alerts.rs:30
crates/factory_sim/src/mining.rs:17
crates/factory_sim/src/player.rs:575
crates/factory_sim/src/resources.rs:86, 93, 100, 107

Eight sites in five files. The committed code was formatted under narrower line breaking than the verb produces, so the declared format verb and the committed tree disagree.

Why it is worth fixing rather than tolerating

Running the repo's own format verb currently makes the repo's own test gate fail. ward exec cargo-fmt rejoins player.rs:575 into a 100-char line, and ward exec test then fails on the code-comments hook for that line. An agent that formats before committing produces unrelated churn in four files plus a red gate, and the natural recovery is to hand-revert files it did not mean to touch.

The hook side of that collision is a false positive: the checker reads the leading * dereference as a block-comment continuation. That is tracked upstream in coilyco-flight-deck/agentic-os#961, since agentic-os owns the validator. This issue is the local half.

Acceptance

  • cargo fmt --all -- --config tab_spaces=2 --check exits clean on main.
  • The formatting commit is separate from any behavior change, so the diff stays reviewable as pure formatting.
  • ward exec test passes afterward. If it still fails on code-comments for the rejoined player.rs line, this issue is blocked on agentic-os#961 rather than worked around by reshaping the statement to dodge the checker.
  • No change to the cargo-fmt verb's flags unless a deliberate width decision is recorded in the same commit.
  • Land through direct-to-main.

Provenance

Found while landing #81. Unrelated to that change and reproduces on main without it.

## Symptom `cargo fmt --all -- --config tab_spaces=2`, the exact command behind `ward exec cargo-fmt`, rewrites five committed files that no current work touched. Against `668c1ad`: ``` crates/factory_cli/src/main.rs:49 crates/factory_sim/src/alerts.rs:30 crates/factory_sim/src/mining.rs:17 crates/factory_sim/src/player.rs:575 crates/factory_sim/src/resources.rs:86, 93, 100, 107 ``` Eight sites in five files. The committed code was formatted under narrower line breaking than the verb produces, so the declared format verb and the committed tree disagree. ## Why it is worth fixing rather than tolerating Running the repo's own format verb currently makes the repo's own test gate fail. `ward exec cargo-fmt` rejoins `player.rs:575` into a 100-char line, and `ward exec test` then fails on the `code-comments` hook for that line. An agent that formats before committing produces unrelated churn in four files plus a red gate, and the natural recovery is to hand-revert files it did not mean to touch. The hook side of that collision is a false positive: the checker reads the leading `*` dereference as a block-comment continuation. That is tracked upstream in `coilyco-flight-deck/agentic-os#961`, since agentic-os owns the validator. This issue is the local half. ## Acceptance - `cargo fmt --all -- --config tab_spaces=2 --check` exits clean on `main`. - The formatting commit is separate from any behavior change, so the diff stays reviewable as pure formatting. - `ward exec test` passes afterward. If it still fails on `code-comments` for the rejoined `player.rs` line, this issue is blocked on agentic-os#961 rather than worked around by reshaping the statement to dodge the checker. - No change to the `cargo-fmt` verb's flags unless a deliberate width decision is recorded in the same commit. - Land through direct-to-main. ## Provenance Found while landing #81. Unrelated to that change and reproduces on `main` without it.
Author
Member

Investigated on main at bde07f6. Still reproduces, still blocked, and the blocker has moved.

Reproduction

cargo fmt --all -- --config tab_spaces=2 now rewrites six files, not five. crates/factory_content/src/lib.rs joined the set since 668c1ad. --check is clean afterward, so the churn is a one-time convergence, not an oscillation, and cargo test --workspace passes with 98 tests.

The collision is exactly as described. Formatting rejoins player.rs into one 100-char line, now at :644:

*self.warehouse_stock.entry(item).or_default() += self.trucks[truck_index].cargo_quantity;

Running the gate on the formatted tree in agentic-os:release, code-comments is the only failure out of 34 hook results:

FAIL: crates/factory_sim/src/player.rs:644: comment line is 100 chars, over the 90-char cap.

Run against the fixed checker from agentic-os main, the same tree reports code-comments check: OK. So the formatting is correct and complete, and the false positive is the only thing standing in the way.

The blocker is no longer the validator

agentic-os#961 was fixed on 2026-08-06 at 3a6fe4ad. Nothing this repo consumes carries that fix:

  • Newest plain tag v0.265.0 points at a commit from 2026-08-06T19:34Z. The fix landed at 20:31Z.
  • The release, latest, and v0.265.0 images were all published at 2026-08-06T19:53:32Z, 38 minutes before the fix.

Bumping the pinned rev does not help either. Pinned to aos-precommit-v0.15.0, which does carry the fix, the hook still fails in the CI image with the identical message. The image sets PYTHONPATH=/opt/agentic-os/python, which shadows the pinned checkout with its own baked copy, so rev is ignored in CI. That is agentic-os#971.

docker/dev-base/full/Dockerfile:119 copies agentic_os into the image, and dev-base-publish triggers only on pushes to release touching docker/**. A pure-Python validator fix therefore never triggers a rebuild, so it cannot reach CI until some unrelated docker/** change forces one.

What unblocks this

An agentic-os:release image that carries 3a6fe4ad. No change inside this repo can substitute, and the issue rules out reshaping the statement.

Artifact

The formatting is committed and pushed as fix/82-cargo-fmt-clean (ff39384) rather than left local. It is deliberately not on main: landing it now would redden the gate that #87 just turned green. Once the image ships the fix, that branch should go green as-is and can land direct-to-main.

Investigated on `main` at `bde07f6`. Still reproduces, still blocked, and the blocker has moved. ## Reproduction `cargo fmt --all -- --config tab_spaces=2` now rewrites six files, not five. `crates/factory_content/src/lib.rs` joined the set since `668c1ad`. `--check` is clean afterward, so the churn is a one-time convergence, not an oscillation, and `cargo test --workspace` passes with 98 tests. The collision is exactly as described. Formatting rejoins `player.rs` into one 100-char line, now at `:644`: ```rust *self.warehouse_stock.entry(item).or_default() += self.trucks[truck_index].cargo_quantity; ``` Running the gate on the formatted tree in `agentic-os:release`, `code-comments` is the only failure out of 34 hook results: ``` FAIL: crates/factory_sim/src/player.rs:644: comment line is 100 chars, over the 90-char cap. ``` Run against the fixed checker from agentic-os `main`, the same tree reports `code-comments check: OK`. So the formatting is correct and complete, and the false positive is the only thing standing in the way. ## The blocker is no longer the validator agentic-os#961 was fixed on 2026-08-06 at `3a6fe4ad`. Nothing this repo consumes carries that fix: - Newest plain tag `v0.265.0` points at a commit from 2026-08-06T19:34Z. The fix landed at 20:31Z. - The `release`, `latest`, and `v0.265.0` images were all published at 2026-08-06T19:53:32Z, 38 minutes before the fix. Bumping the pinned `rev` does not help either. Pinned to `aos-precommit-v0.15.0`, which does carry the fix, the hook still fails in the CI image with the identical message. The image sets `PYTHONPATH=/opt/agentic-os/python`, which shadows the pinned checkout with its own baked copy, so `rev` is ignored in CI. That is agentic-os#971. `docker/dev-base/full/Dockerfile:119` copies `agentic_os` into the image, and `dev-base-publish` triggers only on pushes to `release` touching `docker/**`. A pure-Python validator fix therefore never triggers a rebuild, so it cannot reach CI until some unrelated `docker/**` change forces one. ## What unblocks this An `agentic-os:release` image that carries `3a6fe4ad`. No change inside this repo can substitute, and the issue rules out reshaping the statement. ## Artifact The formatting is committed and pushed as `fix/82-cargo-fmt-clean` (`ff39384`) rather than left local. It is deliberately not on `main`: landing it now would redden the gate that #87 just turned green. Once the image ships the fix, that branch should go green as-is and can land direct-to-main.
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
coilyco-gaming/factory-game-v3#82
No description provided.