Add command for checking stale image updates, refactor python utils - #363
Conversation
|
Warning Review limit reached
Next review available in: 2 minutes Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available. 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: Path: .coderabbit.yaml Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (10)
WalkthroughGit and Docker Compose utility modules were relocated into scripts/utils, with dependent scripts and the docs Taskfile updated to reference the new import paths. Compose processing gained image reference extraction with line numbers. A new CLI script, check-stale-images.py, reports image ages based on git blame history. ChangesShared utils relocation and stale image tooling
Estimated code review effort: 3 (Moderate) | ~25 minutes Possibly related PRs
🚥 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 |
|
@coderabbitai review |
✅ Action performedReview finished.
|
There was a problem hiding this comment.
Actionable comments posted: 2
🧹 Nitpick comments (2)
scripts/check-stale-images.py (2)
135-135: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low valueMinor: repeated
datetime.now(tz=UTC)calls in sort key.The sort key calls
datetime.now(tz=UTC)once per uncommitted entry rather than a single reference timestamp, giving eachNoneentry a slightly different "now" value. This has negligible practical impact but a single computed timestamp would be more deterministic.🤖 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 `@scripts/check-stale-images.py` at line 135, The sort key in the entries ordering uses datetime.now(tz=UTC) repeatedly for each None last_changed value, which makes the fallback timestamp vary slightly across items. Update the logic around the entries sort to compute one UTC “now” timestamp once before sorting, then reuse that single value in the key function so all uncommitted entries share the same deterministic fallback.
190-192: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low valueUse the configured
loggerinstead of the module-levellogging.exception.
logging.exception(...)logs against the root logger, not theloggerconfigured viaconfigure_logger. In--verbosemode this bypasses the custom formatter/handler attached tologger, producing inconsistently formatted error output compared to the rest of the script's logging.🤖 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 `@scripts/check-stale-images.py` around lines 190 - 192, The exception handler in the stale image report flow is logging through the root logger instead of the configured logger. Update the except block in the stale image reporting path to use the existing logger created by configure_logger, so the error goes through the same formatter and handlers as the rest of the script. Keep the same error message in the report-generation error path, but route it via logger rather than logging.exception.
🤖 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 `@scripts/check-stale-images.py`:
- Around line 183-192: The repository path resolution in the stale-images script
bypasses the existing error handler because `get_git_root()` is called before
the `try` block. Move the `repository_path = args.repository_path or
Path(get_git_root())` logic inside the `main` flow’s `try` section so
`GitExecutableNotFoundError` and `NotInGitRepositoryError` from `get_git_root()`
are caught and routed through the existing `logging.exception("Error generating
stale image report")` and `sys.exit(1)` path, alongside the rest of
`collect_image_entries` and `print_report`.
- Around line 37-59: The non-verbose path in configure_logger() sets the logger
to INFO but never attaches any handler, so INFO messages are dropped by the
default logging flow. Update configure_logger() so both branches configure an
output handler (or rely on a shared root handler) and ensure the non-verbose
branch still emits INFO-level logs, while preserving the existing DEBUG
formatter/handler behavior for verbose mode. Reference configure_logger() and
its verbose=False branch when making the change.
---
Nitpick comments:
In `@scripts/check-stale-images.py`:
- Line 135: The sort key in the entries ordering uses datetime.now(tz=UTC)
repeatedly for each None last_changed value, which makes the fallback timestamp
vary slightly across items. Update the logic around the entries sort to compute
one UTC “now” timestamp once before sorting, then reuse that single value in the
key function so all uncommitted entries share the same deterministic fallback.
- Around line 190-192: The exception handler in the stale image report flow is
logging through the root logger instead of the configured logger. Update the
except block in the stale image reporting path to use the existing logger
created by configure_logger, so the error goes through the same formatter and
handlers as the rest of the script. Keep the same error message in the
report-generation error path, but route it via logger rather than
logging.exception.
🪄 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: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
Run ID: 7be5058d-6a2b-4aad-b1da-d496eb6d25ca
📒 Files selected for processing (10)
docs/ai/ai-agents.mddocs/web/Taskfile.web.yamldocs/web/git_utils.pydocs/web/update-docs.pyscripts/check-stale-images.pyscripts/export-services.pyscripts/utils/__init__.pyscripts/utils/compose_processor.pyscripts/utils/docker_scanner.pyscripts/utils/git_utils.py
💤 Files with no reviewable changes (1)
- docs/web/git_utils.py
Summary by CodeRabbit
New Features
Bug Fixes