test(constants): table-driven assertions and extend octal-literal check to cmd/#44114
Conversation
…tions, cmd/ coverage Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
There was a problem hiding this comment.
Pull request overview
This PR improves the consistency and coverage of permission-policy tests in pkg/constants by refactoring constant assertions into a table-driven style and extending the existing AST-based “no raw octal permission literals” check to also scan cmd/.
Changes:
- Refactors
TestPermissionConstantsValuesinto a table-driven test usingtestify/assertfor consistent assertions. - Expands
TestNoRawOctalPermissionLiteralsInOSCallsto walk bothpkg/andcmd/when checking for raw octal permission literals in relevantos.*calls. - Introduces
testify/requirefor theruntime.Callerguard (matching patterns used in other tests in the repo).
Show a summary per file
| File | Description |
|---|---|
pkg/constants/permissions_policy_test.go |
Refactors permission constant assertions and expands the repo-wide raw-octal permission literal guard to include cmd/. |
Review details
Tip
Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
- Files reviewed: 1/1 changed files
- Comments generated: 0
- Review effort level: Low
|
@copilot please run the
|
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
|
Hey This looks ready for review. ✅
|
HEAD remains Local merge-readiness validation passed: The last known PR checks for the code/test workflows were green on this head; the remaining status is stale/agent-side only. I can’t re-run CI from the cloud agent in a way that verifies this HEAD, so a maintainer still needs to re-trigger checks before merge. |
|
@copilot please run the
|
HEAD is still I re-checked the review surface: there are no unresolved review threads or in-scope review comments to address. The remaining recent bot comments are approval/praise-only, not change requests. I also re-ran local merge-readiness validation on this HEAD: The last known code/test checks on this HEAD are green. The remaining GitHub status is agent-side/pending automation, and I can’t re-trigger CI from the cloud agent in a way that verifies this HEAD, so a maintainer still needs to re-run checks before merge. |
|
@copilot please run the
|
No code changes were needed here; HEAD is still I re-checked the review surface and there are no unresolved in-scope review threads or review comments to address. I also re-ran local merge-readiness validation on this HEAD: The last code/test workflow runs for |
|
\n@copilot please run the skill, make this PR merge-ready, address all unresolved review feedback, and rerun checks once the branch is up to date.
|
🤖 PR Triage
Rationale: CI passing. Test-only change (76+/68−) — converts raw Run §28909358158
|
|
@copilot please run the
|
|
🎉 This pull request is included in a new release. Release: |
permissions_policy_test.goused rawif/t.Fatalfguards inconsistent with sibling tests, and the raw-octal AST walker only coveredpkg/, leavingcmd/unprotected.Changes
TestPermissionConstantsValues— replaces fiveif/t.Fatalfblocks with a[]struct{name, got, want fs.FileMode}table +assert.Equal; the typed struct field also gives compile-time verification that constants arefs.FileMode(not untyped int)cmd/—TestNoRawOctalPermissionLiteralsInOSCallsnow iterates over{pkg/, cmd/}roots so raw permission literals incmd/are caughtassert/requireto align withspec_test.go; replaces theruntime.Callerguard withrequire.Truepr-sous-chef run: https://github.com/github/gh-aw/actions/runs/28907709886