Lint the harness-tui build script and format unclaimed Rust sources

Merged
VA
1d ago
+201-154

Summary

This PR does two things:

  • harness-tui build script: rust/crates/harness-tui/build.rs failed clippy, which stopped cargo clippy -p acyclic-harness-tui ... -D warnings before it reached the crate itself.
  • Formatting drift: on main, cargo fmt --all -- --check failed on 47 files. This PR formats 29 of them: the 27 that no open PR touches, plus the graphcoder tests execution_feedback.rs and presentation.rs, which were reported specifically along with prompt_files.rs.

It adds no #[allow] and changes no lint configuration.

Build script, structural changes:

  • Malformed data:
    • Every JSON lookup that used unwrap now goes through object/text helpers, so malformed declarative data in data/*.json becomes a build error that names the field instead of a panic.
    • An empty name segment is also reported, where chars().next().unwrap() used to panic.
  • Color parsing: &color[1..] becomes strip_prefix('#').
  • Structure: the 140-line main splits into keymap, settings, theme and style_expression, and write! replaces push_str(&format!(..)).
  • Generated output: the output is unchanged except that role docs are now /// `popup_selected` style.. Without the backticks, doc_markdown failed inside the generated theme.rs.

Validation (bb1)

  • cargo clippy -p acyclic-harness-tui --all-targets --all-features --locked -- -D warnings: the build script and the generated sources are now clean.
  • That command still fails on the crate's own sources: about 160 pre-existing lib/test errors, which follow in a separate lint-c PR.
  • cargo test --locked -p acyclic-harness-tui --all-features --lib: 30 passed in 0.12 s, built with the new script, so the generated keymap, settings and theme compile and behave as before.
  • The formatting change is rustfmt 1.98.1 output only.

Formatting that is still drifted

The 18 drifted files left are all touched by open PRs. Each should pick up cargo fmt when it lands (or a follow-up should):

  • actors: src/lib.rs (#559).
  • filesystem: native_capture/mod.rs (#894, #780), native_mount/fuse/mod.rs (#852, #600, #595), workspace/mod.rs (#867).
  • graphcoder test: help.rs (#906, #823).
  • harness client: task_files/tests/retention.rs, task_projection.rs.
  • harness, other: distributed/mod.rs, filesystem/task_runtime/tests.rs, local/tests.rs, local/tests/context/generation.rs, search/files/crash_cut_tests.rs, test_support/crash_cuts.rs, test_support/crash_cuts/tests.rs.
  • harness integration tests: tests/client_commands.rs, tests/default_tools.rs.
  • stream: src/lib.rs (#852, #600).

Proposal: check fmt on every PR (not added; CI policy is the user's call)

Today cargo fmt --all -- --check runs only in scripts/qualify-ci.sh policy. That runs only through qualification.yml, which is a workflow_call from the release workflow, so PRs never check formatting and drift builds up between releases. A small step in .github/workflows/static.yml (the job that already runs on every PR) would close that gap:

      - name: Check Rust formatting
        run: |
          rustup toolchain install 1.98.1 --profile minimal --component rustfmt
          cargo +1.98.1 fmt --all -- --check

rustfmt needs no compilation, so the step should fit the job's 1-minute budget. If the toolchain download is too slow for that budget, raise the timeout.

Decisions

  • Formatting skips files touched by open PRs so they don't conflict, except the three graphcoder tests named in the request. Two of those are in #823, and their diffs are import-order only.
  • The harness-tui lib lint (about 160 errors across 28 files, 12 of them in open PRs) is a separate PR, to keep this one reviewable and unblock the build-script gate now.

🤖 Generated with Claude Code


Summary by cubic

Makes the harness-tui build script pass clippy under -D warnings and formats Rust sources that had drifted on main, so cargo clippy -p acyclic-harness-tui can reach the crate itself and cargo fmt --check stops failing.

Build script

  • JSON lookups now use object/text helpers so malformed declarative data becomes a build error naming the field, not a panic.
  • main is split into keymap, settings, and theme; color parsing uses strip_prefix('#').
  • Generated output is unchanged except role docs now wrap the style name in backticks, satisfying doc_markdown in the generated theme.rs.

Formatting

  • Applies rustfmt to 31 of 49 drifted files, skipping the 18 touched by open PRs so they don't conflict.
  • Includes the three graphcoder test files named in the request.
  • Leaves the crate's own lib lints (about 160 pre-existing errors) to a separate PR.