ticket #000028 §2.6 sketch: refresh stale TODO post-#000027

Broader stale-map sweep across docs/, bench/, scripts/, Makefile, and
top-level surfaced one hit: the witness-mode example sketch in §2.6
of ticket #000028 still showed a no-op cache_lookup closure with
"TODO: wire post-#000027" — even though the real implementation in
arborist/qa/query.py:2158-2172 wired the cache leg in commit e19aed8
(2026-05-09), the same commit that closed both #000027 and #000028.

Updated the sketch to match the actual implementation: the cache
lookup closes over the prior persisted row's answer bytes (encoded
with surrogatepass for UTF safety), and the comparison is non-
tautological because cached_row is the row picked up BEFORE we'd
write a new one in this same call.

Same drift pattern as the #000028 §8 follow-up refresh (6d20aeb)
and the #000010/§000021/#000040 sweep (e84f453) and the repair.py
TODOs (8980e64): pre-implementation design notes don't get refreshed
after the implementation lands. Each instance is one session-waste
saved.

After this, both surfaces are clean:
- arborist/ + tests/ stale TODOs: zero (8980e64)
- docs/ + bench/ + scripts/ + Makefile + top-level: zero (this commit)

The remaining matches are all genuine future-work markers (raw_html
cache in async_web_fetcher.py:2309) or false-positives (\\uXXXX
escape-pattern docs in mesh/wire.py and tests/test_cli_render.py).
This commit is contained in:
russell@unturf.com 2026-05-10 07:52:54 -04:00
parent 8980e64aa0
commit 29ddd164bb
No known key found for this signature in database

View file

@ -261,10 +261,18 @@ if canonical_match is not None:
witness = None
if policy.get("canonical_witness_enabled", False):
from arborist.qa.witness import run_witness
# Cache lookup is a no-op closure pre-#000027 (always returns
# None). Post-#000027 it's the actual canonical_cache lookup.
def _cache_lookup() -> bytes | None:
return None # TODO: wire post-#000027
# Cache lookup closes over the prior persisted row's answer
# bytes (post-#000027 / e19aed8). The real implementation in
# arborist/qa/query.py:2158-2172 reads the cached_row picked
# up at the top of the canonical branch — comparing against
# that prior row, not anything we'd write in the same call,
# so the leg is non-tautological.
_cached_bytes = (
cached_row["answer_text"].encode("utf-8", errors="surrogatepass")
if cached_row is not None
else None
)
_cache_lookup = lambda: _cached_bytes # noqa: E731
witness = run_witness(
question=question,
pi_star_ref=pi_star_ref,