feat(contracts): runtime-checked requires preconditions + counterexample evidence (v1.7.0, Theme A-lite) - #72
Merged
Conversation
…xample evidence
Sprint 2 / Theme A-lite of the agentlanguages.dev competitive-borrow program.
Borrowed from Vera/Aver (design-by-contract) + Vow (counterexample = concrete
replayable input). NO SMT — consistent with the 1.5.0 'Decided' ruling.
- requires clauses compiled to runtime guards at function entry (reusing the
dormant Op::Assert; no bytecode bump). Functions without contracts emit none.
- Violation -> VmError::ContractViolation { message, counterexample }, where
counterexample is the offending args (positional, rendered) -> the replayable
input an auditor needs. Captured in the hash-chained audit log.
- Stable error_kind 'contract_violation' (retry: no, deterministic in inputs).
- ensures postconditions deferred (documented).
- Version 1.6.0 -> 1.7.0; CHANGELOG, README, ax-language reference,
docs/design-contracts-runtime.md.
- Tests: codegen emits/omits Assert, VM counterexample capture, satisfied path,
error classification.
|
Bench compare Threshold for regression: ≥ 10% slower mean.
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Sprint 2 / Theme A-lite — agentlanguages.dev competitive-borrow program
Borrowed from Vera/Aver (design-by-contract) and Vow (counterexample = concrete replayable input). No SMT/Z3 — consistent with the 1.5.0
Decidedruling against symbolic model checking; stays in Boruna's concrete-trace + replay philosophy. (User chose this lighter path over full Z3.)What
requires <expr>preconditions compiled to runtime guards at function entry (reusing the previously-dormantOp::Assert— no bytecode bump). Functions without contracts emit no guard.VmError::ContractViolation { message, counterexample }, wherecounterexampleis the offending arguments (positional, rendered) — the replayable input an auditor needs. Captured in the run's hash-chained audit log (tamper-evident).error_kindcontract_violation(retry: no — deterministic in inputs).ensurespostconditions deferred (documented).Gates (local, clippy 1.97)
compiler ✓ · vm ✓ · orchestrator ✓ (new contract + classify tests) · clippy
--all-targets --features serve✓ · fmt ✓.Release
1.6.0 → 1.7.0 (CHANGELOG, README badge). See
docs/design-contracts-runtime.md.