Procedures: CallProcedure + ProcedureResult #11
Labels
No labels
area:defold
area:docs
area:infra
area:protocol
area:testing
kind:bug
kind:chore
phase:breadth
phase:core
phase:hardening
phase:slice
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
yuris/spacetimedb-defold#11
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Wire the procedure path symmetric to reducers. Handlers stubbed in connection.lua; needs tests and a live-module verification.
Closed in
a20f026A
ProcedureResulthandler already existed, but nothing could reach it — there was no send path — and it handed back the raw message. A procedure differs from a reducer in the one way that matters to a client: it returns a value.Verified against a real module
Added three procedures to the test module (u64 return, string return with args, one that throws), published, and captured the traffic. Four new fixture frames.
1. The return value is double-encoded — the same ByteString rule that bit reducer args in #4:
status.Returnedcount_messages→ u64"2"2echo("from lua")→ string"\"echo: from lua\""echo: from luaprotocol.decode_payloadunwraps it, so the callback gets a real Lua value.2. Every failure is
InternalError. A procedure that throws and a name that does not exist produce the same status, differing only in message:So there is no "no such procedure" variant to branch on.
Failedis in the schema but was never observed; it is handled anyway.3.
request_idcorrelates directly, not Option-wrapped likeSubscriptionError's.Generator limitation found on the way
The HTTP schema endpoint has no
procedureskey at all (2.8.2), thoughspacetime describe --jsonlists them fine. Sotools/gen-schema.shcannot emit procedure names — noted in the script header. Call them by canonical snake_case, same rule as reducers (countMessages→count_messages).Proof
Conformance runs a fourth phase in a real Defold engine, covering both the success and failure paths: