From ceb57b1a1d02b9556a63b0a987533676438d6fb7 Mon Sep 17 00:00:00 2001 From: Osama Ansar Date: Wed, 2 Sep 2026 12:37:32 +0500 Subject: [PATCH 1/5] gh-470: fix dropped Boost decay field, remove debug log, guard journey afterAll - Serialize.boostGRPC spread the public `decay` field straight into fromPartial({...}), but the generated proto type only recognizes decayValue, so fromPartial silently dropped it and the value never reached the wire. Map decay -> decayValue explicitly for both TimeDecay and NumericDecay. - Remove a console.error(JSON.stringify(out)) debug line left in boostGRPC that wrote to stderr on every boosted query. - Guard journey.test.ts's afterAll with client?. so a beforeAll failure (client left undefined) doesn't throw a second, misleading TypeError that obscures the real failure. Adds unit coverage for the decay -> decayValue mapping in src/collections/serialize/unit.test.ts (present/absent cases for both TimeDecay and NumericDecay), run against the pure serializer with no live server required. --- src/collections/serialize/index.ts | 7 ++-- src/collections/serialize/unit.test.ts | 56 ++++++++++++++++++++++++++ test/collections/journey.test.ts | 2 +- 3 files changed, 61 insertions(+), 4 deletions(-) diff --git a/src/collections/serialize/index.ts b/src/collections/serialize/index.ts index a2c5092c..41fe93e4 100644 --- a/src/collections/serialize/index.ts +++ b/src/collections/serialize/index.ts @@ -1642,23 +1642,25 @@ export class Serialize { }; break; case 'timeDecay': { - const { curve, ...timeDecay } = func as TimeDecay; + const { curve, decay, ...timeDecay } = func as TimeDecay; condProto = { ...condProto, timeDecay: Boost_TimeDecayFunction.fromPartial({ ...timeDecay, curve: this.boostCurve(curve), + decayValue: decay, }), }; break; } case 'numericDecay': { - const { curve, ...numericDecay } = func as NumericDecay; + const { curve, decay, ...numericDecay } = func as NumericDecay; condProto = { ...condProto, numericDecay: Boost_NumericDecayFunction.fromPartial({ ...numericDecay, curve: this.boostCurve(curve), + decayValue: decay, }), }; break; @@ -1678,7 +1680,6 @@ export class Serialize { out.conditions.push(condProto); } - console.error(JSON.stringify(out)); return out; }; diff --git a/src/collections/serialize/unit.test.ts b/src/collections/serialize/unit.test.ts index b8915e43..a40befbf 100644 --- a/src/collections/serialize/unit.test.ts +++ b/src/collections/serialize/unit.test.ts @@ -1032,6 +1032,62 @@ describe('Unit testing of Serialize', () => { }); }); }); + + describe('.boostGRPC', () => { + // Regression coverage: `decay` was being spread into `fromPartial({...})` unchanged, + // but the generated proto type only recognizes `decayValue`, so `fromPartial` silently + // dropped it and the value never reached the wire. See weaviate/typescript-client#470. + it('should map TimeDecay.decay onto the proto decayValue field', () => { + const out = Serialize.boostGRPC({ + conditions: [ + { + func: { + type: 'timeDecay', + property: 'createdAt', + scale: '35d', + origin: '2024-01-01T00:00:00Z', + curve: 'exponential', + decay: 0.2, + }, + }, + ], + }); + expect(out.conditions[0].timeDecay?.decayValue).toEqual(0.2); + }); + + it('should map NumericDecay.decay onto the proto decayValue field', () => { + const out = Serialize.boostGRPC({ + conditions: [ + { + func: { + type: 'numericDecay', + property: 'rating', + scale: 10, + origin: 0, + curve: 'linear', + decay: 0.5, + }, + }, + ], + }); + expect(out.conditions[0].numericDecay?.decayValue).toEqual(0.5); + }); + + it('should omit decayValue when decay is not provided', () => { + const out = Serialize.boostGRPC({ + conditions: [ + { + func: { + type: 'timeDecay', + property: 'createdAt', + scale: '35d', + }, + }, + ], + }); + expect(out.conditions[0].timeDecay?.decayValue).toBeUndefined(); + }); + }); }); describe('Unit testing of DataGuards', () => { diff --git a/test/collections/journey.test.ts b/test/collections/journey.test.ts index 11d01222..094bdd83 100644 --- a/test/collections/journey.test.ts +++ b/test/collections/journey.test.ts @@ -13,7 +13,7 @@ describe('Journey testing of the client using a WCD cluster', () => { dateOfBirth: Date; }; - afterAll(() => client.collections.delete(collectionName)); + afterAll(() => client?.collections.delete(collectionName)); beforeAll(async () => { client = await weaviate.connectToWeaviateCloud( From d784229eb6562938fb37cc835560c4f488a6eb3a Mon Sep 17 00:00:00 2001 From: Osama Ansar Date: Wed, 2 Sep 2026 19:38:41 +0500 Subject: [PATCH 2/5] address review: drop unnecessary comment, assert full boostGRPC output Per bevzzz's review on #471: - removed the explanatory comment above the .boostGRPC describe block - extended the TimeDecay test to assert the entire boostGRPC output against the expected proto stub, not just the decayValue field --- src/collections/serialize/unit.test.ts | 23 ++++++++++++++++++----- 1 file changed, 18 insertions(+), 5 deletions(-) diff --git a/src/collections/serialize/unit.test.ts b/src/collections/serialize/unit.test.ts index a40befbf..fb422708 100644 --- a/src/collections/serialize/unit.test.ts +++ b/src/collections/serialize/unit.test.ts @@ -34,7 +34,7 @@ import { Targets, } from '../../proto/v1/base_search.js'; import { GenerativeSearch } from '../../proto/v1/generative.js'; -import { GroupBy, MetadataRequest, PropertiesRequest } from '../../proto/v1/search_get.js'; +import { Boost_DecayCurve, GroupBy, MetadataRequest, PropertiesRequest } from '../../proto/v1/search_get.js'; import { Filters as FiltersFactory } from '../filters/classes.js'; import filter from '../filters/index.js'; import { Bm25OperatorOptions, TargetVectorInputType } from '../query/types.js'; @@ -1034,9 +1034,6 @@ describe('Unit testing of Serialize', () => { }); describe('.boostGRPC', () => { - // Regression coverage: `decay` was being spread into `fromPartial({...})` unchanged, - // but the generated proto type only recognizes `decayValue`, so `fromPartial` silently - // dropped it and the value never reached the wire. See weaviate/typescript-client#470. it('should map TimeDecay.decay onto the proto decayValue field', () => { const out = Serialize.boostGRPC({ conditions: [ @@ -1052,7 +1049,23 @@ describe('Unit testing of Serialize', () => { }, ], }); - expect(out.conditions[0].timeDecay?.decayValue).toEqual(0.2); + expect(out).toEqual({ + weight: undefined, + depth: undefined, + conditions: [ + { + weight: undefined, + timeDecay: { + property: 'createdAt', + origin: '2024-01-01T00:00:00Z', + scale: '35d', + offset: undefined, + curve: Boost_DecayCurve.DECAY_CURVE_EXPONENTIAL, + decayValue: 0.2, + }, + }, + ], + }); }); it('should map NumericDecay.decay onto the proto decayValue field', () => { From 8ac63f747735373c9ecc4ba63fb761c52f259d88 Mon Sep 17 00:00:00 2001 From: Osama Ansar Date: Thu, 3 Sep 2026 15:56:56 +0500 Subject: [PATCH 3/5] gh-470: address review - rename boostGRPC test, drop redundant omitted-decay case --- src/collections/serialize/unit.test.ts | 17 +---------------- 1 file changed, 1 insertion(+), 16 deletions(-) diff --git a/src/collections/serialize/unit.test.ts b/src/collections/serialize/unit.test.ts index fb422708..0c4929e9 100644 --- a/src/collections/serialize/unit.test.ts +++ b/src/collections/serialize/unit.test.ts @@ -1034,7 +1034,7 @@ describe('Unit testing of Serialize', () => { }); describe('.boostGRPC', () => { - it('should map TimeDecay.decay onto the proto decayValue field', () => { + it('should serialize a TimeDecay boost to the full proto shape with decay mapped to decayValue', () => { const out = Serialize.boostGRPC({ conditions: [ { @@ -1085,21 +1085,6 @@ describe('Unit testing of Serialize', () => { }); expect(out.conditions[0].numericDecay?.decayValue).toEqual(0.5); }); - - it('should omit decayValue when decay is not provided', () => { - const out = Serialize.boostGRPC({ - conditions: [ - { - func: { - type: 'timeDecay', - property: 'createdAt', - scale: '35d', - }, - }, - ], - }); - expect(out.conditions[0].timeDecay?.decayValue).toBeUndefined(); - }); }); }); From a8d31330a5b9b25a50c3ce3ef6cfa57374502781 Mon Sep 17 00:00:00 2001 From: Osama Ansar Date: Mon, 7 Sep 2026 13:19:39 +0500 Subject: [PATCH 4/5] gh-470: assert full proto shape in NumericDecay boostGRPC test --- src/collections/serialize/unit.test.ts | 20 ++++++++++++++++++-- 1 file changed, 18 insertions(+), 2 deletions(-) diff --git a/src/collections/serialize/unit.test.ts b/src/collections/serialize/unit.test.ts index 0c4929e9..34ccec11 100644 --- a/src/collections/serialize/unit.test.ts +++ b/src/collections/serialize/unit.test.ts @@ -1068,7 +1068,7 @@ describe('Unit testing of Serialize', () => { }); }); - it('should map NumericDecay.decay onto the proto decayValue field', () => { + it('should serialize a NumericDecay boost to the full proto shape with decay mapped to decayValue', () => { const out = Serialize.boostGRPC({ conditions: [ { @@ -1083,7 +1083,23 @@ describe('Unit testing of Serialize', () => { }, ], }); - expect(out.conditions[0].numericDecay?.decayValue).toEqual(0.5); + expect(out).toEqual({ + weight: undefined, + depth: undefined, + conditions: [ + { + weight: undefined, + numericDecay: { + property: 'rating', + origin: 0, + scale: 10, + offset: undefined, + curve: Boost_DecayCurve.DECAY_CURVE_LINEAR, + decayValue: 0.5, + }, + }, + ], + }); }); }); }); From 047028bf6b4d6d58ef39a15d3f81751b6e8ec3eb Mon Sep 17 00:00:00 2001 From: Osama Ansar Date: Tue, 8 Sep 2026 13:52:45 +0500 Subject: [PATCH 5/5] gh-470: drop the unrelated journey afterAll guard per review --- test/collections/journey.test.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/collections/journey.test.ts b/test/collections/journey.test.ts index 094bdd83..11d01222 100644 --- a/test/collections/journey.test.ts +++ b/test/collections/journey.test.ts @@ -13,7 +13,7 @@ describe('Journey testing of the client using a WCD cluster', () => { dateOfBirth: Date; }; - afterAll(() => client?.collections.delete(collectionName)); + afterAll(() => client.collections.delete(collectionName)); beforeAll(async () => { client = await weaviate.connectToWeaviateCloud(