sweep: import the engine's anchored_scan; pin engine consumers commit
The anchor-windowed scanning machinery sweep.py carried privately
(~270 lines: gate/anchor derivation, window merge, clip-guard) was
extracted into the engine as legalpdf/anchored_scan.py (engine 2821387).
Now that the full rerun is off the machine, the sweep drops its copy and
consumes the engine module: _ENTRIES becomes (id, AnchoredPattern,
gate), scan_doc counts via pattern.finditer(text, lower), and the
engine handle owns every fallback (small text, .lower() length drift,
coverage bailout, window-edge clip). Kept sweep-side: the _HAND_ANCHORS
per-match-mandatory sets, PREFILTER-gate precedence, and the launch
discipline. probes/shard_gate_check.py and probes/perf_gate.py follow
the new entry shape; perf_gate's per-entry cost now times the real
production path (windowed), not the bare full scan.
Equivalence notes: sweep's _ANCHOR_MIN_LEN=2 was dead weight (literal
runs flush at >= 3 chars, so no 2-char literal ever reached the filter)
- the engine's stricter constant derives identical anchors. The empty
_NO_ANCHOR opt-out set died with the copy.
Gates: shard_gate_check reservoir differential re-run green - 0 gate
misses, 0 window mismatches over the sample, shard path reproduces
legacy aggregation exactly. Engine pin 9e72346 ("Consumers adopt
AnchoredPattern for whole-input scans"): deterministic_citations
full-doc scan sites + benchmark._CITATION_RES go windowed, measured
1.57x on 21 real SCC decisions with byte-identical spans; engine suite
93 passed + 34 subtests.
Integration plan item 6 (task #28). TS mirror + derived-anchor drift
gate stay deferred to Phase 4 (engine anchored_scan.py docstring carries
the pointer).
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_012AgUm5EcRKbT3duVFMbrQD
| Repository | eliziff/Beaver |
|---|---|
| Author | Eli Ziff <eliasziff@gmail.com> |
| Authored | |
| Parents | c9d21066 |
| Stats | 6 files changed , +36 , -273 |
| Part of | Deterministic legal-text tools ("SLA audit organs") |
Capture this commit into my fork
Download a Markdown prompt that tells Claude how to port this
exact commit into your working tree. Run it via
claude -p < capture-commit-73284884.md
from inside the repo you want the change in.