Repository navigation
Show versions and labelled sections on the Statistics page - #301
Merged
Merged
Conversation
The page printed the first twelve keys of the backend's status as they came, raw names and all. On mcrit 1.13 that cut off the stale MinHash and block hash counts, the rows that say a maintenance job is due, and the versions of MCRITweb and of the backend were nowhere on it. statistics_page() in mcritweb/statistics.py turns the status answer into a Versions, a Corpus and an Index section with labels and thousands separators, a Maintenance list that names a count only when it is above zero together with the job that redoes it, and the escaper fingerprints per architecture. A key it has no label for goes under Other, so a newer backend is never trimmed. The versions are MCRITweb's (MCRITWEB_VERSION), the backend's (backend_version, moved from the admin view to views/client.py so both pages share it), the installed mcrit client library's and the backend's SMDA. The database's last change is shown as a UTC date and time, which is the clock mcrit stamps it with on every release from 1.12 on. The page keeps asking for the distinct PicHash count, which is one of the corpus figures. A backend without a status answer still gets the versions and a sentence saying so.
This was referenced Oct 20, 2026
danielplohmann
added a commit
that referenced
this pull request
Oct 29, 2026
This was referenced Oct 29, 2026
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.
The Statistics page printed the backend's status as raw key names, and only the first twelve of them (
{% if loop.index <= 12 %}instatistics.html:9on master 6564602). mcrit 1.13 reports 15 keys and 1.16 reports 17, so the page cut off the MinHash compatibility threshold and every stale-hash count, which are the rows that say a maintenance job is due. Neither MCRITweb's version nor the backend's was on the page. This shows the versions, puts the rest into a few labelled sections, and drops nothing the backend sends.Change.
statistics_page()(mcritweb/statistics.py:136) turnsgetStatus()'s answer into what the template renders:MCRITWEB_VERSION), the MCRIT backend (backend_version()), the mcrit client library installed next to MCRITweb (mcrit_client_version(),statistics.py:72), and the backend's SMDA. The client library is there becauserequirements.txtonly sets a floor, so it can drift from the backend's version.CORPUS_FIELDS,statistics.py:17).MongoDbStorage._getCurrentTimestampuses on every release from 1.12 on (INDEX_FIELDS,statistics.py:23).MAINTENANCE_COUNTS,statistics.py:35). The meanings are taken from the comments next to each count in mcrit'sMinHashIndex.getStatus: stale MinHashes are redone by Repair stale MinHashes, stale block hashes and stale PicHashes by Recalculate PicHashes, and unrehashable samples cannot be.inline_xcfg_remainingpoints at mcrit'smigrate_xcfg_split, which runs on the backend host. When nothing is due, the section says so.statistics.py:160), so a newer backend is never trimmed again.explore.statistics(mcritweb/views/explore.py:873) passes the status and both versions. It keeps asking for the distinct PicHash count, the client's default: the count is one of the corpus figures, and Count distinct PicHashes for /status from the count index mcrit#282, which answers it frompichash_counts, makes it cheap.backend_version()moves fromviews/administration.pytoviews/client.py:108, unchanged, so the admin server page and this page share it.The page is visitor-level, as before. It shows versions and counts only: no paths, host names, URLs or tokens.
Verification. On the testbed, master (6564602) and this branch as side instances against the same backend, logged in as a visitor, GET only, first with mcrit 1.13.0 and smda 4.9.0, then after upgrading the same corpus to mcrit 1.16.0 and smda 4.11.0:
inline_xcfg_remaining.minhash_compatibility_thresholdand every stale count are not on the page, on both releases./status?with_pichash=True, and/version.check_corpus.py: as in the snapshot.Tests. New
tests/testStatisticsPage.py, with the testbed's status answers under mcrit 1.13.0 and 1.16.0 as captured, and one with 1.16's keys and every maintenance job due:tests/testServerStatus.py: the test that pinned the 12-row cap now checks that every key is shown, and the captured-status test checks the labels.18 of the 23 new or changed tests fail on master.
test_what_the_backend_sends_is_escapedis a guard and passes there too, since master printed the values through autoescaping as well. Full suite with Chromium on e7f4ff6: 2090 passed, 11 skipped;ruff check .clean.Taking out the escaping, the Other list, the above-zero check, the xcfg note, the number formatting, the backend version or the MCRITweb fallback each fails at least one test.
Relation to open PRs. A trial merge (
git merge-tree) with every open PR:statistics.html(the<th>closing tag, alignment classes). It conflicts; this replaces that table, so the resolution is to take this side. Surface, rotate and optionally retire the pre-1.5.0 API tokens (#250) #254 is stacked on Establish UI/UX parity and design consistency across views #253 and conflicts the same way.views/explore.py; the resolution keeps both. Answer a failed backend call with a page, not a stack trace (#43) #130's table lists the statistics page'sgetStatusas degrading on a failed backend, and it still does.pyproject.tomlbut keeps fillingMCRITWEB_VERSION, which is all this reads, so it works unchanged after Release on a tag, with pyproject.toml as the one place the version lives #176.