Skip to content

[BUG] indexed_at Date Silently Defaults to Unix Epoch on Parse Failure #203

@EnthusiasticTech

Description

@EnthusiasticTech

Project

vgrep

Description

When reading file metadata from the database, the indexed_at timestamp uses parse().unwrap_or_default() which silently converts any invalid/corrupted date string to DateTime::default() (1970-01-01 00:00:00 UTC). This hides database corruption and makes debugging difficult.

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. Manually corrupt the database:
    sqlite3 ~/.vgrep/vgrep.db "UPDATE files SET indexed_at = 'invalid-date' WHERE rowid = 1;"
  2. Run status command: vgrep status
  3. Observe that affected files show 1970-01-01 timestamp with no warning

Expected Behavior

  1. Invalid dates should be logged as warnings
  2. Users should be notified of database corruption
  3. Option to repair or re-index corrupted entries

Actual Behavior

  1. Invalid dates silently become Unix epoch (1970-01-01)
  2. No warning or error message
  3. Users unaware of data corruption

Additional Context

Location: src/core/db.rs:96 and src/core/db.rs:262

indexed_at: row.get::<_, String>(3)?.parse().unwrap_or_default(),

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingvalidValid issuevgrep

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions