Repository navigation
fix: keep --from-resolve and --to-resolve rules separate - #2282
Merged
TerryHowe merged 1 commit intoOct 24, 2026
Merged
Conversation
BinaryTarget.Parse appended the side-specific rules to the shared --resolve slice. When that slice had spare capacity, both appends wrote into the same backing array, so --from-resolve ended up with the --to-resolve rule. Build each side's rules with slices.Concat instead. Fixes #2277 Signed-off-by: Wleeaf <[email protected]>
wleeaf
requested review from
TerryHowe,
Wwwsylvia,
sabre1041,
sajayantony and
shizhMSFT
as code owners
October 23, 2026 22:33
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #2282 +/- ##
=======================================
Coverage 60.81% 60.81%
=======================================
Files 140 140
Lines 6091 6091
=======================================
Hits 3704 3704
Misses 2166 2166
Partials 221 221 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
4 tasks
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.
What this PR does / why we need it:
BinaryTarget.Parsebuilt the per-side DNS rules by appending--from-resolveand--to-resolveto the same--resolveslice. pflag'sStringArrayoften leaves that slice with spare capacity (for example 3 values give len 3, cap 4), so bothappendcalls wrote into the same backing array and--from-resolveended up with the--to-resolverule.This PR builds each side's rules with
slices.Concat, as proposed in the issue, so each side gets its own slice.The new
TestBinaryTarget_Parse_resolveFlagparses the flags through a real cobra/pflag flag set and runsBinaryTarget.Parse. It covers 3 base rules (spare capacity, which fails without the fix), 4 base rules (no spare capacity), no base rules, and only one side-specific rule.Which issue(s) this PR fixes (optional, in
fixes #<issue number>(, fixes #<issue_number>, ...)format, will close the issue(s) when PR gets merged):Fixes #2277
Please check the following list: