test: tighten single-role GH_AW_REQUIRED_ROLES assertion (fixes #26799)#26804
test: tighten single-role GH_AW_REQUIRED_ROLES assertion (fixes #26799)#26804
Conversation
Agent-Logs-Url: https://github.com/github/gh-aw/sessions/d897b0b8-59e8-415e-865b-e0bdeaf80f69 Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
There was a problem hiding this comment.
Pull request overview
Updates a workflow compiler test to avoid false-positive matching when validating single-string on.roles configuration, per issue #26799.
Changes:
- Tighten the single-role assertion to match the exact compiled YAML fragment
GH_AW_REQUIRED_ROLES: "write". - Add a negative assertion to ensure the compiler does not fall back to the default role list when a single-string role is provided.
Show a summary per file
| File | Description |
|---|---|
| pkg/workflow/role_checks_test.go | Makes single-role test assertions more specific and adds a guard against default-role fallback. |
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
🧪 Test Quality Sentinel ReportTest Quality Score: 100/100✅ Excellent test quality
Test Classification Details
AnalysisThis PR fixes a weak assertion in
Both new assertions carry descriptive messages ✅. The test compiles a real workflow and inspects the output (no mocks) ✅. The What design invariant does this test enforce? A behavioral contract: when What would break if deleted? A regression where a single-role string is silently coerced into the default role list would go undetected, allowing unauthorized actors to trigger role-gated workflows. Language SupportTests analyzed:
Verdict
📖 Understanding Test ClassificationsDesign Tests (High Value) verify what the system does:
Implementation Tests (Low Value) verify how the system does it:
Goal: Shift toward tests that describe the system's behavioral contract — the promises it makes to its users and collaborators. References: §24548231227
|
There was a problem hiding this comment.
✅ Test Quality Sentinel: 100/100. Test quality is excellent — 0% of modified tests are implementation tests (threshold: 30%). The PR tightens a vague substring assertion into a precise GH_AW_REQUIRED_ROLES: "write" check and adds a NotContains regression guard, directly encoding the single-role behavioral contract.
Summary
GH_AW_REQUIRED_ROLES: "write"Validation
go test -v -run 'TestRoleMembershipSupportsSingleRoleString|TestRoleMembershipUsesGitHubToken|TestRoleMembershipTokenWithBots' ./pkg/workflow/make agent-finishwas run and fails due a pre-existing timeout inpkg/clitests (panic: test timed out after 10m0s), reproducible before and after this test-only change