A debug assertion that was added in order to catch corruption that was reported in MDEV-17983 turns out to be bogus. In the test innodb_gis.rtree_compress,4k, the function is sometimes being invoked by purge for a spatial index root page that is not a leaf page (PAGE_LEVEL is 1). The assertion should be relaxed as follows:
That is, if the page is a leftmost non-leaf page, it may carry a record where the flag is set.
I observed the failure on 10.5, but the assertion was introduced in 10.2.