89f9ce7bc7c9333c45190074088f5bee377ca1d7
braney
  Sat Sep 19 18:30:26 2026 -0700
snapshotTypeTester: check the fast snapshotType reader against raFromString

A saved session is a snapshot when its settings carry a snapshotType line, and
the My Sessions listings hide those rows.  #38313 replaced raFromString with a
walk over the lines, because the question is asked once per row in a listing
and the hash costs about 600ns and three allocations per session against about
30ns and none.

A hand written parser that has to agree with a general one is the shape of bug
found a year later, so this is a differential test: every case is read both
ways and the two answers are printed side by side.  The claim in the code is
"same line semantics as raFromString", and that claim is what is checked rather
than a list of answers written down once.  Reading the tag wrongly is invisible
either way: a snapshot is listed as an ordinary session, or an ordinary session
disappears from the listing, and both look like something the user did.

One case does not agree, and it is recorded rather than hidden.  Given two
snapshotType lines the walk returns the first and raFromString returns the
last, because a hash overwrites.  Real settings carry the tag once, so nothing
depends on it today, but it is a difference in the semantics the code says it
copies.  It is marked as a known difference, and the test also fails if it ever
starts agreeing, so the note cannot go stale in the other direction.

Watched to fail and then pass: dropping the delimiter test after the tag makes
"snapshotTypeExtra view" read as the type "Extra view" while raFromString finds
none.  Recorded as sandbox-ab in utils/testRegistry.

refs #38313, refs #38391

diff --git src/hg/lib/tests/makefile src/hg/lib/tests/makefile
index fd8208fb8b3..9351b8b41cd 100644
--- src/hg/lib/tests/makefile
+++ src/hg/lib/tests/makefile
@@ -13,31 +13,32 @@
 	${BIN_DIR}/quickLiftTester \
 	${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 spDbTest hdbTest genePredTest pslReaderTest customTrackTest hgvsTest
+	hVarSubstHtmlTest dataVersionPathTest genarkLiftOverTest \
+	snapshotTypeTest 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
@@ -123,21 +124,26 @@
 hVarSubstHtmlTest: mkdirs
 	${CC} ${CC_PROG_OPTS} -o ${BIN_DIR}/hVarSubstHtmlTester hVarSubstHtmlTester.c ${MYLIBS} $L
 	${BIN_DIR}/hVarSubstHtmlTester > output/hVarSubstHtmlTest
 	diff expected/hVarSubstHtmlTest output/hVarSubstHtmlTest
 
 dataVersionPathTest: mkdirs
 	${CC} ${CC_PROG_OPTS} -o ${BIN_DIR}/dataVersionPathTester dataVersionPathTester.c ${MYLIBS} $L
 	${BIN_DIR}/dataVersionPathTester > output/dataVersionPathTest
 	diff expected/dataVersionPathTest output/dataVersionPathTest
 
 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
+
 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