Repository navigation
Conversation
CopyPolicyToWorkspace returned the workspace-relative policy path via filepath.Join, which yields "policies\<dir>" on Windows. The path is written into the build file that the Linux gateway-builder container reads, so every local (filePath) policy failed discovery on Windows hosts: policy path does not exist: /workspace/policies\<dir> Use path.Join so the build-file path is slash-separated on every host OS, and add a test pinning the returned path.
|
No actionable comments were generated in the recent review.
|
| Layer / File(s) | Summary |
|---|---|
Construct and verify the workspace path cli/src/utils/policy_utils.go, cli/src/utils/policy_utils_test.go |
CopyPolicyToWorkspace uses path.Join to construct the workspace-relative path. The new test expects policies/my-policy. |
Priority:
Estimated code review effort: 2 (Simple) | ~8 minutes
Change: Bug fix · Severity of issue fixed: Medium
Suggested reviewers: renuka-fernando, krishanx92
Merge Risk: 
Minimal · up to 96d82
-
No actionable merge-blocking risk remains for the local policy path change.
Pre-merge checks: 
4 · 
1
-
Failed checks: 1 warning Passed checks: 4 passed-
Full details: Description check
-
Explanation
The description covers the required sections, explains the Windows failure and fix, references issue
#3912, documents unit and integration testing, records security checks, and specifies the test environment.
Full details: Linked Issues check
-
Explanation
Issue
#3912requires local policy paths in the generated build file to use forward slashes on Windows.CopyPolicyToWorkspacenow usespath.Joinfor the container-facing path and retainsfilepathfor host-side paths.TestCopyPolicyToWorkspaceReturnsSlashSeparatedBuildPathverifiespolicies/my-policy.
-
-
Finishing Touches
-
🧪 Generate unit tests (beta)
-
- Create a new PR
-
- Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts
Comment @coderabbitai help to get the list of available commands.
|
|
Purpose
ap gateway image buildfails on Windows for any build file containing a local (filePath:) policy.CopyPolicyToWorkspacereturns the workspace-relative path withfilepath.Join, which ispolicies\<dir>on Windows, and that path is written into the build file read by the Linuxgateway-buildercontainer, so discovery fails withpolicy path does not exist: /workspace/policies\<dir>.Resolves #3912
Goals
Local policies build on Windows hosts the same way they do on Linux and macOS.
Approach
path.Joininstead offilepath.Joinfor the path returned to the build file, since it is consumed inside a Linux container and must be slash-separated on every host OS. The host-side copy (workspacePolicyDir) still usesfilepath.TestCopyPolicyToWorkspaceReturnsSlashSeparatedBuildPath.User stories
As a policy developer on Windows, I can build a custom gateway image with my local policy using
ap gateway image build.Documentation
N/A — bug fix, no behaviour change on Linux/macOS.
Automation tests
TestCopyPolicyToWorkspaceReturnsSlashSeparatedBuildPath."policies\\my-policy", want "policies/my-policy") and passes with it.filepath.Joinalready uses/there), so it guards only when run on a Windows runner.go vet ./utilsandgo test ./utilspass (Linux, Go 1.26).Security checks
Samples
N/A
Related PRs
None.
Test environment
Windows 11 Pro 10.0.26100, Docker Desktop 4.87.0, Go 1.26, gateway-builder 1.2.1.
Unrelated observation while testing on Windows:
TestSetupTempGatewayWorkspaceCreatesSharedTempDirectoriesfails there because it setsHOME, whileos.UserHomeDir()readsUSERPROFILEon Windows. Happy to send a separate PR if useful.