Edwin Salguero commited on
Commit Β·
184a5a6
1
Parent(s): 1315d62
feat: Add comprehensive Dependabot PR review workflow
Browse files- Add automated review script for all 12 Dependabot PRs
- Create Cursor-specific PR review guide
- Include AI-assisted review prompts and templates
- Add trading-specific review criteria
- Support both EAName and ParallelLLC repositories
- Include local testing and Docker build validation
- Add review decision logging and tracking
Files changed (4)
- CURSOR_PR_REVIEW_GUIDE.mdAdded+269
- HUGGINGFACE_PROTECTION.mdAdded+188
- review_dependabot_prs.shAdded+177
- setup_branch_protection.shAdded+72
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269# π€ Cursor PR Review Guide for Dependabot PRs
## π― **Quick Start: Review All 12 Dependabot PRs**
### **Step 1: Run the Automated Review Script**```bash# Make the script executablechmod +x review_dependabot_prs.sh
# Run the review workflow./review_dependabot_prs.sh```
This script will:- β
Run local tests first- β
Test Docker builds- β
Open each PR in your browser- β
Guide you through review decisions- β
Log all decisions for tracking
## π **Cursor-Specific Review Workflow**
### **Method 1: Using Cursor's GitHub Integration**
#### **Open All PRs in Cursor:**```bash# In Cursor command palette (Cmd+Shift+P):GitHub: View Pull Requests```
#### **Review Each PR:**1. **Select PR** from the list2. **Review changes** in side-by-side diff3. **Add comments** using Cursor's inline commenting4. **Use AI assistance** for code review5. **Approve or request changes**
### **Method 2: Direct PR URLs**
#### **EAName Repository PRs:**```bash# In Cursor command palette:GitHub: Open Pull Request from URL
# Then paste these URLs one by one:https://github.com/EAName/algorithmic_trading/pull/6https://github.com/EAName/algorithmic_trading/pull/5https://github.com/EAName/algorithmic_trading/pull/4https://github.com/EAName/algorithmic_trading/pull/3https://github.com/EAName/algorithmic_trading/pull/2https://github.com/EAName/algorithmic_trading/pull/1```
#### **ParallelLLC Repository PRs:**```bash# Same process for ParallelLLC:https://github.com/ParallelLLC/algorithmic_trading/pull/6https://github.com/ParallelLLC/algorithmic_trading/pull/5https://github.com/ParallelLLC/algorithmic_trading/pull/4https://github.com/ParallelLLC/algorithmic_trading/pull/3https://github.com/ParallelLLC/algorithmic_trading/pull/2https://github.com/ParallelLLC/algorithmic_trading/pull/1```
## π **Review Checklist for Each PR**
### **Critical PRs (Review First):**
#### **1. Python 3.13 Update (PR #6)****Priority: HIGH**```bash# Check for breaking changes- [ ] All dependencies compatible with Python 3.13- [ ] No deprecated features used- [ ] Performance impact minimal- [ ] Trading logic unaffected```
#### **2. Docker Action Updates (PRs #2, #4)****Priority: MEDIUM**```bash# Check CI/CD pipeline- [ ] Docker builds still work- [ ] Image size reasonable- [ ] Security improvements- [ ] No breaking changes```
#### **3. GitHub Actions Updates (PRs #1, #3, #5)****Priority: LOW**```bash# Check workflow compatibility- [ ] Actions still function- [ ] No deprecated features- [ ] Performance improvements- [ ] Security enhancements```
## π€ **Using Cursor's AI for PR Review**
### **AI-Assisted Review Commands:**
#### **1. Ask AI to Review Changes:**```bash# In Cursor chat:"Review this PR for breaking changes and security issues"```
#### **2. Check for Trading-Specific Issues:**```bash# In Cursor chat:"Check if these dependency updates affect our trading algorithms or risk management"```
#### **3. Validate CI/CD Pipeline:**```bash# In Cursor chat:"Verify that these GitHub Actions updates won't break our CI/CD pipeline"```
### **AI Review Prompts:**
#### **For Python 3.13 Update:**```"Review this Python 3.13 update for:1. Breaking changes in our trading dependencies2. Performance impact on our algorithms3. Security improvements4. Compatibility with our Docker setup"```
#### **For GitHub Actions Updates:**```"Review these GitHub Actions updates for:1. Workflow compatibility2. Security improvements3. Performance enhancements4. Any deprecated features"```
## π **Review Decision Matrix**
### **Approve If:**- β
No breaking changes detected- β
Tests pass locally- β
Docker builds successfully- β
Security improvements included- β
Performance maintained or improved
### **Request Changes If:**- β Breaking changes found- β Tests fail- β Docker build fails- β Security vulnerabilities introduced- β Performance degradation
### **Comment Only If:**- π¬ Minor concerns that don't block approval- π¬ Suggestions for future improvements- π¬ Questions about implementation- π¬ Documentation requests
## π‘οΈ **Trading-Specific Review Criteria**
### **Risk Management:**- [ ] No changes to risk calculation logic- [ ] Position limits still enforced- [ ] Drawdown protection maintained- [ ] Compliance requirements met
### **Performance:**- [ ] Algorithm execution time unchanged- [ ] Memory usage reasonable- [ ] CPU utilization acceptable- [ ] API response times maintained
### **Security:**- [ ] No new vulnerabilities introduced- [ ] API keys still secure- [ ] Authentication mechanisms intact- [ ] Data encryption maintained
## π― **Efficient Review Strategy**
### **Batch Review Approach:**
#### **Phase 1: Critical Updates (30 minutes)**1. **Python 3.13 Update** - Test thoroughly2. **Docker Updates** - Verify builds3. **Security Updates** - Validate improvements
#### **Phase 2: Standard Updates (15 minutes)**1. **GitHub Actions** - Quick compatibility check2. **Minor Dependencies** - Standard review3. **Documentation Updates** - Verify accuracy
#### **Phase 3: Approval (5 minutes)**1. **Approve safe updates**2. **Request changes for issues**3. **Merge approved PRs**
## π **Review Template**
### **For Each PR, Use This Template:**
```markdown## PR Review: [PR Title]
### β
What I Reviewed:- [ ] Code changes- [ ] Dependency updates- [ ] Breaking changes- [ ] Security implications- [ ] Performance impact- [ ] Local testing- [ ] Docker build
### π Findings:- **Breaking Changes**: [Yes/No]- **Security Issues**: [Yes/No]- **Performance Impact**: [None/Minor/Major]- **Test Results**: [Pass/Fail]
### π¬ Comments:[Add any specific comments or suggestions]
### β
Decision:- [ ] **Approve** - Safe to merge- [ ] **Request Changes** - Issues found- [ ] **Comment Only** - Minor concerns```
## π **Quick Commands for Cursor**
### **Keyboard Shortcuts:**```bashCmd+Shift+P # Command paletteCmd+Shift+G # Source controlCmd+Enter # Submit reviewCmd+Shift+Enter # Approve PRCmd+/ # Toggle comment```
### **Useful Commands:**```bashGitHub: View Pull RequestsGitHub: Open Pull Request from URLGitHub: Review Pull RequestGitHub: Add Comment to Pull Request```
## β
**Success Metrics**
### **Review Goals:**- **Time**: Complete all 12 PRs in < 1 hour- **Quality**: 100% of critical issues caught- **Safety**: No breaking changes merged- **Efficiency**: Use AI assistance for 80% of reviews
### **Quality Checklist:**- [ ] All PRs reviewed within 24 hours- [ ] No critical issues missed- [ ] All approved PRs pass CI/CD- [ ] Documentation updated as needed- [ ] Team notified of any issues
---
**Ready to start? Run `./review_dependabot_prs.sh` to begin the automated review workflow!** 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188# π€ Hugging Face Repository Protection Guide
## π Overview
Hugging Face repositories have different protection mechanisms than GitHub. This guide shows how to implement protection for your algorithmic trading repositories on Hugging Face.
## π‘οΈ Available Protection Methods
### **1. Repository Settings (Web Interface)**
#### **Access Control:**1. Go to your repository: `https://huggingface.co/ParallelLLC/algorithmic_trading`2. Click **"Settings"** tab3. Configure these settings:
**Repository Visibility:**- [x] **Private** (recommended for trading systems)- [ ] Public (if you want to share)
**Collaboration:**- [x] **Require approval for new collaborators**- [x] **Restrict push access to maintainers only**
**Model Card:**- [x] **Require model card for uploads**- [x] **Validate model card format**
### **2. Git Hooks (Local Protection)**
#### **Pre-commit Hook:**The pre-commit hook I created will:- β
Warn about direct commits to main- β
Run tests before commit- β
Check code formatting- β
Scan for secrets- β
Prevent commits if checks fail
#### **Install the Hook:**```bash# The hook is already installed in .git/hooks/pre-commit# It will run automatically on every commit```
### **3. CI/CD Protection**
#### **GitHub Actions (Recommended):**Since Hugging Face integrates with GitHub:1. **Keep GitHub as primary** with full protection2. **Sync to Hugging Face** after GitHub validation3. **Use GitHub's branch protection** rules
#### **Workflow:**```bash# 1. Develop on GitHub (with protection)git push origin feature/new-strategy
# 2. Create PR on GitHub# 3. All checks pass# 4. Merge to main# 5. Sync to Hugging Facegit push hf maingit push esalguero_hf main```
### **4. Manual Protection Practices**
#### **Development Workflow:**```bash# Always use feature branchesgit checkout -b feature/new-strategy# Make changesgit commit -m "feat: add new strategy"git push origin feature/new-strategy
# Create PR on GitHub (not Hugging Face)# Get reviews and approvals# Merge on GitHub# Then sync to Hugging Face```
#### **Code Review Process:**1. **Never commit directly to main**2. **Always create feature branches**3. **Use GitHub for PRs and reviews**4. **Sync to Hugging Face after approval**
## π§ Implementation Steps
### **Step 1: Configure Repository Settings**1. Go to: `https://huggingface.co/ParallelLLC/algorithmic_trading/settings`2. Set repository to **Private**3. Enable **Require approval for collaborators**
### **Step 2: Use GitHub as Primary**1. **Develop on GitHub** with full protection2. **Use GitHub's branch protection** rules3. **Sync to Hugging Face** after validation
### **Step 3: Enable Pre-commit Hook**```bash# The hook is already installed and executable# It will run automatically on commits```
### **Step 4: Team Guidelines**```markdown## Development Guidelines for Hugging Face Repos
### β
Do:- Use GitHub for development and PRs- Create feature branches for all changes- Get code review before merging- Run tests locally before pushing- Sync to Hugging Face after GitHub approval
### β Don't:- Commit directly to main branch- Push untested code- Skip code review process- Use Hugging Face for development workflow```
## π¨ Emergency Procedures
### **If Direct Commit to Main is Needed:**```bash# 1. Create emergency branchgit checkout -b hotfix/emergency-fix
# 2. Make minimal fixgit commit -m "hotfix: emergency fix for critical issue"
# 3. Test thoroughlypython -m pytest tests/python demo.py
# 4. Push to GitHub firstgit push origin hotfix/emergency-fix
# 5. Create emergency PR# 6. Get expedited review# 7. Merge and sync to Hugging Face```
## π Protection Summary
### **GitHub (Primary Development):**- β
Full branch protection- β
Required reviews- β
CI/CD checks- β
Code owner reviews- β
Automated testing
### **Hugging Face (Distribution):**- β
Private repository- β
Pre-commit hooks- β
Manual review process- β
Sync after GitHub validation
## π― Best Practices
### **1. Use GitHub as Source of Truth**- All development happens on GitHub- Hugging Face is for distribution- Sync after GitHub validation
### **2. Never Skip Protection**- Always use feature branches- Always get code review- Always run tests- Always validate on GitHub first
### **3. Monitor Both Repositories**- Check GitHub for development status- Check Hugging Face for distribution status- Ensure both are in sync
## π Useful Links
- **GitHub Repository**: https://github.com/EAName/algorithmic_trading- **Hugging Face ParallelLLC**: https://huggingface.co/ParallelLLC/algorithmic_trading- **Hugging Face esalguero**: https://huggingface.co/esalguero/algorithmic_trading- **GitHub Settings**: https://github.com/EAName/algorithmic_trading/settings/branches- **Hugging Face Settings**: https://huggingface.co/ParallelLLC/algorithmic_trading/settings
---
**Note**: Hugging Face repositories are best used for model distribution and sharing, while GitHub provides the robust development and protection features needed for algorithmic trading systems. 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177#!/bin/bash
# Dependabot PR Review Workflow Script# This script helps review all Dependabot PRs efficiently
echo "π€ Dependabot PR Review Workflow"echo "=================================="
# ConfigurationEANAME_REPO="EAName/algorithmic_trading"PARALLEL_REPO="ParallelLLC/algorithmic_trading"
# Colors for outputRED='\033[0;31m'GREEN='\033[0;32m'YELLOW='\033[1;33m'BLUE='\033[0;34m'NC='\033[0m' # No Color
# Function to check PR statuscheck_pr_status() { local repo=$1 local pr_number=$2 local pr_title=$3 echo -e "\n${BLUE}π Reviewing PR #$pr_number: $pr_title${NC}" echo "Repository: $repo" # Open PR in browser echo -e "${YELLOW}π Opening PR in browser...${NC}" open "https://github.com/$repo/pull/$pr_number" # Wait for user to review echo -e "${YELLOW}β³ Review the PR in your browser, then press Enter to continue...${NC}" read -r # Ask for decision echo -e "${GREEN}β
Decision for PR #$pr_number:${NC}" echo "1. Approve" echo "2. Request changes" echo "3. Comment only" echo "4. Skip for now" read -p "Enter your choice (1-4): " choice case $choice in 1) echo -e "${GREEN}β
Approved PR #$pr_number${NC}" echo "$repo PR #$pr_number: APPROVED - $pr_title" >> review_log.txt ;; 2) echo -e "${RED}β Requested changes for PR #$pr_number${NC}" echo "$repo PR #$pr_number: CHANGES_REQUESTED - $pr_title" >> review_log.txt ;; 3) echo -e "${YELLOW}π¬ Commented on PR #$pr_number${NC}" echo "$repo PR #$pr_number: COMMENTED - $pr_title" >> review_log.txt ;; 4) echo -e "${YELLOW}βοΈ Skipped PR #$pr_number${NC}" echo "$repo PR #$pr_number: SKIPPED - $pr_title" >> review_log.txt ;; *) echo -e "${RED}β Invalid choice, skipping...${NC}" echo "$repo PR #$pr_number: SKIPPED - $pr_title" >> review_log.txt ;; esac}
# Function to run local testsrun_local_tests() { echo -e "\n${BLUE}π§ͺ Running local tests...${NC}" # Check if we're in the right directory if [ ! -f "requirements.txt" ]; then echo -e "${RED}β Not in algorithmic_trading directory${NC}" return 1 fi # Run tests echo "Running pytest..." python -m pytest tests/ -v --tb=short if [ $? -eq 0 ]; then echo -e "${GREEN}β
Tests passed${NC}" else echo -e "${RED}β Tests failed${NC}" return 1 fi # Check code formatting echo "Checking code formatting..." python -m black --check . if [ $? -eq 0 ]; then echo -e "${GREEN}β
Code formatting OK${NC}" else echo -e "${YELLOW}β οΈ Code formatting issues found${NC}" fi # Check for security issues echo "Checking for security issues..." if command -v safety &> /dev/null; then safety check else echo -e "${YELLOW}β οΈ Safety not installed, skipping security check${NC}" fi}
# Function to check Docker buildcheck_docker_build() { echo -e "\n${BLUE}π³ Testing Docker build...${NC}" # Build Docker image docker build -t test-algorithmic-trading . if [ $? -eq 0 ]; then echo -e "${GREEN}β
Docker build successful${NC}" # Test Docker image docker run --rm test-algorithmic-trading python -c "print('Docker test passed')" if [ $? -eq 0 ]; then echo -e "${GREEN}β
Docker image test passed${NC}" else echo -e "${RED}β Docker image test failed${NC}" fi # Clean up docker rmi test-algorithmic-trading else echo -e "${RED}β Docker build failed${NC}" return 1 fi}
# Main workflowmain() { echo -e "${GREEN}π Starting Dependabot PR Review Workflow${NC}" # Initialize review log echo "# Dependabot PR Review Log - $(date)" > review_log.txt echo "" >> review_log.txt # Run local tests first run_local_tests # Check Docker build check_docker_build echo -e "\n${BLUE}π Reviewing EAName Repository PRs${NC}" echo "==================================" # EAName Repository PRs check_pr_status "$EANAME_REPO" "6" "docker(deps): bump python from 3.11-slim to 3.13-slim" check_pr_status "$EANAME_REPO" "5" "github-actions(deps): bump peter-evans/create-pull-request from 4 to 7" check_pr_status "$EANAME_REPO" "4" "github-actions(deps): bump peaceiris/actions-gh-pages from 3 to 4" check_pr_status "$EANAME_REPO" "3" "github-actions(deps): bump actions/upload-artifact from 3 to 4" check_pr_status "$EANAME_REPO" "2" "github-actions(deps): bump docker/login-action from 2 to 3" check_pr_status "$EANAME_REPO" "1" "github-actions(deps): bump github/codeql-action from 2 to 3" echo -e "\n${BLUE}π Reviewing ParallelLLC Repository PRs${NC}" echo "==================================" # ParallelLLC Repository PRs check_pr_status "$PARALLEL_REPO" "6" "docker(deps): bump python from 3.11-slim to 3.13-slim" check_pr_status "$PARALLEL_REPO" "5" "github-actions(deps): bump actions/setup-python from 4 to 5" check_pr_status "$PARALLEL_REPO" "4" "github-actions(deps): bump docker/login-action from 2 to 3" check_pr_status "$PARALLEL_REPO" "3" "github-actions(deps): bump docker/metadata-action from 4 to 5" check_pr_status "$PARALLEL_REPO" "2" "github-actions(deps): bump peter-evans/create-pull-request from 4 to 7" check_pr_status "$PARALLEL_REPO" "1" "github-actions(deps): bump docker/build-push-action from 4 to 6" # Summary echo -e "\n${GREEN}β
Review workflow completed!${NC}" echo -e "${BLUE}π Review log saved to: review_log.txt${NC}" echo -e "\n${YELLOW}π Summary:${NC}" cat review_log.txt}
# Run the workflowmain 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172#!/bin/bash
# Branch Protection Setup Script# Run this script to automatically configure branch protection
echo "π‘οΈ Setting up branch protection for algorithmic trading repository..."
# ConfigurationREPO="EAName/algorithmic_trading"BRANCH="main"REQUIRED_REVIEWS=2REQUIRED_CHECKS='["ci-cd/quality-check","ci-cd/test","ci-cd/security","ci-cd/backtesting"]'
echo "π Configuration:"echo " Repository: $REPO"echo " Branch: $BRANCH"echo " Required reviews: $REQUIRED_REVIEWS"echo " Required checks: $REQUIRED_CHECKS"
echo ""echo "β οΈ IMPORTANT: You need a GitHub Personal Access Token with 'repo' permissions"echo " Get one from: https://github.com/settings/tokens"echo ""
read -p "Enter your GitHub Personal Access Token: " GITHUB_TOKEN
if [ -z "$GITHUB_TOKEN" ]; then echo "β No token provided. Exiting." exit 1fi
echo ""echo "π§ Applying branch protection rules..."
# Apply branch protectioncurl -X PUT \ -H "Authorization: token $GITHUB_TOKEN" \ -H "Accept: application/vnd.github.v3+json" \ "https://api.github.com/repos/$REPO/branches/$BRANCH/protection" \ -d "{ \"required_status_checks\": { \"strict\": true, \"contexts\": $REQUIRED_CHECKS }, \"enforce_admins\": true, \"required_pull_request_reviews\": { \"required_approving_review_count\": $REQUIRED_REVIEWS, \"dismiss_stale_reviews\": true, \"require_code_owner_reviews\": true }, \"restrictions\": null, \"allow_force_pushes\": false, \"allow_deletions\": false }"
if [ $? -eq 0 ]; then echo "" echo "β
Branch protection successfully applied!" echo "" echo "π Applied rules:" echo " - Require pull request before merging" echo " - Require $REQUIRED_REVIEWS approvals" echo " - Require code owner reviews" echo " - Require status checks: $REQUIRED_CHECKS" echo " - No force pushes allowed" echo " - No deletions allowed" echo "" echo "π View settings: https://github.com/$REPO/settings/branches"else echo "" echo "β Failed to apply branch protection. Check your token and permissions."fi CURSOR_PR_REVIEW_GUIDE.mdAdded+269
HUGGINGFACE_PROTECTION.mdAdded+188
review_dependabot_prs.shAdded+177
setup_branch_protection.shAdded+72