refactor: remove AI-generated slop across modules#209
Closed
weboko wants to merge 2 commits into
Closed
Conversation
- 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
Contributor
There was a problem hiding this comment.
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_hexto always usesha2and 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
Collaborator
Author
|
closing in favor of #210 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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 withcargo check(clean, no warnings) andcargo test --no-run(all targets compile).Bug fix
src/commands/setup.rs—sha256_hexnever computed SHA-256.sha2is 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 prebuiltsequencer_serviceverification (setup.rs:348) compared it against a published 64-char.sha256and always mismatched →bail!, silently breaking the--prebuiltpath whenever a checksum file existed. Now usessha2unconditionally, matching the project's existing hex-encode idiom (run_state.rs::hex_encode).Slop cleanup (no behavior change)
src/config.rs— removed a deadlet path = format!("modules.{name}");binding that was only consumed bylet _ = path;(plus its "Defensive:" comment).src/commands/basecamp.rs— removed#[allow(dead_code)] // Fields wired up in later phasesonBasecampAction(all variants are constructed; compiles clean without it); collapsed a verbose two-armcwd_overridematch intoas_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 inbasecamp.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 nestedif letoptional-chaining (no let-chains on rustc 1.81) and the well-documented non-cryptographicfnv1a_64helper were also left untouched.https://claude.ai/code/session_01KutAyMX3auZUKhuHHp5xXq