~/bend-docscommunity

ordinary_resource_system.bend checks

raw source on the hub · import bendvy-ecs-core@0.1.0.2/ordinary_resource_system.bend as Ordinary_resource_system

10 imports
import Base
import ./trace_facts.bend as TraceFacts
import ./ordinary_schema.bend as Schema
import ./ordinary_query_declaration.bend as Query
import ./world.bend as W
import ./system.bend as Sys
import ./resource.bend as Res
import ./transaction.bend as T
import ./commands.bend as Cmd
import ./capabilities.bend as Cap

Types

type Declaration source · line 16 · raw

@-S:Data -> @-R:Type -> @-H:Type -> @-Ops:Type -> Type

Static declaration: one ordinary identity supplies operational grant and metadata. Current resource operations replace the entire Resources owner, not one field. Retained whole-resource identity, access mode and operational grant. R may be affine Type; this declaration does not narrow replacement to a selected field. Raw declaration/adapters remain trusted, rather than authority created by strings.

type Owner source · line 64 · raw

@-S:Data -> @-Registry:Type -> @-kind:0xb2b0f04555daca474f0f77d0966945c9/ordinary_query_declaration.Mode -> Type

Affine registry owner plus presentation slot, indexed by declared access mode. Resource payload remains in World, not copied into this registration metadata.

type Defined source · line 68 · raw

@-S:Data -> @-World:Type -> @-Registry:Type -> @-kind:0xb2b0f04555daca474f0f77d0966945c9/ordinary_query_declaration.Mode -> Type

Registration result returning World in both branches; Defined retains registry in Owner and Rejected has no newly allocated runner owner.

Templates

template read source · line 20 · raw

@-S:Data -> @-C:Type -> @-R:Type -> @-E:Data -> @-V:Data -> @-project:(@_:R -> Pair(R, V)) -> @identity:0xb2b0f04555daca474f0f77d0966945c9/ordinary_schema.Resource<S, R> -> Declaration<S, R, 0xb2b0f04555daca474f0f77d0966945c9/transaction.Tx<0xb2b0f04555daca474f0f77d0966945c9/world.World<S, C, R, E>, E>, 0xb2b0f04555daca474f0f77d0966945c9/capabilities.ValueRead<0xb2b0f04555daca474f0f77d0966945c9/transaction.Tx<0xb2b0f04555daca474f0f77d0966945c9/world.World<S, C, R, E>, E>, V>>

Build whole-resource read declaration exposing detached V through an owner- returning projector. This supplies no setter and does not copy the actual R.

template write source · line 24 · raw

@-S:Data -> @-C:Type -> @-R:Type -> @-E:Data -> @-V:Data -> @-project:(@_:R -> Pair(R, V)) -> @identity:0xb2b0f04555daca474f0f77d0966945c9/ordinary_schema.Resource<S, R> -> Declaration<S, R, 0xb2b0f04555daca474f0f77d0966945c9/transaction.Tx<0xb2b0f04555daca474f0f77d0966945c9/world.World<S, C, R, E>, E>, 0xb2b0f04555daca474f0f77d0966945c9/capabilities.ValueWrite<0xb2b0f04555daca474f0f77d0966945c9/transaction.Tx<0xb2b0f04555daca474f0f77d0966945c9/world.World<S, C, R, E>, E>, R, V>>

Build whole-R read/replacement declaration. Setter consumes incoming R and journals displaced R for ordinary rollback; it returns no recovery receipt.

template grant source · line 27 · raw

@-S:Data -> @-R:Type -> @-H:Type -> @-Ops:Type -> @declaration:Declaration<S, R, H, Ops> -> Ops

Advanced declaration projection of operational caps; does not invoke them.

template clause source · line 31 · raw

@-S:Data -> @-R:Type -> @-H:Type -> @-Ops:Type -> @declaration:Declaration<S, R, H, Ops> -> 0xb2b0f04555daca474f0f77d0966945c9/ordinary_query_declaration.Clause<S>

Derive the resource key/mode clause from the same retained declaration.

template mode source · line 35 · raw

@-S:Data -> @-R:Type -> @-H:Type -> @-Ops:Type -> @declaration:Declaration<S, R, H, Ops> -> 0xb2b0f04555daca474f0f77d0966945c9/ordinary_query_declaration.Mode

Project the declared read/write mode without inspecting resource storage.

template descriptions source · line 41 · raw

@-S:Data -> @+kind:0xb2b0f04555daca474f0f77d0966945c9/ordinary_query_declaration.Mode -> @names:List<&2, String> -> List<&2, 0xb2b0f04555daca474f0f77d0966945c9/ordinary_query_declaration.Clause<S>>

Description allocation is explicit observation work, not registration work. Presentation adapter expanding access names into same-mode detached clauses. Does not validate grants, allocate a registry or invoke a resource operation.

template access source · line 46 · raw

@-S:Data -> @value:0xb2b0f04555daca474f0f77d0966945c9/ordinary_query_declaration.Clause<S> -> List<&2, String>

Project the singleton operational resource name used for registration metadata.

template returned source · line 49 · raw

@-S:Data -> @-C:Type -> @-R:Type -> @-E:Data -> @-Error:Data -> @-Out:Type -> @output:Out -> @result:0xb2b0f04555daca474f0f77d0966945c9/transaction.Returned<0xb2b0f04555daca474f0f77d0966945c9/world.World<S, C, R, E>, Error> -> 0xb2b0f04555daca474f0f77d0966945c9/system.Outcome<0xb2b0f04555daca474f0f77d0966945c9/world.World<S, C, R, E>, Error, Out>

template finished source · line 53 · raw

@-S:Data -> @-C:Type -> @-R:Type -> @-E:Data -> @-Error:Data -> @-Out:Type -> @result:Pair(0xb2b0f04555daca474f0f77d0966945c9/transaction.Tx<0xb2b0f04555daca474f0f77d0966945c9/world.World<S, C, R, E>, E>, Pair(0xb2b0f04555daca474f0f77d0966945c9/transaction.Outcome<Error>, Out)) -> 0xb2b0f04555daca474f0f77d0966945c9/system.Outcome<0xb2b0f04555daca474f0f77d0966945c9/world.World<S, C, R, E>, Error, Out>

template runner source · line 60 · raw

@-S:Data -> @-C:Type -> @-R:Type -> @-E:Data -> @-Ops:(@_:Type -> Type) -> @-Args:Type -> @-Error:Data -> @-Out:Type -> @-declaration:Declaration<S, R, 0xb2b0f04555daca474f0f77d0966945c9/transaction.Tx<0xb2b0f04555daca474f0f77d0966945c9/world.World<S, C, R, E>, E>, Ops(0xb2b0f04555daca474f0f77d0966945c9/transaction.Tx<0xb2b0f04555daca474f0f77d0966945c9/world.World<S, C, R, E>, E>)> -> @-body:(@-H:Type -> @-caps:Ops(H) -> @_:Args -> @_:H -> Pair(H, Pair(0xb2b0f04555daca474f0f77d0966945c9/transaction.Outcome<Error>, Out))) -> @world:0xb2b0f04555daca474f0f77d0966945c9/world.World<S, C, R, E> -> @args:Args -> 0xb2b0f04555daca474f0f77d0966945c9/system.Outcome<0xb2b0f04555daca474f0f77d0966945c9/world.World<S, C, R, E>, Error, Out>

Invoke the opaque-owner body in one fresh ECS transaction with declaration caps. Args and Out may own Type payloads. Success returns Out; failure rolls back recorded ECS edits and discards Out. Deferred commands require a later barrier; ordinary rollback is not owned recovery or reversal of external callback effects.

template registered source · line 71 · raw

@-S:Data -> @-C:Type -> @-R:Type -> @-E:Data -> @-Args:Type -> @-Error:Data -> @-Out:Type -> @-kind:0xb2b0f04555daca474f0f77d0966945c9/ordinary_query_declaration.Mode -> @-run:(@_:0xb2b0f04555daca474f0f77d0966945c9/world.World<S, C, R, E> -> @_:Args -> 0xb2b0f04555daca474f0f77d0966945c9/system.Outcome<0xb2b0f04555daca474f0f77d0966945c9/world.World<S, C, R, E>, Error, Out>) -> @slot:String -> @result:0xb2b0f04555daca474f0f77d0966945c9/system.RegistrationResult<S, C, R, E, Args, Error, Out, run> -> Defined<S, 0xb2b0f04555daca474f0f77d0966945c9/world.World<S, C, R, E>, 0xb2b0f04555daca474f0f77d0966945c9/system.Registry<S, C, R, E, Args, Error, Out, run>, kind>

template define source · line 78 · raw

@-S:Data -> @-C:Type -> @-R:Type -> @-E:Data -> @-Ops:(@_:Type -> Type) -> @-Args:Type -> @-Error:Data -> @-Out:Type -> @-declaration:Declaration<S, R, 0xb2b0f04555daca474f0f77d0966945c9/transaction.Tx<0xb2b0f04555daca474f0f77d0966945c9/world.World<S, C, R, E>, E>, Ops(0xb2b0f04555daca474f0f77d0966945c9/transaction.Tx<0xb2b0f04555daca474f0f77d0966945c9/world.World<S, C, R, E>, E>)> -> @-body:(@-H:Type -> @-caps:Ops(H) -> @_:Args -> @_:H -> Pair(H, Pair(0xb2b0f04555daca474f0f77d0966945c9/transaction.Outcome<Error>, Out))) -> @world:0xb2b0f04555daca474f0f77d0966945c9/world.World<S, C, R, E> -> @name:String -> @slot:String -> Defined<S, 0xb2b0f04555daca474f0f77d0966945c9/world.World<S, C, R, E>, 0xb2b0f04555daca474f0f77d0966945c9/system.Registry<S, C, R, E, Args, Error, Out, runner(S, C, R, E, Ops, Args, Error, Out, declaration, body)>, mode(S, R, 0xb2b0f04555daca474f0f77d0966945c9/transaction.Tx<0xb2b0f04555daca474f0f77d0966945c9/world.World<S, C, R, E>, E>, Ops(0xb2b0f04555daca474f0f77d0966945c9/transaction.Tx<0xb2b0f04555daca474f0f77d0966945c9/world.World<S, C, R, E>, E>), declaration)>

Register the declaration-bound runner with its derived access. slot is retained for presentation and does not change operational resource authority. No body runs at registration. See the named-app matched-feature fixture under test-fixtures.

template run source · line 84 · raw

@-S:Data -> @-C:Type -> @-R:Type -> @-E:Data -> @-Args:Type -> @-Error:Data -> @-Out:Type -> @-kind:0xb2b0f04555daca474f0f77d0966945c9/ordinary_query_declaration.Mode -> @-runner:(@_:0xb2b0f04555daca474f0f77d0966945c9/world.World<S, C, R, E> -> @_:Args -> 0xb2b0f04555daca474f0f77d0966945c9/system.Outcome<0xb2b0f04555daca474f0f77d0966945c9/world.World<S, C, R, E>, Error, Out>) -> @owner:Owner<S, 0xb2b0f04555daca474f0f77d0966945c9/system.Registry<S, C, R, E, Args, Error, Out, runner>, kind> -> @world:0xb2b0f04555daca474f0f77d0966945c9/world.World<S, C, R, E> -> @args:Args -> Pair(0xb2b0f04555daca474f0f77d0966945c9/system.RunResult<S, C, R, E, Args, Error, Out, runner>, String)

Registry's existing namespace and registration checks remain authoritative. Run tracked registration, returning its full success/refusal result plus slot. Refusal retains actual registry, World and Args under Sys.RunResult; successful execution returns callback Out, while callback failure does not return Out.

template describe source · line 91 · raw

@-S:Data -> @-C:Type -> @-R:Type -> @-E:Data -> @-Args:Type -> @-Error:Data -> @-Out:Type -> @-kind:0xb2b0f04555daca474f0f77d0966945c9/ordinary_query_declaration.Mode -> @-runner:(@_:0xb2b0f04555daca474f0f77d0966945c9/world.World<S, C, R, E> -> @_:Args -> 0xb2b0f04555daca474f0f77d0966945c9/system.Outcome<0xb2b0f04555daca474f0f77d0966945c9/world.World<S, C, R, E>, Error, Out>) -> @owner:Owner<S, 0xb2b0f04555daca474f0f77d0966945c9/system.Registry<S, C, R, E, Args, Error, Out, runner>, kind> -> Pair(Owner<S, 0xb2b0f04555daca474f0f77d0966945c9/system.Registry<S, C, R, E, Args, Error, Out, runner>, kind>, List<&2, 0xb2b0f04555daca474f0f77d0966945c9/ordinary_query_declaration.Clause<S>>)

Called by an enabled debug bridge; actual Registry is borrowed and reconstructed. Enabled-observation adapter returning actual Owner and detached access clauses. Does not inspect resource payloads or grant access from the presentation slot.

template returned_observed source · line 96 · raw

@-S:Data -> @-C:Type -> @-R:Type -> @-E:Data -> @-Error:Data -> @-Out:Type -> @output:Out -> @result:Pair(0xb2b0f04555daca474f0f77d0966945c9/transaction.Returned<0xb2b0f04555daca474f0f77d0966945c9/world.World<S, C, R, E>, Error>, 0xb2b0f04555daca474f0f77d0966945c9/trace_facts.State) -> Pair(0xb2b0f04555daca474f0f77d0966945c9/system.Outcome<0xb2b0f04555daca474f0f77d0966945c9/world.World<S, C, R, E>, Error, Out>, 0xb2b0f04555daca474f0f77d0966945c9/trace_facts.State)

template finished_observed source · line 103 · raw

@-S:Data -> @-C:Type -> @-R:Type -> @-E:Data -> @-Error:Data -> @-Out:Type -> @result:Pair(0xb2b0f04555daca474f0f77d0966945c9/transaction.Tx<0xb2b0f04555daca474f0f77d0966945c9/world.World<S, C, R, E>, E>, Pair(0xb2b0f04555daca474f0f77d0966945c9/transaction.Outcome<Error>, Out)) -> Pair(0xb2b0f04555daca474f0f77d0966945c9/system.Outcome<0xb2b0f04555daca474f0f77d0966945c9/world.World<S, C, R, E>, Error, Out>, 0xb2b0f04555daca474f0f77d0966945c9/trace_facts.State)

Same user body and grants, with detached transaction facts returned beside it. Advanced runner finish adapter retaining detached transaction facts separately from World outcome. Same commit/rollback and failure-Out disposal as runner; attempted facts are not evidence that failed transaction writes committed.