pub struct FalsificationTest {
pub id: String,
pub rule: String,
pub prediction: String,
pub test: Option<String>,
pub test_harness: Option<String>,
pub name: Option<String>,
pub if_fails: String,
pub obligation: Option<Citation>,
}Expand description
A Popperian falsification test.
Each makes a falsifiable prediction about the implementation. If the prediction is wrong, the test identifies root cause.
Fields§
§id: String§rule: StringWhat the test asserts. Alias description accepted for legacy
pre-APR-MONO contracts that used the description: field name.
name: is NOT aliased because several legacy contracts (e.g.
publish-manifest-v1) ship both name: (a slug) and
description: (prose) side-by-side; aliasing both collapses to
a duplicate field error.
prediction: StringThe predicted outcome if the rule holds. Alias expected accepted
for legacy contracts (e.g. expected: exit 0, expected: "PASS").
Defaulted because diagnostic contracts often encode prediction
inside the rule text alone.
test: Option<String>How to run the test. Alias command accepted for legacy contracts
(e.g. shell snippets under command: |).
test_harness: Option<String>How to run the test, in the test_harness: spelling. 619 entries in
contracts/ use this field INSTEAD of test: — 94 of them holding a
real cargo test invocation, the rest a shell harness (grep -q …,
test -f …, bash …).
#2465: this field did not exist on the struct, and FalsificationTest
is not deny_unknown_fields, so serde dropped it silently. Every one
of those 619 entries reached strict_test_binding with test: None
and was skipped — the gate reported them as neither bound nor broken.
name: Option<String>The bare test-fn name, when the contract names it here rather than in
an invocation. Deliberately NOT a serde alias of rule: several
legacy contracts (e.g. publish-manifest-v1) ship name: (a slug)
and description: (prose) side by side, and aliasing both onto one
field collapses to a duplicate field parse error. Consumed as a
binding source of last resort — see strict_test_binding.
if_fails: StringWhat failure means. Alias fails_if accepted for legacy contracts.
Defaulted because several legacy diagnostic contracts omit it.
obligation: Option<Citation>The obligation this test discharges — the only machine-readable claim that THIS test proves THAT obligation (#3347).
Until this field existed the key was written to disk and silently
dropped on parse (the same shape as id in #3314 and test_harness
in #2465: no deny_unknown_fields, so serde discarded it), which is
why obligation_matrix had nothing to read and fell back to comparing
an INDEX against falsification_tests.len().
Measured over contracts/ (1,842 files, 4,691 falsification tests):
26 entries spell it obligation: and 38 spell it binds_to:. No entry
carries BOTH — checked, and it matters, because serde collapses an
alias pair present on one mapping into a duplicate field parse error.
Resolved against the obligation’s id, then its exact property text.
A comma-separated list cites several obligations.