Bolt-on capabilities — worked graph designs

These designs describe intended system behavior and qualification requirements. Inspect the system atlas for named ports and relation participants.

Navigation: nested containers, deep links and modal return

How does a route cross a nested feature boundary?

Inspect this design · Definition JSON · revision ee9f93df80a6

Diagram legend. Frames are named graph regions. Left/right pins show required/offered participation, not a universal schedule. Filled pins are connected; hollow pins are unbound. A junction card preserves one relation's role slots.

MarkerMeaning in this diagram
↪ N12Route / navigation
⌘ N10Function / blueprint region
▤ N11Surface / view component
⊂ N33Policy / principal boundary
▷ P11Execution / continuation
⊕ P19Capability descriptor
◎ P24Inspection / evidence
⊂ P20Authorization request / grant
↪ H36Navigation / interaction route
⇥ H30Boundary export / alias
⊂ H23Scoped authorization
⊏ H19Ownership / containment

Logic and ownership

Kotlin parses the incoming URL into a typed payload, resolves the container path and computes the return continuation.

Failure and qualification

  • A modal return carries a typed result to an existing activation; it does not recreate arbitrary caller state.
  • Missing or unauthorized routes yield an explicit outcome before activating children.
  • A region boundary exports selected endpoints; it does not expose the entire child graph.

Hyperedge roles

RelationPatternParticipants, preserving role positions
entryH36 — Navigation / interaction route {#h36--navigation--interaction-route}provider[0]: entry.destination; consumer[0]: container.destination
exportH30 — Boundary export / alias {#h30--boundary-export--alias}provider[0]: route.export; consumer[0]: container.child
screenH36 — Navigation / interaction route {#h36--navigation--interaction-route}provider[0]: route.destination; consumer[0]: screen.route
modalH36 — Navigation / interaction route {#h36--navigation--interaction-route}provider[0]: screen.approve; consumer[0]: modal.route
grantH23 — Scoped authorization {#h23--scoped-authorization}provider[0]: gate.grant; consumer[0]: route.authority
ownershipH19 — Ownership / containment {#h19--ownership--containment}parent[0]: container.owner; child[1]: route.owned; return[2]: modal.continuation

Kotlin common declaration

Import dev.shibasis.reaktor.portgraph.definition.* for this structural declaration. Behavior stays in ordinary Kotlin and binds through qualified runtime ports and adapters. Declaring a graph does not activate a system.

graphDefinition("capability-navigation", "ee9f93df80a63c5664c50a0c50bed123a359307443855aae9c8a61084173672e") {
    region("app", "App")
    region("feature", "Account feature", "app")
    region("modal", "Approval modal", "feature")
    node("entry", "Deep-link resolver", "N12", "app", ports = listOf(
        PortDefinition("destination", "P11", "RouteAddressV1", PortPolarity.Offer)
    ))
    node("container", "Feature container", "N10", "app", ports = listOf(
        PortDefinition("destination", "P11", "RouteAddressV1", PortPolarity.Require),
        PortDefinition("child", "P19", "AccountRouteV1", PortPolarity.Require),
        PortDefinition("owner", "P24", "OwnerRefV1", PortPolarity.Neutral)
    ))
    node("route", "Account route", "N12", "feature", ports = listOf(
        PortDefinition("export", "P19", "AccountRouteV1", PortPolarity.Offer),
        PortDefinition("destination", "P11", "AccountRouteV1", PortPolarity.Offer),
        PortDefinition("authority", "P20", "RouteGrantV1", PortPolarity.Require),
        PortDefinition("owned", "P24", "DefinitionRefV1", PortPolarity.Neutral)
    ))
    node("screen", "Account Surface", "N11", "feature", ports = listOf(
        PortDefinition("route", "P11", "AccountRouteV1", PortPolarity.Require),
        PortDefinition("approve", "P11", "ApprovalRouteV1", PortPolarity.Offer)
    ))
    node("modal", "Approval Surface", "N11", "modal", ports = listOf(
        PortDefinition("route", "P11", "ApprovalRouteV1", PortPolarity.Require),
        PortDefinition("continuation", "P24", "ContinuationRefV1", PortPolarity.Neutral)
    ))
    node("gate", "Route policy", "N33", "app", ports = listOf(
        PortDefinition("grant", "P20", "RouteGrantV1", PortPolarity.Offer)
    ))
    relation("entry", "H36",
        Incidence("entry", "destination", "provider", 0),
        Incidence("container", "destination", "consumer", 0)
    )
    relation("export", "H30",
        Incidence("route", "export", "provider", 0),
        Incidence("container", "child", "consumer", 0)
    )
    relation("screen", "H36",
        Incidence("route", "destination", "provider", 0),
        Incidence("screen", "route", "consumer", 0)
    )
    relation("modal", "H36",
        Incidence("screen", "approve", "provider", 0),
        Incidence("modal", "route", "consumer", 0)
    )
    relation("grant", "H23",
        Incidence("gate", "grant", "provider", 0),
        Incidence("route", "authority", "consumer", 0)
    )
    relation("ownership", "H19",
        Incidence("container", "owner", "parent", 0),
        Incidence("route", "owned", "child", 1),
        Incidence("modal", "continuation", "return", 2)
    )
}

Authorization: delegation, expiry and effect admission

Can a delegated agent execute the same operation a human proposed?

Inspect this design · Definition JSON · revision da11babd2039

Diagram legend. Frames are named graph regions. Left/right pins show required/offered participation, not a universal schedule. Filled pins are connected; hollow pins are unbound. A junction card preserves one relation's role slots.

MarkerMeaning in this diagram
⊂ N33Policy / principal boundary
✧ N39Agent / change proposer
↗ N19Tool / external API adapter
⊢ N37Claim / evidence record
◎ P24Inspection / evidence
○ P01Value / immutable snapshot
⊂ P20Authorization request / grant
⇆ P02Request / response
→ H02Value flow
⊂ H23Scoped authorization
⇆ H05Request / reply binding
⊢ H27Derivation / provenance

Logic and ownership

Normal Kotlin policy code evaluates principal, resource, operation, revision and time, then produces a bounded decision for the current request.

Failure and qualification

  • A capability descriptor states what can be done; a grant identifies who may do it within which scope.
  • Approval expires and is bound to a plan fingerprint; changed effects need reevaluation.
  • A recorded grant is not ambient access to hidden graph facets or data.

Hyperedge roles

RelationPatternParticipants, preserving role positions
proposalH02 — Value flow {#h02--value-flow}provider[0]: agent.proposal; consumer[0]: gate.proposal
decisionH23 — Scoped authorization {#h23--scoped-authorization}provider[0]: policy.decision; consumer[0]: gate.policy
executeH05 — Request / reply binding {#h05--request--reply-binding}provider[0]: service.operation; consumer[0]: gate.effect
receiptH27 — Derivation / provenance {#h27--derivation--provenance}provider[0]: gate.receipt; consumer[0]: receipt.effect
delegationH23 — Scoped authorization {#h23--scoped-authorization}delegator[0]: human.delegation; delegate[1]: agent.identity; resource[2]: service.resource; admission[3]: gate.admission

Kotlin common declaration

Import dev.shibasis.reaktor.portgraph.definition.* for this structural declaration. Behavior stays in ordinary Kotlin and binds through qualified runtime ports and adapters. Declaring a graph does not activate a system.

graphDefinition("capability-auth", "da11babd2039ade15e3cdeceec7954abf8f1c9e1ceac913c8ff7ff12ec3ac849") {
    region("control", "Control plane")
    region("data", "Data plane")
    node("human", "Human principal", "N33", "control", ports = listOf(
        PortDefinition("delegation", "P24", "PrincipalRefV1", PortPolarity.Neutral)
    ))
    node("agent", "Agent proposer", "N39", "control", ports = listOf(
        PortDefinition("proposal", "P01", "EffectProposalV1", PortPolarity.Offer),
        PortDefinition("identity", "P24", "PrincipalRefV1", PortPolarity.Neutral)
    ))
    node("policy", "Policy evaluator", "N33", "control", ports = listOf(
        PortDefinition("decision", "P20", "PolicyDecisionV1", PortPolarity.Offer)
    ))
    node("gate", "Effect admission", "N33", "control", ports = listOf(
        PortDefinition("proposal", "P01", "EffectProposalV1", PortPolarity.Require),
        PortDefinition("policy", "P20", "PolicyDecisionV1", PortPolarity.Require),
        PortDefinition("effect", "P02", "PrivilegedOperationV1", PortPolarity.Require),
        PortDefinition("receipt", "P24", "EffectReceiptV1", PortPolarity.Offer),
        PortDefinition("admission", "P24", "AuthorityRefV1", PortPolarity.Neutral)
    ))
    node("service", "Privileged service", "N19", "data", ports = listOf(
        PortDefinition("operation", "P02", "PrivilegedOperationV1", PortPolarity.Offer),
        PortDefinition("resource", "P24", "ResourceRefV1", PortPolarity.Neutral)
    ))
    node("receipt", "Audit receipt", "N37", "control", ports = listOf(
        PortDefinition("effect", "P24", "EffectReceiptV1", PortPolarity.Require)
    ))
    relation("proposal", "H02",
        Incidence("agent", "proposal", "provider", 0),
        Incidence("gate", "proposal", "consumer", 0)
    )
    relation("decision", "H23",
        Incidence("policy", "decision", "provider", 0),
        Incidence("gate", "policy", "consumer", 0)
    )
    relation("execute", "H05",
        Incidence("service", "operation", "provider", 0),
        Incidence("gate", "effect", "consumer", 0)
    )
    relation("receipt", "H27",
        Incidence("gate", "receipt", "provider", 0),
        Incidence("receipt", "effect", "consumer", 0)
    )
    relation("delegation", "H23",
        Incidence("human", "delegation", "delegator", 0),
        Incidence("agent", "identity", "delegate", 1),
        Incidence("service", "resource", "resource", 2),
        Incidence("gate", "admission", "admission", 3)
    )
}

Telemetry: graph attribution, sampling and privacy

How can a span identify a graph operation without leaking its payload?

Inspect this design · Definition JSON · revision 82bc1eb404f2

Diagram legend. Frames are named graph regions. Left/right pins show required/offered participation, not a universal schedule. Filled pins are connected; hollow pins are unbound. A junction card preserves one relation's role slots.

MarkerMeaning in this diagram
↯ N02Effectful operation
◎ N38Observer / query / visitor
⊂ N33Policy / principal boundary
ƒ N01Pure computation
↗ N19Tool / external API adapter
⊟ N30External system boundary
◎ P24Inspection / evidence
⊂ P20Authorization request / grant
○ P01Value / immutable snapshot
↦ P04Push event
⇆ P02Request / response
↦ H04Event subscription
⊂ H23Scoped authorization
→ H02Value flow
⇆ H05Request / reply binding
⊢ H27Derivation / provenance

Logic and ownership

A Kotlin sampler uses deterministic operation identity and declared budget. The interceptor emits approved metadata before any exporter runs.

Failure and qualification

  • Observed traffic is a sampled, time-bounded claim rather than proof that all paths are healthy.
  • Read access and capture are sensitive effects with separate grants and redaction policies.
  • Trace continuity across retries and hosts requires explicit context propagation.

Hyperedge roles

RelationPatternParticipants, preserving role positions
spanH04 — Event subscription {#h04--event-subscription}provider[0]: app.span; consumer[0]: interceptor.span
policyH23 — Scoped authorization {#h23--scoped-authorization}provider[0]: policy.grant; consumer[0]: interceptor.capture
sampleH02 — Value flow {#h02--value-flow}provider[0]: interceptor.envelope; consumer[0]: sampler.input
exportH02 — Value flow {#h02--value-flow}provider[0]: sampler.selected; consumer[0]: exporter.input
backendH05 — Request / reply binding {#h05--request--reply-binding}provider[0]: collector.ingest; consumer[0]: exporter.backend
attributionH27 — Derivation / provenance {#h27--derivation--provenance}definition[0]: app.definition; activation[1]: interceptor.activation; observation[2]: collector.observation

Kotlin common declaration

Import dev.shibasis.reaktor.portgraph.definition.* for this structural declaration. Behavior stays in ordinary Kotlin and binds through qualified runtime ports and adapters. Declaring a graph does not activate a system.

graphDefinition("capability-telemetry", "82bc1eb404f21646e7ba228dfa6fe2a6b235da41c3b9a8dac6fc6f75905a1444") {
    region("control", "Control plane")
    region("data", "Data plane")
    node("app", "Application operation", "N02", "data", ports = listOf(
        PortDefinition("span", "P24", "SpanEnvelopeV1", PortPolarity.Offer),
        PortDefinition("definition", "P24", "DefinitionRefV1", PortPolarity.Neutral)
    ))
    node("interceptor", "Port interceptor", "N38", "data", ports = listOf(
        PortDefinition("span", "P24", "SpanEnvelopeV1", PortPolarity.Require),
        PortDefinition("capture", "P20", "CaptureGrantV1", PortPolarity.Require),
        PortDefinition("envelope", "P01", "RedactedSpanV1", PortPolarity.Offer),
        PortDefinition("activation", "P24", "ActivationRefV1", PortPolarity.Neutral)
    ))
    node("policy", "Capture / privacy policy", "N33", "control", ports = listOf(
        PortDefinition("grant", "P20", "CaptureGrantV1", PortPolarity.Offer)
    ))
    node("sampler", "Sampling logic", "N01", "data", ports = listOf(
        PortDefinition("input", "P01", "RedactedSpanV1", PortPolarity.Require),
        PortDefinition("selected", "P04", "RedactedSpanV1", PortPolarity.Offer)
    ))
    node("exporter", "OTel exporter", "N19", "data", ports = listOf(
        PortDefinition("input", "P04", "RedactedSpanV1", PortPolarity.Require),
        PortDefinition("backend", "P02", "TelemetryBatchV1", PortPolarity.Require)
    ))
    node("collector", "Observability backend", "N30", "control", ports = listOf(
        PortDefinition("ingest", "P02", "TelemetryBatchV1", PortPolarity.Offer),
        PortDefinition("observation", "P24", "ObservationRefV1", PortPolarity.Neutral)
    ))
    relation("span", "H04",
        Incidence("app", "span", "provider", 0),
        Incidence("interceptor", "span", "consumer", 0)
    )
    relation("policy", "H23",
        Incidence("policy", "grant", "provider", 0),
        Incidence("interceptor", "capture", "consumer", 0)
    )
    relation("sample", "H02",
        Incidence("interceptor", "envelope", "provider", 0),
        Incidence("sampler", "input", "consumer", 0)
    )
    relation("export", "H02",
        Incidence("sampler", "selected", "provider", 0),
        Incidence("exporter", "input", "consumer", 0)
    )
    relation("backend", "H05",
        Incidence("collector", "ingest", "provider", 0),
        Incidence("exporter", "backend", "consumer", 0)
    )
    relation("attribution", "H27",
        Incidence("app", "definition", "definition", 0),
        Incidence("interceptor", "activation", "activation", 1),
        Incidence("collector", "observation", "observation", 2)
    )
}

Service composition: retry, fallback and contract evolution

When is a fallback semantically compatible with the primary service?

Inspect this design · Definition JSON · revision b4bd5132161b

Diagram legend. Frames are named graph regions. Left/right pins show required/offered participation, not a universal schedule. Filled pins are connected; hollow pins are unbound. A junction card preserves one relation's role slots.

MarkerMeaning in this diagram
↯ N02Effectful operation
↗ N19Tool / external API adapter
▣ N05Actor / statechart
⊂ N33Policy / principal boundary
≡ N31Schema / contract definition
⇆ P02Request / response
◉ P08Signal / reactive state
⊂ P20Authorization request / grant
◎ P24Inspection / evidence
⇆ H05Request / reply binding
→ H02Value flow
⊂ H23Scoped authorization
⋁ H33Fallback / preference set
λ H25Implements / source ownership

Logic and ownership

Ordinary Kotlin evaluates error class, deadline and fallback freshness. Typed request/response DTOs remain shared KMP code.

Failure and qualification

  • A matching payload type is insufficient if authority, consistency or error behavior differs.
  • Retries consume the caller deadline and preserve idempotency identity.
  • Circuit state is owned per declared scope; it is not an accidental global singleton.

Hyperedge roles

RelationPatternParticipants, preserving role positions
primaryH05 — Request / reply binding {#h05--request--reply-binding}provider[0]: primary.api; consumer[0]: client.primary
fallbackH05 — Request / reply binding {#h05--request--reply-binding}provider[0]: fallback.api; consumer[0]: client.fallback
budgetH02 — Value flow {#h02--value-flow}provider[0]: breaker.budget; consumer[0]: client.budget
grantH23 — Scoped authorization {#h23--scoped-authorization}provider[0]: policy.grant; consumer[0]: client.authority
preferenceH33 — Fallback / preference set {#h33--fallback--preference-set}preferred[0]: primary.profile; fallback[1]: fallback.profile; selector[2]: client.selector
contractH25 — Implements / source ownership {#h25--implements--source-ownership}contract[0]: schema.contract; implementation[1]: primary.implementation; implementation[2]: fallback.implementation

Kotlin common declaration

Import dev.shibasis.reaktor.portgraph.definition.* for this structural declaration. Behavior stays in ordinary Kotlin and binds through qualified runtime ports and adapters. Declaring a graph does not activate a system.

graphDefinition("capability-services", "b4bd5132161b90f0191449ba3e53c883ddb5a7230646a82d03be964451d9ca6b") {
    region("control", "Control plane")
    region("data", "Data plane")
    node("client", "Typed client logic", "N02", "control", ports = listOf(
        PortDefinition("primary", "P02", "SearchV1", PortPolarity.Require),
        PortDefinition("fallback", "P02", "SearchV1", PortPolarity.Require),
        PortDefinition("budget", "P08", "CallBudgetV1", PortPolarity.Require),
        PortDefinition("authority", "P20", "ServiceGrantV1", PortPolarity.Require),
        PortDefinition("selector", "P24", "SelectorRefV1", PortPolarity.Neutral)
    ))
    node("primary", "Primary service", "N19", "data", ports = listOf(
        PortDefinition("api", "P02", "SearchV1", PortPolarity.Offer),
        PortDefinition("profile", "P24", "ServiceProfileV1", PortPolarity.Neutral),
        PortDefinition("implementation", "P24", "ImplementationRefV1", PortPolarity.Neutral)
    ))
    node("fallback", "Qualified fallback", "N19", "data", ports = listOf(
        PortDefinition("api", "P02", "SearchV1", PortPolarity.Offer),
        PortDefinition("profile", "P24", "ServiceProfileV1", PortPolarity.Neutral),
        PortDefinition("implementation", "P24", "ImplementationRefV1", PortPolarity.Neutral)
    ))
    node("breaker", "Circuit / budget state", "N05", "control", ports = listOf(
        PortDefinition("budget", "P08", "CallBudgetV1", PortPolarity.Offer)
    ))
    node("policy", "Invocation policy", "N33", "control", ports = listOf(
        PortDefinition("grant", "P20", "ServiceGrantV1", PortPolarity.Offer)
    ))
    node("schema", "Versioned service contract", "N31", "control", ports = listOf(
        PortDefinition("contract", "P24", "ContractRefV1", PortPolarity.Neutral)
    ))
    relation("primary", "H05",
        Incidence("primary", "api", "provider", 0),
        Incidence("client", "primary", "consumer", 0)
    )
    relation("fallback", "H05",
        Incidence("fallback", "api", "provider", 0),
        Incidence("client", "fallback", "consumer", 0)
    )
    relation("budget", "H02",
        Incidence("breaker", "budget", "provider", 0),
        Incidence("client", "budget", "consumer", 0)
    )
    relation("grant", "H23",
        Incidence("policy", "grant", "provider", 0),
        Incidence("client", "authority", "consumer", 0)
    )
    relation("preference", "H33",
        Incidence("primary", "profile", "preferred", 0),
        Incidence("fallback", "profile", "fallback", 1),
        Incidence("client", "selector", "selector", 2)
    )
    relation("contract", "H25",
        Incidence("schema", "contract", "contract", 0),
        Incidence("primary", "implementation", "implementation", 1),
        Incidence("fallback", "implementation", "implementation", 2)
    )
}

Partitioning: graph cut with exported contracts and fences

Which semantics must be preserved when a region moves to another host?

Inspect this design · Definition JSON · revision 53f07b6718ea

Diagram legend. Frames are named graph regions. Left/right pins show required/offered participation, not a universal schedule. Filled pins are connected; hollow pins are unbound. A junction card preserves one relation's role slots.

MarkerMeaning in this diagram
⊞ N28Placement / resource pool
▸ N27Runtime host / executor
↗ N19Tool / external API adapter
◆ N16Native resource / engine
▰ N21Database / state authority
◎ P24Inspection / evidence
⇆ P02Request / response
⇆ H05Request / reply binding
⌖ H21Placement
⇥ H30Boundary export / alias

Logic and ownership

A common Kotlin cost function ranks legal placements after policy and target capability checks; it cannot override failed legality checks.

Failure and qualification

  • Cutting a local pointer or borrowed resource is illegal without a qualified transfer adapter.
  • Authority, clock, failure, latency and cancellation contracts survive the cut.
  • Migrating an activation requires an epoch and state handoff; moving a diagram card does not move computation.

Hyperedge roles

RelationPatternParticipants, preserving role positions
callH05 — Request / reply binding {#h05--request--reply-binding}provider[0]: kernel.compute; consumer[0]: service.compute
stateH05 — Request / reply binding {#h05--request--reply-binding}provider[0]: state.conditional; consumer[0]: kernel.storage
placementH21 — Placement {#h21--placement}planner[0]: planner.plan; edge[1]: edge.profile; native[2]: native.profile
boundaryH30 — Boundary export / alias {#h30--boundary-export--alias}export[0]: service.export; implementation[1]: kernel.implementation; authority[2]: state.fence

Kotlin common declaration

Import dev.shibasis.reaktor.portgraph.definition.* for this structural declaration. Behavior stays in ordinary Kotlin and binds through qualified runtime ports and adapters. Declaring a graph does not activate a system.

graphDefinition("capability-partitioning", "53f07b6718ea84a95590b67dfd3164965b70738f10ef7d536d2aef6470bd4210") {
    region("system", "System")
    region("edge", "Edge partition", "system")
    region("native", "Native partition", "system")
    node("planner", "Placement planner", "N28", "system", ports = listOf(
        PortDefinition("plan", "P24", "PlacementPlanV1", PortPolarity.Neutral)
    ))
    node("edge", "Edge host", "N27", "edge", ports = listOf(
        PortDefinition("profile", "P24", "HostProfileV1", PortPolarity.Neutral)
    ))
    node("service", "Service export", "N19", "edge", ports = listOf(
        PortDefinition("compute", "P02", "ComputeV1", PortPolarity.Require),
        PortDefinition("export", "P24", "ContractRefV1", PortPolarity.Neutral)
    ))
    node("native", "Native host", "N27", "native", ports = listOf(
        PortDefinition("profile", "P24", "HostProfileV1", PortPolarity.Neutral)
    ))
    node("kernel", "Native algorithm", "N16", "native", ports = listOf(
        PortDefinition("compute", "P02", "ComputeV1", PortPolarity.Offer),
        PortDefinition("storage", "P02", "ConditionalStateV1", PortPolarity.Require),
        PortDefinition("implementation", "P24", "ImplementationRefV1", PortPolarity.Neutral)
    ))
    node("state", "State authority", "N21", "native", ports = listOf(
        PortDefinition("conditional", "P02", "ConditionalStateV1", PortPolarity.Offer),
        PortDefinition("fence", "P24", "FenceRefV1", PortPolarity.Neutral)
    ))
    relation("call", "H05",
        Incidence("kernel", "compute", "provider", 0),
        Incidence("service", "compute", "consumer", 0)
    )
    relation("state", "H05",
        Incidence("state", "conditional", "provider", 0),
        Incidence("kernel", "storage", "consumer", 0)
    )
    relation("placement", "H21",
        Incidence("planner", "plan", "planner", 0),
        Incidence("edge", "profile", "edge", 1),
        Incidence("native", "profile", "native", 2)
    )
    relation("boundary", "H30",
        Incidence("service", "export", "export", 0),
        Incidence("kernel", "implementation", "implementation", 1),
        Incidence("state", "fence", "authority", 2)
    )
}

FFI: typed call, owned bytes and target admission

Who releases a buffer after a foreign call fails?

Inspect this design · Definition JSON · revision 724164211963

Diagram legend. Frames are named graph regions. Left/right pins show required/offered participation, not a universal schedule. Filled pins are connected; hollow pins are unbound. A junction card preserves one relation's role slots.

MarkerMeaning in this diagram
ƒ N01Pure computation
⚙ N15Device / platform adapter
◆ N16Native resource / engine
▱ N26Blob / buffer / asset store
⊂ N33Policy / principal boundary
⇆ P02Request / response
⊂ P20Authorization request / grant
↦ P04Push event
◎ P24Inspection / evidence
◇̸ P17Borrowed buffer / view
⇆ H05Request / reply binding
— H01Exclusive binding
⊂ H23Scoped authorization
→ H02Value flow
⊏ H19Ownership / containment

Logic and ownership

Kotlin prepares a typed request and invokes the admitted bridge. The adapter maps serialization, error values and resource cleanup onto the target ABI.

Failure and qualification

  • Kotlin/JS compilation proves no foreign-runtime parity. Each ABI and embedding host needs its own tests.
  • Raw addresses and borrowed views remain local to a compatible memory domain.
  • Cancellation is cooperative unless the target adapter explicitly supports interruption.

Hyperedge roles

RelationPatternParticipants, preserving role positions
invokeH05 — Request / reply binding {#h05--request--reply-binding}provider[0]: bridge.call; consumer[0]: logic.call
nativeH05 — Request / reply binding {#h05--request--reply-binding}provider[0]: native.compute; consumer[0]: bridge.native
bufferH01 — Exclusive binding {#h01--exclusive-binding}provider[0]: pool.lease; consumer[0]: native.buffer
grantH23 — Scoped authorization {#h23--scoped-authorization}provider[0]: policy.grant; consumer[0]: bridge.admission
errorH02 — Value flow {#h02--value-flow}provider[0]: bridge.failure; consumer[0]: error.failure
ownershipH19 — Ownership / containment {#h19--ownership--containment}allocator[0]: pool.allocator; borrower[1]: native.borrow; adapter[2]: bridge.release

Kotlin common declaration

Import dev.shibasis.reaktor.portgraph.definition.* for this structural declaration. Behavior stays in ordinary Kotlin and binds through qualified runtime ports and adapters. Declaring a graph does not activate a system.

graphDefinition("capability-ffi", "724164211963e316ddea9b20c178c39615ad06a08b19db8f21156cb876ca768e") {
    region("js", "Kotlin/JS host")
    region("native", "Native target adapter")
    node("logic", "Common Kotlin logic", "N01", "js", ports = listOf(
        PortDefinition("call", "P02", "NativeComputeV1", PortPolarity.Require)
    ))
    node("bridge", "FFI transport adapter", "N15", "js", ports = listOf(
        PortDefinition("call", "P02", "NativeComputeV1", PortPolarity.Offer),
        PortDefinition("native", "P02", "NativeComputeV1", PortPolarity.Require),
        PortDefinition("admission", "P20", "HostGrantV1", PortPolarity.Require),
        PortDefinition("failure", "P04", "ForeignFailureV1", PortPolarity.Offer),
        PortDefinition("release", "P24", "ReleaseProtocolV1", PortPolarity.Neutral)
    ))
    node("native", "Foreign function library", "N16", "native", ports = listOf(
        PortDefinition("compute", "P02", "NativeComputeV1", PortPolarity.Offer),
        PortDefinition("buffer", "P17", "BufferLeaseV1", PortPolarity.Require),
        PortDefinition("borrow", "P24", "BorrowRefV1", PortPolarity.Neutral)
    ))
    node("pool", "Native buffer owner", "N26", "native", ports = listOf(
        PortDefinition("lease", "P17", "BufferLeaseV1", PortPolarity.Offer),
        PortDefinition("allocator", "P24", "AllocatorRefV1", PortPolarity.Neutral)
    ))
    node("policy", "Host capability gate", "N33", "js", ports = listOf(
        PortDefinition("grant", "P20", "HostGrantV1", PortPolarity.Offer)
    ))
    node("error", "Error / cancellation adapter", "N15", "js", ports = listOf(
        PortDefinition("failure", "P04", "ForeignFailureV1", PortPolarity.Require)
    ))
    relation("invoke", "H05",
        Incidence("bridge", "call", "provider", 0),
        Incidence("logic", "call", "consumer", 0)
    )
    relation("native", "H05",
        Incidence("native", "compute", "provider", 0),
        Incidence("bridge", "native", "consumer", 0)
    )
    relation("buffer", "H01",
        Incidence("pool", "lease", "provider", 0),
        Incidence("native", "buffer", "consumer", 0)
    )
    relation("grant", "H23",
        Incidence("policy", "grant", "provider", 0),
        Incidence("bridge", "admission", "consumer", 0)
    )
    relation("error", "H02",
        Incidence("bridge", "failure", "provider", 0),
        Incidence("error", "failure", "consumer", 0)
    )
    relation("ownership", "H19",
        Incidence("pool", "allocator", "allocator", 0),
        Incidence("native", "borrow", "borrower", 1),
        Incidence("bridge", "release", "adapter", 2)
    )
}

Subgraph code push: state migration and old-call draining

How does a replacement preserve both callers and mutable state?

Inspect this design · Definition JSON · revision 782330082316

Diagram legend. Frames are named graph regions. Left/right pins show required/offered participation, not a universal schedule. Filled pins are connected; hollow pins are unbound. A junction card preserves one relation's role slots.

MarkerMeaning in this diagram
⌘ N10Function / blueprint region
λ N34Build / compiler pass
⧉ N36Test / Shadow scenario
⊂ N33Policy / principal boundary
▸ N27Runtime host / executor
▰ N21Database / state authority
▧ P23Artifact / schema reference
◎ P24Inspection / evidence
⊂ P20Authorization request / grant
⇆ P02Request / response
▧ H26Artifact dependency
✓ H28Evidence supports claim
⊂ H23Scoped authorization
⇆ H05Request / reply binding
⇧ H35State migration
⏻ H29Activation cohort

Logic and ownership

The migration is an ordinary Kotlin function with declared preconditions. The host publishes a candidate epoch only after state and exported-contract checks.

Failure and qualification

  • Generation pinning preserves code/routing identity; it does not by itself provide a consistent shared-state snapshot.
  • Old invocations need bounded draining, explicit cancellation or a documented coexistence policy.
  • Rollback to an older code image may be unsafe after a noninvertible data migration.

Hyperedge roles

RelationPatternParticipants, preserving role positions
buildH26 — Artifact dependency {#h26--artifact-dependency}provider[0]: candidate.source; consumer[0]: build.source
testH26 — Artifact dependency {#h26--artifact-dependency}provider[0]: build.bundle; consumer[0]: check.bundle
evidenceH28 — Evidence supports claim {#h28--evidence-supports-claim}provider[0]: check.evidence; consumer[0]: policy.evidence
publishH23 — Scoped authorization {#h23--scoped-authorization}provider[0]: policy.decision; consumer[0]: host.admission
stateH05 — Request / reply binding {#h05--request--reply-binding}provider[0]: state.conditional; consumer[0]: host.state
migrationH35 — State migration {#h35--state-migration}old[0]: old.stateSchema; new[1]: candidate.stateSchema; authority[2]: state.version
activationH29 — Activation cohort {#h29--activation-cohort}old[0]: old.epoch; new[1]: candidate.definition; publisher[2]: host.publisher

Kotlin common declaration

Import dev.shibasis.reaktor.portgraph.definition.* for this structural declaration. Behavior stays in ordinary Kotlin and binds through qualified runtime ports and adapters. Declaring a graph does not activate a system.

graphDefinition("capability-code-push", "7823300823163d4e5ac905949bc0725e0934fc8f6ac1ce9794b4ab1c875c65fc") {
    region("control", "Control plane")
    region("data", "Data plane")
    node("candidate", "Replacement region", "N10", "control", ports = listOf(
        PortDefinition("source", "P23", "SourceRevisionV1", PortPolarity.Offer),
        PortDefinition("stateSchema", "P24", "SchemaRefV1", PortPolarity.Neutral),
        PortDefinition("definition", "P24", "DefinitionRefV1", PortPolarity.Neutral)
    ))
    node("build", "Kotlin/JS packager", "N34", "control", ports = listOf(
        PortDefinition("source", "P23", "SourceRevisionV1", PortPolarity.Require),
        PortDefinition("bundle", "P23", "BundleRefV1", PortPolarity.Offer)
    ))
    node("check", "Compatibility / Shadow checks", "N36", "control", ports = listOf(
        PortDefinition("bundle", "P23", "BundleRefV1", PortPolarity.Require),
        PortDefinition("evidence", "P24", "EvidenceSetV1", PortPolarity.Offer)
    ))
    node("policy", "Publication authority", "N33", "control", ports = listOf(
        PortDefinition("evidence", "P24", "EvidenceSetV1", PortPolarity.Require),
        PortDefinition("decision", "P20", "PublishDecisionV1", PortPolarity.Offer)
    ))
    node("host", "Target host loader", "N27", "data", ports = listOf(
        PortDefinition("admission", "P20", "PublishDecisionV1", PortPolarity.Require),
        PortDefinition("state", "P02", "MigrationCommitV1", PortPolarity.Require),
        PortDefinition("publisher", "P24", "HostRefV1", PortPolarity.Neutral)
    ))
    node("old", "Old activation epoch", "N10", "data", ports = listOf(
        PortDefinition("stateSchema", "P24", "SchemaRefV1", PortPolarity.Neutral),
        PortDefinition("epoch", "P24", "ActivationRefV1", PortPolarity.Neutral)
    ))
    node("state", "State authority", "N21", "data", ports = listOf(
        PortDefinition("conditional", "P02", "MigrationCommitV1", PortPolarity.Offer),
        PortDefinition("version", "P24", "StateVersionV1", PortPolarity.Neutral)
    ))
    relation("build", "H26",
        Incidence("candidate", "source", "provider", 0),
        Incidence("build", "source", "consumer", 0)
    )
    relation("test", "H26",
        Incidence("build", "bundle", "provider", 0),
        Incidence("check", "bundle", "consumer", 0)
    )
    relation("evidence", "H28",
        Incidence("check", "evidence", "provider", 0),
        Incidence("policy", "evidence", "consumer", 0)
    )
    relation("publish", "H23",
        Incidence("policy", "decision", "provider", 0),
        Incidence("host", "admission", "consumer", 0)
    )
    relation("state", "H05",
        Incidence("state", "conditional", "provider", 0),
        Incidence("host", "state", "consumer", 0)
    )
    relation("migration", "H35",
        Incidence("old", "stateSchema", "old", 0),
        Incidence("candidate", "stateSchema", "new", 1),
        Incidence("state", "version", "authority", 2)
    )
    relation("activation", "H29",
        Incidence("old", "epoch", "old", 0),
        Incidence("candidate", "definition", "new", 1),
        Incidence("host", "publisher", "publisher", 2)
    )
}