docs(okf): re-ground the null-byte test's rationale on the resolve guard, not the retired heuristic

The commons pull (7aa53fc..a2b57d2) retires "a path separator means out-of-bundle"
in method-spec §3 Step 1. test_navigate_skips_null_byte_link stayed GREEN, but its
docstring explained itself via that heuristic ("slips past the `/` pre-filter") —
a live test citing dead doctrine. Behavior and assertions are unchanged; only the
reason is re-anchored on what the new spec makes load-bearing: a target failing to
resolve for ANY reason is skipped, not raised (§11 row "Navigation boundary").

Measured, not assumed: this was the only rotted rationale. The three other
separator mentions (okf.py:26-27, :125, test_okf.py:164) describe what the code
actually does or rest on safe_resolve, which survives the retirement.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01HxGWaoDYb6vmzd7EPfYkqS
This commit is contained in:
Kjell Tore Guttormsen 2026-07-31 18:40:48 +02:00
commit bb877d241f

View file

@ -141,10 +141,15 @@ def test_navigate_tolerates_broken_links(tmp_path) -> None:
def test_navigate_skips_null_byte_link(tmp_path) -> None:
"""OKF SPEC §4 (okf.py:8-9): a broken link is NEVER raised. A link target carrying an embedded
null byte has no path separator, so it slips past the ``/`` pre-filter and reaches path
resolution, where ``os.path.realpath`` raises ``ValueError`` which MUST be absorbed
fail-closed (skipped), not propagated out of ``navigate_bundle``."""
"""OKF SPEC §4 (okf.py:8-9): a broken link is NEVER raised. A null byte is an INVALID PATH
COMPONENT, so path resolution raises ``ValueError`` which MUST be absorbed fail-closed
(skipped), not propagated out of ``navigate_bundle``. This is the *malformed* sub-class of
method spec §3 Step 1's "a target that fails to resolve for ANY reason (missing file, invalid
path component, escape) is skipped, not raised" (§11 row "Navigation boundary").
The rationale rests on the RESOLVE guard alone, never on the retired "a path separator means
out-of-bundle" heuristic: this test stays green — and its reason stays true — once that
heuristic goes and nested targets become legal."""
(tmp_path / "index.md").write_text(
"---\ntype: index\n---\n\nSee [bad](a\x00b.md) and [ok](real.md).\n",
encoding="utf-8",