Add automatic PR batching for coordinate edit submissions#2651
Add automatic PR batching for coordinate edit submissions#2651CommanderStorm merged 31 commits intomainfrom
Conversation
|
@copilot instead of batching in the db, we need to update PRs for better persistance. |
…d workflow Co-authored-by: CommanderStorm <26258709+CommanderStorm@users.noreply.github.com>
…ence Co-authored-by: CommanderStorm <26258709+CommanderStorm@users.noreply.github.com>
Co-authored-by: CommanderStorm <26258709+CommanderStorm@users.noreply.github.com>
… CI workflow Co-authored-by: CommanderStorm <26258709+CommanderStorm@users.noreply.github.com>
Co-authored-by: CommanderStorm <26258709+CommanderStorm@users.noreply.github.com>
…r logging Co-authored-by: CommanderStorm <26258709+CommanderStorm@users.noreply.github.com>
Already implemented in commit 75b2584. The system now:
Each call to |
|
@copilot there are tons of hard to review unrelated changes. Remove all uneessesary changes |
…ementation Co-authored-by: CommanderStorm <26258709+CommanderStorm@users.noreply.github.com>
Removed all unnecessary changes in commit 279a1eb: Removed:
Kept (minimal):
The batch processor now accesses internal structure directly since it's in the same module tree, eliminating need for public APIs. |
CommanderStorm
left a comment
There was a problem hiding this comment.
@copilot please make sure to extend the GitHub struct with new functions to do things with GitHub for a clean architecture
…tecture Co-authored-by: CommanderStorm <26258709+CommanderStorm@users.noreply.github.com>
Refactored in commit 2e61cde. Added to GitHub struct (
Batch processor now uses these methods instead of direct octocrab calls, following the clean architecture pattern established in the codebase. |
|
@copilot the description is not updated correctly, only title and lavlbels. Append the necessary lines. |
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
|
error[E0425]: cannot find value error[E0425]: cannot find value |
… variable reference Co-authored-by: CommanderStorm <26258709+CommanderStorm@users.noreply.github.com>
Fixed compilation errors in commit 953e48e: Error 1 -
Error 2 -
Code now compiles successfully. |
|
@copilot fix the clippy lint and make sure that the PR titles are helpfull and have the needed context. Batched PRs are OK to loose context, the first PR is not ideal though |
Co-authored-by: CommanderStorm <26258709+CommanderStorm@users.noreply.github.com>
Fixed in commit f078b09. Clippy lint fixed:
PR titles now have helpful context:
The first PR now provides clear context about what's being edited, while subsequent batch updates use the generic batching title. |
Proposed Change(s)
Coordinate edit submissions now batch automatically into a single open PR instead of creating individual PRs per edit. The first edit creates a PR with the "batch-in-progress" label, and subsequent edits are added to that PR until it's merged or closed.
Implementation:
batch_processormodule (~120 lines with tests): Located atserver/src/routes/feedback/batch_processor/mod.rsfind_open_batch_pr(): Searches for open PR withbatch-in-progresslabel usingGitHub::find_pr_with_label()with full pagination supportupdate_batch_pr_metadata(): Updates PR title, labels, and description based on edit types using GitHub struct methods%pr_numberand%branchformatBATCH_LABELconstant is public for use in other modulespropose_editsendpoint: Modified to create batch PRs with proper labeling or add to existing batch PRextract_subject()(e.g., "chore(data): coordinate edit for mi.03.11.170")server/src/external/github.rs): Added 6 new methods with pagination support for clean architecturefind_pr_with_label(): Find open PR with specific label (iterates through all pages)update_pr_labels(): Update PR labelsupdate_pr_title(): Update PR title (takes&strparameter)get_pr_commit_count(): Get number of commits in PR (counts across all pages)get_pr_description(): Get current PR description/bodyupdate_pr_description(): Update PR description/body (takes&strparameter)Behavior:
PR Description Format:
Each edit's description is appended to the batch PR with separators:
Pagination Support:
find_pr_with_label()iterates through all pages of open PRs (no longer limited to first 100)get_pr_commit_count()counts commits across all pages (supports batches with >100 edits)Clean architecture approach:
BATCH_LABELconstant public for cross-module accessextract_subject()method for first PR title (fixes clippy dead_code lint)Testing:
Bug Fixes:
BATCH_LABELconstant publicextract_subject()for first PR titleNo configuration required. No CI changes.
Checklist
Original prompt
Add Batching System for Coordinate Edit Submissions
Problem
Currently, each coordinate edit submission creates one pull request immediately. Users submit edits one at a time, creating a flood of individual PRs that overwhelm our CI and review processes.
Current behavior (line 180 in
server/src/routes/feedback/proposed_edits/mod.rs):Each request immediately creates a PR.
Proposed Solution
Implement a batching system that queues edit requests and periodically creates PRs with multiple edits combined.
Requirements
1. Database Schema
Create a new table to queue pending edits:
2. Modify
propose_editsEndpointFile:
server/src/routes/feedback/proposed_edits/mod.rsChanges needed:
BATCH_ENABLED(default: true) to enable/disable batchingNew response:
{ "tracking_id": 12345, "status": "queued", "message": "Your edit has been queued and will be processed in the next batch" }3. Create Batch Processor
New file:
server/src/batch_processor/mod.rsImplement:
EditRequestobjects into oneBatching logic:
BATCH_WINDOW_HOURS, default: 6)BATCH_MAX_EDITS, default: 50)Branch naming:
PR title format:
PR description format:
4. Add GitHub Actions Workflow
New file:
.github/workflows/process-edit-batches.yml5. Create Batch Processor Binary
New file:
server/src/bin/batch_processor.rsCommand-line tool that:
6. Update API Documentation
File:
server/src/routes/feedback/proposed_edits/mod.rsUpdate the
#[utoipa::path]documentation to reflect:7. Migration File
New file:
data/migrations/YYYYMMDD_add_edit_batching.sqlInclude the table creation SQL from requirement #1.
8. Configuration
Add to
server/README.mdenvironment variables section:BATCH_ENABLEDbatch_processortrue)BATCH_WINDOW_HOURSbatch_processor6)BATCH_MAX_EDITSbatch_processor50)Testing Requirements
This pull request was created from Copilot chat.
✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.