fix(wren): validate import paths before force cleanup#2580
Conversation
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Repository UI Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (2)
Walkthrough
ChangesSafe output path handling
Estimated code review effort: 3 (Moderate) | ~20 minutes Suggested reviewers: Poem
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
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 |
What
Validate all project output paths before
write_project_files()performs--forcecleanup.Also reject paths that resolve to the project root itself, such as an empty
path,
., ormodels/...Why
The previous implementation removed Wren-managed project files before
validating every
ProjectFile.relative_path.A malformed import could therefore fail with
invalid output pathafterthe existing project had already been partially deleted.
Paths resolving exactly to the project root also passed the containment
check and failed during
write_text()only after cleanup.Changes
Validation
uv run --no-sync pytest tests/unit/test_convert_mdl.py -v30 passeduvx ruff format --check src/80 files already formatteduvx ruff check src/All checks passed!Additional local stress testing covered both
force=Trueandforce=Falsewith valid entries preceding invalid targets.
Disclosure
This issue was initially reported through the project's coordinated
disclosure process. The maintainers reproduced it, classified it as a
low-severity local data-integrity issue, and authorized proceeding through
the normal public contribution process.
Scope
This change prevents filesystem mutation when output-path preflight fails.
It does not implement transactional rollback for disk errors or process
interruption during the later cleanup/write phase.
Summary by CodeRabbit