Publish native arity and validate callback contracts before registration
Verify Tessera GUI / verify (push) Failing after 7m44s

This commit is contained in:
2026-10-22 12:03:24 +08:00
parent 50422f801a
commit 25275b515c
17 changed files with 297 additions and 35 deletions
+12 -3
View File
@@ -196,6 +196,10 @@ struct After {
desktop: ObjectRef,
}
impl NativeCallable for After {
fn arity(&self) -> Option<endor_core::CallArity> {
Some(endor_core::CallArity::exact(4))
}
fn invoke(&self, cx: &mut NativeContext<'_>, args: &[Value]) -> Result<NativeResult, VmError> {
if cx.store().is_read_only() {
return Err(invalid(
@@ -212,10 +216,11 @@ impl NativeCallable for After {
if !cx.store().object(callback)?.payload().is_function() {
return Err(invalid("task callback must be a Function"));
}
if cx
if !cx
.store()
.positional_parameter_count(callback)?
.is_some_and(|count| count != 0)
.call_arity(callback)?
.ok_or(invalid("task callback requires positional metadata"))?
.accepts(0)
{
return Err(invalid("task callback requires zero unbound parameters"));
}
@@ -323,6 +328,10 @@ struct Method {
desktop: ObjectRef,
}
impl NativeCallable for Method {
fn arity(&self) -> Option<endor_core::CallArity> {
Some(endor_core::CallArity::exact(1))
}
fn invoke(&self, cx: &mut NativeContext<'_>, args: &[Value]) -> Result<NativeResult, VmError> {
let [value] = args else {
return Err(invalid("Task methods accept no arguments"));