fix(ingestion): normalize artifact stat errors - #462
Conversation
|
Warning Review limit reached
Next review available in: 25 minutes You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository. How can I continue?After more reviews become available, a review can be triggered using the To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews. How do review limits work?CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability. For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window. Please refer docs for additional details. Review details⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (2)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Pull request overview
This PR tightens artifact-path validation in the cohort document materializer by normalizing lstat() failures into the existing MaterializerArtifactValidationError, ensuring the CLI boundary and user-facing error message remain consistent (per the contract introduced in #454).
Changes:
- Treat any
path.lstat()OSErroras “no metadata available” so missing/inaccessible artifacts consistently raise the regular-file validation error. - Add a regression test that simulates an unreadable artifact (permission failure) and asserts the normalized
CohortDocumentMaterializationErrormessage.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
legalforecast/ingestion/cohort_document_materializer.py |
Broadens lstat() exception handling to normalize all OSError failures into the existing artifact validation error path. |
tests/test_cohort_document_materializer.py |
Adds a regression test for inaccessible artifact metadata (permission-style lstat() failure) to lock in the normalized error message/contract. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Summary
lstat()OSErrorfailures to the existing materializer regular-file validation errorCommandErrorboundary introduced by refactor(ingestion): extract materializer artifact guard #454Validation
uv run ruff format --check .uv run ruff check .uv run pyrightuv run pytest -q tests/test_cohort_document_materializer.py -k materializer_artifact_validation(8 passed)5bf15922Bead: LegalForecastBench-4i0g
Note
Low Risk
Narrow change to artifact path validation error normalization in the cohort document materializer; no auth, data, or workflow logic changes.
Overview
require_materializer_artifactnow treats anylstat()OSError(not onlyFileNotFoundError) as failed metadata lookup, so inaccessible artifacts surface the sameMaterializerArtifactValidationErroras missing or non-regular files instead of leaking the underlying OS error.A regression test uses a path stub that raises
PermissionErroronlstat()and asserts the unchanged CLI-facing message andCohortDocumentMaterializationErrorcontract.Reviewed by Cursor Bugbot for commit 5bf1592. Bugbot is set up for automated code reviews on this repo. Configure here.