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:
parent
2d91943fab
commit
bb877d241f
1 changed files with 9 additions and 4 deletions
|
|
@ -141,10 +141,15 @@ def test_navigate_tolerates_broken_links(tmp_path) -> None:
|
||||||
|
|
||||||
|
|
||||||
def test_navigate_skips_null_byte_link(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
|
"""OKF SPEC §4 (okf.py:8-9): a broken link is NEVER raised. A null byte is an INVALID PATH
|
||||||
null byte has no path separator, so it slips past the ``/`` pre-filter and reaches path
|
COMPONENT, so path resolution raises ``ValueError`` — which MUST be absorbed fail-closed
|
||||||
resolution, where ``os.path.realpath`` raises ``ValueError`` — which MUST be absorbed
|
(skipped), not propagated out of ``navigate_bundle``. This is the *malformed* sub-class of
|
||||||
fail-closed (skipped), not propagated out of ``navigate_bundle``."""
|
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(
|
(tmp_path / "index.md").write_text(
|
||||||
"---\ntype: index\n---\n\nSee [bad](a\x00b.md) and [ok](real.md).\n",
|
"---\ntype: index\n---\n\nSee [bad](a\x00b.md) and [ok](real.md).\n",
|
||||||
encoding="utf-8",
|
encoding="utf-8",
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue