Skip to content

do not mutate scoped filter - #198

Merged
peterbroadhurst merged 2 commits into
hyperledger-firefly:mainfrom
kaleido-io:do-not-mutate-scoped-filter
Nov 3, 2025
Merged

do not mutate scoped filter#198
peterbroadhurst merged 2 commits into
hyperledger-firefly:mainfrom
kaleido-io:do-not-mutate-scoped-filter

Conversation

@hosie

@hosie hosie commented Nov 3, 2025

Copy link
Copy Markdown
Contributor

idFilter was modifying the scoped filter on a collection with an id filter condition and any attempts read from that collection afterwards, would always be scoped to a single record.

This PR changes that so we now only read from the scoped filter and do not modify it.

Signed-off-by: John Hosie <john.hosie@kaleido.io>
@hosie
hosie requested a review from a team November 3, 2025 18:09
Signed-off-by: John Hosie <john.hosie@kaleido.io>
Comment thread pkg/dbsql/crud_test.go
//Get many still returns all scope1 rows
cs, _, err = scopedCollection.GetMany(ctx, CRUDableQueryFactory.NewFilter(ctx).And())
assert.NoError(t, err)
require.Len(t, cs, 2)

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Without the fix in this PR, this call to GetMany would return only one record

@peterbroadhurst peterbroadhurst left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

@peterbroadhurst
peterbroadhurst merged commit deff72a into hyperledger-firefly:main Nov 3, 2025
5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants