Handle missing log in export_report#55
Conversation
WalkthroughThe PR fixes log path normalization in ChangesLog path normalization in report export
Estimated code review effort🎯 2 (Simple) | ⏱️ ~8 minutes 🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ 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 |
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@tests/test_report_export.py`:
- Around line 6-17: Add a concise docstring to the helper function
_export_single_report describing its purpose, inputs (tmp_path, monkeypatch,
record) and returned value, then add short inline comments to mark the setup
phase (changing to tmp_path and clearing report_export.status and
report_export.status_list) and the export phase (calling
report_export.export_report and reading report.json) so each logical block is
documented for tooling and readers.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: ASSERTIVE
Plan: Pro
Run ID: 750492e3-c887-4ae3-8731-cccb4ae37286
📒 Files selected for processing (2)
make_profiler/report_export.pytests/test_report_export.py
| def _export_single_report(tmp_path, monkeypatch, record: dict[str, object]) -> dict: | ||
| monkeypatch.chdir(tmp_path) | ||
| report_export.status.clear() | ||
| report_export.status_list.clear() | ||
|
|
||
| report_export.export_report( | ||
| {"build": record}, | ||
| {"build": "Build target"}, | ||
| {"build"}, | ||
| ) | ||
|
|
||
| return json.loads((tmp_path / "report.json").read_text()) |
There was a problem hiding this comment.
🛠️ Refactor suggestion | 🟠 Major | ⚡ Quick win
Add a helper docstring and brief logical-block comments.
Please document this helper and annotate its setup/export phases to satisfy the Python documentation/comment requirements.
Proposed update
def _export_single_report(tmp_path, monkeypatch, record: dict[str, object]) -> dict:
+ """Export a single-target report.json and return parsed JSON content."""
+ # Isolate filesystem side effects and reset module-level accumulators.
monkeypatch.chdir(tmp_path)
report_export.status.clear()
report_export.status_list.clear()
+ # Export one synthetic target record.
report_export.export_report(
{"build": record},
{"build": "Build target"},
{"build"},
)
+ # Read the generated report payload.
return json.loads((tmp_path / "report.json").read_text())🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
In `@tests/test_report_export.py` around lines 6 - 17, Add a concise docstring to
the helper function _export_single_report describing its purpose, inputs
(tmp_path, monkeypatch, record) and returned value, then add short inline
comments to mark the setup phase (changing to tmp_path and clearing
report_export.status and report_export.status_list) and the export phase
(calling report_export.export_report and reading report.json) so each logical
block is documented for tooling and readers.
Summary
targetLogas an empty string when the performance record haslog: Nonelogkey is absentkonturiotomaumapsTesting
git diff --check origin/master...maumaps/codex/fix-keyerror--log--on-geocint81bce12:pytest -q,ruff check make_profiler tests/test_report_export.py,pylint --disable=all --enable=E make_profiler, and GitHub CI/Lint passed on Handle missing log in export_report #33Summary by CodeRabbit
Bug Fixes
Tests