Skip to content

[BUG] Database Query Errors Silently Filtered with filter_map(Result::ok) #205

@EnthusiasticTech

Description

@EnthusiasticTech

Project

vgrep

Description

Multiple database query functions in src/core/db.rs use .filter_map(Result::ok) to collect results, which silently drops any rows that fail to deserialize. This can cause:

  • Search results to be incomplete
  • File listings to be missing entries
  • No indication that errors occurred

Error Message

Debug Logs

System Information

Bounty Version: 0.1.0
OS: Ubuntu 24.04 LTS
CPU: AMD EPYC-Genoa Processor (8 cores)
RAM: 15 GB

Screenshots

No response

Steps to Reproduce

  1. Corrupt a chunk entry in database:
    sqlite3 ~/.vgrep/vgrep.db "UPDATE chunks SET content = NULL WHERE rowid = 1;"
  2. Run a search: vgrep search "function"
  3. Observe results - corrupted chunk silently missing, no error shown

Expected Behavior

  1. Database errors should be logged
  2. Partial failures should be reported to user
  3. Option to identify and repair corrupted entries

Actual Behavior

  1. .filter_map(Result::ok) drops failed rows
  2. No logging of which rows failed
  3. Users see incomplete results without knowing

Additional Context

Locations: src/core/db.rs:187, src/core/db.rs:220, src/core/db.rs:265

.filter_map(Result::ok)  // Silently drops errors
.collect();

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingideIssues related to IDEvalidValid issuevgrep

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions