rfc: specify contract prefix and invariant publication constraints

This commit is contained in:
dev committed 2026-10-09 07:14:41 +03:00
1 parent 11725ad1c3
commit 8cd933538b
3 files changed
+61 -13

No files matched your search

+10
View File
@@ -399,8 +399,18 @@ P6-6 requires contracts and their four audit statuses, but spec 13 §1/spec 08
[RFC 0039](../rfcs/0039-verifier-visible-contracts.md) is a Draft spec gate covering requires/ensures and preserving the unresolved type/module invariant work. Decide complete rules before implementation; function-boundary checks alone do not establish value invariants, and source 0.1 has no module-state/visibility declaration surface. No semantic policy, feature or code is introduced by this entry.
2026-10-09: the candidate function representation now uses a leading `contract.pre/old/post` prefix; all three isolated spellings currently reject E0004, avoiding Q-055's header-specific E0001 conflict. The used-result probe additionally reports E5001; complete rejection-code compatibility remains to be audited. Deferred post bindings require ordinary access checks at every return. Verified Range probes distinguish a repaired exclusive update from an invalid Copy escape and shared-reader overflow; exclusive-borrow end alone cannot establish publication coverage. Type/module invariant representation and predicate purity remain unresolved; no implementation is authorized.
## Q-055 — Feature-gated AIR headers and frozen rejection codes
Spec 07 §8.7 permits changes to earlier E0004/E0006 rejections, not E0001. Source inspection of the parser before commit `0086549` shows that an unfeatured `trusted "..."` header was parsed as a block label and failed while expecting `:`; current spec 13 §6.3 and the parser require E0006 `feature_not_declared`. RFC 0009 calls the header additive, although this diagnostic transition is outside the literal exception. The historical parser has not been executed in this audit.
Resolve this compatibility policy before using `trusted` as a precedent for new contract headers (Q-054). Preserving legacy E0001 parsing conflicts with §8.1's E0006 for an undeclared construct; replacing E0001 conflicts with §8.7. Instructions whose old rejection is E0004 or a new AIR version avoid this header conflict. Amending either rule is an owner decision, not implied by the implementation. No existing parser, diagnostic or stability rule changes here; other historical syntax extensions remain unaudited.
The opcode candidate needs a separate dependent-error audit: at `94414da`, `%old = contract.old @snapshot(%x)` followed by `add.checked.u64 %old, %x` reports both E0004 for the unknown opcode and E5001 for its undefined result. This body-use shape remains invalid under the candidate's contract-only snapshot rule; audit its rejection-code transition, not its acceptance. A snapshot used only by `contract.post` currently reports two E0004s without E5001. Establish how §8.7's named-opcode exception applies to combined rejections before claiming the entire extension compatible. An unrelated invalid SSA use must not be accepted merely because the same module also contains a new opcode.
## Q-056 — Source zeroability versus AIR zeroability
Spec 15 §4 calls `var x: T = zero` a lowering to `local.zero` for zeroable types, without naming a narrower source set. Spec 07a's `local.zero` includes structs whose fields are zeroable. At `94414da`, source `var range: Range = zero` with two u64 fields rejects E7006 `zero_not_zeroable`; AIR `local.alloc @Range` followed by `local.zero` accepts and runs. `src/frontend/lower.zig` restricts source zeroability to integers, bool and arrays of those types.
Decide whether source intentionally exposes that narrower set (and make spec 15 precise), or whether the missing structural lowering is an implementation gap. This entry changes neither layer. P6-6 invariant coverage must independently include the existing AIR construction path, regardless of the source decision.