Skip to content

cleanup: rename fail_oom_clierror; surface geocode update-check error cause#3806

Merged
jqnatividad merged 1 commit into
masterfrom
review-cleanups-clitypes-geocode
May 2, 2026
Merged

cleanup: rename fail_oom_clierror; surface geocode update-check error cause#3806
jqnatividad merged 1 commit into
masterfrom
review-cleanups-clitypes-geocode

Conversation

@jqnatividad

Copy link
Copy Markdown
Collaborator

Summary

  • Rename fail_OOM_clierror! to fail_oom_clierror! for snake_case consistency with the other fail_*_clierror! macros (fail_clierror!, fail_incorrectusage_clierror!, fail_encoding_clierror!). One call site updated in src/util.rs::mem_file_check.
  • In src/cmd/geocode.rs, the two updater.has_updates(...).await.map_err(|_| ...) sites discarded the reqwest error and reported a generic "Geonames update check failed." Capture the error and include its message so timeouts, DNS failures, HTTP errors, etc. are visible to the user and in logs.

Both findings came out of a /symbolic-review of src/clitypes.rs.

Test plan

  • cargo build --locked --bin qsv -F all_features — clean
  • cargo build --locked --bin qsvlite -F lite — clean (pre-existing warnings only)
  • cargo build --locked --bin qsvdp -F datapusher_plus — clean (pre-existing warnings only)
  • cargo clippy --locked -F all_features --bin qsv — clean
  • Optional: exercise qsv geocode index-check / index-update against an unreachable Geonames host to confirm the reqwest cause now appears in the error message

🤖 Generated with Claude Code

- Rename `fail_OOM_clierror!` to `fail_oom_clierror!` so the macro name
  matches the snake_case convention used by its siblings
  (`fail_clierror!`, `fail_incorrectusage_clierror!`,
  `fail_encoding_clierror!`). Updates the sole call site in
  `src/util.rs::mem_file_check`.

- In `src/cmd/geocode.rs`, the two `updater.has_updates(...)` calls
  used `.map_err(|_| ...)` and reported a generic
  "Geonames update check failed." message, discarding the underlying
  reqwest error. Capture the error and include its message
  (timeout / DNS / HTTP status / etc.) so the failure cause is visible
  to the user and in logs.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@jqnatividad jqnatividad requested a review from Copilot May 2, 2026 13:16
@codacy-production

Copy link
Copy Markdown

Up to standards ✅

🟢 Issues 0 issues

Results:
0 new issues

View in Codacy

🟢 Metrics 0 complexity

Metric Results
Complexity 0

View in Codacy

NEW Get contextual insights on your PRs based on Codacy's metrics, along with PR and Jira context, without leaving GitHub. Enable AI reviewer
TIP This summary will be updated as you push new changes.

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 cleanup to improve consistency and debuggability in qsv’s CLI: it standardizes an out-of-memory helper macro name to snake_case, and it preserves the underlying reqwest error when geocode checks Geonames for index updates.

Changes:

  • Renamed fail_OOM_clierror!fail_oom_clierror! and updated the mem_file_check call site.
  • Updated geocode’s IndexUpdater::has_updates error mapping to include the underlying network error message.

Reviewed changes

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

File Description
src/util.rs Updates the OOM macro call in mem_file_check to the new snake_case name.
src/cmd/geocode.rs Preserves and surfaces the underlying update-check error cause in index-check and index-update.
src/clitypes.rs Renames the OOM error macro for naming consistency with other fail_*_clierror! helpers.
Comments suppressed due to low confidence (1)

src/clitypes.rs:113

  • The doc comment says this macro writes to stderr, but the implementation only logs via log::error and returns Err(CliError::OutOfMemory(..)). Consider updating the comment to avoid misleading future readers (or adjust the macro to actually emit to stderr if that’s intended).
/// write to stderr and log::error, using CliError::OutOfMemory
macro_rules! fail_oom_clierror {
    ($($t:tt)*) => {{
        use log::error;
        use crate::CliError;
        let err = format!($($t)*);
        error!("{err}");
        Err(CliError::OutOfMemory(err))
    }};

Comment thread src/cmd/geocode.rs
Comment thread src/cmd/geocode.rs
@jqnatividad jqnatividad merged commit 55fa83f into master May 2, 2026
21 checks passed
@jqnatividad jqnatividad deleted the review-cleanups-clitypes-geocode branch May 2, 2026 13:26
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