refactor(rust-guard): eliminate duplicated author_association lookup and raw field-name literals in backend.rs - #9535
Merged
Conversation
…and raw field-name literals in backend.rs - Make `get_author_association` in helpers.rs `pub(crate)` so backend.rs can use it - Import `get_author_association` and `field_names` in backend.rs - Replace two inline author_association extraction blocks with `get_author_association()` - Replace raw `"full_name"` literals with `field_names::FULL_NAME` (2 sites) - Replace raw `"login"` literals with `field_names::LOGIN` (3 sites) Closes #9512
Copilot
AI
changed the title
[WIP] Eliminate duplicated author_association lookup in backend.rs
refactor(rust-guard): eliminate duplicated author_association lookup and raw field-name literals in backend.rs
Jul 17, 2026
lpcox
marked this pull request as ready for review
July 18, 2026 04:32
Contributor
There was a problem hiding this comment.
Pull request overview
Centralizes GitHub response-field extraction in the Rust guard.
Changes:
- Exposes the existing author-association helper within the crate.
- Reuses shared extraction helpers and field-name constants in backend logic.
Show a summary per file
| File | Description |
|---|---|
helpers.rs |
Makes get_author_association crate-visible. |
backend.rs |
Removes duplicate extraction logic and raw field-name literals. |
Review details
Tip
Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
- Files reviewed: 2/2 changed files
- Comments generated: 0
- Review effort level: Medium
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.
backend.rshad two inline copies of theauthor_association/authorAssociationdual-alias extraction pattern, despitehelpers.rsalready owning a helper for exactly this. It also used raw"full_name"and"login"string literals in five production-code sites while thefield_namesconstants module (already imported in the test block of the same file) exists as the single source of truth for those names.Changes
helpers.rsget_author_association:fn→pub(crate) fn(minimal visibility bump to expose within crate)backend.rs— importsbackend.rs— deduplicateauthor_associationextraction (2 sites)backend.rs— replace raw field-name literals with constants (5 sites)"full_name"→field_names::FULL_NAME(base and head repo inget_pull_request_facts_with_callback)"login"→field_names::LOGIN(PR author, issue author, collaborator#[cfg(test)]path)