fix: expandConfigStrings recurse into nested []any slices#201
Merged
Conversation
Co-authored-by: intel352 <77607+intel352@users.noreply.github.com>
Copilot
AI
changed the title
[WIP] Fix recursion for nested []any in expandConfigStrings
fix: expandConfigStrings recurse into nested []any slices
Feb 27, 2026
Contributor
There was a problem hiding this comment.
Pull request overview
This PR fixes a bug where expandConfigStrings did not recurse into nested []any slices, leaving ${VAR} placeholders unexpanded in array-of-array configurations like Casbin's roleAssignments.
Changes:
- Refactored slice expansion logic into a dedicated
expandConfigSlicehelper function that handles string, map, and nested array expansion via mutual recursion - Added comprehensive test coverage for the array-of-arrays expansion pattern
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
| engine.go | Extracted slice processing into expandConfigSlice helper with mutual recursion to support arbitrary nesting depth |
| engine_secrets_test.go | Added TestExpandConfigStrings_NestedArrayOfArrays to verify expansion in nested array structures |
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.
expandConfigStringsdid not recurse into[]anyitems that are themselves[]any, leaving${VAR}placeholders unexpanded in array-of-array configs like CasbinroleAssignments.Changes
engine.go: Extract[]anyprocessing into a dedicatedexpandConfigSlicehelper that handlesstring,map[string]any, and[]anyitems — enabling expansion at arbitrary nesting depth via mutual recursion withexpandConfigStrings.engine_secrets_test.go: AddTestExpandConfigStrings_NestedArrayOfArrayscovering the[]any{[]any{"${VAR}", "literal"}}pattern.✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.