import { PAG_LANGUAGE } from "#configuration/constants/code.constants"; import { PRINCIPLE_SECTION_ICON } from "#configuration/icons/grammar.icons"; import { PRINCIPLE_SECTION_ID } from "#core/ids/grammar.ids"; import type { Section } from "#types/document.types"; const INVARIANT_SAMPLE = "# CROSS-NODE INVARIANTS (each a record with four slots · a property nothing would object to declares its objector as none)\nINVARIANT one-writer-per-record: a record is written only by the party named on it over: every record on every shared surface binds: every party that writes a surface objector: [check] the anchored edit refuses a write outside the caller's span\nINVARIANT no-written-state: no party writes a status marker over: every item on the coordination surface binds: every party objector: [check] a scan for markers on every run\nINVARIANT handler-removes: an item is removed by a party in its reader set over: every closed item binds: every party objector: none\n\n# the scan reads the four slots and refuses a record missing one\n[check] every invariant names its set, its parties and its objector (evidence: the defect scan) over: measured: / "; const CLOSING_SAMPLE = "# a node's gate cites the invariant it holds rather than restating it\nHANDOFF GATE:\n [check] the write landed inside the caller's span (evidence: the anchored edit's report) # \n [check] no marker written (evidence: the marker scan) # \n [check] the removed item named this party in its reader set (evidence: the item's fence) # · objector none, so this check is the only watcher\n result: pass -> NODE 4 | span breached -> REPAIR (owner: NODE 3) | unknown -> BLOCKED"; const HOME_DIAGRAM = 'flowchart LR\n stated["One record per invariant · property, set, parties, objector"]\n closing["The document\'s invariant block · holds it"]\n role["The role · the invariants this party protects, by name"]\n check["A gate check · the half an artifact can observe"]\n closing --> stated\n role --> stated\n check --> stated'; export const PRINCIPLE_SECTION: Section = { icon: PRINCIPLE_SECTION_ICON, id: PRINCIPLE_SECTION_ID, intro: "A collaboration relies on invariants, and stating an invariant teaches what one must carry: the property in a form that could be false, the set it quantifies over, the parties it binds, and the objector that would disagree if it stopped holding. A document declares each once as a record in its invariant block, as invariant records shows, and a party's role and a gate check each point at that record rather than restating it, which gate cites records writes and three homes draws.", subsections: [ { blocks: [ { application: "Declare every invariant a collaboration relies on as a record with four slots, and where nothing in any artifact would disagree, write none as the objector so the debt is declared rather than hidden. Let a gate check cite the record it holds and let a role name the invariants that party protects, as a seat is a contract describes. Never head a block with a bare modifier and a list of bullets: a bullet carries no set, no parties and no objector, which is what the scan refuses it for.", boundary: "The invariants scale with the parties and the shared surfaces.", cause: "A restatement is a copy, and a copy carries no edge back to the statement it copied; a bullet is a restatement with even the statement's slots dropped.", decision: "Declare each invariant once as a four-slot record and point at it from every home, rather than restate it where each party reads.", failureMode: "A document's closing lines, a role and a check each carry their own wording of one rule, one is edited, and the other two keep binding the old rule.", kind: "lesson", principle: "A collaboration's invariants are stated with their objectors, and every home that needs one points at the statement.", problem: "An invariant restated in every document that needs it is a set of copies that drift.", validation: "For each gate check and role entry, name the invariant record it points at. A line that points at nothing is a copy, and the record it should point at is the finding; a record whose objector is none is the debt the tension has a mechanism names for a rule with no check.", }, { kind: "text", text: "One statement, three homes that point at it. A document's invariant block holds the records. A role lists the invariants that party protects, by name. A gate check holds the half an artifact can observe, and where the objector is none that check is the only watcher, so it says so. Delivery demands that an invariant reach every party that needs it, and pointing is how it reaches them without a copy that can disagree, so the record is the unit that is re-derived whenever the invariant changes.", }, { code: INVARIANT_SAMPLE, kind: "code", language: PAG_LANGUAGE, title: "invariant records" }, { code: CLOSING_SAMPLE, kind: "code", language: PAG_LANGUAGE, title: "gate cites records" }, { caption: "three homes", kind: "mermaid", text: HOME_DIAGRAM }, ], title: "Declared once, cited thrice", }, ], title: "Orchestration invariants", };