Repository navigation
Table record match: read row-scoped section labels as body rows - #5
Merged
Merged
Conversation
A full-width section label written <th colspan="n" scope="rowgroup"> (or scope="row") lost its record. The parser rightly keeps a row-scoped header out of col_headers, but the header-block scanner still counted the row as a column-header row because it holds a <th>. With no column-header text, the title detector could not see it as a spanning title either, so the row was neither a column key nor a data row and its text dropped out of the records. The same markup without scope, or with <td>, kept the record. find_col_header_rows now stops at a body row whose <th> cells all declare a row scope, as it already does for rows whose <th> cells sit only in row-header columns. Rows inside <thead>, rows mixing row- and column-scoped headers, and markup without scope are unchanged.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
A table row made only of row-scoped headers, such as the full-width section label
<th colspan="3" scope="rowgroup">Assets</th>, now counts as a body row in table record matching. Its text no longer drops out of the records.Why
parse_html_tablescorrectly leaves a<th scope="row|rowgroup">cell out ofcol_headers. Butfind_col_header_rowsstill counted any body row holding a<th>as part of the column-header block. The title detector only looks atcol_headers, so the row was neither a column key nor a record, and its text was lost. The same markup withoutscope(or with<td>) kept its text, so the correct accessibility attribute cost content.Change
_declares_row_headers_onlyintable_title_stripping.py: a body row whose<th>cells all declare a row scope ends the header scan. This mirrors the existing handling of<th>row labels in a label column. Unchanged: rows inside<thead>, rows mixing row and column scopes, and markup withoutscope. Thescopeattribute is not stripped, because chart label lookups use it.Cherry-picked from
etienne/grader-ignore-scope(1181984) onto currentmain. Etienne remains the commit author.Testing
uv run ruff check src testsanduv run ruff format --check src testspass.uv run pytest -q: 5,153 passed.test_table_row_scope_label.py: 13 tests; 9 of them fail without the fix.Effect
Re-grading the stored Nutrient DWS (Agentic) table outputs from the 2026-10-29 measurement (503 pages, no new API calls):
5 pages change. 4 go up (
Low-Back-Guideline (1)_page20.777 → 0.944,Apple 10-k_page30.939 → 0.952,0000027_page10.747 → 0.754,FBLB-134215544_page150.973 → 0.979) and 1 goes down slightly (SERFF_TX_random_pages 1_page8570.438 → 0.434). Any provider that writes row-scoped<th>cells in body rows is affected the same way.The same commit goes upstream in run-llama#250, together with the Nutrient DWS row refresh.