tests: extend audited rejection twins through tasks and locks
This commit is contained in:
1 parent
e4aacef48c
commit
272aebfd32
16 files changed
+157
-13
No files matched your search
@@ -317,3 +317,9 @@ Validation: units and Zig formatting pass; full conformance is 1,642/1,642. All
|
||||
Pairs compare operation/site, resource family, identity roles and stable rule facts, then independently check marked primary/related source positions against canonical AIR annotations. Early declaration errors and function budget sites have explicit checks; raw errors use spec 15 §10's exact duplicate projection. Cancellation witnesses preserve the reviewed regression context. Manual rule audits remain necessary. CI runs both the partial checker and 21 negative/positive checker regressions, including wrong operation, ordering, resource family, source position, related role and cancellation context. No compiler, verifier, runtime, normative rule, diagnostic code or reference bundle changes.
|
||||
|
||||
Validation: unit tests and Zig formatting pass; full conformance is 1,655/1,655. All 13 new source fixtures pass collection before every instruction. The pair checker verifies 27/199 and reports incomplete coverage; its completion gate rejects that inventory. Existing borrow-return, related-position and source-coverage checks pass (133, 355 and 121/121 respectively). Claude independently audited Phase 0–1 cases and reviewed the checker; its false-pair findings are covered by regression probes.
|
||||
|
||||
## P6-7 Phase 1–3 rejection-twin audit (2026-10-08)
|
||||
|
||||
Thirteen further audited pairs bring verified same-code coverage to 40/199. Twelve link existing source tests for owner/file/receiver leaks, use after transfer, missing allocation effects, unchecked access, live children/task loans and waiting under a mutex guard. One new source fixture checks local.store with a live shared borrow, including its related conflict position. Seven additional generated-only cases are documented: explicit borrow ends, unmatched lexical cleanup, reserved borrow-join parameters and a missing feature dependency. The legacy reserved_feature fixture's comment now describes its actual missing_dependency rejection; its body and permanent name are unchanged. The inventory retains 133 pending, four E7xxx analogues and 22 AIR-only cases, all still unmet under Q-053. P6-7 remains doing.
|
||||
|
||||
Validation: full conformance is 1,656/1,656; unit tests, Zig formatting, all 21 checker regressions and the 40-pair source/AIR position check pass. The new fixture passes collection before every instruction; the completion gate still rejects partial coverage. Claude independently audited the pairs, checked the receiver's success/return path and reviewed generated-only classifications. No compiler, verifier, runtime, normative rule, diagnostic code or reference bundle changes.
|
||||
@@ -1,4 +1,4 @@
|
||||
; heap is registered but reserved until Phase 2 publishes it.
|
||||
; Legacy reserved-feature fixture: heap is now published, but its required dependencies are missing.
|
||||
; expect: reject E0006
|
||||
; phase: 0
|
||||
; spec: docs/spec/07-air.md
|
||||
|
||||
@@ -86,6 +86,11 @@
|
||||
"rule": "Node contains itself by value; source declaration validation retains E1003 (Q-043/Q-044).",
|
||||
"lowering": "rejected"
|
||||
},
|
||||
"phase0/reject/reserved_feature.air": {
|
||||
"kind": "air_only",
|
||||
"spec": "docs/spec/15-source-language.md \u00a79",
|
||||
"rule": "This legacy heap header now rejects missing_dependency (capabilities), not a reserved feature. Source generates the full dependency closure and cannot spell the faulty header."
|
||||
},
|
||||
"phase0/reject/terminator_mid_block.air": {
|
||||
"kind": "air_only",
|
||||
"spec": "docs/spec/15-source-language.md \u00a71",
|
||||
@@ -122,6 +127,16 @@
|
||||
"spec": "docs/spec/15-source-language.md \u00a71",
|
||||
"rule": "local.alloc placement is chosen by lowering; source has no instruction-placement operation."
|
||||
},
|
||||
"phase1/reject/borrow_block_parameter.air": {
|
||||
"kind": "air_only",
|
||||
"spec": "docs/spec/15-source-language.md \u00a75/\u00a719",
|
||||
"rule": "Borrow-typed branch block arguments require reserved borrow_joins. Source binds borrows only with ref/mut, never in an assignable var, and forbids yielding them from blocks/if/match; branches may return directly. Region allocation outcome parameters do not request borrow_joins."
|
||||
},
|
||||
"phase1/reject/borrow_not_ended.air": {
|
||||
"kind": "air_only",
|
||||
"spec": "docs/spec/15-source-language.md \u00a79",
|
||||
"rule": "Source ends every non-returned lexical borrow on a normal return; it has no operation to omit that generated end."
|
||||
},
|
||||
"phase1/reject/borrow_return_without_from.air": {
|
||||
"kind": "source_error",
|
||||
"spec": "docs/spec/15-source-language.md \u00a719",
|
||||
@@ -138,6 +153,21 @@
|
||||
}
|
||||
]
|
||||
},
|
||||
"phase1/reject/borrow_use_after_end.air": {
|
||||
"kind": "air_only",
|
||||
"spec": "docs/spec/15-source-language.md \u00a79",
|
||||
"rule": "A borrow binding is no longer visible after its lexical end; source cannot use an explicitly ended borrow."
|
||||
},
|
||||
"phase1/reject/end_lent_parameter.air": {
|
||||
"kind": "air_only",
|
||||
"spec": "docs/spec/15-source-language.md \u00a79",
|
||||
"rule": "Source does not explicitly end a lent borrow parameter; generated cleanup ends owned lexical bindings instead."
|
||||
},
|
||||
"phase1/reject/end_parent_first.air": {
|
||||
"kind": "air_only",
|
||||
"spec": "docs/spec/15-source-language.md \u00a79",
|
||||
"rule": "Source generates lexical ends in reverse creation order and transfers returned ancestors; it cannot request parent-before-child cleanup. Task-loan conflicts with such cleanup use E4302 instead; they are covered by separate twins."
|
||||
},
|
||||
"phase1/reject/feature_not_declared.air": {
|
||||
"kind": "air_only",
|
||||
"spec": "docs/spec/15-source-language.md \u00a79",
|
||||
@@ -155,6 +185,11 @@
|
||||
"spec": "docs/spec/08-verifier.md",
|
||||
"rule": "The same deterministic budget is exceeded, with identical limit/max/found/type facts."
|
||||
},
|
||||
"phase1/reject/join_mismatch.air": {
|
||||
"kind": "air_only",
|
||||
"spec": "docs/spec/15-source-language.md \u00a79",
|
||||
"rule": "Source lexical cleanup ends a borrow on every normal exit from its scope; explicit unmatched borrow.end edges are generated mechanics."
|
||||
},
|
||||
"phase1/reject/le_is_not_a_fact.air": {
|
||||
"kind": "air_only",
|
||||
"spec": "docs/spec/15-source-language.md \u00a75",
|
||||
@@ -171,6 +206,12 @@
|
||||
"spec": "docs/spec/15-source-language.md \u00a74",
|
||||
"rule": "Source local declarations require an initializer; there is no uninitialized frame-local declaration."
|
||||
},
|
||||
"phase1/reject/related_borrow_live.air": {
|
||||
"kind": "same_code",
|
||||
"site": "instruction",
|
||||
"spec": "docs/spec/08-verifier.md \u00a711.2",
|
||||
"rule": "local.store writes a local with a live shared borrow, retaining that borrow as the related conflict."
|
||||
},
|
||||
"phase1/reject/size_overflow.air": {
|
||||
"kind": "same_code",
|
||||
"site": "function",
|
||||
@@ -183,18 +224,36 @@
|
||||
"spec": "docs/spec/08-verifier.md",
|
||||
"rule": "The same deterministic budget is exceeded, with identical limit/max/found/type facts."
|
||||
},
|
||||
"phase2/reject/alloc_without_effect.air": {
|
||||
"kind": "same_code",
|
||||
"site": "instruction",
|
||||
"spec": "docs/spec/05-effects-and-capabilities.md",
|
||||
"rule": "own.new lacks mem.alloc; the missing effect and complete suggested list agree."
|
||||
},
|
||||
"phase2/reject/own_free_while_borrowed.air": {
|
||||
"kind": "same_code",
|
||||
"site": "instruction",
|
||||
"spec": "docs/spec/03-memory-model.md",
|
||||
"rule": "The same owning-resource consumption or whole-place borrow conflicts with a live borrow."
|
||||
},
|
||||
"phase2/reject/own_leak.air": {
|
||||
"kind": "same_code",
|
||||
"site": "instruction",
|
||||
"spec": "docs/spec/06-resources-and-errors.md \u00a76.3",
|
||||
"rule": "An allocated owner reaches return without consumption."
|
||||
},
|
||||
"phase2/reject/own_use_after_free.air": {
|
||||
"kind": "same_code",
|
||||
"site": "instruction",
|
||||
"spec": "docs/spec/03-memory-model.md",
|
||||
"rule": "A closed/freed resource is borrowed again."
|
||||
},
|
||||
"phase2/reject/own_use_after_move.air": {
|
||||
"kind": "same_code",
|
||||
"site": "instruction",
|
||||
"spec": "docs/spec/06-resources-and-errors.md \u00a76.2",
|
||||
"rule": "An owner transferred to a consuming call is subsequently borrowed."
|
||||
},
|
||||
"phase2/reject/region_destroy_with_live_reference.air": {
|
||||
"kind": "same_code",
|
||||
"site": "instruction",
|
||||
@@ -231,12 +290,24 @@
|
||||
"spec": "docs/spec/08-verifier.md \u00a711.4",
|
||||
"rule": "The same file is closed on one incoming edge and still live on another."
|
||||
},
|
||||
"phase2/reject/resource_leak.air": {
|
||||
"kind": "same_code",
|
||||
"site": "instruction",
|
||||
"spec": "docs/spec/06-resources-and-errors.md \u00a76.3",
|
||||
"rule": "An opened file<read> reaches return without close."
|
||||
},
|
||||
"phase2/reject/resource_use_after_close.air": {
|
||||
"kind": "same_code",
|
||||
"site": "instruction",
|
||||
"spec": "docs/spec/06-resources-and-errors.md",
|
||||
"rule": "A closed/freed resource is borrowed again."
|
||||
},
|
||||
"phase2/reject/unsafe_outside_boundary.air": {
|
||||
"kind": "same_code",
|
||||
"site": "instruction",
|
||||
"spec": "docs/spec/13-contracts-and-unsafe.md \u00a76",
|
||||
"rule": "borrow.index.unchecked occurs outside an unsafe or trusted function."
|
||||
},
|
||||
"phase3/reject/cancel_join_keeps_loans.air": {
|
||||
"kind": "same_code",
|
||||
"site": "instruction",
|
||||
@@ -255,12 +326,54 @@
|
||||
"task.join.cancel": 2
|
||||
}
|
||||
},
|
||||
"phase3/reject/channels_receiver_leak.air": {
|
||||
"kind": "same_code",
|
||||
"site": "instruction",
|
||||
"spec": "docs/spec/06-resources-and-errors.md \u00a76.3",
|
||||
"rule": "A channel receiver remains unclosed at return after its sender is closed. The source success arm passes through a single-predecessor match join; the allocation failure arm traps."
|
||||
},
|
||||
"phase3/reject/sync_call_waiting_function.air": {
|
||||
"kind": "same_code",
|
||||
"site": "instruction",
|
||||
"spec": "docs/spec/04-concurrency-and-atomics.md \u00a741",
|
||||
"rule": "A function declaring task.wait is called while a mutex guard is held."
|
||||
},
|
||||
"phase3/reject/sync_lock_twice.air": {
|
||||
"kind": "same_code",
|
||||
"site": "instruction",
|
||||
"spec": "docs/spec/04-concurrency-and-atomics.md \u00a741",
|
||||
"rule": "A second mutex.lock may wait while the first guard is held."
|
||||
},
|
||||
"phase3/reject/sync_wait_while_locked.air": {
|
||||
"kind": "same_code",
|
||||
"site": "instruction",
|
||||
"spec": "docs/spec/04-concurrency-and-atomics.md \u00a741",
|
||||
"rule": "channel.recv may wait while a mutex guard is held."
|
||||
},
|
||||
"phase3/reject/tasks_access_lent.air": {
|
||||
"kind": "same_code",
|
||||
"site": "instruction",
|
||||
"spec": "docs/spec/04-concurrency-and-atomics.md \u00a734",
|
||||
"rule": "The parent indexes an exclusive slice lent to an unjoined task; raw borrow.index/load errors share one source location."
|
||||
},
|
||||
"phase3/reject/tasks_end_lent_borrow.air": {
|
||||
"kind": "same_code",
|
||||
"site": "instruction",
|
||||
"spec": "docs/spec/04-concurrency-and-atomics.md",
|
||||
"rule": "The lent borrow is ended while its task remains unjoined; the creating spawn is retained."
|
||||
},
|
||||
"phase3/reject/tasks_same_mut_twice.air": {
|
||||
"kind": "same_code",
|
||||
"site": "instruction",
|
||||
"spec": "docs/spec/04-concurrency-and-atomics.md \u00a734",
|
||||
"rule": "The same exclusive borrow is lent to a second task while the first task remains live."
|
||||
},
|
||||
"phase3/reject/tasks_scope_end_unjoined.air": {
|
||||
"kind": "same_code",
|
||||
"site": "instruction",
|
||||
"spec": "docs/spec/04-concurrency-and-atomics.md \u00a733",
|
||||
"rule": "A task scope ends while a child task remains unjoined."
|
||||
},
|
||||
"phase4/reject/arc_release_twice.air": {
|
||||
"kind": "same_code",
|
||||
"site": "instruction",
|
||||
|
||||
@@ -3,10 +3,11 @@
|
||||
// phase: 6
|
||||
// spec: docs/spec/15-source-language.md
|
||||
module demo.leak
|
||||
// AIR twin: phase2/reject/own_leak.air
|
||||
|
||||
fn main(heap: cap<mem.alloc>) -> u64
|
||||
effects [mem.alloc]
|
||||
{
|
||||
let x = own.new(1u64, heap) or trap;
|
||||
7
|
||||
7 // diagnostic here
|
||||
}
|
||||
@@ -3,10 +3,11 @@
|
||||
// phase: 6
|
||||
// spec: docs/spec/15-source-language.md
|
||||
module demo.missingeffect
|
||||
// AIR twin: phase2/reject/alloc_without_effect.air
|
||||
|
||||
fn main(heap: cap<mem.alloc>) -> u64
|
||||
effects []
|
||||
{
|
||||
let x = own.new(1u64, heap) or trap;
|
||||
let x = own.new(1u64, heap) or trap; // diagnostic here: own.new
|
||||
own.take(move x)
|
||||
}
|
||||
@@ -3,6 +3,7 @@
|
||||
// phase: 6
|
||||
// spec: docs/spec/15-source-language.md
|
||||
module demo.useaftermove
|
||||
// AIR twin: phase2/reject/own_use_after_move.air
|
||||
|
||||
fn sink(o: own<u64>) -> void
|
||||
effects []
|
||||
@@ -21,5 +22,5 @@ effects [mem.alloc]
|
||||
{
|
||||
let x = own.new(1u64, heap) or trap;
|
||||
sink(move x);
|
||||
read(ref x)
|
||||
read(ref x) // diagnostic here: ref
|
||||
}
|
||||
@@ -3,9 +3,10 @@
|
||||
// phase: 6
|
||||
// spec: docs/spec/15-source-language.md
|
||||
module demo.resourceleak
|
||||
// AIR twin: phase2/reject/resource_leak.air
|
||||
|
||||
fn main(src: cap<fs.read>) -> void
|
||||
effects [fs.read]
|
||||
{
|
||||
{ // diagnostic here
|
||||
let f = fs.open_read(src, b"/in/a") or trap;
|
||||
}
|
||||
@@ -3,11 +3,12 @@
|
||||
// phase: 6
|
||||
// spec: docs/spec/13-contracts-and-unsafe.md
|
||||
module demo.unsafeboundary
|
||||
// AIR twin: phase2/reject/unsafe_outside_boundary.air
|
||||
|
||||
fn get(s: slice<u64>, i: usize) -> u64
|
||||
effects []
|
||||
{
|
||||
ref unchecked e = s[i];
|
||||
ref unchecked e = s[i]; // diagnostic here
|
||||
*e
|
||||
}
|
||||
|
||||
|
||||
@@ -3,6 +3,7 @@
|
||||
// phase: 6
|
||||
// spec: docs/spec/15-source-language.md
|
||||
module demo.access_lent
|
||||
// AIR twin: phase3/reject/tasks_access_lent.air
|
||||
|
||||
fn bump(s: slice_mut<u64>) -> void
|
||||
effects []
|
||||
@@ -20,7 +21,7 @@ effects [task.spawn]
|
||||
let (l, r) = s.split_at(2);
|
||||
scope sc {
|
||||
let a = task.spawn(sc, bump, l);
|
||||
seen = l[0];
|
||||
seen = l[0]; // diagnostic here: l[0]
|
||||
task.join(move a);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3,11 +3,12 @@
|
||||
// phase: 6
|
||||
// spec: docs/spec/15-source-language.md
|
||||
module demo.receiver_leak
|
||||
// AIR twin: phase3/reject/channels_receiver_leak.air
|
||||
|
||||
fn main(heap: cap<mem.alloc>) -> u64
|
||||
effects [mem.alloc, task.wait]
|
||||
{
|
||||
match channel.make<u64>(1, heap) {
|
||||
match channel.make<u64>(1, heap) { // diagnostic here
|
||||
ok(tx, rx) => {
|
||||
channel.close_sender(move tx);
|
||||
0
|
||||
|
||||
@@ -3,6 +3,7 @@
|
||||
// phase: 6
|
||||
// spec: docs/spec/15-source-language.md
|
||||
module demo.same_mut_twice
|
||||
// AIR twin: phase3/reject/tasks_same_mut_twice.air
|
||||
|
||||
fn bump(s: slice_mut<u64>) -> void
|
||||
effects []
|
||||
@@ -18,7 +19,7 @@ effects [task.spawn]
|
||||
mut s = buf;
|
||||
scope sc {
|
||||
let a = task.spawn(sc, bump, s);
|
||||
let b = task.spawn(sc, bump, s);
|
||||
let b = task.spawn(sc, bump, s); // diagnostic here: task.spawn
|
||||
task.join(move a);
|
||||
task.join(move b);
|
||||
}
|
||||
|
||||
@@ -3,6 +3,7 @@
|
||||
// phase: 6
|
||||
// spec: docs/spec/15-source-language.md
|
||||
module demo.scope_unjoined
|
||||
// AIR twin: phase3/reject/tasks_scope_end_unjoined.air
|
||||
|
||||
fn work() -> u64
|
||||
effects []
|
||||
@@ -13,7 +14,7 @@ effects []
|
||||
fn main() -> u64
|
||||
effects [task.spawn]
|
||||
{
|
||||
scope sc {
|
||||
scope sc { // diagnostic here: {
|
||||
let t = task.spawn(sc, work);
|
||||
}
|
||||
0
|
||||
|
||||
@@ -3,6 +3,7 @@
|
||||
// phase: 6
|
||||
// spec: docs/spec/15-source-language.md
|
||||
module demo.call_waiting_function
|
||||
// AIR twin: phase3/reject/sync_call_waiting_function.air
|
||||
|
||||
fn pause() -> void
|
||||
effects [task.wait]
|
||||
@@ -14,7 +15,7 @@ effects [task.wait]
|
||||
{
|
||||
let m = mutex.make(0u64);
|
||||
lock ref m as c {
|
||||
pause();
|
||||
pause(); // diagnostic here
|
||||
*c = 1;
|
||||
} cancelled {}
|
||||
mutex.take(move m)
|
||||
|
||||
@@ -3,6 +3,7 @@
|
||||
// phase: 6
|
||||
// spec: docs/spec/15-source-language.md
|
||||
module demo.lock_twice
|
||||
// AIR twin: phase3/reject/sync_lock_twice.air
|
||||
|
||||
fn main() -> u64
|
||||
effects [task.wait]
|
||||
@@ -10,7 +11,7 @@ effects [task.wait]
|
||||
let a = mutex.make(0u64);
|
||||
let b = mutex.make(0u64);
|
||||
lock ref a as x {
|
||||
lock ref b as y {
|
||||
lock ref b as y { // diagnostic here
|
||||
*y = *x;
|
||||
} cancelled {}
|
||||
} cancelled {}
|
||||
|
||||
@@ -3,6 +3,7 @@
|
||||
// phase: 6
|
||||
// spec: docs/spec/15-source-language.md
|
||||
module demo.wait_while_locked
|
||||
// AIR twin: phase3/reject/sync_wait_while_locked.air
|
||||
|
||||
fn main(heap: cap<mem.alloc>) -> u64
|
||||
effects [mem.alloc, task.wait]
|
||||
@@ -11,7 +12,7 @@ effects [mem.alloc, task.wait]
|
||||
match channel.make<u64>(1, heap) {
|
||||
ok(tx, rx) => {
|
||||
lock ref m as c {
|
||||
*c = channel.recv(rx) or trap;
|
||||
*c = channel.recv(rx) or trap; // diagnostic here: channel.recv
|
||||
} cancelled {}
|
||||
channel.close_sender(move tx);
|
||||
channel.close_receiver(move rx) or trap;
|
||||
|
||||
@@ -0,0 +1,13 @@
|
||||
// A direct local store conflicts with a live shared view.
|
||||
// expect: reject E2101
|
||||
// phase: 6
|
||||
// spec: docs/spec/08-verifier.md §11.2
|
||||
// AIR twin: phase1/reject/related_borrow_live.air
|
||||
module test.source_store_with_live_borrow
|
||||
|
||||
fn main() -> u64 effects [] {
|
||||
var data: u64 = 0;
|
||||
ref view = data;
|
||||
data = 2; // diagnostic here
|
||||
return *view;
|
||||
}
|
||||
Reference in new issue
Block a user