// Verifier label ladder: how (audit_mode, violations) → display rung.
//
// Schema column `audit_mode` keeps the v9.8 trichotomy
// (STRICT / HYBRID / UNGROUNDED). The display ladder is a renderer-
// only transformation that names what's actually proved at each rung.
//
// Render: dot -Tsvg verifier-ladder.dot -o verifier-ladder.svg

digraph verifier_ladder {
    rankdir=TB
    node [shape=box, style="rounded,filled", fontname="Helvetica", fontsize=10]
    edge [fontname="Helvetica", fontsize=9]
    bgcolor="white"

    // Inputs
    inputs [label="VERIFIER OUTPUT\naudit_mode ∈ {STRICT, HYBRID, UNGROUNDED}\nviolations: list[dict]", fillcolor="#fff7e6", shape=note]

    // Decision tree
    is_ungrounded [label="audit_mode == UNGROUNDED?", fillcolor="#dddddd", shape=diamond]
    has_warrant_miss [label="WARRANT_MISSING or\nTITLE_MISMATCH in violations?", fillcolor="#dddddd", shape=diamond]
    has_soft_demote [label="any soft-demote violation?\n(LAZY_ANCHOR_DEMOTED,\nPOINTER_OVERFLOW_TRIMMED,\nTOO_MANY_CLAIMS, BARE_NAME_CLAIM,\nFORMAT_COLLAPSED,\nBROAD_QUANTIFIER_RUNAWAY,\nBROAD_QUANTIFIER_CAP_APPLIED,\nBROAD_QUANTIFIER_SCOPE_UNBOUND, …)", fillcolor="#dddddd", shape=diamond]
    is_hybrid [label="audit_mode == HYBRID?", fillcolor="#dddddd", shape=diamond]

    // Rungs (top to bottom = strongest to weakest)
    evidence_warranted [label="EVIDENCE-WARRANTED\npointer verified +\nwarrant ran & passed +\nNO soft demotes", fillcolor="#28a745", fontcolor="white"]
    anchor_warranted [label="ANCHOR-WARRANTED\npointer-linked +\nwarrant passed where it ran;\nsoft demotes present", fillcolor="#7cc66e"]
    pointer_linked [label="POINTER-LINKED\npointer/source/chunk verified;\nwarrant didn't apply OR failed\nfor at least one claim", fillcolor="#ffc107"]
    ungrounded [label="UNGROUNDED\nno verified pairs\nat all", fillcolor="#dc3545", fontcolor="white"]

    // Suffix annotation
    partial [label="HYBRID → add `-PARTIAL` suffix\non whichever rung applies", fillcolor="#fff0e0", shape=note]

    // Audit-line tail tokens (#000008 + #000010 — pure render layer,
    // composed onto the rung label after the suffix is applied).
    tail_tokens [label="AUDIT-LINE TAILS\nappended to all rung labels:\n#000008 quantifier guard:\n  · broad cap N · broad rejected\n  · broad unbounded · broad runaway\n#000010 metacognition preflight:\n  · false premise · contradictory\n  · stale risk · out of corpus\n  · frame ambiguous\nclassic verifier:\n  · warrant missing · title mismatch\n  · format collapsed", fillcolor="#fff0e0", shape=note]

    // Decision flow
    inputs -> is_ungrounded
    is_ungrounded -> ungrounded [label="yes"]
    is_ungrounded -> has_warrant_miss [label="no"]
    has_warrant_miss -> pointer_linked [label="yes"]
    has_warrant_miss -> has_soft_demote [label="no"]
    has_soft_demote -> anchor_warranted [label="yes"]
    has_soft_demote -> evidence_warranted [label="no"]

    // HYBRID adds suffix to all 3 non-UNGROUNDED rungs
    evidence_warranted -> is_hybrid [style=dotted]
    anchor_warranted -> is_hybrid [style=dotted]
    pointer_linked -> is_hybrid [style=dotted]
    is_hybrid -> partial [label="yes" style=dotted]

    // All four rungs can carry tail tokens.
    evidence_warranted -> tail_tokens [style=dashed, color="#888888"]
    anchor_warranted -> tail_tokens [style=dashed, color="#888888"]
    pointer_linked -> tail_tokens [style=dashed, color="#888888"]
    ungrounded -> tail_tokens [style=dashed, color="#888888"]

    {rank=same; evidence_warranted; anchor_warranted; pointer_linked; ungrounded}
}
