coverage.validity

Report-time validity for pinned manual captures (spec §7).

Anchor chain per file: blob fast-path → blob diff → pin diff → unverifiable (whole file stale, loud warning). Valid lines are loaded into the store under the capture’s tier; stale lines are marked but carry no hits; aging marks valid-but-old manual evidence.

otto.coverage.validity.load_capture_into_store(store: CoverageStore, capture: Capture, repo_root: Path) None

Fold a pin==HEAD (e2e-kind) capture into store verbatim.

The caller has already verified capture.pin equals the tree’s HEAD, so the capture’s pin coordinates are the current-worktree coordinates and no anchor chain / remap is needed. Unlike apply_manual_capture() this sets no validity states and appends no provenance — an automated capture carries no human session to attribute.

otto.coverage.validity.load_dirty_capture_into_store(store: CoverageStore, capture: Capture, repo_root: Path) None

Fold a pin==HEAD e2e capture in, remapping HEAD → dirty working tree.

An e2e capture carries no anchor chain: its coordinates are the exact pin commit’s line numbers. The caller has verified capture.pin equals HEAD, but when the working tree is dirty the renderer reads the edited on-disk source, so a verbatim insert (load_capture_into_store()) would misalign every hit past a local edit. Remap each file’s line/branch numbers from HEAD (OLD) to the working tree (NEW) using the same -U0 worktree diff + LineRemapper the manual anchor chain uses; hits on locally-modified lines have no NEW counterpart and are dropped.

otto.coverage.validity.apply_manual_capture(store: CoverageStore, capture: Capture, repo_root: Path, max_age_days: int | None, today: datetime | None = None) None

Fold one manual capture into store with validity states.