Repository navigation
Borrow repository fields in Rust guard dispatch - #16347
Merged
Merged
Conversation
Co-authored-by: lpcox <[email protected]>
Copilot
AI
changed the title
[WIP] Refactor tool_rules to borrow owner and repo reducing allocations
Borrow repository fields in Rust guard dispatch
Nov 11, 2026
lpcox
marked this pull request as ready for review
November 11, 2026 18:54
Contributor
There was a problem hiding this comment.
🟢 Approval recommended
No active review issues are reported, and the changes include regression coverage for fallback behavior alongside the allocation-reducing borrowed lookups.
No open issues 🎉
What changed in this PR
This PR reduces per-call allocations in Rust guard tool-label dispatch by borrowing owner and repo fields while preserving empty-string fallback behavior for missing or non-string values. It also updates the labeling documentation and adds regression coverage.
Changes:
- Replaced allocating field extraction with borrowed
get_str_orlookups. - Updated project baseline scopes to use borrowed values.
- Added fallback-behavior tests and refreshed field-extraction guidance.
| File | Description |
|---|---|
| guards/github-guard/rust-guard/src/labels/tool_rules.rs | Borrows repository fields during dispatch and adds tests covering missing, null, and non-string fallback values. |
| guards/github-guard/rust-guard/src/labels/README.md | Documents get_str_or as the preferred helper for borrowed field extraction. |
Review effort: Lite (auto)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Labeling dispatch allocated owner and repository strings on every tool call, although it only needs borrowed values.
get_str_or, including for project baseline scopes.