Files
base/core/record_model_functions.go
zeekayandHanzo Dev 6f05491bcc a function is a record, and it reads as whoever invoked it
Both halves of this existed and neither was a function: one runtime knew how
to invoke by name and bound no host, the other bound every host and could not
invoke. They are joined through the runtime interface that was already here
and used by nothing outside its own tests.

A function lives in a collection, so it is the tenant's own file, its rules
are the rules, and the two doors — the collection and /v1/functions — refuse
in the same words because there is one rule. The source is the server's: a
caller who may see that a function exists does not get what it says.

What a function may ask for is two reads of the Base it is running in, and
that is the whole host. Not the app, not a process, not a file, not the
network — a name bound in a first version is bound for good, so the list is
what a function needs and nothing anticipated.

It reads as its caller. The collection comes from the Base the credential
already resolved, and the rule from the caller's own identity, so a function
renders what the caller could have read and is never a way around them. The
payload does not answer a rule: `@request.body` is about a write, and letting
an invocation body speak for it would let a caller satisfy a read rule by
naming a field they sent.

Invoking counts under its own action, because running code is the cost.
A function that does not finish is stopped.

Co-authored-by: Hanzo Dev <[email protected]>
2026-08-13 19:56:34 -07:00

6 lines
206 B
Go

package core
// CollectionNameFunctions is where a Base keeps the functions it runs. One row
// is one function: its id is its name and its source is its body.
const CollectionNameFunctions = "_functions"