Conversation
|
Warning Rate limit exceeded
⌛ How to resolve this issue?After the wait time has elapsed, a review can be triggered using the We recommend that you space out your commits to avoid hitting the rate limit. 🚦 How do rate limits work?CodeRabbit enforces hourly rate limits for each developer per organization. Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout. Please see our FAQ for further information. 📒 Files selected for processing (7)
📝 WalkthroughWalkthroughA new "recent jobs" feature is introduced, adding a GET /jobs API endpoint to retrieve jobs created within a specified time window, along with a "recent" CLI subcommand to query and display those jobs, backed by a database function and comprehensive test coverage. Changes
Sequence DiagramsequenceDiagram
actor User
participant CLI as jobcli (CLI Tool)
participant API as Backend API
participant DB as PostgreSQL
User->>CLI: jobsctl recent --minutes 90 --limit 25
CLI->>CLI: Validate --minutes & --limit via _positive_int()
CLI->>API: GET /jobs?minutes=90&limit=25<br/>(with X-API-Secret header)
API->>API: Authorize request
API->>DB: list_jobs(created_after=cutoff, limit=25)
DB->>DB: Query jobs WHERE created_at >= cutoff<br/>ORDER BY created_at DESC LIMIT 25
DB-->>API: JobRecord list
API-->>CLI: JSON response with job records
CLI->>CLI: Pretty-print JSON payload
CLI-->>User: Display recent jobs (exit 0)
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~25 minutes Poem
🚥 Pre-merge checks | ✅ 2 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (2 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.
🧹 Nitpick comments (2)
apps/worker/README.md (1)
133-163: Minor: Grammar nit flagged by static analysis.Line 138: "look back window" should use a hyphen as "look-back window" for compound adjective.
📝 Optional grammar fix
- - `minutes` (integer, default: `60`, minimum: `1`): look back window size. + - `minutes` (integer, default: `60`, minimum: `1`): look-back window size.🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@apps/worker/README.md` around lines 133 - 163, In the GET /jobs?minutes=<minutes>&limit=<limit> API docs paragraph, change the phrase "look back window size." to the hyphenated compound adjective "look-back window size." so the description of the `minutes` query param reads "look-back window size."; locate the text under the "GET /jobs?minutes=<minutes>&limit=<limit>" heading in the README and update the sentence describing the `minutes` parameter accordingly.apps/worker/src/five08/backend/api.py (1)
664-694: Consider adding an upper bound on theminutesparameter.The
minutesparameter only has a lower bound (ge=1), allowing queries for arbitrarily old data (e.g.,minutes=525600for a year). While thelimit=1000caps row count, an unbounded time window could still impact query performance on large tables if thecreated_atindex scan is expensive.♻️ Optional: Add upper bound to minutes parameter
async def jobs_handler( request: Request, - minutes: int = Query(default=60, ge=1), + minutes: int = Query(default=60, ge=1, le=10080), # max 7 days limit: int = Query(default=100, ge=1, le=1000), ) -> JSONResponse:🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@apps/worker/src/five08/backend/api.py` around lines 664 - 694, The jobs_handler currently allows an unbounded minutes parameter which can cause expensive queries; add an upper bound to the minutes Query (e.g., change minutes: int = Query(default=60, ge=1, le=MAX_MINUTES)) or validate minutes at the start of jobs_handler and return a 400 if it exceeds a configured max; introduce a named constant (e.g., MAX_MINUTES or settings.MAX_JOB_LOOKBACK) and reference it in the Query or validation so callers and reviewers can see the limit and it can be adjusted centrally.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Nitpick comments:
In `@apps/worker/README.md`:
- Around line 133-163: In the GET /jobs?minutes=<minutes>&limit=<limit> API docs
paragraph, change the phrase "look back window size." to the hyphenated compound
adjective "look-back window size." so the description of the `minutes` query
param reads "look-back window size."; locate the text under the "GET
/jobs?minutes=<minutes>&limit=<limit>" heading in the README and update the
sentence describing the `minutes` parameter accordingly.
In `@apps/worker/src/five08/backend/api.py`:
- Around line 664-694: The jobs_handler currently allows an unbounded minutes
parameter which can cause expensive queries; add an upper bound to the minutes
Query (e.g., change minutes: int = Query(default=60, ge=1, le=MAX_MINUTES)) or
validate minutes at the start of jobs_handler and return a 400 if it exceeds a
configured max; introduce a named constant (e.g., MAX_MINUTES or
settings.MAX_JOB_LOOKBACK) and reference it in the Query or validation so
callers and reviewers can see the limit and it can be adjusted centrally.
ℹ️ Review info
Configuration used: defaults
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (7)
README.mdapps/worker/README.mdapps/worker/src/five08/backend/api.pyapps/worker/src/five08/jobcli.pypackages/shared/src/five08/queue.pytests/unit/test_backend_api.pytests/unit/test_jobcli.py
* feat: require id_type for mark-id-verified * docs: move slash command docs to linked command reference * docs: add consolidated Discord bot documentation file * docs: remove obsolete kimai slash commands * Handle optional id_type for mark-id-verified compatibility
* add rerun endpoint and jobsctl CLI * Fix rerun payload validation and stabilize jobsctl tests
* fix: confirm ID verification overwrite before update * fix: require overwrite confirmation for single field conflicts
5cfb90f to
6fa3ff8
Compare
Resolve merge conflict in README.md: keep expanded env var reference from this branch and retain DEVELOPMENT.md link added on main. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Description
Adds a new
jobsctl recentcommand to query recent jobs with--minutes(default 60) and--limit(default 100).Adds
GET /jobs?minutes=<n>&limit=<n>on the worker backend with shared-secret auth, bounded inputs, and descending-order job metadata responses.Introduces
jobslisting support infive08.queueaslist_jobs(...)and wires it to the API handler.Updates docs and unit tests across worker CLI, backend API, and shared queue behavior so the feature is discoverable and covered.
Related Issue
None.
How Has This Been Tested?
Ran
./scripts/test.shand./scripts/lint.sh; both passed in this workspace.Summary by CodeRabbit
Release Notes
New Features
recentCLI subcommand to query recent jobs with customizable time window (--minutes) and result limit (--limit)./jobsAPI endpoint to fetch jobs created within a specified time window.Documentation
Tests