Conversation
- Remove outer guard in buildDetectionJob: always build Permissions object (RenderToYAML returns empty string when no permissions set), eliminating one level of nesting and making the logic more linear - Inline warnings array in doCompile result building (WASM entry point) - Remove redundant comments in cmd/gh-aw-wasm/main.go that merely re-stated what the adjacent code does Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Closed
Contributor
There was a problem hiding this comment.
Pull request overview
This PR performs small refactors to simplify workflow compilation code paths without changing behavior, focusing on detection job permissions rendering and WASM result construction.
Changes:
- Flattened
buildDetectionJobpermissions construction by always instantiatingPermissionsand relying onRenderToYAML()returning""when empty. - Simplified WASM entrypoint code by removing redundant comments/whitespace and inlining one-time
warningsallocation.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
pkg/workflow/threat_detection.go |
Makes detection job permissions building more linear while preserving empty-output behavior via Permissions.RenderToYAML(). |
cmd/gh-aw-wasm/main.go |
Minor cleanup in WASM compile path; inlines warnings array creation into the result object. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
pelikhan
approved these changes
Mar 31, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Code simplifications to recently modified files from PR #23647 (fix: correct YAML indentation for detection job permissions block).
Files Simplified
pkg/workflow/threat_detection.go— Flattened detection job permissions logiccmd/gh-aw-wasm/main.go— Cleaned up WASM result buildingImprovements Made
1. Reduced Nesting in
buildDetectionJobThe outer
if needsContentsRead || copilotRequestsEnabledguard was unnecessary becauseNewPermissions().RenderToYAML()already returns""when no permissions are set. Removing it makes the code more linear:Before / After
Before:
After:
2. Cleaned Up WASM Entry Point
compileWorkflowthat merely restated the codekeysdeclaration injsObjectToFileMapwarningsvariable directly intoresult.Set(...)since it was only used onceChanges Based On
Recent changes from:
Testing
TestDetectionJobPermissionsIndentationpasses (validates both the fix and the refactoring preserve behavior)make fmt— no formatting changesmake build— builds successfullymake test-unit— all unit tests passReview Focus
Please verify:
buildDetectionJobpermissions logic is equivalent (empty permissions returns""fromRenderToYAML)Automated by Code Simplifier Agent - analyzing code from the last 24 hours
Note
🔒 Integrity filter blocked 1 item
The following item were blocked because they don't meet the GitHub integrity level.
pull_request_read: has lower integrity than agent requires. The agent cannot read data with integrity below "approved".To allow these resources, lower
min-integrityin your GitHub frontmatter: