Skip to content

Commit 161d490

Browse files
committed
Merge remote-tracking branch 'upstream/develop' into test/migrate-patch-collection-test-action
2 parents 3675b93 + a7fc706 commit 161d490

579 files changed

Lines changed: 6089 additions & 4806 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

cli/utils.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -184,10 +184,10 @@ func setContextRootDir(cmd *cobra.Command) error {
184184
func openKeyring(cmd *cobra.Command) (keyring.Keyring, error) {
185185
cfg := mustGetContextConfig(cmd)
186186
backend := cfg.Get("keyring.backend")
187-
if backend == "system" {
187+
if backend == keyring.KeyringBackendSystem {
188188
return keyring.OpenSystemKeyring(cfg.GetString("keyring.namespace")), nil
189189
}
190-
if backend != "file" {
190+
if backend != keyring.KeyringBackendFile {
191191
log.Info("keyring defaulted to file backend")
192192
}
193193
path := cfg.GetString("keyring.path")

cli/wizard/callbacks.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,9 +35,9 @@ func callback_SetKeyringBackend(s step, ctx *WizardContext) error {
3535
return NewErrModelTypeMismatch(s.ID(), "*modelMultipleChoice")
3636
}
3737

38-
choice := "file"
38+
choice := keyring.KeyringBackendFile
3939
if mm.cursor == 1 {
40-
choice = "system"
40+
choice = keyring.KeyringBackendSystem
4141
}
4242

4343
return setConfigValue(ctx, "keyring.backend", choice)

cli/wizard/unit_test.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ func Test_SetKeyringBackend(t *testing.T) {
7171
if !ok {
7272
t.Fatal("failed to type assert keyring.backend value")
7373
}
74-
if checkedValue != "file" {
74+
if checkedValue != keyring.KeyringBackendFile {
7575
t.Fatal("keyring.backend is not set to file")
7676
}
7777

@@ -84,7 +84,7 @@ func Test_SetKeyringBackend(t *testing.T) {
8484
if !ok {
8585
t.Fatal("failed to type assert keyring.backend value")
8686
}
87-
if checkedValue != "system" {
87+
if checkedValue != keyring.KeyringBackendSystem {
8888
t.Fatal("keyring.backend is not set to system")
8989
}
9090
}
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
# Secondary Index geq and leq on null
2+
3+
Fix handling of `_geq` and `_leq` filters on null values with secondary indexes. Tests have been updated to include additional documents to improve coverage of edge cases with null values in JSON fields.

go.mod

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -6,15 +6,15 @@ require (
66
github.com/bits-and-blooms/bitset v1.22.0
77
github.com/bxcodec/faker v2.0.1+incompatible
88
github.com/charmbracelet/bubbles v0.21.0
9-
github.com/charmbracelet/bubbletea v1.3.4
9+
github.com/charmbracelet/bubbletea v1.3.10
1010
github.com/charmbracelet/lipgloss v1.1.0
1111
github.com/cosmos/cosmos-sdk v0.50.14
1212
github.com/cosmos/gogoproto v1.7.2
1313
github.com/decred/dcrd/dcrec/secp256k1/v4 v4.4.0
1414
github.com/dgraph-io/badger/v4 v4.8.0
1515
github.com/evanphx/json-patch/v5 v5.9.11
1616
github.com/fxamacker/cbor/v2 v2.9.0
17-
github.com/getkin/kin-openapi v0.132.0
17+
github.com/getkin/kin-openapi v0.133.0
1818
github.com/go-chi/chi/v5 v5.2.4
1919
github.com/go-chi/cors v1.2.1
2020
github.com/go-errors/errors v1.5.1
@@ -56,15 +56,15 @@ require (
5656
github.com/sourcenetwork/lens/host-go v0.9.4
5757
github.com/sourcenetwork/sourcehub v0.3.3-0.20251204195821-6e21a42984ba
5858
github.com/sourcenetwork/testo v0.2.0
59-
github.com/spf13/cobra v1.10.1
59+
github.com/spf13/cobra v1.10.2
6060
github.com/spf13/pflag v1.0.10
6161
github.com/spf13/viper v1.20.1
6262
github.com/stretchr/testify v1.11.1
6363
github.com/valyala/fastjson v1.6.4
6464
github.com/vito/go-sse v1.1.3
6565
github.com/wundergraph/graphql-go-tools/v2 v2.0.0-rc.240
6666
github.com/zalando/go-keyring v0.2.6
67-
go.opentelemetry.io/contrib/instrumentation/runtime v0.63.0
67+
go.opentelemetry.io/contrib/instrumentation/runtime v0.64.0
6868
go.opentelemetry.io/otel v1.39.0
6969
go.opentelemetry.io/otel/exporters/otlp/otlpmetric/otlpmetrichttp v1.37.0
7070
go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracehttp v1.38.0
@@ -133,7 +133,7 @@ require (
133133
github.com/cenkalti/backoff/v5 v5.0.3 // indirect
134134
github.com/cespare/xxhash/v2 v2.3.0 // indirect
135135
github.com/charmbracelet/colorprofile v0.2.3-0.20250311203215-f60798e515dc // indirect
136-
github.com/charmbracelet/x/ansi v0.8.0 // indirect
136+
github.com/charmbracelet/x/ansi v0.10.1 // indirect
137137
github.com/charmbracelet/x/cellbuf v0.0.13-0.20250311204145-2c3ea96c31dd // indirect
138138
github.com/charmbracelet/x/term v0.2.1 // indirect
139139
github.com/chzyer/readline v1.5.1 // indirect
@@ -148,7 +148,7 @@ require (
148148
github.com/cockroachdb/pebble v1.1.5 // indirect
149149
github.com/cockroachdb/redact v1.1.6 // indirect
150150
github.com/cockroachdb/tokenbucket v0.0.0-20250429170803-42689b6311bb // indirect
151-
github.com/cometbft/cometbft v0.38.19 // indirect
151+
github.com/cometbft/cometbft v0.38.21 // indirect
152152
github.com/cometbft/cometbft-db v0.14.1 // indirect
153153
github.com/cosmos/btcutil v1.0.5 // indirect
154154
github.com/cosmos/cosmos-db v1.1.3 // indirect
@@ -385,6 +385,7 @@ require (
385385
github.com/wasmerio/wasmer-go v1.0.4 // indirect
386386
github.com/whyrusleeping/go-keyspace v0.0.0-20160322163242-5b898ac5add1 // indirect
387387
github.com/wlynxg/anet v0.0.5 // indirect
388+
github.com/woodsbury/decimal128 v1.3.0 // indirect
388389
github.com/x448/float16 v0.8.4 // indirect
389390
github.com/xo/terminfo v0.0.0-20220910002029-abceb7e1c41e // indirect
390391
github.com/zondax/hid v0.9.2 // indirect
@@ -404,6 +405,7 @@ require (
404405
go.uber.org/multierr v1.11.0 // indirect
405406
go.uber.org/zap v1.27.0 // indirect
406407
go.yaml.in/yaml/v2 v2.4.3 // indirect
408+
go.yaml.in/yaml/v3 v3.0.4 // indirect
407409
golang.org/x/arch v0.21.0 // indirect
408410
golang.org/x/mod v0.29.0 // indirect
409411
golang.org/x/net v0.47.0 // indirect

go.sum

Lines changed: 14 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -860,14 +860,14 @@ github.com/cespare/xxhash/v2 v2.3.0/go.mod h1:VGX0DQ3Q6kWi7AoAeZDth3/j3BFtOZR5XL
860860
github.com/charithe/durationcheck v0.0.9/go.mod h1:SSbRIBVfMjCi/kEB6K65XEA83D6prSM8ap1UCpNKtgg=
861861
github.com/charmbracelet/bubbles v0.21.0 h1:9TdC97SdRVg/1aaXNVWfFH3nnLAwOXr8Fn6u6mfQdFs=
862862
github.com/charmbracelet/bubbles v0.21.0/go.mod h1:HF+v6QUR4HkEpz62dx7ym2xc71/KBHg+zKwJtMw+qtg=
863-
github.com/charmbracelet/bubbletea v1.3.4 h1:kCg7B+jSCFPLYRA52SDZjr51kG/fMUEoPoZrkaDHyoI=
864-
github.com/charmbracelet/bubbletea v1.3.4/go.mod h1:dtcUCyCGEX3g9tosuYiut3MXgY/Jsv9nKVdibKKRRXo=
863+
github.com/charmbracelet/bubbletea v1.3.10 h1:otUDHWMMzQSB0Pkc87rm691KZ3SWa4KUlvF9nRvCICw=
864+
github.com/charmbracelet/bubbletea v1.3.10/go.mod h1:ORQfo0fk8U+po9VaNvnV95UPWA1BitP1E0N6xJPlHr4=
865865
github.com/charmbracelet/colorprofile v0.2.3-0.20250311203215-f60798e515dc h1:4pZI35227imm7yK2bGPcfpFEmuY1gc2YSTShr4iJBfs=
866866
github.com/charmbracelet/colorprofile v0.2.3-0.20250311203215-f60798e515dc/go.mod h1:X4/0JoqgTIPSFcRA/P6INZzIuyqdFY5rm8tb41s9okk=
867867
github.com/charmbracelet/lipgloss v1.1.0 h1:vYXsiLHVkK7fp74RkV7b2kq9+zDLoEU4MZoFqR/noCY=
868868
github.com/charmbracelet/lipgloss v1.1.0/go.mod h1:/6Q8FR2o+kj8rz4Dq0zQc3vYf7X+B0binUUBwA0aL30=
869-
github.com/charmbracelet/x/ansi v0.8.0 h1:9GTq3xq9caJW8ZrBTe0LIe2fvfLR/bYXKTx2llXn7xE=
870-
github.com/charmbracelet/x/ansi v0.8.0/go.mod h1:wdYl/ONOLHLIVmQaxbIYEC/cRKOQyjTkowiI4blgS9Q=
869+
github.com/charmbracelet/x/ansi v0.10.1 h1:rL3Koar5XvX0pHGfovN03f5cxLbCF2YvLeyz7D2jVDQ=
870+
github.com/charmbracelet/x/ansi v0.10.1/go.mod h1:3RQDQ6lDnROptfpWuUVIUG64bD2g2BgntdxH0Ya5TeE=
871871
github.com/charmbracelet/x/cellbuf v0.0.13-0.20250311204145-2c3ea96c31dd h1:vy0GVL4jeHEwG5YOXDmi86oYw2yuYUGqz6a8sLwg0X8=
872872
github.com/charmbracelet/x/cellbuf v0.0.13-0.20250311204145-2c3ea96c31dd/go.mod h1:xe0nKWGd3eJgtqZRaN9RjMtK7xUYchjzPr7q6kcvCCs=
873873
github.com/charmbracelet/x/term v0.2.1 h1:AQeHeLZ1OqSXhrAWpYUtZyX1T3zVxfpZuEQMIQaGIAQ=
@@ -930,8 +930,8 @@ github.com/cockroachdb/redact v1.1.6/go.mod h1:BVNblN9mBWFyMyqK1k3AAiSxhvhfK2oOZ
930930
github.com/cockroachdb/tokenbucket v0.0.0-20250429170803-42689b6311bb h1:3bCgBvB8PbJVMX1ouCcSIxvsqKPYM7gs72o0zC76n9g=
931931
github.com/cockroachdb/tokenbucket v0.0.0-20250429170803-42689b6311bb/go.mod h1:7nc4anLGjupUW/PeY5qiNYsdNXj7zopG+eqsS7To5IQ=
932932
github.com/codahale/hdrhistogram v0.0.0-20161010025455-3a0bb77429bd/go.mod h1:sE/e/2PUdi/liOCUjSTXgM1o87ZssimdTWN964YiIeI=
933-
github.com/cometbft/cometbft v0.38.19 h1:vNdtCkvhuwUlrcLPAyigV7lQpmmo+tAq8CsB8gZjEYw=
934-
github.com/cometbft/cometbft v0.38.19/go.mod h1:UCu8dlHqvkAsmAFmWDRWNZJPlu6ya2fTWZlDrWsivwo=
933+
github.com/cometbft/cometbft v0.38.21 h1:qcIJSH9LiwU5s6ZgKR5eRbsLNucbubfraDs5bzgjtOI=
934+
github.com/cometbft/cometbft v0.38.21/go.mod h1:UCu8dlHqvkAsmAFmWDRWNZJPlu6ya2fTWZlDrWsivwo=
935935
github.com/cometbft/cometbft-db v0.14.1 h1:SxoamPghqICBAIcGpleHbmoPqy+crij/++eZz3DlerQ=
936936
github.com/cometbft/cometbft-db v0.14.1/go.mod h1:KHP1YghilyGV/xjD5DP3+2hyigWx0WTp9X+0Gnx0RxQ=
937937
github.com/containerd/console v1.0.3/go.mod h1:7LqA/THxQ86k76b8c/EMSiaJ3h1eZkMkXar0TQ1gf3U=
@@ -1133,8 +1133,8 @@ github.com/gammazero/chanqueue v1.1.1 h1:n9Y+zbBxw2f7uUE9wpgs0rOSkP/I/yhDLiNuhyV
11331133
github.com/gammazero/chanqueue v1.1.1/go.mod h1:fMwpwEiuUgpab0sH4VHiVcEoji1pSi+EIzeG4TPeKPc=
11341134
github.com/gammazero/deque v1.2.0 h1:scEFO8Uidhw6KDU5qg1HA5fYwM0+us2qdeJqm43bitU=
11351135
github.com/gammazero/deque v1.2.0/go.mod h1:JVrR+Bj1NMQbPnYclvDlvSX0nVGReLrQZ0aUMuWLctg=
1136-
github.com/getkin/kin-openapi v0.132.0 h1:3ISeLMsQzcb5v26yeJrBcdTCEQTag36ZjaGk7MIRUwk=
1137-
github.com/getkin/kin-openapi v0.132.0/go.mod h1:3OlG51PCYNsPByuiMB0t4fjnNlIDnaEDsjiKUV8nL58=
1136+
github.com/getkin/kin-openapi v0.133.0 h1:pJdmNohVIJ97r4AUFtEXRXwESr8b0bD721u/Tz6k8PQ=
1137+
github.com/getkin/kin-openapi v0.133.0/go.mod h1:boAciF6cXk5FhPqe/NQeBTeenbjqU4LhWBf09ILVvWE=
11381138
github.com/getsentry/sentry-go v0.36.2 h1:uhuxRPTrUy0dnSzTd0LrYXlBYygLkKY0hhlG5LXarzM=
11391139
github.com/getsentry/sentry-go v0.36.2/go.mod h1:p5Im24mJBeruET8Q4bbcMfCQ+F+Iadc4L48tB1apo2c=
11401140
github.com/ghodss/yaml v1.0.0/go.mod h1:4dBDuWmgqj2HViK6kFavaiC9ZROes6MMH2rRYeMEF04=
@@ -2364,8 +2364,8 @@ github.com/spf13/cobra v0.0.5/go.mod h1:3K3wKZymM7VvHMDS9+Akkh4K60UwM26emMESw8tL
23642364
github.com/spf13/cobra v1.3.0/go.mod h1:BrRVncBjOJa/eUcVVm9CE+oC6as8k+VYr4NY7WCi9V4=
23652365
github.com/spf13/cobra v1.4.0/go.mod h1:Wo4iy3BUC+X2Fybo0PDqwJIv3dNRiZLHQymsfxlB84g=
23662366
github.com/spf13/cobra v1.5.0/go.mod h1:dWXEIy2H428czQCjInthrTRUg7yKbok+2Qi/yBIJoUM=
2367-
github.com/spf13/cobra v1.10.1 h1:lJeBwCfmrnXthfAupyUTzJ/J4Nc1RsHC/mSRU2dll/s=
2368-
github.com/spf13/cobra v1.10.1/go.mod h1:7SmJGaTHFVBY0jW4NXGluQoLvhqFQM+6XSKD+P4XaB0=
2367+
github.com/spf13/cobra v1.10.2 h1:DMTTonx5m65Ic0GOoRY2c16WCbHxOOw6xxezuLaBpcU=
2368+
github.com/spf13/cobra v1.10.2/go.mod h1:7C1pvHqHw5A4vrJfjNwvOdzYu0Gml16OCs2GRiTUUS4=
23692369
github.com/spf13/jwalterweatherman v1.0.0/go.mod h1:cQK4TGJAtQXfYWX+Ddv3mKDzgVb68N+wFjFa4jdeBTo=
23702370
github.com/spf13/jwalterweatherman v1.1.0/go.mod h1:aNWZUN0dPAAO/Ljvb5BEdw96iTZ0EXowPYD95IqWIGo=
23712371
github.com/spf13/pflag v1.0.1/go.mod h1:DYY7MBk1bdzusC3SYhjObp+wFpr4gzcvqqNjLnInEg4=
@@ -2495,6 +2495,8 @@ github.com/whyrusleeping/chunker v0.0.0-20181014151217-fe64bd25879f h1:jQa4QT2UP
24952495
github.com/whyrusleeping/chunker v0.0.0-20181014151217-fe64bd25879f/go.mod h1:p9UJB6dDgdPgMJZs7UjUOdulKyRr9fqkS+6JKAInPy8=
24962496
github.com/whyrusleeping/go-keyspace v0.0.0-20160322163242-5b898ac5add1 h1:EKhdznlJHPMoKr0XTrX+IlJs1LH3lyx2nfr1dOlZ79k=
24972497
github.com/whyrusleeping/go-keyspace v0.0.0-20160322163242-5b898ac5add1/go.mod h1:8UvriyWtv5Q5EOgjHaSseUEdkQfvwFv1I/In/O2M9gc=
2498+
github.com/woodsbury/decimal128 v1.3.0 h1:8pffMNWIlC0O5vbyHWFZAt5yWvWcrHA+3ovIIjVWss0=
2499+
github.com/woodsbury/decimal128 v1.3.0/go.mod h1:C5UTmyTjW3JftjUFzOVhC20BEQa2a4ZKOB5I6Zjb+ds=
24982500
github.com/wundergraph/graphql-go-tools/v2 v2.0.0-rc.240 h1:xnYwsUrmDcQnrZQ4+WZ8oODktsKJyAJWiYplWfmiQuk=
24992501
github.com/wundergraph/graphql-go-tools/v2 v2.0.0-rc.240/go.mod h1:mX25ASEQiKamxaFSK6NZihh0oDCigIuzro30up4mFH4=
25002502
github.com/x448/float16 v0.8.4 h1:qLwI1I70+NjRFUR3zs1JPUCgaCXSh3SW62uAKT1mSBM=
@@ -2569,8 +2571,8 @@ go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc v0.5
25692571
go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc v0.54.0/go.mod h1:B9yO6b04uB80CzjedvewuqDhxJxi11s7/GtiGa8bAjI=
25702572
go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.63.0 h1:RbKq8BG0FI8OiXhBfcRtqqHcZcka+gU3cskNuf05R18=
25712573
go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.63.0/go.mod h1:h06DGIukJOevXaj/xrNjhi/2098RZzcLTbc0jDAUbsg=
2572-
go.opentelemetry.io/contrib/instrumentation/runtime v0.63.0 h1:PeBoRj6af6xMI7qCupwFvTbbnd49V7n5YpG6pg8iDYQ=
2573-
go.opentelemetry.io/contrib/instrumentation/runtime v0.63.0/go.mod h1:ingqBCtMCe8I4vpz/UVzCW6sxoqgZB37nao91mLQ3Bw=
2574+
go.opentelemetry.io/contrib/instrumentation/runtime v0.64.0 h1:/+/+UjlXjFcdDlXxKL1PouzX8Z2Vl0OxolRKeBEgYDw=
2575+
go.opentelemetry.io/contrib/instrumentation/runtime v0.64.0/go.mod h1:Ldm/PDuzY2DP7IypudopCR3OCOW42NJlN9+mNEroevo=
25742576
go.opentelemetry.io/otel v1.39.0 h1:8yPrr/S0ND9QEfTfdP9V+SiwT4E0G7Y5MO7p85nis48=
25752577
go.opentelemetry.io/otel v1.39.0/go.mod h1:kLlFTywNWrFyEdH0oj2xK0bFYZtHRYUdv1NklR/tgc8=
25762578
go.opentelemetry.io/otel/exporters/otlp/otlpmetric/otlpmetrichttp v1.37.0 h1:9PgnL3QNlj10uGxExowIDIZu66aVBwWhXmbOp1pa6RA=

internal/db/fetcher/indexer_iterators.go

Lines changed: 22 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -762,6 +762,15 @@ func (f *indexFetcher) determineFieldFilterConditions() ([]fieldFilterCond, erro
762762
return true
763763
}
764764

765+
// For _geq: null, every value is >= null, so the index provides no benefit -
766+
// we need all documents anyway. Fall back to a full scan.
767+
// For _leq: null on nested JSON paths, documents where the JSON field is entirely
768+
// missing or null should also match. If path is specified though, the index
769+
// has no efficient way of distinguishing between them. Fall back to scan.
770+
if filterVal == nil && (op == opGe || (op == opLe && len(jsonPath) > 0)) {
771+
return true
772+
}
773+
765774
cond, err := makeFieldFilterCondition(op, jsonPath, indexedField, filterVal)
766775

767776
if err != nil {
@@ -800,8 +809,10 @@ func (f *indexFetcher) determineFieldFilterConditions() ([]fieldFilterCond, erro
800809

801810
// makeFieldFilterCondition creates a fieldFilterCond based on the given operator and filter value on
802811
// the given indexed field.
803-
// If jsonPath is not empty, it means that the indexed field is a JSON field and the filter value
804-
// should be treated as a JSON value.
812+
// For JSON fields, the filter value handling depends on the path and value:
813+
// - Direct null filter (empty path, null value): uses scalar nil to match index encoding
814+
// - Nested null filter (non-empty path, null value): uses JSON null with path
815+
// - Non-null filters: uses JSON encoding regardless of path depth
805816
func makeFieldFilterCondition(
806817
op string,
807818
jsonPath client.JSONPath,
@@ -815,7 +826,7 @@ func makeFieldFilterCondition(
815826
}
816827

817828
var err error
818-
if len(jsonPath) > 0 {
829+
if isJSONFilterCondition(indexedField.Kind, jsonPath, filterVal) {
819830
err = setJSONFilterCondition(&cond, filterVal, jsonPath)
820831
} else if filterVal == nil {
821832
cond.val, err = client.NewNormalNil(cond.kind)
@@ -870,6 +881,14 @@ func getNestedOperatorConditionIfJSON(
870881
}
871882
}
872883

884+
// isJSONFilterCondition returns true if the field is JSON and has a path or filter value.
885+
// Path can be empty if the filter is on the field itself, not on a nested property.
886+
// If the filter value is nil and path is empty, it means we are filtering for null values
887+
// on the entire JSON field, which can be handled as a scalar nil value.
888+
func isJSONFilterCondition(kind client.FieldKind, jsonPath client.JSONPath, filterVal any) bool {
889+
return kind == client.FieldKind_NILLABLE_JSON && (len(jsonPath) > 0 || filterVal != nil)
890+
}
891+
873892
// setJSONFilterCondition sets up the given condition struct based on the filter value and JSON path so that
874893
// it can be used to fetch the indexed data.
875894
func setJSONFilterCondition(cond *fieldFilterCond, filterVal any, jsonPath client.JSONPath) error {

internal/planner/arbitrary_join.go

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -274,6 +274,14 @@ func (m *orderedMap) appendChild(key string, childIndex int, value core.Doc, map
274274
index = len(m.values)
275275

276276
parent = mapping.NewDoc()
277+
// Copy non-child fields from the child document to the new parent.
278+
// This ensures groupBy fields are properly set even if the parent
279+
// document never arrives (e.g., due to filtering).
280+
for i, fieldValue := range value.Fields {
281+
if i != childIndex && i < len(parent.Fields) {
282+
parent.Fields[i] = fieldValue
283+
}
284+
}
277285
m.values = append(m.values, parent)
278286

279287
m.indexesByKey[key] = index

internal/planner/planner.go

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -411,8 +411,15 @@ func (p *Planner) tryOptimizeJoinDirectionByFilter(node *invertibleTypeJoin, par
411411
}
412412

413413
// extractRelatedSubFilter extracts the sub filter from the parent filter.
414+
// Returns nil if the relation field doesn't exist in the document map.
414415
func extractRelatedSubFilter(f *mapper.Filter, docMap *core.DocumentMapping, relField mapper.Field) *mapper.Filter {
415-
subInd := docMap.FirstIndexOfName(relField.Name)
416+
// In groupBy queries with _group filters, the docMap may not contain the relation field,
417+
// so we check existence before accessing to avoid a panic.
418+
indexes, ok := docMap.IndexesByName[relField.Name]
419+
if !ok {
420+
return nil
421+
}
422+
subInd := indexes[0]
416423
relatedField := mapper.Field{Name: relField.Name, Index: subInd}
417424
subFilter := filter.UnwrapRelation(f, relatedField)
418425
return subFilter

keyring/keyring.go

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,11 +10,16 @@
1010

1111
package keyring
1212

13+
const (
14+
KeyringBackendSystem = "system"
15+
KeyringBackendFile = "file"
16+
)
17+
1318
// Keyring provides a simple set/get interface for a keyring service.
1419
type Keyring interface {
1520
// Set stores the given key in the keystore under the given name.
1621
//
17-
// If a key with the given name already exists it will be overriden.
22+
// If a key with the given name already exists it will be overridden.
1823
Set(name string, key []byte) error
1924
// Get returns the key with the given name from the keystore.
2025
//

0 commit comments

Comments
 (0)