Skip to content

Borrow repository fields in Rust guard dispatch - #16347

Merged
lpcox merged 2 commits into
mainfrom
copilot/rust-guard-borrow-owner-repo
Nov 11, 2026
Merged

lpcox merged 2 commits into
mainfrom
copilot/rust-guard-borrow-owner-repo

Conversation

Copilot AI commented Nov 11, 2026 •

Copy link
Copy Markdown
Contributor

Labeling dispatch allocated owner and repository strings on every tool call, although it only needs borrowed values.

  • Dispatch: Borrow fields with get_str_or, including for project baseline scopes.
  • Documentation: Recommend borrowing for field extraction.
  • Coverage: Check missing and non-string fields retain empty-string fallback behavior.

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
Copilot AI requested a review from lpcox November 11, 2026 18:45
@lpcox
lpcox marked this pull request as ready for review November 11, 2026 18:54
Copilot AI adaptive review requested due to automatic review settings November 11, 2026 18:55

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟢 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_or lookups.
  • 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)

@lpcox
lpcox merged commit 5e66e9f into main Nov 11, 2026
49 checks passed
@lpcox
lpcox deleted the copilot/rust-guard-borrow-owner-repo branch November 11, 2026 19:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[rust-guard] Rust Guard: borrow owner/repo instead of allocating Strings in tool_rules

3 participants