It seems like item::has_label() has different behavior if called from within the item class vs outside the item class. In particular it always seems to return false from outside the item class while behaving as expected from within. Pretty sure has_label() is a public member of the item class.
I don’t know if own incompetence or something genuinely off, thought I should say something in case of the latter. I ended up uncertain about the code when I tried inserting has_label() calls into other code which already had an item object it was working with. Still came back false. The debugger I’m using REALLY doesn’t like trying to step into has_label() so I stopped trying.