Use core's blob fetch-summary formatter in apply's fetch_stage instead of a drifted copy

Open Beginner friendly
#1,838 0 comments 0 reactions 0 assignees View on GitHub

Maintainers usually reply within 1 day

Nobody has claimed this yet.

Assessment

Difficulty
2/5
Estimated time
1-3 hours
Newbie friendliness
78/100
Issue type
Refactor
Clarity
Clearly specified
Activity status
Active
Tech stack
rust
Domain
cli

Research direction

Read crates/socket-patch-cli/src/commands/fetch_stage.rs alongside the core formatters in crates/socket-patch-core/src/api/blob_fetcher.rs; repair is cited as an existing caller. Update the fetch stage to use the core success and failure formatters while retaining its total == 0 line, then update the named fetch_stage and apply_render tests. Done when success output is unchanged and failure output matches core's sorted, concise format without the trailing colon.

Written by the indexing model from the issue text.

Description

agent:triaged arch-audit priority:p3 refactor

[agent] Filed by the scheduled architecture audit (audit-cli-tests). Register: register comment.

Kind: refactor. Register ID: T04.

Problem

Two private functions in fetch_stage.rs L77-L128,`` format_fetch_summary and `format_fetch_failures`, copy the public formatters in core: `api/blob_fetcher.rs` L210-L264 (`format_fetch_result_for`, `format_fetch_successes`, `format_fetch_failures`). `repair` already uses the core ones.

The copies have drifted:

core fetch_stage
failures sorted by hash yes (results come from a HashSet) no, so the order is nondeterministic
header Failed to download N blobs Failed to download N blobs:
id noun.display_id (no ... for ids of 12 chars or fewer) always chars().take(12) + ...
error text concise_fetch_error raw error

"All blobs are present locally." and the ... and N more cap are written in both copies. The cap is also open-coded in fetch_stage::format_purl_list (L77-L83) and in repair.rs.

Proposed change

  • Delete fetch_stage::format_fetch_summary and format_fetch_failures.
  • Call blob_fetcher::format_fetch_successes / format_fetch_failures with ArtifactNoun blobs, keeping the total == 0 line.

Size

1 file. About −45 / +5 lines.

Acceptance criteria

  • apply prints the same success lines.
  • Failure lines take core's form: sorted, concise, and without the trailing colon.
  • fetch_stage and apply_render tests are updated where they pinned the old form.
Dominant language
Rust
Stars
9
Forks
2
Avg merge
1d 8h
Merged PRs (30d)
309

Getting set up

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from SocketDev/socket-patch

All issues in SocketDev/socket-patch

Similar issues

More Rust issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.