Skip to content

fix(npm): operator precedence bug in progress indicator filter #2654

Open

Description

@guyoron1

Bug

In src/cmds/js/npm_cmd.rs:152, the progress indicator filter has an operator precedence bug:

if line.contains("⸩") || line.contains("⸨") || line.contains("...") && line.len() < 10 {
    continue;
}

Since && binds tighter than || in Rust, this parses as:

line.contains("⸩") || line.contains("⸨") || (line.contains("...") && line.len() < 10)

The line.len() < 10 guard only applies to lines containing "...", not to lines containing ⸩ or ⸨.

Impact

Any line containing ⸩ or ⸨ is unconditionally dropped, regardless of length. A legitimate output line like "Building module (⸨loader⸩) completed successfully" would be silently filtered out.

Currently works by accident because these Unicode chars rarely appear outside npm progress bars, but the logic doesn't match the intent.

Fix

Add parentheses to group correctly:

if (line.contains("⸩") || line.contains("⸨") || line.contains("...")) && line.len() < 10 {
    continue;
}

Activity

  1. added
    bug
    good first issue
    on Jun 27, 2026
  2. pszymkowiak commented on Jun 27, 2026

    @pszymkowiak
    Collaborator

    wshm · Automated triage by AI

    🔍 Automated Triage

    🐛 Category bug
    🟢 Priority low
    🎯 Confidence 93%

    Summary

    Operator precedence bug in npm progress filter silently drops lines containing ⸩/⸨ regardless of length; fix by adding parentheses — low real-world impact since these chars rarely appear in non-progress output.

    This looks like a simple fix that could be auto-resolved. Repo maintainers can use /wshm fix to attempt it.

    📁 Relevant files
    • src/cmds/js/npm_cmd.rs

    Triaged automatically by wshm · This is an automated analysis, not a human review.

  3. ayesha-devx commented on Jun 27, 2026

    @ayesha-devx

    Hi! I'd like to work on this issue.

    I plan to fix the operator precedence bug in src/cmds/js/npm_cmd.rs by grouping the progress indicator conditions with parentheses so that the length check applies consistently to all progress marker patterns. I'll keep the change minimal and preserve the existing behavior apart from correcting the filtering logic.

    Thank you!

  4. added a commit that references this issue on Aug 14, 2026
    766e013
  5. added a commit that references this issue on Sep 21, 2026
    242d013
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    area:clibuggood first issuepriority:low

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions