coverage.anchor¶
Per-capture anchor resolution: one tree diff, per-file blob fallback (spec §8/§9).
Semantics table lives in AnchorResolver’s docstring; keep it in sync with tests/unit/cov/test_anchor.py.
- class otto.coverage.anchor.AnchorResult(new_relpath: ~pathlib.Path | None, hunks: list[~otto.coverage.capture.remap.Hunk] = <factory>, verifiable: bool = True)¶
Bases:
objectWhere one file’s capture coordinates land in the current tree.
-
class otto.coverage.anchor.AnchorResolver(repo_root: Path, base_commit: str, *, files: dict[str, CaptureFileCov] | None =
None)¶ Bases:
objectResolve every file of one capture against the working tree.
situation | result |base ok, absent from tree diff | (relpath, [], True) — unchanged/ws-only |base ok, modified | (relpath, hunks, True) |base ok, renamed | (new_path, hunks, True) |base ok, deleted | (None, [], False) |base missing (GC’d / shallow) | batched fallback index (or per-file chain) |- resolve(relpath: Path, fc: CaptureFileCov) AnchorResult¶
Resolve one capture-relative relpath against this resolver’s diff/fallback.