Easy first: there's a comment in the code about cloning the buf delete term hash with a clear vs. copying the reference and creating a new hash. I've gone back and forth. I don't have a strong opinion.
I did notice that every call to startTransaction had flushed the deletes ahead but I didn't see that it was required to be so. I can go either way on this, too. I'd vote for making startTransaction safer. I think, in theory, it could be opened to users at some point, if it were to help people trying to use Lucene in certain transactional contexts.
Of course, that violates YAGNI.
But I hadn't looked at the ram segments. Does look like if there are any at the start of a trans. and they get flushed, they would/might get lost? Since that touches on the index file deleter, it strikes me as more complex.