Repository navigation
Autoharness documentation is out of date and missing several features #4979
Description
The autoharness reference page (docs/src/reference/experimental/autoharness.md) is out of date with the implementation on main. Some sections are now wrong, and several user-visible features are not documented at all.
Incorrect / outdated content
- Slices and
Vecare no longer always bounded (Autoharness: unbounded slice, mutable slice and Vec arguments #4721).&[T],&mut [T]andVec<T>arguments whose element type is a primitive integer or float are generated as fresh allocations of nondeterministic length. They are eligible by default (no--bounded-argumentsneeded) and are not marked "(bounded)". Seeautomatic_harness_partitioninkani-compiler/src/kani_middle/codegen_units.rsandUnboundedModelsinkani-compiler/src/kani_middle/transform/automatic.rs. The "Bounded Arguments" and "Limitations > Arguments Implementing Arbitrary" sections currently say slices require--bounded-arguments. - Generic functions bounded by
Fn/FnMut/FnOnceare no longer skipped. They are instantiated with nondeterministic closure models (fn_bound_candidates,resolve_deferred_fn_slotsandNondetFnModelsincodegen_units.rs). Arities 0-3 are supported; for reference-taking shapes only arity 1 and 2. The "Generic Functions" section should describe this and its limits.
Undocumented features
-
Box<T>/Rc<T>/Arc<T>arguments whose pointee implements or can deriveArbitraryare supported and unbounded (SmartPointerModelsinkani-compiler/src/kani_middle/mod.rs; testcargo_autoharness_smart_pointers). -
Layout niche assumptions. Generated values of types with scalar valid ranges (e.g.
NonZero*,Duration's nanoseconds field) are constrained to their valid range (assume_scalar_niche). This is sound and needs no flag, but it explains why such types do not produce false alarms. -
Default verification settings.
kani autoharnesssets--harness-timeout 60sand--default-unwind 20(kani-driver/src/autoharness/mod.rs). The page only mentions the unwind bound in passing. -
The full list of skip reasons. Only "Generic Function" and "Requires --bounded-arguments" are documented. Missing:
Comptime(can only be called at compile time)KaniImplNoBodyUnsupportedVariadicUserFilterMissingArbitraryImpl
See
AutoHarnessSkipReasoninkani_metadata/src/lib.rs. -
Additional generic-instantiation rejections:
- SIMD-invalid instantiations (e.g.
simd_imin::<T>with a non-SIMDT;invalid_simd_instantiation). - Functions with const-generic preconditions that the substituted value would violate (
has_const_generic_precondition).
- SIMD-invalid instantiations (e.g.
-
Smaller CLI items:
kani autoharness --std(run on the standard library).--list --format <FORMAT>.- The bound flags (
--slice-bound,--string-bound,--bounded-arbitrary-bound) are rejected unless--bounded-argumentsis passed.
Suggested restructuring
The page has grown feature by feature. Consider reorganizing it as:
- Overview + how it works (pipeline: select functions → generate harness → verify → summary)
- Selecting functions (filters,
--list, skip reasons) - Generating arguments, split into:
- unbounded: Arbitrary/derive, raw pointers, smart pointers, unbounded slices/
Vec, Fn-bound generics, niches - opt-in under-approximations:
--bounded-arguments,--constructor-args
- unbounded: Arbitrary/derive, raw pointers, smart pointers, unbounded slices/
- Assumptions and checks (contracts,
Invariant, mined invariants /--check-invariants) - Running and reading results (parallelism, defaults, "(bounded)" / "(ctor)" markers)
- Soundness caveats in one place (bounds, ctor vacuity Autoharness --constructor-args: an unsatisfiable constructor yields a vacuous (always-Success) harness #4757, mined-invariant heuristic Autoharness --constructor-args: assumed mined invariants may exclude valid values (heuristic under-approximation) #4763, aliasing Autoharness: model caller-controlled aliasing between reference/pointer arguments #4750, single monomorphization)
Activity
feliperodri commentedon Oct 6, 2026
@Tianshu-Huang cc.
Tianshu-Huang commentedon Oct 6, 2026
I'll take this. Since #4958 also touches this page, I'll start once it lands to avoid conflicts.
feliperodri commentedon Oct 6, 2026
The new autoharness book chapter should follow this overall structure. It starts with the core idea, then covers the three phases (select → generate → verify/report), and ends by collecting the soundness caveats and the internals in one place each:
Architecture diagram (for the contributors section)
feliperodri commentedon Oct 6, 2026
@Tianshu-Huang I need more time to review #4958 so don't wait on it to be merged to start working on this one.
Tianshu-Huang commentedon Oct 7, 2026
Thank you, the structure is clear!
I wrote my earlier reply last night, before our sync today. After the sync, the team decided that Sriv and I will take the verification-result analysis, and @CYJ904 @acearyanarun @wodex1nhaoIeng will work on this one.
Fill in the soundness caveats of the autoharness reference page
docs(autoharness): document function selection and skip reasons
Document autoharness default settings and the summary table
Document running autoharness on the standard library
Add an architecture overview for autoharness contributors
Polish the autoharness reference page for consistency
Document autoharness assumptions and checks
Clarify autoharness model availability and generation limits
Document the missing "(ctor)" marker for mined-invariant filtering