Skip to main content

AccessFactServerOverrideBehavior

How a fact's server answer combines with the one the client worked out for itself.

The server's answer always replicates -- that part is not configurable, because a client that silently never hears is the failure nobody can debug. What a fact chooses is what the client should do with it, and there are only four sensible answers, so they are named rather than left to a predicate somebody has to read.

Properties

DEFAULT

AccessFactServerOverrideBehavior.DEFAULT: string

The behavior a fact gets when it does not choose one.

Functions

isBehavior

AccessFactServerOverrideBehavior.isBehavior(valueany) → boolean

combine

AccessFactServerOverrideBehavior.combine(
localValueboolean?,--

what this realm worked out

serverValueboolean?,--

what the server replicated

replicationStatestring,--

see AccessReplicationState

behaviorstring?
) → boolean?

Combines the two answers. Pure, and the only place the rule lives.

Two rules come before the behavior, and both matter more than it does:

  1. Unless the server has actually said something -- AccessReplicationState.hasAnswer -- nothing is overridden. NOT_YET_ARRIVED and ABSTAINED both leave the local answer alone, and taking the state rather than inspecting a value is what keeps "has not arrived" from being confused with "arrived saying no".
  2. If this realm has no answer of its own, the server's simply is the answer. A behavior governs overriding a local answer; with none to override there is nothing to protect. Without this a fact the client cannot compute -- a receipt in a server-only DataStore -- would sit unresolved forever under the default, and every feature reading it would never settle. That is not a wrong answer on screen, it is a screen that never fills in.
Show raw api
{
    "functions": [
        {
            "name": "isBehavior",
            "desc": "",
            "params": [
                {
                    "name": "value",
                    "desc": "",
                    "lua_type": "any"
                }
            ],
            "returns": [
                {
                    "desc": "",
                    "lua_type": "boolean"
                }
            ],
            "function_type": "static",
            "source": {
                "line": 66,
                "path": "src/access/src/Shared/AccessFactServerOverrideBehavior.lua"
            }
        },
        {
            "name": "combine",
            "desc": "Combines the two answers. Pure, and the only place the rule lives.\n\nTwo rules come before the behavior, and both matter more than it does:\n\n1. Unless the server has actually said something -- [AccessReplicationState].hasAnswer -- nothing is\n   overridden. `NOT_YET_ARRIVED` and `ABSTAINED` both leave the local answer alone, and taking the\n   state rather than inspecting a value is what keeps \"has not arrived\" from being confused with\n   \"arrived saying no\".\n2. If this realm has no answer of its own, the server's simply **is** the answer. A behavior governs\n   *overriding a local answer*; with none to override there is nothing to protect. Without this a\n   fact the client cannot compute -- a receipt in a server-only DataStore -- would sit unresolved\n   forever under the default, and every feature reading it would never settle. That is not a wrong\n   answer on screen, it is a screen that never fills in.",
            "params": [
                {
                    "name": "localValue",
                    "desc": "what this realm worked out",
                    "lua_type": "boolean?"
                },
                {
                    "name": "serverValue",
                    "desc": "what the server replicated",
                    "lua_type": "boolean?"
                },
                {
                    "name": "replicationState",
                    "desc": "see AccessReplicationState",
                    "lua_type": "string"
                },
                {
                    "name": "behavior",
                    "desc": "",
                    "lua_type": "string?"
                }
            ],
            "returns": [
                {
                    "desc": "",
                    "lua_type": "boolean?"
                }
            ],
            "function_type": "static",
            "source": {
                "line": 97,
                "path": "src/access/src/Shared/AccessFactServerOverrideBehavior.lua"
            }
        }
    ],
    "properties": [
        {
            "name": "DEFAULT",
            "desc": "The behavior a fact gets when it does not choose one.",
            "lua_type": "string",
            "source": {
                "line": 60,
                "path": "src/access/src/Shared/AccessFactServerOverrideBehavior.lua"
            }
        }
    ],
    "types": [],
    "name": "AccessFactServerOverrideBehavior",
    "desc": "How a fact's server answer combines with the one the client worked out for itself.\n\nThe server's answer **always replicates** -- that part is not configurable, because a client that\nsilently never hears is the failure nobody can debug. What a fact chooses is what the client should\n*do* with it, and there are only four sensible answers, so they are named rather than left to a\npredicate somebody has to read.",
    "source": {
        "line": 12,
        "path": "src/access/src/Shared/AccessFactServerOverrideBehavior.lua"
    }
}