Commit 9169878
authored
[Repo Assist] test(rust-guard): add list_commits tests for default-branch vs feature-branch integrity (#6095)
🤖 *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 `None` → `false` 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](https://github.com/github/gh-aw-mcpg/actions/runs/26165758577/agentic_workflow)
· ● 5.7M ·
[◷](https://github.com/search?q=repo%3Agithub%2Fgh-aw-mcpg+%22gh-aw-workflow-id%3A+repo-assist%22&type=pullrequests)
>
> To install this [agentic
workflow](https://github.com/githubnext/agentics/blob/851905c06e905bf362a9f6cc54f912e3df747d55/workflows/repo-assist.md),
run
> ```
> gh aw add
githubnext/agentics@851905c
> ```
<!-- gh-aw-agentic-workflow: Repo Assist, engine: copilot, version:
1.0.40, model: claude-sonnet-4.6, id: 26165758577, workflow_id:
repo-assist, run:
https://github.com/github/gh-aw-mcpg/actions/runs/26165758577 -->
<!-- gh-aw-workflow-id: repo-assist -->1 file changed
Lines changed: 88 additions & 0 deletions
Lines changed: 88 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
751 | 751 | | |
752 | 752 | | |
753 | 753 | | |
| 754 | + | |
| 755 | + | |
| 756 | + | |
| 757 | + | |
| 758 | + | |
| 759 | + | |
| 760 | + | |
| 761 | + | |
| 762 | + | |
| 763 | + | |
| 764 | + | |
| 765 | + | |
| 766 | + | |
| 767 | + | |
| 768 | + | |
| 769 | + | |
| 770 | + | |
| 771 | + | |
| 772 | + | |
| 773 | + | |
| 774 | + | |
| 775 | + | |
| 776 | + | |
| 777 | + | |
| 778 | + | |
| 779 | + | |
| 780 | + | |
| 781 | + | |
| 782 | + | |
| 783 | + | |
| 784 | + | |
| 785 | + | |
| 786 | + | |
| 787 | + | |
| 788 | + | |
| 789 | + | |
| 790 | + | |
| 791 | + | |
| 792 | + | |
| 793 | + | |
| 794 | + | |
| 795 | + | |
| 796 | + | |
| 797 | + | |
| 798 | + | |
| 799 | + | |
| 800 | + | |
| 801 | + | |
| 802 | + | |
| 803 | + | |
| 804 | + | |
| 805 | + | |
| 806 | + | |
| 807 | + | |
| 808 | + | |
| 809 | + | |
| 810 | + | |
| 811 | + | |
| 812 | + | |
| 813 | + | |
| 814 | + | |
| 815 | + | |
| 816 | + | |
| 817 | + | |
| 818 | + | |
| 819 | + | |
| 820 | + | |
| 821 | + | |
| 822 | + | |
| 823 | + | |
| 824 | + | |
| 825 | + | |
| 826 | + | |
| 827 | + | |
| 828 | + | |
| 829 | + | |
| 830 | + | |
| 831 | + | |
| 832 | + | |
| 833 | + | |
| 834 | + | |
| 835 | + | |
| 836 | + | |
| 837 | + | |
| 838 | + | |
| 839 | + | |
| 840 | + | |
| 841 | + | |
754 | 842 | | |
0 commit comments