Skip to content
This repository was archived by the owner on Jun 3, 2026. It is now read-only.
This repository was archived by the owner on Jun 3, 2026. It is now read-only.

[Bug] Add Missing Payload Range Checks and Empty String Validation in Text Utilities #227

@vakrahul

Description

@vakrahul

Context & Problem

In src/utils/text.py and across our text pre-processing hooks, strings are parsed and prepared for memory ingestion. Currently, these helper methods do not strictly validate bounds on inbound string objects.

If an upstream pipeline mistakenly forwards an empty payload "" or an anomalously massive un-chunked string block, the processing utility functions execution loops unnecessarily, wasting resources before passing the payload to downstream validation schemas.

Proposed Solution

Add explicit, lightweight guard clauses at the entry points of our string helper functions to catch edge cases early.

Key Implementation Steps

  • Empty Checking: Add an immediate guard clause to return early if not text.strip() is evaluated.
  • Length Constraints: Implement a reasonable maximum length threshold verification check to log an explicit warning or throw a descriptive value error early if the string size goes out of normal programmatic boundaries.
  • Unit Tests: Add a quick series of unit test assertions inside tests/unit/test_utils.py covering null, empty, and boundary conditions to ensure zero regressions.

Impacted Files

  • src/utils/text.py
  • tests/unit/test_utils.py

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type
No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions