Skip to content

The Drift Log · Certifying that code does something

Bounding Property Generators to Prevent False Failures

22 November 2026 · 4 min read · 775 words · established

A crystal artifact under orange probe beams inside a test rig

Unconstrained property generators waste runner cycles and trigger false failures. Here is how to bound generator domains to match real domain contracts.

A property-based test harness that fails on impossible data is not finding bugs. It is burning compute on inputs the production system can never receive.

Consider a payment reconciliation worker. The function takes an allocation map and a settlement batch ID. An unconstrained property test generates a batch ID containing null bytes, a Unicode direction-override character, and an allocation map with negative cent balances. The function throws an uncaught parsing error, the test fails, and an engineer spends an hour debugging a scenario that a database constraint or gateway validation rejects at the boundary.

Even worse is the reverse case: the test silently swallows or filters invalid inputs using an assume() or filter predicate. When 95% of generated inputs are discarded because they violate basic schema prerequisites, the harness completes with a green checkmark after executing three real edge cases.

A green suite proves the tests ran. It does not prove the artifact satisfies its invariants.

The Cost of Sloppy Domain Bounds

In property based testing, the generator represents your assumptions about the universe. When your generator produces structurally valid JSON that violates domain semantics, you hit one of two failure modes:

  1. False failures: The harness flags a defect in code that was never intended to handle nonsensical data, obscuring genuine regressions.
  2. Exhaustion limits: The harness discards so many discarded iterations that it gives up, masking unexercised execution paths under a passing status.

The problem is a missing input contract. A parser at the edge of your system should accept arbitrary, untrusted bytes. An internal domain service should not.

If a function assumes an invariant, the property generator for that function must construct inputs strictly within those contract boundaries. If the generator is wider than the boundary, the test is testing an imaginary interface.

// Fragile: Relies on filtering out invalid states after generation
fc.property(fc.integer(), fc.integer(), (start, end) => {
  fc.pre(start <= end); // Wastes harness cycles on discards
  return calculateRange(start, end) >= 0;
});

// Robust: Bounded generation mirrors the domain contract
fc.property(
  fc.integer({ min: 0, max: 86400 }).chain(start =>
    fc.record({
      start: fc.constant(start),
      duration: fc.integer({ min: 0, max: 86400 - start })
    })
  ),
  ({ start, duration }) => calculateWindow(start, start + duration) >= 0
);

The second generator cannot construct an invalid state. It exercises edge cases—zero duration, boundary integers, maximum ranges—without running into harness limits caused by impossible permutations.

Separating Harness Limits from Component Defects

When an automated test run fails, you need to know immediately whether the component broke or the harness broke.

If a property generator supplies a negative array length or a malformed URI to a function whose signature demands a validated value object, the resulting panic is not a component failure. It is a harness limitation. The test harness failed to construct a valid proof environment.

When writing harnesses:

  • Generate structured types, not raw primitives. If a domain function takes a TenantId, generate an opaque branded string conforming to the exact UUID or alphanumeric specification of the tenant system, not arbitrary strings.
  • Model dependent invariants explicitly. If field B depends on field A (such as an array and an index into that array), generate them together using dependent combinators. Do not generate two independent primitives and filter out mismatches.
  • Treat harness discards as errors. If your framework discards more than 10% of generated iterations due to precondition checks, fail the harness build. The generator is uncalibrated.

Constraining generator ranges to real architectural invariants eliminates inconclusive harness runs. It ensures that every cycle spent by the runner actually stresses the logic under test.

How SHPBL Enforces Input Contracts

SHPBL tests software against explicit verification gates. When the certification harness evaluates an artifact, it separates harness boundaries from logic defects.

The harness reports one of four unambiguous verdicts: CERTIFIED, PROVISIONAL (reproducible execution where correctness is not yet formally asserted), INCONCLUSIVE, or FAILED. An INCONCLUSIVE verdict specifically marks a run where the harness could not exercise the input contract or hit harness limits—preventing a test setup issue from being misrecorded as an artifact defect.

All catalog components are model-independent and computed rather than generated. They ship with explicit boundaries tested against these strict domain matrices. You can inspect your own repository's contract coverage through a free repository evaluation.

What to Audit on Monday

Pick the slowest property-based test file in your continuous integration pipeline.

  1. Calculate the discard rate. Inspect how many iterations are skipped via assume(), pre(), or conditional returns. If the discard rate exceeds 10%, rewrite the generator to produce bounded valid states directly.
  2. Replace primitive generators. Find functions accepting primitive number or string arguments that represent validated concepts (such as email addresses, ports, or non-empty collections). Replace fc.string() with generators that enforce the target validation regex or length constraints.
  3. Audit edge-case generation. Verify that your constrained generators still emit zero values, max values, and boundary values within the valid domain. Bounding does not mean testing only the happy path; it means testing the true edges of your actual contract.

This post supports the longer argument in Certifying Software Invariants Across the Verification Ladder.

Keep reading

Next in the log

The Strategic Master Library · written and reviewed under the house's own epistemic rules: nothing claimed that we cannot show.