Skip to content

Add direct repo-scope fallback coverage in Rust guard#7274

Draft
Copilot wants to merge 2 commits into
mainfrom
copilot/rust-guard-add-unit-tests
Draft

Add direct repo-scope fallback coverage in Rust guard#7274
Copilot wants to merge 2 commits into
mainfrom
copilot/rust-guard-add-unit-tests

Conversation

Copilot AI commented Jun 9, 2026

Copy link
Copy Markdown
Contributor

extract_repo_scope_with_query_fallback is security-relevant for issue and PR collection labeling, but only had indirect coverage through larger response-labeling tests. This change adds direct coverage for its arg-vs-query resolution behavior and simplifies duplicated items_path handling in response_paths.rs.

  • Direct coverage for repo-scope fallback

    • Adds focused unit tests for the four resolution paths in extract_repo_scope_with_query_fallback:
      • explicit owner/repo wins over query
      • fallback to query when args are absent
      • fallback to query when args are partial
      • empty result when neither source provides repo scope
  • Idiomatic items_path construction

    • Replaces three repeated if items_path.is_empty() { None } else { Some(items_path) } blocks with then_some(...)
    • Keeps behavior unchanged while removing duplicated branching in the PR, issue, and project-item response path code
  • Example

    items_path: (!items_path.is_empty()).then_some(items_path),

GitHub Advanced Security started work on behalf of lpcox June 9, 2026 15:29 View session
GitHub Advanced Security finished work on behalf of lpcox June 9, 2026 15:30
Copilot AI changed the title [WIP] Add direct unit tests for extract_repo_scope_with_query_fallback Add direct repo-scope fallback coverage in Rust guard Jun 9, 2026
Copilot finished work on behalf of lpcox June 9, 2026 15:33
Copilot AI requested a review from lpcox June 9, 2026 15:33
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: Direct tests for extract_repo_scope_with_query_fallback + idiomatic then_some in response_paths.rs

2 participants