Skip to content

Avoid discarded repository identifier allocations in Rust guard labeling - #16457

Merged
lpcox merged 2 commits into
mainfrom
copilot/rust-guard-avoid-discarded-allocations
Nov 13, 2026
Merged

lpcox merged 2 commits into
mainfrom
copilot/rust-guard-avoid-discarded-allocations

Conversation

Copilot AI commented Nov 13, 2026 •

Copy link
Copy Markdown
Contributor

Twelve response-labeling call sites allocate owner/repo strings only to discard them. This refactor borrows those fields while preserving repository IDs and visibility-derived secrecy labels.

  • Shared helper: Add repo_full_with_secrecy, migrate all 12 callers, and reuse it in the test-only four-value helper.
    let (repo_full, secrecy) = repo_full_with_secrecy(tool_args, ctx);
  • Related allocations: Borrow fields directly in project-item labeling and pull-request content integrity checks.
  • Regression coverage: Add equivalence assertions for public, private, unknown, missing, and malformed repository inputs.

Copilot AI changed the title [WIP] Add repo_full_with_secrecy helper to reduce discarded String allocations Avoid discarded repository identifier allocations in Rust guard labeling Nov 13, 2026
Copilot AI requested a review from lpcox November 13, 2026 14:56
@lpcox
lpcox marked this pull request as ready for review November 13, 2026 15:39
Copilot AI adaptive review requested due to automatic review settings November 13, 2026 15:39

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 for the allocation-reducing changes to Rust guard response labeling.

No open issues 🎉

What changed in this PR

Reduces temporary string allocations in Rust guard response labeling while preserving repository identifiers and visibility-derived secrecy labels.

Changes:

  • Adds repo_full_with_secrecy and migrates all 12 callers that discarded owner and repository strings.
  • Borrows fields directly in project-item labeling and pull-request integrity checks.
  • Adds equivalence tests covering visibility states and missing or malformed repository arguments.
File Description
guards/​github-guard/​rust-guard/​src/​labels/​response_paths.rs Uses the new helper and borrows the project owner.
guards/​github-guard/​rust-guard/​src/​labels/​response_items.rs Migrates item labelers to the allocation-saving helper.
guards/​github-guard/​rust-guard/​src/​labels/​helpers.rs Adds the helper, removes integrity-check allocations, and adds regression tests.

Review effort: Max (dynamic)

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: Avoid discarded owner/repo allocations in repo_info_with_secrecy callers

3 participants