91008f116877a4ac9de458dec4abb98ca3249dbf
braney
  Wed Sep 23 17:15:55 2026 -0700
docent status page: try-it links for sessions loaded by URL, none on hgwbeta for named ones, refs #38252

A named session lives in one machine's hgcentral, so its hgwbeta link only answered
"Could not find session"; those rows now offer genome-test alone and say why.  A
session loaded from a text file by URL works on any server, so a script that loads one
now gets a link, with both servers.

diff --git src/hg/utils/docent/tests/regress/nightlyStatus.py src/hg/utils/docent/tests/regress/nightlyStatus.py
index 1bf1cd7d074..686ebe6135e 100755
--- src/hg/utils/docent/tests/regress/nightlyStatus.py
+++ src/hg/utils/docent/tests/regress/nightlyStatus.py
@@ -146,59 +146,65 @@
     extra = '&'.join(f'{k}={enc(x)}' for k, x in v.items())
     url = base + ('&' if '?' in base else '?') + extra if extra else base
     url = url.replace('&&', '&').rstrip('&')
     if url.startswith('/cgi-bin/hgTracks') and 'pix=' not in url:
         url += '&' + PIX
     return url
 
 
 def candidates(yamlPath, doc):
     """One URL per expect: step that a single request can reach, in step order."""
     db = doc.get('db') or 'hg38'
     pos = doc.get('position')
     steps = doc.get('steps') or []
     nExpect = sum(norm(s)[0] == 'expect' for s in steps)
     base, cgiVars, tracks, cands, seen, stop = None, {}, None, [], 0, None
+    session = False
     for i, s in enumerate(steps, 1):
         verb, arg = norm(s)
         if verb == 'expect':
             seen += 1
             cands.append({'url': urlOf(db, pos, base, cgiVars), 'reached': seen,
+                          'session': session,
                           'expect': arg if isinstance(arg, dict) else {}})
             continue
         if verb in PASSIVE:
             continue
         if verb == 'go':
             if arg is True:
                 continue
             pos, base = arg, None
         elif verb == 'goto':
             base, cgiVars = str(arg), {}
         elif verb == 'hide' and arg in ('all', True):
             cgiVars['hideTracks'] = '1'
         elif verb == 'track' and isinstance(arg, dict):
             if tracks is None:
                 tracks = derive(yamlPath)
             cgiVars.update(tracks.get(i, {}))
         elif verb == 'hub':
             o = arg if isinstance(arg, dict) else {'url': arg}
             cgiVars['hubUrl'] = o['url']
             db = o.get('db', db)
             pos = o.get('position', pos)
         elif verb == 'loadSession' and isinstance(arg, dict) and arg.get('user'):
             cgiVars.update({'hgS_doOtherUser': 'submit', 'hgS_otherUserName': arg['user'],
                             'hgS_otherUserSessionName': arg.get('name')})
+            session = True
+        elif verb == 'loadSession' and isinstance(arg, str) and re.match(r'https?://', arg):
+            # A session file by URL (sessionFiles/), which any server can load.
+            cgiVars.update({'hgS_doLoadUrl': 'submit', 'hgS_loadUrlName': arg})
         else:
             stop = verb
             break
     for c in cands:
         c['total'], c['stop'] = nExpect, stop
     if not cands:
         return None, (f'"{stop}:" comes before the first check' if stop
                       else 'it has no expect: step')
     return cands, None
 
 
 def verify(c):
     """Fetch with a fresh cart and look for what the expect: step names."""
     exp = c.pop('expect')
     rows = exp.get('rows') or []
@@ -225,30 +231,36 @@
     if cands is None:
         return {'reason': why}
     last = None
     for c in reversed(cands):
         last = verify(c)
         if last['ok'] is not False:
             return last
     return last
 
 
 def tryIt(name, r):
     e = html.escape
     if 'url' not in r:
         return f'<span class="note">Run the script: {e(r["reason"])}.</span>'
     u = e(r['url'])
+    # A saved session lives in one machine's central, and hgwbeta reads a different one,
+    # so a link that loads one would only answer "Could not find session" there.
+    if r.get('session'):
+        links = f'<a href="{TEST}{u}">genome-test</a> <span class="note">(a saved ' \
+                f'session, so not on hgwbeta)</span>'
+    else:
         links = f'<a href="{TEST}{u}">genome-test</a> ยท <a href="{BETA}{u}">hgwbeta</a>'
     n, m = r['reached'], r['total']
     if n == m:
         reach = f'Reaches the last check ({n} of {m}).'
     elif r.get('stop'):
         reach = f'Reaches check {n} of {m}. Then "{e(r["stop"])}:" needs the browser UI.'
     else:
         reach = f'Reaches check {n} of {m}. Later checks need more than one request.'
     if name.endswith('.xfail'):
         return f'{links}<div class="note">Shows the open bug. The fix is not on ' \
                f'genome-test yet.</div>'
     if r['ok'] is True:
         return f'{links}<div class="note">{reach} Verified on genome-test.</div>'
     if r['ok'] is False:
         return '<span class="note">Run the script: one URL does not rebuild what its ' \