Skip to content

Commit d994759

Browse files
igerberclaude
andcommitted
fix(reviewer-eval): prose block gates on the -z discovery, not quoted name-status (CI codex P1)
touches_notebook() parses non-z name-status text where git's default core.quotePath C-quotes non-ASCII/special paths — the tab-split predicate silently missed them, excluding the notebook from the diff body while never building its prose block. The prose builder's robust null-delimited --name-only -z discovery is now authoritative (it returns '' when no tutorial changed). Regression test: a C-quoted non-ASCII tutorial filename still gets its prose block. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
1 parent dcd0d7d commit d994759

2 files changed

Lines changed: 33 additions & 8 deletions

File tree

tests/test_evals_adapters.py

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -416,3 +416,23 @@ def test_notebook_prose_aggregate_cap_is_bytes(tmp_path, monkeypatch):
416416
assert "--- docs/tutorials/a.ipynb ---" not in block
417417
assert "AGGREGATE TRUNCATION" in block
418418
assert " - docs/tutorials/a.ipynb" in block
419+
420+
421+
def test_notebook_prose_built_for_git_quoted_filename(tmp_path):
422+
"""P1 regression: a tutorial notebook whose path git C-quotes under the
423+
default core.quotePath (non-ASCII) must still get its prose block — the
424+
prose builder's -z discovery is authoritative, not the quoted
425+
name-status text."""
426+
from adapters.ci_prompt import build_ci_prompt
427+
428+
nb = _make_nb([("markdown", "# quoted-path marker PLUGH")])
429+
repo, base, head = _init_case_repo(tmp_path, {"docs/tutorials/tütorial-ñb.ipynb": nb})
430+
prompt = build_ci_prompt(
431+
worktree_dir=repo,
432+
base_sha=base,
433+
head_sha=head,
434+
base_prompt="RULES",
435+
extractor_path=_EXTRACTOR,
436+
)
437+
assert "PLUGH" in prompt
438+
assert '<notebook-prose untrusted="true">' in prompt

tools/reviewer-eval/adapters/ci_prompt.py

Lines changed: 13 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -332,14 +332,19 @@ def build_ci_prompt(
332332
"""
333333
name_status = git_name_status(worktree_dir, base_sha, head_sha)
334334
unified = git_unified_diff(worktree_dir, base_sha, head_sha)
335-
prose_block = ""
336-
if touches_notebook(name_status):
337-
if extractor_path is None:
338-
# TRUSTED current-repo extractor (documented divergence from CI's
339-
# base-SHA staging) — never the case worktree's copy, which is
340-
# case-controlled content.
341-
extractor_path = os.path.join(_HARNESS_REPO_ROOT, DEFAULT_EXTRACTOR_RELPATH)
342-
prose_block = build_notebook_prose_block(worktree_dir, base_sha, head_sha, extractor_path)
335+
if extractor_path is None:
336+
# TRUSTED current-repo extractor (documented divergence from CI's
337+
# base-SHA staging) — never the case worktree's copy, which is
338+
# case-controlled content.
339+
extractor_path = os.path.join(_HARNESS_REPO_ROOT, DEFAULT_EXTRACTOR_RELPATH)
340+
# Unconditional: the prose builder discovers changed tutorials itself via
341+
# the robust null-delimited `--name-only -z` read (returning "" when none
342+
# changed). Gating on touches_notebook() would re-parse the NON-`-z`
343+
# name-status text, where git's default core.quotePath C-quotes
344+
# non-ASCII/special paths and the tab-split predicate silently misses
345+
# them — the diff body would exclude the notebook while no prose block
346+
# was ever built (CI's -z path handles those names).
347+
prose_block = build_notebook_prose_block(worktree_dir, base_sha, head_sha, extractor_path)
343348
return assemble_prompt(
344349
base_prompt=base_prompt,
345350
name_status=name_status,

0 commit comments

Comments
 (0)