Remote configuration improvements - #416
Conversation
🤖 AI Code Review (Sashiko / Jetski)Here is a review of PR #416 ( 📋 SummaryThe PR introduces map-format deserialization for 🚨 1. Critical Regression Risks1.1 Complete Removal of
|
Add a submitted_at field to Event::RawMboxSubmitted, stamped with the server's current time when a raw mbox is submitted via POST /api/submit (Inject variant). This timestamp is propagated through metadata.received_date and used as the patchset date instead of the email's Date: header. This prevents stale mbox timestamps (which can be arbitrarily far in the past) from skewing queue ordering. The original email date is preserved in the messages table for display purposes. The Thread and Remote submission paths are unaffected as they already use server-side timestamps via create_fetching_patchset(). Signed-off-by: Elkin Cruz <elkin@google.com>
Define PriorityRule and CompiledPriorityRule structs for regex-based patchset priority classification. Add a custom serde deserializer (deserialize_indexed_vec) to handle both TOML array and env-var indexed-map representations. Add the priority_rules field to ReviewSettings with serde(default) so existing configs are unaffected. Signed-off-by: Elkin Cruz <elkin@google.com>
Add a priority INTEGER DEFAULT 500 column to the patchsets table and a composite index idx_patchsets_status_priority_date on (status, priority DESC, date ASC) for efficient priority-ordered queries. The column defaults to 500 so existing patchsets are unaffected. Signed-off-by: Elkin Cruz <elkin@google.com>
Add migration to create the priority column and composite index. Introduce create_patchset_with_priority() which threads an explicit priority through all INSERT/UPDATE paths, with MIN(priority, ?) semantics to preserve manual deprioritization. Refactor create_patchset() to delegate with default None. Change get_pending_patchsets() ordering to priority DESC, date ASC. Add calculate_priority() for evaluating compiled regex rules against subjects (last match wins). Signed-off-by: Elkin Cruz <elkin@google.com>
Compile priority_rules from settings at startup and thread them through the DB worker into process_parsed_article(). Use calculate_priority() to compute priority from the patchset subject before calling create_patchset_with_priority(). API callers pass None for priority to create_fetching_patchset(). Signed-off-by: Elkin Cruz <elkin@google.com>
The config crate deserializes custom_remotes environment variables SASHIKO__GIT__CUSTOM_REMOTES__* as a map with numeric string keys instead of a sequence. This caused a deserialization failure when attempting to parse into a Vec structure. Replace the untagged enum deserialization strategy with a custom Visitor pattern in settings.rs. This Visitor successfully handles both sequential TOML/JSON arrays and indexed map formats, preserving type coercion for nested fields. Signed-off-by: Elkin Cruz <elkin@google.com>
When a custom remote has thousands of branches (e.g. icebreaker with 4,467 branches), fetching all refs downloads millions of objects and saturates the pod for hours. Add a branch_patterns field to CustomRemoteSettings that accepts glob patterns (e.g. "*/6.18", "14*"). When configured: 1. ensure_remote builds refspecs from patterns so git fetch only downloads matching refs instead of all branches 2. check_all_branches filters the branch list through the same patterns before adding baseline candidates Implement a simple glob matcher supporting "*" (any substring) and "?" (any single character) in git_ops, avoiding an external dependency for this small use case. Signed-off-by: Elkin Cruz <elkin@google.com>
82864af to
0906d97
Compare
|
After a couple of rounds of AI reviews and subsequent fixes, I present to you the new code. It has been hardened and tested in production. Thanks for the review |
🤖 AI Code Review (Sashiko / Jetski)Here is a summary of issues that should be addressed before PR #416 is merged: 🚨 Critical Issues & Regressions
Note: This review was automatically generated by AI. |
On top of #415
Commits 7f947df and 82864af.
Two highly correlated changes:
Support map-format deserialization: allow custom_remotes in Settings.toml to be specified as either a TOML array ([[...]]) or as indexed environment variables (CUSTOM_REMOTES__0__URL), matching the pattern used by the config crate.
Add branch_patterns for selective fetching: when a custom remote has thousands of branches, fetching all refs downloads millions of objects and saturates the pod for 30 minutes. branch_patterns accepts glob patterns (e.g., /6.18, 14) so git fetch only downloads matching refs. The same patterns filter baseline branch candidates.