feat: release Dever 0.1.5 with direct workers and long transactions

This commit is contained in:
Codex committed 2026-10-11 11:17:33 +00:00
1 parent 89629c2197
commit a900d7e8db
153 files changed
+3676 -3708

No files matched your search

+70
View File
@@ -11,6 +11,76 @@ const ADAPTER: &str = "port.read() (value: Int) { value = 7 }";
const COMMAND_PORT: &str = "execute(args: List<Text>, stdin: Bytes?) (output: dever.process.Output) fails dever.process.Error";
const COMMAND_APP: &str = "read() (value: Int) { output = port.execute([\"argument with spaces\"], null)\n value = output.code }";
#[test]
fn external_worker_orchestration_requires_an_explicit_long_entry() {
for adapter in [
"external exec \"worker/mail\" {}",
"external exec \"worker/mail\" { allow gpu }",
] {
for long in [false, true] {
let entry = if long {
"long cmd read = app.read"
} else {
"cmd read = app.read"
};
let source = sources(
PORT,
adapter,
&[
("notification/mail/model.dever", "type Mail { value: Int }"),
(
"notification/mail/app.dever",
"type ReadResult { Read(value: Int)\n error Unavailable(message: Text) }\nread() (value: Int) { value = port.read()\nstore(value) }\ntransaction store(value: Int) () { stored = model.create({ value = value }) }",
),
("notification/mail/api.dever", entry),
],
);
if long {
let program =
dever_core::check(&source).unwrap_or_else(|errors| panic!("{errors:?}"));
let native = dever_core::native::emit_project(
&program,
&source,
dever_runtime::config::RuntimeProfile {
sqlite: true,
postgres: false,
},
)
.unwrap();
assert!(!native.contains("let transaction = transaction_database.begin()"));
dever_core::llvm::emit_application(&program, &source).unwrap();
} else {
rejected(&source, "declare the entry 'long'");
}
}
}
}
#[test]
fn transactions_reject_external_workers_even_without_declared_io_capabilities() {
for adapter in [
"external exec \"worker/mail\" {}",
"external exec \"worker/mail\" { allow gpu }",
] {
let source = sources(
PORT,
adapter,
&[
("notification/mail/model.dever", "type Mail { value: Int }"),
(
"notification/mail/app.dever",
"type ReadResult { Read(value: Int)\n error Unavailable(message: Text) }\ntransaction save() (value: Int) { value = port.read()\nstored = model.create({ value = value }) }",
),
("notification/mail/api.dever", "cmd save = app.save"),
],
);
rejected(
&source,
"transaction functions cannot start concurrent work or external I/O",
);
}
}
fn command_sources(port: &str, adapter: &str, app: &str) -> SourceMap {
sources(port, adapter, &[("notification/mail/app.dever", app)])
}