-
Notifications
You must be signed in to change notification settings - Fork 0
feat: create script to schedule adding Pending Summaries To Queue instead of Cron #66
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
Caution Review failedRate limit reached, please try again later. Warning Rate limit exceeded@kshitij-k-osmosys has exceeded the limit for the number of commits or files that can be reviewed per hour. Please wait 6 minutes and 23 seconds before requesting another review. ⌛ 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. WalkthroughThe changes in this pull request involve modifications to the Dockerfile, documentation, and the introduction of a new shell script and controller for managing summary tasks. The Dockerfile now executes a scheduler script alongside the NestJS application. Documentation updates include new instructions for running the scheduler script. A new Changes
Possibly related PRs
Suggested labels
Suggested reviewers
Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media? 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
CodeRabbit Configuration File (
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 11
🧹 Outside diff range and nitpick comments (2)
apps/api/src/config/logger.config.ts (1)
Line range hint
13-16
: Consider implementing distributed tracing for request correlationThe TODO comment about tracebackId suggests a need for request correlation across components. Consider implementing proper distributed tracing using a solution like OpenTelemetry.
Would you like me to provide an example implementation using OpenTelemetry for distributed tracing?
apps/api/docs/usage-guide.md (1)
Security concerns identified in scheduler implementation
The architectural change from Cron to script-based scheduling has several security and implementation issues:
- The scheduler endpoint (
/summary/schedule
) lacks authentication guards, while other endpoints are protected withAzureADGuard
- The scheduler script makes unauthenticated HTTP calls to the endpoint
- No error handling or recovery mechanism in the scheduler script
- No rate limiting or concurrency control in the scheduler implementation
🔗 Analysis chain
Line range hint
24-102
: Verify complete implementation of scheduling changesThe architectural change from Cron to script-based scheduling appears sound, but several critical components need verification:
- The scheduler.sh script implementation
- The controller endpoint security
- Error handling and recovery in the scheduler
Let's verify the complete implementation:
🏁 Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash # Check for scheduler script fd -t f "scheduler.sh$" # Check for controller endpoint security ast-grep --pattern 'class SummaryController { $$$ @$DECORATOR("summary/schedule") scheduleAddingPendingSummariesToQueue() { $$$ } $$$ }' # Check for error handling rg -A 5 "catch.*error.*scheduler"Length of output: 236
Script:
#!/bin/bash # Let's check the scheduler script content cat apps/api/scheduler.sh # Check for controller implementation with broader pattern ast-grep --pattern 'class SummaryController { $$$ }' # Check for any scheduling-related code rg -A 5 "schedule|cron|queue"Length of output: 20969
Script:
#!/bin/bash # Let's check for security decorators and error handling in the schedule service ast-grep --pattern 'class ScheduleService { $$$ }' # Check for any authentication guards rg -A 5 "@UseGuards|@Auth" # Check for error handling in the service rg -A 5 "catch.*error.*summary"Length of output: 1221
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
📒 Files selected for processing (9)
apps/api/Dockerfile
(1 hunks)apps/api/docs/development-setup.md
(2 hunks)apps/api/docs/usage-guide.md
(2 hunks)apps/api/scheduler.sh
(1 hunks)apps/api/src/config/logger.config.ts
(1 hunks)apps/api/src/modules/summary/schedule/schedule.service.ts
(1 hunks)apps/api/src/modules/summary/summary.controller.spec.ts
(1 hunks)apps/api/src/modules/summary/summary.controller.ts
(1 hunks)apps/api/src/modules/summary/summary.module.ts
(2 hunks)
🧰 Additional context used
🪛 Shellcheck (0.10.0)
apps/api/scheduler.sh
[warning] 13-13: last_archive_run appears unused. Verify use (or export if used externally).
(SC2034)
🪛 LanguageTool
apps/api/docs/development-setup.md
[uncategorized] ~102-~102: Possible missing article found.
Context: ...tion that adds all pending summaries to queue for processing.
(AI_HYDRA_LEO_MISSING_A)
🔇 Additional comments (2)
apps/api/src/modules/summary/summary.module.ts (1)
13-13
: Verify controller dependencies and consider exporting ScheduleService
The controller addition looks good, but please verify:
- That SummaryController has access to all required dependencies
- Whether ScheduleService should be exported if it's needed by other modules
Also applies to: 27-27
✅ Verification successful
Let me gather more information about the dependencies and service usage.
Let me check one final thing to see if the controller's constructor is properly injecting the ScheduleService.
Dependencies are properly configured, no need to export ScheduleService
The verification shows that:
- SummaryController correctly injects ScheduleService in its constructor
- ScheduleService is properly provided in the SummaryModule
- ScheduleService is only used within the summary module (no external usage found), so it doesn't need to be exported
🏁 Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash
# Check if ScheduleService is used outside this module
rg "ScheduleService" --type ts -l | grep -v "summary/schedule"
# Verify controller's constructor dependencies
ast-grep --pattern 'class SummaryController {
constructor($_) {
$$$
}
}'
Length of output: 241
Script:
#!/bin/bash
# Check SummaryController's constructor dependencies
ast-grep --pattern 'constructor($_) {
$$$
}' apps/api/src/modules/summary/summary.controller.ts
# Check if ScheduleService is imported in summary.controller.ts
rg "import.*ScheduleService" apps/api/src/modules/summary/summary.controller.ts
# Check module providers and exports
cat apps/api/src/modules/summary/summary.module.ts
Length of output: 1476
Script:
#!/bin/bash
# Get the full SummaryController implementation to check constructor
cat apps/api/src/modules/summary/summary.controller.ts
Length of output: 437
apps/api/src/config/logger.config.ts (1)
38-38
: LGTM: App name updated correctly
The logger name change from 'OsmosysAssistant' to 'TranscriptSummarizer' accurately reflects the application's identity.
API PR Checklist
Pre-requisites
PR Details
PR details have been updated as per the given format (see below)
feat: add admin login endpoint
)Additional Information
ready for review
should be added if the PR is ready to be reviewed)Description:
Create script to schedule adding Pending Summaries To Queue instead of Cron
Related changes:
summary
modulescheduleAddingPendingSummariesToQueue
to runscheduler.service
functionScreenshots:
NA
Query request and response:
NA
Documentation changes:
development-setup.md
usage-guide.md
Test suite output:
NA
Pending actions:
NA
Additional notes:
NA
Summary by CodeRabbit
New Features
scheduler.sh
script for scheduling summary tasks.SummaryController
with a new endpoint for scheduling summaries.Documentation
Bug Fixes
Tests
SummaryController
to ensure proper instantiation.