Skip to content

[Repo Assist] test(rust-guard): add list_commits tests for default-branch vs feature-branch integrity#6095

Merged
lpcox merged 1 commit into
mainfrom
repo-assist/test-task9-list-commits-response-paths-2026-05-20-d115ea4bc446fc6e
May 20, 2026
Merged

[Repo Assist] test(rust-guard): add list_commits tests for default-branch vs feature-branch integrity#6095
lpcox merged 1 commit into
mainfrom
repo-assist/test-task9-list-commits-response-paths-2026-05-20-d115ea4bc446fc6e

Conversation

@github-actions
Copy link
Copy Markdown
Contributor

🤖 This PR was created by Repo Assist, an automated AI assistant.

Summary

Adds two unit tests to response_paths.rs for the list_commits handler — the only response-path handler that had zero test coverage (identified in issue #6086, Improvement 2).

Why This Matters

The sha field in list_commits tool args drives is_default_branch_ref() → merged-level integrity promotion. This is a security-relevant decision: a regression that treats all commits as default-branch would silently over-elevate integrity labels, allowing feature-branch commits to be treated as if they had merged status.

Tests Added

Test Scenario Assertion
list_commits_default_branch_gets_merged_integrity sha = "main" default_labels.integrity contains merged:octocat/hello-world; items_path is None (root array)
list_commits_feature_branch_public_repo_has_no_merged_integrity sha = "feature/my-branch" default_labels.integrity has no merged: prefix; items_path is None

Both tests are self-contained and require no backend mocking (the is_repo_private backend returns Nonefalse in #[cfg(test)]).

Test Status

running 413 tests
test result: ok. 413 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out

(411 pre-existing + 2 new)

Closes #6086 (Improvement 2)

Generated by Repo Assist · ● 5.7M ·

To install this agentic workflow, run

gh aw add githubnext/agentics/workflows/repo-assist.md@851905c06e905bf362a9f6cc54f912e3df747d55

…e-branch integrity

Add two unit tests to response_paths.rs covering the list_commits labeling
branch — the only response-path handler that was untested.

The sha field drives is_default_branch_ref() → merged-level integrity
promotion, which is a security-relevant decision: treating all commits as
default-branch would over-elevate integrity labels.

Tests added:
- list_commits_default_branch_gets_merged_integrity: sha=main → default_labels
  integrity contains merged:octocat/hello-world; items_path is None (root array)
- list_commits_feature_branch_public_repo_has_no_merged_integrity: sha=feature/my-branch
  → default_labels integrity has no merged: prefix; items_path is None

All 413 Rust guard unit tests pass (411 pre-existing + 2 new).

Closes #6086 (Improvement 2)

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@lpcox lpcox marked this pull request as ready for review May 20, 2026 13:55
Copilot AI review requested due to automatic review settings May 20, 2026 13:55
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Adds unit test coverage for the Rust guard’s path-based labeling of the list_commits tool response, specifically validating integrity behavior for default-branch vs feature-branch SHAs (a security-relevant distinction).

Changes:

  • Added a test ensuring sha = "main" results in merged-level integrity on default_labels.
  • Added a test ensuring a feature-branch sha in a public repo does not receive merged-level integrity.
  • Both tests assert items_path is None for the root-array list_commits response shape.
Show a summary per file
File Description
guards/github-guard/rust-guard/src/labels/response_paths.rs Adds list_commits unit tests covering default-branch vs feature-branch integrity labeling and root-array items_path behavior.

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

@lpcox lpcox merged commit 9169878 into main May 20, 2026
23 checks passed
@lpcox lpcox deleted the repo-assist/test-task9-list-commits-response-paths-2026-05-20-d115ea4bc446fc6e branch May 20, 2026 14:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[rust-guard] Rust Guard: extract_items_array should return Option<&'static str> for items path, not "" sentinel

2 participants