36977d0e699d3c853840f08cec63ab2a2dd5eaa7
braney
  Sat Sep 19 18:34:00 2026 -0700
geoMirrorSelfTester: pin which gbNode row a server takes for itself

The browser runs on several machines and each offers the others in a menu, so
it has to know which gbNode row is itself.  It used to answer from browser.node
in hg.conf alone, so a machine serving a node other than the one browser.node
names -- a sandbox, or two nodes behind one apache -- took itself for its own
peer and offered the visitor a link to the site they were already on.  #27988
made the host the visitor typed decide whenever that host is one of the nodes,
with browser.node as the fallback.

The symptom is invisible in the way that matters: every page renders, and a
menu entry pointing back at itself reads as a mirror being down rather than as
a bug.

No domain is named here.  gbNode is configuration data whose rows change, so
the test reads two rows, points browser.node at the first, and asks whether the
second can claim the server.  What is printed is which of the two answered, not
what they are called, and the port case is included because HTTP_HOST carries
one whenever it is not 80 or 443.

Also recorded in utils/testRegistry: what blocks a unit test on the fifteen
v504 tickets still waiting for one, each with its own reason rather than a
category, since the reason decides who can unblock it.

Watched to fail and then pass: with the host test removed the server claims no
node at all and offers all three, itself included.  Recorded as sandbox-ab.

refs #27988, refs #38391

diff --git src/hg/lib/tests/makefile src/hg/lib/tests/makefile
index 92734650e16..7d40158e230 100644
--- src/hg/lib/tests/makefile
+++ src/hg/lib/tests/makefile
@@ -14,31 +14,31 @@
 	${BIN_DIR}/sessionDataTester \
 	${BIN_DIR}/trashDirTester \
 #	${BIN_DIR}/annoGratorTester \
 	${BIN_DIR}/binTest \
 	${BIN_DIR}/customTrackTester \
 	${BIN_DIR}/hgvsTester \
 	${BIN_DIR}/sqlCheck 
 
 ${BIN_DIR}/%: %.c ${MYLIBS}
 	@${MKDIR} ${BIN_DIR}
 	${CC} ${CC_PROG_OPTS} -o $@ $*.c ${MYLIBS} $L
 
 #test: binTest spDbTest hdbTest genePredTest pslReaderTest annoGratorTest customTrackTest hgvsTest
 test: binTest quickLiftTest sessionDataTest trashDirTest mallocTopPadTest bedItemRgbTest \
 	hVarSubstHtmlTest dataVersionPathTest genarkLiftOverTest \
-	snapshotTypeTest sessionDirTest spDbTest hdbTest genePredTest pslReaderTest customTrackTest hgvsTest
+	snapshotTypeTest sessionDirTest geoMirrorSelfTest spDbTest hdbTest genePredTest pslReaderTest customTrackTest hgvsTest
 	rm -r output
 	echo tested all
 
 mkdirs:
 	@${MKDIR} output ${BIN_DIR}
 
 loaders:
 	ln -sf ${CGI_BIN}/loader .
 
 spDbTest: ${BIN_DIR}/spDbTest mkdirs
 	${BIN_DIR}/spDbTest sp121210 Q9FFH7 > output/spDbTest
 	${BIN_DIR}/spDbTest sp121210 P29312 >> output/spDbTest
 	diff expected/spDbTest output/spDbTest
 
 hdbTest: ${BIN_DIR}/hdbTest mkdirs
@@ -134,21 +134,30 @@
 genarkLiftOverTest: mkdirs
 	${CC} ${CC_PROG_OPTS} -o ${BIN_DIR}/genarkLiftOverTester genarkLiftOverTester.c ${MYLIBS} $L
 	${BIN_DIR}/genarkLiftOverTester > output/genarkLiftOverTest
 	diff expected/genarkLiftOverTest output/genarkLiftOverTest
 
 snapshotTypeTest: mkdirs
 	${CC} ${CC_PROG_OPTS} -o ${BIN_DIR}/snapshotTypeTester snapshotTypeTester.c ${MYLIBS} $L
 	${BIN_DIR}/snapshotTypeTester > output/snapshotTypeTest
 	diff expected/snapshotTypeTest output/snapshotTypeTest
 
 sessionDirTest: mkdirs
 	${CC} ${CC_PROG_OPTS} -o ${BIN_DIR}/sessionDirTester sessionDirTester.c ${MYLIBS} $L
 	${BIN_DIR}/sessionDirTester > output/sessionDirTest
 	diff expected/sessionDirTest output/sessionDirTest
 
+# browser.node is set in the conf rather than assumed, since a developer's own hg.conf need
+# not have one.
+geoMirrorSelfTest: mkdirs
+	${CC} ${CC_PROG_OPTS} -o ${BIN_DIR}/geoMirrorSelfTester geoMirrorSelfTester.c ${MYLIBS} $L
+	echo "include ${HOME}/.hg.conf" > output/geoNode.conf
+	echo "browser.node=1" >> output/geoNode.conf
+	HGDB_CONF=output/geoNode.conf ${BIN_DIR}/geoMirrorSelfTester > output/geoMirrorSelfTest
+	diff expected/geoMirrorSelfTest output/geoMirrorSelfTest
+
 sqlCheck: ${BIN_DIR}/sqlCheck mkdirs
 	${MAKE} -f sqlCheck.mk test BIN_DIR=${BIN_DIR} OUT_DIR=output
 
 
 clean:
 	rm -rf *.o bin output *.tmp loader udcCache