import { PAG_LANGUAGE } from "#configuration/constants/code.constants"; import type { Section } from "#types/document.types"; import { VALIDATION_SECTION_ICON } from "#configuration/icons/grammar.icons"; import { VALIDATION_SECTION_ID } from "#core/ids/grammar.ids"; const GATE_SAMPLE = 'HANDOFF GATE (evidence-bearing):\n rule_id: "" yields: \n [check] exists at (evidence: the listing that shows it)\n [check] conforms to (evidence: the validator\'s report) over: measured: / \n [check] every in resolves (evidence: the resolution log)\n ASSERT above 0\n REQUIRE .\n refuse: changed since it was read before PERSIST_ARTIFACT\n standing: moved-set \n result: pass -> NODE | -> REPAIR (owner: ) | unknown -> BLOCKED'; const POPULATION_SAMPLE = "# a verdict with no domain · passed over what?\n[check] every settings file conforms (evidence: the validator's report)\n\n# a verdict beside its domain · zero of zero is not evidence\n[check] every settings file conforms (evidence: the validator's report) over: measured: 12 / 12\n[check] every settings file conforms (evidence: the validator's report) over: measured: 0 / 0 # empty · the gate fails\n\n# the three verdicts · unknown is routed, never absorbed into pass\nresult: pass -> NODE 4 | schema mismatch -> REPAIR (owner: NODE 2) | unknown -> BLOCKED"; const CONDITION_SAMPLE = "# a judgement · true for whoever reads it\n[check] the email looks valid\n[check] the data is good\n[check] everything worked\n\n# a condition · true or false against the artifact, with what settles it and what it ranged over\n[check] . matches (evidence: the match returned true)\n[check] is non-empty (evidence: a count above zero)\n[check] every required field present in (evidence: no missing field named) over: measured: / \n[check] . equals . (evidence: the two numbers)"; const GATE_DIAGRAM = 'flowchart TB\n node["A node yields its output"]\n conditions["Three to five checks · each against the output"]\n evidence["Each carries the evidence that decided it and the set it ranged over"]\n refuse["A write is refused before it lands when its condition holds"]\n verdict{"pass · fail · unknown"}\n next["The next node\'s contract reads exactly that output"]\n action["The result line · which check, what was found, which node owns the repair"]\n blocked["BLOCKED · the answer is owed by someone outside the run"]\n node --> conditions --> evidence --> refuse --> verdict\n verdict -- pass --> next\n verdict -- fail --> action\n verdict -- unknown --> blocked'; const CONDITION_DIAGRAM = 'flowchart LR\n judgement["looks valid · a judgement"]\n who["True for whoever reads it"]\n condition["matches the pattern · a condition"]\n what["True or false against the artifact"]\n domain["Over a declared set · n of N"]\n judgement --> who\n condition --> what --> domain'; export const VALIDATION_SECTION: Section = { icon: VALIDATION_SECTION_ICON, id: VALIDATION_SECTION_ID, intro: "A handoff gate closes a node with three to five checks, each checkable against the node's output, each carrying the evidence that decided it and the set it was measured over, the whole of a gate and what at the boundary draws. Its result line has three arms: the next node on pass, the node that owns the repair on failure, and blocked on unknown, the third verdict verdict and domain shows. A check is a comparison and never a judgement, as judgement or check rewrites one and who decides draws the difference. The gate is the verify stage of the loop, and the methodology's unknown is not pass is its third arm. A node boundary is trusted only when its checks are specific, its verdict carries its domain, and its writes are refused before they land.", subsections: [ { blocks: [ { application: "Close every node with a gate of three to five checks. Write each as a comparison against the node's output, with the evidence that settles it beside it and, wherever the check ranges over a set, that set and the count measured over it. Mark a hard assertion and a prerequisite as such. Where the node writes, name the condition under which it refuses before the write. Write the result line with all three arms, so a failed check names what was found and routes to the earliest node that can supply the missing evidence, and an unmeasured claim routes to blocked rather than reading as pass. Let the next node's contract read exactly the output the gate confirmed.", boundary: "A gate checks outcomes and never confidence. A check about how sure the model is, or whether it understood, is not observable from outside and belongs under limits rather than in a gate.", cause: "A condition that compares an artifact to a value can be evaluated by anyone, and a condition that asks whether something looks right can be evaluated only by whoever is looking; a verdict with no domain cannot say what it was true of.", decision: "Put the evidence and the population beside the check rather than trust the verdict, so a green reads as coverage and not as silence.", failureMode: "A gate reads that the data looks good, the model reports the gate passed because the data looked good to it, and the next node consumes records that never matched the schema; or the check ran over an empty set and passed over nothing.", kind: "lesson", principle: "A check is specific and checkable, with its evidence, its population and its repair owner beside it, and unknown is its own verdict.", problem: "A vague check passes whatever the reader is inclined to pass, and a check with no domain passes over nothing.", validation: "Rewrite each check as a comparison and name the artifact on each side and the set it ranged over. A check with no artifact on one side is a judgement, a check with no set is a verdict about nothing, and the node either closes is open however the gate reads.", }, { kind: "text", text: "The count is bounded on both sides: fewer than three and the gate checks that something ran rather than that a unit closed; more than five and the node has several decisions and is several nodes. A gate that passes and a gate that was never evaluated produce the same silence, which is what the evidence beside each check breaks. A gate that passed over an empty set is the same silence wearing a number, which is what the population beside the verdict breaks. The result line is fail fast at the boundary, the rule fail at the boundary states for a system, and its owner is the earliest node that can supply what the check lacked, so a repair invalidates forward from there and nothing earlier is redone.", }, { kind: "text", text: "The refusal line is where the node declines to continue before an irreversible write, which is the only moment a refusal costs nothing. The standing line names the surfaces that moved beneath the verdict, and a non-empty moved set withdraws the verdict's standing to be quoted without touching the verdict itself, which is what a report, not a checkbox derives. The markers are a closed set with one meaning each: a check, a hard assertion, a prerequisite a prior node must have yielded. Severity is not a marker, because severity orders repairs among failures and never softens a verdict; there is no tier between fail and pass.", }, { code: GATE_SAMPLE, kind: "code", language: PAG_LANGUAGE, title: "a gate" }, { code: POPULATION_SAMPLE, kind: "code", language: PAG_LANGUAGE, title: "verdict and domain" }, { code: CONDITION_SAMPLE, kind: "code", language: PAG_LANGUAGE, title: "judgement or check" }, { caption: "at the boundary", kind: "mermaid", text: GATE_DIAGRAM }, { caption: "who decides", kind: "mermaid", text: CONDITION_DIAGRAM }, ], title: "Checkable, with evidence", }, ], title: "Validation gates", };