Context
In PR #10836, we merged a cleanup in EmbeddingProviderConfig.mjs that introduced a local hasValue function. The operator pointed out that this is redundant because Neo.mjs already provides Neo.isEmpty(). Concurrently, the implementation of Neo.isEmpty() itself contains a verbose null/undefined check that can be optimized.
The Problem
EmbeddingProviderConfig.mjs duplicates validation logic with a local hasValue function (const hasValue = value => value !== undefined && value !== null && value !== '';).
Neo.isEmpty() currently uses strict equality for both null and undefined (value === null || value === undefined), which is unnecessarily verbose compared to loose equality.
The Architectural Reality
Neo.isEmpty() is a core utility method meant to prevent exactly this kind of localized hasValue recreation. Updating it to use loose equality (== null) is fully safe, captures both null and undefined, and reduces bytes. EmbeddingProviderConfig.mjs should import/rely on this core utility rather than duplicating logic.
The Fix
- Update
Neo.isEmpty(): replace value === null || value === undefined with value == null.
- Add an explicit code comment in
Neo.isEmpty() clarifying that == is intentional to catch both null and undefined.
- Update
EmbeddingProviderConfig.mjs: drop hasValue and refactor the unified assignment to use !Neo.isEmpty(config.embeddingProvider).
Acceptance Criteria
Out of Scope
- Widespread auditing of other uses of
=== null across the codebase; scope is strictly limited to Neo.isEmpty() and the recent EmbeddingProviderConfig change.
Origin Session ID: a82084a1-4ce1-4a50-b78d-68b3e60a473f
Context
In PR #10836, we merged a cleanup in
EmbeddingProviderConfig.mjsthat introduced a localhasValuefunction. The operator pointed out that this is redundant because Neo.mjs already providesNeo.isEmpty(). Concurrently, the implementation ofNeo.isEmpty()itself contains a verbose null/undefined check that can be optimized.The Problem
EmbeddingProviderConfig.mjsduplicates validation logic with a localhasValuefunction (const hasValue = value => value !== undefined && value !== null && value !== '';).Neo.isEmpty()currently uses strict equality for both null and undefined (value === null || value === undefined), which is unnecessarily verbose compared to loose equality.The Architectural Reality
Neo.isEmpty()is a core utility method meant to prevent exactly this kind of localizedhasValuerecreation. Updating it to use loose equality (== null) is fully safe, captures both null and undefined, and reduces bytes.EmbeddingProviderConfig.mjsshould import/rely on this core utility rather than duplicating logic.The Fix
Neo.isEmpty(): replacevalue === null || value === undefinedwithvalue == null.Neo.isEmpty()clarifying that==is intentional to catch both null and undefined.EmbeddingProviderConfig.mjs: drophasValueand refactor theunifiedassignment to use!Neo.isEmpty(config.embeddingProvider).Acceptance Criteria
Neo.isEmpty()usesvalue == nullinternally with an explanatory comment.EmbeddingProviderConfig.mjsremoves the localhasValuefunction.EmbeddingProviderConfig.mjsuses!Neo.isEmpty()for config resolution.Out of Scope
=== nullacross the codebase; scope is strictly limited toNeo.isEmpty()and the recentEmbeddingProviderConfigchange.Origin Session ID: a82084a1-4ce1-4a50-b78d-68b3e60a473f