Skip to content

[benchmark] Simply Inputs more.#1077

Open
hildebrandmw wants to merge 12 commits into
mainfrom
mhildebr/simplify-any
Open

[benchmark] Simply Inputs more.#1077
hildebrandmw wants to merge 12 commits into
mainfrom
mhildebr/simplify-any

Conversation

@hildebrandmw
Copy link
Copy Markdown
Contributor

@hildebrandmw hildebrandmw commented May 15, 2026

Move the Input trait in diskann-benchmark-runner over to a strongly typed representation and remove Any from the public API. This finishes the large work in streamlining the benchmark API. The new interface is

pub trait Input: Sized + std::fmt::Debug + 'static {
    type Raw: serde::de::DeserializeOwned + serde::Serialize;
    fn tag() -> &'static str;
    fn from_raw(raw: Self::Raw, checker: &mut Checker) -> anyhow::Result<Self>;
    fn serialize(&self) -> anyhow::Result<serde_json::Value>;
    fn example() -> Self::Raw;
}

with the big changes being the introduction of the Raw associated type, changing try_deserialize for from_raw, adding serialize (for custom serialization) and example returning Self::Raw instead of raw serde_json::Value. The idea behind Raw is that it is used to replace the CheckDeserialization trait and allows decoupling of an unvalidated raw deserialized struct from the final validated object.

This PR also removes the CheckDeserialization trait.

Suggested Reviewing Order

  • diskann-benchmark-runner:
    • src/input.rs: This is where the bulk of the actual changes are. The now removed custom Any type is moved as an internal implementation detail in this module and is no longer user facing.
    • src/files.rs: The file path validation for InputFile is moved from CheckDeserialization to an inherent resolve method.
    • src/test/dim.rs: A mechanical change where Raw = Self is used for the Input definitions.
    • src/test/typed.rs: TypeInput is tweaked to use a separate type as the raw input to ensure there is some coverage there.
    • src/any.rs: Removed.
    • The rest of the changes are mostly mechanical updates of import paths.
  • diskann-benchmark:
    • src/inputs.mod.rs: Update the as_input! macro to the new form. Now that we aren't relying on CheckDeserialization, I switched over benchmarks to using ad-hoc validate inherent methods. This is somewhat of a stopgap to preserve the existing checks that mutate in-place.
    • README.md: Update some out-of-date examples and descriptions.
    • The rest of the changes are moving calls to check_deserialization to validate.
  • diskann-benchmark-simd: Simple port to the new Input trait.

@codecov-commenter
Copy link
Copy Markdown

codecov-commenter commented May 15, 2026

Codecov Report

❌ Patch coverage is 77.23577% with 56 lines in your changes missing coverage. Please review.
✅ Project coverage is 89.45%. Comparing base (6c92753) to head (f101132).
⚠️ Report is 2 commits behind head on main.

Files with missing lines Patch % Lines
diskann-benchmark/src/inputs/graph_index.rs 59.61% 21 Missing ⚠️
diskann-benchmark/src/inputs/disk.rs 0.00% 11 Missing ⚠️
diskann-benchmark-simd/src/lib.rs 43.75% 9 Missing ⚠️
diskann-benchmark-runner/src/registry.rs 83.33% 4 Missing ⚠️
diskann-benchmark-runner/src/input.rs 94.54% 3 Missing ⚠️
diskann-benchmark-runner/src/test/dim.rs 78.57% 3 Missing ⚠️
diskann-benchmark-runner/src/test/typed.rs 90.90% 2 Missing ⚠️
diskann-benchmark/src/inputs/mod.rs 80.00% 2 Missing ⚠️
diskann-benchmark-runner/src/app.rs 66.66% 1 Missing ⚠️

❌ Your patch status has failed because the patch coverage (77.23%) is below the target coverage (90.00%). You can increase the patch coverage or adjust the target coverage.

Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff             @@
##             main    #1077      +/-   ##
==========================================
- Coverage   89.47%   89.45%   -0.02%     
==========================================
  Files         459      458       -1     
  Lines       85660    85398     -262     
==========================================
- Hits        76646    76395     -251     
+ Misses       9014     9003      -11     
Flag Coverage Δ
miri 89.45% <77.23%> (-0.02%) ⬇️
unittests 89.08% <77.23%> (-0.03%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

Files with missing lines Coverage Δ
diskann-benchmark-runner/src/benchmark.rs 84.25% <100.00%> (ø)
diskann-benchmark-runner/src/checker.rs 70.54% <ø> (-2.12%) ⬇️
diskann-benchmark-runner/src/files.rs 100.00% <100.00%> (ø)
...iskann-benchmark-runner/src/internal/regression.rs 97.69% <ø> (-0.01%) ⬇️
diskann-benchmark-runner/src/jobs.rs 96.77% <100.00%> (-0.06%) ⬇️
diskann-benchmark-runner/src/result.rs 97.84% <100.00%> (ø)
diskann-benchmark/src/inputs/exhaustive.rs 26.83% <100.00%> (ø)
diskann-benchmark/src/inputs/filters.rs 67.74% <100.00%> (-3.69%) ⬇️
diskann-benchmark-runner/src/app.rs 83.97% <66.66%> (-0.28%) ⬇️
diskann-benchmark-runner/src/test/typed.rs 97.10% <90.90%> (+0.50%) ⬆️
... and 7 more

... and 20 files with indirect coverage changes

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@hildebrandmw hildebrandmw marked this pull request as ready for review May 16, 2026 01:04
@hildebrandmw hildebrandmw requested review from a team and Copilot May 16, 2026 01:04
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR completes the benchmark API streamlining by moving diskann-benchmark-runner::Input to a strongly-typed model (Raw DTO + from_raw validation + serialize) and removing the public Any/CheckDeserialization APIs, then mechanically porting benchmarks and inputs to the new interface.

Changes:

  • Replaced the runner’s dynamic Any + CheckDeserialization flow with Input { type Raw, from_raw(..), serialize(..), example() } and made the type-erasure an internal detail.
  • Migrated benchmark input validation from CheckDeserialization::check_deserialization to ad-hoc inherent validate(..) methods and InputFile::resolve(..).
  • Updated examples/docs and ported diskann-benchmark + diskann-benchmark-simd + runner tests to the new trait.

Reviewed changes

Copilot reviewed 21 out of 21 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
diskann-benchmark/src/inputs/mod.rs Updates as_input! macro to implement new Input API with Raw = Self, calling validate and serialize.
diskann-benchmark/src/inputs/graph_index.rs Ports graph-index inputs from CheckDeserialization to inherent validate + InputFile::resolve.
diskann-benchmark/src/inputs/filters.rs Ports filter inputs to inherent validate + InputFile::resolve.
diskann-benchmark/src/inputs/exhaustive.rs Ports exhaustive inputs to inherent validate + InputFile::resolve and updates nested validation calls.
diskann-benchmark/src/inputs/disk.rs Ports disk-index inputs to inherent validate and replaces file checks with resolve.
diskann-benchmark/src/backend/disk_index/benchmarks.rs Updates tolerance input to new Input trait (Raw, from_raw, serialize, example).
diskann-benchmark/README.md Updates README examples to the new registration and Input API, plus benchmark description hook.
diskann-benchmark-simd/src/lib.rs Ports SIMD benchmark inputs/tolerances to the new Input trait.
diskann-benchmark-runner/src/test/typed.rs Adjusts typed test inputs to use separate Raw DTOs and from_raw validation behavior.
diskann-benchmark-runner/src/test/dim.rs Ports dim test inputs to new Input trait methods.
diskann-benchmark-runner/src/result.rs Updates tests to reflect updated TypeInput::new signature.
diskann-benchmark-runner/src/registry.rs Switches registry internals to input::internal type-erased layer; hides dispatch methods from public API.
diskann-benchmark-runner/src/lib.rs Removes public re-exports of Any and CheckDeserialization; keeps Checker and Input public.
diskann-benchmark-runner/src/jobs.rs Updates job parsing to produce internal type-erased inputs and drops Checker tag plumbing.
diskann-benchmark-runner/src/internal/regression.rs Migrates regression pipeline to internal Any and updated deserialization path.
diskann-benchmark-runner/src/input.rs Introduces new Input trait shape and moves the type-erasure (Any/DynInput/Wrapper) into input::internal.
diskann-benchmark-runner/src/files.rs Replaces CheckDeserialization with InputFile::resolve for path validation/resolution.
diskann-benchmark-runner/src/checker.rs Removes CheckDeserialization and tag-based Checker::any helper; keeps path/output resolution utilities.
diskann-benchmark-runner/src/benchmark.rs Updates internal benchmark dispatch to use input::internal::Any instead of public Any.
diskann-benchmark-runner/src/app.rs Updates job serialization/checkpoint setup to use new Any::serialize() returning anyhow::Result.
diskann-benchmark-runner/src/any.rs Deleted (public Any removed).
Comments suppressed due to low confidence (2)

diskann-benchmark/src/inputs/exhaustive.rs:405

  • Spelling typo in comment: "Chcck" should be "Check".
        // Chcck that provided data type is compatible with `f32`.
        f32::check_converting_load(self.data_type)?;

diskann-benchmark/src/inputs/exhaustive.rs:506

  • Spelling typo in comment: "Chcck" should be "Check".
        // Chcck that provided data type is compatible with `f32`.
        f32::check_converting_load(self.data_type)?;

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread diskann-benchmark/src/inputs/exhaustive.rs Outdated
Comment thread diskann-benchmark/src/inputs/mod.rs Outdated
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
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.

3 participants