First cut of a new authoring surface for punit. Test configuration moves from parameterised annotations into typed builder calls inside the test method body. Statistical early termination and the wider feasibility-gate audit are deferred from this alpha.
org.javai:punit:0.7.0-alpha is on Maven Central. This is the first release of a new authoring style for punit — typed builders in the test method body — that replaces the parameterised annotations of 0.6.x. Module coordinates and artefact layout are unchanged; the change is what users write inside their tests.
What changed
In 0.6.x, test configuration sat on annotations: @ProbabilisticTest(samples = 100, minPassRate = 0.95, intent = SMOKE). The framework read those attributes by reflection, which forced configuration into the lowest-common-denominator types annotations support — strings, integers, class literals — and could not type-check against the use case under test.
In 0.7.0 the same configuration moves into the method body via a typed builder:
@ProbabilisticTest
void apiMeetsSla() {
PUnit.testing(apiCallSampling())
.criterion(PassRate.atLeast(0.95))
.intent(TestIntent.SMOKE)
.assertPasses();
}
Initial values for optimisation, factor records, matchers, and expected outputs are typed; the compiler sees them. The annotations remain as bare markers — @ProbabilisticTest, @Experiment — carrying no attributes. A use case is now an implementation of the typed UseCase<FT, I, O> interface, not an @UseCase-annotated class.
Migration
MIGRATION-0.6-to-0.7.md covers each breaking change with before-and-after code and a per-section FAQ. The guide also carries a self-contained coding-assistant prompt — paste it into Claude Code, Cursor, or any agent that can read and edit local files, and it will walk the codebase and apply the migration. There is no deprecation cycle and no 0.6.x-compatible shim.
Known gaps
This is an alpha. Two specific bodies of work are deferred and should not be assumed:
- Statistical early termination is not yet wired. The 0.6.x sample loop stopped early when the outcome became impossible (failure inevitable) or guaranteed (success guaranteed). The spec-engine refactor preserved the supporting model, but the per-sample evaluator and the
disableEarlyTermination()builder method on the probabilistic-test surface have not yet been re-added. Verdicts are correct — every test runs to its configured sample count and produces the right answer — but configurations that could have terminated after a few samples now run all of them. - Wider feasibility-gate audit. The pre-flight feasibility gate is wired correctly for the failure shape that motivated this release. Related invariants — soundness floor, parameter-bounds validation, configuration-coherence checks across the threshold-first / sample-size-first / confidence-first approaches — remain partially unchecked.
v0.x means the API may still change. If your project depends on 0.7.0-alpha’s surface today, pin to the exact version. Feedback is welcome at the issue tracker.
