Skip to content

fix(cleaners): return no bullets from extract_ordered_bullets for blank text - #4863

Open
sarankumar1325 wants to merge 1 commit into
Unstructured-IO:mainfrom
sarankumar1325:fix/extract-ordered-bullets-empty-text
Open

sarankumar1325 wants to merge 1 commit into
Unstructured-IO:mainfrom
sarankumar1325:fix/extract-ordered-bullets-empty-text

Conversation

@sarankumar1325

@sarankumar1325 sarankumar1325 commented Nov 26, 2026 •

Copy link
Copy Markdown

Summary

extract_ordered_bullets takes text.split()[0] without checking that the text has a word, so an empty or whitespace-only string raises IndexError: list index out of range:

>>> extract_ordered_bullets("")
IndexError: list index out of range

The docstring says text without a leading ordered bullet gives (None, None, None). Blank text has no bullet either, so it now returns the same.

This is the same slip as in clean_ordered_bullets, which I fixed separately in #4862. The two PRs touch different files and are independent.

Validation

  • Added "", " " and "\n" cases to test_extract_ordered_bullets; all three fail without the fix.
  • pytest test_unstructured/cleaners/test_extract.py: 42 passed.
  • ruff check and ruff format --check clean on the two touched files.

Release note

extract_ordered_bullets no longer raises IndexError on empty or whitespace-only text.

AI-assisted change. I reviewed the diff and ran the tests locally. I can't apply labels; this is a bug fix.

View guided diff

…nk text

extract_ordered_bullets read text.split()[0] without checking that the
text had any word, so an empty or whitespace-only string raised
IndexError. Return (None, None, None), like any other text without a
leading ordered bullet.

Signed-off-by: sarankumar1325 <120080287+sarankumar1325@users.noreply.github.com>
@chatgpt-codex-connector

Copy link
Copy Markdown
Codex Review Summary: ❌ Failed

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ❌ Failed 2026-11-26T15:58:33.859399Z
We couldn’t complete this review. Comment @codex review to try again.
1551bd3 PR opened
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@chatgpt-codex-connector

Copy link
Copy Markdown

You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant