Kotlin-to-Rust test parity

August 13, 2026 ยท View on GitHub

This document tracks the Kotlin test suite against the experimental Rust implementation. Consolidated means one Rust test validates the same bazel-diff-owned contract as several Kotlin examples. Tests that only validate Kotlin/JVM implementation mechanics, dependency-injection wiring, or behavior guaranteed by Rust's type system or an external crate are marked non-applicable rather than copied.

Rust unit tests do not create executables that impersonate Bazel. Query planning, repository lowering, and module-impact decisions are tested as pure transformations with injected data; subprocess integration is covered by the real-Bazel E2E suite.

Kotlin test classRust coverageStatus / non-applicable details
bazel/BazelClientTestQuery/cquery, external fallback, filtering, deduplication, and Bzlmod tests in src/bazel.rsConsolidated
bazel/BazelModServiceTestBazel version/module-graph command tests in src/bazel.rsConsolidated
bazel/BazelRuleTestRule input, digest, tag, visibility, and external-label tests in src/bazel.rs and src/hash.rsConsolidated
bazel/BazelTargetTesttarget_names_and_lowering_cover_all_target_typesPorted
bazel/BazelTargetTypeTestGenerated protobuf discriminators are exercised by target-lowering testsKotlin enum reflection is non-applicable
bazel/ModuleGraphParserTestParsing, cycle, edge, change, and fallback tests in src/bazel.rs and src/module_graph.rsConsolidated
bazel/StderrPollutionRegressionTestPrefixed JSON parsing and unchanged-graph fast paths in src/module_graph.rsConsolidated
cli/BazelDiffTestCompatibility argument normalization and command workflow tests in src/main.rsConsolidated; Clap's own required-subcommand/default behavior is not retested
cli/converter/ByteSizeConverterTestparses_binary_byte_sizePorted
cli/converter/CommaSeparatedValueConverterTestNo custom Rust converter existsClap delimiter behavior is external-crate behavior
cli/converter/DurationConverterTestparses_compound_durationPorted
cli/converter/NormalisingPathConverterTestoption_and_path_compatibility_helpers_normalize_valuesPorted
cli/converter/OptionsConverterTestoption_and_path_compatibility_helpers_normalize_valuesPorted
cli/FingerprintCommandTestFingerprint command workflow and output tests in src/main.rs and src/fingerprint.rsConsolidated
cli/FingerprintGathererTestGather/import/version tests in src/fingerprint.rsPorted
cli/ServeCommandTestServe configuration, cache, readiness, metrics, and routing tests in src/main.rs and src/server.rsConsolidated; JVM shutdown-hook/Koin lifecycle mechanics are non-applicable
cli/VersionProviderTestRust version is compile-time CARGO_PKG_VERSIONJVM classpath-resource fallback is non-applicable
cli/WarmupCommandTestWarmup success/failure and artifact-ordering tests in src/main.rsPorted
e2e/E2ETesttests/e2e/{core,external,regressions}.rsPorted; the C++ Bzlmod case is ignored for the same Bazel 7 fixture/Bazel 8+ incompatibility documented by Kotlin
hash/BuildGraphHasherTestIntegrated graph hashing tests in src/hash.rsConsolidated; Kotlin's phase-timing object is non-applicable
hash/RuleHasherAlwaysAffectedTagsTestAlways-affected and stable untagged paths in src/hash.rsConsolidated
hash/RuleHasherTestCycle, memoization, source, visibility, cquery, and dependency-tracking tests in src/hash.rsConsolidated
hash/SourceFileHasherTestContent, executable-bit, external, missing-file, and label-form tests in src/hash.rsConsolidated; Koin-constructor test is non-applicable
hash/TargetHashTestParsing and serialization tests in src/model.rsPorted
interactor/CalculateImpactedTargetsInteractorIssue335TestExtension/sub-string repository regression test in src/module_graph.rsPorted
interactor/CalculateImpactedTargetsInteractorModuleQueryTestQuery success, removed-module, mixed-workspace, and Bzlmod-only fallback tests in src/module_graph.rsConsolidated
interactor/CalculateImpactedTargetsInteractorTestDistance/filter/sort tests in src/model.rs and module-change tests in src/module_graph.rsConsolidated
interactor/DeserialiseHashesInteractorTestLegacy/metadata read and malformed-input tests in src/model.rsConsolidated
interactor/FingerprintInteractorTestDeterministic/component sensitivity tests in src/fingerprint.rsConsolidated
io/ContentHashProviderTesthash_options_load_content_hashes_and_validate_shapePorted
log/StderrLoggerTestRust has no logger abstraction; observable warning/error fallback paths are testedKotlin logger implementation is non-applicable
process/ProcessStdinHangRegressionTestAll Rust subprocess call sites explicitly use Stdio::null()std::process EOF behavior is not retested
server/BazelDiffServerTestLoopback routing, profile, distance, readiness, method, and timeout tests in src/server.rsConsolidated
server/CachePrunerTestDisabled and age/count/size pruning tests in src/server.rsConsolidated; JVM scheduler interruption mechanics are non-applicable
server/GitClientTestReal Git resolve, checkout, stale-lock recovery, and multi-remote targeted-fetch tests in src/server.rsConsolidated
server/HashServiceTestCache-key, local/remote hit, backfill, metadata, and profile tests in src/server.rsConsolidated
server/ImpactedTargetsServiceTestProfiled query, distance, refetch, and route tests in src/server.rsConsolidated
server/LocalDiskHashCacheStorageTestLocal hit/touch/stats and age/count/size pruning tests in src/server.rsConsolidated
server/MetricsServiceTestmetrics_and_human_sizes_report_cache_stateConsolidated; JVM heap/clock injection is non-applicable
server/QueryProfilerTestProfiled query response tests in src/server.rsConsolidated; JVM GC-bean accounting is non-applicable
server/S3HashCacheStorageTestReal loopback S3 success/miss/error and normalized-key tests in src/server.rsConsolidated; rust-s3 request construction itself is not retested
server/TieredHashCacheStorageTestRemote backfill/local reuse and local pruning behavior in src/server.rsConsolidated

Enforcement

  • //:rust_tests runs both //src:rust_tests and //src:cli_tests.
  • //src:rust_tests enforces at least 90% Rust production line coverage through //tools/coverage:lcov_merger.
  • Rust E2E parity lives under tests/e2e.rs and runs in the dedicated CI E2E job.