Skip to content

refactor: remove AI-generated slop across modules#209

Closed
weboko wants to merge 2 commits into
masterfrom
claude/fervent-sagan-ldzB4
Closed

refactor: remove AI-generated slop across modules#209
weboko wants to merge 2 commits into
masterfrom
claude/fervent-sagan-ldzB4

Conversation

@weboko

@weboko weboko commented Jun 6, 2026

Copy link
Copy Markdown
Collaborator

What

A module-by-module sweep of this Rust CLI to remove AI-generated slop. All edits are minimal and behavior-preserving, except one real bug fix (setup.rs). Verified with cargo check (clean, no warnings) and cargo test --no-run (all targets compile).

Bug fix

  • src/commands/setup.rssha256_hex never computed SHA-256. sha2 is a plain, non-optional dependency and the crate has no [features] table, so #[cfg(feature = "sha2")] was always false and the FNV-1a fallback was what compiled. The function returned a 16-char non-SHA digest, so prebuilt sequencer_service verification (setup.rs:348) compared it against a published 64-char .sha256 and always mismatched → bail!, silently breaking the --prebuilt path whenever a checksum file existed. Now uses sha2 unconditionally, matching the project's existing hex-encode idiom (run_state.rs::hex_encode).

Slop cleanup (no behavior change)

  • src/config.rs — removed a dead let path = format!("modules.{name}"); binding that was only consumed by let _ = path; (plus its "Defensive:" comment).
  • src/commands/basecamp.rs — removed #[allow(dead_code)] // Fields wired up in later phases on BasecampAction (all variants are constructed; compiles clean without it); collapsed a verbose two-arm cwd_override match into as_deref().unwrap_or(project_root), matching the idiom the file's own tests already use.
  • src/commands/run.rs — stripped redundant // Step N: comment prefixes that just duplicate the user-facing [N/total_steps] progress prints; all explanatory text preserved.
  • src/commands/wallet_support.rs — collapsed a stray run of spaces in the legacy wallet-config warning string.

Notes on what was not changed

The codebase is otherwise well-maintained. Several flagged "redundant" defensive checks (e.g. .exists() after a non-empty-path guard in basecamp.rs) were verified to be legitimate — a non-empty path string doesn't guarantee the binary is on disk — and were intentionally left as-is. Idiomatic nested if let optional-chaining (no let-chains on rustc 1.81) and the well-documented non-cryptographic fnv1a_64 helper were also left untouched.

https://claude.ai/code/session_01KutAyMX3auZUKhuHHp5xXq

- setup.rs: fix `sha256_hex`. `sha2` is a plain (non-optional) dependency
  and there is no `[features]` table, so `#[cfg(feature = "sha2")]` was
  always false and the FNV-1a fallback compiled instead. The function
  returned a 16-char non-SHA digest, so prebuilt sequencer_service checksum
  verification always failed (and bailed) whenever a `.sha256` was
  published. Use `sha2` unconditionally, matching the project's existing
  hex-encode idiom.
- config.rs: drop the dead `path` binding only consumed by `let _ = path;`.
- run.rs: strip redundant "Step N:" comment prefixes that just duplicate
  the user-facing `[N/total_steps]` progress prints; keep all explanatory
  text.
- wallet_support.rs: collapse stray whitespace in the legacy wallet-config
  warning message.

https://claude.ai/code/session_01KutAyMX3auZUKhuHHp5xXq
@weboko weboko requested review from a team and Copilot June 6, 2026 20:40

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

This PR performs a small refactor pass to remove unused/low-signal code and comments across several modules, and fixes a latent checksum bug in the --prebuilt download path by making sha256_hex compute a real SHA-256 digest unconditionally.

Changes:

  • Fix sha256_hex to always use sha2 and return a proper 64-char SHA-256 hex digest for prebuilt integrity verification.
  • Remove an unused/discarded local binding during TOML serialization (serialize_config), reducing dead code.
  • Clean up user-facing text and inline pipeline comments without changing behavior.

Reviewed changes

Copilot reviewed 3 out of 4 changed files in this pull request and generated no comments.

File Description
src/commands/setup.rs Makes prebuilt checksum verification correct by computing SHA-256 via sha2 unconditionally.
src/config.rs Removes an unused path binding and discard statement in serialize_config.
src/commands/run.rs Simplifies pipeline step comments (keeps user-facing progress output unchanged).
src/commands/wallet_support.rs Normalizes spacing in a legacy wallet-config warning message.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

- Remove `#[allow(dead_code)] // Fields wired up in later phases` on
  `BasecampAction`; all variants are constructed, so `cargo check` is clean
  without it. The attribute and its placeholder comment were leftover slop.
- Collapse the two-arm `cwd_override` match into
  `as_deref().unwrap_or(project_root)`, matching the idiom the file's own
  tests already use. Behavior unchanged.

https://claude.ai/code/session_01KutAyMX3auZUKhuHHp5xXq
@weboko

weboko commented Jun 10, 2026

Copy link
Copy Markdown
Collaborator Author

closing in favor of #210

@weboko weboko closed this Jun 10, 2026
@weboko weboko deleted the claude/fervent-sagan-ldzB4 branch June 16, 2026 21:45
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