783eee083cb8f18c4235ce6655e0f6bc18c09d5e
max
  Thu Apr 24 04:48:00 2025 -0700
making hgcentraltidy more aggressive for single use userDb rows, refs #35554

diff --git src/hg/lib/cart.c src/hg/lib/cart.c
index f139f6a88c8..2ee3f9e6cf9 100644
--- src/hg/lib/cart.c
+++ src/hg/lib/cart.c
@@ -1433,36 +1433,42 @@
 netSetTimeoutErrorMsg("A connection timeout means that either the server is offline or its firewall, the UCSC firewall or any router between the two blocks the connection.");
 
 
 struct cart *cart;
 struct sqlConnection *conn = cartDefaultConnector();
 char *ex;
 boolean userIdFound = FALSE, sessionIdFound = FALSE;
 
 AllocVar(cart);
 cart->hash = newHash(12);
 cart->exclude = newHash(7);
 cart->userId = userId;
 cart->sessionId = sessionId;
 cart->userInfo = loadDb(conn, userDbTable(), userId, &userIdFound);
 cart->sessionInfo = loadDb(conn, sessionDbTable(), sessionId, &sessionIdFound);
+
+if (isEmpty(userId))
+    fprintf(stderr, "CART userId not sent");
+
 if (sessionIdFound)
     cartParseOverHash(cart, cart->sessionInfo->contents);
 else if (userIdFound)
     cartParseOverHash(cart, cart->userInfo->contents);
 else
     {
+    if (isNotEmpty(userId))
+        fprintf(stderr, "CART userId sent but not in userDb");
     char *defaultCartContents = getDefaultCart(conn);
     cartParseOverHash(cart, defaultCartContents);
     }
 char when[1024];
 safef(when, sizeof(when), "open %s %s", userId, sessionId);
 cartTrace(cart, when, conn);
 
 loadCgiOverHash(cart, oldVars);
 
 fixUpDb(cart); // now is the time to see if someone is loading a Genark hub or specified a bad database.
 
 // I think this is the place to justify old and new values
 cartJustify(cart, oldVars);
 
 #ifndef GBROWSE