Repository navigation
Extract the result-page match tables into one set of macros, and sort them over the whole list (#50) - #152
Extract the result-page match tables into one set of macros, and sort them over the whole list (#50)#152r0ny123 wants to merge 3 commits into
Conversation
a22406b to
d3bd655
Compare
|
Held out of the batch C integration (#298, #299), and here is why. This PR replaces the inline match tables of
Merging means re-applying all of that inside the macros, so it's a rebase onto master once batch C lands. Three things for the rebase:
The sort/pagination interplay itself looked right: the reset to page 1, the sort params carried through 🤖 Generated with Claude Code |
Issue #50, the deduplication half. The four result pages each carried their own copy of every column_type dispatch chain: nine header/body pairs in result_compare_all, _family, _sample and _vs, differing in indentation and, on the 1-vs-1 page, in one column. They now call six macros in the new table/match_row.html. The macros emit cells only. The <tr> stays at the call site, because its background colour is per table and because the library table on result_compare_all.html opens its row differently from the other copies. That quirk is kept, not fixed, so the pages render as before. A macro does not see the caller's context, so matching_result, the score colour provider, the function pagination and the score divisors of familiary#148 are parameters now. url_for, request and join_hint_strings are globals. result_compare_vs.html had no branch for is_unique_match: against a single other sample a function's uniqueness across the corpus is not known (see the note in data.result()). That stays, as unique_match_known=False on the vs calls, so the reason is visible at the call site. result_compare_function.html keeps its own table. Its columns (family B, sample B) are in none of the others. Rendered on the captured reports, 960 pages (every report, page two, eight filter shapes and every famid, samid and funid the pages link to): the same HTML as master once whitespace and the session's CSRF token are normalised.
Jinja renders a macro called with the wrong arity as nothing, so a slip in a match_row.html call leaves a page that answers 200 with a table that lost or gained a column. tests/testResultTables.py looks at the tables themselves, on the overview and the famid, samid and funid views of the captured reports: - every match table has as many body cells as its header has columns (by colspan) times its rows; - no body cell leaves an <i> open, the shape the aggregated table's library and unique cells had before master fixed them; - the 1-vs-1 page renders the stored sample columns minus Uniq, compared against the sample-filtered page that gets the same list. Dropping unique_match_known=False from both vs calls keeps the table rectangular, so only this sees it; - the score tooltips divide by the divisors the view computes, checked with sentinel values in place of recover_score_divisors(). All four pass on master as well; they guard the refactor. Each fails when its guard is taken out: the flag dropped from both vs calls or from the header only, the old open-<i> form, binweight in place of the divisors.
The second box of issue #50. Every paginated match table on the result pages now sorts by clicking its header: the family, library and function tables of the overview, the sample and function tables of a family, and the function tables of the sample-filtered, 1-vs-1 and function pages. The sort runs in the view. These tables are server-paginated, so a sort in the browser would order one page and leave the list as it was. sorted_page() in views/result_sorting.py sorts the whole list a table is drawn from and then slices the page, so page two starts where page one ended. Without a sort, or with a sort column it has no key for, it builds the page as before: the aggregated function table keeps the page-only aggregation of familiary#194, and only a sorted page aggregates the whole report. The view hands each template its rows; the templates no longer slice. Pagination answers sort_by, is_ascending and get_sort_link the way CursorPagination does, so sortable_header_col works unchanged. The parameters come from each table's page parameter (famp -> fampsort, fampasc), which lets the three tables of result_compare_all.html sort independently. A sort link goes back to page 1 and keeps the other parameters. sortable_header_col gains a colspan for the Direct and Frequency headers, which cover a score and its library-excluded twin. The twins have no header of their own and so do not sort; splitting the header would change what the page shows. The two tables with nothing to page through, the sample-filtered page's one sample and the 1-vs-1 similarity scores, keep plain headers. The family and sample headers opened their icon's <i> and never closed it; they close it now, on every result page including the function page. Rendered on the captured reports, the same 960 pages as for the extraction: everything outside <thead> is the same HTML as master, and every header cell has the same text, icons, span and alignment. What differs is the sort link and icon on each sortable header.
7db5fe5 to
64631b0
Compare
|
Thanks. Rebuilt on master after batch C (6564602) rather than rebased: the old history no longer applied, so the macros were written again from master's markup, as three commits (5ac8494, cd18e16, 64631b0). They carry #194's
#253 and #160 now conflict with this in the moved markup (header icons, The branch is force-pushed over 7db5fe5. |
|
The three earlier points are fixed, thanks. It now conflicts non-mechanically with #253 and #302 (and #160 if that |
Update (2026-10-25), after the batch E review. Beyond what the old title said, this adds server-side column sorting to every paginated match table on the result pages: a header click sorts the whole list, then slices the page (see "Sorting" below). It lands after #275, which is on master now: the sortable headers put an
onclickon every result page, which is only safe with #275's escaping. It conflicts with #253 and #302 (and #160, if that goes first) in the markup it moves intotable/match_row.html, not mechanically, so it is rebuilt on master once those have landed, as the last review asked.Closes #50. The result pages each carried their own copy of every match table: nine header/body pairs in four templates, 244
column_type ==branches between them. They now share six macros intable/match_row.html, and the paginated tables sort by clicking a header, over the whole list rather than the page on screen.This is the branch rebuilt on master after batch C (6564602), as asked in the last review. The macros were written again from master's markup, so they carry everything master changed in those tables: #194's
function_rows, #148's rounded score cells and divisor tooltips, #244's aria labels, and the closed icon tags. What #122, #142 and #145 changed (job names in the headings,matching_statistics,match_diagram) sits outside the tables and stays in the pages as master has it. The old history (up to 7db5fe5) no longer applied and was replaced by three commits.Change.
Extraction (5ac8494).
table/match_row.htmlholds three header/row pairs:famlib_header/famlib_rowaggregated_function_header/aggregated_function_rowmatched_function_header/matched_function_row<tr>stays at the call site, because its colour is per table and because the library table ofresult_compare_all.htmlopens its row with<tr ...></tr>. That quirk is kept, so the pages render as before.matching_result,scp,funpand Round the score columns instead of truncating them (part of #7) #148'sdivisorsare parameters (famlib_row,mcritweb/templates/table/match_row.html:87).is_unique_matchcell: against one other sample a function's uniqueness across the corpus is not known. It isunique_match_known=Falseon its calls (match_row.html:215,:241).result_compare_function.htmlkeeps its own table; its family B and sample B columns are in none of the others.column_type ==branches: 244 on master, 92 here (70 in the macro file, 22 left inresult_compare_function.html).Tests (cd18e16), in a new
tests/testResultTables.pyrather than intestResultPages.py, which other PRs also change.Sorting (64631b0).
sorted_page()(mcritweb/views/result_sorting.py:90) sorts the whole list a table is drawn from and then slices the page. Without a sort, or with a column it has no key for, it builds the page the way master does. The aggregated function table therefore keeps Result views rebuild function aggregations and sample-match passes repeatedly #194's page-only aggregation, and only a sorted page aggregates the whole report (aggregated_function_rows,mcritweb/views/data.py:1141). No template slices any more; the view hands each table its rows.Paginationanswerssort_by,is_ascendingandget_sort_linkasCursorPaginationdoes (mcritweb/views/pagination.py:73,:141), sosortable_header_colworks unchanged. The parameters come from the table's page parameter (famp->fampsort,fampasc), so the three tables of the overview sort independently. A sort link goes back to page 1 and keeps the other parameters.sortable_header_colgains acolspan(mcritweb/templates/table/pagination_widget.html:196) for the Direct and Frequency headers, which cover a score and its library-excluded twin. The twins have no header of their own and do not sort.header_cell,match_row.html:45).<i>, on the function page too.From the review:
is_library_match/is_unique_matchcells use master's closed form (match_row.html:181,:183), and a test now fails on an<i>left open in any match cell or header.funpsortfalls back toaggregate_function_matches_page.sorted_pagenever sees a sliced page: it takes the full list and the unsorted page as two callables.famlib_rowtakesdivisors.Verification. On the captured reports (
tests/fixtures/, mcrit 1.13.0 data), every result page variant was rendered with master (6564602) and with each commit: every report, page two, eight filter shapes, and every?famid=,?samid=and?funid=the overview links to, with page two and a score filter on each. 960 pages, all answering 200. Whitespace and the session's CSRF token normalised:<thead>What the sorting changes in the headers is the sort link and icon on each sortable column, and the closing
</i>of the family and sample icons. The comparison was checked against a change it must see: droppingunique_match_known=Falsefrom the 1-vs-1 page made all 9 of its renders differ.On the testbed (mcrit 1.13.0), master (6564602) and this branch as side instances against the live backend, GET only: 41 pages of five finished jobs (two 1-vs-N, two 1-vs-1, one SMDA query), each with page two, a page of 25, and two of each
?famid=,?samid=and?funid=it links to. All 41 answered 200 on both, none rendered as corrupted, and the same comparison as above found them identical outside<thead>and in every header cell. The aggregated table of6abcb034595a8fbde6630826(242 functions), sorted by size descending and read over three pages of 100, is the master list in descending size order. A sorted page of 100 took 0.16 s against 0.10 s unsorted (median of 3).check_corpus.py: as in the snapshot.Tests.
tests/testResultTables.py, on the captured corpus with every matched function resolvable (astestResultPages.pywidens it):<i>open;recover_score_divisors();Five pass on master too and guard the refactor: the first four, and the unknown sort column, which master ignores as well. Each test was checked by taking its guard out: the flag dropped from both vs calls or the header only, the open-
<i>form in a cell or a header,binweightin place of the divisors, sorting the sliced page, no fallback, the direction ignored, the page kept in the sort link, and one set of sort parameters for all tables. Each fails at least one test.Full suite with Chromium: 2090 passed, 11 skipped.
testBrowserScoreTooltips.py, which drives the result pages' score tooltips, andtestBrowser.pyare among the skips there, because they launch Playwright's own Chromium rather thanMCRITWEB_CHROMIUM; run with/opt/pw-browsers/chromiumas the executable, their 5 tests pass.ruff check .clean.Relation to open PRs. A trial merge (
git merge-tree) with each open PR that touches the same files:theadclasses, fixes the library table's<tr ...></tr>and recolours the status icons in result_compare_all and _family, and makessortable_header_colkeyboard-operable, on the line this gives acolspan. Add a dark theme, chosen per account in Settings (#70) #160 recolours the status icons on the 1-vs-1 page. Both conflict with this; whichever merges later applies its change insidetable/match_row.htmlinstead. Establish UI/UX parity and design consistency across views #253's closed icons are already here.pagination_widget.html) and Check the sha256 of an SMDA report before it goes into a backend path #271 are on master now. Check job ids from the URL before they reach the backend client #279, Show how long a job with dependencies really took (#46) #149, A dedumped sample is not a dump, and an empty base address is not zero (#44) #141, Offer a rerun on the jobs a request can be faithfully rebuilt from (#55) #133 and Answer a failed backend call with a page, not a stack trace (#43) #130 add no conflict with this.