Skip to content

Reject HTTP error responses before partitioning - #4414

Draft
CyMule wants to merge 3 commits into
mainfrom
fix/reject-url-error-responses
Draft

Reject HTTP error responses before partitioning#4414
CyMule wants to merge 3 commits into
mainfrom
fix/reject-url-error-responses

Conversation

@CyMule

@CyMule CyMule commented Jul 20, 2026

Copy link
Copy Markdown
Contributor

Summary

  • reject unsuccessful URL responses before classifying and partitioning their bodies
  • preserve the existing timeout handling path
  • add a mocked 404 regression test
  • serialize metrics tests that write to shared result directories under pytest-xdist

Why

The general URL loader could classify and partition an HTTP error page as if it were the requested document. That makes an unsuccessful fetch look like successful ingestion and can place error-page content in downstream indexes.

The unit-test matrix also exposed a pre-existing race in test_evaluate.py: parallel pytest workers wrote to and removed the same fixed result directories. One worker could therefore delete a generated TSV before another worker read it.

Impact

HTTP 4xx and 5xx responses now fail visibly instead of being partitioned. Successful responses and the existing request timeout behavior are unchanged.

Metrics tests that mutate shared evaluation-result paths now hold a cross-process lock for the duration of each test and its cleanup, preventing xdist workers from deleting one another's outputs.

Validation

  • uv run --no-sync pytest -q test_unstructured/partition/test_auto.py -k 'rejects_an_error_response' — 1 passed
  • uv run --no-sync pytest -n 8 -q test_unstructured/metrics/test_evaluate.py — 26 passed
  • Ruff check and format check passed for the changed Python files
  • git diff --check passed
  • changelog and package versions both set to 0.25.2

Review in cubic

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