/** * @copyright Sister Software * @license AGPL-3.0 * @author Teffen Ellis, et al. * * Structural-validity checker for the decoded `AddressTree` — v0.7 task #37. * * The postcode-only harness scores an address as "pass" on exact component match, but a parse can * match a component and still be STRUCTURALLY incoherent — e.g. a `house_number` or * `street_suffix` floating with no `street` anywhere, an `attention` with no `venue`. These * orphan fragments are the signature of the overconfident hallucinations the v0.6.x cycle fought. * This checker lifts the harness from "address-level pass" to "address-level pass AND * structurally valid." * * Two checks: * * 1. **illegal-edge** — invariant: a non-root node's parent tag must appear in its `PARENT_OF` list. * (The tree builder enforces this by construction; the check guards against regressions in * build-tree.ts.) * 2. **stranded-dependent** — a STRICT dependent tag (one that is meaningless without a structural * anchor) whose anchor type is entirely ABSENT from the tree. Geographic containers * (postcode / locality / region / street / venue / po_box) are deliberately NOT checked: a * postcode-only or city-only input is a degenerate-but-valid parse, not a violation. */ import type { ComponentTag } from "../types/component.ts"; import type { AddressTree } from "./types.ts"; /** * Tags that cannot stand alone: each is a sub-component of a specific structural anchor (street / locality / venue / * postcode). If none of a tag's allowed parents appear anywhere in the tree, the node is an orphan fragment. * * This set is also the DENOMINATOR of the stranded-dependent check — the classes that CAN fire — so a caller counting * which ones do reads it here rather than re-listing the tags, which would drift the moment one is added. */ export declare const STRICT_DEPENDENTS: ReadonlySet; export interface TreeViolation { type: "illegal-edge" | "stranded-dependent"; tag: ComponentTag; value: string; detail: string; } export interface TreeValidity { valid: boolean; violations: TreeViolation[]; } /** * Validate an `AddressTree`'s structural coherence. See module docstring. */ export declare function validateTree(tree: AddressTree): TreeValidity; //# sourceMappingURL=validate-tree.d.ts.map