Skip to content

feat(family-2): parser-safe adapter transforms + external-benchmarks table - #2

Merged
blade47 merged 3 commits into
mainfrom
bench/codewikibench-parser-safe
Sep 2, 2026
Merged

feat(family-2): parser-safe adapter transforms + external-benchmarks table#2
blade47 merged 3 commits into
mainfrom
bench/codewikibench-parser-safe

Conversation

@blade47

@blade47 blade47 commented Aug 31, 2026

Copy link
Copy Markdown
Contributor

What

Two content-preserving transforms in the CodeWikiBench adapter, closing the retained-word gap measured by the free dry-run, plus the external-benchmarks comparison table extended to all four published systems.

Measured loss modes in the pinned parser (probed directly against 5e728fb4 with controlled markdown, 2026-08-31):

  1. Preamble death — text between a heading and its first child heading has no dict key to hang on in markdown_to_json's tree and is dropped whole. hoistPreambles packages each preamble as a synthetic first child heading ("Overview", with Introduction/Preamble/numbered fallbacks on sibling collision) — the same key shape CodeWiki's own example output uses.
  2. After-list death — within a section span, everything after the first list dies: a trailing paragraph, a second list, and list items sitting directly above a Sources: line. neutralizeNonFinalLists escapes the markers of any list that is not the span's trailing list (1.1\.), which renders identically but parses as paragraphs, which always survive.

Neither transform adds, removes, or reorders a word: packaging for their parser, not editing.

Results (dry-run, all pages parsed before and after)

corpus retained-word fraction
hono-2026-07-v2 0.7339 → 0.9516
hono-2026-07 0.9508

A word-multiset diff of the residual shows ~2/3 is markdown syntax that can never reappear as words in the parsed JSON (##, >, fence info-strings, [!NOTE] tags) — content-level retention is ~99%, the DESIGN target.

Also

docs/comparison-systems.md's external-benchmarks table now lists all four published Table 1 systems — naming CodeWiki (Sonnet-4) as the benchmark authors' own generator — and states the Family-2 comparability contract (their published per-repo rubrics + their exact judge panel), so doc0's row will compare per-repo against every published row without re-running any peer.

Tests

10 new cases pin both transforms (fence masking, collision fallbacks, tight lists, trailing-Sources shape, span independence). Full suite: 9 files / 116 tests green; eslint clean.

🤖 Generated with Claude Code

https://claude.ai/code/session_01DfgE3Yucn5LUDZPpqJzhz2


View with [code]smith Autofix with [code]smith
Need help on this PR? Tag @codesmith-bot with what you need. Autofix is disabled.

Review round 1 (Codex)

  • Skipped heading levels (fcd281c): the pinned parser splits each section on headings at exactly parent+1 and discards everything before the first match, so a first child that skips a level (H1 straight to H3, redis-2026-07/cluster-routing.md) made the synthetic ## Overview childful and lost the preamble again. A synthetic heading at the child's own level is skipped over with it. New normalizeHeadingLevels pass (stack walk) runs first inside hoistPreambles. That page: 0.834 → 0.997 on the real parser; byte-identical no-op on the other 542 pages.

blade47 and others added 2 commits August 31, 2026 14:46
Two measured loss modes in the pinned CodeWikiBench parser (probed directly
against 5e728fb4, 2026-08-31):

1. Preamble text under a heading with child headings has no dict key to
   hang on and is dropped whole. Fix: hoistPreambles packages each preamble
   as a synthetic first child heading ("Overview", with collision
   fallbacks), the same key shape CodeWiki's own example output uses.
2. Within a section span, everything after the first list dies: a trailing
   paragraph, a second list, and (the corpus staple) list items directly
   above a Sources line. Fix: neutralizeNonFinalLists escapes the markers
   of any list that is not the span's trailing list (1. -> 1\.), which
   renders identically but parses as paragraphs, which always survive.

No words are added, removed, or reordered by either transform; this is
packaging for their parser, not editing.

Measured on the committed hono corpora (dry-run, all pages parsed both
before and after):
  hono-2026-07-v2: retained-word fraction 0.7339 -> 0.9516
  hono-2026-07:    0.73x -> 0.9508
Word-multiset diff shows the residual gap is ~2/3 markdown syntax tokens
(heading markers, blockquote prefixes, fence info-strings, alert tags), so
content-level retention is ~99%.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01DfgE3Yucn5LUDZPpqJzhz2
…nch systems

CodeWiki (Sonnet-4) is named as the benchmark authors' own generator, and
the deepwiki-open and OpenDeepWiki rows join from the paper's Table 1. Notes
the Family-2 comparability contract: their published per-repo rubrics + their
exact judge panel, so doc0's row compares per-repo against every published
row without re-running any peer. The 7-vs-21-repo scope discrepancy is cited
as-published per docs/codewikibench-pinned.md (f).

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01DfgE3Yucn5LUDZPpqJzhz2

@greptile-apps greptile-apps Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Your trial has ended. Reactivate Greptile to resume code reviews.

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Aug 31, 2026

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review Completed 2026-09-02T15:23:58.757516Z fcd281c New commits
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: e8b8569219

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread runners/codewikibench.ts
…preambles

The pinned evaluator parser (markdown_to_json 2.1.2) splits a section on
headings at exactly one level below its own and discards every block before
the first one it finds. A first child that skips a level (H1 straight to H3,
the shape of corpora/redis-2026-07/cluster-routing.md) is never a key: the
synthetic "## Overview" swallowed the H3, became childful, and the preamble
was dropped again. Placing the synthetic heading at the child's level does
not help either, since the parser then skips over both of them together
(probed directly against the pinned parser).

normalizeHeadingLevels re-levels every heading to exactly one deeper than
its nearest shallower predecessor (stack walk, first heading keeps its
level), and hoistPreambles runs it first so its one-level-deeper invariant
holds. Heading text and order are untouched. On the redis page, parser
retention goes from 0.834 to 0.997; the transform is a byte-identical
no-op on the other 542 corpus pages.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01HS8GHxjM3NfU2nPk1hwVJx
@blade47
blade47 merged commit dbb7eb9 into main Sep 2, 2026
5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant