Implement EANCH-WP-0002 and EANCH-WP-0003 anchor hardening and DOM selectors
All checks were successful
CI Smoke / host-smoke (push) Successful in 4s
CI Smoke / container-smoke (push) Successful in 31s

WP-0002: stale vs unresolved resolution, orphaned flag/helper, bounded
fuzzy quote recovery, and PdfViewerAdapter promotion with resolveSelectors
integration. WP-0003: DomSelectionCapture, DOM create/resolve ladder,
HtmlViewerAdapter under evidence-anchor/dom, and finished workplans.

Verification: 42 anchor tests, citation-evidence typecheck + 51 tests green.
This commit is contained in:
tegwick 2026-07-09 09:18:42 +02:00
parent e4582b52fa
commit a1af0c6a45
22 changed files with 1118 additions and 105 deletions

View file

@ -12,7 +12,11 @@
import type { Document, DocumentRepresentation } from "@citation-evidence/engine/shared";
import type { Selector } from "@citation-evidence/engine/shared";
import type { AnnotationResolutionStatus } from "@citation-evidence/engine/shared";
import type { NormalizedRect } from "@citation-evidence/engine/shared";
import type {
DomNodePath,
NormalizedRect,
StructuralPathSegment,
} from "@citation-evidence/engine/shared";
/**
* The raw selection captured from a viewer adapter an opaque payload that
@ -36,8 +40,17 @@ export interface PdfSelectionCapture {
readonly boundingRect?: NormalizedRect;
}
/** Reserved for the HTML/Markdown adapter. Not implementable in MVP. */
export type DomSelectionCapture = never;
/** Selection captured from a rendered HTML/Markdown viewer. */
export interface DomSelectionCapture {
readonly kind: "dom";
/** Verbatim selected text, before canonical normalisation. */
readonly text: string;
readonly startPath: DomNodePath;
readonly startOffset: number;
readonly endPath: DomNodePath;
readonly endOffset: number;
readonly structuralPath?: readonly StructuralPathSegment[];
}
/**
* A passage located inside a representation, ready to be scrolled to and
@ -65,6 +78,11 @@ export interface AnchorResolution {
/** Names of the selector kinds that produced a usable candidate. */
readonly usedSelectorTypes: readonly string[];
readonly warnings?: readonly string[];
/**
* True when no selector could place the anchor at all. Distinct from `stale`,
* which signals representation drift and may still return fuzzy candidates.
*/
readonly orphaned?: boolean;
}
export interface HighlightRenderOptions {