return values for all functions in the codebase#234
Merged
Conversation
VectorDB Benchmark - Ready To Run
Post one of the command below. Only members with write access can trigger runs. Available Modes
Infrastructure
Both servers start on demand and are always terminated after the run — pass or fail. How Correctness Benchmarking Works
|
vindwi
approved these changes
May 4, 2026
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.
PR Title
Add shared
OperationResulttype for explicit error propagationPR Body
Summary
This PR introduces a shared
ndd::OperationResult<T>type insrc/utils/types.hpp.OperationResultis intended to become the standard lightweight return type for operations that need to report success or failure without throwing exceptions. It supports both status-only functions and functions that return a value.Why
Several parts of the codebase currently handle errors inconsistently: some functions throw, some log and continue, and some return fallback values like
falseor an empty bitmap even when the real issue is a storage failure.That makes it hard for callers to distinguish between valid empty results and actual failures.
OperationResultgives us a common pattern for propagating errors upward so callers can decide whether to log, retry, return an API error, or abort the current operation.Design
OperationResult<T>contains:code:0means success; non-zero codes are operation-specific.message: optional human-readable failure context.value: optional result payload for functions that return data.ok(): convenience helper for success checks.The default type is
std::monostate, so status-only operations can use:Future Usage
Follow-up changes will use this type across the filter subsystem first, especially for paths that currently swallow failures or return ambiguous defaults.
Examples:
Each function using
OperationResultshould document its local result codes above the function definition. Callers will use those codes to map failures to logs and API responses.For example:
Notes
This PR only adds the shared type. It does not yet change filter behavior or API error handling. Subsequent PRs will wire this into filter writes, reads, MDBX error paths, logging, and API response mapping.