fix(pins): send explicit match=exact on pins_list name filter - #450
Merged
Conversation
pins_list's exact name filter was sent as a bare `name` with no `match` strategy, so pinning-service backends that require an explicit strategy ignored it and returned the full list. status/limit kept working (they are different params) and search kept working (WithFilterNamePartial pins match=partial), which is why only the name filter appeared broken. Send WithFilterMatch(ipfs.MatchExact) alongside the name, mirroring the partial-match search path, and add a guard test asserting match=exact is sent (symmetric with the existing match=partial guard).
Kody Review CompleteGreat news! 🎉 Keep up the excellent work! 🚀 Kody Guide: Usage and ConfigurationInteracting with Kody
Current Kody ConfigurationReview OptionsThe following review options are enabled or disabled:
|
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
Fixes the
pins_listname-filter regression where a non-matching name returned the full unfiltered list.Root cause: the exact-name filter was sent as a bare
namewith nomatchstrategy. Pinning-service backends that require an explicit match strategy ignore it, so the server returns every pin.status/limitkept working (different params) andsearchkept working (WithFilterNamePartialpinsmatch=partial) — isolating the breakage to thenamefilter.Change
In
PinningServiceDefault.listViaSDK(internal/cli/pinning_client.go), the exact-name path now sendsWithFilterMatch(ipfs.MatchExact)alongsideWithFilterName, mirroring how the substring-search path pinsmatch=partial.Tests
TestPinsListSendsExactNameMatch— assertsListPinsreceivesname+match=exact(symmetric with the existingmatch=partialguard).go build ./...clean;TestPins*suite passes.Summary
This pull request fixes the
pins_listcommand's exact-name filter to explicitly send thematch=exactstrategy to the pinning service backend.Changes
Bug Fix
internal/cli/pinning_client.go: When anameFilteris provided (without a partial-match search), the code now appends bothipfs.WithFilterName(nameFilter)ANDipfs.WithFilterMatch(ipfs.MatchExact)to the list options.Why It Matters
Previously, the exact-name filter sent only the name parameter without declaring a match strategy. Some pinning-service backends require an explicit matching strategy and would silently ignore a bare name filter, returning the full list instead of filtering by name. Status and limit filters would still apply, but the name filter became a no-op.
Test Coverage
internal/cli/pinning_service_test.go: AddedTestPinsListSendsExactNameMatch, which verifies that:Listis called with a non-emptynameFilter(and no search), it passes bothWithFilterNameandWithFilterMatch(ipfs.MatchExact)to the SDK.Impact
This fix ensures that users filtering pins by exact name receive correctly filtered results, aligning behavior with the documented API specification where the default matching strategy is
exact.