Hey Chris,
I’m not sure that the code changes will make much sense to you, but here’s the changeset that I put in place to ensure this never happens again: https://github.com/opencredit/badgeos/commit/30c9967ffcaa99abf9ff03d8f23aef6ac350678e
In 1.4 we added a new feature that supports automatically migrating all achievements from one type to another when an achievement-type is renamed (e.g. Changing “Badge” to “Level”). This is a fairly complex process, which is why we never supported it prior to 1.4. While there were already extensive checks in place to make sure something like this wouldn’t happen during the achievement-type renaming process, that condition actually failed in certain cases when a brand new achievement-type was created.
In these instances, when the migration functions were called, the “original achievement type” value would be empty, causing a query for “all posts of this type: ____” to pull back all posts of any type.
The code alterations I linked above are a two-fold measure to make sure this cannot happen again. The first edit is to ensure that there absolutely, positively is an original achievement type post (a hard requirement to verify an existing achievement type is being renamed). The second edit is a backup failsafe to make sure that we absolutely cannot alter the post type of any posts of a core post type (e.g. post, page, menu item, etc).
Michael and I were able to repeatedly reproduce the issue before the patch, and unsuccessful in reproducing it again after the patch.
Hopefully that brings about some clarity as to how and when this bug came to be, and some level of assurance that it’s definitely gone.