fix: lock pypdf to patched release - #46
Conversation
📝 WalkthroughWalkthrough
Changes
Estimated code review effort🎯 2 (Simple) | ⏱️ ~8 minutes Poem
🚥 Pre-merge checks | ✅ 1 | ❌ 2❌ Failed checks (1 warning, 1 inconclusive)
✅ Passed checks (1 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Comment |
|
@coderabbitai review |
✅ Actions performedReview triggered.
|
There was a problem hiding this comment.
🧹 Nitpick comments (1)
tests/test_project_metadata.py (1)
5-12: 상대 경로 의존성 제거 권장 - 작업 디렉토리에 강한 의존성 제거현재 코드의 정규식 자체는
uv.lock형식과 일치하며 정상 작동하지만,Path("uv.lock")은 스크립트 실행 디렉토리에 의존합니다. 테스트를 저장소 루트 외 다른 위치에서 실행하거나 작업 디렉토리가 변경되면 실패할 수 있습니다. 절대 경로로 변경하고 TOML 파싱을 사용하면 더 견고해집니다.제안 diff
from pathlib import Path -import re +import tomllib def _locked_package_version(name: str) -> tuple[int, ...]: - text = Path("uv.lock").read_text(encoding="utf-8") - match = re.search( - rf'\[\[package\]\]\nname = "{re.escape(name)}"\nversion = "([^"]+)"', - text, - ) - assert match is not None, f"package {name!r} missing from uv.lock" - return tuple(int(part) for part in match.group(1).split(".")) + repo_root = Path(__file__).resolve().parents[1] + lock_data = tomllib.loads((repo_root / "uv.lock").read_text(encoding="utf-8")) + for pkg in lock_data.get("package", []): + if pkg.get("name") == name: + version = pkg.get("version") + assert isinstance(version, str), f"invalid version for package {name!r}" + return tuple(int(part) for part in version.split(".")) + raise AssertionError(f"package {name!r} missing from uv.lock")🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@tests/test_project_metadata.py` around lines 5 - 12, The helper _locked_package_version currently reads uv.lock via Path("uv.lock") which depends on the current working directory; change it to locate the repository root (or use the test file's directory) and open the uv.lock with an absolute path, and replace the regex parsing with a TOML parser to robustly extract package version (look up the package entry for name in the parsed data and return the version tuple). Update references inside _locked_package_version to use the absolute path and toml.load instead of Path("uv.lock").read_text and regex.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Nitpick comments:
In `@tests/test_project_metadata.py`:
- Around line 5-12: The helper _locked_package_version currently reads uv.lock
via Path("uv.lock") which depends on the current working directory; change it to
locate the repository root (or use the test file's directory) and open the
uv.lock with an absolute path, and replace the regex parsing with a TOML parser
to robustly extract package version (look up the package entry for name in the
parsed data and return the version tuple). Update references inside
_locked_package_version to use the absolute path and toml.load instead of
Path("uv.lock").read_text and regex.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
Run ID: a81727a0-68d4-4e54-a04a-b485e2bb8fbb
⛔ Files ignored due to path filters (1)
uv.lockis excluded by!**/*.lock
📒 Files selected for processing (1)
tests/test_project_metadata.py
Summary
uv.lockfrompypdf 6.9.2to the patched6.10.0release that fixes GHSA-3crg-w4f6-42mx / CVE-2026-40260pypdffloorVerification
uv run pytestuv run pytest --cov=src/newsdom_api --cov-branch --cov-report=term-missing --cov-fail-under=100Summary by CodeRabbit
릴리스 노트
참고: 이번 변경은 내부 테스트 개선 사항이며, 최종 사용자에게 직접적인 영향은 없습니다.