Skip to content

refactor: Remove dead code in openrouter.rs content truncation #434

@AlexMikhalev

Description

@AlexMikhalev

Issue Description

Content truncation logic in openrouter.rs is unreachable due to an early return check.

Location

crates/terraphim_service/src/openrouter.rs:168-172

Current Code

```rust
// Line 156: Early return if content too long
if content.len() > MAX_CONTENT_LENGTH {
return Err(...);
}

// Line 168-172: Unreachable truncation logic
let truncated_content = if content.len() > MAX_CONTENT_LENGTH {
&content[..MAX_CONTENT_LENGTH]
} else {
content
};
```

Impact

  • MEDIUM priority - Dead code
  • Confusing for maintainers
  • Wastes compilation time

Recommended Fix

Either:

  1. Remove the early return to allow truncation
  2. Remove the truncation logic entirely

References

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions