Rust guard: remove list_commits secrecy clone and add project-item path labeling regressions#6941
Merged
Merged
Conversation
Copilot
AI
changed the title
[WIP] Improve performance by eliminating redundant Vec clone in list_commits
Rust guard: remove Jun 3, 2026
list_commits secrecy clone and add project-item path labeling regressions
This was referenced Jun 3, 2026
Contributor
There was a problem hiding this comment.
Pull request overview
This PR improves the Rust guard’s response path labeling in response_paths.rs by removing a remaining per-call deep clone in list_commits secrecy labels and by adding targeted regression tests for security-sensitive project-item path labeling edge cases.
Changes:
- Convert
list_commitsdefault secrecy labels toSharedLabelsimmediately and reuse via cheapArcclones (eliminating the lastVec<String>deep clone in that path). - Add regression tests for
list_project_items/projects_listto ensure fail-secure behavior when repo context is missing, correct handling ofDRAFT_ISSUE, and alias behavioral equivalence. - Add an explicit test assertion that
{ "items": [...] }responses forwarditems_path == Some("/items")and produce/items/{n}entry paths.
Show a summary per file
| File | Description |
|---|---|
| guards/github-guard/rust-guard/src/labels/response_paths.rs | Removes an unnecessary secrecy-label deep clone for list_commits and adds regression tests covering project-item labeling and items_path propagation. |
Copilot's findings
Tip
Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
- Files reviewed: 1/1 changed files
- Comments generated: 0
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.
This tightens two remaining weak spots in
response_paths.rs:list_commitsstill deep-cloned secrecy labels on every call, and thelist_project_items/projects_listpath-labeling branch lacked direct regression coverage for its security-relevant edge cases.list_commits: eliminate the lastVec<String>deep cloneSharedLabelsimmediately.Arcclones for per-item labels.default_labelson its final use.Project-item response-path regressions
ISSUEitem has no repo context.DRAFT_ISSUEstays owner-writer integrity with empty secrecy.projects_listremains behaviorally identical tolist_project_items.items_pathcontract{ "items": [...] }responses propagateitems_path == Some("/items")and produce/items/{n}entry paths.These changes keep the response-labeling behavior unchanged where already correct, while removing unnecessary allocation/copying in commit labeling and documenting the intended contract around heterogeneous project items.