3c814b674f49f9a30d4b8d227e0fe7061a18766a
braney
Tue Sep 1 09:21:28 2026 -0700
registryPages: correlate the trackDb settings docs with the cart, refs #37908 #37838
Two files in the tree say which track types a setting applies to, and they were
written from different evidence. trackDbLibrary.shtml carries a hand-written
types list per setting, which is what #37908 has been correcting.
cartTrackVarCatalog files each cart variable under the config function that
reads it and records the trackDb types that function serves, which came from
reading hui.c and the per-type Ui functions.
Where a trackDb setting and a cart variable are the same knob, the two are
answering the same question, so they can be compared. 60 of the 261 documented
settings have a runtime override. 46 of those pairs are comparable, 12 agree
exactly, and 28 have a type the config code serves that the docs do not list.
The output is a candidate list, not a verdict, and the page says so. Two known
false-positive shapes are called out on it: a variable read by two config
functions collects the types of both, and a pair joined by tdbDefault rather
than by name is weaker evidence, so those are reported separately.
Also factors the palette and the shared reset out of venn.css and index.css
into tokens.css, since a third page now needs them.
diff --git src/hg/utils/registryPages/registryPages.py src/hg/utils/registryPages/registryPages.py
index 024479459e3..ee67bab65f5 100755
--- src/hg/utils/registryPages/registryPages.py
+++ src/hg/utils/registryPages/registryPages.py
@@ -29,59 +29,65 @@
that needs a person to read a call site. See KNOWN_SHARED in registryData.py.
--audit runs sessionCartAudit, which needs the database and takes about fifteen
seconds. Without it the pages leave out the one paragraph that talks about real
saved sessions.
"""
import argparse
import datetime
import html
import os
import sys
sys.path.insert(0, os.path.dirname(os.path.abspath(__file__)))
import registryData as rd # noqa: E402
+import trackDbData as td # noqa: E402
NUM_WORD = {0: "no", 1: "one", 2: "two", 3: "three", 4: "four", 5: "five", 6: "six",
7: "seven", 8: "eight", 9: "nine", 10: "ten", 11: "eleven", 12: "twelve",
13: "thirteen", 14: "fourteen", 15: "fifteen", 16: "sixteen",
17: "seventeen", 18: "eighteen", 19: "nineteen", 20: "twenty"}
def word(n):
"""Small numbers read better spelled out in a sentence."""
return NUM_WORD.get(n, "{:,}".format(n))
def esc(s):
return html.escape(s, quote=False)
def shortPath(path):
"""Write a path under the user's home as ~/... so provenance is readable."""
home = os.path.expanduser("~")
return "~" + path[len(home):] if path.startswith(home + os.sep) else path
def asset(name):
"""Read one of the stylesheet or script files that sits next to this one."""
with open(os.path.join(os.path.dirname(os.path.abspath(__file__)), name)) as f:
return f.read().rstrip("\n")
+def style(name):
+ """The shared tokens plus one page's own rules, as a single stylesheet."""
+ return asset("tokens.css") + "\n\n" + asset(name)
+
+
# ============================================================ the Venn page ==
# Four congruent ellipses in the classic four-set arrangement: two rotated one
# way, two the other, so all fifteen regions exist. Order matters, and it is
# the order in rd.REG_ORDER: the two outer ellipses are the first and last.
ELLIPSES = {
"track": (350, 418, 360, 225, -140),
"url": (450, 318, 360, 225, -140),
"file": (544, 318, 360, 225, -40),
"conf": (644, 418, 360, 225, -40),
}
VIEWBOX = (1000, 730)
# Where each region's label goes. Found by rasterizing the four ellipses and
@@ -258,31 +264,31 @@
return ("
No name is spelled the same way in two registries while meaning two "
"different variables.
")
lines = []
for name, where in coll:
keys = [k for k in rd.REG_ORDER if k in where]
lines.append("%s is %s" % (esc(name), " and ".join(
"%s in the %s" % (", ".join("%s" % esc(v) for v in where[k]),
esc(REG_PHRASE[k])) for k in keys)))
return ("
%s %s in two registries and mean two different variables. They are "
"counted as separate names above.
\n
%s.
"
% (word(len(coll)).capitalize(),
"spelling appears" if len(coll) == 1 else "spellings appear",
". ".join(lines)))
-def vennPage(regs, counts, shared, coll, baseline, audit, indexName, today):
+def vennPage(regs, counts, shared, coll, baseline, audit, indexName, corrName, today):
"""The whole Venn page."""
byKey = {r["key"]: r for r in regs}
total = sum(counts.values())
rowTotal = sum(r["rows"] for r in regs)
alone = sum(n for r, n in counts.items() if len(r) == 1)
nShared = total - alone
track = byKey["track"]
prefixes = next(g for g in track["groups"] if g["title"].endswith("the track name"))
exceptions = next((g for g in track["groups"]
if g["title"].startswith("Exceptions")), {"rows": []})
plain = track["rows"] - len(prefixes["rows"]) - len(exceptions["rows"])
confShared = sorted(n for n, keys in shared.items() if "conf" in keys)
if confShared == ["textSize"]:
@@ -386,61 +392,63 @@
%(urlBaseline)d URL names and %(trackBaseline)d cart variable names are recorded in the
baseline files as out of scope. Those files were accepted wholesale on the day they were
written, so a name being in one is not evidence that anybody reviewed it.
Global cart variables, the ones scoped to no track, have no registry at all.
textSize is one of them, which is why it enters the picture through the URL
registry rather than a cart one.
%(auditPara)s
""" % {
- "css": asset("venn.css"),
+ "css": style("venn.css"),
"today": today,
"tree": esc(shortPath(rd.kentSrc())),
"svg": "\n".join(" " + line for line in vennSvg(regs, counts).splitlines()),
"rowTotal": "{:,}".format(rowTotal),
"total": "{:,}".format(total),
"alone": "{:,}".format(alone),
"sharedWord": word(nShared),
"plain": plain,
"prefixes": len(prefixes["rows"]),
"exceptions": len(exceptions["rows"]),
"slivers": sliverList(regs, shared),
"table": regionTable(regs, counts),
"nRegions": word(len(REGION_LABEL)),
"emptyWord": word(sum(1 for r in REGION_LABEL if not counts.get(r, 0))).capitalize(),
"fullWord": word(sum(1 for r in REGION_LABEL
if counts.get(r, 0) and len(r) > 1)),
"collisions": collisionNote(coll),
"confNames": len(byKey["conf"]["names"]),
"confShared": word(len(confShared)),
"confExcept": confExcept,
"urlBaseline": baseline["url"],
"trackBaseline": baseline["track"],
"auditPara": auditPara,
"indexName": esc(indexName),
+ "corrName": esc(corrName),
"footRegs": " · ".join("%s #%s" % (r["tool"], r["ticket"]) for r in regs),
}
# =========================================================== the index page ==
def sortKey(name):
"""Sort a name by the part that varies, setting the shared