fd380f3ae9c678f8e92b4728d5f614a71764fecd
braney
  Tue Sep 1 12:56:18 2026 -0700
trackDbConditions: four fixes found by walking the results against the code, refs #37908

Walking the worklist row by row is what found these; none of them was visible
from the summary counts.

A read wrapped in another call was invisible to the value map, because it
stopped at the first call name.  cloneString(trackDbSetting(...)) and
atoi(cartOrTdbString(...)) are both common.  This is why
hideEmptySubtracksSourcesUrl came back as merely composite-only when it in fact
also needs hideEmptySubtracks and hideEmptySubtracksMultiBedUrl.

A macro in a condition was read as an unknown word, so
cartVarExistsAnyLevel(cart, tdb, FALSE, MAF_CHAIN_VAR) did not resolve.  That
hid the fact that irows is consulted only when mafChain is absent from the cart.
Same indirection trap as the chained defines, in a different place.

The variable-to-setting map kept only the last assignment.
wigFetchMinMaxYWithCart assigns defaultViewLimits from defaultViewLimits and
then, if that came back NULL, from viewLimits, so the test in between looked
like viewLimits testing itself.  It is now resolved at the position of the test,
which turns an artifact into the real finding: viewLimits is read only when
defaultViewLimits is absent.

Two classes of noise removed.  "Read the trackDb value when the cart has none"
is how every setting with a default resolves, and it was a third of the
worklist.  A guard on the trackDb type line having words is a sanity check that
is true of every track, and it was the whole of what the scan had to say about
chainNormScoreAvailable, lollyMaxSize and lollyNoStems.

diff --git src/hg/utils/trackDbConditions/trackDbConditions.py src/hg/utils/trackDbConditions/trackDbConditions.py
index 0c50921b978..7692f814b4d 100755
--- src/hg/utils/trackDbConditions/trackDbConditions.py
+++ src/hg/utils/trackDbConditions/trackDbConditions.py
@@ -208,30 +208,40 @@
             conds.append({"text": cond["text"], "kind": kind, "names": named,
                           "file": cond["file"], "line": cond["line"]})
         used = []
         for cond in read.get("useConds", []):
             if hc.isNoise(cond):
                 continue
             kind, named = classify(cond, accessors, settingNames)
             used.append({"text": cond["text"], "kind": kind, "names": named,
                          "file": cond["file"], "line": cond["line"]})
         entry["sites"].append({"file": read["file"], "line": read["line"],
                                "func": read["func"], "reader": read["reader"],
                                "conds": conds, "used": used})
         if read["callerUnknown"]:
             entry["unknown"] = True
 
+    # "read the trackDb value when the cart has none" is how every setting with a
+    # default resolves.  It is not a condition on the setting, and left in it
+    # accounted for a third of the worklist.
+    for entry in settings.values():
+        for site in entry["sites"]:
+            for field in ("conds", "used"):
+                site[field] = [c for c in site[field]
+                               if not (c["kind"] == OTHER_SETTING
+                                       and c["names"] == [entry["name"]])]
+
     for entry in settings.values():
         perSite = [{condId(c): c for c in s["conds"]} for s in entry["sites"]]
         always, sometimes = {}, {}
         if perSite:
             common = set(perSite[0])
             for one in perSite[1:]:
                 common &= set(one)
             for one in perSite:
                 for cid, cond in one.items():
                     (always if cid in common else sometimes)[cid] = cond
         entry["always"] = sorted(always.values(), key=lambda c: (KIND_ORDER.index(c["kind"]),
                                                                 c["text"]))
         entry["sometimes"] = sorted(sometimes.values(), key=lambda c: (KIND_ORDER.index(c["kind"]),
                                                                       c["text"]))
         perUse = [{condId(c): c for c in s["used"]} for s in entry["sites"] if s["used"]]