# configuration/strings/handoff.strings.ts

> 61 lines of code and 6 definitions.

Tree: Site tree
Language: typescript
Layer: product
Canonical: https://banes-lab.com/anatomy/tree#file-configuration-strings-handoff-strings-ts
Source text: https://banes-lab.com/assets/sources/source.e6c2616c56536b4b7747d92bfdb7269f3a2f688e7f856bf671acf9678e1eb3c1.generated.txt

## Definitions

- `ITEM_SAMPLE` (lexical_declaration, line 6)
- `SIGNAL_SAMPLE` (lexical_declaration, line 9)
- `CLOSE_SAMPLE` (lexical_declaration, line 12)
- `ITEM_DIAGRAM` (lexical_declaration, line 15)
- `FAILURE_DIAGRAM` (lexical_declaration, line 18)
- `HANDOFF_SECTION` (lexical_declaration, line 21, exported)

## Source

```typescript
import { HANDOFF_SECTION_ICON } from "#configuration/icons/grammar.icons";
import { HANDOFF_SECTION_ID } from "#core/ids/grammar.ids";
import { PAG_LANGUAGE } from "#configuration/constants/code.constants";
import type { Section } from "#types/document.types";

const ITEM_SAMPLE =
    "# an item is a typed span · its kind selects how it closes, and the closure is checked by a party other than its author\nDECLARE item: object\nSET item = {\n  id:    <allocated by the surface, never by hand>,\n  kind:  <artifact | judgement>,\n  from:  <this party>,\n  to:    [<the parties that need it>],\n  body:  {surface: <where>, locus: <what part>, observed: <what was seen>, expected: <what should hold>}\n}\n\nFUNCTION closes(item):\n  # an artifact item asks for something that can exist · it closes when a typed reference resolves\n  IF item.kind == artifact: RETURN resolves(item.satisfied_by) AND monotone_with_the_work(item.satisfied_by)\n  # a judgement item asks for a reading · it closes by its declared acknowledger, with nothing to point at\n  IF item.kind == judgement: RETURN acknowledged_by(item.acknowledger)\n\nFUNCTION may_close(party, item):\n  RETURN party IN item.to   # a reader, never the author";

const SIGNAL_SAMPLE =
    '# a failure is a finding, not a halt · it flows through the same channel and routes by what it binds\nFUNCTION route(failure):\n  SET finding = {surface: failure.surface, locus: failure.locus, observed: failure.observed, expected: failure.expected}\n  IF failure.blocks_a_decision:\n    RETURN SEND finding TO <the party whose surface the decision binds>\n  IF failure.asks_what_the_work_is_for:\n    RETURN SEND finding TO <the developer> AS <a question with a recommendation first>\n  RETURN <the next open item>\n\n# NODE 9 — COMMIT   [evaluative · representation · information-theory · yields: one typed artifact]\nCONTRACT:\n  input:        findings + run_context\n  transform:    emit exactly one artifact of the kind bound at orientation, deduplicated, naming every limitation\n  constraints:  a report goes to the parties whose next work it creates, never to the developer as a closing summary\n  output:       committed { artifact_type, output }\n  handoff:      one typed artifact emitted (yields: hash + boolean)\n\nHANDOFF GATE (evidence-bearing):\n  rule_id: "COMMIT"   yields: hash + boolean\n  [check] exactly one artifact emitted, of the kind bound at orientation (evidence: committed.artifact_type)\n  [check] every finding addressed to a party that needs it (evidence: findings[].to) over: findings measured: <addressed> / <findings>\n  [check] no finding recorded twice (evidence: dedup)\n  refuse: the artifact\'s destination changed since it was read before PERSIST_ARTIFACT\n  result: pass → NODE 10 | duplicate or unaddressed → REPAIR (owner: NODE 9) | unknown → BLOCKED';

const CLOSE_SAMPLE =
    "# closing an item · the handler removes it, never the author, and extraction comes first\nWHEN <party> handles <item>:\n    VALIDATE <party> IN <item>.<to>\n    VALIDATE closes(<item>)\n    EXTRACT_FACTS <item>.<durable half> INTO <the one home history has>\n    PERSIST_ARTIFACT <the extraction> TO <that home>\n    REMOVE <item> BY <item>.<id>       # the span, never a matched line";

const ITEM_DIAGRAM =
    'flowchart TB\n    posted["An item is posted · id allocated, kind set, readers named"]\n    kind{"Which kind?"}\n    artifact["Artifact · closes when its reference resolves"]\n    judgement["Judgement · closes when its acknowledger marks it"]\n    handler["Removed by a party in its reader set · never its author"]\n    extract["Its durable half extracted first"]\n    posted --> kind\n    kind -- artifact --> artifact --> handler\n    kind -- judgement --> judgement --> handler\n    handler --> extract';

const FAILURE_DIAGRAM =
    'flowchart LR\n    fails["A gate fails"]\n    finding["A finding · surface, locus, observed, expected"]\n    binds{"What does it bind?"}\n    owner["The party whose surface the decision binds"]\n    person["The developer · what the work is for, a recommendation first"]\n    next["The next open item"]\n    fails --> finding --> binds\n    binds -- a decision --> owner\n    binds -- the purpose --> person\n    binds -- nothing --> next';

export const HANDOFF_SECTION: Section = {
    icon: HANDOFF_SECTION_ICON,
    id: HANDOFF_SECTION_ID,
    intro: "A handoff is an item addressed to the parties that need it, with an allocated id, a declared kind and a closure the kind selects, as written in <cite>an item</cite> and shown in <cite>kind selects closure</cite>. An artifact item asks for something that can exist, and it closes when a typed reference to that thing resolves. A judgement item asks for a reading, and it closes when its acknowledger marks it; <cite>closing an item</cite> shows the closure in either case. A failure is a finding rather than a halt, and it follows the route shown in <cite>failure routes</cite> and <cite>failure to finding</cite>. A report goes to the parties whose next work it creates, never to the developer as a closing summary.",
    subsections: [
        {
            blocks: [
                {
                    application:
                        "In practice, a handoff is posted as an item with an id the surface allocates, a kind, the parties it is addressed to, and a body carrying the finding's surface, location, and observed and expected values. An artifact item closes through a reference that has to resolve and stay true while the work is done, and a judgement item closes through its acknowledger. A failure is routed by what it binds: a decision goes to the party whose surface it binds, a question about the purpose of the work goes to the developer with a recommendation first, and everything else goes to the next open item.",
                    boundary:
                        "The handoff protocol is for parties that share a surface; what a bounded reader does instead is described in composing a collaboration.",
                    cause: "A closure that a reference decides can be checked by any party, while a closure that a party declares can be checked only by that party.",
                    decision:
                        "The kind decides the closure, either a reference that has to resolve or an acknowledger named on the item, rather than the author's word that the work is done.",
                    failureMode:
                        "A party declares an item handled, nothing points at the thing it asked for, the item is removed, and the work it named was never done.",
                    kind: "lesson",
                    principle:
                        "For this reason a handoff is a typed item whose closure can be checked by a party other than its author.",
                    problem: "A handoff closed by the party that wrote it closes whether or not the work exists.",
                    validation:
                        "To check this, name for each closed item the reference that closed it or the party that acknowledged it. An item that its own author closed with no reference was declared done, not shown to be done.",
                },
                {
                    kind: "text",
                    text: "The kind is on the item, and it selects the closure. An artifact item names something that can exist, such as a file, a gate or a record, so it closes with a typed reference that has to resolve. The reference names a condition that can turn out wrong rather than a path, because a path resolves as soon as the file exists, and the item would read as closed while the defect is still open. The reference also moves with the work: it is true when the work is done and false when it is not, so a citation that points at the findings themselves is refused, since a broken tree would satisfy it. A judgement item closes when its declared acknowledger signs it off, with no reference, and why one kind requires an acknowledger and the other forbids one is explained in the board and the venue.",
                },
                {
                    kind: "text",
                    text: "A failure travels through the same channel as any other item and is routed along the same three paths, as derived in a turn never ends to wait. A gate's result line is the same routing in miniature, with a third arm that the item channel also needs. An unknown, meaning a claim the run could not measure, is blocked rather than passed, and blocked is a state that names the party who owes the answer. The commit node carries the rule that a report goes to the parties whose next work it creates.",
                },
                {
                    kind: "text",
                    text: "The handler removes the item by its id, after extraction, as the board and the venue requires. An item whose readers have all gone is re-addressed rather than left, because an item that no party can handle reads as live traffic forever.",
                },
                { code: ITEM_SAMPLE, kind: "code", language: PAG_LANGUAGE, title: "an item" },
                { code: SIGNAL_SAMPLE, kind: "code", language: PAG_LANGUAGE, title: "failure routes" },
                { code: CLOSE_SAMPLE, kind: "code", language: PAG_LANGUAGE, title: "closing an item" },
                { caption: "kind selects closure", kind: "mermaid", text: ITEM_DIAGRAM },
                { caption: "failure to finding", kind: "mermaid", text: FAILURE_DIAGRAM },
            ],
            title: "Typed items, falsifiable closures",
        },
    ],
    title: "Handoff signals",
};
```
