Skip to content

[BUG] chunk_overlap vs chunk_size Not Validated #156

@olddev94

Description

@olddev94

Project

vgrep

Description

The configuration allows setting chunk_overlap to any value, including values larger than chunk_size. This can cause unexpected behavior where chunks overlap more than the actual content, or the overlap calculation results in negative indices (handled by saturating_sub but still semantically wrong).

Error Message

No error - unexpected chunking behavior.

Debug Logs

System Information

- Bounty Version: 0.1.0
- OS: Ubuntu 24.04 LTS
- Rust: 1.75+

Screenshots

No response

Steps to Reproduce

# Set chunk_overlap larger than chunk_size
vgrep config set chunk_size 100
vgrep config set chunk_overlap 200

# Index a file
vgrep index

# Chunks will have unexpected overlap behavior

Expected Behavior

  1. Validate chunk_overlap < chunk_size
  2. Validate chunk_size > 0
  3. Return error if constraints violated

Actual Behavior

  1. Any values accepted without validation
  2. chunk_size = 0 could cause infinite loop
  3. chunk_overlap > chunk_size causes semantic errors

Additional Context

No response

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